com.ptc.windchill.esi.esidoc
Class ESIDocumentRenderer

java.lang.Object
  extended bycom.ptc.windchill.esi.rnd.ResponseRendererImpl
      extended bycom.ptc.windchill.esi.esidoc.ESIDocumentRenderer
All Implemented Interfaces:
DocumentRenderer, ResponseRenderer, Serializable

public class ESIDocumentRenderer
extends ResponseRendererImpl
implements DocumentRenderer, Serializable

This is the ESI default implementation of DocumentRenderer.

Supported API: true

Extendable: true

See Also:
Serialized Form

Nested Class Summary
private  class ESIDocumentRenderer.Delta
           
 
Field Summary
protected static String ADDED_DOCLINK_GROUP_NAME
           
protected static String ADDEDDOCGROUP_NAME
           
private  String auth
           
protected static String CHANGEDDOCGROUP_NAME
           
private static String CLASSNAME
           
private  WTPart currentPartIteration
           
protected static String DELETED_DOCLINK_GROUP_NAME
           
protected static Class DOC_CLASS
           
protected static Class DOC_DESCLINK_CLASS
           
protected static Class DOC_REFLINK_CLASS
           
private  ESIDocUtility docUtility
           
protected static Class EPM_BUILD_HISTORY_CLASS
           
protected static Class EPMDOC_CLASS
           
protected static Class EPMDOC_LINK_CLASS
           
protected static int PARTDOCINFO_ADDED
           
protected static int PARTDOCINFO_DELETED
           
protected static int PARTDOCINFO_UNCHANGED
           
private  WTPart previousPartIteration
           
protected static ReleaseActivityAction RA_CREATE
           
protected static ReleaseActivityAction RA_DELETE
           
private static String RESOURCE
           
private  Collection targets
           
protected static String TASK_URI
           
private  TaskHelper taskHelper
           
private  ESITransactionUtility transactionUtility
           
protected static String UNCHANGEDDOCGROUP_NAME
           
private  String wcAdapter
           
 
Fields inherited from class com.ptc.windchill.esi.rnd.ResponseRendererImpl
XML_META_NAME
 
Constructor Summary
ESIDocumentRenderer()
           
 
Method Summary
protected  Element adjustDocLinkElement(Element element, String group, ObjectToObjectLink documentLink, Collection targets)
          Allow subclasses to fix the contents of an element.
protected  Element adjustDocumentElement(Element element, String group, Document document, Collection targets)
          Allow subclasses to fix the contents of an element.
private  void buildDocument(PartDocInfo pdi, Map docElements, Collection targets, String linkGroupName, boolean deletedDocLink)
           
private  Collection buildDocumentLink(int pdiType, WTPart previous, PartDocInfo pdi, Map docLinkElements, Hashtable docElements, Collection targets)
           
protected  void buildGroups()
          Creates the Document output.
private  void buildGroups(WTPart current, WTPart previous, Collection targets)
           
private  void buildUnchangedLink(PartDocInfo pdi, WTPart previous, Hashtable docElements, Map docLinkElements, Collection targets, boolean unchangedPart)
           
private  void buildUnchangedRefLink(PartDocInfo pdi, Map docElements, Map docLinkElements, Collection targets, boolean unchangedPart)
          Add any revised documents that are identified by unchanged Reference links.
private  Collection createDeltas(HashMap map)
           
private  String findLatestPublishedRefDoc(WTPartReferenceLink link, ESITarget tgt)
           
private  QueryResult getAllActivity(Iterated iterated)
           
protected  String getAuth()
          Gets the value of the attribute: auth; The authentication information to pass to the Windchill Adapter when executing a query-objects task.
protected  WTPart getCurrentPartIteration()
          Gets the value of the attribute: currentPartIteration; The current iteration of the part associated with this document.
private  Hashtable getDocElements(Collection allDocs)
           
private  Hashtable getDocLinkElements(Collection allDocLinks)
           
private  Collection[] getDocumentDeltas(Document document, Collection targets)
           
protected  ESIDocUtility getDocUtility()
          Gets the value of the attribute: docUtility; Reference to a ESIDocUtility.
private  Hashtable getElements(Collection objects, Class objectType)
           
private  Collection[] getPartDocInfo(WTPart current, WTPart previous)
           
private  Collection getPreviouslyReleased(Iterated iterated, Collection targets)
           
protected  WTPart getPreviousPartIteration()
          Gets the value of the attribute: previousPartIteration; The last release iteration of the part associated with this document.
private  Collection getReleasedTargets(Persistable persistable, ReleaseActivityAction action, Collection targets)
           
protected  Collection getTargets()
          Gets the value of the attribute: targets; A collection ESITarget objects.
protected  TaskHelper getTaskHelper()
          Gets the value of the attribute: taskHelper; Reference to a TaskHelper.
protected  ESITransactionUtility getTransactionUtility()
          Gets the value of the attribute: transactionUtility; Reference to a ESITransactionUtility.
private  Collection getUnreleasedTargets(Persistable persistable, ReleaseActivityAction action, Collection targets)
           
protected  String getWcAdapter()
          Gets the value of the attribute: wcAdapter; The name of the Windchill Adapter where query-object tasks are to be executed.
private  Element mapDocument(String groupName, Element e, PartDocInfo pdi, Collection targets, Document previous)
           
private  Element mapDocumentLink(String groupName, Element e, PartDocInfo pdi, Collection targets)
           
private  void processRefDoc(ESIRefLink refLink, PartDocInfo pdi, Map docElements, Map docLinkElements)
           
 void setData(WTPart currentPart, WTPart previousPart, Collection targetOrgs, String wcAdapter, String authorization)
          Provide all necessary data to a DocumentRenderer.
protected  void validate()
          Throws an exception if currentPart or targets attributes are null.
 
Methods inherited from class com.ptc.windchill.esi.rnd.ResponseRendererImpl
adjustEffectivities, adjustObjectID, adjustTargets, buildUfidString, getAttsFromMapFile, getBuilder, getEffectivityHandler, getGroupInfo, getMap, getMapInfo, getTargetsFromAssns, invokeQueryTask, logException, mapElement, mapObject, render, setBuilder, setEffectivityHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ptc.windchill.esi.rnd.ResponseRenderer
render
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

currentPartIteration

private WTPart currentPartIteration

previousPartIteration

private WTPart previousPartIteration

targets

private Collection targets

wcAdapter

private String wcAdapter

auth

private String auth

taskHelper

private TaskHelper taskHelper

docUtility

private ESIDocUtility docUtility

transactionUtility

private ESITransactionUtility transactionUtility

PARTDOCINFO_ADDED

protected static final int PARTDOCINFO_ADDED
See Also:
Constant Field Values

PARTDOCINFO_DELETED

protected static final int PARTDOCINFO_DELETED
See Also:
Constant Field Values

PARTDOCINFO_UNCHANGED

protected static final int PARTDOCINFO_UNCHANGED
See Also:
Constant Field Values

ADDEDDOCGROUP_NAME

protected static final String ADDEDDOCGROUP_NAME
See Also:
Constant Field Values

CHANGEDDOCGROUP_NAME

protected static final String CHANGEDDOCGROUP_NAME
See Also:
Constant Field Values

UNCHANGEDDOCGROUP_NAME

protected static final String UNCHANGEDDOCGROUP_NAME
See Also:
Constant Field Values

ADDED_DOCLINK_GROUP_NAME

protected static final String ADDED_DOCLINK_GROUP_NAME
See Also:
Constant Field Values

DELETED_DOCLINK_GROUP_NAME

protected static final String DELETED_DOCLINK_GROUP_NAME
See Also:
Constant Field Values

DOC_CLASS

protected static final Class DOC_CLASS

EPMDOC_CLASS

protected static final Class EPMDOC_CLASS

DOC_DESCLINK_CLASS

protected static final Class DOC_DESCLINK_CLASS

DOC_REFLINK_CLASS

protected static final Class DOC_REFLINK_CLASS

EPMDOC_LINK_CLASS

protected static final Class EPMDOC_LINK_CLASS

EPM_BUILD_HISTORY_CLASS

protected static final Class EPM_BUILD_HISTORY_CLASS

TASK_URI

protected static final String TASK_URI

RA_CREATE

protected static final ReleaseActivityAction RA_CREATE

RA_DELETE

protected static final ReleaseActivityAction RA_DELETE
Constructor Detail

ESIDocumentRenderer

public ESIDocumentRenderer()
Method Detail

getCurrentPartIteration

protected WTPart getCurrentPartIteration()
Gets the value of the attribute: currentPartIteration; The current iteration of the part associated with this document. No setter for this attribute - it must be set using setData().

Supported API: true

Returns:
WTPart

getPreviousPartIteration

protected WTPart getPreviousPartIteration()
Gets the value of the attribute: previousPartIteration; The last release iteration of the part associated with this document. No setter for this attribute - it must be set using setData().

Supported API: true

Returns:
WTPart

getTargets

protected Collection getTargets()
Gets the value of the attribute: targets; A collection ESITarget objects. No setter for this attribute - it must be set using setData().

Supported API: true

Returns:
Collection

getWcAdapter

protected String getWcAdapter()
Gets the value of the attribute: wcAdapter; The name of the Windchill Adapter where query-object tasks are to be executed. No setter for this attribute - it must be set using setData().

Supported API: true

Returns:
String

getAuth

protected String getAuth()
Gets the value of the attribute: auth; The authentication information to pass to the Windchill Adapter when executing a query-objects task. No setter for this attribute - it must be set using setData().

Supported API: true

Returns:
String

getTaskHelper

protected TaskHelper getTaskHelper()
Gets the value of the attribute: taskHelper; Reference to a TaskHelper. Do not access the attribute directly. Use the lazy-initialing getter.

Supported API: true

Returns:
TaskHelper

getDocUtility

protected ESIDocUtility getDocUtility()
Gets the value of the attribute: docUtility; Reference to a ESIDocUtility. Do not access the attribute directly. Use the lazy-initialing getter.

Supported API: true

Returns:
ESIDocUtility

getTransactionUtility

protected ESITransactionUtility getTransactionUtility()
Gets the value of the attribute: transactionUtility; Reference to a ESITransactionUtility. Do not access the attribute directly. Use the lazy-initialing getter.

Supported API: true

Returns:
ESITransactionUtility

validate

protected void validate()
                 throws ESIRendererException
Throws an exception if currentPart or targets attributes are null. This method may be overridden.

Supported API: true

Specified by:
validate in class ResponseRendererImpl
Throws:
ESIRendererException

buildGroups

protected void buildGroups()
                    throws ESIRendererException
Creates the Document output. Does the following:
  1. If there is a previous iteration of the part, obtains the differences in document associations between the current part and the previous iteration of the part. Invokes ESIDocUtility.retrievePartDocDifferences() to obtain the differences.

    If there is no previous part iteration, obtains the documents from the current part iteration by requesting them from the ESIDocUtility.retrievePartDocInformation().

    The result of the ESIDocUtility methods is an array of collections of PartDocInfo objects.
  2. Obtains all of the documents associated with the PartDocInfo objects.
  3. Obtains all of the document links associated with the PartDocInfo objects.
  4. Separates the documents and document links on the basis of whether they were added, removed, changed, or unchanged.
  5. Invokes the Windchill adapter query-objects to obtain the data for the document and document link objects.
  6. calls adjustObjectID(), adjustTargets(), adjustDocumentElement() and adjustDocLinkElement()
  7. Passes the resultant Info*Engine element to the VdbBuilder that is maintained by the base class.


Supported API: true

Specified by:
buildGroups in class ResponseRendererImpl
Throws:
ESIRendererException

adjustDocumentElement

protected Element adjustDocumentElement(Element element,
                                        String group,
                                        Document document,
                                        Collection targets)
                                 throws ESIRendererException
Allow subclasses to fix the contents of an element. Default behavior is to return the element argument.

Supported API: true

Parameters:
element - The element to be adjusted.
group - the logical group name of the VdbGroup that will contain the element.
document - The document object that is being processsed
targets - Collection of ESITarget objects.
Returns:
Element
Throws:
ESIRendererException

adjustDocLinkElement

protected Element adjustDocLinkElement(Element element,
                                       String group,
                                       ObjectToObjectLink documentLink,
                                       Collection targets)
                                throws ESIRendererException
Allow subclasses to fix the contents of an element. Default behavior is to return the element argument.

Supported API: true

Parameters:
element - The element to be updated.
group - The logical group name. Used by the VdbBuilder to identify a VdbGroup.
documentLink - The object being mapped for output.
targets - Collection of ESITarget objects.
Returns:
Element
Throws:
ESIRendererException

setData

public void setData(WTPart currentPart,
                    WTPart previousPart,
                    Collection targetOrgs,
                    String wcAdapter,
                    String authorization)
Provide all necessary data to a DocumentRenderer.

Supported API: true

Specified by:
setData in interface DocumentRenderer
Parameters:
currentPart - Current part iteration
previousPart - previous part iteration.
targetOrgs - Contains the ESITargets that this document is being exported to.
wcAdapter - The name of the Windchill adapter where the query-object task will be executed.
authorization - The authorization for executing the query-object task.

buildGroups

private void buildGroups(WTPart current,
                         WTPart previous,
                         Collection targets)
                  throws WTException
Throws:
WTException

buildUnchangedLink

private void buildUnchangedLink(PartDocInfo pdi,
                                WTPart previous,
                                Hashtable docElements,
                                Map docLinkElements,
                                Collection targets,
                                boolean unchangedPart)
                         throws WTException
Throws:
WTException

buildUnchangedRefLink

private void buildUnchangedRefLink(PartDocInfo pdi,
                                   Map docElements,
                                   Map docLinkElements,
                                   Collection targets,
                                   boolean unchangedPart)
                            throws WTException
Add any revised documents that are identified by unchanged Reference links. Unchanged in this context means that the link was attached to the object previously. However, a WTPartReferenceLink always points to the current version of the document. This may not have been the version that was published. This method determines the previous version of the document that was published when the link was published to the appropriate targets. If there has been a change, the document is updated and the link is removed and readded.

Parameters:
pdi - The PartDocInfo that points to the link of interest.
docElements - The collection of Elements of the already mapped documents.
docLinkElements - The collection of mapped DocumentLink objects.
targets - The collection of targets of interest for this operation.
Throws:
WTException

processRefDoc

private void processRefDoc(ESIRefLink refLink,
                           PartDocInfo pdi,
                           Map docElements,
                           Map docLinkElements)
                    throws WTException
Throws:
WTException

findLatestPublishedRefDoc

private String findLatestPublishedRefDoc(WTPartReferenceLink link,
                                         ESITarget tgt)
                                  throws WTException
Throws:
WTException

buildDocumentLink

private Collection buildDocumentLink(int pdiType,
                                     WTPart previous,
                                     PartDocInfo pdi,
                                     Map docLinkElements,
                                     Hashtable docElements,
                                     Collection targets)
                              throws WTException
Throws:
WTException

buildDocument

private void buildDocument(PartDocInfo pdi,
                           Map docElements,
                           Collection targets,
                           String linkGroupName,
                           boolean deletedDocLink)
                    throws WTException
Throws:
WTException

getPreviouslyReleased

private Collection getPreviouslyReleased(Iterated iterated,
                                         Collection targets)
                                  throws WTException
Throws:
WTException

getPartDocInfo

private Collection[] getPartDocInfo(WTPart current,
                                    WTPart previous)
                             throws WTException
Throws:
WTException

getDocElements

private Hashtable getDocElements(Collection allDocs)
                          throws WTException
Throws:
WTException

getDocLinkElements

private Hashtable getDocLinkElements(Collection allDocLinks)
                              throws WTException
Throws:
WTException

getElements

private Hashtable getElements(Collection objects,
                              Class objectType)
                       throws WTException
Throws:
WTException

getUnreleasedTargets

private Collection getUnreleasedTargets(Persistable persistable,
                                        ReleaseActivityAction action,
                                        Collection targets)
                                 throws WTException
Throws:
WTException

getReleasedTargets

private Collection getReleasedTargets(Persistable persistable,
                                      ReleaseActivityAction action,
                                      Collection targets)
                               throws WTException
Throws:
WTException

mapDocument

private Element mapDocument(String groupName,
                            Element e,
                            PartDocInfo pdi,
                            Collection targets,
                            Document previous)
                     throws ESIRendererException
Throws:
ESIRendererException

mapDocumentLink

private Element mapDocumentLink(String groupName,
                                Element e,
                                PartDocInfo pdi,
                                Collection targets)
                         throws ESIRendererException
Throws:
ESIRendererException

getDocumentDeltas

private Collection[] getDocumentDeltas(Document document,
                                       Collection targets)
                                throws WTException
Throws:
WTException

createDeltas

private Collection createDeltas(HashMap map)

getAllActivity

private QueryResult getAllActivity(Iterated iterated)
                            throws WTException
Throws:
WTException