/** * @see java.lang.Object#toString() */ @Override public String toString() { return String.valueOf(getState()); } }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return String.valueOf(getState()); } }
/** * Create state message key for resource name.<p> * * @param state resource state * * @return title message key to resource state * * @see org.opencms.file.CmsResource#getState() */ public static String getStateKey(CmsResourceState state) { StringBuffer sb = new StringBuffer(GUI_STATE_PREFIX); sb.append(state.getState()); sb.append(GUI_STATE_POSTFIX); return sb.toString(); }
/** * Create state message key for resource name.<p> * * @param state resource state * * @return title message key to resource state * * @see org.opencms.file.CmsResource#getState() */ public static String getStateKey(CmsResourceState state) { StringBuffer sb = new StringBuffer(GUI_STATE_PREFIX); sb.append(state.getState()); sb.append(GUI_STATE_POSTFIX); return sb.toString(); }
/** * Appends the appropriate selection criteria related with the resource state.<p> * * @param projectId the id of the project of the resources * @param state the resource state * @param mode the selection mode * @param conditions buffer to append the selection criteria * @param params list to append the selection parameters */ protected void prepareStateCondition( CmsUUID projectId, CmsResourceState state, int mode, StringBuffer conditions, List params) { if (state != null) { if ((mode & CmsDriverManager.READMODE_EXCLUDE_STATE) > 0) { // C_READ_MODIFIED_STATES: add condition to match against any state but not given state conditions.append(BEGIN_EXCLUDE_CONDITION); } else { // otherwise add condition to match against given state if necessary conditions.append(BEGIN_INCLUDE_CONDITION); } conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_BY_RESOURCE_STATE")); conditions.append(END_CONDITION); params.add(new Integer(state.getState())); params.add(new Integer(state.getState())); } }
/** * Appends the appropriate selection criteria related with the resource state.<p> * * @param projectId the id of the project of the resources * @param state the resource state * @param mode the selection mode * @param conditions buffer to append the selection criteria * @param params list to append the selection parameters */ protected void prepareStateCondition( CmsUUID projectId, CmsResourceState state, int mode, StringBuffer conditions, List<Object> params) { if (state != null) { if ((mode & CmsDriverManager.READMODE_EXCLUDE_STATE) > 0) { // C_READ_MODIFIED_STATES: add condition to match against any state but not given state conditions.append(BEGIN_EXCLUDE_CONDITION); } else { // otherwise add condition to match against given state if necessary conditions.append(BEGIN_INCLUDE_CONDITION); } conditions.append(m_sqlManager.readQuery(projectId, C_RESOURCES_SELECT_BY_RESOURCE_STATE)); conditions.append(END_CONDITION); params.add(Integer.valueOf(state.getState())); params.add(Integer.valueOf(state.getState())); } }
/** * Appends the appropriate selection criteria related with the resource state.<p> * * @param projectId the id of the project of the resources * @param state the resource state * @param mode the selection mode * @param conditions buffer to append the selection criteria * @param params list to append the selection parameters */ protected void prepareStateCondition( CmsUUID projectId, CmsResourceState state, int mode, StringBuffer conditions, List<Object> params) { if (state != null) { if ((mode & CmsDriverManager.READMODE_EXCLUDE_STATE) > 0) { // C_READ_MODIFIED_STATES: add condition to match against any state but not given state conditions.append(BEGIN_EXCLUDE_CONDITION); } else { // otherwise add condition to match against given state if necessary conditions.append(BEGIN_INCLUDE_CONDITION); } conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_BY_RESOURCE_STATE")); conditions.append(END_CONDITION); params.add(new Integer(state.getState())); params.add(new Integer(state.getState())); } }
q.setParameter(2, Integer.valueOf(state.getState())); q.setParameter(3, Integer.valueOf(state.getState())); q.setParameter(4, Integer.valueOf(state.getState())); q.setParameter(5, Integer.valueOf(state.getState())); } else if (mode == CmsDriverManager.READMODE_UNMATCHSTATE) { q = m_sqlManager.createQuery(dbc, projectId, C_RESOURCES_GET_RESOURCE_IN_PROJECT_WITHOUT_STATE); q.setParameter(1, projectId.toString()); q.setParameter(2, Integer.valueOf(state.getState())); q.setParameter(3, Integer.valueOf(state.getState())); } else { q = m_sqlManager.createQuery(dbc, projectId, C_RESOURCES_GET_RESOURCE_IN_PROJECT_IGNORE_STATE);
"C_RESOURCES_GET_RESOURCE_IN_PROJECT_WITH_STATE"); stmt.setString(1, projectId.toString()); stmt.setInt(2, state.getState()); stmt.setInt(3, state.getState()); stmt.setInt(4, state.getState()); stmt.setInt(5, state.getState()); } else if (mode == CmsDriverManager.READMODE_UNMATCHSTATE) { stmt = m_sqlManager.getPreparedStatement( "C_RESOURCES_GET_RESOURCE_IN_PROJECT_WITHOUT_STATE"); stmt.setString(1, projectId.toString()); stmt.setInt(2, state.getState()); stmt.setInt(3, state.getState()); } else { stmt = m_sqlManager.getPreparedStatement(
"C_RESOURCES_GET_RESOURCE_IN_PROJECT_WITH_STATE"); stmt.setString(1, projectId.toString()); stmt.setInt(2, state.getState()); stmt.setInt(3, state.getState()); stmt.setInt(4, state.getState()); stmt.setInt(5, state.getState()); } else if (mode == CmsDriverManager.READMODE_UNMATCHSTATE) { stmt = m_sqlManager.getPreparedStatement( "C_RESOURCES_GET_RESOURCE_IN_PROJECT_WITHOUT_STATE"); stmt.setString(1, projectId.toString()); stmt.setInt(2, state.getState()); stmt.setInt(3, state.getState()); } else { stmt = m_sqlManager.getPreparedStatement(
/** * @see org.opencms.db.I_CmsProjectDriver#writePublishHistory(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, org.opencms.db.CmsPublishedResource) */ public void writePublishHistory(CmsDbContext dbc, CmsUUID publishId, CmsPublishedResource resource) throws CmsDataAccessException { Connection conn = null; PreparedStatement stmt = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, "C_RESOURCES_WRITE_PUBLISH_HISTORY"); stmt.setInt(1, resource.getPublishTag()); stmt.setString(2, resource.getStructureId().toString()); stmt.setString(3, resource.getResourceId().toString()); stmt.setString(4, resource.getRootPath()); stmt.setInt(5, resource.getMovedState().getState()); stmt.setInt(6, resource.getType()); stmt.setString(7, publishId.toString()); stmt.setInt(8, resource.getSiblingCount()); stmt.executeUpdate(); } catch (SQLException e) { throw new CmsDbSqlException(Messages.get().container( Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } }
/** * @see org.opencms.db.I_CmsProjectDriver#writePublishHistory(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, org.opencms.db.CmsPublishedResource) */ public void writePublishHistory(CmsDbContext dbc, CmsUUID publishId, CmsPublishedResource resource) throws CmsDataAccessException { Connection conn = null; PreparedStatement stmt = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, "C_RESOURCES_WRITE_PUBLISH_HISTORY"); stmt.setInt(1, resource.getPublishTag()); stmt.setString(2, resource.getStructureId().toString()); stmt.setString(3, resource.getResourceId().toString()); stmt.setString(4, resource.getRootPath()); stmt.setInt(5, resource.getMovedState().getState()); stmt.setInt(6, resource.getType()); stmt.setString(7, publishId.toString()); stmt.setInt(8, resource.getSiblingCount()); stmt.executeUpdate(); } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } }
stmt.setInt(1, resource.getState().getState()); stmt.setLong(2, resource.getDateLastModified()); stmt.setString(3, resource.getUserLastModified().toString()); stmt.setInt(1, resource.getState().getState()); stmt.setString(2, project.getUuid().toString()); stmt.setString(3, resource.getResourceId().toString()); || (changed == CmsDriverManager.UPDATE_STRUCTURE_STATE)) { stmt = m_sqlManager.getPreparedStatement(conn, project, "C_RESOURCES_UPDATE_STRUCTURE_STATE"); stmt.setInt(1, resource.getState().getState()); stmt.setString(2, resource.getStructureId().toString()); stmt.executeUpdate();
stmt.setLong(3, resourceDateModified); stmt.setString(4, resource.getUserLastModified().toString()); stmt.setInt(5, resourceState.getState()); stmt.setInt(6, resource.getLength()); stmt.setLong(7, resource.getDateContent()); stmt.setString(1, resource.getResourceId().toString()); stmt.setString(2, resourcePath); stmt.setInt(3, structureState.getState()); stmt.setLong(4, resource.getDateReleased()); stmt.setLong(5, resource.getDateExpired());
project, "C_RESOURCES_UPDATE_RESOURCE_STATELASTMODIFIED"); stmt.setInt(1, resource.getState().getState()); stmt.setLong(2, resource.getDateLastModified()); stmt.setString(3, resource.getUserLastModified().toString()); stmt.setInt(1, resource.getState().getState()); stmt.setString(2, project.getUuid().toString()); stmt.setString(3, resource.getResourceId().toString()); || (changed == CmsDriverManager.UPDATE_STRUCTURE_STATE)) { stmt = m_sqlManager.getPreparedStatement(conn, project, "C_RESOURCES_UPDATE_STRUCTURE_STATE"); stmt.setInt(1, resource.getState().getState()); stmt.setString(2, resource.getStructureId().toString()); stmt.executeUpdate();
LOG.warn(e.getLocalizedMessage(), e); m_state = res.getState().getState(); m_structureId = res.getStructureId().toString(); try {
CmsUUID projectLastModified = new CmsUUID( res.getString(m_sqlManager.readQuery("C_RESOURCES_PROJECT_LASTMODIFIED"))); int state = histRes.getState().getState(); // may be we have to compute something here? long dateCreated = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_CREATED")); long dateLastModified = res.getLong(m_sqlManager.readQuery("C_RESOURCES_DATE_LASTMODIFIED"));
r.setResourceState(resource.getState().getState()); r.setDateLastModified(resource.getDateLastModified()); r.setUserLastModified(resource.getUserLastModified().toString()); r.setResourceState(resource.getState().getState()); r.setProjectLastModified(project.getUuid().toString()); s.setStructureState(resource.getState().getState());
/** * @see org.opencms.db.I_CmsProjectDriver#writePublishHistory(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, org.opencms.db.CmsPublishedResource) */ public void writePublishHistory(CmsDbContext dbc, CmsUUID publishId, CmsPublishedResource resource) throws CmsDataAccessException { try { CmsDAOPublishHistory ph = new CmsDAOPublishHistory(); ph.setPublishTag(resource.getPublishTag()); ph.setStructureId(resource.getStructureId().toString()); ph.setResourceId(resource.getResourceId().toString()); ph.setResourcePath(resource.getRootPath()); ph.setResourceState(resource.getMovedState().getState()); ph.setResourceType(resource.getType()); ph.setHistoryId(publishId.toString()); ph.setSiblingCount(resource.getSiblingCount()); m_sqlManager.persist(dbc, ph); } catch (PersistenceException e) { throw new CmsDataAccessException(Messages.get().container(Messages.ERR_JPA_PERSITENCE_1, e), e); } }
int resourceFlags = hr.getResourceFlags(); CmsUUID projectLastModified = new CmsUUID(hr.getProjectLastModified()); int state = histRes.getState().getState(); // may be we have to compute something here? long dateCreated = hr.getDateCreated(); long dateLastModified = hr.getDateLastModified();