001: /*
002: * Copyright 2006-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.financial.service;
017:
018: import org.kuali.core.util.KualiDecimal;
019: import org.kuali.module.financial.bo.CashDrawer;
020:
021: /**
022: * This service interface defines methods that a CashDrawerService implementation must provide.
023: *
024: */
025: public interface CashDrawerService {
026: /**
027: * Closes the CashDrawer instance associated with the given workgroupName, creating one if necessary.
028: *
029: * @param workgroupName The workgroup name used to retrieve the cash drawer to be closed.
030: */
031: public void closeCashDrawer(String workgroupName);
032:
033: /**
034: * Closes the cash drawer associated with the given document
035: *
036: * @param cd The cash drawer to closed.
037: */
038: public void closeCashDrawer(CashDrawer cd);
039:
040: /**
041: *
042: * Opens the CashDrawer instance associated with the given workgroupName, creating one if necessary. Records the given
043: * documentId as the document which opened the cashdrawer.
044: *
045: * @param workgroupName The workgroup name to be used to retrieve the cash drawer to be closed.
046: * @param documentId The id of the document used to open the cash drawer.
047: * @return The opened version of the cash drawer.
048: */
049: public CashDrawer openCashDrawer(String workgroupName,
050: String documentId);
051:
052: /**
053: * Opens the given cash drawer
054: *
055: * @param cd The cash drawer to open
056: * @param documentId the document number which is opening the cash drawer
057: * @return The opened version of the cash drawer
058: */
059: public CashDrawer openCashDrawer(CashDrawer cd, String documentId);
060:
061: /**
062: * Locks the currently-open CashDrawer instance associated with the given workgroupName, throwing an IllegalStateException if
063: * that cashDrawer is not open (i.e. is closed or locked). Records the given documentId as the document which locked the
064: * cashDrawer.
065: *
066: * @param workgroupName The workgroup name used to retrieve the cash drawer to be locked.
067: * @param documentId The id of the document used to lock the cash drawer.
068: */
069: public void lockCashDrawer(String workgroupName, String documentId);
070:
071: /**
072: * Locks the given cash drawer, if it is open
073: *
074: * @param cd The cash drawer to open
075: * @param documentId The document id which is locking the cash drawer
076: */
077: public void lockCashDrawer(CashDrawer cd, String documentId);
078:
079: /**
080: * Unlocks the currently-locked CashDrawer instance associated with the given workgroupName,
081: * throwing an IllegalStateException if that cashDrawer is not locked (i.e. is closed or open).
082: * Records the given documentId as the document which unlocked the cashDrawer.
083: *
084: * @param workgroupName The workgroup name used to retrieve the cash drawer to be unlocked.
085: * @param documentId The id of the document used to unlock the cash drawer.
086: */
087: public void unlockCashDrawer(String workgroupName, String documentId);
088:
089: /**
090: * Unlocks the given cash drawer, if it is open and locked
091: *
092: * @param cd The cash drawer to unlock
093: * @param documentId The document which is unlocking the cash drawer
094: */
095: public void unlockCashDrawer(CashDrawer cd, String documentId);
096:
097: /**
098: * Retrieves the CashDrawer instance associated with the given workgroupName, if any. If autocreate is true,
099: * and no CashDrawer for the given workgroupName exists, getByWorkgroupName will return a newly-created
100: * (non-persisted) CashDrawer instance.
101: *
102: * @param workgroupName The workgroup name used to retrieve the cash drawer.
103: * @param autocreate Identifies whether or not a new cash drawer will be created if one does not already exist for the workgroup name provided.
104: * @return CashDrawer instance or null
105: */
106: public CashDrawer getByWorkgroupName(String workgroupName,
107: boolean autocreate);
108:
109: /**
110: * Calculates the total amount of all the currency in the drawer.
111: * NOTE: The value returned only refers to paper currency in the drawer and does not include coin amounts.
112: *
113: * @param drawer The cash drawer to calculate the currency total from.
114: * @return The summed amount of currency in the cash drawer.
115: */
116: public KualiDecimal getCurrencyTotal(CashDrawer drawer);
117:
118: /**
119: * Calculates the total amount of all the coins in the drawer.
120: *
121: * @param drawer The drawer to calculate the coin total from.
122: * @return The summed value of coins in the drawer.
123: */
124: public KualiDecimal getCoinTotal(CashDrawer drawer);
125: }
|