private MembershipByUserGroupTypeWrapper findMembership ( Session session , String id ) throws Exception { IdComponents ids ; try { ids = utils . splitId ( id ) ; } catch ( IndexOutOfBoundsException e ) { throw new ItemNotFoundException ( "Can not find membership by id=" + id , e ) ; } Node groupNode = session . getNodeByUUID ( ids . groupNodeId ) ; Node refUserNode = groupNode . getNode ( JCROrganizationServiceImpl . JOS_MEMBERSHIP ) . getNode ( ids . userName ) ; Node refTypeNode = refUserNode . getNode ( ids . type . equals ( MembershipTypeHandler . ANY_MEMBERSHIP_TYPE ) ? JCROrganizationServiceImpl . JOS_MEMBERSHIP_TYPE_ANY : ids . type ) ; String groupId = utils . getGroupIds ( groupNode ) . groupId ; MembershipImpl membership = new MembershipImpl ( ) ; membership . setId ( id ) ; membership . setGroupId ( groupId ) ; membership . setMembershipType ( ids . type ) ; membership . setUserName ( ids . userName ) ; putInCache ( membership ) ; return new MembershipByUserGroupTypeWrapper ( membership , refUserNode , refTypeNode ) ; }
Use this method to search for an membership record with the given id .