m_historyDriver.readPropertyDefinition(dbc, name); } catch (CmsException e) { m_historyDriver.createPropertyDefinition(dbc, name, CmsPropertyDefinition.TYPE_NORMAL);
/** * 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); m_vfsDriver.deletePropertyDefinition(dbc, propertyDefinition); m_historyDriver.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.singletonMap("propertyDefinition", propertyDefinition))); } }
m_historyDriver.destroy(); } catch (Throwable t) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_HISTORY_DRIVER_0), t);
int version = m_driverManager.getHistoryDriver(dbc).readLastVersion(dbc, id); if (version > 0) { I_CmsHistoryResource histRes = m_driverManager.getHistoryDriver(dbc).readResource(dbc, id, version); if (parent != null) { if (!includeSubFolders
int version = m_historyDriver.readLastVersion(dbc, structureId); I_CmsHistoryResource histRes = m_historyDriver.readResource(dbc, structureId, version); contents = ((CmsFile)histRes).getContents(); if ((contents == null) || (contents.length == 0)) { contents = m_historyDriver.readContent(dbc, histRes.getResourceId(), histRes.getPublishTag()); List properties = m_historyDriver.readProperties(dbc, histRes);
new Integer(versionsToKeep)), I_CmsReport.FORMAT_HEADLINE); List resources = m_historyDriver.getAllNotDeletedEntries(dbc); if (resources.isEmpty()) { report.println(Messages.get().container(Messages.RPT_DELETE_NOTHING_0), I_CmsReport.FORMAT_OK); int deleted = m_historyDriver.deleteEntries(dbc, histResource, versionsToKeep, -1); new Integer(versionsDeleted)), I_CmsReport.FORMAT_HEADLINE); List resources = m_historyDriver.getAllDeletedEntries(dbc); if (resources.isEmpty()) { report.println(Messages.get().container(Messages.RPT_DELETE_NOTHING_0), I_CmsReport.FORMAT_OK); int deleted = m_historyDriver.deleteEntries(dbc, histResource, versionsDeleted, timeDeleted);
try { m_driverManager.getHistoryDriver(dbc).writeProject(dbc, publishTag, System.currentTimeMillis()); dbc.pop(); } catch (Throwable t) { historyDriver.deleteEntries( dbc, new CmsHistoryFile(currentFolder), m_driverManager.getHistoryDriver(dbc).deleteEntries( dbc, new CmsHistoryFile(currentFolder),
/** * 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 itVersions = m_historyDriver.readAllAvailableVersions(dbc, resource.getStructureId()).iterator(); while (itVersions.hasNext()) { I_CmsHistoryResource histRes = (I_CmsHistoryResource)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())); }
m_driverManager.getHistoryDriver(dbc).deleteEntries( dbc, new CmsHistoryFile(offlineResource), m_driverManager.getHistoryDriver(dbc).deleteEntries( dbc, new CmsHistoryFile(offlineResource), m_driverManager.getHistoryDriver(dbc).deleteEntries( dbc, new CmsHistoryFile(offlineResource),
if (resource instanceof I_CmsHistoryResource) { file = new CmsHistoryFile((I_CmsHistoryResource)resource); file.setContents(m_historyDriver.readContent( dbc, resource.getResourceId(),
dbc.getRequestContext().setAttribute("ATTR_RESOURCE_NAME", resource.getRootPath()); try { deletedResources = m_historyDriver.readDeletedResources(dbc, resource.getStructureId(), isVfsManager ? null : dbc.currentUser().getId());
int version = m_driverManager.getHistoryDriver(dbc).readLastVersion(dbc, id); if (version > 0) { I_CmsHistoryResource histRes = m_driverManager.getHistoryDriver(dbc).readResource(dbc, id, version); if (parent != null) { if (!includeSubFolders
int version = getHistoryDriver(dbc).readLastVersion(dbc, structureId); I_CmsHistoryResource histRes = getHistoryDriver(dbc).readResource(dbc, structureId, version); contents = ((CmsFile)histRes).getContents(); if ((contents == null) || (contents.length == 0)) { contents = getHistoryDriver(dbc).readContent(dbc, histRes.getResourceId(), histRes.getPublishTag()); List<CmsProperty> properties = getHistoryDriver(dbc).readProperties(dbc, histRes);
I_CmsReport.FORMAT_HEADLINE); List<I_CmsHistoryResource> resources = getHistoryDriver(dbc).getAllNotDeletedEntries(dbc); if (resources.isEmpty()) { report.println(Messages.get().container(Messages.RPT_DELETE_NOTHING_0), I_CmsReport.FORMAT_OK); int deleted = getHistoryDriver(dbc).deleteEntries(dbc, histResource, versionsToKeep, -1); I_CmsReport.FORMAT_HEADLINE); List<I_CmsHistoryResource> resources = getHistoryDriver(dbc).getAllDeletedEntries(dbc); if (resources.isEmpty()) { report.println(Messages.get().container(Messages.RPT_DELETE_NOTHING_0), I_CmsReport.FORMAT_OK); int deleted = getHistoryDriver(dbc).deleteEntries(dbc, histResource, versionsDeleted, timeDeleted);
try { m_driverManager.getHistoryDriver(dbc).writeProject(dbc, publishTag, System.currentTimeMillis()); dbc.pop(); } catch (Throwable t) { historyDriver.deleteEntries( dbc, new CmsHistoryFile(currentFolder), m_driverManager.getHistoryDriver(dbc).deleteEntries( dbc, new CmsHistoryFile(currentFolder),
/** * 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())); }
m_driverManager.getHistoryDriver().deleteEntries( dbc, new CmsHistoryFile(offlineResource), m_driverManager.getHistoryDriver().deleteEntries( dbc, new CmsHistoryFile(offlineResource), m_driverManager.getHistoryDriver().deleteEntries( dbc, new CmsHistoryFile(offlineResource),
file = new CmsHistoryFile((I_CmsHistoryResource)resource); file.setContents( getHistoryDriver(dbc).readContent( dbc, resource.getResourceId(),
dbc.getRequestContext().setAttribute("ATTR_RESOURCE_NAME", resource.getRootPath()); try { deletedResources = getHistoryDriver(dbc).readDeletedResources( dbc, resource.getStructureId(),
int lastVersion = m_driverManager.getHistoryDriver().readLastVersion(dbc, newStructureId); int newStrVersion = 0; int newResVersion = 0; if (lastVersion > 0) { I_CmsHistoryResource histRes = m_driverManager.getHistoryDriver().readResource( dbc, newStructureId,