Seitenhistorie
...
Codeblock |
---|
package org.nuclet.company;
import org.nuclos.api.rule.InsertFinalRule;
import org.nuclos.api.context.InsertContext;
import org.nuclos.api.annotation.Rule;
import org.nuclos.api.exception.BusinessException;
import java.util.Calendar;
import org.nuclos.api.provider.BusinessObjectProvider;
/** @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