/** * Sets a new parent group for an already existing group.<p> * * @param dbc the current database context * @param groupName the name of the group that should be written * @param parentGroupName the name of the parent group to set, * or <code>null</code> if the parent * group should be deleted. * * @throws CmsException if operation was not successful * @throws CmsDataAccessException if the group with <code>groupName</code> could not be read from VFS */ public void setParentGroup(CmsDbContext dbc, String groupName, String parentGroupName) throws CmsException, CmsDataAccessException { CmsGroup group = readGroup(dbc, groupName); CmsUUID parentGroupId = CmsUUID.getNullUUID(); // if the group exists, use its id, else set to unknown. if (parentGroupName != null) { parentGroupId = readGroup(dbc, parentGroupName).getId(); } group.setParentId(parentGroupId); // write the changes to the cms writeGroup(dbc, group); }
/** * Sets a new parent group for an already existing group.<p> * * @param dbc the current database context * @param groupName the name of the group that should be written * @param parentGroupName the name of the parent group to set, * or <code>null</code> if the parent * group should be deleted. * * @throws CmsException if operation was not successful * @throws CmsDataAccessException if the group with <code>groupName</code> could not be read from VFS */ public void setParentGroup(CmsDbContext dbc, String groupName, String parentGroupName) throws CmsException, CmsDataAccessException { CmsGroup group = readGroup(dbc, groupName); CmsUUID parentGroupId = CmsUUID.getNullUUID(); // if the group exists, use its id, else set to unknown. if (parentGroupName != null) { parentGroupId = readGroup(dbc, parentGroupName).getId(); } group.setParentId(parentGroupId); // write the changes to the cms writeGroup(dbc, group); }
CmsGroup child = (CmsGroup)itChildren.next(); child.setParentId(parentId); writeGroup(dbc, child); CmsGroup child = (CmsGroup)itChildren.next(); child.setParentId(replacementId); writeGroup(dbc, child);
CmsGroup child = itChildren.next(); child.setParentId(parentId); writeGroup(dbc, child); CmsGroup child = itChildren.next(); child.setParentId(replacementId); writeGroup(dbc, child);
/** * Writes an already existing group.<p> * * The group id has to be a valid OpenCms group id.<br> * * The group with the given id will be completely overridden * by the given data.<p> * * @param context the current request context * @param group the group that should be written * * @throws CmsRoleViolationException if the current user does not own the role {@link CmsRole#ACCOUNT_MANAGER} for the current project * @throws CmsException if operation was not successful */ public void writeGroup(CmsRequestContext context, CmsGroup group) throws CmsException, CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(group.getName()))); m_driverManager.writeGroup(dbc, group); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_GROUP_1, group.getName()), e); } finally { dbc.clear(); } }
/** * Writes an already existing group.<p> * * The group id has to be a valid OpenCms group id.<br> * * The group with the given id will be completely overridden * by the given data.<p> * * @param context the current request context * @param group the group that should be written * * @throws CmsRoleViolationException if the current user does not own the role {@link CmsRole#ACCOUNT_MANAGER} for the current project * @throws CmsException if operation was not successful */ public void writeGroup(CmsRequestContext context, CmsGroup group) throws CmsException, CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(group.getName()))); m_driverManager.writeGroup(dbc, group); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_GROUP_1, group.getName()), e); } finally { dbc.clear(); } }