Seitenhistorie
...
Codeblock |
---|
package org.nuclet.company; import java.util.Calendar; import org.nuclos.api.annotation.Rule; import org.nuclos.api.context.InsertContext; import org.nuclos.api.exception.BusinessException; import org.nuclos.api.ruleprovider.InsertFinalRuleBusinessObjectProvider; import org.nuclos.api.providerrule.BusinessObjectProviderInsertFinalRule; /** @name * @description * @usage * @change */ @Rule(name="BestellungStichtag", description="BestellungStichtag") public class BestellungStichtag implements InsertFinalRule { public void insertFinal(InsertContext context) throws BusinessException { Bestellung curBestellung = context.getBusinessObject(Bestellung.class); Calendar recallDay = Calendar.getInstance(); recallDay.add(Calendar.DAY_OF_MONTH, 7); curBestellung.setRecallTermin(recallDay.getTime()); // Due to the fact that this is an InsertFinal rule we have to save the changed data again. // Updating the same entry twice - like in this case - might cause infinite loops, because updating via BusinessObjectProvider // activates the normal Nuclos save-process und might run the same rule again and again. So better be careful. BusinessObjectProvider.update(curBestellung); } } |
Überblick
Inhalte