com.ptc.windchill.cadx.common
Class ObjectDependencyProcessor

java.lang.Object
  extended bycom.ptc.windchill.cadx.common.ObjectDependencyProcessor
All Implemented Interfaces:
RemoteAccess

public class ObjectDependencyProcessor
extends Object
implements RemoteAccess


Field Summary
static Comparator DOCUMENT_NUMBER_COMPARATOR
           
static Comparator PERSISTABLE_COMPARATOR
           
private static String SERVER_CLASS
           
private static boolean VERBOSE
           
 
Fields inherited from interface wt.method.RemoteAccess
versionID
 
Constructor Summary
ObjectDependencyProcessor()
           
 
Method Summary
private static void addAssociatedDocs(EPMDocument[] assocDocs, Set[] objectSets, Set targetSet)
           
private static void addAssociatedParts(WTPart[] assocParts, Set[] objectSets, Set targetSet)
           
private static WTPart[] getAssociated(EPMDocument source)
          This method gives all WTPart objects associated with an EPMDocument object
private static EPMDocument[] getAssociated(WTPart target)
          This method gives all EPMDocument objects associated with a WTPart object
static Object[] getAssociatedDocsAndParts(Object[] selected)
          This method returns the WTParts which are associated to the selected EPM documents, EPM documents which are associated to any of the selected WTParts and other WTParts which are associated with these EPM documents.
static Object[] getAssociatedRemote(List selected)
          This method returns the WTParts which are associated to the selected EPM documents, EPM documents which are associated any of the selected WTParts and other WTParts which are associated with these EPM documents.
static Object[] getOptionalDependents(Object[] selected, EPMWorkspace workspace, EPMDocConfigSpec docConfigSpec, EPMPopulateRule rule, boolean includeAssociated, List associatedObjects, List requiredDependentObjects)
          Finds out the optional dependents of the selected CAD documents and their associated parts if required.
static Object[] getOptionalDependentsRemote(List selected, EPMWorkspace workspace, EPMDocConfigSpec docConfigSpec, EPMPopulateRule rule, Boolean includeAssociated, List associatedObjects, List requiredDependentObjects)
          Finds out the optional dependents of the selected CAD documents and their associated parts if required.
static Map getRefreshedObjects(Object[] objectsToBeRefreshed, ConfigSpec partConfigSpec, ConfigSpec docConfigSpec, EPMWorkspace workspace)
          This method refreshes the objects passed in the input array based upon the input config spec for parts and documents and the current open workspace and returns a map which has the numbers of the objects as the keys and the objects as the corresponding values.
static Map getRefreshedObjectsRemote(List objectList, ConfigSpec partConfigSpec, ConfigSpec docConfigSpec, EPMWorkspace workspace)
          This method refreshes the objects passed in the input array based upon the input config spec for parts and documents and the current open workspace and returns a map which has the numbers of the objects as the keys and the objects as the corresponding values.
static Object[] getRelatedDrawings(Object[] selected, boolean includeAssociated, List associatedObjects, List allDependents, ConfigSpec configSpec)
          This method finds out the drawings if any referencing the selected EPM documents and their dependents (if the flag includeDrawingsOfDependents is set) and the parts associated with these drawings (if the flag includeAssociated is set).
static Object[] getRelatedDrawingsRemote(List selected, Boolean includeAssociated, List associatedObjects, List allDependents, ConfigSpec configSpec)
          This method is meant for invocation by the remote method server.
private static QueryResult getRelatedItems(EPMWorkspace workspace, EPMPopulateRule rule, List selected, EPMDocConfigSpec docConfigSpec)
           
static Object[] getRequiredDependents(Object[] selected, EPMWorkspace workspace, EPMDocConfigSpec docConfigSpec, boolean includeAssociated, List associatedObjects)
          Finds out the required dependents of the selected CAD documents and their associated parts if required.
static Object[] getRequiredDependentsRemote(List selected, EPMWorkspace workspace, EPMDocConfigSpec docConfigSpec, Boolean includeAssociated, List associatedObjects)
          Finds out the required dependents of the selected CAD documents and their associated parts if required.
static Object[] getSecondaryDependents(Object[] selected, EPMWorkspace workspace, EPMDocConfigSpec docConfigSpec, EPMPopulateRule rule, boolean includeAssociated, List associatedObjects, List requiredDependentObjects, List optionalDependentObjects, List drawingObjects)
          Finds out the secondary dependents of the selected CAD documents and their associated parts if required.
static Object[] getSecondaryDependentsRemote(List selected, EPMWorkspace workspace, EPMDocConfigSpec docConfigSpec, EPMPopulateRule rule, Boolean includeAssociated, List associatedObjects, List requiredDependentObjects, List optionalDependentObjects, List drawingObjects)
          Finds out the secondary dependents of the selected CAD documents and their associated parts if required.
static ArrayList getUsesComponentsForEPMDoc(EPMDocument doc, ConfigSpec docConfigSpec, ArrayList docList)
          This method finds the components used in an assembly structure.
private static Workable getWorkspaceCopy(Workable inWorkable, EPMWorkspace workspace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_CLASS

private static final String SERVER_CLASS

VERBOSE

private static boolean VERBOSE

PERSISTABLE_COMPARATOR

public static final Comparator PERSISTABLE_COMPARATOR

DOCUMENT_NUMBER_COMPARATOR

public static final Comparator DOCUMENT_NUMBER_COMPARATOR
Constructor Detail

ObjectDependencyProcessor

public ObjectDependencyProcessor()
Method Detail

getAssociatedDocsAndParts

public static Object[] getAssociatedDocsAndParts(Object[] selected)
                                          throws WTException
This method returns the WTParts which are associated to the selected EPM documents, EPM documents which are associated to any of the selected WTParts and other WTParts which are associated with these EPM documents. Note that this method just wraps around the method getAssociatedRemote() which is invoked by the method server and is meant for use by client only.

Parameters:
selected - The array of objects selected from workspace browser(WB) or selection dialog(SD)
Returns:
Object[]
Throws:
WTException

getRelatedDrawings

public static Object[] getRelatedDrawings(Object[] selected,
                                          boolean includeAssociated,
                                          List associatedObjects,
                                          List allDependents,
                                          ConfigSpec configSpec)
                                   throws WTException
This method finds out the drawings if any referencing the selected EPM documents and their dependents (if the flag includeDrawingsOfDependents is set) and the parts associated with these drawings (if the flag includeAssociated is set). Note that this method is really meant for use from the client side and is a wrapper around the method getRelatedDrawingsRemote() which is invoked by this method from the remote method server.

Parameters:
selected - The array of objects selected from workspace browser(WB) or selection dialog(SD)
includeAssociated - A boolean flag indicating whether the parts associated with the drawings should be included in the list of dependents
associatedObjects - List of objects associated to those selected (could be passed as argument for avoiding recomputation of associated objects)
allDependents - List of dependents of the selected objects
configSpec - Config Spec to be used for filtering out the drawings
Returns:
Object[]
Throws:
WTException

getUsesComponentsForEPMDoc

public static ArrayList getUsesComponentsForEPMDoc(EPMDocument doc,
                                                   ConfigSpec docConfigSpec,
                                                   ArrayList docList)
                                            throws WTException
This method finds the components used in an assembly structure.

Parameters:
doc - The top level EPMDocument.
Returns:
String[]
Throws:
WTException

getRequiredDependents

public static Object[] getRequiredDependents(Object[] selected,
                                             EPMWorkspace workspace,
                                             EPMDocConfigSpec docConfigSpec,
                                             boolean includeAssociated,
                                             List associatedObjects)
                                      throws WTException,
                                             WTPropertyVetoException
Finds out the required dependents of the selected CAD documents and their associated parts if required. This method is meant for client use only and wraps around the method getRequiredDependentsRemote() below which is invoked by the remote method server.

Parameters:
selected - The array of objects selected from workspace browser(WB) or selection dialog(SD)
workspace - The current open workspace where the selected and dependent objects are to be downloaded/checked out
docConfigSpec - Document config spec to be used for finding out dependents (could be latest or a baseline or the same as current open workspace which is default)
includeAssociated - Boolean flag to indicate whether the parts associated with the required dependents should be included
associatedObjects - List of objects associated to those selected (could be passed as argument for avoiding recomputation of associated objects)
Returns:
Object[]
Throws:
WTException, - WTPropertyVetoException
WTException
WTPropertyVetoException

getOptionalDependents

public static Object[] getOptionalDependents(Object[] selected,
                                             EPMWorkspace workspace,
                                             EPMDocConfigSpec docConfigSpec,
                                             EPMPopulateRule rule,
                                             boolean includeAssociated,
                                             List associatedObjects,
                                             List requiredDependentObjects)
                                      throws WTException
Finds out the optional dependents of the selected CAD documents and their associated parts if required. This method is meant for client use only and wraps around the method getOptionalDependentsRemote() below which is invoked by the remote method server.

Parameters:
selected - The array of objects selected from workspace browser(WB) or selection dialog(SD)
workspace - The current open workspace where the selected and dependent objects are to be downloaded/checked out
docConfigSpec - Document config spec to be used for finding out dependents (could be latest or a baseline or the same as current open workspace which is default)
rule - The EPMPopulateRule to be used for finding out the dependents
includeAssociated - Boolean flag to indicate whether the parts associated with the optional dependents should be included
associatedObjects - List of objects associated to those selected (could be passed as argument for avoiding recomputation of associated objects)
requiredDependentObjects - List of required dependents of selected objects. Could be passed as argument if already determined to save time.
Returns:
Object[]
Throws:
WTException

getSecondaryDependents

public static Object[] getSecondaryDependents(Object[] selected,
                                              EPMWorkspace workspace,
                                              EPMDocConfigSpec docConfigSpec,
                                              EPMPopulateRule rule,
                                              boolean includeAssociated,
                                              List associatedObjects,
                                              List requiredDependentObjects,
                                              List optionalDependentObjects,
                                              List drawingObjects)
                                       throws WTException
Finds out the secondary dependents of the selected CAD documents and their associated parts if required. This method is meant for client use only and wraps around the method getSecondaryDependentsRemote() below which is invoked by the remote method server.

Parameters:
selected - The array of objects selected from workspace browser(WB) or selection dialog(SD)
workspace - The current open workspace where the selected and dependent objects are to be downloaded/checked out
docConfigSpec - Document config spec to be used for finding out dependents (could be latest or a baseline or the same as current open workspace which is default)
rule - The EPMPopulateRule to be used for finding out the dependents
includeAssociated - Boolean flag to indicate whether the parts associated with the optional dependents should be included
associatedObjects - List of objects associated to those selected
requiredDependentObjects - List of required dependents of selected objects.
optionalDependentObjects - List of optional dependents of selected objects.
drawingObjects - List of drawings referring the selected objects or their dependents
Returns:
Object[]
Throws:
WTException

getRefreshedObjects

public static Map getRefreshedObjects(Object[] objectsToBeRefreshed,
                                      ConfigSpec partConfigSpec,
                                      ConfigSpec docConfigSpec,
                                      EPMWorkspace workspace)
                               throws WTException
This method refreshes the objects passed in the input array based upon the input config spec for parts and documents and the current open workspace and returns a map which has the numbers of the objects as the keys and the objects as the corresponding values. Note that this method is a client-side method just wrapping around the method getRefreshedObjectsRemote() below which is invoked by the remote method server.

Parameters:
objectsToBeRefreshed - The array of objects to be refreshed
partConfigSpec - The config spec to be used for refreshing parts
docConfigSpec - The config spec to be used for refreshing documents
workspace - The current open workspace to be used to determine whether the object to be refreshed is checked out to this workspace
Returns:
Map
Throws:
WTException

getAssociatedRemote

public static Object[] getAssociatedRemote(List selected)
                                    throws WTException
This method returns the WTParts which are associated to the selected EPM documents, EPM documents which are associated any of the selected WTParts and other WTParts which are associated with these EPM documents. Note that this method is meant for remote invocation from the method server and the client code is not supposed to use it directly. This method uses the static methods getAssociated(WTPart) and getAssociated(EPMDocument) for finding respectively the documents and parts associated with the selected parts and documents.

Parameters:
selected - The list of objects selected from workspace browser(WB) or selection dialog(SD)
Returns:
Object[]
Throws:
WTException

getRelatedDrawingsRemote

public static Object[] getRelatedDrawingsRemote(List selected,
                                                Boolean includeAssociated,
                                                List associatedObjects,
                                                List allDependents,
                                                ConfigSpec configSpec)
                                         throws WTException
This method is meant for invocation by the remote method server. It finds out the drawings referenced by one or more of the EPM documents selected from WB/SD and their dependents if the flag includeDrawingsOfDependents is set and also the parts associated with these drawings if the flag includeAssociated is set. Essentially what this method does is to obtain the drawings referencing each document through the navigatReferencedBy() method from EPMStructureService.

Parameters:
selected - The list of objects selected from workspace browser(WB) or selection dialog(SD)
includeAssociated - A Boolean flag indicating whether the parts associated with the drawings should be included in the list of dependents
associatedObjects - List of objects associated to those selected. If passed as a non-null value, the objects associated to the selected ones are not recomputed.
allDependents - List of dependents of the selected objects
configSpec - Config Spec to be used for filtering out drawings
Returns:
Object[]
Throws:
WTException

getRequiredDependentsRemote

public static Object[] getRequiredDependentsRemote(List selected,
                                                   EPMWorkspace workspace,
                                                   EPMDocConfigSpec docConfigSpec,
                                                   Boolean includeAssociated,
                                                   List associatedObjects)
                                            throws WTException,
                                                   WTPropertyVetoException
Finds out the required dependents of the selected CAD documents and their associated parts if required. This method is meant to be invoked directly on method server.

Parameters:
selected - The list of objects selected from workspace browser(WB) or selection dialog(SD)
workspace - The current open workspace where the selected and dependent objects are to be downloaded/checked out
docConfigSpec - Document config spec to be used for finding out dependents (could be latest or a baseline or the same as current open workspace which is default)
includeAssociated - Boolean flag to indicate whether the parts associated with the required dependents should be included
associatedObjects - List of objects associated to those selected. If passed as a non-null value, the objects associated to the selected ones are not recomputed.
Returns:
Object[]
Throws:
WTException, - WTPropertyVetoException
WTException
WTPropertyVetoException

getOptionalDependentsRemote

public static Object[] getOptionalDependentsRemote(List selected,
                                                   EPMWorkspace workspace,
                                                   EPMDocConfigSpec docConfigSpec,
                                                   EPMPopulateRule rule,
                                                   Boolean includeAssociated,
                                                   List associatedObjects,
                                                   List requiredDependentObjects)
                                            throws WTException,
                                                   WTPropertyVetoException
Finds out the optional dependents of the selected CAD documents and their associated parts if required. This method is meant for being invoked from remote method server. In this method it is necessary to find the associated parts and documents as well as the required dependents because the optional dependents cannot be found out directly from the server. Instead we find all dependents using the method getRelatedItems() from EPMBaselineService and then eliminate all the required dependents from this list. This method also finds out any dependents of the documents associated with the selected parts since they are also considered as optional dependents. Also as usual the parts, if any, associated with these dependents will also be included in the list of dependents.

Parameters:
selected - The list of objects selected from workspace browser(WB) or selection dialog(SD)
workspace - The current open workspace where the selected and dependent objects are to be downloaded/checked out
docConfigSpec - Document config spec to be used for finding out dependents (could be latest or a baseline or the same as current open workspace which is default)
rule - The EPMPopulateRule to be used for finding out the dependents
includeAssociated - Boolean flag to indicate whether the parts associated with the optional dependents should be included
associatedObjects - List of objects associated to those selected. If passed as a non-null value, the objects associated to the selected ones are not recomputed.
requiredDependentObjects - List of the required dependents of the selected CAD documents and their associated parts if any. The required dependents are recomputed only if this parameter is null.
Returns:
Object[]
Throws:
WTException, - WTPropertyVetoException
WTException
WTPropertyVetoException

getSecondaryDependentsRemote

public static Object[] getSecondaryDependentsRemote(List selected,
                                                    EPMWorkspace workspace,
                                                    EPMDocConfigSpec docConfigSpec,
                                                    EPMPopulateRule rule,
                                                    Boolean includeAssociated,
                                                    List associatedObjects,
                                                    List requiredDependentObjects,
                                                    List optionalDependentObjects,
                                                    List drawingObjects)
                                             throws WTException,
                                                    WTPropertyVetoException
Finds out the secondary dependents of the selected CAD documents and their associated parts if required. These include : 1) The required and optional dependents of the drawings referring to one or more of the selected objects and/or their dependents, provided none of them have already been included as dependents. (Note that this list could grow depending upon the software requirements and as our understanding of dependencies in Pro/E improves.)

Parameters:
selected - The array of objects selected from workspace browser(WB) or selection dialog(SD)
workspace - The current open workspace where the selected and dependent objects are to be downloaded/checked out
docConfigSpec - Document config spec to be used for finding out dependents (could be latest or a baseline or the same as current open workspace which is default)
rule - The EPMPopulateRule to be used for finding out the dependents
includeAssociated - Boolean flag to indicate whether the parts associated with the optional dependents should be included
associatedObjects - List of objects associated to those selected
requiredDependentObjects - List of required dependents of selected objects.
optionalDependentObjects - List of optional dependents of selected objects.
drawingObjects - List of drawings referring the selected objects or their dependents
Returns:
Object[]
Throws:
WTException, - WTPropertyVetoException
WTException
WTPropertyVetoException

getRefreshedObjectsRemote

public static Map getRefreshedObjectsRemote(List objectList,
                                            ConfigSpec partConfigSpec,
                                            ConfigSpec docConfigSpec,
                                            EPMWorkspace workspace)
                                     throws WTException
This method refreshes the objects passed in the input array based upon the input config spec for parts and documents and the current open workspace and returns a map which has the numbers of the objects as the keys and the objects as the corresponding values. This method is meant to be invoked from remote method server.

Parameters:
objectList - The list of objects to be refreshed
partConfigSpec - The config spec to be used for refreshing parts
docConfigSpec - The config spec to be used for refreshing documents
workspace - The current open workspace to be used to determine whether the object to be refreshed is checked out to this workspace
Returns:
Map
Throws:
WTException

addAssociatedDocs

private static void addAssociatedDocs(EPMDocument[] assocDocs,
                                      Set[] objectSets,
                                      Set targetSet)
                               throws WTException
Throws:
WTException

addAssociatedParts

private static void addAssociatedParts(WTPart[] assocParts,
                                       Set[] objectSets,
                                       Set targetSet)

getRelatedItems

private static QueryResult getRelatedItems(EPMWorkspace workspace,
                                           EPMPopulateRule rule,
                                           List selected,
                                           EPMDocConfigSpec docConfigSpec)
                                    throws WTException,
                                           WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

getAssociated

private static WTPart[] getAssociated(EPMDocument source)
                               throws WTException
This method gives all WTPart objects associated with an EPMDocument object

Parameters:
source - The EPMDocument whose associated parts are to be obtained
Returns:
WTPart[]
Throws:
WTException

getAssociated

private static EPMDocument[] getAssociated(WTPart target)
                                    throws WTException
This method gives all EPMDocument objects associated with a WTPart object

Parameters:
target - The part whose associated documents are to be obtained
Returns:
EPMDocument[]
Throws:
WTException

getWorkspaceCopy

private static Workable getWorkspaceCopy(Workable inWorkable,
                                         EPMWorkspace workspace)
                                  throws WTException
Throws:
WTException