it.cnr.contab.fondecon00.bp.RicercaSpeseBP 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 .
*/
package it.cnr.contab.fondecon00.bp;
import it.cnr.contab.fondecon00.core.bulk.*;
import it.cnr.contab.fondecon00.ejb.FondoEconomaleComponentSession;
import it.cnr.jada.action.ActionContext;
import it.cnr.jada.action.BusinessProcessException;
/**
* Gestione della ricerca delle spese relative a un fondo economale
*/
public class RicercaSpeseBP extends it.cnr.jada.util.action.BulkBP {
private int status = INSERT;
private boolean bringBack = true;
private it.cnr.contab.fondecon00.core.bulk.Fondo_economaleBulk fondo;
public RicercaSpeseBP() {
super();
}
public RicercaSpeseBP(String function) {
super(function);
}
public Filtro_ricerca_speseVBulk createEmptyModelForSearch(ActionContext context) throws BusinessProcessException {
try {
return createNewBulk(context).initializeForSearch(this, context);
} catch(Exception e) {
throw handleException(e);
}
}
/**
* Crea un OggettoBulk vuoto della classe compatibile con la CRUDComponentSession del ricevente
*/
public Filtro_ricerca_speseVBulk createNewBulk(ActionContext context) throws BusinessProcessException {
try {
Filtro_ricerca_speseVBulk bulk = new Filtro_ricerca_speseVBulk();
bulk.setFondo_economale( getFondo() );
bulk.setUser(context.getUserInfo().getUserid());
return bulk;
} catch(Exception e) {
throw handleException(e);
}
}
protected it.cnr.jada.util.jsp.Button[] createToolbar() {
it.cnr.jada.util.jsp.Button[] toolbar = new it.cnr.jada.util.jsp.Button[2];
int i = 0;
toolbar[i++] = new it.cnr.jada.util.jsp.Button(it.cnr.jada.util.Config.getHandler().getProperties(it.cnr.jada.util.action.CRUDBP.class),"CRUDToolbar.search");
toolbar[i++] = new it.cnr.jada.util.jsp.Button(it.cnr.jada.util.Config.getHandler().getProperties(it.cnr.jada.util.action.CRUDBP.class),"CRUDToolbar.startSearch");
// toolbar[i++] = new it.cnr.jada.util.jsp.Button(it.cnr.jada.util.Config.getHandler().getProperties(it.cnr.jada.util.action.CRUDBP.class),"CRUDToolbar.new");
return toolbar;
}
/**
* Effettua una operazione di ricerca per un attributo di un modello.
* @param actionContext contesto dell'azione in corso
* @param clauses Albero di clausole da utilizzare per la ricerca
* @param bulk prototipo del modello di cui si effettua la ricerca
* @param context modello che fa da contesto alla ricerca (il modello del FormController padre del
* controller che ha scatenato la ricerca)
* @return un RemoteIterator sul risultato della ricerca o null se la ricerca non ha ottenuto nessun risultato
*/
public it.cnr.jada.util.RemoteIterator find(ActionContext actionContext,it.cnr.jada.persistency.sql.CompoundFindClause clauses,it.cnr.jada.bulk.OggettoBulk bulk,it.cnr.jada.bulk.OggettoBulk context,String property) throws it.cnr.jada.action.BusinessProcessException {
try {
FondoEconomaleComponentSession fpcs = (FondoEconomaleComponentSession)actionContext.getBusinessProcess().createComponentSession("CNRFONDECON00_EJB_FondoEconomaleComponentSession", FondoEconomaleComponentSession.class);
return it.cnr.jada.util.ejb.EJBCommonServices.openRemoteIterator(
actionContext,
fpcs.cerca(
actionContext.getUserContext(),
clauses,
bulk,
context,
property));
} catch (it.cnr.jada.comp.ComponentException e) {
throw handleException(e);
} catch (java.rmi.RemoteException e) {
throw handleException(e);
}
}
/**
* Effettua una operazione di ricerca per un attributo di un modello.
* @param actionContext contesto dell'azione in corso
* @param clauses Albero di clausole da utilizzare per la ricerca
* @param bulk prototipo del modello di cui si effettua la ricerca
* @param context modello che fa da contesto alla ricerca (il modello del FormController padre del
* controller che ha scatenato la ricerca)
* @return un RemoteIterator sul risultato della ricerca o null se la ricerca non ha ottenuto nessun risultato
*/
public it.cnr.jada.util.RemoteIterator findSpese(it.cnr.jada.action.ActionContext actionContext, it.cnr.jada.bulk.OggettoBulk context) throws it.cnr.jada.action.BusinessProcessException {
try {
FondoEconomaleComponentSession fpcs = (FondoEconomaleComponentSession)actionContext.getBusinessProcess().createComponentSession("CNRFONDECON00_EJB_FondoEconomaleComponentSession", FondoEconomaleComponentSession.class);
return fpcs.cercaSpese(actionContext.getUserContext(), (Filtro_ricerca_speseVBulk)getModel());
} catch (it.cnr.jada.comp.ComponentException e) {
throw handleException(e);
} catch (java.rmi.RemoteException e) {
throw handleException(e);
}
}
/**
* Effettua una operazione di ricerca per un attributo di un modello.
* @param actionContext contesto dell'azione in corso
* @param clauses Albero di clausole da utilizzare per la ricerca
* @param bulk prototipo del modello di cui si effettua la ricerca
* @param context modello che fa da contesto alla ricerca (il modello del FormController padre del
* controller che ha scatenato la ricerca)
* @return un RemoteIterator sul risultato della ricerca o null se la ricerca non ha ottenuto nessun risultato
*/
public it.cnr.jada.util.RemoteIterator findSpeseReintegrabili(it.cnr.jada.action.ActionContext actionContext, it.cnr.jada.bulk.OggettoBulk context) throws it.cnr.jada.action.BusinessProcessException {
try {
FondoEconomaleComponentSession fpcs = (FondoEconomaleComponentSession)actionContext.getBusinessProcess().createComponentSession("CNRFONDECON00_EJB_FondoEconomaleComponentSession", FondoEconomaleComponentSession.class);
return fpcs.cercaSpeseReintegrabili(actionContext.getUserContext(), (Filtro_ricerca_speseVBulk)getModel());
} catch (it.cnr.jada.comp.ComponentException e) {
throw handleException(e);
} catch (java.rmi.RemoteException e) {
throw handleException(e);
}
}
/**
* Insert the method's description here.
* Creation date: (22/02/2002 11.20.22)
* @return it.cnr.contab.fondecon00.core.bulk.Fondo_economaleBulk
*/
public it.cnr.contab.fondecon00.core.bulk.Fondo_economaleBulk getFondo() {
return fondo;
}
public java.util.Dictionary getSearchResultColumns() {
return getModel().getBulkInfo().getColumnFieldPropertyDictionary();
}
public int getStatus() {
return status;
}
protected void init(it.cnr.jada.action.Config config,it.cnr.jada.action.ActionContext context) throws it.cnr.jada.action.BusinessProcessException {
super.init(config,context);
setStatus(SEARCH);
}
public boolean isBringBack() {
return bringBack;
}
public boolean isBringbackButtonEnabled() {
return isSearching();
}
public boolean isBringbackButtonHidden() {
return !isBringBack();
}
public boolean isNewButtonEnabled() {
return isEditable();
}
/**
* Abilito il bottone di cancellazione documento solo se non ho scadenze in fase di modifica/inserimento
*/
public boolean isNewButtonHidden() {
return false;
}
public boolean isSearchButtonHidden() {
return isSearching();
}
public boolean isSearching() {
return status == SEARCH;
}
public boolean isStartSearchButtonHidden() {
return !isSearching();
}
/**
* Inzializza il ricevente nello stato di SEARCH.
*/
public void resetForSearch(it.cnr.jada.action.ActionContext context) throws it.cnr.jada.action.BusinessProcessException {
try {
setModel(context, createEmptyModelForSearch(context));
setStatus(SEARCH);
setDirty(false);
resetChildren(context);
} catch(Throwable e) {
throw new it.cnr.jada.action.BusinessProcessException(e);
}
}
public void setBringBack(boolean newBringBack) {
bringBack = newBringBack;
}
/**
* Insert the method's description here.
* Creation date: (22/02/2002 11.20.22)
* @param newFondo it.cnr.contab.fondecon00.core.bulk.Fondo_economaleBulk
*/
public void setFondo(it.cnr.contab.fondecon00.core.bulk.Fondo_economaleBulk newFondo) {
fondo = newFondo;
}
public void setStatus(int newStatus) {
status = newStatus;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy