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

net.anotheria.anosite.gen.asuserdata.data.ModuleASUserData Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** ModuleASUserData.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.asuserdata.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 ModuleASUserData extends Module{


	public static final String MODULE_ID = "asuserdata";

	public static final String LIST_USERDEF = "list_userdef";
	public static final String ID_HOLDER_USERDEF = IDHolder.DOC_ID_HOLDER_PRE+"userdef";
	public static final String LIST_ROLEDEF = "list_roledef";
	public static final String ID_HOLDER_ROLEDEF = IDHolder.DOC_ID_HOLDER_PRE+"roledef";

	public ModuleASUserData(){
		super(MODULE_ID);
	}

	@SuppressWarnings("unchecked")
	private DocumentList _getUserDefs(){
		try{
			return getList(LIST_USERDEF);
		}catch(NoSuchDocumentListException e){
			return new DocumentList(LIST_USERDEF);
		}
	}

	private void _updateUserDefs(DocumentList list){
		putList(list);
	}

	public List getUserDefs(){
		return _getUserDefs().getList();
	}

	public UserDefDocument getUserDef(String id){
		return _getUserDefs().getDocumentById(id);
	}

	public void updateUserDef(UserDefDocument userdef){
		DocumentList userdefs = _getUserDefs();
		userdefs.removeDocumentById(userdef.getId());
		userdef.setLastUpdateNow();
		userdef.setCallContextAuthor();
		userdefs.addDocument(userdef);
		_updateUserDefs(userdefs);
	}

	public void deleteUserDef(String id){
		DocumentList entries = _getUserDefs();
		entries.removeDocumentById(id);
		_updateUserDefs(entries);
	}

	public UserDefDocument createUserDef(UserDefDocument userdef ){
		IDHolder idh = _getIdHolder(ID_HOLDER_USERDEF);
		int id = idh.getNextIdInt();
		userdef.renameTo(""+id);
		putDocument(idh);

		DocumentList entries = _getUserDefs();
		userdef.setLastUpdateNow();
		userdef.setCallContextAuthor();
		entries.addDocument(userdef);
		_updateUserDefs(entries);
		return userdef;
	}

	public UserDefDocument importUserDef(UserDefDocument userdef ){
		IDHolder idh = _getIdHolder(ID_HOLDER_USERDEF);
		idh.adjustTill(userdef.getId());
		putDocument(idh);

		DocumentList entries = _getUserDefs();
		userdef.setLastUpdateNow();
		userdef.setCallContextAuthor();
		entries.addDocument(userdef);
		_updateUserDefs(entries);
		return userdef;
	}


	@SuppressWarnings("unchecked")
	private DocumentList _getRoleDefs(){
		try{
			return getList(LIST_ROLEDEF);
		}catch(NoSuchDocumentListException e){
			return new DocumentList(LIST_ROLEDEF);
		}
	}

	private void _updateRoleDefs(DocumentList list){
		putList(list);
	}

	public List getRoleDefs(){
		return _getRoleDefs().getList();
	}

	public RoleDefDocument getRoleDef(String id){
		return _getRoleDefs().getDocumentById(id);
	}

	public void updateRoleDef(RoleDefDocument roledef){
		DocumentList roledefs = _getRoleDefs();
		roledefs.removeDocumentById(roledef.getId());
		roledef.setLastUpdateNow();
		roledef.setCallContextAuthor();
		roledefs.addDocument(roledef);
		_updateRoleDefs(roledefs);
	}

	public void deleteRoleDef(String id){
		DocumentList entries = _getRoleDefs();
		entries.removeDocumentById(id);
		_updateRoleDefs(entries);
	}

	public RoleDefDocument createRoleDef(RoleDefDocument roledef ){
		IDHolder idh = _getIdHolder(ID_HOLDER_ROLEDEF);
		int id = idh.getNextIdInt();
		roledef.renameTo(""+id);
		putDocument(idh);

		DocumentList entries = _getRoleDefs();
		roledef.setLastUpdateNow();
		roledef.setCallContextAuthor();
		entries.addDocument(roledef);
		_updateRoleDefs(entries);
		return roledef;
	}

	public RoleDefDocument importRoleDef(RoleDefDocument roledef ){
		IDHolder idh = _getIdHolder(ID_HOLDER_ROLEDEF);
		idh.adjustTill(roledef.getId());
		putDocument(idh);

		DocumentList entries = _getRoleDefs();
		roledef.setLastUpdateNow();
		roledef.setCallContextAuthor();
		entries.addDocument(roledef);
		_updateRoleDefs(entries);
		return roledef;
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy