001/** 002 * Copyright 2005-2016 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 */ 016package org.kuali.rice.kew.doctype; 017 018import org.kuali.rice.kew.doctype.bo.DocumentType; 019import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 020 021import javax.persistence.*; 022 023 024/** 025 * Model bean representing the valid application document statuses for a document type 026 * An instance of this class represents a single valid status for a given document type. 027 * 028 * The purpose of the Application Document Status is to provide an alternative to the 029 * KEW Route Status. Some documents may have a variety of statuses relating to where they are 030 * in their lifecycle. The application document status provides a means to for a document type to have its 031 * own set of statuses. 032 * 033 * A policy defined in the document type definition for a document determines if the Application 034 * Document Status is to be used. In the document definition, a list of valid application statuses 035 * for the document may also be defined. If the list of valid statuses are not defined, then any status 036 * value may be assigned by the client. 037 * 038 * 039 * @author Dan Seibert 040 * 041 */ 042@Entity 043@Table(name="KREW_DOC_TYP_APP_DOC_STAT_T") 044public class ApplicationDocumentStatus extends PersistableBusinessObjectBase { 045 private static final long serialVersionUID = -2212481684546954746L; 046 047 @EmbeddedId 048 private ApplicationDocumentStatusId applicationDocumentStatusId; 049 050 // TODO: JPA map ordering field 051 private Integer sequenceNumber; 052 053 @MapsId("documentTypeId") 054 @ManyToOne(fetch=FetchType.EAGER) 055 @JoinColumn(name="DOC_TYP_ID") 056 private DocumentType documentType; 057 058 @Transient 059 private String documentTypeId; 060 @Transient 061 private String statusName; 062 063 // TODO: JPA map 064 private String categoryName; 065 066 public ApplicationDocumentStatusId getApplicationDocumentStatusId() { 067 if (this.applicationDocumentStatusId == null) { 068 this.applicationDocumentStatusId = new ApplicationDocumentStatusId(); 069 } 070 return this.applicationDocumentStatusId; 071 } 072 073 public void setApplicationDocumentStatusId(ApplicationDocumentStatusId documentStatusId) { 074 this.applicationDocumentStatusId = documentStatusId; 075 } 076 077 public String getDocumentTypeId() { 078 return (this.getApplicationDocumentStatusId().getDocumentTypeId() != null) ? this.getApplicationDocumentStatusId().getDocumentTypeId() : this.documentTypeId; 079 } 080 081 public void setDocumentTypeId(String documentTypeId) { 082 this.documentTypeId = documentTypeId; 083 this.getApplicationDocumentStatusId().setDocumentTypeId(documentTypeId); 084 } 085 086 public String getStatusName() { 087 return (this.getApplicationDocumentStatusId().getStatusName() != null) ? this.getApplicationDocumentStatusId().getStatusName() : this.statusName; 088 } 089 090 public void setStatusName(String statusName) { 091 this.statusName = statusName; 092 this.getApplicationDocumentStatusId().setStatusName(statusName); 093 } 094 095 public Integer getSequenceNumber() { 096 return sequenceNumber; 097 } 098 099 public void setSequenceNumber(Integer sequenceNumber) { 100 this.sequenceNumber = sequenceNumber; 101 } 102 103 public String getCategoryName() { 104 return categoryName; 105 } 106 107 public void setCategoryName(String categoryName) { 108 this.categoryName = categoryName; 109 } 110 111 public DocumentType getDocumentType() { 112 return this.documentType; 113 } 114 115 public void setDocumentType(DocumentType documentType) { 116 this.documentType = documentType; 117 } 118}