Auslesen eines Systemparameters
Methode | Beispiel |
---|---|
getSystemParameter | package org.nuclet.businessentity; import org.nuclos.api.annotation.Rule; import org.nuclos.api.context.UpdateContext; import org.nuclos.api.exception.BusinessException; import org.nuclos.api.provider.ParameterProvider; import org.nuclos.api.rule.UpdateRule; import org.nuclos.parameter.NuclosSystemParameter; /** @name * @description * @usage * @change */ @Rule(name="SendConfirmationEmail", description="SendConfirmationEmail") public class SendConfirmationEmail implements UpdateRule { public void update(UpdateContext context) throws BusinessException { Auftrag a = context.getBusinessObject(Auftrag.class); if(a.isApproved()) { String useEmail = ParameterProvider.getSystemParameter(NuclosSystemParameter.ConfirmationEmailIsActive); // First check, if the value of this parameter is not null if (useEmail != null) { if (usrEmail.equals("Y")) { // Following method creates a NuclosEmail and sends it to the user mentioned in "Auftrag" a. // For lack of space this method is not implemented in this example. Suppose it does exist. sendConfirmationEmail(a); } } } } } Erläuterung: Für einen abgeschlossenen Auftrag soll eine Bestätigungsemail versandt werden. In den Systemparametern wurde nun ein Parameter namens "ConfirmationEmailIsActive" hinterlegt, der festlegt, ob das System (unabhängig von Aufträgen) im aktuellen Zustand überhaupt den Versandt ermöglicht oder nicht. Findet die Regel den Wert "Y" (steht für Yes), dann kann die Email verschickt werden. |
Systemparameter zur Konfiguration des Emailservers siehe Systemparameter
Überblick
Inhalte