Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Auszug
hiddentrue

Nuclos event rule Delete: interface, DeleteContext, structure, assignment in the server rule manager, example code (Java).

globe with meridians Language: Deutsch · English

open book Event - Delete

Event rule „Delete“: interface, context and an example – how to react to this Nuclos event.

Status
colourGrey
titleReferenz
Status
colourBlue
titleDeveloper
Status
colourGreen
titleUpdated: Jul 2026
Status
colourGrey
titleapplies to Nuclos 4.2026.x

Panel
bgColor#F4F5F7

On this page

Inhalt
maxLevel2
minLevel2

When does the rule fire?

This server-side rule runs when a record is deleted. It can be assigned to a business object.

Structure

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

Codeblock
languagejava
package org.nuclet.lager; 

import org.nuclos.api.rule.DeleteRule; 
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", description="Loeschen Lagerposition")
public class LoeschenLagerposition implements DeleteRule {
    
    public void delete(DeleteContext context) throws BusinessException { 
    }
}
Info
titleContext: 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“.

Example

Codeblock
languagejava
package org.nuclet.company; 

import org.nuclos.api.rule.DeleteRule; 
import org.nuclos.api.businessobject.Query;
import org.nuclos.api.context.DeleteContext; 
import org.nuclos.api.annotation.Rule; 
import org.nuclos.api.exception.BusinessException; 
import org.nuclos.api.provider.BusinessObjectProvider;
import org.nuclos.api.provider.QueryProvider;

/** @name        
  * @description 
  * @usage       
  * @change      
*/
@Rule(name="BestellungLoeschen", description="BestellungLoeschen")
public class BestellungLoeschen implements DeleteRule {

    public void delete(DeleteContext context) throws BusinessException { 
        
        Bestellung b = context.getBusinessObject(Bestellung.class);
        
		// create new history entry
        AnfragenHistory newHistory = new AnfragenHistory();
        newHistory.setBestellungId(b.getId());
        newHistory.setLogicalDelete(context.isLogical());
		
		// save new entry
        BusinessObjectProvider.insert(newHistory);
        
    }
}

Related pages

open book Server-side rules


Basics.

Open →

gear Server rule manager


Assign.

Open →

clipboard Rule execution order


Order.

Open →