/** * Returns the next publish tag for the published historical resources.<p> * * @param dbc the current database context * * @return the next available publish tag */ public int getNextPublishTag(CmsDbContext dbc) { return getHistoryDriver(dbc).readNextPublishTag(dbc); }
/** * Creates an historical entry of the current project.<p> * * @param dbc the current database context * @param publishTag the version * @param publishDate the date of publishing * * @throws CmsDataAccessException if operation was not successful */ public void writeHistoryProject(CmsDbContext dbc, int publishTag, long publishDate) throws CmsDataAccessException { getHistoryDriver(dbc).writeProject(dbc, publishTag, publishDate); }
/** * Returns the latest historical project entry with the given id.<p> * * @param dbc the current database context * @param projectId the project id * * @return the requested historical project entry * * @throws CmsException if something goes wrong */ public CmsHistoryProject readHistoryProject(CmsDbContext dbc, CmsUUID projectId) throws CmsException { return getHistoryDriver(dbc).readProject(dbc, projectId); }
/** * Returns a historical project entry.<p> * * @param dbc the current database context * @param publishTag the publish tag of the project * * @return the requested historical project entry * * @throws CmsException if something goes wrong */ public CmsHistoryProject readHistoryProject(CmsDbContext dbc, int publishTag) throws CmsException { return getHistoryDriver(dbc).readProject(dbc, publishTag); }
/** * Reads the list of all <code>{@link CmsProperty}</code> objects that belongs to the given historical resource.<p> * * @param dbc the current database context * @param historyResource the historical resource to read the properties for * * @return the list of <code>{@link CmsProperty}</code> objects * * @throws CmsException if something goes wrong */ public List<CmsProperty> readHistoryPropertyObjects(CmsDbContext dbc, I_CmsHistoryResource historyResource) throws CmsException { return getHistoryDriver(dbc).readProperties(dbc, historyResource); }
/** * Reads a principal (an user or group) from the historical archive based on its ID.<p> * * @param dbc the current database context * @param principalId the id of the principal to read * * @return the historical principal entry with the given id * * @throws CmsException if something goes wrong, ie. {@link CmsDbEntryNotFoundException} * * @see CmsObject#readUser(CmsUUID) * @see CmsObject#readGroup(CmsUUID) * @see CmsObject#readHistoryPrincipal(CmsUUID) */ public CmsHistoryPrincipal readHistoricalPrincipal(CmsDbContext dbc, CmsUUID principalId) throws CmsException { return getHistoryDriver(dbc).readPrincipal(dbc, principalId); }
m_sqlManager.closeAll(dbc, conn, stmt, res); I_CmsHistoryDriver historyDriver = m_driverManager.getHistoryDriver(dbc); for (Map.Entry<Integer, CmsHistoryProject> entry : tmpProjects.entrySet()) { List<String> resources = historyDriver.readProjectResources(dbc, entry.getKey().intValue());
m_sqlManager.closeAll(dbc, conn, stmt, res); I_CmsHistoryDriver historyDriver = m_driverManager.getHistoryDriver(dbc); for (Map.Entry<Integer, CmsHistoryProject> entry : tmpProjects.entrySet()) { List<String> resources = historyDriver.readProjectResources(dbc, entry.getKey().intValue());
m_sqlManager.closeAll(dbc, conn, stmt, res); I_CmsHistoryDriver historyDriver = m_driverManager.getHistoryDriver(dbc); for (Map.Entry<Integer, CmsHistoryProject> entry : tmpProjects.entrySet()) { List<String> resources = historyDriver.readProjectResources(dbc, entry.getKey().intValue());
m_sqlManager.closeAll(dbc, conn, stmt, res); I_CmsHistoryDriver historyDriver = m_driverManager.getHistoryDriver(dbc); for (Map.Entry<Integer, CmsHistoryProject> entry : tmpProjects.entrySet()) { List<String> resources = historyDriver.readProjectResources(dbc, entry.getKey().intValue());
res = stmt.executeQuery(); while (res.next()) { List resources = m_driverManager.getHistoryDriver().readProjectResources(dbc, res.getInt("PUBLISH_TAG")); projects.add(internalCreateProject(res, resources));
res = stmt.executeQuery(); while (res.next()) { List resources = m_driverManager.getHistoryDriver().readProjectResources( dbc, res.getInt("PUBLISH_TAG"));
res = stmt.executeQuery(); while (res.next()) { List resources = m_driverManager.getHistoryDriver().readProjectResources(dbc, res.getInt("PUBLISH_TAG")); projects.add(internalCreateProject(res, resources));
/** * @see org.opencms.db.I_CmsHistoryDriver#readProjects(org.opencms.db.CmsDbContext) */ @Override public List readProjects(CmsDbContext dbc) throws CmsDataAccessException { List projects = new ArrayList(); ResultSet res = null; PreparedStatement stmt = null; Connection conn = null; try { // create the statement conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, "C_MSSQL_PROJECTS_READLAST_HISTORY"); res = stmt.executeQuery(); while (res.next()) { List resources = m_driverManager.getHistoryDriver().readProjectResources(dbc, res.getInt("PUBLISH_TAG")); projects.add(internalCreateProject(res, resources)); } } catch (SQLException e) { throw new CmsDbSqlException(org.opencms.db.generic.Messages.get().container( org.opencms.db.generic.Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } return (projects); } }
/** * Reads an historical resource entry for the given resource and with the given version number.<p> * * @param dbc the current db context * @param resource the resource to be read * @param version the version number to retrieve * * @return the resource that was read * * @throws CmsException if the resource could not be read for any reason * * @see CmsObject#restoreResourceVersion(CmsUUID, int) * @see CmsObject#readResource(CmsUUID, int) */ public I_CmsHistoryResource readResource(CmsDbContext dbc, CmsResource resource, int version) throws CmsException { Iterator<I_CmsHistoryResource> itVersions = getHistoryDriver(dbc).readAllAvailableVersions( dbc, resource.getStructureId()).iterator(); while (itVersions.hasNext()) { I_CmsHistoryResource histRes = itVersions.next(); if (histRes.getVersion() == version) { return histRes; } } throw new CmsVfsResourceNotFoundException( org.opencms.db.generic.Messages.get().container( org.opencms.db.generic.Messages.ERR_HISTORY_FILE_NOT_FOUND_1, resource.getStructureId())); }
/** * Deletes a property definition.<p> * * @param dbc the current database context * @param name the name of the property definition to delete * * @throws CmsException if something goes wrong */ public void deletePropertyDefinition(CmsDbContext dbc, String name) throws CmsException { CmsPropertyDefinition propertyDefinition = null; try { // first read and then delete the metadefinition. propertyDefinition = readPropertyDefinition(dbc, name); getVfsDriver(dbc).deletePropertyDefinition(dbc, propertyDefinition); getHistoryDriver(dbc).deletePropertyDefinition(dbc, propertyDefinition); } finally { // fire an event that a property of a resource has been deleted OpenCms.fireCmsEvent( new CmsEvent( I_CmsEventListener.EVENT_PROPERTY_DEFINITION_MODIFIED, Collections.<String, Object> singletonMap("propertyDefinition", propertyDefinition))); } }
/** * Reads all versions of the given resource.<br> * * This method returns a list with the history of the given resource, i.e. * the historical resource entries, independent of the project they were attached to.<br> * * The reading excludes the file content.<p> * * @param dbc the current database context * @param resource the resource to read the history for * * @return a list of file headers, as <code>{@link I_CmsHistoryResource}</code> objects * * @throws CmsException if something goes wrong */ public List<I_CmsHistoryResource> readAllAvailableVersions(CmsDbContext dbc, CmsResource resource) throws CmsException { // read the historical resources List<I_CmsHistoryResource> versions = getHistoryDriver(dbc).readAllAvailableVersions( dbc, resource.getStructureId()); if ((versions.size() > OpenCms.getSystemInfo().getHistoryVersions()) && (OpenCms.getSystemInfo().getHistoryVersions() > -1)) { return versions.subList(0, OpenCms.getSystemInfo().getHistoryVersions()); } return versions; }
properties = m_driverManager.getVfsDriver().readPropertyObjects(dbc, dbc.currentProject(), resource); m_driverManager.getHistoryDriver().writeResource(dbc, resource, properties, publishTag);
resource); m_driverManager.getHistoryDriver(dbc).writeResource(dbc, resource, properties, publishTag);
file = new CmsHistoryFile((I_CmsHistoryResource)resource); file.setContents( getHistoryDriver(dbc).readContent( dbc, resource.getResourceId(),