| Auszug |
|---|
|
Nuclos event rule User action: interface, CustomContext, structure, assignment in the server rule manager, example code (Java). |
Language: Deutsch · English
Event - User action
Event rule „User action“: 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 button in the layout is clicked. 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.CustomRule;
import org.nuclos.api.context.CustomContext;
import org.nuclos.api.annotation.Rule;
import org.nuclos.api.exception.BusinessException;
/** @name
* @description
* @usage
* @change
*/
@Rule(name="Benutzeraktion Lager", description="Benutzeraktion Lager")
public class BenutzeraktionLager implements CustomRule {
public void custom(CustomContext context) throws BusinessException {
}
} |
| Info |
|---|
| title | Context: CustomContext |
|---|
|
The context CustomContext 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.
Example
| Codeblock |
|---|
|
package org.nuclet.company;
import org.nuclos.api.rule.CustomRule;
import org.nuclos.api.context.CustomContext;
import org.nuclos.api.annotation.Rule;
import org.nuclos.api.exception.BusinessException;
import org.nuclos.api.provider.BusinessObjectProvider;
/** @name
* @description
* @usage
* @change
*/
@Rule(name="Bestellungpuefen", description="Bestellungpuefen")
public class Bestellungpuefen implements CustomRule {
public void custom(CustomContext context) throws BusinessException {
Bestellung b = context.getBusinessObject(Bestellung.class);
if (b.getBestellungsposition().size() <= 0) {
b.setKurzbeschreibung("Nicht vollständig");
}
else {
b.setKurzbeschreibung("Vollständig!");
}
}
} |
Related pages
Server-side rules
Basics.
Open →
Server rule manager
Assign.
Open →
Rule execution order
Order.
Open →