/** * Update given group in specific domain * * @param group */ @Override public void updateGroup(Group group) throws Exception { Group specificGroup = new Group(group); try { // Set supergroup specific Id if (StringUtil.isDefined(group.getSuperGroupId())) { // Get the user information GroupRow gr = getOrganization().group.getGroup(idAsInt(group.getSuperGroupId())); if (gr == null) { throw new AdminException( "DomainDriverManager.updateGroup", SilverpeasException.ERROR, "admin.EX_ERR_GROUP_NOT_FOUND", "group Id: '" + group.getSuperGroupId() + "'"); } specificGroup.setSuperGroupId(gr.specificId); } // Set subUsers specific Id specificGroup.setUserIds( translateUserIdsToSpecificIds(idAsInt(group.getDomainId()), group.getUserIds())); // Get the group information GroupRow gr = getOrganization().group.getGroup(idAsInt(group.getId())); if (gr == null) { throw new AdminException( "DomainDriverManager.updateGroup", SilverpeasException.ERROR, "admin.EX_ERR_GROUP_NOT_FOUND", "group Id: '" + group.getId() + "'"); } // Get a DomainDriver instance DomainDriver domainDriver = this.getDomainDriver(gr.domainId); specificGroup.setId(gr.specificId); // Update Group in specific domain domainDriver.updateGroup(specificGroup); } catch (AdminException e) { throw new AdminException( "DomainDriverManager.updateGroup", SilverpeasException.ERROR, "admin.EX_ERR_UPDATE_GROUP", "group Id: '" + group.getId() + "'", e); } }
/** * return group with given id (contains list of user ids for this group) * * @param groupId * @return Group */ @Override public Group getGroup(String groupId) throws Exception { Group group = null; try { // Set the OrganizationSchema (if not already done) getOrganizationSchema(); // Get the user information GroupRow gr = getOrganization().group.getGroup(idAsInt(groupId)); if (gr == null) { throw new AdminException( "DomainDriverManager.getGroup", SilverpeasException.ERROR, "admin.EX_ERR_GROUP_NOT_FOUND", "group Id: '" + groupId + "'"); } // Get a DomainDriver instance DomainDriver domainDriver = this.getDomainDriver(gr.domainId); // Get Group detail from specific domain group = domainDriver.getGroup(gr.specificId); // Fill silverpeas info of group details group.setId(groupId); group.setSpecificId(gr.specificId); group.setDomainId(idAsString(gr.domainId)); } catch (AdminException e) { throw new AdminException( "DomainDriverManager.getGroup", SilverpeasException.ERROR, "admin.EX_ERR_GET_GROUP", "group Id: '" + groupId + "'", e); } finally { releaseOrganizationSchema(); } return group; }