Package org.nuclos.api.rule
Interface PrintRule
@RuleType(name="nuclos.ruletype.printrule.name",
description="nuclos.ruletype.printrule.description")
public interface PrintRule
PrintRule
is the interface that should be used to make an rule
applicable for Print-Events.
Classes implementing this interface can be attached to the printout process.
{\@code package de.mynuclet; import org.nuclos.api.rule.PrintRule; import org.nuclos.api.context.PrintContext; import org.nuclos.api.printout.Printout; import org.nuclos.api.annotation.Rule; import org.nuclos.api.exception.BusinessException; import org.nuclos.api.printout.PrintoutList; import de.mynuclet.formulare.*; \@Rule(name="PrintRuleBeispiel", description="PrintRule Beispiel") public class PrintRuleBeispiel implements PrintRule { public void print(PrintContext context) throws BusinessException { final Auftrag auftrag = context.getBusinessObject(Auftrag.class); context.log("printoutlist " + context.getPrintoutList()); if ("EUR".equals(auftrag.getWaehrung())) { context.log("Die Währung \"EUR\" wurde angegeben"); for (final Printout printout : context.getPrintoutList()) { if (AuftragsbestaetigungLiefergeschaeftPO.class.equals(printout.getClass())) { context.log("attach output format " + AuftragsbestaetigungProjektgeschaeftPO.Auftrag_Projektgeschaeft.getClass().getName()); printout.getOutputFormats().add(AuftragsbestaetigungProjektgeschaeftPO.Auftrag_Projektgeschaeft); context.log("after attach" + printout.getOutputFormats().size()); } else { context.log(printout.getClass() + " != " + AuftragsbestaetigungLiefergeschaeftPO.class.getName()); } } } } } }
- Author:
- Moritz Neuhaeuser
-
Method Summary
Modifier and TypeMethodDescriptionvoid
print
(PrintContext context) PrintContext
is the context providing all print - relevant attributes and methods.
-
Method Details
-
print
PrintContext
is the context providing all print - relevant attributes and methods.- Parameters:
context
-PrintContext
context- Throws:
BusinessException
-