Package com.xwiki.confluencepro.script
Class BatchesScriptServices
- java.lang.Object
-
- com.xwiki.confluencepro.script.BatchesScriptServices
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("confluenceBatches") @Singleton public class BatchesScriptServices extends Object implements org.xwiki.script.service.ScriptServiceExpose various methods needed for the batch migrations.- Since:
- 1.30.2
- Version:
- $Id$
-
-
Constructor Summary
Constructors Constructor Description BatchesScriptServices()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcomputeBatchSize(List<String> paths)Computes the size of a batch.Map<String,List<String>>createBatch(String batchName, List<String> sources, String inputProperties, String outputProperties, Map<String,String> extraParams)Creates the batch and all its migrations.StringgetServerAbsolutePath()Returns the absolute path of the server to provide a hint to the user if the path given togetZips(String)is not valid.File[]getZips(String path)Returns the files present in the specified directory ornullif the given path is not a directory.com.fasterxml.jackson.databind.node.ObjectNoderesolveJson(String json)Receives a json in string format and returns a JSON object.
-
-
-
Field Detail
-
ROLEHINT
public static final String ROLEHINT
The rolehint of the class.- See Also:
- Constant Field Values
-
-
Method Detail
-
computeBatchSize
public String computeBatchSize(List<String> paths)
Computes the size of a batch.- Parameters:
paths- files that form the batch- Returns:
- size of the batch
-
getZips
public File[] getZips(String path)
Returns the files present in the specified directory ornullif the given path is not a directory.- Parameters:
path- the source directory path- Returns:
- an array of files in the directory if the path is valid; otherwise,
null
-
getServerAbsolutePath
public String getServerAbsolutePath()
Returns the absolute path of the server to provide a hint to the user if the path given togetZips(String)is not valid.- Returns:
- the absolute path of the server
-
createBatch
public Map<String,List<String>> createBatch(String batchName, List<String> sources, String inputProperties, String outputProperties, Map<String,String> extraParams) throws com.fasterxml.jackson.core.JsonProcessingException, com.xpn.xwiki.XWikiException
Creates the batch and all its migrations.- Parameters:
batchName- The name of the batch.sources- The sources of the migration packages.inputProperties- The input properties of the migration.outputProperties- The output properties of the migration.extraParams- A map containing extra parameters for custom implementations that may require additional data.- Returns:
- A map containing logs of the creation process.
- Throws:
com.fasterxml.jackson.core.JsonProcessingExceptioncom.xpn.xwiki.XWikiException
-
resolveJson
public com.fasterxml.jackson.databind.node.ObjectNode resolveJson(String json) throws com.fasterxml.jackson.core.JsonProcessingException
Receives a json in string format and returns a JSON object.- Parameters:
json- json string- Returns:
- JSON object
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
-