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

net.anotheria.anosite.gen.assiteconfig.data.ModuleASSiteConfig Maven / Gradle / Ivy

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


	public static final String MODULE_ID = "assiteconfig";

	public static final String LIST_FILTEREDIP = "list_filteredip";
	public static final String ID_HOLDER_FILTEREDIP = IDHolder.DOC_ID_HOLDER_PRE+"filteredip";

	public ModuleASSiteConfig(){
		super(MODULE_ID);
	}

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

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

	public List getFilteredIPs(){
		return _getFilteredIPs().getList();
	}

	public FilteredIPDocument getFilteredIP(String id){
		return _getFilteredIPs().getDocumentById(id);
	}

	public void updateFilteredIP(FilteredIPDocument filteredip){
		DocumentList filteredips = _getFilteredIPs();
		filteredips.removeDocumentById(filteredip.getId());
		filteredip.setLastUpdateNow();
		filteredip.setCallContextAuthor();
		filteredips.addDocument(filteredip);
		_updateFilteredIPs(filteredips);
	}

	public void deleteFilteredIP(String id){
		DocumentList entries = _getFilteredIPs();
		entries.removeDocumentById(id);
		_updateFilteredIPs(entries);
	}

	public FilteredIPDocument createFilteredIP(FilteredIPDocument filteredip ){
		IDHolder idh = _getIdHolder(ID_HOLDER_FILTEREDIP);
		int id = idh.getNextIdInt();
		filteredip.renameTo(""+id);
		putDocument(idh);

		DocumentList entries = _getFilteredIPs();
		filteredip.setLastUpdateNow();
		filteredip.setCallContextAuthor();
		entries.addDocument(filteredip);
		_updateFilteredIPs(entries);
		return filteredip;
	}

	public FilteredIPDocument importFilteredIP(FilteredIPDocument filteredip ){
		IDHolder idh = _getIdHolder(ID_HOLDER_FILTEREDIP);
		idh.adjustTill(filteredip.getId());
		putDocument(idh);

		DocumentList entries = _getFilteredIPs();
		filteredip.setLastUpdateNow();
		filteredip.setCallContextAuthor();
		entries.addDocument(filteredip);
		_updateFilteredIPs(entries);
		return filteredip;
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy