public class CrowdinFileSystem extends Object
Elements retrieved by using the
"info" function in the Crowdin API.| Modifier and Type | Class and Description |
|---|---|
static class |
CrowdinFileSystem.ItemType
This
enum represents the item types in the "Crowdin file system". |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsBranch(org.jdom2.Element currentElement,
String branchName,
org.apache.maven.plugin.logging.Log logger)
Checks if the given
Element contains the specified branch. |
static boolean |
containsFile(org.jdom2.Element currentElement,
String name,
EnumSet<CrowdinFileSystem.ItemType> filter,
org.apache.maven.plugin.logging.Log logger)
Checks if the given
Element contains the specified file, folder
or branch. |
static boolean |
containsFile(org.jdom2.Element currentElement,
String fileName,
org.apache.maven.plugin.logging.Log logger)
Checks if the given
Element contains the specified file. |
static boolean |
containsFolder(org.jdom2.Element currentElement,
String folderName,
org.apache.maven.plugin.logging.Log logger)
Checks if the given
Element contains the specified folder. |
static void |
createBranch(org.apache.http.client.HttpClient httpClient,
org.apache.maven.settings.Server server,
String branchName,
org.apache.maven.plugin.logging.Log logger)
Creates a new branch at Crowdin.
|
static void |
createFolder(org.apache.http.client.HttpClient httpClient,
org.apache.maven.settings.Server server,
String folderName,
org.apache.maven.plugin.logging.Log logger)
Creates a new folder at Crowdin.
|
static org.jdom2.Element |
createFolders(org.apache.http.client.HttpClient httpClient,
org.apache.maven.settings.Server server,
org.jdom2.Element currentElement,
String path,
org.apache.maven.plugin.logging.Log logger)
Creates folders on Crowdin as needed until the specified path exists.
|
static String |
formatPath(Path path,
boolean appendSeparator)
|
static String |
formatPath(String path,
boolean appendSeparator)
Formats a file path by converting backslashes to slashes and optionally
appends a slash to the end of the path if it's not already present.
|
static org.jdom2.Element |
getBranch(org.jdom2.Element currentElement,
String branchName,
org.apache.maven.plugin.logging.Log logger)
Extracts the specified branch
Element from files. |
static org.jdom2.Element |
getBranch(List<org.jdom2.Element> items,
String branchName)
Extracts the branch
Element with the given name. |
static org.jdom2.Element |
getFile(org.jdom2.Element currentElement,
String name,
EnumSet<CrowdinFileSystem.ItemType> filter,
org.apache.maven.plugin.logging.Log logger)
Extracts the specified file, folder or branch
Element from
files. |
static org.jdom2.Element |
getFile(org.jdom2.Element currentElement,
String fileName,
org.apache.maven.plugin.logging.Log logger)
Extracts the specified file
Element from files. |
static org.jdom2.Element |
getFile(List<org.jdom2.Element> items,
String fileName)
Extracts the file
Element with the given name. |
static org.jdom2.Element |
getFile(List<org.jdom2.Element> items,
String name,
EnumSet<CrowdinFileSystem.ItemType> filter)
Extracts the file, folder or branch
Element with the specified name. |
static org.jdom2.Element |
getFolder(org.jdom2.Element currentElement,
String folderName,
org.apache.maven.plugin.logging.Log logger)
Extracts the specified folder
Element from files. |
static org.jdom2.Element |
getFolder(List<org.jdom2.Element> items,
String folderName)
Extracts the folder
Element with the specified name. |
static org.jdom2.Element |
getParent(org.jdom2.Element item)
Gets the parent file or folder for the specified Crowdin file or folder
item.
|
static String |
getPushFolder(TranslationFileSet fileSet,
boolean includeCrowdinPath)
Determines and returns the push file folder by taking
TranslationFileSet.crowdinPath (optionally) and any folders in
TranslationFileSet.baseFileName into account. |
static boolean |
isBranch(org.jdom2.Element item)
Checks whether the specified
Element is a Crowdin branch. |
static boolean |
isFile(org.jdom2.Element item)
Checks whether the specified
Element is a Crowdin file. |
static boolean |
isFolder(org.jdom2.Element item)
Checks whether the specified
Element is a Crowdin folder. |
static boolean |
isRoot(org.jdom2.Element item)
Checks whether the specified
Element is the Crowdin
"root folder". |
public static boolean containsFile(@Nullable org.jdom2.Element currentElement, @Nullable String fileName, @Nullable org.apache.maven.plugin.logging.Log logger)
Element contains the specified file.currentElement - the Element to check.fileName - the file name to look for.logger - the Log instance to use for logging.true if the file exists in files, false
otherwise.public static boolean containsFolder(@Nullable org.jdom2.Element currentElement, @Nullable String folderName, @Nullable org.apache.maven.plugin.logging.Log logger)
Element contains the specified folder.currentElement - the Element to check.folderName - the folder name to look for.logger - the Log instance to use for logging.true if the folder exists in files, false
otherwise.public static boolean containsBranch(@Nullable org.jdom2.Element currentElement, @Nullable String branchName, @Nullable org.apache.maven.plugin.logging.Log logger)
Element contains the specified branch.currentElement - the Element to check.branchName - the file name to look for.logger - the Log instance to use for logging.true if the branch exists in files, false
otherwise.public static boolean containsFile(@Nullable org.jdom2.Element currentElement, @Nullable String name, @Nullable EnumSet<CrowdinFileSystem.ItemType> filter, @Nullable org.apache.maven.plugin.logging.Log logger)
Element contains the specified file, folder
or branch.currentElement - the Element to check.name - the file name to look for.filter - the CrowdinFileSystem.ItemTypes to look for.logger - the Log instance to use for logging.true if the file, folder or branch exists in
files, false otherwise.@Nullable public static org.jdom2.Element getFolder(@Nullable List<org.jdom2.Element> items, @Nullable String folderName)
Element with the specified name.items - the List of Elements to extract from.folderName - the folder name.Element or null.@Nullable public static org.jdom2.Element getFolder(@Nullable org.jdom2.Element currentElement, @Nullable String folderName, @Nullable org.apache.maven.plugin.logging.Log logger)
Element from files.currentElement - the Element to look in.folderName - the folder name to look for.logger - the Log instance to use for logging.Element or null if it doesn't
exist.@Nullable public static org.jdom2.Element getBranch(@Nullable List<org.jdom2.Element> items, @Nullable String branchName)
Element with the given name.items - the List of Elements to extract from.branchName - the branch name.Element or null.@Nullable public static org.jdom2.Element getBranch(@Nullable org.jdom2.Element currentElement, @Nullable String branchName, @Nullable org.apache.maven.plugin.logging.Log logger)
Element from files.currentElement - the Element to look in.branchName - the branch name to look for.logger - the Log instance to use for logging.Element or null if it doesn't
exist.@Nullable public static org.jdom2.Element getFile(@Nullable List<org.jdom2.Element> items, @Nullable String fileName)
Element with the given name.items - the List of Elements to extract from.fileName - the file name.Element or null.@Nullable public static org.jdom2.Element getFile(@Nullable List<org.jdom2.Element> items, @Nullable String name, @Nullable EnumSet<CrowdinFileSystem.ItemType> filter)
Element with the specified name.items - the List of Elements to extract from.name - the file, branch or folder name.filter - the CrowdinFileSystem.ItemTypes to look for.Element or null.@Nullable public static org.jdom2.Element getFile(@Nullable org.jdom2.Element currentElement, @Nullable String fileName, @Nullable org.apache.maven.plugin.logging.Log logger)
Element from files.currentElement - the Element to look in.fileName - the file name to look for.logger - the Log instance to use for logging.Element or null if it doesn't
exist.@Nullable public static org.jdom2.Element getFile(@Nullable org.jdom2.Element currentElement, @Nullable String name, @Nullable EnumSet<CrowdinFileSystem.ItemType> filter, @Nullable org.apache.maven.plugin.logging.Log logger)
Element from
files.currentElement - the Element to look in.name - the file name to look for.filter - the CrowdinFileSystem.ItemTypes to look for.logger - the Log instance to use for logging.Element or null if it doesn't
exist.public static boolean isFile(@Nullable org.jdom2.Element item)
Element is a Crowdin file.item - the Element to check.true if item is a Crowdin file, false
otherwise.public static boolean isFolder(@Nullable org.jdom2.Element item)
Element is a Crowdin folder.item - the Element to check.true if item is a Crowdin folder, false
otherwise.public static boolean isBranch(@Nullable org.jdom2.Element item)
Element is a Crowdin branch.item - the Element to check.true if item is a Crowdin branch, false
otherwise.public static boolean isRoot(@Nullable org.jdom2.Element item)
Element is the Crowdin
"root folder".item - the Element to check.true if item is the Crowdin "root folder",
false otherwise.@Nullable public static org.jdom2.Element getParent(@Nullable org.jdom2.Element item)
<files> Element.item - the Element for which to get the parent;@Nonnull public static String getPushFolder(@Nonnull TranslationFileSet fileSet, boolean includeCrowdinPath)
TranslationFileSet.crowdinPath (optionally) and any folders in
TranslationFileSet.baseFileName into account.fileSet - the TranslationFileSet for which to find the
Crowdin push folder.includeCrowdinPath - true to include
TranslationFileSet.crowdinPath in the returned path,
false otherwise.TranslationFileSet is placed in the Crowdin root.@Nonnull public static org.jdom2.Element createFolders(@Nonnull org.apache.http.client.HttpClient httpClient, @Nonnull org.apache.maven.settings.Server server, @Nonnull org.jdom2.Element currentElement, String path, @Nullable org.apache.maven.plugin.logging.Log logger) throws IOException
httpClient - the HttpClient to use.server - the Server to use for Crowdin credentials.currentElement - the file or branch item to resolve path
from.path - the path to make sure exists relative to
currentElement.logger - the Log instance to use for logging.IOException - If an error occurs during the operation.public static void createFolder(@Nonnull org.apache.http.client.HttpClient httpClient, @Nonnull org.apache.maven.settings.Server server, @Nonnull String folderName, @Nullable org.apache.maven.plugin.logging.Log logger) throws IOException
httpClient - the HttpClient to use.server - the Server to use for Crowdin credentials.folderName - the name of the new folder.logger - the Log instance to use for logging.IOException - If an error occurs during the operation.IllegalArgumentException - If folderName is blank.public static void createBranch(@Nonnull org.apache.http.client.HttpClient httpClient, @Nonnull org.apache.maven.settings.Server server, @Nonnull String branchName, @Nullable org.apache.maven.plugin.logging.Log logger) throws IOException
httpClient - the HttpClient to use.server - the Server to use for Crowdin credentials.branchName - the name of the new branch.logger - the Log instance to use for logging.IOException - If an error occurs during the operation.IllegalArgumentException - If branchrName is blank.@Nonnull public static String formatPath(@Nonnull String path, boolean appendSeparator)
path - the file path to format.appendSeparator - if true a slash will be appended to the
path if one isn't already there.Copyright © 2018. All rights reserved.