Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Codice contratto: identifier
  • Nome contratto: description troncata a 255 caratteri per limitazioni lato UGOV PJ
  • Importo contratto totalAmount
    L'invio viene effettuato se l'importo è non nullo e maggiore di zero.
  • Data inizio validità: startDate
  • Data fine validità: endDate
  • Riferimento Data Management System (Sistema Documentale): externalDmsIdentifier
    Inviato l'identifier del progetto se valorizzata a true la variabile di configurazione ap.con.externalDmsIdentifier.autogenerated, in tutti gli altri casi viene inviato externalDmsIdentifier.
  • Responsabili scientifici: owner
    Inviate anche date di inizio e fine se valorizzata a true la variabile di configurazione ap.contract.owner.starDate.required.
  • Partecipanti: contributor
    Inviate anche date di inizio e fine se valorizzata a true la variabile di configurazione ap.contract.contributor.starDate.required.
  • Unità organizzative interne: internalOrganizationUnit
  • Enti Committenti: customer
    Inviato se valorizzata a true la variabile di configurazione ap.contract.customer.send2ugov.enable.
  • Tipo contratto: come da mappatura tassonomia ap-item-type.xls
  • Schema di finanziamento: come da mappatura tassonomia ap-item-type.xls
  • Stato contratto: come da mappatura tassonomia ap-item-type.xls

...

Code Block
languagejs
linenumberstrue
collapsetrue
			var Logic = function(wfItem, dtoPj, superLogic, errors, messageUtil, request, gaService, wfService, wfTaskService, searchBuilderTemplate, log) {
			this.wfItem=wfItem;
			this.dtoPj=dtoPj;
			this.superLogic=superLogic;
			this.errors=errors;
			this.messageUtil=messageUtil;
			this.request=request;
			this.gaService=gaService;
			this.wfService=wfService;
			this.wfTaskService=wfTaskService;
			this.searchBuilderTemplate=searchBuilderTemplate;
			this.log=log;
			this.setInternalOrgUnitList = function() {
				var internalOrganizationUnitSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(wfItem, "it.cilea.wf.model.WfItemElement","internalOrganizationUnit", wfService);
				var internalOrganizationUnitSetIterator=internalOrganizationUnitSet.iterator();
				while (internalOrganizationUnitSetIterator.hasNext()){
					var element=internalOrganizationUnitSetIterator.next();
					var orgUnit = element.getOrganizationUnitMap().get("ouId");
					var orgUnitRole = element.getWfDictionaryMap().get("roleId");
					dtoPj.getDTOUoPjs().add(superLogic.getOrganizationUnit(orgUnit, orgUnitRole, errors));
				}
			};			
			this.setFinanciers = function() {
				var sendCustomer2Ugov=Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.contract.customer.send2ugov.enable");
				if (sendCustomer2Ugov && sendCustomer2Ugov.trim().equalsIgnoreCase("true")){
					var contractorSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(wfItem, "it.cilea.wf.model.WfItemElement", "customer",wfService);
					var contractorSetIterator=contractorSet.iterator();
					while (contractorSetIterator.hasNext()){
						var element=contractorSetIterator.next();
						var organizationUnit = element.getOrganizationUnitMap().get("customerId");
						var enteFinanziatore = superLogic.getEnteFinanziatore(organizationUnit, this.getFinancing(), contractorSet.size(), errors);
						dtoPj.getDTOEfPjs().add(enteFinanziatore);
					}
				}
			};
			this.setPartners = function() {};
			this.getResearchNature = function() {
				return null;
			};
			this.getContribution = function() {
				return null;
			};
			this.getCofinancing = function() {
				return null;
			};
			this.getFinancing = function() {				
				return wfItem.getNumberMap().get("totalAmount");
			};
			this.getStartDate = function() {
				return wfItem.getDateMap().get("startDate");			    	
			};
			this.getEndDate = function() {
				return wfItem.getDateMap().get("endDate");			    
			};
			this.getExpenditureStartDate = function() {
				return wfItem.getDateMap().get("startDate");			    	
			};
			this.getExpenditureEndDate = function() {
				return wfItem.getDateMap().get("endDate");			    
			};
			this.getCurrentEndDate = function() {
				return null;	    
			};
			this.getIdentifier = function() {	
				return wfItem.getIdentifier();
			};
			this.getIdPj = function() {     
 	 			if(wfItem.getIntegerMap().get("ugovId") != null){
 	 	        	return wfItem.getIntegerMap().get("ugovId");
 	            } else {
 	                return null;
 	            }
 	 	    };
			this.getDescription = function() {
				if(wfItem.getDescription()!=null){
					var length=wfItem.getDescription().length();
					return wfItem.getDescription().substring(0,(length>255)?255:length);
				} else {
					return null;
				}
			};
			this.getCup = function() {
				var sendCup2Ugov = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.con.cup.send2ugov.enable");
				if (sendCup2Ugov && sendCup2Ugov.trim().equalsIgnoreCase("true")){
					return wfItem.getStringMap().get("cup");
				} else {
					return null;
				}		
			};
			this.getAcronym = function() {
				if(wfItem.getStringMap().get("acronym") != null){
					var length = wfItem.getStringMap().get("acronym").length();
					return wfItem.getStringMap().get("acronym").substring(0,(length>50)?50:length);
				} else {
					return null;
				}
			};
			this.getExternalDmsIdentifier = function() {
				var externalDmsIdentifierAutogenerated = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.con.externalDmsIdentifier.autogenerated");
				if("true".equals(externalDmsIdentifierAutogenerated)){
					return wfItem.getIdentifier();
				}else {
					return wfItem.getStringMap().get("externalDmsIdentifier");
				}
			};						
			this.isSynchronizable = function() {
				var financing=this.getFinancing();
				var legacy=wfItem.getBooleanMap().get("legacy");
				if (Packages.java.lang.Boolean.TRUE.equals(legacy) || financing==null || Packages.java.math.BigDecimal.ZERO.equals(financing))
					return Packages.java.lang.Boolean.FALSE;
				else			    
					return Packages.java.lang.Boolean.TRUE;
			};
			this.getProjectType = function() {
				return superLogic.getProjectType(wfItem);
			};
			this.getFinanceSchema = function() {
				return this.getProjectType();
			};
			this.getPjInternalCode = function() {
				return null;
			};
			this.isContributorStartDateRequired = function() {						
				var contributorStartDateRequired=Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.contract.contributor.starDate.required");
				if (contributorStartDateRequired){
					if (contributorStartDateRequired.trim().equalsIgnoreCase("true")){
						return Packages.java.lang.Boolean.TRUE;
					} else if (contributorStartDateRequired.trim().equalsIgnoreCase("false")){
						return Packages.java.lang.Boolean.FALSE;
					} else {
						throw "ap.contract.contributor.starDate.required MUST BE true or false";
					}
				} else {
					return Packages.java.lang.Boolean.TRUE;
				}							    
			};				
			this.isOwnerStartDateRequired = function() {
				var ownerStartDateRequired=Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.contract.owner.starDate.required");
				if (ownerStartDateRequired){
					if (ownerStartDateRequired.trim().equalsIgnoreCase("true")){
						return Packages.java.lang.Boolean.TRUE;
					} else if (ownerStartDateRequired.trim().equalsIgnoreCase("false")){
						return Packages.java.lang.Boolean.FALSE;
					} else {
						throw "ap.contract.owner.starDate.required MUST BE true or false";
					}
				} else {
					return Packages.java.lang.Boolean.TRUE;
				}
			};
		};
		new Logic(wfItem, dtoPj, superLogic, errors, messageUtil, request, gaService, wfService, wfTaskService, searchBuilderTemplate, log);
		

...

  • Codice progetto: identifier
  • Nome progetto: description troncata a 255 caratteri per limitazioni lato UGOV PJ
  • Importo progetto
    Viene valutata la variabile di configurazione ap.project.financing.internalCost.send2ugov.forced.
    Se valorizzata a true allora viene usato l'attributo internalCost
    Se NON valorizzata a true allora
    • se l'ateneo è capofila allora viene inviato il risultato della seguente formula globalCost-(globalCost-globalContribution-internalCofinancing)
    • se l'ateneo NON è capofila allora viene inviato internalCost
    L'invio viene effettuato se l'importo è non nullo e maggiore di zero.
  • Data inizio validità:
    Viene valutata la variabile di configurazione ap.project.date.expenditure.send2ugov.enabled.
    Se valorizzata a true allora viene usato l'attributo expenditureStartDate altrimenti startDate
  • Data fine validità:
    Viene valutata la variabile di configurazione ap.project.date.expenditure.send2ugov.enabled.
    Se valorizzata a true allora viene usato l'attributo expenditureEndDate altrimenti endDate
  • Data proroga uffciale:
    Viene valutata la variabile di configurazione ap.prj.date.extensionCurrent.send2ugov.enabled.
    Se valorizzata a true allora viene valutata la presenza di eventuale Proroga di IRIS (extension).
    Se questa è presente, allora viene inviata la nuova data di fine attività (attributo startDate) rivista in base alla proroga.
  • CUP: cup
    Inviato se valorizzata a true la variabile di configurazione ap.project.cup.send2ugov.enable.
  • Riferimento Data Management System (Sistema Documentale): externalDmsIdentifier
    Inviato l'identifier del progetto se valorizzata a true la variabile di configurazione ap.prj.externalDmsIdentifier.autogenerated, in tutti gli altri casi viene inviato externalDmsIdentifier.
  • Responsabili scientifici: owner
    Inviate anche date di inizio e fine se valorizzata a true la variabile di configurazione ap.project.owner.starDate.required.
    Per i Responsabili scientifici, nella scheda, può essere visibile il Ruolo (visibilità pilotata da configuration ap.prj.owner.role.enabled con default false)
    E' buona cosa inserire prima nel flusso, in caso di attivazione dei ruoli, la validazione ownerRoleSend2UgovValidatorProject, a cui è delegata la correttezza dei dati.
  • Partecipanti: contributor
    Inviate anche date di inizio e fine se valorizzata a true la variabile di configurazione ap.project.contributor.starDate.required.
  • Unità organizzative interne: internalOrganizationUnit
  • Finanziatori: grantor
    Inviato se valorizzata a true la variabile di configurazione ap.project.grantor.send2ugov.enable.
    Se valorizzata a true la configurazione ap.prj.grantor.financingQuota.enabled nel form è possibile inserire anche le quote di finanziamento associate, che vengono inviate a PJ
  • Partner: partner
    Inviato se valorizzata a true la variabile di configurazione ap.project.partner.send2ugov.enable.
  • Tipo progetto: come da mappatura tassonomia ap-item-type.xls
  • Schema di finanziamento: come da mappatura tassonomia ap-item-type.xls
  • Stato progetto: come da mappatura tassonomia ap-item-type.xls

...

Code Block
languagejs
linenumberstrue
collapsetrue
			var Logic = function(wfItem, dtoPj, superLogic, errors, messageUtil, request, gaService, wfService, wfTaskService, searchBuilderTemplate, log) {
			this.wfItem=wfItem;
			this.dtoPj=dtoPj;
			this.superLogic=superLogic;
			this.errors=errors;
			this.messageUtil=messageUtil;
			this.request=request;
			this.gaService=gaService;
			this.wfService=wfService;
			this.wfTaskService=wfTaskService;
			this.searchBuilderTemplate=searchBuilderTemplate;
			this.log=log;
			this.setInternalOrgUnitList = function() {
				var internalOrganizationUnitSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(wfItem, "it.cilea.wf.model.WfItemElement","internalOrganizationUnit", wfService);
				var internalOrganizationUnitSetIterator=internalOrganizationUnitSet.iterator();
				while (internalOrganizationUnitSetIterator.hasNext()){
					var element=internalOrganizationUnitSetIterator.next();
					var orgUnit = element.getOrganizationUnitMap().get("ouId");
					var orgUnitRole = element.getWfDictionaryMap().get("roleId");
					dtoPj.getDTOUoPjs().add(superLogic.getOrganizationUnit(orgUnit, orgUnitRole, errors));
				}
			};			
			this.setFinanciers = function() {
				var sendGrantor2Ugov = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.grantor.send2ugov.enable");
				if (sendGrantor2Ugov && sendGrantor2Ugov.trim().equalsIgnoreCase("true")){
					var contractorSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(wfItem, "it.cilea.wf.model.WfItemElement", "grantor",wfService);
					var contractorSetIterator = contractorSet.iterator();
					while (contractorSetIterator.hasNext()){
						var element = contractorSetIterator.next();
						//var organizationUnit = element.getOrganizationUnitMap().get("grantorId");
						var enteFinanziatore = superLogic.getEnteFinanziatore(organizationUnitelement, this.getFinancing(), contractorSet.size(), errors);
						dtoPj.getDTOEfPjs().add(enteFinanziatore);
					}
				}
			};
			this.setPartners = function() {
				var sendPartner2Ugov = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.partner.send2ugov.enable");
				if (sendPartner2Ugov && sendPartner2Ugov.trim().equalsIgnoreCase("true")){
					var partnerSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(wfItem, "it.cilea.wf.model.WfItemElement", "partner",wfService);
					var partnerSetIterator=partnerSet.iterator();
					while (partnerSetIterator.hasNext()){
						var element=partnerSetIterator.next();
						var organizationUnit = element.getOrganizationUnitMap().get("partnerId");
						var partnerRole = element.getWfDictionaryMap().get("partnerRole");
						var partecipante = superLogic.getPartecipante(organizationUnit,  partnerRole, errors);
						dtoPj.getDTOPartPjs().add(partecipante)
					}
				}			
			};
			this.getContribution = function() {
				return wfItem.getNumberMap().get("internalContribution");
			};
			this.getCofinancing = function() {
				return wfItem.getNumberMap().get("internalCofinancing");
			};
			this.getFinancing = function() {
				var coordinatorRoleId = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.partner.role.main");
				var myOrganization = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("rm.orgunit.external.myOrganization");
				var forcedPjInternalCost = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.financing.internalCost.send2ugov.forced");
				if (forcedPjInternalCost == null)
					forcedPjInternalCost = false;
				else if (forcedPjInternalCost.equalsIgnoreCase("true")){				
					forcedPjInternalCost=true;
				} else {
					forcedPjInternalCost=false;
				}
				
				if (!forcedPjInternalCost){
					if (coordinatorRoleId==null || myOrganization==null){
						throw "Configuration variables ap.project.partner.role.main and rm.orgunit.external.myOrganization MUST BE DEFINED";
					} else {
						coordinatorRoleId=new Packages.java.lang.Integer(coordinatorRoleId);
						myOrganization=new Packages.java.lang.Integer(myOrganization);
					}		
					var partnerSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(wfItem, "it.cilea.wf.model.WfItemElement", "partner",wfService);
					var partnerSetIterator=partnerSet.iterator();
					while (partnerSetIterator.hasNext()){
						var element=partnerSetIterator.next();			 
						var orgUnitRole = element.getWfDictionaryMap().get("partnerRole");
						if (orgUnitRole==null){
							errors.reject("error.project.partner.missingRole");
							throw "Detected partner without role";
						}
						
						var orgUnit = element.getOrganizationUnitMap().get("partnerId");
						if(myOrganization.equals(orgUnit.getId()) && coordinatorRoleId.equals(orgUnitRole.getId())){				
							var globalCost=wfItem.getNumberMap().get("globalCost");
							if (globalCost==null)
								globalCost=Packages.java.math.BigDecimal.ZERO;
							
							var globalContribution=wfItem.getNumberMap().get("globalContribution");
							if (globalContribution==null)
								globalContribution=Packages.java.math.BigDecimal.ZERO;
							
							var internalCofinancing=wfItem.getNumberMap().get("internalCofinancing");
							if (internalCofinancing==null)
								internalCofinancing=Packages.java.math.BigDecimal.ZERO;
							
							return globalCost.subtract(globalCost.subtract(globalContribution).subtract(internalCofinancing));
						}			
					}
				}				
				return wfItem.getNumberMap().get("internalCost");
			};
			this.getStartDate = function() {
				var expenditureDateEnabled=Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.date.expenditure.send2ugov.enabled");
				var expenditureAndActivityDateEnabled = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.date.activityAndExpenditure.send2ugov.enabled");
				if (expenditureDateEnabled && expenditureDateEnabled.trim().equalsIgnoreCase("true") && expenditureAndActivityDateEnabled && expenditureAndActivityDateEnabled.trim().equalsIgnoreCase("true")){
					throw "ap.project.date.expenditure.send2ugov.enabled and ap.project.date.activityAndExpenditure.send2ugov.enabled CANNOT BE BOTH TRUE";
				} else {
					if (expenditureDateEnabled && expenditureDateEnabled.trim().equalsIgnoreCase("true")){
						if (wfItem.getDateMap().get("expenditureStartDate")!=null)
							return wfItem.getDateMap().get("expenditureStartDate");
						else
							return wfItem.getDateMap().get("startDate");
					} else {
						return wfItem.getDateMap().get("startDate");
					}	
				}					    	
			};
			this.getEndDate = function() {
				var expenditureDateEnabled=Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.date.expenditure.send2ugov.enabled");
				var expenditureAndActivityDateEnabled = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.date.activityAndExpenditure.send2ugov.enabled");
				if (expenditureDateEnabled && expenditureDateEnabled.trim().equalsIgnoreCase("true")){
					if (wfItem.getDateMap().get("expenditureEndDate")!=null)
						return wfItem.getDateMap().get("expenditureEndDate");
					else
						return wfItem.getDateMap().get("endDate");
				} else {
					return wfItem.getDateMap().get("endDate");
				}		
			};
						
			this.getExpenditureStartDate = function() {
			    var expenditureDateEnabled=Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.date.expenditure.send2ugov.enabled");
				var expenditureAndActivityDateEnabled = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.date.activityAndExpenditure.send2ugov.enabled");
				if (expenditureDateEnabled && expenditureDateEnabled.trim().equalsIgnoreCase("true") && expenditureAndActivityDateEnabled && expenditureAndActivityDateEnabled.trim().equalsIgnoreCase("true")){
					throw "ap.project.date.expenditure.send2ugov.enabled and ap.project.date.activityAndExpenditure.send2ugov.enabled CANNOT BE BOTH TRUE";
				} else {
					if (expenditureAndActivityDateEnabled && expenditureAndActivityDateEnabled.trim().equalsIgnoreCase("true")){
				    	return wfItem.getDateMap().get("expenditureStartDate");
				    } else {
						if (expenditureDateEnabled && expenditureDateEnabled.trim().equalsIgnoreCase("true")){
							if (wfItem.getDateMap().get("expenditureStartDate")!=null)
								return wfItem.getDateMap().get("expenditureStartDate");
							else
								return wfItem.getDateMap().get("startDate");
						} else {
							return wfItem.getDateMap().get("startDate");
						}	
					}		
				}
			    				    	
			};
			this.getExpenditureEndDate = function() {
				var expenditureAndActivityDateEnabled = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.date.activityAndExpenditure.send2ugov.enabled");
			    if (expenditureAndActivityDateEnabled && expenditureAndActivityDateEnabled.trim().equalsIgnoreCase("true")){
			    	return wfItem.getDateMap().get("expenditureEndDate");
			    } else {
			    
					var expenditureDateEnabled = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.date.expenditure.send2ugov.enabled");
					if (expenditureDateEnabled && expenditureDateEnabled.trim().equalsIgnoreCase("true")){
						if (wfItem.getDateMap().get("expenditureEndDate")!=null)
							return wfItem.getDateMap().get("expenditureEndDate");
						else
							return wfItem.getDateMap().get("endDate");
					} else {
						return wfItem.getDateMap().get("endDate");
					}		
				}
			};
			this.getCurrentEndDate = function() {
				var currentEndDateEnabled = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.prj.date.extensionCurrent.send2ugov.enabled");
				if (currentEndDateEnabled && currentEndDateEnabled.trim().equalsIgnoreCase("true")){
					var extensionSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(wfItem, "it.cilea.wf.model.WfItemElement", "extension", wfService);
					if(extensionSet.isEmpty()){	  
						return null;
					}  else {
						return wfItem.getDateMap().get("endDate");
					}
				} else {
					return null;
				}				
			};			
			this.getIdentifier = function() {	
				return wfItem.getIdentifier();
			};
			this.getIdPj = function() {     
 	 			if(wfItem.getIntegerMap().get("ugovId") != null){
 	 	        	return wfItem.getIntegerMap().get("ugovId");
 	            } else {
 	                return null;
 	            }
 	 	    };
			this.getDescription = function() {
				if(wfItem.getDescription() != null){
					var length=wfItem.getDescription().length();
					return wfItem.getDescription().substring(0,(length>255)?255:length);
				} else {
					return null;
				}
			};
			this.getCup = function() {
				var sendCup2Ugov = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.cup.send2ugov.enable");
				if (sendCup2Ugov && sendCup2Ugov.trim().equalsIgnoreCase("true")){
					return wfItem.getStringMap().get("cup");
				} else {
					return null;
				}				
			};
			this.getAcronym = function() {
				if(wfItem.getStringMap().get("acronym") != null){
					var length = wfItem.getStringMap().get("acronym").length();
					return wfItem.getStringMap().get("acronym").substring(0,(length>50)?50:length);
				} else {
					return null;
				}
			};
			this.getExternalDmsIdentifier = function() {
				var externalDmsIdentifierAutogenerated = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.prj.externalDmsIdentifier.autogenerated");
				if("true".equals(externalDmsIdentifierAutogenerated)){
					return wfItem.getIdentifier();
				}else {
					return wfItem.getStringMap().get("externalDmsIdentifier");
				}
			};
			this.isSynchronizable = function() {
				var legacy = wfItem.getBooleanMap().get("legacy");
				var financing = this.getFinancing();				
				if (Packages.java.lang.Boolean.TRUE.equals(legacy) || financing==null || Packages.java.math.BigDecimal.ZERO.equals(financing))
					return Packages.java.lang.Boolean.FALSE;
				else			    
					return Packages.java.lang.Boolean.TRUE;
			};
			this.getResearchNature = function() {
				if(wfItem.getWfDictionaryMap().get("researchNature") == null){
					return null;
				} else {
					return wfItem.getWfDictionaryMap().get("researchNature").getStringMap().get("ugovCode");
				}			
			};			
			this.getProjectType = function() {
				return superLogic.getProjectType(wfItem);
			};
			this.getFinanceSchema = function() {
				return this.getProjectType();
			};
			this.getPjInternalCode = function() {
				return null;
			};
			this.isContributorStartDateRequired = function() {						
				var contributorStartDateRequired=Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.contributor.starDate.required");
				if (contributorStartDateRequired){
					if (contributorStartDateRequired.trim().equalsIgnoreCase("true")){
						return Packages.java.lang.Boolean.TRUE;
					} else if (contributorStartDateRequired.trim().equalsIgnoreCase("false")){
						return Packages.java.lang.Boolean.FALSE;
					} else {
						throw "ap.project.contributor.starDate.required MUST BE true or false";
					}
				} else {
					return Packages.java.lang.Boolean.TRUE;
				}							    
			};				
			this.isOwnerStartDateRequired = function() {
				var ownerStartDateRequired = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.owner.starDate.required");
				if (ownerStartDateRequired){
					if (ownerStartDateRequired.trim().equalsIgnoreCase("true")){
						return Packages.java.lang.Boolean.TRUE;
					} else if (ownerStartDateRequired.trim().equalsIgnoreCase("false")){
						return Packages.java.lang.Boolean.FALSE;
					} else {
						throw "ap.project.owner.starDate.required MUST BE true or false";
					}
				} else {
					return Packages.java.lang.Boolean.TRUE;
				}
			};
		};
		new Logic(wfItem, dtoPj, superLogic, errors, messageUtil, request, gaService, wfService, wfTaskService, searchBuilderTemplate, log);
		

...

Anchor
grantorValidatorProject-anchor
grantorValidatorProject-anchor
grantorValidatorProject
Questa validazione controlla che esista almeno un ente finanziatore nel tab "Dati generali".
Dal punto di vista del modello dati si tratta degli elementi di tipo grantor
Per maggiori dettagli cfr. excel modello dati dell'entità Progetto
Code Block
languagejs
linenumberstrue
collapsetrue
					
			var grantorSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(object, "getWfItemElementSet", "it.cilea.wf.model.WfItemElement", "grantor", wfService);
			if (grantorSet.size()<1)
				errors.reject("error.project.grantor.atLeast1");	
		

Anchor
topicValidatorProjectgrantorFinancingQuotaRequiredValidatorProject-anchortopicValidatorProject
grantorFinancingQuotaRequiredValidatorProject-anchor
topicValidatorProject grantorFinancingQuotaRequiredValidatorProject
Questa validazione controlla che esista almeno una area tematica nel tab "Dati generali"viene attivata dalla configuration ap.prj.grantor.financingQuota.enabled.
Verfica che vengano inserite le quote di finanziamento associate a ogni ente e che la loro somma sia corretta.
Dal punto di vista del modello dati si tratta degli elementi di tipo topic grantor.
Per maggiori dettagli cfr. excel modello dati dell'entità Progetto
Code Block
languagejs
linenumberstrue
collapsetrue
					
			if(ConfigurationUtil.getConfigValue("ap.prj.grantor.financingQuota.enabled") != null){
				if(ConfigurationUtil.getConfigValue("ap.prj.grantor.financingQuota.enabled").equalsIgnoreCase("true")){
					var grantorSet = FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(object, "getWfItemElementSet", "it.cilea.wf.model.WfItemElement", "grantor", wfService);
					var grantorSetIterator = grantorSet.iterator();
					var sum = BigDecimal.ZERO;
					while (grantorSetIterator.hasNext()){
						var element = grantorSetIterator.next();		
						sum = sum.add(element.getNumberMap().get("financingQuota") != null ? element.getNumberMap().get("financingQuota") : BigDecimal.ZERO);
					}
					if(!sum.equals(object.getNumberMap().get("internalContribution"))){
						errors.reject("error.project.grantor.quota.inconsistent");		
					}
			
				}
			}
		

Anchor
topicValidatorProject-anchor
topicValidatorProject-anchor
topicValidatorProject
Questa validazione controlla che esista almeno una area tematica nel tab "Dati generali".
Dal punto di vista del modello dati si tratta degli elementi di tipo topic
Per maggiori dettagli cfr. excel modello dati dell'entità Progetto
Code Block
languagejs
linenumberstrue
collapsetrue
					
			var topicSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(object, "getWfItemElementSet", "it.cilea.wf.model.WfItemElement", "topic", wfService);
			if (topicSet.size()<1)
				errors.reject("error.project.topic.atLeast1");		
		

...

Code Block
languagejs
linenumberstrue
collapsetrue
						
			var coordinatorRoleId = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("ap.project.partner.role.main");
			var uniquePartnerRoleId = WfUtil.getDictionaryByCode(wfService, "partnerRole.uniquePartner");
			var myOrganization = Packages.it.cilea.core.configuration.util.ConfigurationUtil.getConfigValue("rm.orgunit.external.myOrganization");
			if (coordinatorRoleId==null || myOrganization==null || uniquePartnerRoleId==null){
				throw "Configuration variables ap.project.partner.role.main and Dictionary partnerRole.uniquePartner, rm.orgunit.external.myOrganization MUST BE DEFINED";
			} else {
				coordinatorRoleId = new Packages.java.lang.Integer(coordinatorRoleId);
				uniquePartnerRoleId = new Packages.java.lang.Integer(uniquePartnerRoleId);
				myOrganization = new Packages.java.lang.Integer(myOrganization);				
			}		
			var partnerSet = Packages.it.cilea.core.fragment.util.FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(object, "it.cilea.wf.model.WfItemElement", "partner",wfService);
			var partnerSetIterator = partnerSet.iterator();
			
			while (partnerSetIterator.hasNext()){
				var element=partnerSetIterator.next();			 
				var orgUnitRole = element.getWfDictionaryMap().get("partnerRole");						
				var orgUnit = element.getOrganizationUnitMap().get("partnerId");
				
				if(myOrganization.equals(orgUnit.getId()) && coordinatorRoleId.equals(orgUnitRole.getId())){
					
					if (!object.getNumberMap().get("globalContribution")){
						errors.rejectValue("numberMap[globalContribution]","error.project.funding.globalContribution.required");											
					}
					
					if (!object.getNumberMap().get("globalCost")){
						errors.rejectValue("numberMap[globalCost]","error.project.funding.globalCost.required");											
					}
					var currency = object.getWfDictionaryMap().get("currency");	
					if(currency != null){
						var currencyId = object.getWfDictionaryMap().get("currency").getId();
						var dictionary = wfService.getWfDictionary(currencyId);
						var currencyCode = dictionary.getStringMap().get("code");
						if (currencyCode != "currency.eur"){	
							if (!object.getNumberMap().get("globalCostOriginalCurrency")){
								errors.rejectValue("numberMap[globalCostOriginalCurrency]","error.project.funding.globalCostOriginalCurrency.required");											
							}										
							
							if (!object.getNumberMap().get("globalContributionOriginalCurrency")){
								errors.rejectValue("numberMap[globalContributionOriginalCurrency]","error.project.funding.globalContributionOriginalCurrency.required");											
							}
						}
					}
				}			
			}	
		

...