globe with meridians Language: Deutsch · English

open book Event - Create (final)

Event rule „Create (final)“: 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

When does the rule fire?

This server-side rule runs after a record has been created successfully. It can be assigned to a business object.

Structure

Skeleton of the rule class (the rule editor creates it automatically):

package org.nuclet.lager; 

import org.nuclos.api.annotation.Rule; 
import org.nuclos.api.context.InsertContext; 
import org.nuclos.api.exception.BusinessException; 
import org.nuclos.api.rule.InsertFinalRule; 

/** @name        
  * @description 
  * @usage       
  * @change      
*/

@Rule(name="Anlegen Lagerposition im Anschluss", description="Anlegen Lagerposition im Anschluss")
public class AnlegenLagerpositionImAnschluss implements InsertFinalRule {

    public void insertFinal(InsertContext context) throws BusinessException {     
    }
}

Context: InsertContext

The context InsertContext 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

package org.nuclet.projekt; 

import org.nuclos.api.annotation.Rule; 
import org.nuclos.api.context.InsertContext; 
import org.nuclos.api.exception.BusinessException; 
import org.nuclos.api.rule.InsertFinalRule; 

/** 
 * @name AnsprechpartnerErstellen       
 * @description Unterstützende Regel zum Erstellen neuer Ansprechpartner aus Unterprojekten
 * @usage       
 * @change      
 * 
 */
@Rule(name="AnsprechpartnerErstellen", description="Unterstützende Regel zum Erstellen neuer Ansprechpartner aus Unterprojekten")
public class AnsprechpartnerErstellen implements InsertFinalRule {

	public void insertFinal(InsertContext context) throws BusinessException { 
        final Ansprechpartner boAnsprechpartner = context.getBusinessObject(Ansprechpartner.class);
        
        if (boAnsprechpartner.getUnterprojektsrefId() != null) {
            final Unterprojekt boUnterprojekt = Unterprojekt.get(boAnsprechpartner.getUnterprojektsrefId());
            
            boUnterprojekt.setAnsprechpartnerrefId(boAnsprechpartner.getId());
        
            boUnterprojekt.save();
        }
	}
}

Related pages

open book Server-side rules


Basics.

Open →

gear Server rule manager


Assign.

Open →

clipboard Rule execution order


Order.

Open →

  • Keine Stichwörter