All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.anotheria.anosite.gen.asgenericaction.data.ModuleASGenericAction Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** 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;
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy