001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.kfs.rule.event;
017:
018: import org.kuali.core.rule.BusinessRule;
019: import org.kuali.core.rule.event.KualiDocumentEventBase;
020: import org.kuali.core.util.GeneralLedgerPendingEntrySequenceHelper;
021: import org.kuali.kfs.document.GeneralLedgerPostingDocument;
022: import org.kuali.kfs.rule.GenerateGeneralLedgerDocumentPendingEntriesRule;
023:
024: /**
025: * Event used for documents to generate specific pending entries.
026: */
027: public final class GenerateGeneralLedgerDocumentPendingEntriesEvent
028: extends KualiDocumentEventBase {
029: private GeneralLedgerPendingEntrySequenceHelper sequenceHelper;
030:
031: /**
032: * Constructs a GenerateGeneralLedgerPendingEntriesEvent with the given errorPathPrefix, document, accountingLine, and counter
033: *
034: * @param errorPathPrefix
035: * @param glDocument
036: * @param sequenceHelper
037: */
038: public GenerateGeneralLedgerDocumentPendingEntriesEvent(
039: String errorPathPrefix,
040: GeneralLedgerPostingDocument glDocument,
041: GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
042: super ("creating generatePendingEntries event for document "
043: + getDocumentId(glDocument), errorPathPrefix,
044: glDocument);
045: // note that we want to override the parent b/c we do want this by reference here
046: // the parent does a deepCopy and we don't want that b/c we need to set the GLPEs into the document
047: super .document = glDocument;
048: this .sequenceHelper = sequenceHelper;
049: }
050:
051: /**
052: * Constructs a GenerateGeneralLedgerPendingEntriesEvent with the given document and accountingLine
053: *
054: * @param glDocument
055: * @param sequenceHelper
056: */
057: public GenerateGeneralLedgerDocumentPendingEntriesEvent(
058: GeneralLedgerPostingDocument glDocument,
059: GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
060: this ("", glDocument, sequenceHelper);
061: }
062:
063: /**
064: * @return GeneralLedgerPostingDocument associated with this event
065: */
066: public GeneralLedgerPostingDocument getGeneralLedgerPostingDocument() {
067: return (GeneralLedgerPostingDocument) getDocument();
068: }
069:
070: /**
071: * @return sequenceHelper associated with this event
072: */
073: public GeneralLedgerPendingEntrySequenceHelper getSequenceHelper() {
074: return sequenceHelper;
075: }
076:
077: /**
078: * This method sets the value of the sequenceHelper.
079: *
080: * @param sequenceHelper
081: */
082: public void setSequenceHelper(
083: GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
084: this .sequenceHelper = sequenceHelper;
085: }
086:
087: /**
088: * @see org.kuali.core.rule.event.KualiDocumentEvent#getRuleInterfaceClass()
089: */
090: public Class getRuleInterfaceClass() {
091: return GenerateGeneralLedgerDocumentPendingEntriesRule.class;
092: }
093:
094: /**
095: * @see org.kuali.core.rule.event.KualiDocumentEvent#invokeRuleMethod(org.kuali.core.rule.BusinessRule)
096: */
097: public boolean invokeRuleMethod(BusinessRule rule) {
098: return ((GenerateGeneralLedgerDocumentPendingEntriesRule) rule)
099: .processGenerateDocumentGeneralLedgerPendingEntries(
100: (GeneralLedgerPostingDocument) getDocument(),
101: getSequenceHelper());
102: }
103: }
|