Sie zeigen eine alte Version dieser Seite an. Zeigen Sie die aktuelle Version an.

Unterschiede anzeigen Seitenhistorie anzeigen

« Vorherige Version anzeigen Version 3 Aktuelle »

globe with meridians Language: Deutsch · English

open book Event - Delete (final)

Event rule „Delete (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 deleted 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.rule.DeleteFinalRule; 
import org.nuclos.api.context.DeleteContext; 
import org.nuclos.api.annotation.Rule; 
import org.nuclos.api.exception.BusinessException; 

/** @name        
  * @description 
  * @usage       
  * @change      
*/
@Rule(name="Loeschen Lagerposition im Anschluss", description="Loeschen Lagerposition im Anschluss")
public class LoeschenLagerpositionImAnschluss implements DeleteFinalRule {
  
  public void deleteFinal(DeleteContext context) throws BusinessException { 
    }
}

Context: DeleteContext

The context DeleteContext 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 „Delete (final)“.

Example

package org.nuclet.company; 

import java.util.Date;
import java.util.List;
import org.nuclos.api.annotation.Rule;
import org.nuclos.api.businessobject.BusinessObject;
import org.nuclos.api.businessobject.Query;
import org.nuclos.api.context.DeleteContext;
import org.nuclos.api.exception.BusinessException;
import org.nuclos.api.provider.BusinessObjectProvider;
import org.nuclos.api.provider.QueryProvider;
import org.nuclos.api.rule.DeleteFinalRule;

/** @name        
  * @description 
  * @usage       
  * @change      
*/
@Rule(name="BestellungFinalDelete", description="BestellungFinalDelete")
public class BestellungFinalDelete implements DeleteFinalRule {
   
 public void deleteFinal(DeleteContext context) throws BusinessException { 
            
		Bestellung businessObject = context.getBusinessObject(Bestellung.class);

        Query<History> allHistoryEntries = QueryProvider.create(History.class);
        allHistoryEntries.where(History.EntityId.equals(businessObject.getId()));
        
        List<History> results = QueryProvider.execute(allHistoryEntries);
        
        for (History b : results) {
            if (context.isLogical()) {
                b.setBemerkung("logical delete");                
            } else {
                b.setBemerkung("physical delete");
            }
            BusinessObjectProvider.update(b);
        }
    }
}

Related pages

open book Server-side rules


Basics.

Open →

gear Server rule manager


Assign.

Open →

clipboard Rule execution order


Order.

Open →

  • Keine Stichwörter