Language: Deutsch · English
Event rule „Update“: interface, context and an example – how to react to this Nuclos event.
REFERENZ DEVELOPER UPDATED: JUL 2026 APPLIES TO NUCLOS 4.2026.X
On this page
This server-side rule runs when a record is updated (before saving). It can be assigned to a business object.
Skeleton of the rule class (the rule editor creates it automatically):
package org.nuclet.lager;
import org.nuclos.api.rule.UpdateRule;
import org.nuclos.api.context.UpdateContext;
import org.nuclos.api.annotation.Rule;
import org.nuclos.api.exception.BusinessException;
/** @name
* @description
* @usage
* @change
*/
@Rule(name="Aktualisieren einer Lagerposition", description="Aktualisieren eines Lagerposition")
public class AktualisierenLagerposition implements UpdateRule {
public void update(UpdateContext context) throws BusinessException {
}
}
Context: UpdateContext
The context UpdateContext provides the affected BusinessObject via context.getBusinessObject(...); the RuleContext functions (providers) are also available. A BusinessException aborts the operation.
Assign it to the target via drag-and-drop in the server rule manager. Optionally restrict execution to a status or an action; control the order with the arrow buttons.
Assignment of „Update“.
package org.nuclet.company;
import java.util.List;
import org.nuclos.api.rule.UpdateRule;
import org.nuclos.api.context.UpdateContext;
import org.nuclos.api.annotation.Rule;
import org.nuclos.api.exception.BusinessException;
/** @name
* @description
* @usage
* @change
*/
@Rule(name="UpdateBestellung", description="UpdateBestellung")
public class UpdateBestellung implements UpdateRule {
public void update(UpdateContext context) throws BusinessException {
Bestellung curBestellung = context.getBusinessObject(Bestellung.class);
List<Bestellposition> lstPositionen = curBestellung.getPositionen();
double gesamteArtikelAnzahl = 0d;
for (Bestellposition curPos : lstPositionen) {
gesamteArtikelAnzahl += curPos.getAnzahlArtikel();
}
curBestellung.setKurzbeschreibung("Bestellung " + curBestellung.getNummer() + " umfasst insgesamt " + gesamtArtikelAnzahl + "Artikel.");
}
}