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 if 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);
}
}
}
}
} |