public class MergeMetadataForSharedProgramHelper extends Object implements Serviceable, Component
Modifier and Type | Field and Description |
---|---|
protected ContentTypeExtensionPoint |
_cTypeE
The content type extension point
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver
|
protected static XPathProcessor |
_xPathProcessor
The xpath processor
|
static String |
ROLE
The avalon role
|
static String |
SHARED_PROGRAMS_NODE_NAME
The name of the JCR node holding the shared metadata
|
Constructor and Description |
---|
MergeMetadataForSharedProgramHelper() |
Modifier and Type | Method and Description |
---|---|
protected String[] |
getMergeSharedStringArrayMetadata(SubProgram mainSubProgram,
String metadataName,
Logger logger)
Get and merge a String array shared metadata
|
ModifiableCompositeMetadata |
getSharedMetadataHolder(SubProgram mainProgram,
String subProgramCode,
Logger logger)
Get the composite metadata holding the shared metadata for subprogram of given code
|
Node |
getSharedProgramRootNode(SubProgram mainProgram,
Logger logger)
Get the shared program node holding the shared subprogram node
|
boolean |
isValidMetadataPath(ContentType cType,
String metadataPath,
Logger logger)
Determines if the metadata path is a valid path from the given content type and eligible to merge
|
boolean |
mergeSharedMetadata(SubProgram mainProgram,
Node contentNode,
Set<String> metadataToMerge,
Logger logger)
Merge the shared metadata
|
protected boolean |
mergeSharedMultipleMetadata(MetadataDefinition metadataDefinition,
SubProgram mainSubProgram,
Node contentNode,
String metadataName,
Logger logger)
Synchronize multiple metadata for main program
|
protected boolean |
mergeSharedRepeaterMetadata(MetadataDefinition metadataDefinition,
SubProgram mainSubProgram,
String metadataName,
Logger logger)
Merge all repeater entry to the main program
|
protected boolean |
mergeSharedSingleMetadata(MetadataDefinition metadataDefinition,
SubProgram mainProgram,
String metadataPath,
Logger logger)
Synchronize single metadata for main program
|
void |
service(ServiceManager manager) |
public static final String SHARED_PROGRAMS_NODE_NAME
protected static XPathProcessor _xPathProcessor
protected ContentTypeExtensionPoint _cTypeE
protected AmetysObjectResolver _resolver
public MergeMetadataForSharedProgramHelper()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public boolean mergeSharedMetadata(SubProgram mainProgram, Node contentNode, Set<String> metadataToMerge, Logger logger) throws RepositoryException
mainProgram
- the main programcontentNode
- The DOM representing the contentmetadataToMerge
- the metadata to mergelogger
- the loggerRepositoryException
- if an error occurredprotected boolean mergeSharedMultipleMetadata(MetadataDefinition metadataDefinition, SubProgram mainSubProgram, Node contentNode, String metadataName, Logger logger) throws RepositoryException
metadataDefinition
- the metadata definitionmainSubProgram
- the main subprogramcontentNode
- The DOM representing the contentmetadataName
- the metadata namelogger
- the loggerRepositoryException
- if an error occurredprotected boolean mergeSharedSingleMetadata(MetadataDefinition metadataDefinition, SubProgram mainProgram, String metadataPath, Logger logger) throws RepositoryException
metadataDefinition
- the metadata definitionmainProgram
- the main programmetadataPath
- the metadata pathlogger
- the loggerRepositoryException
- if an error occurredprotected String[] getMergeSharedStringArrayMetadata(SubProgram mainSubProgram, String metadataName, Logger logger) throws RepositoryException
mainSubProgram
- The main subprogrammetadataName
- The metadata namelogger
- the loggerRepositoryException
- if an error occurredprotected boolean mergeSharedRepeaterMetadata(MetadataDefinition metadataDefinition, SubProgram mainSubProgram, String metadataName, Logger logger) throws RepositoryException
metadataDefinition
- the metadata definitionmainSubProgram
- the main subprogrammetadataName
- the metadata namelogger
- the loggerRepositoryException
- if an error occurredpublic Node getSharedProgramRootNode(SubProgram mainProgram, Logger logger) throws RepositoryException
mainProgram
- the main programlogger
- the loggerRepositoryException
- if an error occurredpublic ModifiableCompositeMetadata getSharedMetadataHolder(SubProgram mainProgram, String subProgramCode, Logger logger) throws RepositoryException
mainProgram
- the main programsubProgramCode
- the sub program codelogger
- the loggerRepositoryException
- if an error occurredpublic boolean isValidMetadataPath(ContentType cType, String metadataPath, Logger logger)
cType
- The content typemetadataPath
- The metadata pathlogger
- the logger