View Javadoc
1   package org.kuali.kpme.edo.group;
2   
3   import org.kuali.kpme.edo.api.group.EdoGroupDefinition;
4   import org.kuali.kpme.edo.api.group.EdoRoleResponsibility;
5   import org.kuali.kpme.edo.api.group.EdoRoleResponsibilityContract;
6   import org.kuali.rice.core.api.mo.ModelObjectUtils;
7   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
8   
9   import com.google.common.collect.ImmutableList;
10  import com.google.common.collect.ImmutableMap;
11  
12  /**
13   * $HeadURL$
14   * $Revision$
15   * Created with IntelliJ IDEA.
16   * User: bradleyt
17   * Date: 1/27/14
18   * Time: 2:21 PM
19   */
20  public class EdoRoleResponsibilityBo extends PersistableBusinessObjectBase implements EdoRoleResponsibilityContract {
21  
22  	private static final long serialVersionUID = -2760119398952490275L;
23  
24  	static class KeyFields {
25  		private static final String KIM_ROLE_NAME = "kimRoleName";
26  		private static final String KIM_RESPONSIBILITY_NAME = "kimResponsibilityName";
27  		private static final String KIM_ACTION_TYPE_CODE = "kimActionTypeCode";
28  	}
29  	
30      private String edoKimRoleResponsibilityId;
31      private String kimRoleName;
32      private String kimResponsibilityName;
33      private String kimActionTypeCode;
34      private String kimActionPolicyCode;
35      private int kimPriority;
36      private boolean kimForceAction;
37      
38      public static final ImmutableList<String> BUSINESS_KEYS = new ImmutableList.Builder<String>()
39  			.add(KeyFields.KIM_ROLE_NAME)
40  			.add(KeyFields.KIM_RESPONSIBILITY_NAME)
41  			.add(KeyFields.KIM_ACTION_TYPE_CODE)
42  			.build();
43      
44      public String getId() {
45  		return  getEdoKimRoleResponsibilityId();
46  	}
47  
48  	public void setId(String edoKimRoleResponsibilityId) {
49  		setEdoKimRoleResponsibilityId(edoKimRoleResponsibilityId);
50  	}
51  
52  	public ImmutableMap<String, Object> getBusinessKeyValuesMap() {
53  		return  new ImmutableMap.Builder<String, Object>()
54  				.put(KeyFields.KIM_ROLE_NAME, this.getKimRoleName())
55  				.put(KeyFields.KIM_RESPONSIBILITY_NAME, this.getKimResponsibilityName())
56  				.put(KeyFields.KIM_ACTION_TYPE_CODE, this.getKimActionTypeCode())
57  				.build();
58  	}
59  
60      public String getEdoKimRoleResponsibilityId() {
61          return edoKimRoleResponsibilityId;
62      }
63  
64      public void setEdoKimRoleResponsibilityId(String edoKimRoleResponsibilityId) {
65          this.edoKimRoleResponsibilityId = edoKimRoleResponsibilityId;
66      }
67  
68      public String getKimRoleName() {
69          return kimRoleName;
70      }
71  
72      public void setKimRoleName(String kimRoleName) {
73          this.kimRoleName = kimRoleName;
74      }
75  
76      public String getKimResponsibilityName() {
77          return kimResponsibilityName;
78      }
79  
80      public void setKimResponsibilityName(String kimResponsibilityName) {
81          this.kimResponsibilityName = kimResponsibilityName;
82      }
83  
84      public String getKimActionTypeCode() {
85          return kimActionTypeCode;
86      }
87  
88      public void setKimActionTypeCode(String kimActionTypeCode) {
89          this.kimActionTypeCode = kimActionTypeCode;
90      }
91  
92      public String getKimActionPolicyCode() {
93          return kimActionPolicyCode;
94      }
95  
96      public void setKimActionPolicyCode(String kimActionPolicyCode) {
97          this.kimActionPolicyCode = kimActionPolicyCode;
98      }
99  
100     public int getKimPriority() {
101         return kimPriority;
102     }
103 
104     public void setKimPriority(int kimPriority) {
105         this.kimPriority = kimPriority;
106     }
107 
108     public boolean isKimForceAction() {
109         return kimForceAction;
110     }
111 
112     public void setKimForceAction(boolean kimForceAction) {
113         this.kimForceAction = kimForceAction;
114     }
115     
116     public static EdoRoleResponsibilityBo from(EdoRoleResponsibility im) {
117         if (im == null) {
118             return null;
119         }
120         EdoRoleResponsibilityBo err = new EdoRoleResponsibilityBo();
121         err.setEdoKimRoleResponsibilityId(im.getEdoKimRoleResponsibilityId());
122         err.setKimRoleName(im.getKimRoleName());
123         err.setKimResponsibilityName(im.getKimResponsibilityName());
124         err.setKimActionTypeCode(im.getKimActionTypeCode());
125         err.setKimActionPolicyCode(im.getKimActionPolicyCode());
126         err.setKimPriority(im.getKimPriority());        
127         err.setKimForceAction(im.isKimForceAction());
128         err.setVersionNumber(im.getVersionNumber());
129         err.setObjectId(im.getObjectId()); 
130         
131         return err;
132     } 
133     
134     public static EdoRoleResponsibility to(EdoRoleResponsibilityBo bo) {
135         if (bo == null) {
136             return null;
137         }
138         return EdoRoleResponsibility.Builder.create(bo).build();
139     }
140     
141     public static final ModelObjectUtils.Transformer<EdoRoleResponsibilityBo, EdoRoleResponsibility> toImmutable = new ModelObjectUtils.Transformer<EdoRoleResponsibilityBo, EdoRoleResponsibility>() {
142         public EdoRoleResponsibility transform(EdoRoleResponsibilityBo input) {
143             return EdoRoleResponsibilityBo.to(input);
144         };
145     };
146             
147     public static final ModelObjectUtils.Transformer<EdoRoleResponsibility, EdoRoleResponsibilityBo> toBo = new ModelObjectUtils.Transformer<EdoRoleResponsibility, EdoRoleResponsibilityBo>() {
148         public EdoRoleResponsibilityBo transform(EdoRoleResponsibility input) {
149             return EdoRoleResponsibilityBo.from(input);
150         };
151     };
152 }