public final class CmsDocumentDependency
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static class |
CmsDocumentDependency.DependencyType
Defines the possible dependency types.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addAttachment(CmsDocumentDependency dep)
Adds another document attachment dependency to this document.
|
void |
addDependency(CmsDocumentDependency dep)
Adds another document dependency to this document.
|
void |
addVariant(CmsDocumentDependency dep)
Adds another language version document dependency to this document.
|
boolean |
equals(java.lang.Object obj) |
static CmsDocumentDependency |
fromDependencyString(java.lang.String input,
java.lang.String rootPath)
Creates a dependency object from a String representation.
|
void |
fromJSON(JSONObject json,
java.lang.String rootPath)
Read the information out of the given JSON object to fill
the values of the document.
|
int |
getAttachmentNumber()
Returns the attachment number.
|
java.util.List<CmsDocumentDependency> |
getAttachments()
Returns the attachments.
|
java.util.List<CmsDocumentDependency> |
getDependencies()
Returns the list of resources the main resource depends on, including the main resource itself.
|
java.lang.String |
getDocumentName()
Returns the file name of the document without attachment or locale suffixes.
|
java.lang.String |
getDocumentSuffix()
Returns the suffix of the document.
|
java.util.Locale |
getLocale()
Returns the locale of this document container.
|
static java.util.Locale |
getLocale(java.lang.String rootPath)
Returns the locale (language) of the given resource based on the resource root path.
|
CmsDocumentDependency |
getMainDocument()
Returns the main document in case this document is an attachment.
|
CmsPublishedResource |
getResource()
Returns the VFS resource for which the dependencies are calculated.
|
java.lang.String |
getRootPath()
Returns the root path of this dependency.
|
CmsDocumentDependency.DependencyType |
getType()
Returns the type.
|
java.util.List<CmsDocumentDependency> |
getVariants()
Returns the variants.
|
int |
hashCode() |
boolean |
hasLocaleFileName()
Returns the locale file name flag.
|
boolean |
isAttachment()
Returns true if this document is an attachment, i.e. an attachment number is provided.
|
static CmsDocumentDependency |
load(CmsObject cms,
CmsPublishedResource pubRes)
Loads or creates a dependency object for the given parameters.
|
static CmsDocumentDependency |
load(CmsObject cms,
CmsResource res)
Loads or creates a dependency object for the given parameters.
|
static CmsDocumentDependency |
load(CmsObject cms,
CmsResource res,
java.util.List<CmsResource> resources)
Loads or creates a dependency object for the given parameters.
|
protected static CmsDocumentDependency |
loadForTest(java.lang.String rootPath)
Creates a dependency object for the given root path, to be used only for test cases.
|
void |
readDependencies(CmsObject cms)
Reads all dependencies that exist for this main resource in the OpenCms VFS.
|
void |
readDependencies(CmsObject cms,
java.util.List<CmsResource> folderContent)
Reads all dependencies that exist for this main resource in provided list of resources.
|
protected static void |
removeFromContext(CmsObject cms,
CmsPublishedResource pubRes)
Removes the dependency object for a published resource from the OpenCms
runtime context.
|
void |
setAttachmentNumber(java.lang.Integer attachmentNumber)
Sets the attachment number.
|
void |
setDocumentName(java.lang.String documentName)
Sets the file name of the document without attachment or locale suffixes.
|
void |
setDocumentSuffix(java.lang.String documentSuffix)
Sets the suffix (.pdf, .doc etc.) of the document.
|
void |
setLocale(java.util.Locale locale)
Sets the locale of this document container.
|
void |
setMainDocument(CmsDocumentDependency mainDocument)
Sets the main document in case this document is an attachment.
|
void |
setType(CmsDocumentDependency.DependencyType type)
Sets the type for this dependency.
|
void |
storeInContext(CmsObject cms)
Stores this dependency object for a published resource in the OpenCms runtime context.
|
java.lang.String |
toDependencyString(CmsObject cms)
Creates the String representation of this dependency object.
|
JSONObject |
toJSON(CmsObject cms,
boolean includeLang)
Returns a JSON object describing this dependency document.
|
java.lang.String |
toString() |
public static CmsDocumentDependency fromDependencyString(java.lang.String input, java.lang.String rootPath)
input
- the String representationrootPath
- the root path of the base document of which the dependencies are encodedpublic static java.util.Locale getLocale(java.lang.String rootPath)
rootPath
- the resource name to check for the locale informationpublic static CmsDocumentDependency load(CmsObject cms, CmsPublishedResource pubRes)
cms
- the current OpenCms user contextpubRes
- the published resource to get the dependency object forpublic static CmsDocumentDependency load(CmsObject cms, CmsResource res)
cms
- the current OpenCms user contextres
- the VFS resource to get the dependency object forpublic static CmsDocumentDependency load(CmsObject cms, CmsResource res, java.util.List<CmsResource> resources)
cms
- the current OpenCms user contextres
- the VFS resource to get the dependency object forresources
- the resource folder data to check for dependenciesprotected static CmsDocumentDependency loadForTest(java.lang.String rootPath)
rootPath
- the root path to create the dependency object forprotected static void removeFromContext(CmsObject cms, CmsPublishedResource pubRes)
Please note: This must be used with caution since the information may be required to generate documents for several configured indexes. It must be ensured that this is called only when all indexes have been updated.
cms
- the current OpenCms user contextpubRes
- the published resource infostoreInContext(CmsObject)
public void addAttachment(CmsDocumentDependency dep)
dep
- the document attachment dependency to addpublic void addDependency(CmsDocumentDependency dep)
dep
- the document dependency to addpublic void addVariant(CmsDocumentDependency dep)
dep
- the language version document dependency to addpublic boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
Object.equals(java.lang.Object)
public void fromJSON(JSONObject json, java.lang.String rootPath)
json
- the JSON object with the information about this documentrootPath
- the current path the home divisionpublic int getAttachmentNumber()
public java.util.List<CmsDocumentDependency> getAttachments()
public java.util.List<CmsDocumentDependency> getDependencies()
public java.lang.String getDocumentName()
public java.lang.String getDocumentSuffix()
public java.util.Locale getLocale()
public CmsDocumentDependency getMainDocument()
public CmsPublishedResource getResource()
public java.lang.String getRootPath()
public CmsDocumentDependency.DependencyType getType()
public java.util.List<CmsDocumentDependency> getVariants()
public int hashCode()
hashCode
在类中 java.lang.Object
Object.hashCode()
public boolean hasLocaleFileName()
public boolean isAttachment()
public void readDependencies(CmsObject cms)
To be used when incremental updating an index.
cms
- the current users OpenCms contextpublic void readDependencies(CmsObject cms, java.util.List<CmsResource> folderContent)
cms
- the current users OpenCms contextfolderContent
- the contents of the folder to check the dependencies forpublic void setAttachmentNumber(java.lang.Integer attachmentNumber)
attachmentNumber
- the attachment numberpublic void setDocumentName(java.lang.String documentName)
documentName
- the file name of the document without attachment or locale suffixespublic void setDocumentSuffix(java.lang.String documentSuffix)
documentSuffix
- the suffix to setpublic void setLocale(java.util.Locale locale)
locale
- the locale of this document containerpublic void setMainDocument(CmsDocumentDependency mainDocument)
mainDocument
- the main document to setpublic void setType(CmsDocumentDependency.DependencyType type)
type
- the type to setpublic void storeInContext(CmsObject cms)
This done to optimize indexing speed. When the index update information is calculated, all dependencies for a resource must be calculated also. The same information is later needed when the Lucene document is created, for example in order to store the list of other available languages.
cms
- the current OpenCms user contextpublic java.lang.String toDependencyString(CmsObject cms)
cms
- the current OpenCms user contextpublic JSONObject toJSON(CmsObject cms, boolean includeLang)
cms
- the current cms objectincludeLang
- flag if language versions should be includedpublic java.lang.String toString()
toString
在类中 java.lang.Object
Object.toString()