Versions Compared

Key

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

...

Anchor
bookEntryTotalPatentValidator-anchor
bookEntryTotalPatentValidator-anchor
bookEntryTotalPatentValidator
Questa validazione verifica la somma dei Costi inseriti.
In particolare verifica che il valore dell'attributo numberMap[bookEntryTotal] sia uguale alla somma degli attributi numberMap[amount] presenti nella sezione "Costi".
Dal punto di vista del modello dati si tratta degli attributi numberMap[bookEntryTotal], numberMap[amount] e l'elemento bookEntry.
Per maggiori dettagli cfr. modello dati dell'entità in questione. Code Block
languagejs
linenumberstrue
collapsetrue


			var bookEntryWfElementSet = FragmentUtil.getCurrentFragmentSetByParentAndDiscriminator(object, "it.cilea.wf.model.WfItemElement", "bookEntry", wfService);
			var calculatedBookEntryTotal = BigDecimal.ZERO;
			var bookEntryTotal = (object.getNumberMap().get("bookEntryTotal") == null ? BigDecimal.ZERO : object.getNumberMap().get("bookEntryTotal"));
			
			if (bookEntryWfElementSet.size() > 0) {
				var bookEntryWfElementSetIterator = bookEntryWfElementSet.iterator();
				while (bookEntryWfElementSetIterator.hasNext()) {
					var bookEntryWfElement = bookEntryWfElementSetIterator.next();
					var amount = bookEntryWfElement.getNumberMap().get("amount");
					calculatedBookEntryTotal = calculatedBookEntryTotal.add(amount != null ? amount : BigDecimal.ZERO);
				}
			}
			
			if (!calculatedBookEntryTotal.stripTrailingZeros().equals(bookEntryTotal.stripTrailingZeros())) {
				errors.rejectValue("numberMap[bookEntryTotal]", "error.patent.autocalculatedBookEntryTotal.inconsistent");
			}
		
Anchor
lastLegalStatusCalculatorPatent-anchor
lastLegalStatusCalculatorPatent-anchor
lastLegalStatusCalculatorPatent
Questa validazione si occupa, ad ogni salvataggio, di a cercare l'ultimo Status Legale valido basandosi sulla Data di Registrazione e salvarne la voce in un metadato nascosto.
In particolare va a cercare tra gli elementi con discriminator legalStatus e ne va a valutare la data all'interno di dateMap[registrationStatus].
La voce di dizionario presente in wfDictionaryMap[status] viene poi salvata all'interno di wfItem.wfDictionaryMap[lastLegalStatus].
Per maggiori dettagli cfr. modello dati dell'entità in questione.

...

Anchor
wfStartLogicPublicEngagement-anchor
wfStartLogicPublicEngagement-anchor
wfStartLogicPublicEngagement
Questa logica viene eseguita in fase di creazione di un nuovo oggetto.
Effettua il setup dei seguenti attributi con i valori tra parentesi

  • istitutionalInitiative (false)
  • evaluationEnable (false)
  • externalFinancing (0)
  • totalBudget (0)

...

Code Block
languagejs
linenumberstrue
collapsetrue

			if(wfItem.getBooleanMap().get("istitutionalInitiative")==null){
				wfItem.getBooleanMap().put("istitutionalInitiative",false);
			}
			if(wfItem.getBooleanMap().get("evaluationEnable")==null){
				wfItem.getBooleanMap().put("evaluationEnable",false);
			}			
			if(wfItem.getNumberMap().get("externalFinancing")==null){
				wfItem.getNumberMap().put("externalFinancing",new java.math.BigDecimal("0"));
			}
			if(wfItem.getNumberMap().get("totalBudget")==null){
				wfItem.getNumberMap().put("totalBudget", new java.math.BigDecimal("0"));
			}
			if(wfItem.getBooleanMap().get("personOrDepartment")!=null){			
				wfItem.getBooleanMap().put("personOrDepartment",null);
			}		
			if(wfItem.getBooleanMap().get("copyFrom")!=null){			
				wfItem.getBooleanMap().put("copyFrom", null);	
			}
			if(wfItem.getIntegerMap().get("customizedYear")==null){	
				var myDate=WfUtil.getCheckDate(wfItem, "owner", wfService);
				if(myDate == null)
					throw "The provided date MUST NOT be null";
				var calendar = Calendar.getInstance();
				calendar.setTime(myDate);
				wfItem.getIntegerMap().put("customizedYear", new Packages.java.lang.Integer(calendar.get(Calendar.YEAR)));
			}
			true;
		

...