001 /** 002 * Copyright 2005-2012 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.rice.kim.bo.ui; 017 018 import org.hibernate.annotations.GenericGenerator; 019 import org.hibernate.annotations.Parameter; 020 import org.kuali.rice.kew.api.util.CodeTranslator; 021 import org.kuali.rice.kim.api.responsibility.Responsibility; 022 import org.kuali.rice.kim.api.services.KimApiServiceLocator; 023 import org.kuali.rice.kim.impl.responsibility.ResponsibilityBo; 024 import org.kuali.rice.kim.impl.role.RoleResponsibilityBo; 025 import org.kuali.rice.krad.service.KRADServiceLocator; 026 import org.kuali.rice.krad.util.ObjectUtils; 027 028 import javax.persistence.Column; 029 import javax.persistence.Entity; 030 import javax.persistence.GeneratedValue; 031 import javax.persistence.Id; 032 import javax.persistence.IdClass; 033 import javax.persistence.Table; 034 import 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") 045 public 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 @Transient 068 protected ResponsibilityBo kimResponsibility; 069 @Transient 070 protected RoleResponsibilityBo roleResponsibility; 071 072 073 074 /*{ 075 roleResponsibility = new RoleResponsibilityImpl(); 076 roleResponsibility.setKimResponsibility(new KimResponsibilityImpl()); 077 roleResponsibility.getKimResponsibility().setTemplate(new KimResponsibilityTemplateImpl()); 078 }*/ 079 080 /** 081 * @return the kimResponsibility 082 */ 083 public ResponsibilityBo getKimResponsibility() { 084 if ( ObjectUtils.isNull( kimResponsibility ) && ObjectUtils.isNotNull( getRoleResponsibility() ) ) { 085 //TODO: this needs to be changed to use the KimResponsibilityInfo object 086 // but the changes are involved in the UiDocumentService based on the copyProperties method used 087 // to move the data to/from the document/real objects 088 Responsibility info = KimApiServiceLocator.getResponsibilityService().getResponsibility(getRoleResponsibility().getResponsibilityId()); 089 kimResponsibility = ResponsibilityBo.from(info); 090 } 091 return kimResponsibility; 092 } 093 /** 094 * @param kimResponsibility the kimResponsibility to set 095 */ 096 public void setKimResponsibility(ResponsibilityBo kimResponsibility) { 097 this.kimResponsibility = kimResponsibility; 098 } 099 public String getRoleResponsibilityActionId() { 100 return this.roleResponsibilityActionId; 101 } 102 public void setRoleResponsibilityActionId(String roleResponsibilityResolutionId) { 103 this.roleResponsibilityActionId = roleResponsibilityResolutionId; 104 } 105 public String getRoleResponsibilityId() { 106 return this.roleResponsibilityId; 107 } 108 public void setRoleResponsibilityId(String roleResponsibilityId) { 109 this.roleResponsibilityId = roleResponsibilityId; 110 } 111 public String getActionTypeCode() { 112 return this.actionTypeCode; 113 } 114 public void setActionTypeCode(String actionTypeCode) { 115 this.actionTypeCode = actionTypeCode; 116 } 117 public Integer getPriorityNumber() { 118 return this.priorityNumber; 119 } 120 public void setPriorityNumber(Integer priorityNumber) { 121 this.priorityNumber = priorityNumber; 122 } 123 124 public String getActionPolicyCode() { 125 return this.actionPolicyCode; 126 } 127 public void setActionPolicyCode(String actionPolicyCode) { 128 this.actionPolicyCode = actionPolicyCode; 129 } 130 public String getRoleMemberId() { 131 return this.roleMemberId; 132 } 133 public void setRoleMemberId(String roleMemberId) { 134 this.roleMemberId = roleMemberId; 135 } 136 137 /** 138 * 139 * This method fore readonlyalterdisplay 140 * 141 * @return 142 */ 143 public String getActionPolicyDescription() { 144 return (String)CodeTranslator.approvePolicyLabels.get(this.actionPolicyCode); 145 } 146 147 /** 148 * 149 * This method fore readonlyalterdisplay 150 * 151 * @return 152 */ 153 public String getActionTypeDescription() { 154 return (String) CodeTranslator.arLabels.get(this.actionTypeCode); 155 } 156 /** 157 * @return the roleResponsibility 158 */ 159 public RoleResponsibilityBo getRoleResponsibility() { 160 if ( ObjectUtils.isNull( roleResponsibility ) && roleResponsibilityId != null ) { 161 //TODO: this needs to be changed to use the KimResponsibilityInfo object 162 // but the changes are involved in the UiDocumentService based on the copyProperties method used 163 // to move the data to/from the document/real objects 164 roleResponsibility = KRADServiceLocator.getBusinessObjectService().findBySinglePrimaryKey(RoleResponsibilityBo.class, getRoleResponsibilityId()); 165 } 166 return roleResponsibility; 167 } 168 /** 169 * @param roleResponsibility the roleResponsibility to set 170 */ 171 public void setRoleResponsibility(RoleResponsibilityBo roleResponsibility) { 172 this.roleResponsibility = roleResponsibility; 173 } 174 175 /** 176 * @return the forceAction 177 */ 178 public boolean isForceAction() { 179 return this.forceAction; 180 } 181 /** 182 * @param forceAction the forceAction to set 183 */ 184 public void setForceAction(boolean forceAction) { 185 this.forceAction = forceAction; 186 } 187 188 }