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.kim.bo.ui; 017 018import org.hibernate.annotations.GenericGenerator; 019import org.hibernate.annotations.Parameter; 020import org.kuali.rice.kew.api.util.CodeTranslator; 021import org.kuali.rice.kim.api.responsibility.Responsibility; 022import org.kuali.rice.kim.api.services.KimApiServiceLocator; 023import org.kuali.rice.kim.impl.responsibility.ResponsibilityBo; 024import org.kuali.rice.kim.impl.role.RoleResponsibilityBo; 025import org.kuali.rice.krad.service.KRADServiceLocator; 026import org.kuali.rice.krad.util.ObjectUtils; 027 028import javax.persistence.Column; 029import javax.persistence.Entity; 030import javax.persistence.GeneratedValue; 031import javax.persistence.Id; 032import javax.persistence.IdClass; 033import javax.persistence.Table; 034import javax.persistence.Transient; 035 036/** 037 * This is a description of what this class does - shyu don't forget to fill this in. 038 * 039 * @author Kuali Rice Team (rice.collab@kuali.org) 040 * 041 */ 042@IdClass(KimDocumentRoleResponsibilityActionId.class) 043@Entity 044@Table(name="KRIM_PND_ROLE_RSP_ACTN_MT") 045public class KimDocumentRoleResponsibilityAction extends KimDocumentBoEditableBase { 046 private static final long serialVersionUID = 696663543888096105L; 047 @Id 048 @GeneratedValue(generator="KRIM_ROLE_RSP_ACTN_ID_S") 049 @GenericGenerator(name="KRIM_ROLE_RSP_ACTN_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={ 050 @Parameter(name="sequence_name",value="KRIM_ROLE_RSP_ACTN_ID_S"), 051 @Parameter(name="value_column",value="id") 052 }) 053 @Column(name="ROLE_RSP_ACTN_ID") 054 protected String roleResponsibilityActionId; 055 @Column(name="ROLE_RSP_ID") 056 protected String roleResponsibilityId; 057 @Column(name="ROLE_MBR_ID") 058 protected String roleMemberId; 059 @Column(name="ACTN_TYP_CD") 060 protected String actionTypeCode; 061 @Column(name="ACTN_PLCY_CD") 062 protected String actionPolicyCode; 063 @Column(name="PRIORITY_NBR") 064 protected Integer priorityNumber; 065 @Column(name="FRC_ACTN") 066 protected boolean forceAction; 067 // temporary default value in lieu of optimistic locking 068 @Column(name="VER_NBR") 069 protected Long versionNumber = (long) 0; 070 @Transient 071 protected ResponsibilityBo kimResponsibility; 072 @Transient 073 protected RoleResponsibilityBo roleResponsibility; 074 075 076 077 /*{ 078 roleResponsibility = new RoleResponsibilityImpl(); 079 roleResponsibility.setKimResponsibility(new KimResponsibilityImpl()); 080 roleResponsibility.getKimResponsibility().setTemplate(new KimResponsibilityTemplateImpl()); 081 }*/ 082 083 /** 084 * @return the kimResponsibility 085 */ 086 public ResponsibilityBo getKimResponsibility() { 087 if ( ObjectUtils.isNull( kimResponsibility ) && ObjectUtils.isNotNull( getRoleResponsibility() ) ) { 088 //TODO: this needs to be changed to use the KimResponsibilityInfo object 089 // but the changes are involved in the UiDocumentService based on the copyProperties method used 090 // to move the data to/from the document/real objects 091 Responsibility info = KimApiServiceLocator.getResponsibilityService().getResponsibility(getRoleResponsibility().getResponsibilityId()); 092 kimResponsibility = ResponsibilityBo.from(info); 093 } 094 return kimResponsibility; 095 } 096 /** 097 * @param kimResponsibility the kimResponsibility to set 098 */ 099 public void setKimResponsibility(ResponsibilityBo kimResponsibility) { 100 this.kimResponsibility = kimResponsibility; 101 } 102 public String getRoleResponsibilityActionId() { 103 return this.roleResponsibilityActionId; 104 } 105 public void setRoleResponsibilityActionId(String roleResponsibilityResolutionId) { 106 this.roleResponsibilityActionId = roleResponsibilityResolutionId; 107 } 108 public String getRoleResponsibilityId() { 109 return this.roleResponsibilityId; 110 } 111 public void setRoleResponsibilityId(String roleResponsibilityId) { 112 this.roleResponsibilityId = roleResponsibilityId; 113 } 114 public String getActionTypeCode() { 115 return this.actionTypeCode; 116 } 117 public void setActionTypeCode(String actionTypeCode) { 118 this.actionTypeCode = actionTypeCode; 119 } 120 public Integer getPriorityNumber() { 121 return this.priorityNumber; 122 } 123 public void setPriorityNumber(Integer priorityNumber) { 124 this.priorityNumber = priorityNumber; 125 } 126 127 public String getActionPolicyCode() { 128 return this.actionPolicyCode; 129 } 130 public void setActionPolicyCode(String actionPolicyCode) { 131 this.actionPolicyCode = actionPolicyCode; 132 } 133 public String getRoleMemberId() { 134 return this.roleMemberId; 135 } 136 public void setRoleMemberId(String roleMemberId) { 137 this.roleMemberId = roleMemberId; 138 } 139 140 /** 141 * 142 * This method fore readonlyalterdisplay 143 * 144 * @return 145 */ 146 public String getActionPolicyDescription() { 147 return (String)CodeTranslator.approvePolicyLabels.get(this.actionPolicyCode); 148 } 149 150 /** 151 * 152 * This method fore readonlyalterdisplay 153 * 154 * @return 155 */ 156 public String getActionTypeDescription() { 157 return (String) CodeTranslator.arLabels.get(this.actionTypeCode); 158 } 159 /** 160 * @return the roleResponsibility 161 */ 162 public RoleResponsibilityBo getRoleResponsibility() { 163 if ( ObjectUtils.isNull( roleResponsibility ) && roleResponsibilityId != null ) { 164 //TODO: this needs to be changed to use the KimResponsibilityInfo object 165 // but the changes are involved in the UiDocumentService based on the copyProperties method used 166 // to move the data to/from the document/real objects 167 roleResponsibility = KRADServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(RoleResponsibilityBo.class, getRoleResponsibilityId()); 168 } 169 return roleResponsibility; 170 } 171 /** 172 * @param roleResponsibility the roleResponsibility to set 173 */ 174 public void setRoleResponsibility(RoleResponsibilityBo roleResponsibility) { 175 this.roleResponsibility = roleResponsibility; 176 } 177 178 /** 179 * @return the forceAction 180 */ 181 public boolean isForceAction() { 182 return this.forceAction; 183 } 184 /** 185 * @param forceAction the forceAction to set 186 */ 187 public void setForceAction(boolean forceAction) { 188 this.forceAction = forceAction; 189 } 190 191}