| Auszug |
|---|
|
Nuclos event rule Update: interface, UpdateContext, structure, assignment in the server rule manager, example code (Java). |
Language: Deutsch · English
Event - Update
Event rule „Update“: interface, context and an example – how to react to this Nuclos event.
| Status |
|---|
| colour | Green |
|---|
| title | Updated: Jul 2026 |
|---|
|
| Status |
|---|
| colour | Grey |
|---|
| title | applies to Nuclos 4.2026.x |
|---|
|
When does the rule fire?
This server-side rule runs when a record is updated (before saving). It can be assigned to a business object.
Structure
Skeleton of the rule class (the rule editor creates it automatically):
| Codeblock |
|---|
|
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 {
}
} |
| Info |
|---|
| title | Context: UpdateContext |
|---|
|
The context UpdateContext provides the affected BusinessObject via context.getBusinessObject(...); the RuleContext functions (providers) are also available. A BusinessException aborts the operation. |
Assignment
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“.
Example
| Codeblock |
|---|
|
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.");
}
} |
Related pages
Server-side rules
Basics.
Open →
Server rule manager
Assign.
Open →
Rule execution order
Order.
Open →