001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.module.ar.businessobject;
017    
018    import java.sql.Date;
019    import java.util.LinkedHashMap;
020    
021    import org.apache.commons.lang.StringUtils;
022    import org.kuali.kfs.module.ar.document.CustomerInvoiceDocument;
023    import org.kuali.kfs.sys.context.SpringContext;
024    import org.kuali.rice.kim.bo.Person;
025    import org.kuali.rice.kns.bo.Inactivateable;
026    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
027    
028    /**
029     * @author Kuali Nervous System Team (kualidev@oncourse.iu.edu)
030     */
031    
032    public class CustomerInvoiceRecurrenceDetails extends PersistableBusinessObjectBase implements Inactivateable {
033    
034        private String invoiceNumber;
035        private String customerNumber;
036        private Date documentRecurrenceBeginDate;
037        private Date documentRecurrenceEndDate;
038        private Integer documentTotalRecurrenceNumber;
039        private String documentRecurrenceIntervalCode;
040        private String documentInitiatorUserIdentifier;
041        private Date documentLastCreateDate;
042        private boolean active;
043    
044        private AccountsReceivableDocumentHeader accountsReceivableDocumentHeader;
045        private CustomerInvoiceDocument customerInvoiceDocument;
046        private Customer customer;
047        private Person documentInitiatorUser;
048        
049        
050        /**
051         * Default constructor.
052         */
053        public CustomerInvoiceRecurrenceDetails() {
054    
055        }
056    
057    
058    
059    
060        /**
061         * Gets the invoiceNumber attribute.
062         * 
063         * @return Returns the invoiceNumber
064         * 
065         */
066        public String getInvoiceNumber() {
067            return invoiceNumber;
068        }
069    
070    
071        /**
072         * Sets the invoiceNumber attribute.
073         * 
074         * @param invoiceNumber The invoiceNumber to set.
075         * 
076         */
077        public void setInvoiceNumber(String invoiceNumber) {
078            this.invoiceNumber = invoiceNumber;
079        }
080    
081        /**
082         * Gets the customerNumber attribute.
083         * 
084         * @return Returns the customerNumber
085         * 
086         */
087        public String getCustomerNumber() { 
088            return customerNumber;
089        }
090    
091        /**
092         * Sets the customerNumber attribute.
093         * 
094         * @param customerNumber The customerNumber to set.
095         * 
096         */
097        public void setCustomerNumber(String customerNumber) {
098            this.customerNumber = customerNumber;
099        }
100    
101    
102        /**
103         * Gets the documentRecurrenceBeginDate attribute.
104         * 
105         * @return Returns the documentRecurrenceBeginDate
106         * 
107         */
108        public Date getDocumentRecurrenceBeginDate() { 
109            return documentRecurrenceBeginDate;
110        }
111    
112        /**
113         * Sets the documentRecurrenceBeginDate attribute.
114         * 
115         * @param documentRecurrenceBeginDate The documentRecurrenceBeginDate to set.
116         * 
117         */
118        public void setDocumentRecurrenceBeginDate(Date documentRecurrenceBeginDate) {
119            this.documentRecurrenceBeginDate = documentRecurrenceBeginDate;
120        }
121    
122    
123        /**
124         * Gets the documentRecurrenceEndDate attribute.
125         * 
126         * @return Returns the documentRecurrenceEndDate
127         * 
128         */
129        public Date getDocumentRecurrenceEndDate() { 
130            return documentRecurrenceEndDate;
131        }
132    
133        /**
134         * Sets the documentRecurrenceEndDate attribute.
135         * 
136         * @param documentRecurrenceEndDate The documentRecurrenceEndDate to set.
137         * 
138         */
139        public void setDocumentRecurrenceEndDate(Date documentRecurrenceEndDate) {
140            this.documentRecurrenceEndDate = documentRecurrenceEndDate;
141        }
142    
143    
144        /**
145         * Gets the documentTotalRecurrenceNumber attribute.
146         * 
147         * @return Returns the documentTotalRecurrenceNumber
148         * 
149         */
150        public Integer getDocumentTotalRecurrenceNumber() { 
151            return documentTotalRecurrenceNumber;
152        }
153    
154        /**
155         * Sets the documentTotalRecurrenceNumber attribute.
156         * 
157         * @param documentTotalRecurrenceNumber The documentTotalRecurrenceNumber to set.
158         * 
159         */
160        public void setDocumentTotalRecurrenceNumber(Integer documentTotalRecurrenceNumber) {
161            this.documentTotalRecurrenceNumber = documentTotalRecurrenceNumber;
162        }
163    
164    
165        /**
166         * Gets the documentRecurrenceIntervalCode attribute.
167         * 
168         * @return Returns the documentRecurrenceIntervalCode
169         * 
170         */
171        public String getDocumentRecurrenceIntervalCode() { 
172            return documentRecurrenceIntervalCode;
173        }
174    
175        /**
176         * Sets the documentRecurrenceIntervalCode attribute.
177         * 
178         * @param documentRecurrenceIntervalCode The documentRecurrenceIntervalCode to set.
179         * 
180         */
181        public void setDocumentRecurrenceIntervalCode(String documentRecurrenceIntervalCode) {
182            this.documentRecurrenceIntervalCode = documentRecurrenceIntervalCode;
183        }
184    
185        /**
186         * Gets the documentInitiatorUserIdentifier attribute.
187         * 
188         * @return Returns the documentInitiatorUserIdentifier
189         * 
190         */
191        public String getDocumentInitiatorUserIdentifier() { 
192            return documentInitiatorUserIdentifier;
193        }
194    
195        /**
196         * Sets the documentInitiatorUserIdentifier attribute.
197         * 
198         * @param documentInitiatorUserIdentifier The documentInitiatorUserIdentifier to set.
199         * 
200         */
201        public void setDocumentInitiatorUserIdentifier(String documentInitiatorUserIdentifier) {
202            this.documentInitiatorUserIdentifier = documentInitiatorUserIdentifier;
203        }
204    
205    
206        public Person getDocumentInitiatorUser() {
207            documentInitiatorUser = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(documentInitiatorUserIdentifier, documentInitiatorUser);
208            return documentInitiatorUser;
209        }
210    
211        /**
212         * @param documentInitiatorUser The documentInitiatorUser to set.
213         */
214        public void setDocumentInitiatorUser(Person documentInitiatorUser) {
215            this.documentInitiatorUser = documentInitiatorUser;
216        }
217        
218        /**
219         * The network id of the document initiator
220         * 
221         * @return the network id of the document initiator
222         */
223        public String getDocumentInitiatorUserPersonUserIdentifier() {
224            return this.getDocumentInitiatorUser().getPrincipalName();
225        }
226    
227    
228        /**
229         * Gets the documentLastCreateDate attribute.
230         * 
231         * @return Returns the documentLastCreateDate
232         * 
233         */
234        public Date getDocumentLastCreateDate() { 
235            return documentLastCreateDate;
236        }
237    
238        /**
239         * Sets the documentLastCreateDate attribute.
240         * 
241         * @param documentLastCreateDate The documentLastCreateDate to set.
242         * 
243         */
244        public void setDocumentLastCreateDate(Date documentLastCreateDate) {
245            this.documentLastCreateDate = documentLastCreateDate;
246        }
247    
248    
249        /**
250         * Gets the active attribute.
251         * 
252         * @return Returns the active
253         * 
254         */
255        public boolean isActive() { 
256            return active;
257        }
258    
259        /**
260         * Sets the active attribute.
261         * 
262         * @param active The active to set.
263         * 
264         */
265        public void setActive(boolean active) {
266            this.active = active;
267        }
268    
269        /**
270         * Gets the customer attribute. 
271         * @return Returns the customer.
272         */
273        public Customer getCustomer() {
274            return customer;
275        }
276    
277        /**
278         * Sets the customer attribute value.
279         * @param customer The customer to set.
280         * @deprecated
281         */
282        public void setCustomer(Customer customer) {
283            this.customer = customer;
284        }
285    
286        
287    
288        /**
289         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
290         */
291        protected LinkedHashMap toStringMapper() {
292            LinkedHashMap m = new LinkedHashMap();      
293            m.put("documentNumber", this.invoiceNumber);
294            return m;
295        }
296    
297        public AccountsReceivableDocumentHeader getAccountsReceivableDocumentHeader() {
298            return accountsReceivableDocumentHeader;
299        }
300    
301        /**
302         * Sets the accountsReceivableDocumentHeader attribute value.
303         * @param accountsReceivableDocumentHeader The AccountsReceivableDocumentHeader to set.
304         * @deprecated
305         */
306        public void setAccountsReceivableDocumentHeader(AccountsReceivableDocumentHeader accountsReceivableDocumentHeader) {
307            this.accountsReceivableDocumentHeader = accountsReceivableDocumentHeader;
308        }
309    
310        
311        /**
312         * Gets the customerName attribute.
313         * 
314         * @return Returns the customerName
315         * 
316         */
317        public String getCustomerName() {
318            return this.getCustomer().getCustomerName();
319        }
320    
321    
322        public CustomerInvoiceDocument getCustomerInvoiceDocument() {
323            return customerInvoiceDocument;
324        }
325    
326        /**
327         * Sets the customerInvoiceDocument attribute value.
328         * @param customerInvoiceDocument The customerInvoiceDocument to set.
329         * @deprecated
330         */
331        public void setCustomerInvoiceDocument(CustomerInvoiceDocument customerInvoiceDocument) {
332            this.customerInvoiceDocument = customerInvoiceDocument;
333        }
334    
335    }
336