Java-based APIs to work with DITA maps id175UB30E05Z
The following Java-based APIs allow you to work with DITA maps in AEM Guides. These APIs are available in the form of a bundle. You must include this bundle in your code to use these APIs.
Bundle details:
-
Group ID: com.adobe.fmdita
-
Artifact ID: api
-
Version: 3.2
-
Package: com.adobe.fmdita.api.maps
-
Class details:
code language-java public class MapUtilities extends Object
The MapUtilities class contain methods for retrieving metadata information from a DITA map file.
Download DITA map with dependents
The zipMapWithDependents
method creates a .zip file containing a DITA map along with all its dependents such as referenced topics, sub-maps, images, and DTDs. The .zip file for the DITA map is created based on a given baseline.
It also allows you to either maintain the same structure (parent and child folders) or create a flat file structure within a single folder for all dependent files.
Syntax:
public static void zipMapWithDependents(Session session,
String sourcePath,
String baseline,
OutputStream outputStream,
boolean flatFS)
throws RepositoryException, IOException
Parameters:
session
sourcePath
outputStream
baseline
Note: The value is case-sensitive.
The default value for this parameter is false.
Returns:
Contents of the ZIP are written to the outputStream
.
Exception:
Throws javax.jcr.RepositoryException
, java.io.IOException
.
Download DITA map with dependents (Asynchronously)
Alternatively, you can download DITA map with dependents in an asynchronous mode. This approach is more useful for larger DITA maps.
The zipMapWithDependents
method creates a .zip file containing a DITA map along with all its dependents such as referenced topics, sub-maps, images, and DTDs. The .zip file for the DITA map is created based on a given baseline.
It also allows you to either maintain the same structure (parent and child folders) or create a flat file structure within a single folder for all dependent files.
Syntax:
public static CompletableFuture<Node> zipMapWithDependencies(Session session,
String sourcePath,
String baseline,
boolean flatFS)
Parameters:
session
sourcePath
baseline
Note: The value is case-sensitive.
The default value for this parameter is false.
Returns:
The Node of the zip file is wrapped in the CompletableFuture
class. The user can continue handling it asynchronously, and can use .get()
method of the future to block the thread when the node is needed. The returned value can also end with an error, and that can be handled with .exceptionally()
method.
Get a list of baselines
The getBaselineList
method retrieves a list of all baselines that exist for a given DITA map.
Syntax:
public static List<HashMap<String,String>> getBaselineList(
javax.jcr.Session session,
String sourcePath)
throws javax.jcr.RepositoryException
Parameters:
session
sourcePath
Returns:
A list of HashMap
objects. Each HashMap
object represents a baseline and contains the name and title of the baseline.
Exception:
Throws javax.jcr.RepositoryException
.
Get a list of conditional presets
The getConditionalPresetList
method retrieves a list of all conditional presets that exist for a given DITA map.
Syntax:
public static List<HashMap<String,String>> getConditionalPresetList (
javax.jcr.Session session,
String sourcePath)
throws javax.jcr.RepositoryException
Parameters:
session
sourcePath
Returns:
A list of HashMap
objects. Each HashMap
object represents a conditional preset and contains the name and title of the conditional preset.
Exception:
Throws javax.jcr.RepositoryException
.
Get the DITAVAL file information for a conditional preset
The getDitavalFromConditionalPreset
method retrieves the path of the DITAVAL file corresponding to a conditional preset for a given DITA map.
Syntax:
public static String getDitavalFromConditionalPreset
(Session session,
String sourcePath,
String cpName) throws RepositoryException
Parameters:
session
sourcePath
cpName
Returns:
The path of the DITAVAL file corresponding to the conditional preset defined in the DITA map file.
Get all dependencies for a node
The getAllDependencies
method returns all dependencies of a given node.
Syntax:
public static List
<Node> getAllDependencies
(Node rootNode) throws GuidesApiException
Parameters:
rootNode
Returns:
A node list containing all dependencies of the root node.