/** * @see org.opencms.db.I_CmsCacheKey#getCacheKeyForUserGroups(java.lang.String, org.opencms.db.CmsDbContext, org.opencms.file.CmsUser) */ public String getCacheKeyForUserGroups(String prefix, CmsDbContext context, CmsUser user) { if (!context.getProjectId().isNullUUID()) { return ""; } StringBuffer cacheBuffer = new StringBuffer(64); cacheBuffer.append(prefix); cacheBuffer.append('_'); cacheBuffer.append(user.getName()); return cacheBuffer.toString(); }
/** * @see org.opencms.db.I_CmsCacheKey#getCacheKeyForGroupUsers(java.lang.String, org.opencms.db.CmsDbContext, org.opencms.file.CmsGroup) */ public String getCacheKeyForGroupUsers(String prefix, CmsDbContext context, CmsGroup group) { if (!context.getProjectId().isNullUUID()) { return ""; } StringBuffer cacheBuffer = new StringBuffer(64); cacheBuffer.append(prefix); cacheBuffer.append('_'); cacheBuffer.append(group.getName()); return cacheBuffer.toString(); }
/** * @see org.opencms.db.I_CmsCacheKey#getCacheKeyForGroupUsers(java.lang.String, org.opencms.db.CmsDbContext, org.opencms.file.CmsGroup) */ public String getCacheKeyForGroupUsers(String prefix, CmsDbContext context, CmsGroup group) { if (!context.getProjectId().isNullUUID()) { return ""; } StringBuffer cacheBuffer = new StringBuffer(64); cacheBuffer.append(prefix); cacheBuffer.append('_'); cacheBuffer.append(group.getName()); return cacheBuffer.toString(); }
/** * @see org.opencms.db.I_CmsCacheKey#getCacheKeyForUserGroups(java.lang.String, org.opencms.db.CmsDbContext, org.opencms.file.CmsUser) */ public String getCacheKeyForUserGroups(String prefix, CmsDbContext context, CmsUser user) { if (!context.getProjectId().isNullUUID()) { return ""; } StringBuffer cacheBuffer = new StringBuffer(64); cacheBuffer.append(prefix); cacheBuffer.append('_'); cacheBuffer.append(user.getName()); return cacheBuffer.toString(); }
/** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return m_structureId.isNullUUID() ? m_resourceId.hashCode() : m_structureId.hashCode(); }
/** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return m_structureId.isNullUUID() ? m_resourceId.hashCode() : m_structureId.hashCode(); }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof CmsPublishedResource) { if (m_structureId.isNullUUID()) { return ((CmsPublishedResource)obj).m_resourceId.equals(m_resourceId); } else { return ((CmsPublishedResource)obj).m_structureId.equals(m_structureId); } } return false; }
/** * Returns the correct project id.<p> * * @param dbc the database context * * @return the correct project id */ private CmsUUID getProjectIdForContext(CmsDbContext dbc) { CmsUUID projectId = dbc.getProjectId(); if (projectId.isNullUUID()) { projectId = dbc.currentProject().getUuid(); } return projectId; }
/** * Returns the correct project id.<p> * * @param dbc the database context * * @return the correct project id */ private CmsUUID getProjectIdForContext(CmsDbContext dbc) { CmsUUID projectId = dbc.getProjectId(); if (projectId.isNullUUID()) { projectId = dbc.currentProject().getUuid(); } return projectId; }
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }
/** * Check that the given id is not the null id.<p> * * @param id the id to check * @param canBeNull only if flag is set, <code>null</code> is accepted * * @see #isNullUUID() */ public static void checkId(CmsUUID id, boolean canBeNull) { if (canBeNull && (id == null)) { return; } if ((!canBeNull && (id == null)) || id.isNullUUID()) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_INVALID_UUID_1, id)); } }
/** * Check that the given id is not the null id.<p> * * @param id the id to check * @param canBeNull only if flag is set, <code>null</code> is accepted * * @see #isNullUUID() */ public static void checkId(CmsUUID id, boolean canBeNull) { if (canBeNull && (id == null)) { return; } if ((!canBeNull && (id == null)) || id.isNullUUID()) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_INVALID_UUID_1, id)); } }
/** * Deletes a user, where all permissions and resources attributes of the user * were transfered to a replacement user.<p> * * @param context the current request context * @param userId the id of the user to be deleted * @param replacementId the id of the user to be transfered * * @throws CmsException if operation was not successful */ public void deleteUser(CmsRequestContext context, CmsUUID userId, CmsUUID replacementId) throws CmsException { CmsUser user = readUser(context, userId); CmsUser replacementUser = null; if ((replacementId != null) && !replacementId.isNullUUID()) { replacementUser = readUser(context, replacementId); } deleteUser(context, user, replacementUser); }
/** * Returns the history driver for a given database context.<p> * * @param dbc the database context * @return the history driver for the database context */ public I_CmsHistoryDriver getHistoryDriver(CmsDbContext dbc) { if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) { return m_historyDriver; } I_CmsHistoryDriver driver = dbc.getHistoryDriver(dbc.getProjectId()); return driver != null ? driver : m_historyDriver; }
/** * Returns the user driver for a given database context.<p> * * @param dbc the database context * * @return the user driver for the database context */ public I_CmsUserDriver getUserDriver(CmsDbContext dbc) { if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) { return m_userDriver; } I_CmsUserDriver driver = dbc.getUserDriver(dbc.getProjectId()); return driver != null ? driver : m_userDriver; }
/** * Returns the VFS driver for the given database context.<p> * * @param dbc the database context * * @return a VFS driver */ public I_CmsVfsDriver getVfsDriver(CmsDbContext dbc) { if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) { return m_vfsDriver; } I_CmsVfsDriver driver = dbc.getVfsDriver(dbc.getProjectId()); return driver != null ? driver : m_vfsDriver; }
/** * Returns the project driver for a given DB context.<p> * * @param dbc the database context * * @return the project driver for the database context */ public I_CmsProjectDriver getProjectDriver(CmsDbContext dbc) { if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) { return m_projectDriver; } I_CmsProjectDriver driver = dbc.getProjectDriver(dbc.getProjectId()); return driver != null ? driver : m_projectDriver; }
/** * Returns either the user driver for the given DB context (if it has one) or a default value instead.<p> * * @param dbc the DB context * @param defaultDriver the driver that should be returned if no driver for the DB context was found * * @return either the user driver for the DB context, or <code>defaultDriver</code> if none were found */ public I_CmsUserDriver getUserDriver(CmsDbContext dbc, I_CmsUserDriver defaultDriver) { if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) { return defaultDriver; } I_CmsUserDriver driver = dbc.getUserDriver(dbc.getProjectId()); return driver != null ? driver : defaultDriver; }
/** * Returns either the project driver for the DB context (if it has one) or a default project driver.<p> * * @param dbc the DB context * @param defaultDriver the driver which should be returned if there is no project driver for the DB context * * @return either the project driver for the DB context, or the default driver */ public I_CmsProjectDriver getProjectDriver(CmsDbContext dbc, I_CmsProjectDriver defaultDriver) { if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) { return defaultDriver; } I_CmsProjectDriver driver = dbc.getProjectDriver(dbc.getProjectId()); return driver != null ? driver : defaultDriver; }
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }