net.anotheria.anosite.gen.aswebdata.data.ModuleASWebData Maven / Gradle / Ivy
/**
********************************************************************************
*** ModuleASWebData.java ***
*** generated by AnoSiteGenerator (ASG), Version: 3.2.2 ***
*** Copyright (C) 2005 - 2023 Anotheria.net, www.anotheria.net ***
*** All Rights Reserved. ***
********************************************************************************
*** Don't edit this code, if you aren't sure ***
*** that you do exactly know what you are doing! ***
*** It's better to invest time in the generator, as into the generated code. ***
********************************************************************************
*/
package net.anotheria.anosite.gen.aswebdata.data;
import net.anotheria.anodoc.data.Module;
import net.anotheria.anodoc.data.DocumentList;
import net.anotheria.anodoc.data.IDHolder;
import net.anotheria.anodoc.data.NoSuchDocumentListException;
import java.util.List;
public class ModuleASWebData extends Module{
public static final String MODULE_ID = "aswebdata";
public static final String LIST_PAGEX = "list_pagex";
public static final String ID_HOLDER_PAGEX = IDHolder.DOC_ID_HOLDER_PRE+"pagex";
public static final String LIST_BOX = "list_box";
public static final String ID_HOLDER_BOX = IDHolder.DOC_ID_HOLDER_PRE+"box";
public static final String LIST_ATTRIBUTE = "list_attribute";
public static final String ID_HOLDER_ATTRIBUTE = IDHolder.DOC_ID_HOLDER_PRE+"attribute";
public ModuleASWebData(){
super(MODULE_ID);
}
@SuppressWarnings("unchecked")
private DocumentList _getPagexs(){
try{
return getList(LIST_PAGEX);
}catch(NoSuchDocumentListException e){
return new DocumentList(LIST_PAGEX);
}
}
private void _updatePagexs(DocumentList list){
putList(list);
}
public List getPagexs(){
return _getPagexs().getList();
}
public PagexDocument getPagex(String id){
return _getPagexs().getDocumentById(id);
}
public void updatePagex(PagexDocument pagex){
DocumentList pagexs = _getPagexs();
pagexs.removeDocumentById(pagex.getId());
pagex.setLastUpdateNow();
pagex.setCallContextAuthor();
pagexs.addDocument(pagex);
_updatePagexs(pagexs);
}
public void deletePagex(String id){
DocumentList entries = _getPagexs();
entries.removeDocumentById(id);
_updatePagexs(entries);
}
public PagexDocument createPagex(PagexDocument pagex ){
IDHolder idh = _getIdHolder(ID_HOLDER_PAGEX);
int id = idh.getNextIdInt();
pagex.renameTo(""+id);
putDocument(idh);
DocumentList entries = _getPagexs();
pagex.setLastUpdateNow();
pagex.setCallContextAuthor();
entries.addDocument(pagex);
_updatePagexs(entries);
return pagex;
}
public PagexDocument importPagex(PagexDocument pagex ){
IDHolder idh = _getIdHolder(ID_HOLDER_PAGEX);
idh.adjustTill(pagex.getId());
putDocument(idh);
DocumentList entries = _getPagexs();
pagex.setLastUpdateNow();
pagex.setCallContextAuthor();
entries.addDocument(pagex);
_updatePagexs(entries);
return pagex;
}
@SuppressWarnings("unchecked")
private DocumentList _getBoxs(){
try{
return getList(LIST_BOX);
}catch(NoSuchDocumentListException e){
return new DocumentList(LIST_BOX);
}
}
private void _updateBoxs(DocumentList list){
putList(list);
}
public List getBoxs(){
return _getBoxs().getList();
}
public BoxDocument getBox(String id){
return _getBoxs().getDocumentById(id);
}
public void updateBox(BoxDocument box){
DocumentList boxs = _getBoxs();
boxs.removeDocumentById(box.getId());
box.setLastUpdateNow();
box.setCallContextAuthor();
boxs.addDocument(box);
_updateBoxs(boxs);
}
public void deleteBox(String id){
DocumentList entries = _getBoxs();
entries.removeDocumentById(id);
_updateBoxs(entries);
}
public BoxDocument createBox(BoxDocument box ){
IDHolder idh = _getIdHolder(ID_HOLDER_BOX);
int id = idh.getNextIdInt();
box.renameTo(""+id);
putDocument(idh);
DocumentList entries = _getBoxs();
box.setLastUpdateNow();
box.setCallContextAuthor();
entries.addDocument(box);
_updateBoxs(entries);
return box;
}
public BoxDocument importBox(BoxDocument box ){
IDHolder idh = _getIdHolder(ID_HOLDER_BOX);
idh.adjustTill(box.getId());
putDocument(idh);
DocumentList entries = _getBoxs();
box.setLastUpdateNow();
box.setCallContextAuthor();
entries.addDocument(box);
_updateBoxs(entries);
return box;
}
@SuppressWarnings("unchecked")
private DocumentList _getAttributes(){
try{
return getList(LIST_ATTRIBUTE);
}catch(NoSuchDocumentListException e){
return new DocumentList(LIST_ATTRIBUTE);
}
}
private void _updateAttributes(DocumentList list){
putList(list);
}
public List getAttributes(){
return _getAttributes().getList();
}
public AttributeDocument getAttribute(String id){
return _getAttributes().getDocumentById(id);
}
public void updateAttribute(AttributeDocument attribute){
DocumentList attributes = _getAttributes();
attributes.removeDocumentById(attribute.getId());
attribute.setLastUpdateNow();
attribute.setCallContextAuthor();
attributes.addDocument(attribute);
_updateAttributes(attributes);
}
public void deleteAttribute(String id){
DocumentList entries = _getAttributes();
entries.removeDocumentById(id);
_updateAttributes(entries);
}
public AttributeDocument createAttribute(AttributeDocument attribute ){
IDHolder idh = _getIdHolder(ID_HOLDER_ATTRIBUTE);
int id = idh.getNextIdInt();
attribute.renameTo(""+id);
putDocument(idh);
DocumentList entries = _getAttributes();
attribute.setLastUpdateNow();
attribute.setCallContextAuthor();
entries.addDocument(attribute);
_updateAttributes(entries);
return attribute;
}
public AttributeDocument importAttribute(AttributeDocument attribute ){
IDHolder idh = _getIdHolder(ID_HOLDER_ATTRIBUTE);
idh.adjustTill(attribute.getId());
putDocument(idh);
DocumentList entries = _getAttributes();
attribute.setLastUpdateNow();
attribute.setCallContextAuthor();
entries.addDocument(attribute);
_updateAttributes(entries);
return attribute;
}
}