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.module.labor.batch.poster.impl;
017:
018: import java.util.ArrayList;
019: import java.util.List;
020:
021: import org.kuali.kfs.KFSConstants;
022: import org.kuali.kfs.service.ParameterService;
023: import org.kuali.kfs.service.impl.ParameterConstants;
024: import org.kuali.module.gl.batch.poster.VerifyTransaction;
025: import org.kuali.module.gl.bo.Transaction;
026: import org.kuali.module.gl.util.Message;
027: import org.kuali.module.labor.LaborConstants;
028: import org.kuali.module.labor.bo.LaborTransaction;
029: import org.kuali.module.labor.rules.TransactionFieldValidator;
030: import org.kuali.module.labor.util.MessageBuilder;
031: import org.springframework.transaction.annotation.Transactional;
032:
033: /**
034: * This class is a validator for the transactions processed by Labor Poster.
035: */
036: @Transactional
037: public class LaborPosterTransactionValidator implements
038: VerifyTransaction {
039:
040: /**
041: * @see org.kuali.module.gl.batch.poster.VerifyTransaction#verifyTransaction(org.kuali.module.gl.bo.Transaction)
042: */
043: public List<Message> verifyTransaction(Transaction transaction) {
044: List<Message> messageList = new ArrayList<Message>();
045:
046: LaborTransaction laborTransaction = (LaborTransaction) transaction;
047:
048: MessageBuilder.addMessageIntoList(messageList,
049: TransactionFieldValidator
050: .checkUniversityFiscalYear(laborTransaction));
051: MessageBuilder.addMessageIntoList(messageList,
052: TransactionFieldValidator
053: .checkChartOfAccountsCode(laborTransaction));
054: MessageBuilder.addMessageIntoList(messageList,
055: TransactionFieldValidator
056: .checkAccountNumber(laborTransaction));
057: MessageBuilder
058: .addMessageIntoList(
059: messageList,
060: TransactionFieldValidator
061: .checkSubAccountNumber(
062: laborTransaction,
063: LaborConstants.ANNUAL_CLOSING_DOCUMENT_TYPE_CODE));
064: MessageBuilder
065: .addMessageIntoList(
066: messageList,
067: TransactionFieldValidator
068: .checkUniversityFiscalPeriodCode(laborTransaction));
069: MessageBuilder
070: .addMessageIntoList(
071: messageList,
072: TransactionFieldValidator
073: .checkFinancialBalanceTypeCode(laborTransaction));
074: MessageBuilder.addMessageIntoList(messageList,
075: TransactionFieldValidator
076: .checkFinancialObjectCode(laborTransaction));
077: MessageBuilder.addMessageIntoList(messageList,
078: TransactionFieldValidator
079: .checkFinancialSubObjectCode(laborTransaction));
080: MessageBuilder
081: .addMessageIntoList(
082: messageList,
083: TransactionFieldValidator
084: .checkFinancialObjectTypeCode(laborTransaction));
085: MessageBuilder
086: .addMessageIntoList(
087: messageList,
088: TransactionFieldValidator
089: .checkFinancialDocumentTypeCode(laborTransaction));
090: MessageBuilder
091: .addMessageIntoList(
092: messageList,
093: TransactionFieldValidator
094: .checkFinancialDocumentNumber(laborTransaction));
095: MessageBuilder
096: .addMessageIntoList(
097: messageList,
098: TransactionFieldValidator
099: .checkFinancialSystemOriginationCode(laborTransaction));
100: MessageBuilder
101: .addMessageIntoList(
102: messageList,
103: TransactionFieldValidator
104: .checkTransactionDebitCreditCode(laborTransaction));
105: MessageBuilder
106: .addMessageIntoList(
107: messageList,
108: TransactionFieldValidator
109: .checkTransactionLedgerEntrySequenceNumber(laborTransaction));
110: MessageBuilder
111: .addMessageIntoList(messageList,
112: TransactionFieldValidator
113: .checkEmplid(laborTransaction));
114:
115: return messageList;
116: }
117: }
|