/** * Returns the RFS name used for caching an the text extraction result * based on the given VFS resource and locale.<p> * * @param resource the VFS resource to generate the cache name for * @param locale the locale to generate the cache name for (may be <code>null</code>) * * @return the RFS name to use for caching the given VFS resource with parameters */ public String getCacheName(CmsResource resource, Locale locale) { // create a StringBuffer for the result StringBuffer buf = new StringBuffer(m_rfsRepository.length() + 72); buf.append(m_rfsRepository); buf.append(resource.getResourceId().toString()); // check if parameters are provided, if so add them as well if (locale != null) { buf.append('_'); buf.append(locale.toString()); } // append the date of last content modification to the result buffer // please note that we need only worry about last change in content, since properties are ignored here buf.append('_'); buf.append(resource.getDateContent()); // finally append the extension buf.append(".ext"); return buf.toString(); }
buf.append(resource.getDateContent());
if (resource.isFile()) { result = resource.getDateContent();
if (resource.isFile()) { result = resource.getDateContent();
/** * 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.getSiblingCount(), resource.getLength(), resource.getDateContent(), resource.getVersion());
resource.getSiblingCount(), resource.getLength(), resource.getDateContent(), resource.getVersion());
stmt.setInt(5, resourceState.getState()); stmt.setInt(6, resource.getLength()); stmt.setLong(7, resource.getDateContent()); stmt.setString(8, projectLastModified.toString()); stmt.setInt(9, sibCount); stmt.setString(4, resource.getUserLastModified().toString()); stmt.setInt(5, resource.getLength()); stmt.setLong(6, resource.getDateContent()); stmt.setString(7, projectLastModified.toString()); stmt.setInt(8, sibCount);
stmt.setInt(5, resourceState.getState()); stmt.setInt(6, resource.getLength()); stmt.setLong(7, resource.getDateContent()); stmt.setString(8, projectLastModified.toString()); stmt.setInt(9, countSiblings(dbc, projectId, resource.getResourceId())); stmt.setString(4, resource.getUserLastModified().toString()); stmt.setInt(5, resource.getLength()); stmt.setLong(6, resource.getDateContent()); stmt.setString(7, projectLastModified.toString()); stmt.setInt(8, countSiblings(dbc, projectId, resource.getResourceId()));
/** * 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.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; }
long contentDateIndex = oldDoc.getFieldValueAsDate(CmsSearchField.FIELD_DATE_CONTENT).getTime(); if (contentDateIndex == resource.getDateContent()) {
/** * 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()); }
source.getSiblingCount() + 1, source.getLength(), source.getDateContent(),
/** * 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 * @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); }
/** * 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); }
r.setResourceState(resourceState.getState()); r.setResourceSize(resource.getLength()); r.setDateContent(resource.getDateContent()); r.setProjectLastModified(projectLastModified.toString()); r.setSiblingCount(countSiblings(dbc, projectId, resource.getResourceId())); r.setUserLastModified(resource.getUserLastModified().toString()); r.setResourceSize(resource.getLength()); r.setDateContent(resource.getDateContent()); r.setProjectLastModified(projectLastModified.toString()); r.setSiblingCount(countSiblings(dbc, projectId, resource.getResourceId()));
if (contentDateIndex == resource.getDateContent()) {
r.setResourceState(CmsResource.STATE_UNCHANGED.getState()); r.setResourceSize(resourceSize); r.setDateContent(offlineResource.getDateContent()); r.setProjectLastModified(offlineResource.getProjectLastModified().toString()); r.setSiblingCount(countSiblings(dbc, onlineProject.getUuid(), onlineResource.getResourceId())); r.setResourceState(CmsResource.STATE_UNCHANGED.getState()); r.setResourceSize(resourceSize); r.setDateContent(offlineResource.getDateContent()); r.setProjectLastModified(offlineResource.getProjectLastModified().toString()); r.setSiblingCount(1); // initial siblings count