net.anotheria.anosite.gen.asgenericaction.data.ModuleASGenericAction Maven / Gradle / Ivy
/**
********************************************************************************
*** ModuleASGenericAction.java ***
*** generated by AnoSiteGenerator (ASG), Version: 1.3.3 ***
*** Copyright (C) 2005 - 2010 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.asgenericaction.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 ModuleASGenericAction extends Module{
public static final String MODULE_ID = "asgenericaction";
public static final String LIST_GENERICACTIONDEF = "list_genericactiondef";
public static final String ID_HOLDER_GENERICACTIONDEF = IDHolder.DOC_ID_HOLDER_PRE+"genericactiondef";
public ModuleASGenericAction(){
super(MODULE_ID);
}
@SuppressWarnings("unchecked")
private DocumentList _getGenericActionDefs(){
try{
return getList(LIST_GENERICACTIONDEF);
}catch(NoSuchDocumentListException e){
return new DocumentList(LIST_GENERICACTIONDEF);
}
}
private void _updateGenericActionDefs(DocumentList list){
putList(list);
}
public List getGenericActionDefs(){
return _getGenericActionDefs().getList();
}
public GenericActionDefDocument getGenericActionDef(String id){
return _getGenericActionDefs().getDocumentById(id);
}
public void updateGenericActionDef(GenericActionDefDocument genericactiondef){
DocumentList genericactiondefs = _getGenericActionDefs();
genericactiondefs.removeDocumentById(genericactiondef.getId());
genericactiondef.setLastUpdateNow();
genericactiondef.setCallContextAuthor();
genericactiondefs.addDocument(genericactiondef);
_updateGenericActionDefs(genericactiondefs);
}
public void deleteGenericActionDef(String id){
DocumentList entries = _getGenericActionDefs();
entries.removeDocumentById(id);
_updateGenericActionDefs(entries);
}
public GenericActionDefDocument createGenericActionDef(GenericActionDefDocument genericactiondef ){
IDHolder idh = _getIdHolder(ID_HOLDER_GENERICACTIONDEF);
int id = idh.getNextIdInt();
genericactiondef.renameTo(""+id);
putDocument(idh);
DocumentList entries = _getGenericActionDefs();
genericactiondef.setLastUpdateNow();
genericactiondef.setCallContextAuthor();
entries.addDocument(genericactiondef);
_updateGenericActionDefs(entries);
return genericactiondef;
}
public GenericActionDefDocument importGenericActionDef(GenericActionDefDocument genericactiondef ){
IDHolder idh = _getIdHolder(ID_HOLDER_GENERICACTIONDEF);
idh.adjustTill(genericactiondef.getId());
putDocument(idh);
DocumentList entries = _getGenericActionDefs();
genericactiondef.setLastUpdateNow();
genericactiondef.setCallContextAuthor();
entries.addDocument(genericactiondef);
_updateGenericActionDefs(entries);
return genericactiondef;
}
}