/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsDbEntryNotFoundException(container, cause); } }
throw new CmsDbEntryNotFoundException( Messages.get().container(Messages.ERR_UNKNOWN_GROUP_1, roleGroupName)); LOG.debug(e.getLocalizedMessage(), e);
/** * 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 } }
/** * 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 } }
/** * @see org.opencms.main.CmsException#createException(org.opencms.i18n.CmsMessageContainer, java.lang.Throwable) */ @Override public CmsException createException(CmsMessageContainer container, Throwable cause) { return new CmsDbEntryNotFoundException(container, cause); } }
LOG.debug(e.getLocalizedMessage(), e); LOG.debug(e.getLocalizedMessage(), e); throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_UNKNOWN_GROUP_1, groupname));
/** * Utility function to read a prefixed principal from the OpenCms database using the * provided OpenCms user context.<p> * * The principal must be either prefixed with <code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}.</code> or * <code>{@link I_CmsPrincipal#PRINCIPAL_USER}.</code>.<p> * * @param cms the OpenCms user context to use when reading the principal * @param name the prefixed principal name * * @return the principal read from the OpenCms database * * @throws CmsException in case the principal could not be read */ public static I_CmsPrincipal readPrefixedPrincipal(CmsObject cms, String name) throws CmsException { if (CmsStringUtil.isNotEmpty(name)) { String upperCaseName = name.toUpperCase(); if (upperCaseName.startsWith(I_CmsPrincipal.PRINCIPAL_GROUP)) { // this principal is a group String groupName = name.substring(I_CmsPrincipal.PRINCIPAL_GROUP.length() + 1); return cms.readGroup(groupName); } else if (upperCaseName.startsWith(I_CmsPrincipal.PRINCIPAL_USER)) { // this principal is a user String userName = name.substring(I_CmsPrincipal.PRINCIPAL_USER.length() + 1); return cms.readUser(userName); } } // invalid principal name was given throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_INVALID_PRINCIPAL_1, name)); }
throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_UNKNOWN_GROUP_1, groupname)); LOG.debug(e.getLocalizedMessage(), e); LOG.debug(e.getLocalizedMessage(), e);
/** * @see org.opencms.db.I_CmsHistoryDriver#readProject(org.opencms.db.CmsDbContext, int) */ public CmsHistoryProject readProject(CmsDbContext dbc, int publishTag) throws CmsDataAccessException { CmsHistoryProject project = null; try { Query q = m_sqlManager.createQuery(dbc, C_PROJECTS_HISTORY_READ); q.setParameter(1, Integer.valueOf(publishTag)); try { CmsDAOHistoryProjects hp = (CmsDAOHistoryProjects)q.getSingleResult(); List<String> projectresources = readProjectResources(dbc, publishTag); project = internalCreateProject(hp, projectresources); } catch (NoResultException e) { throw new CmsDbEntryNotFoundException( Messages.get().container(Messages.ERR_NO_HISTORY_PROJECT_WITH_TAG_ID_1, new Integer(publishTag))); } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } return project; }
/** * Utility function to read a principal of the given type from the OpenCms database using the * provided OpenCms user context.<p> * * The type must either be <code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}</code> or * <code>{@link I_CmsPrincipal#PRINCIPAL_USER}</code>.<p> * * @param cms the OpenCms user context to use when reading the principal * @param type the principal type * @param name the principal name * * @return the principal read from the OpenCms database * * @throws CmsException in case the principal could not be read */ public static I_CmsPrincipal readPrincipal(CmsObject cms, String type, String name) throws CmsException { if (CmsStringUtil.isNotEmpty(type)) { String upperCaseType = type.toUpperCase(); if (PRINCIPAL_GROUP.equals(upperCaseType)) { // this principal is a group return cms.readGroup(name); } else if (PRINCIPAL_USER.equals(upperCaseType)) { // this principal is a user return cms.readUser(name); } } // invalid principal type was given throw new CmsDbEntryNotFoundException( Messages.get().container(Messages.ERR_INVALID_PRINCIPAL_TYPE_2, type, name)); }
throw new CmsDbEntryNotFoundException(Messages.get().container( Messages.ERR_INVALID_PRINCIPAL_TYPE_2, type,
/** * @see org.opencms.db.I_CmsUserDriver#readUser(org.opencms.db.CmsDbContext, java.lang.String, java.lang.String, String) */ public CmsUser readUser(CmsDbContext dbc, String userFqn, String password, String remoteAddress) throws CmsDataAccessException, CmsPasswordEncryptionException { CmsUser user = readUser(dbc, userFqn); if (OpenCms.getPasswordHandler().checkPassword(password, user.getPassword(), true)) { return user; } else { CmsMessageContainer message = org.opencms.db.Messages.get().container( org.opencms.db.Messages.ERR_UNKNOWN_USER_1, userFqn); if (LOG.isDebugEnabled()) { LOG.debug(message.key()); } throw new CmsDbEntryNotFoundException(message); } }
/** * @see org.opencms.db.I_CmsUserDriver#readGroup(org.opencms.db.CmsDbContext, java.lang.String) */ public CmsGroup readGroup(CmsDbContext dbc, String groupFqn) throws CmsDataAccessException { CmsGroup group = null; try { Query q = m_sqlManager.createQuery(dbc, C_GROUPS_READ_BY_NAME_2); // read the group from the database q.setParameter(1, CmsOrganizationalUnit.getSimpleName(groupFqn)); q.setParameter(2, CmsOrganizationalUnit.SEPARATOR + CmsOrganizationalUnit.getParentFqn(groupFqn)); try { CmsDAOGroups g = (CmsDAOGroups)q.getSingleResult(); group = internalCreateGroup(g); } catch (NoResultException e) { CmsMessageContainer message = org.opencms.db.Messages.get().container( org.opencms.db.Messages.ERR_UNKNOWN_GROUP_1, groupFqn); if (LOG.isDebugEnabled()) { LOG.debug(message.key(), new Exception()); } throw new CmsDbEntryNotFoundException(message); } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } return group; }
/** * @see org.opencms.db.I_CmsProjectDriver#readProject(org.opencms.db.CmsDbContext, CmsUUID) */ public CmsProject readProject(CmsDbContext dbc, CmsUUID id) throws CmsDataAccessException { CmsProject project = null; try { Query q = m_sqlManager.createQuery(dbc, C_PROJECTS_READ_1); q.setParameter(1, id.toString()); try { CmsDAOProjects p = (CmsDAOProjects)q.getSingleResult(); project = internalCreateProject(p); } catch (NoResultException e) { throw new CmsDbEntryNotFoundException( Messages.get().container(Messages.ERR_NO_PROJECT_WITH_ID_1, String.valueOf(id))); } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } return project; }
/** * @see org.opencms.db.I_CmsUserDriver#readUser(org.opencms.db.CmsDbContext, java.lang.String) */ public CmsUser readUser(CmsDbContext dbc, String userFqn) throws CmsDataAccessException { CmsUser user = null; try { Query q = m_sqlManager.createQuery(dbc, C_USERS_READ_BY_NAME_2); q.setParameter(1, CmsOrganizationalUnit.getSimpleName(userFqn)); q.setParameter(2, CmsOrganizationalUnit.SEPARATOR + CmsOrganizationalUnit.getParentFqn(userFqn)); try { CmsDAOUsers u = (CmsDAOUsers)q.getSingleResult(); user = internalCreateUser(dbc, u); } catch (NoResultException e) { CmsMessageContainer message = org.opencms.db.Messages.get().container( org.opencms.db.Messages.ERR_UNKNOWN_USER_1, userFqn); if (LOG.isDebugEnabled()) { LOG.debug(message.key()); } throw new CmsDbEntryNotFoundException(message); } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } return user; }
throw new CmsDbEntryNotFoundException(Messages.get().container( Messages.ERR_NO_HISTORY_PROJECT_WITH_TAG_ID_1, new Integer(publishTag)));
/** * @see org.opencms.db.I_CmsProjectDriver#readProject(org.opencms.db.CmsDbContext, java.lang.String) */ public CmsProject readProject(CmsDbContext dbc, String projectFqn) throws CmsDataAccessException { CmsProject project = null; try { Query q = m_sqlManager.createQuery(dbc, C_PROJECTS_READ_BYNAME_2); q.setParameter(1, CmsOrganizationalUnit.getSimpleName(projectFqn)); q.setParameter(2, CmsOrganizationalUnit.SEPARATOR + CmsOrganizationalUnit.getParentFqn(projectFqn)); try { CmsDAOProjects p = (CmsDAOProjects)q.getSingleResult(); project = internalCreateProject(p); } catch (NoResultException e) { throw new CmsDbEntryNotFoundException( Messages.get().container(Messages.ERR_NO_PROJECT_WITH_NAME_1, projectFqn)); } } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } return project; }
LOG.debug(message.key(), new Exception()); throw new CmsDbEntryNotFoundException(message);
/** * Utility function to read a principal by its id from the OpenCms database using the * provided OpenCms user context.<p> * * @param cms the OpenCms user context to use when reading the principal * @param id the id of the principal to read * * @return the principal read from the OpenCms database * * @throws CmsException in case the principal could not be read */ public static I_CmsPrincipal readPrincipal(CmsObject cms, CmsUUID id) throws CmsException { try { // first try to read the principal as a user return cms.readUser(id); } catch (CmsException exc) { // assume user does not exist } try { // now try to read the principal as a group return cms.readGroup(id); } catch (CmsException exc) { // assume group does not exist } // invalid principal name was given throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_INVALID_PRINCIPAL_1, id)); }
LOG.debug(message.key(), new Exception()); throw new CmsDbEntryNotFoundException(message);