Language: Deutsch · English
Event rule „Delete“: 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
This server-side rule runs when a record is deleted. It can be assigned to a business object.
Skeleton of the rule class (the rule editor creates it automatically):
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 {
}
}
Context: DeleteContext
The context DeleteContext provides the affected BusinessObject via context.getBusinessObject(...); the RuleContext functions (providers) are also available. A BusinessException aborts the operation.
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“.
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);
}
}