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.purap.bo;
017:
018: import java.util.LinkedHashMap;
019: import java.util.List;
020:
021: import org.kuali.core.bo.Note;
022: import org.kuali.core.bo.PersistableBusinessObjectBase;
023: import org.kuali.core.service.KualiConfigurationService;
024: import org.kuali.core.service.NoteService;
025: import org.kuali.core.util.TypedArrayList;
026: import org.kuali.kfs.KFSConstants;
027: import org.kuali.kfs.context.SpringContext;
028:
029: /**
030: * Base class for Related View Business Objects.
031: */
032: public abstract class AbstractRelatedView extends
033: PersistableBusinessObjectBase {
034:
035: private Integer accountsPayablePurchasingDocumentLinkIdentifier;
036: private Integer purapDocumentIdentifier;
037: private String documentNumber;
038:
039: private List<Note> notes;
040:
041: public Integer getAccountsPayablePurchasingDocumentLinkIdentifier() {
042: return accountsPayablePurchasingDocumentLinkIdentifier;
043: }
044:
045: public void setAccountsPayablePurchasingDocumentLinkIdentifier(
046: Integer accountsPayablePurchasingDocumentLinkIdentifier) {
047: this .accountsPayablePurchasingDocumentLinkIdentifier = accountsPayablePurchasingDocumentLinkIdentifier;
048: }
049:
050: public Integer getPurapDocumentIdentifier() {
051: return purapDocumentIdentifier;
052: }
053:
054: public void setPurapDocumentIdentifier(
055: Integer purapDocumentIdentifier) {
056: this .purapDocumentIdentifier = purapDocumentIdentifier;
057: }
058:
059: public String getDocumentNumber() {
060: return documentNumber;
061: }
062:
063: public void setDocumentNumber(String documentNumber) {
064: this .documentNumber = documentNumber;
065: }
066:
067: public List<Note> getNotes() {
068: if (notes == null) {
069: notes = new TypedArrayList(Note.class);
070: List<Note> tmpNotes = SpringContext.getBean(
071: NoteService.class).getByRemoteObjectId(
072: this .getObjectId());
073: for (Note note : tmpNotes) {
074: notes.add(note);
075: }
076: }
077: return notes;
078: }
079:
080: public String getUrl() {
081: return SpringContext.getBean(KualiConfigurationService.class)
082: .getPropertyString(KFSConstants.WORKFLOW_URL_KEY)
083: + "/DocHandler.do?docId="
084: + getDocumentNumber()
085: + "&command=displayDocSearchView";
086: }
087:
088: /**
089: * @see org.kuali.core.bo.BusinessObjectBase#toStringMapper()
090: */
091: protected LinkedHashMap toStringMapper() {
092: LinkedHashMap m = new LinkedHashMap();
093: if (this .accountsPayablePurchasingDocumentLinkIdentifier != null) {
094: m
095: .put(
096: "accountsPayablePurchasingDocumentLinkIdentifier",
097: this.accountsPayablePurchasingDocumentLinkIdentifier
098: .toString());
099: }
100: return m;
101: }
102: }
|