Main objective of chunking is to reuse chunked element at many places throughout application. But sometimes while application development many elements defined as chunks, but in future it turns out they are no longer needed to be reused.
Below mentioned Steps one needs to follow to unchunk specific XML element.
For example, one needs to unchunk 'Learning Objective' element as there is no need to reuse this part.
Step 1: Stop chunking for 'Learning Objective' element in configuration XML of Documentum XML Application
First of all chunking should be stopped for all content elements. So, content rule of learningObjective is modified to stop chunking:
File1: Sample XML Application Configuratio File (SampleXMLApp.xml)
<xml_content_rule make_object="false">
<element_selection_pattern>
<element>learningObjective</element>
</element_selection_pattern>
..…
..
…..
</xml_content_rule>
Here, make_object="false" defines that learningObjective element should not be chunked. So, new object will not be created but defined content_rule is still intact and it will carry out mentioned tasks such as:
Each content rule or link rule contains a <location> element that specifies where chunks should be created. Folder of paths specified in the <location> element will be created if they do not already exist.
<location>
<path>
<expression>
xmlAppUtil:createUnchunkedLearningObject('<var name="DF_SESSION"
/>','<var name="componentName"/>','<var name="objectId"/>','<var name="destinationFolderId"/>','<var name="destinationFolder"/>','<var
name="categoryName"/>','3G')
</expression>
</path>
</location>
Method defined in <expression> for location of chunked object will still be called and create folder with same name as chunk element. But, folder will not contain any chunked object as chunking has been stopped using make_object="false".
Step 2: Create object without chunking
This step need to be performed for legacy content.
Chunking is stopped for learningObjective element but Learning Objective object of some customized type (For example, 'customized_type') is needed at many places.
So, it is required that 'customized_type' type of object should be created with all required documentum attributes.
Using dfc custom object of type 'customized_type' with all required attributes will be created at location where previously object created by chunking was present. In this example, as mentioned in step 1 <location> element will call method of XmlAppUtil.java:
File2: XmlAppUtil.java
public static String createUnchunkedLearningObject(String stringSession, String componentName, String objectId, String destinationFolderId, String destinationFolder, String chunkName, String xmlVersion) throws Exception {
return createUnchunkedLearningObject(stringSession, componentName, objectId, destinationFolderId, destinationFolder, chunkName, null, xmlVersion);
}
public static String createUnchunkedLearningObject(String stringSession,
String componentName,
String objectId,
String destinationFolderId,
String destinationFolder,
String chunkName,
String typeValue,
String xmlVersion) throws Exception {
ChunkLocationCache cache = getChunkLocationCache(objectId);
LOGGER_.debug("createUnchunkedLearningObject cache: " + cache);
String location = cache.getChunkLocation(chunkName, typeValue);
if (location != null) {
return location;
}
location = createUnchunkedLO(stringSession,
componentName,
objectId,
destinationFolderId,
destinationFolder,
chunkName,
typeValue,
xmlVersion);
cache.setChunkLocation(chunkName, typeValue, location);
LOGGER_.debug("createUnchunkedLearningObject location: " + location);
return location;
}
createUnchunkedLearningObject() method will call createUnchunkedLO(), this method is finally responsible for creating folder with element name and create object of type customized_type in that folder as shown in code below:
public static String createUnchunkedLO(String stringSession,
String componentName,
String objectId,
String destinationFolderId,
String destinationFolder,
String chunkName,
String typeValue,
String xmlVersion) throws Exception {
….
..
….
IDfDocument idfDocument = (IDfDocument)session.newObject("customized_type");
idfDocument.setObjectName("Learning Objective");
idfDocument.link(chunkFolderPath);
idfDocument.setString("meta_type","learningObjective"); idfDocument.setString("meta_value", getLearningObjective("learningObjective"));
idfDocument.save();
…
..
…
}