/** * Returns the full qualified name of the parent organizational unit of this organizational unit.<p> * * This is <code>null</code> for the root ou, and the empty string for first level ous.<p> * * @return the full qualified name of the parent organizational unit of this organizational unit */ public String getParentFqn() { return getParentFqn(m_name); }
/** * Returns the fully qualified name of the associated organizational unit.<p> * * @return the fully qualified name of the associated organizational unit */ public String getOuFqn() { return CmsOrganizationalUnit.getParentFqn(m_name); }
/** * Returns the fully qualified name of the associated organizational unit.<p> * * @return the fully qualified name of the associated organizational unit */ public String getOuFqn() { return CmsOrganizationalUnit.getParentFqn(m_name); }
/** * Returns the fully qualified name of the associated organizational unit.<p> * * @return the fully qualified name of the associated organizational unit */ public String getOuFqn() { return CmsOrganizationalUnit.getParentFqn(m_name); }
/** * Returns the fully qualified name of the associated organizational unit.<p> * * @return the fully qualified name of the associated organizational unit */ public String getOuFqn() { return CmsOrganizationalUnit.getParentFqn(m_name); }
/** * Returns the full qualified name of the parent organizational unit of this organizational unit.<p> * * This is <code>null</code> for the root ou, and the empty string for first level ous.<p> * * @return the full qualified name of the parent organizational unit of this organizational unit */ public String getParentFqn() { return getParentFqn(m_name); }
/** * Returns the last name of the given fully qualified name.<p> * * @param fqn the fully qualified name to get the last name from * * @return the last name of the given fully qualified name */ public static final String getSimpleName(String fqn) { String parentFqn = getParentFqn(fqn); if (parentFqn != null) { fqn = fqn.substring(parentFqn.length()); } if ((fqn != null) && fqn.startsWith(CmsOrganizationalUnit.SEPARATOR)) { fqn = fqn.substring(CmsOrganizationalUnit.SEPARATOR.length()); } return fqn; }
/** * 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 username.<p> * * @param userName the username to set * * @see CmsRequestContext#getCurrentUser() */ public void setUserName(String userName) { checkFrozen(); m_userName = userName; setOuFqn(CmsOrganizationalUnit.getParentFqn(userName)); }
/** * Sets the username.<p> * * @param userName the username to set * * @see CmsRequestContext#currentUser() */ public void setUserName(String userName) { checkFrozen(); m_userName = userName; setOuFqn(CmsOrganizationalUnit.getParentFqn(userName)); }
/** * Deletes the given organizational unit.<p> * * @throws Exception if something goes wrong */ public void actionParent() throws Exception { String ouFqn = CmsOrganizationalUnit.getParentFqn(getParamOufqn()); Map<String, String[]> params = new HashMap<String, String[]>(); params.put(A_CmsOrgUnitDialog.PARAM_OUFQN, new String[] {ouFqn}); params.put(CmsDialog.PARAM_ACTION, new String[] {CmsDialog.DIALOG_INITIAL}); String toolPath = getCurrentToolPath().substring(0, getCurrentToolPath().lastIndexOf("/")); getToolManager().jspForwardTool(this, toolPath, params); actionCloseDialog(); }
/** * Returns the simple name if the ou is the same as the current user's ou.<p> * * @param name the fully qualified name to check * * @return the simple name if the ou is the same as the current user's ou */ private String getCurrentOuRelativeName(String name) { if (m_request == null) { return CmsOrganizationalUnit.SEPARATOR + name; } String ou = CmsOrganizationalUnit.getParentFqn(name); if (ou.equals(m_request.getCurrentUser().getOuFqn())) { return CmsOrganizationalUnit.getSimpleName(name); } return CmsOrganizationalUnit.SEPARATOR + name; }
/** * Returns the simple name if the ou is the same as the current user's ou.<p> * * @param cms the CMS context * @param name the fully qualified name to check * * @return the simple name if the ou is the same as the current user's ou */ protected static String getOuAwareName(CmsObject cms, String name) { String ou = CmsOrganizationalUnit.getParentFqn(name); if (ou.equals(cms.getRequestContext().getCurrentUser().getOuFqn())) { return CmsOrganizationalUnit.getSimpleName(name); } return CmsOrganizationalUnit.SEPARATOR + name; }
/** * Returns the simple name if the ou is the same as the current user's ou.<p> * * @param cms the CMS context * @param name the fully qualified name to check * * @return the simple name if the ou is the same as the current user's ou */ protected static String getOuAwareName(CmsObject cms, String name) { String ou = CmsOrganizationalUnit.getParentFqn(name); if (ou.equals(cms.getRequestContext().getCurrentUser().getOuFqn())) { return CmsOrganizationalUnit.getSimpleName(name); } return CmsOrganizationalUnit.SEPARATOR + name; }
/** * Returns the simple name if the ou is the same as the current user's ou.<p> * * @param cms the CMS context * @param name the fully qualified name to check * * @return the simple name if the ou is the same as the current user's ou */ public static String getOuAwareName(CmsObject cms, String name) { String ou = CmsOrganizationalUnit.getParentFqn(name); if (ou.equals(cms.getRequestContext().getCurrentUser().getOuFqn())) { return CmsOrganizationalUnit.getSimpleName(name); } return CmsOrganizationalUnit.SEPARATOR + name; }
/** * @see org.opencms.db.I_CmsUserDriver#deleteGroup(org.opencms.db.CmsDbContext, java.lang.String) */ public void deleteGroup(CmsDbContext dbc, String groupFqn) throws CmsDataAccessException { try { Query q = m_sqlManager.createQuery(dbc, C_GROUPS_DELETE_GROUP_2); q.setParameter(1, CmsOrganizationalUnit.getSimpleName(groupFqn)); q.setParameter(2, CmsOrganizationalUnit.SEPARATOR + CmsOrganizationalUnit.getParentFqn(groupFqn)); List<CmsDAOGroups> res = q.getResultList(); for (CmsDAOGroups g : res) { m_sqlManager.remove(dbc, g); } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } }
/** * @see org.opencms.db.I_CmsUserDriver#existsGroup(org.opencms.db.CmsDbContext, java.lang.String) */ public boolean existsGroup(CmsDbContext dbc, String groupFqn) throws CmsDataAccessException { boolean result = false; try { Query q = m_sqlManager.createQuery(dbc, C_GROUPS_CHECK_BY_NAME_2); q.setParameter(1, CmsOrganizationalUnit.getSimpleName(groupFqn)); q.setParameter(2, CmsOrganizationalUnit.SEPARATOR + CmsOrganizationalUnit.getParentFqn(groupFqn)); int count = CmsDataTypeUtil.numberToInt((Number)q.getSingleResult()); if (count > 0) { result = true; } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } return result; }
/** * Initializes the select options.<p> * * @param orgUnits the selectable OUs */ public void initOrgUnits(List<CmsOrganizationalUnit> orgUnits) { if ((orgUnits.size() == 1) && (orgUnits.get(0).getParentFqn() == null)) { setVisible(false); m_alwaysHidden = true; } for (CmsOrganizationalUnit ou : orgUnits) { String key = normalizeOuName(ou.getName()); m_ouSelect.addItem(key); m_ouSelect.setItemCaption(key, ou.getDisplayName(A_CmsUI.get().getLocale())); } }
/** * Returns the display name for this organizational unit.<p> * * @param locale the locale * * @return the display name for this organizational unit */ public String getDisplayName(Locale locale) { if (getParentFqn() == null) { // for the root ou return getDescription(locale); } return Messages.get().getBundle(locale).key( Messages.GUI_ORGUNIT_DISPLAY_NAME_2, getDescription(locale), CmsOrganizationalUnit.SEPARATOR + getName()); }