本文整理匯總了Java中org.kuali.rice.kim.impl.group.GroupMemberBo類的典型用法代碼示例。如果您正苦於以下問題:Java GroupMemberBo類的具體用法?Java GroupMemberBo怎麽用?Java GroupMemberBo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GroupMemberBo類屬於org.kuali.rice.kim.impl.group包,在下文中一共展示了GroupMemberBo類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: inactivatePrincipalGroupMemberships
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
protected void inactivatePrincipalGroupMemberships(List<String> groupIds, Timestamp yesterday) {
if (groupIds == null || groupIds.isEmpty() ) {
return;
}
Collection<GroupMember> groupMemberships = getGroupService().getMembers(groupIds);
if ( groupMemberships.isEmpty() ) {
return;
}
List<GroupMember> groupMembers = new ArrayList<GroupMember>();
for (GroupMember groupMembershipInfo : groupMemberships) {
if (MemberType.GROUP.equals(groupMembershipInfo.getType())
&& groupMembershipInfo.isActive(new DateTime())) {
groupMembers.add(groupMembershipInfo);
}
}
// FIXME: Is there a reason we are doing this directly and *not* calling the group service???
for (GroupMember groupMember : groupMembers) {
GroupMember.Builder builder = GroupMember.Builder.create(groupMember);
builder.setActiveToDate(new DateTime(yesterday.getTime()));
getDataObjectService().save(GroupMemberBo.from(builder.build()));
}
}
示例2: saveEntityPerson
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
/**
* @see org.kuali.rice.kim.service.UiDocumentService#saveEntityPerson(IdentityManagementPersonDocument)
*/
@Override
public void saveEntityPerson(IdentityManagementPersonDocument identityManagementPersonDocument) {
boolean inactivatingPrincipal = false;
List <GroupMemberBo> groupPrincipals = populateGroupMembers(identityManagementPersonDocument);
List <RoleMemberBo> rolePrincipals = populateRoleMembers(identityManagementPersonDocument);
List <DelegateTypeBo> personDelegations = populateDelegations(identityManagementPersonDocument);
List <Object> bos = new ArrayList<Object>();
List <RoleResponsibilityActionBo> roleRspActions = populateRoleRspActions(identityManagementPersonDocument);
List <RoleMemberAttributeDataBo> blankRoleMemberAttrs = getBlankRoleMemberAttrs(rolePrincipals);
//if(ObjectUtils.isNotNull(kimEntity.getPrivacyPreferences()))
// bos.add(kimEntity.getPrivacyPreferences());
bos.addAll(groupPrincipals);
bos.addAll(rolePrincipals);
bos.addAll(roleRspActions);
bos.addAll(personDelegations);
// boservice.save(bos) does not handle deleteawarelist
for ( Object bo : bos ) {
getDataObjectService().save(bo);
}
for ( RoleMemberAttributeDataBo blankRoleMemberAttr : blankRoleMemberAttrs ) {
getDataObjectService().delete(blankRoleMemberAttr);
}
if ( inactivatingPrincipal ) {
//when a person is inactivated, inactivate their group, role, and delegation memberships
KimImplServiceLocator.getRoleInternalService().principalInactivated(identityManagementPersonDocument.getPrincipalId());
}
}
示例3: populateGroupMembers
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
protected List <GroupMemberBo> populateGroupMembers(IdentityManagementPersonDocument identityManagementPersonDocument) {
List <GroupMemberBo> groupPrincipals = new ArrayList<GroupMemberBo>();
// List<? extends Group> origGroups = getGroupService().getGroupsByPrincipalId(identityManagementPersonDocument.getPrincipalId());
if(CollectionUtils.isNotEmpty(identityManagementPersonDocument.getGroups())){
for (PersonDocumentGroup group : identityManagementPersonDocument.getGroups()) {
GroupMember.Builder groupPrincipalImpl = GroupMember.Builder.create(group.getGroupId(), identityManagementPersonDocument.getPrincipalId(), KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE);
if (group.getActiveFromDate() != null) {
groupPrincipalImpl.setActiveFromDate(new DateTime(group.getActiveFromDate().getTime()));
}
if (group.getActiveToDate() != null) {
groupPrincipalImpl.setActiveToDate(new DateTime(group.getActiveToDate().getTime()));
}
groupPrincipalImpl.setId(group.getGroupMemberId());
//groupPrincipalImpl.setVersionNumber(group.getVersionNumber());
// get the ORM-layer optimisic locking value
// TODO: this should be replaced with the retrieval and storage of that value
// in the document tables and not re-retrieved here
Collection<GroupMember> currGroupMembers = getGroupService().getMembers(Collections.singletonList(group.getGroupId()));
if(ObjectUtils.isNotNull(currGroupMembers)){
for (GroupMember origGroupMember: currGroupMembers) {
if (origGroupMember.isActive(new DateTime(System.currentTimeMillis()))
&& KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.equals(origGroupMember.getType())) {
if(origGroupMember.getId()!=null && StringUtils.equals(origGroupMember.getId(), group.getGroupMemberId())){
groupPrincipalImpl.setObjectId(origGroupMember.getObjectId());
groupPrincipalImpl.setVersionNumber(origGroupMember.getVersionNumber());
}
}
}
}
groupPrincipals.add(GroupMemberBo.from(groupPrincipalImpl.build()));
}
}
return groupPrincipals;
}
示例4: testRemoveGroupFromGroup
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
@Test
public void testRemoveGroupFromGroup() {
List<String> preGroupIds = groupService.getDirectMemberGroupIds("g1");
assertTrue( "g1 must contain group g2", preGroupIds.contains( "g2" ) );
groupService.removeGroupFromGroup("g2", "g1");
List<String> postGroupIds = groupService.getDirectMemberGroupIds("g1");
assertFalse( "g1 must not contain group g2", postGroupIds.contains( "g2" ) );
// add it back in, and the two lists should contain the same elements
postGroupIds = new ArrayList<String>(postGroupIds);
postGroupIds.add("g2");
assertTrue(postGroupIds.containsAll(preGroupIds) && preGroupIds.containsAll(postGroupIds));
// historical information should be preserved
List<GroupMemberBo> members = getActiveAndInactiveGroupTypeMembers("g1");
GroupMemberBo g2 = null;
for (GroupMemberBo member : members) {
if (member.getMemberId().equals("g2")) {
g2 = member;
}
}
// it exists
assertNotNull("should have found g2", g2);
// it is inactive
assertFalse("g2 should be inactive", g2.isActive(new Timestamp(System.currentTimeMillis())));
}
示例5: testRemovePrincipalFromGroup
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
@Test
public void testRemovePrincipalFromGroup() {
List<String> preDirectPrincipalMemberIds = groupService.getDirectMemberPrincipalIds("g2");
assertTrue( "p1 must be direct member of g2", preDirectPrincipalMemberIds.contains("p1") );
groupService.removePrincipalFromGroup("p1", "g2");
List<String> postDirectPrincipalMemberIds = groupService.getDirectMemberPrincipalIds("g2");
assertFalse( "p1 must no longer be a direct member of g2", postDirectPrincipalMemberIds.contains("p1") );
// add p1 back to the list, and pre & post should contain the same elements
postDirectPrincipalMemberIds = new ArrayList<String>(postDirectPrincipalMemberIds);
postDirectPrincipalMemberIds.add("p1");
assertTrue(preDirectPrincipalMemberIds.containsAll(postDirectPrincipalMemberIds) &&
postDirectPrincipalMemberIds.containsAll(preDirectPrincipalMemberIds));
// historical information should be preserved
List<GroupMemberBo> members = getActiveAndInactivePrincipalTypeMembers("g2");
GroupMemberBo p1 = null;
for (GroupMemberBo member : members) {
if (member.getMemberId().equals("p1")) {
p1 = member;
}
}
// it exists
assertNotNull("should have found p1", p1);
// it is inactive
assertFalse("p1 should be inactive", p1.isActive(new Timestamp(System.currentTimeMillis())));
}
示例6: testRemoveGroupMembers
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
@Test
public void testRemoveGroupMembers() {
List<String> before = groupService.getMemberPrincipalIds("g1");
groupService.addPrincipalToGroup("p1", "g1");
assertTrue( "p1 must be direct member of g1", groupService.isDirectMemberOfGroup("p1", "g1") );
assertTrue( "g2 must be direct member of g1", groupService.isGroupMemberOfGroup("g2", "g1") );
groupService.removeAllMembers("g1");
List<GroupMember> memberInfos = groupService.getMembersOfGroup("g1");
assertTrue("should be no active members", CollectionUtils.isEmpty(memberInfos));
// historical information should be preserved
List<GroupMemberBo> members = getActiveAndInactivePrincipalTypeMembers("g1");
members.addAll(getActiveAndInactiveGroupTypeMembers("g1"));
GroupMemberBo p1 = null;
GroupMemberBo g2 = null;
for (GroupMemberBo member : members) {
if (member.getMemberId().equals("p1")) {
p1 = member;
}
if (member.getMemberId().equals("g2")) {
g2 = member;
}
}
// it exists
assertNotNull("should have found p1", p1);
assertNotNull("should have found g2", g2);
// it is inactive
assertFalse("p1 should be inactive", p1.isActive(new Timestamp(System.currentTimeMillis())));
assertFalse("g2 should be inactive", g2.isActive(new Timestamp(System.currentTimeMillis())));
}
示例7: getActiveAndInactiveGroupTypeMembers
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
private List<GroupMemberBo> getActiveAndInactiveGroupTypeMembers(String groupId) {
Map<String,Object> criteria = new HashMap<String,Object>();
criteria.put(KIMPropertyConstants.GroupMember.GROUP_ID, groupId);
criteria.put(KIMPropertyConstants.GroupMember.MEMBER_TYPE_CODE, KimGroupMemberTypes.GROUP_MEMBER_TYPE.getCode());
return new ArrayList<GroupMemberBo>(KradDataServiceLocator.getDataObjectService().findMatching(GroupMemberBo.class, QueryByCriteria.Builder.andAttributes(criteria).build()).getResults());
}
示例8: getActiveAndInactivePrincipalTypeMembers
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
private List<GroupMemberBo> getActiveAndInactivePrincipalTypeMembers(String groupId) {
Map<String,Object> criteria = new HashMap<String,Object>();
criteria.put(KIMPropertyConstants.GroupMember.GROUP_ID, groupId);
criteria.put(KIMPropertyConstants.GroupMember.MEMBER_TYPE_CODE, KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode());
return new ArrayList<GroupMemberBo>(KradDataServiceLocator.getDataObjectService().findMatching(GroupMemberBo.class, QueryByCriteria.Builder.andAttributes(criteria).build()).getResults());
}
示例9: saveEntityPerson
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
/**
* @see org.kuali.rice.kim.service.UiDocumentService#saveEntityPerson(IdentityManagementPersonDocument)
*/
public void saveEntityPerson(IdentityManagementPersonDocument identityManagementPersonDocument) {
final Entity kimEntity = getIdentityService().getEntity(identityManagementPersonDocument.getEntityId());
boolean creatingNew = false;
String initiatorPrincipalId = getInitiatorPrincipalId(identityManagementPersonDocument);
boolean inactivatingPrincipal = false;
List <GroupMemberBo> groupPrincipals = populateGroupMembers(identityManagementPersonDocument);
List <RoleMemberBo> rolePrincipals = populateRoleMembers(identityManagementPersonDocument);
List <DelegateTypeBo> personDelegations = populateDelegations(identityManagementPersonDocument);
List <PersistableBusinessObject> bos = new ArrayList<PersistableBusinessObject>();
List <RoleResponsibilityActionBo> roleRspActions = populateRoleRspActions(identityManagementPersonDocument);
List <RoleMemberAttributeDataBo> blankRoleMemberAttrs = getBlankRoleMemberAttrs(rolePrincipals);
//if(ObjectUtils.isNotNull(kimEntity.getPrivacyPreferences()))
// bos.add(kimEntity.getPrivacyPreferences());
bos.addAll(groupPrincipals);
bos.addAll(rolePrincipals);
bos.addAll(roleRspActions);
bos.addAll(personDelegations);
// boservice.save(bos) does not handle deleteawarelist
getBusinessObjectService().save(bos);
if (!blankRoleMemberAttrs.isEmpty()) {
getBusinessObjectService().delete(blankRoleMemberAttrs);
}
if ( inactivatingPrincipal ) {
//when a person is inactivated, inactivate their group, role, and delegation memberships
KimImplServiceLocator.getRoleInternalService().principalInactivated(identityManagementPersonDocument.getPrincipalId());
}
}
示例10: inactivatePrincipalGroupMemberships
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
protected void inactivatePrincipalGroupMemberships(String principalId, Timestamp yesterday) {
List<GroupMember> groupMembers = getRoleDao().getGroupPrincipalsForPrincipalIdAndGroupIds(null, principalId);
List<GroupMemberBo> groupMemberBoList = new ArrayList<GroupMemberBo>(groupMembers.size());
for (GroupMember gm : groupMembers) {
GroupMember.Builder builder = GroupMember.Builder.create(gm);
builder.setActiveToDate(new DateTime(yesterday.getTime()));
groupMemberBoList.add(GroupMemberBo.from(builder.build()));
}
getBusinessObjectService().save(groupMemberBoList);
}
示例11: getActiveAndInactiveGroupTypeMembers
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
private List<GroupMemberBo> getActiveAndInactiveGroupTypeMembers(String groupId) {
Map<String,Object> criteria = new HashMap<String,Object>();
criteria.put(KIMPropertyConstants.GroupMember.GROUP_ID, groupId);
criteria.put(KIMPropertyConstants.GroupMember.MEMBER_TYPE_CODE, KimGroupMemberTypes.GROUP_MEMBER_TYPE.getCode());
return new ArrayList<GroupMemberBo>(businessObjectService.findMatching(GroupMemberBo.class, criteria));
}
示例12: getActiveAndInactivePrincipalTypeMembers
import org.kuali.rice.kim.impl.group.GroupMemberBo; //導入依賴的package包/類
private List<GroupMemberBo> getActiveAndInactivePrincipalTypeMembers(String groupId) {
Map<String,Object> criteria = new HashMap<String,Object>();
criteria.put(KIMPropertyConstants.GroupMember.GROUP_ID, groupId);
criteria.put(KIMPropertyConstants.GroupMember.MEMBER_TYPE_CODE, KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode());
return new ArrayList<GroupMemberBo>(businessObjectService.findMatching(GroupMemberBo.class, criteria));
}