Coverage Report - org.kuali.rice.kew.engine.node.ProcessDefinitionBo
 
Classes in this File Line Coverage Branch Coverage Complexity
ProcessDefinitionBo
0%
0/32
0%
0/6
1.375
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kew.engine.node;
 17  
 
 18  
 import org.hibernate.annotations.GenericGenerator;
 19  
 import org.hibernate.annotations.Parameter;
 20  
 import org.kuali.rice.core.framework.persistence.jpa.OrmUtils;
 21  
 import org.kuali.rice.kew.api.doctype.ProcessDefinitionContract;
 22  
 import org.kuali.rice.kew.doctype.bo.DocumentType;
 23  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 24  
 
 25  
 import javax.persistence.CascadeType;
 26  
 import javax.persistence.Column;
 27  
 import javax.persistence.Entity;
 28  
 import javax.persistence.FetchType;
 29  
 import javax.persistence.GeneratedValue;
 30  
 import javax.persistence.Id;
 31  
 import javax.persistence.JoinColumn;
 32  
 import javax.persistence.ManyToOne;
 33  
 import javax.persistence.OneToOne;
 34  
 import javax.persistence.Table;
 35  
 import javax.persistence.Version;
 36  
 import java.io.Serializable;
 37  
 
 38  
 
 39  
 /**
 40  
  * Represents a route path defined on a {@link DocumentType}.  A ProcessDefinition is a named entity which
 41  
  * simply points to an initial {@link RouteNode} which represents the beginning of the ProcessDefinition.
 42  
  * The path of the process can then be followed using the next nodes defined on the route nodes. 
 43  
  *
 44  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 45  
  */
 46  0
 @Entity
 47  
 @Table(name="KREW_DOC_TYP_PROC_T")
 48  
 //@Sequence(name="KREW_RTE_NODE_S",property="processId")
 49  0
 public class ProcessDefinitionBo implements Serializable, ProcessDefinitionContract {
 50  
 
 51  
         private static final long serialVersionUID = -6338857095673479752L;
 52  
     
 53  
     @Id
 54  
     @GeneratedValue(generator="KREW_RTE_NODE_S")
 55  
         @GenericGenerator(name="KREW_RTE_NODE_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
 56  
                         @Parameter(name="sequence_name",value="KREW_RTE_NODE_S"),
 57  
                         @Parameter(name="value_column",value="id")
 58  
         })
 59  
         @Column(name="DOC_TYP_PROC_ID")
 60  
         private String processId;
 61  
         @Column(name="NM")
 62  
         private String name;
 63  
         @ManyToOne(fetch=FetchType.EAGER)
 64  
         @JoinColumn(name="DOC_TYP_ID")
 65  
         private DocumentType documentType;
 66  
         @OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.MERGE})
 67  
         @JoinColumn(name="INIT_RTE_NODE_ID")
 68  
         private RouteNode initialRouteNode;
 69  0
     @Column(name="INIT_IND")
 70  
         private boolean initial = false;
 71  
         @Version
 72  
         @Column(name="VER_NBR")
 73  
         private Integer lockVerNbr;
 74  
         
 75  
         public String getProcessId() {
 76  0
                 return processId;
 77  
         }
 78  
         public void setProcessId(String processId) {
 79  0
                 this.processId = processId;
 80  0
         }
 81  
         public DocumentType getDocumentType() {
 82  0
                 return documentType;
 83  
         }
 84  
         public void setDocumentType(DocumentType documentType) {
 85  0
                 this.documentType = documentType;
 86  0
         }
 87  
         public RouteNode getInitialRouteNode() {
 88  0
                 return initialRouteNode;
 89  
         }
 90  
         public void setInitialRouteNode(RouteNode initialRouteNode) {
 91  0
                 this.initialRouteNode = initialRouteNode;
 92  0
         }
 93  
         public String getName() {
 94  0
                 return name;
 95  
         }
 96  
         public void setName(String name) {
 97  0
                 this.name = name;
 98  0
         }
 99  
         public boolean isInitial() {
 100  0
                 return initial;
 101  
         }
 102  
         public void setInitial(boolean initial) {
 103  0
                 this.initial = initial;
 104  0
         }
 105  
         public Integer getLockVerNbr() {
 106  0
                 return lockVerNbr;
 107  
         }
 108  
         public void setLockVerNbr(Integer lockVerNbr) {
 109  0
                 this.lockVerNbr = lockVerNbr;
 110  0
         }
 111  
 
 112  
         //@PrePersist
 113  
         public void beforeInsert(){
 114  0
                 OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());
 115  0
         }
 116  
 
 117  
         @Override
 118  
     public String getId() {
 119  0
         if (processId == null) {
 120  0
             return null;
 121  
         }
 122  0
         return processId.toString();
 123  
     }
 124  
 
 125  
     @Override
 126  
     public Long getVersionNumber() {
 127  0
         if (lockVerNbr == null) {
 128  0
             return null;
 129  
         }
 130  0
         return new Long(lockVerNbr.longValue());
 131  
     }
 132  
 
 133  
     @Override
 134  
     public String getDocumentTypeId() {
 135  0
         if (documentType == null) {
 136  0
             return null;
 137  
         }
 138  0
         return documentType.getId();
 139  
     }
 140  
 
 141  
 }