/** * Returns the fully qualified name of the organizational unit.<p> * * @return the fully qualified name of the organizational unit */ public String getOuFqn() { return CmsOrganizationalUnit.removeLeadingSeparator(m_ouFqn); }
/** * Returns the fully qualified name of the organizational unit.<p> * * @return the fully qualified name of the organizational unit */ public String getOuFqn() { return CmsOrganizationalUnit.removeLeadingSeparator(m_ouFqn); }
/** * Returns the organizational unit for the parent of the given fully qualified name.<p> * * @param fqn the fully qualified name to get the parent organizational unit for * * @return the parent organizational unit for the fully qualified name */ protected String getParentOrganizationalUnit(String fqn) { String ouFqn = CmsOrganizationalUnit.getParentFqn(CmsOrganizationalUnit.removeLeadingSeparator(fqn)); if (ouFqn == null) { ouFqn = ""; } return ouFqn; }
/** * Returns the organizational unit for the parent of the given fully qualified name.<p> * * @param fqn the fully qualified name to get the parent organizational unit for * * @return the parent organizational unit for the fully qualified name */ protected String getParentOrganizationalUnit(String fqn) { String ouFqn = CmsOrganizationalUnit.getParentFqn(CmsOrganizationalUnit.removeLeadingSeparator(fqn)); if (ouFqn == null) { ouFqn = ""; } return ouFqn; }
/** * Sets the organizational unit fully qualified name.<p> * * @param ouFqn the organizational unit fully qualified name */ public void setOuFqn(String ouFqn) { String userOu = CmsOrganizationalUnit.getParentFqn(m_user.getName()); if (ouFqn != null) { if (ouFqn.startsWith(userOu) || (ouFqn.startsWith(CmsOrganizationalUnit.SEPARATOR) && ouFqn.substring(1).startsWith(userOu))) { m_ouFqn = ouFqn; } else { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_BAD_ORGUNIT_2, ouFqn, userOu)); } } else { m_ouFqn = userOu; } m_ouFqn = CmsOrganizationalUnit.removeLeadingSeparator(m_ouFqn); }
/** * Sets the organizational unit fully qualified name.<p> * * @param ouFqn the organizational unit fully qualified name */ public void setOuFqn(String ouFqn) { String userOu = CmsOrganizationalUnit.getParentFqn(m_user.getName()); if (ouFqn != null) { if (ouFqn.startsWith(userOu) || (ouFqn.startsWith(CmsOrganizationalUnit.SEPARATOR) && ouFqn.substring(1).startsWith(userOu))) { m_ouFqn = ouFqn; } else { throw new CmsIllegalArgumentException(Messages.get().container( Messages.ERR_BAD_ORGUNIT_2, ouFqn, userOu)); } } else { m_ouFqn = userOu; } m_ouFqn = CmsOrganizationalUnit.removeLeadingSeparator(m_ouFqn); }
/** * Lookup and read the user or group with the given name.<p> * * @param context the current request context * @param principalName the name of the principal to lookup * * @return the principal (group or user) if found, otherwise <code>null</code> */ public I_CmsPrincipal lookupPrincipal(CmsRequestContext context, String principalName) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); I_CmsPrincipal result = null; try { result = m_driverManager.lookupPrincipal(dbc, CmsOrganizationalUnit.removeLeadingSeparator(principalName)); } finally { dbc.clear(); } return result; }
/** * Lookup and read the user or group with the given name.<p> * * @param context the current request context * @param principalName the name of the principal to lookup * * @return the principal (group or user) if found, otherwise <code>null</code> */ public I_CmsPrincipal lookupPrincipal(CmsRequestContext context, String principalName) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); I_CmsPrincipal result = null; try { result = m_driverManager.lookupPrincipal(dbc, CmsOrganizationalUnit.removeLeadingSeparator(principalName)); } finally { dbc.clear(); } return result; }
/** * Semi-constructor to create a {@link CmsGroup} instance from a JDBC result set. * * @param res the JDBC ResultSet * @return CmsGroup the new CmsGroup object * * @throws SQLException in case the result set does not include a requested table attribute */ protected CmsGroup internalCreateGroup(ResultSet res) throws SQLException { String ou = CmsOrganizationalUnit.removeLeadingSeparator( res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_OU_0"))); String description = res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_DESCRIPTION_0")); return new CmsGroup( new CmsUUID(res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_ID_0"))), new CmsUUID(res.getString(m_sqlManager.readQuery("C_GROUPS_PARENT_GROUP_ID_0"))), ou + res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_NAME_0")), description, res.getInt(m_sqlManager.readQuery("C_GROUPS_GROUP_FLAGS_0"))); }
/** * Semi-constructor to create a {@link CmsGroup} instance from a JDBC result set. * * @param res the JDBC ResultSet * @return CmsGroup the new CmsGroup object * * @throws SQLException in case the result set does not include a requested table attribute */ protected CmsGroup internalCreateGroup(ResultSet res) throws SQLException { String ou = CmsOrganizationalUnit.removeLeadingSeparator(res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_OU_0"))); String description = res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_DESCRIPTION_0")); return new CmsGroup( new CmsUUID(res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_ID_0"))), new CmsUUID(res.getString(m_sqlManager.readQuery("C_GROUPS_PARENT_GROUP_ID_0"))), ou + res.getString(m_sqlManager.readQuery("C_GROUPS_GROUP_NAME_0")), description, res.getInt(m_sqlManager.readQuery("C_GROUPS_GROUP_FLAGS_0"))); }
/** * Creates a new project from the current row of the given result set.<p> * * @param res the result set * * @return the new project * * @throws SQLException is something goes wrong */ protected CmsProject internalCreateProject(ResultSet res) throws SQLException { String ou = CmsOrganizationalUnit.removeLeadingSeparator( res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_OU_0"))); return new CmsProject( new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_ID_0"))), ou + res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_NAME_0")), res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_DESCRIPTION_0")), new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_USER_ID_0"))), new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_GROUP_ID_0"))), new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_MANAGERGROUP_ID_0"))), res.getInt(m_sqlManager.readQuery("C_PROJECTS_PROJECT_FLAGS_0")), res.getLong(m_sqlManager.readQuery("C_PROJECTS_DATE_CREATED_0")), CmsProject.CmsProjectType.valueOf(res.getInt(m_sqlManager.readQuery("C_PROJECTS_PROJECT_TYPE_0")))); }
/** * Creates a new project from the current row of the given result set.<p> * * @param res the result set * * @return the new project * * @throws SQLException is something goes wrong */ protected CmsProject internalCreateProject(ResultSet res) throws SQLException { String ou = CmsOrganizationalUnit.removeLeadingSeparator(res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_OU_0"))); return new CmsProject( new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_ID_0"))), ou + res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_NAME_0")), res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_DESCRIPTION_0")), new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_USER_ID_0"))), new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_GROUP_ID_0"))), new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_MANAGERGROUP_ID_0"))), res.getInt(m_sqlManager.readQuery("C_PROJECTS_PROJECT_FLAGS_0")), res.getLong(m_sqlManager.readQuery("C_PROJECTS_DATE_CREATED_0")), CmsProject.CmsProjectType.valueOf(res.getInt(m_sqlManager.readQuery("C_PROJECTS_PROJECT_TYPE_0")))); }
/** * Reads a group based on its name.<p> * * @param context the current request context * @param groupname the name of the group that is to be read * * @return the requested group * * @throws CmsException if operation was not successful */ public CmsGroup readGroup(CmsRequestContext context, String groupname) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readGroup(dbc, CmsOrganizationalUnit.removeLeadingSeparator(groupname)); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_GROUP_FOR_NAME_1, groupname), e); } finally { dbc.clear(); } return result; }
/** * Reads a group based on its name.<p> * * @param context the current request context * @param groupname the name of the group that is to be read * * @return the requested group * * @throws CmsException if operation was not successful */ public CmsGroup readGroup(CmsRequestContext context, String groupname) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readGroup(dbc, CmsOrganizationalUnit.removeLeadingSeparator(groupname)); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_GROUP_FOR_NAME_1, groupname), e); } finally { dbc.clear(); } return result; }
/** * Returns the parent group of a group.<p> * * @param context the current request context * @param groupname the name of the group * * @return group the parent group or <code>null</code> * * @throws CmsException if operation was not successful */ public CmsGroup getParent(CmsRequestContext context, String groupname) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.getParent(dbc, CmsOrganizationalUnit.removeLeadingSeparator(groupname)); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_GET_PARENT_GROUP_1, groupname), e); } finally { dbc.clear(); } return result; }
/** * Returns a user object.<p> * * @param context the current request context * @param username the name of the user that is to be read * * @return user read form the cms * * @throws CmsException if operation was not successful */ public CmsUser readUser(CmsRequestContext context, String username) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUser result = null; try { result = m_driverManager.readUser(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username)); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_USER_FOR_NAME_1, username), e); } finally { dbc.clear(); } return result; }
/** * Returns the parent group of a group.<p> * * @param context the current request context * @param groupname the name of the group * * @return group the parent group or <code>null</code> * * @throws CmsException if operation was not successful */ public CmsGroup getParent(CmsRequestContext context, String groupname) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.getParent(dbc, CmsOrganizationalUnit.removeLeadingSeparator(groupname)); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_GET_PARENT_GROUP_1, groupname), e); } finally { dbc.clear(); } return result; }
/** * Returns a user object.<p> * * @param context the current request context * @param username the name of the user that is to be read * * @return user read form the cms * * @throws CmsException if operation was not successful */ public CmsUser readUser(CmsRequestContext context, String username) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUser result = null; try { result = m_driverManager.readUser(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username)); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_USER_FOR_NAME_1, username), e); } finally { dbc.clear(); } return result; }
/** * Semi-constructor to create a {@link CmsGroup} instance from a JDBC result set. * * @param g the group * * @return CmsGroup the new CmsGroup object */ protected CmsGroup internalCreateGroup(CmsDAOGroups g) { String ou = CmsOrganizationalUnit.removeLeadingSeparator(g.getGroupOu()); String description = g.getGroupDescription(); return new CmsGroup( new CmsUUID(g.getGroupId()), new CmsUUID(g.getParentGroupId()), ou + g.getGroupName(), description, g.getGroupFlags()); }
/** * Creates a new project from the current row of the given result set.<p> * * @param p the result set * * @return the new project */ protected CmsProject internalCreateProject(CmsDAOProjects p) { String ou = CmsOrganizationalUnit.removeLeadingSeparator(p.getProjectOu()); return new CmsProject( new CmsUUID(p.getProjectId()), ou + p.getProjectName(), p.getProjectDescription(), new CmsUUID(p.getUserId()), new CmsUUID(p.getGroupId()), new CmsUUID(p.getManagerGroupId()), p.getProjectFlags(), p.getDateCreated(), CmsProject.CmsProjectType.valueOf(p.getProjectType())); }