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

it.cnr.contab.config00.bp.CRUDClassificazioneVociBP Maven / Gradle / Ivy

/*
 * Copyright (C) 2019  Consiglio Nazionale delle Ricerche
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Affero General Public License as
 *     published by the Free Software Foundation, either version 3 of the
 *     License, or (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Affero General Public License for more details.
 *
 *     You should have received a copy of the GNU Affero General Public License
 *     along with this program.  If not, see .
 */

/*
 * Created on Apr 12, 2005
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package it.cnr.contab.config00.bp;

import java.rmi.RemoteException;
import java.util.Enumeration;

import it.cnr.contab.config00.ejb.*;
import it.cnr.contab.config00.pdcfin.cla.bulk.*;
import it.cnr.contab.utenze00.bp.CNRUserContext;
import it.cnr.jada.DetailedRuntimeException;
import it.cnr.jada.action.ActionContext;
import it.cnr.jada.action.BusinessProcessException;
import it.cnr.jada.action.Config;
import it.cnr.jada.bulk.*;
import it.cnr.jada.comp.ComponentException;
import it.cnr.jada.persistency.sql.CompoundFindClause;
import it.cnr.jada.util.RemoteBulkTree;
import it.cnr.jada.util.RemoteIterator;
import it.cnr.jada.util.action.FormController;
import it.cnr.jada.util.action.SimpleCRUDBP;
import it.cnr.jada.util.action.SimpleDetailCRUDController;

/**
 * @author rpagano
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class CRUDClassificazioneVociBP extends SimpleCRUDBP {
	private BulkList bulkTab = new BulkList();
	private int[] focusTab = {-1,-1,-1,-1,-1,-1,-1};
	private CrudAssLivelli[] crudAssLivelli = {null,null,null,null,null,null,null};
	private String[][] tabs = null;
	public Parametri_livelliBulk parametriLivelli;
			
	public CRUDClassificazioneVociBP()
	{
		super();
	}

	public CRUDClassificazioneVociBP(String s)
	{
		super(s);
	}
	
	protected void init(Config config, ActionContext actioncontext) throws BusinessProcessException {
		super.init(config, actioncontext);

		setTab("tab","tabLivello1");
		try {
			setParametriLivelli(((Classificazione_vociComponentSession)createComponentSession()).findParametriLivelli(actioncontext.getUserContext(), CNRUserContext.getEsercizio(actioncontext.getUserContext())));
			allineaDescriptionTab(getTabCorrente().intValue());
			if (this.getName().equals("ClassificazioneVociSpeseBP")) {
				tabs = new String[getParametriLivelli().getLivelli_spesa().intValue()][3];
				
				for (int i = 0; iActionContext che ha generato la richiesta
	 *
	 * @return RemoteBulkTree l'albero richiesto
	**/
	public RemoteBulkTree getClassificazioniTree(ActionContext context) throws it.cnr.jada.comp.ComponentException{
	  return
		new RemoteBulkTree() {
		  public RemoteIterator getChildren(ActionContext context, OggettoBulk bulk) throws java.rmi.RemoteException {
			try{
			  return it.cnr.jada.util.ejb.EJBCommonServices.openRemoteIterator(context,((Classificazione_vociComponentSession)createComponentSession()).getChildren(context.getUserContext(),bulk));
			}catch(it.cnr.jada.comp.ComponentException ex){
				throw new java.rmi.RemoteException("Component Exception",ex);
			}catch(it.cnr.jada.action.BusinessProcessException ex){
				throw new java.rmi.RemoteException("BusinessProcess Exception",ex);
			}

		  }
		  public OggettoBulk getParent(ActionContext context, OggettoBulk bulk) throws java.rmi.RemoteException {
			try{
			  return ((Classificazione_vociComponentSession)createComponentSession()).getParent(context.getUserContext(),bulk);
			}catch(it.cnr.jada.comp.ComponentException ex){
				throw new java.rmi.RemoteException("Component Exception",ex);
			}catch(it.cnr.jada.action.BusinessProcessException ex){
				throw new java.rmi.RemoteException("BusinessProcess Exception",ex);
			}
		  }
	  
		  public boolean isLeaf(ActionContext context, OggettoBulk bulk) throws java.rmi.RemoteException {
			try{
			  return ((Classificazione_vociComponentSession)createComponentSession()).isLeaf(context.getUserContext(),bulk);
			}catch(it.cnr.jada.comp.ComponentException ex){
				throw new java.rmi.RemoteException("Component Exception",ex);
			}catch(it.cnr.jada.action.BusinessProcessException ex){
				throw new java.rmi.RemoteException("BusinessProcess Exception",ex);
			}
		  }
		};
	}

	public Parametri_livelliBulk getParametriLivelli(ActionContext actioncontext) throws BusinessProcessException {
		try {
			if (parametriLivelli == null)
				setParametriLivelli(((Classificazione_vociComponentSession)createComponentSession()).findParametriLivelli(actioncontext.getUserContext(), CNRUserContext.getEsercizio(actioncontext.getUserContext())));
		} catch(it.cnr.jada.comp.ComponentException e) {
			throw handleException(e);
		} catch(java.rmi.RemoteException e) {
			throw handleException(e);
		}
		return getParametriLivelli();
	}

	public Parametri_livelliBulk getParametriLivelli() {
		return parametriLivelli;
	}

	public void setParametriLivelli(Parametri_livelliBulk bulk) {
		parametriLivelli = bulk;
	}

	public class CrudAssLivelli extends SimpleDetailCRUDController {
		private CompoundFindClause filterController;

		public CrudAssLivelli(String s, Class class1, String s1, FormController formcontroller) {
			super(s, class1, s1, formcontroller, true);
		}

		public void setFilter(ActionContext actioncontext, CompoundFindClause compoundfindclause) {
			try {
				CRUDClassificazioneVociBP bp = (CRUDClassificazioneVociBP)actioncontext.getBusinessProcess(); 
				bp.setModel(actioncontext, ((Classificazione_vociComponentSession)createComponentSession()).caricaClassVociAssociate(actioncontext.getUserContext(),(Classificazione_vociBulk)bp.getModel(),compoundfindclause));
				bp.allineaFocusBulkTab(bp.getTabCorrente().intValue());
				filterController = compoundfindclause;
			} catch (DetailedRuntimeException e) {
				handleException(e);
			} catch (ComponentException e) {
				handleException(e);
			} catch (RemoteException e) {
				handleException(e);
			} catch (BusinessProcessException e) {
				handleException(e);
			}
		}
		public boolean isFiltered() {
			return filterController != null;
		}
		public CompoundFindClause getFilter()
		{
			return filterController;
		}
		protected void clearFilter(ActionContext actioncontext)
		{
			clearFilter();
		}
		protected void clearFilter()
		{
			filterController = null;
		}
		public void validate(ActionContext actioncontext) throws ValidationException {
			if (getModel()!=null)
			   getModel().validate();
			super.validate(actioncontext);
		}

		public String getLabelCd_livello1(){
			return ((CRUDClassificazioneVociBP)getParentController()).getLabelCd_livello1();
		}

		public String getLabelCd_livello2(){
			return ((CRUDClassificazioneVociBP)getParentController()).getLabelCd_livello2();
		}

		public String getLabelCd_livello3(){
			return ((CRUDClassificazioneVociBP)getParentController()).getLabelCd_livello3();
		}

		public String getLabelCd_livello4(){
			return ((CRUDClassificazioneVociBP)getParentController()).getLabelCd_livello4();
		}

		public String getLabelCd_livello5(){
			return ((CRUDClassificazioneVociBP)getParentController()).getLabelCd_livello5();
		}

		public String getLabelCd_livello6(){
			return ((CRUDClassificazioneVociBP)getParentController()).getLabelCd_livello6();
		}

		public String getLabelCd_livello7(){
			return ((CRUDClassificazioneVociBP)getParentController()).getLabelCd_livello7();
		}
	}

	public boolean isCdrAccentratoreHidden() {
		Classificazione_vociBulk cla;
		if (getTabCorrente().intValue()==1) 
			cla = (Classificazione_vociBulk)getModel();
		else
			cla = (Classificazione_vociBulk)getCrudAssLivelli().getModel();
		return cla == null || cla.getFl_accentrato() == null ||!cla.getFl_accentrato().booleanValue();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy