/** * @see org.opencms.repository.I_CmsRepositoryItem#getCreationDate() */ public long getCreationDate() { return m_resource.getDateCreated(); }
/** * @see org.opencms.repository.I_CmsRepositoryItem#getCreationDate() */ public long getCreationDate() { return m_resource.getDateCreated(); }
/** * Creates a new instance of this comparator key.<p> * * @param cms the current OpenCms user context * @param resource the resource to create the key for * @param dateIdentifiers the date identifiers to use for selecting the date * * @return a new instance of this comparator key */ private static CmsDateResourceComparator create(CmsObject cms, CmsResource resource, List dateIdentifiers) { CmsDateResourceComparator result = new CmsDateResourceComparator(); result.m_date = calculateDate(cms, resource, dateIdentifiers, resource.getDateCreated()); return result; }
/** * Creates a new instance of this comparator key.<p> * * @param cms the current OpenCms user context * @param resource the resource to create the key for * @param dateIdentifiers the date identifiers to use for selecting the date * * @return a new instance of this comparator key */ private static CmsDateResourceComparator create(CmsObject cms, CmsResource resource, List<String> dateIdentifiers) { CmsDateResourceComparator result = new CmsDateResourceComparator(); result.m_date = calculateDate(cms, resource, dateIdentifiers, resource.getDateCreated()); return result; }
/** * Checks if a resource exists depending on the creation date and the temp files saved.<p> * * Dreamweaver copies folders through creating folder for folder and file for file. * So there is first a call if the property folder already exists and afterwards create * it. If the folder already exists, the copy action fails. * In the first time after creating a folder, the property dir does not exists until it is * created or the time expired.<p> * * @param res the resource to check if it exists * * @return return if the folder exists otherwise false */ private boolean existsResource(CmsResource res) { long now = new Date().getTime(); long created = res.getDateCreated(); long diff = (now - created) / 1000; if (diff <= TIME_DELAY) { // check tmp file table if (TMP_FILE_TABLE.contains(res.getRootPath())) { return true; } return false; } else { // remove from tmp file table TMP_FILE_TABLE.remove(res.getRootPath()); } return true; }
/** * Checks if a resource exists depending on the creation date and the temp files saved.<p> * * Dreamweaver copies folders through creating folder for folder and file for file. * So there is first a call if the property folder already exists and afterwards create * it. If the folder already exists, the copy action fails. * In the first time after creating a folder, the property dir does not exists until it is * created or the time expired.<p> * * @param res the resource to check if it exists * * @return return if the folder exists otherwise false */ private boolean existsResource(CmsResource res) { long now = new Date().getTime(); long created = res.getDateCreated(); long diff = (now - created) / 1000; if (diff <= TIME_DELAY) { // check tmp file table if (TMP_FILE_TABLE.containsKey(res.getRootPath())) { return true; } return false; } else { // remove from tmp file table TMP_FILE_TABLE.remove(res.getRootPath()); } return true; }
ext.append(resource.getDateLastModified()); ext.append(';'); ext.append(resource.getDateCreated()); if (resource.getLength() > 0) { ext.append(';');
ext.append(resource.getDateLastModified()); ext.append(';'); ext.append(resource.getDateCreated()); if (resource.getLength() > 0) { ext.append(';');
/** * Extends the given document by fields for date of creation, content and last modification.<p> * * @param document the document to extend * @param cms the OpenCms context used for building the search index * @param resource the resource that is indexed * @param extractionResult the plain text extraction result from the resource * @param properties the list of all properties directly attached to the resource (not searched) * @param propertiesSearched the list of all searched properties of the resource * * @return the document extended by fields for date of creation, content and last modification */ protected I_CmsSearchDocument appendDates( I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, List<CmsProperty> properties, List<CmsProperty> propertiesSearched) { document.addDateField(CmsSearchField.FIELD_DATE_CREATED, resource.getDateCreated(), true); document.addDateField(CmsSearchField.FIELD_DATE_LASTMODIFIED, resource.getDateLastModified(), true); document.addDateField(CmsSearchField.FIELD_DATE_CONTENT, resource.getDateContent(), false); return document; }
resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(),
/** * Copies state information from the internal CmsResource object to this object.<p> */ protected void updateFromResource() { setCreationDate(m_resource.getDateCreated()); int length = m_resource.getLength(); if (m_resource.isFolder()) { length = 1; } setFileSize(length); setModifyDate(m_resource.getDateLastModified()); setAttributes(m_resource.isFile() ? FileAttribute.Normal : FileAttribute.Directory); }
/** * Constructor, creates a new CmsFolder Object from the given CmsResource.<p> * * @param resource the base resource object to create a folder from */ public CmsFolder(CmsResource resource) { this( resource.getStructureId(), resource.getResourceId(), resource.getRootPath(), resource.getTypeId(), resource.getFlags(), resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(), resource.getVersion()); }
/** * 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 } }
/** * Constructor, creates a new file Object from the given resource with * an empty byte array as file content, if the resource does not * implement a file.<p> * * @param resource the base resource object to create a file from */ public CmsFile(CmsResource resource) { this( resource.getStructureId(), resource.getResourceId(), resource.getRootPath(), resource.getTypeId(), resource.getFlags(), resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(), resource.getSiblingCount(), resource.getLength(), resource.getDateContent(), resource.getVersion(), // if the resource already is a file, keep contents that might have been already read resource instanceof CmsFile ? ((CmsFile)resource).getContents() : null); }
/** * @see org.opencms.search.fields.CmsSearchFieldConfiguration#appendDates(org.opencms.search.I_CmsSearchDocument, org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.extractors.I_CmsExtractionResult, java.util.List, java.util.List) */ @Override protected I_CmsSearchDocument appendDates( I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, List<CmsProperty> properties, List<CmsProperty> propertiesSearched) { document.addDateField(CmsSearchField.FIELD_DATE_CREATED, resource.getDateCreated(), false); document.addDateField(CmsSearchField.FIELD_DATE_LASTMODIFIED, resource.getDateLastModified(), false); document.addDateField(CmsSearchField.FIELD_DATE_CONTENT, resource.getDateContent(), false); document.addDateField(CmsSearchField.FIELD_DATE_RELEASED, resource.getDateReleased(), false); document.addDateField(CmsSearchField.FIELD_DATE_EXPIRED, resource.getDateExpired(), false); return document; }
/** * Constructor, creates a new CmsFolder Object from the given CmsResource.<p> * * @param resource the base resource object to create a folder from */ public CmsFolder(CmsResource resource) { this( resource.getStructureId(), resource.getResourceId(), resource.getRootPath(), resource.getTypeId(), resource.getFlags(), resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(), resource.getVersion()); }
/** * Returns the virtual resource.<p> * * @return the virtual resource */ public CmsResource getResource() { return new CmsResource( m_base.getStructureId(), m_base.getResourceId(), m_rootPath, m_typeId, m_isFolder, m_base.getFlags(), m_base.getProjectLastModified(), m_base.getState(), m_base.getDateCreated(), m_base.getUserCreated(), m_base.getDateLastModified(), m_base.getUserLastModified(), m_base.getDateReleased(), m_base.getDateExpired(), m_base.getSiblingCount(), m_length, m_base.getDateContent(), m_base.getVersion()); }
/** * Constructor, creates a new file Object from the given resource with * an empty byte array as file content, if the resource does not * implement a file.<p> * * @param resource the base resource object to create a file from * @param doc the search document */ public CmsSearchResource(CmsResource resource, I_CmsSearchDocument doc) { this( resource.getStructureId(), resource.getResourceId(), resource.getRootPath(), resource.getTypeId(), resource.getFlags(), resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(), resource.getSiblingCount(), resource.getLength(), resource.getDateContent(), resource.getVersion(), doc); }
/** * Creates a new instance.<p> * * @param cms the current CMS context * @param res the resource to wrap */ public CmsJspResourceWrapper(CmsObject cms, CmsResource res) { super( res.getStructureId(), res.getResourceId(), res.getRootPath(), res.getTypeId(), res.isFolder(), res.getFlags(), res.getProjectLastModified(), res.getState(), res.getDateCreated(), res.getUserCreated(), res.getDateLastModified(), res.getUserLastModified(), res.getDateReleased(), res.getDateExpired(), res.getSiblingCount(), res.getLength(), res.getDateContent(), res.getVersion()); m_cms = cms; }
/** * Constructor, creates a new file Object from the given resource with * an empty byte array as file content, if the resource does not * implement a file.<p> * * @param resource the base resource object to create a file from */ public CmsFile(CmsResource resource) { this( resource.getStructureId(), resource.getResourceId(), resource.getRootPath(), resource.getTypeId(), resource.getFlags(), resource.getProjectLastModified(), resource.getState(), resource.getDateCreated(), resource.getUserCreated(), resource.getDateLastModified(), resource.getUserLastModified(), resource.getDateReleased(), resource.getDateExpired(), resource.getSiblingCount(), resource.getLength(), resource.getDateContent(), resource.getVersion(), // if the resource already is a file, keep contents that might have been already read resource instanceof CmsFile ? ((CmsFile)resource).getContents() : null); }