public class BoxRemoteAssetUpgradeOperation extends AbstractContentTypeUpgradeOperation
UpgradeOperation
to update item descriptors that use the Box File Upload control
Supported YAML properties:
AbstractContentUpgradeOperation.ListFileVisitor
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_KEY_FIELD_XPATH |
static String |
CONFIG_KEY_ITEM_ID_XPATH |
static String |
CONFIG_KEY_ITEM_NAME_XPATH |
static String |
CONFIG_KEY_ITEM_XPATH |
static String |
CONFIG_KEY_PROFILE_XPATH |
static String |
CONFIG_KEY_URL_NAME |
static String |
CONFIG_KEY_URL_TEMPLATE |
protected String |
fieldNameXpath
XPath selector to find the name of the field that uses the Box control
|
protected String |
itemIdXpath
XPath selector to find the Box file id
|
protected String |
itemNameXpath
XPath selector to find the Box file name
|
protected String |
itemXpath
XPath selector to find the value of the field that uses the Box control
|
static String |
PLACEHOLDER_EXTENSION |
static String |
PLACEHOLDER_ID |
static String |
PLACEHOLDER_PROFILE |
protected String |
profileIdXpath
XPath selector to find the profile id configured for the Box control
|
protected String |
urlElementName
Name for the new XML tag to add to the field
|
protected String |
urlTemplate
URL template to generate the new value for the Box file
|
cache, CONFIG_KEY_CONTENT_TYPES, CONFIG_KEY_FORM_DEFINITION, CONFIG_KEY_MAX_ITEMS, contentTypeXpath, DEFAULT_MAX_ITEMS, factory, formDefinitionTemplate, formDefinitionXpath, includedContentTypes, NAME_PLACEHOLDER, transformerFactory, xPathFactory
CONFIG_KEY_INCLUDED_PATHS, includedPaths
applicationContext, commitDetails, CONFIG_KEY_COMMIT_DETAILS, contentRepository, currentVersion, dataSource, generalLockService, nextVersion, servletContext, studioConfiguration
Constructor and Description |
---|
BoxRemoteAssetUpgradeOperation() |
Modifier and Type | Method and Description |
---|---|
protected void |
doInit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) |
protected boolean |
findFields(Path file,
Document definition,
Document descriptor,
Node formField)
Find all fields in the given descriptor that use the Box control
|
protected boolean |
updateField(Document descriptor,
Node item,
String profileId,
String fieldName)
Updates the given field to add the new element if needed
|
protected void |
updateFile(String site,
Path file)
Performs any needed updates on the content of the given file
|
getFormDefinition, loadDocument, select, setContentTypeXpath, setFormDefinitionTemplate, shouldBeUpdated, writeFile
execute, filterPaths, findIncludedPaths, readFile, writeFile
commitAllChanges, getCommitMessage, getConnection, getContentRepository, getGeneralLockService, getProperty, getRepositoryPath, init, loadResource, setApplicationContext, setContentRepository, setDataSource, setGeneralLockService, setServletContext, setStudioConfiguration, writeToRepo
public static final String CONFIG_KEY_FIELD_XPATH
public static final String CONFIG_KEY_PROFILE_XPATH
public static final String CONFIG_KEY_ITEM_XPATH
public static final String CONFIG_KEY_ITEM_ID_XPATH
public static final String CONFIG_KEY_ITEM_NAME_XPATH
public static final String CONFIG_KEY_URL_NAME
public static final String CONFIG_KEY_URL_TEMPLATE
public static final String PLACEHOLDER_PROFILE
public static final String PLACEHOLDER_ID
public static final String PLACEHOLDER_EXTENSION
protected String fieldNameXpath
protected String profileIdXpath
protected String itemXpath
protected String itemIdXpath
protected String itemNameXpath
protected String urlElementName
protected String urlTemplate
protected void doInit(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config)
doInit
in class AbstractContentTypeUpgradeOperation
protected void updateFile(String site, Path file) throws UpgradeException
AbstractContentUpgradeOperation
updateFile
in class AbstractContentUpgradeOperation
site
- the site idfile
- the file to updateUpgradeException
- if there is any error updating the fileprotected boolean findFields(Path file, Document definition, Document descriptor, Node formField) throws XPathExpressionException
file
- the XML filedefinition
- the form definition of the content-typedescriptor
- the item descriptorformField
- the form fieldXPathExpressionException
- if there is an error evaluating a XPath selectorprotected boolean updateField(Document descriptor, Node item, String profileId, String fieldName) throws XPathExpressionException
descriptor
- the item descriptoritem
- the field itemprofileId
- the profile idfieldName
- the field nameXPathExpressionException
- if there is an error evaluating a XPath selectorCopyright © 2023 CrafterCMS. All rights reserved.