Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
GroupMemberBo |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright 2006-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 | ||
17 | package org.kuali.rice.kim.impl.group | |
18 | ||
19 | import javax.persistence.Column | |
20 | import javax.persistence.Entity | |
21 | import javax.persistence.GeneratedValue | |
22 | import javax.persistence.Id | |
23 | import javax.persistence.Table | |
24 | ||
25 | import org.hibernate.annotations.GenericGenerator | |
26 | import org.hibernate.annotations.Parameter | |
27 | import org.kuali.rice.kim.api.group.GroupMember | |
28 | import org.kuali.rice.kim.api.group.GroupMemberContract | |
29 | import org.kuali.rice.kim.impl.membership.AbstractMemberBo | |
30 | ||
31 | @Entity | |
32 | @Table(name="KRIM_GRP_MBR_T") | |
33 | public class GroupMemberBo extends AbstractMemberBo implements GroupMemberContract { | |
34 | private static final long serialVersionUID = 1L; | |
35 | ||
36 | @Id | |
37 | @GeneratedValue(generator="KRIM_GRP_MBR_ID_S") | |
38 | @GenericGenerator(name="KRIM_GRP_MBR_ID_S",strategy="org.kuali.rice.core.framework.persistence.jpa.RiceNumericStringSequenceStyleGenerator",parameters=[ | |
39 | @Parameter(name="sequence_name",value="KRIM_GRP_MBR_ID_S"), | |
40 | @Parameter(name="value_column",value="id") | |
41 | ]) | |
42 | @Column(name="GRP_MBR_ID") | |
43 | String id; | |
44 | ||
45 | @Column(name="GRP_ID") | |
46 | String groupId | |
47 | ||
48 | /** | |
49 | * Converts a mutable bo to its immutable counterpart | |
50 | * @param bo the mutable business object | |
51 | * @return the immutable object | |
52 | */ | |
53 | static GroupMember to(GroupMemberBo bo) { | |
54 | 22 | if (bo == null) { |
55 | 0 | return null |
56 | } | |
57 | ||
58 | 22 | return GroupMember.Builder.create(bo).build(); |
59 | } | |
60 | ||
61 | /** | |
62 | * Converts a immutable object to its mutable counterpart | |
63 | * @param im immutable object | |
64 | * @return the mutable bo | |
65 | */ | |
66 | static GroupMemberBo from(GroupMember im) { | |
67 | 1 | if (im == null) { |
68 | 0 | return null |
69 | } | |
70 | ||
71 | 1 | GroupMemberBo bo = new GroupMemberBo() |
72 | 1 | bo.id = im.id |
73 | 1 | bo.groupId = im.groupId |
74 | 1 | bo.memberId = im.memberId |
75 | 1 | bo.typeCode = im.typeCode |
76 | 1 | bo.activeFromDate = im.activeFromDate |
77 | 1 | bo.activeToDate = im.activeToDate |
78 | 1 | bo.versionNumber = im.versionNumber |
79 | 1 | bo.objectId = im.objectId; |
80 | ||
81 | 1 | return bo |
82 | } | |
83 | ||
84 | /* @Override | |
85 | boolean isActive(){ | |
86 | boolean tempIsActive = super.isActive() | |
87 | if (tempIsActive) { | |
88 | //check to see if underlying member is active | |
89 | if (typeCode.equals(KimConstants.KimGroupMemberTypes.GROUP_MEMBER_TYPE)) { | |
90 | return KimApiServiceLocator.getIdentityManagementService().getGroup(memberId).isActive() | |
91 | } else if (typeCode.equals(KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE)) { | |
92 | return KimApiServiceLocator.getIdentityManagementService().getPrincipal(memberId).isActive() | |
93 | } else { | |
94 | return tempIsActive | |
95 | } | |
96 | ||
97 | } | |
98 | }*/ | |
99 | ||
100 | } |