com.ptc.windchill.uwgm.task.newcaddoc
Class NewCadDocTask

java.lang.Object
  extended bycom.ptc.core.task.Task
      extended bycom.ptc.core.task.AtomicTask
          extended bycom.ptc.windchill.uwgm.task.newcaddoc.NewCadDocTask
All Implemented Interfaces:
Externalizable, Serializable

public class NewCadDocTask
extends AtomicTask
implements Externalizable



Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private  CADDocSpecs cadDocSpec
           
private  String CADModelName
           
private  String checkCADModelName
           
private  String checkNumber
           
private static String CLASSNAME
           
private  String desc
           
static int DESC_MAX_LENGTH
           
private  String docFolder
           
private  String docName
           
private  String docNumber
           
private static int docNumberBlank
           
private static int docNumberTooLong
           
private static int docNumberValid
           
static long EXTERNALIZATION_VERSION_UID
           
private  String isAutoNumber
           
private  EPMReferenceLink linkFromOtherSideObj
           
private  EPMReferenceLink linkFromSrc
           
private  Locale locale
           
private static int modelNameBlank
           
private static int modelNameExists
           
private static int modelNameHasInvalidChars
           
private static int modelNameHasInvalidExtn
           
private static int modelNameTooLong
           
static String modelNameUniqPropName
           
private static int modelNameValid
           
private  String modelType
           
private  EPMDocument newDocObj
           
private  Vector newObjVector
           
protected static long OLD_FORMAT_VERSION_UID
           
private  String organizationOID
           
private  String referredDocNumber
           
private  EPMDocument referredDocTempl
           
private  String referredModelName
           
private  String referredModelType
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private  String templateDocNumber
           
private static boolean VERBOSE
           
private  EPMWorkspace wsObj
           
 
Fields inherited from class com.ptc.core.task.Task
log
 
Constructor Summary
NewCadDocTask()
           
 
Method Summary
protected  TaskResult _run()
          

Supported API: false
private  boolean additionalValidation(EPMDocument tmplDoc)
          This method must be called after validateData ().
 boolean addToWorkspace()
           
 int checkCADModelName()
           
 int checkDocumentNumber()
           
 boolean createDocument()
           
 String getName()
          Gets the value of the attribute: name; Localized String that represents the "user task" label

Supported API: false
private  String getNewNumberForReferencedDocument(String docNo, String referredModelType)
           
 EPMDocument getReferencedDocument(EPMDocument srcDoc)
           
private  EPMDocument getTemplateByConfiguredDocNumber(String modelType)
          For the specified model type, get the template EPMDocument as per the template cad doc number specified in the configuration file for this type of model.
private  EPMDocument getTemplateCadDocForContainer(String modelType)
          For the specified model type, get the template cad doc as found in the container.
private  EPMDocument getTemplateEPMDocument(String modelType)
          For the specified model type, get the template EPMDocument.
 void handleCheckCADModelNamePressed()
           
 void handleCheckNumberPressed()
           
private  void initializeEPMReferenceLink(EPMReferenceLink newLink, EPMReferenceLink srcLink, EPMDocument srcObj, EPMDocument refObj)
           
private  boolean isContainerValid(String containerName)
          Check to see if the specified container is a valid container.
private  boolean isFolderValid(String docFolder, WTContainer container)
          Validate if the specified doc folder is valid one.
private  boolean isNonModeledAttributesPresentInForm(Map taskData)
          Returns true if any non modeled attributes are present in the form
private  boolean processNewCadDocAction(DefaultTaskData taskData)
           
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(NewCadDocTask thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
private  void removeUnwantedReferencedLinks(EPMDocument srcObj)
          During copy, the EPMReferenceLink gets copied too when a EPMDocument with reference link is copied.
private  EPMDocument setEntityAttributes(EPMDocument document)
          Set soft type attributes for the specified CAD Document.
 boolean validateData()
           
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class com.ptc.core.task.AtomicTask
readVersion, run
 
Methods inherited from class com.ptc.core.task.Task
execute, executeInBackground, getClientID, getContext, getEndDate, getInternalStatus, getParentTask, getQueueName, getResolutionOptions, getStartDate, getTaskData, getTaskEventId, hasConflicts, hasErrors, hasOverridableConflicts, hasWarnings, isRunningInBackground, isTaskEventStatusStored, readVersion, setClientID, setContext, setEndDate, setInternalStatus, setName, setParentTask, setQueueName, setResolutionOptions, setRunningInBackground, setStartDate, setTaskData, setTaskEventId, setTaskEventStatusStored, toString, updateTaskEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

checkNumber

private String checkNumber

docNumber

private String docNumber

docFolder

private String docFolder

CADModelName

private String CADModelName

modelType

private String modelType

templateDocNumber

private String templateDocNumber

docName

private String docName

wsObj

private EPMWorkspace wsObj

cadDocSpec

private CADDocSpecs cadDocSpec

desc

private String desc

newDocObj

private EPMDocument newDocObj

checkCADModelName

private String checkCADModelName

referredDocTempl

private EPMDocument referredDocTempl

referredModelType

private String referredModelType

referredModelName

private String referredModelName

referredDocNumber

private String referredDocNumber

linkFromSrc

private EPMReferenceLink linkFromSrc

linkFromOtherSideObj

private EPMReferenceLink linkFromOtherSideObj

newObjVector

private Vector newObjVector

isAutoNumber

private String isAutoNumber

organizationOID

private String organizationOID

locale

private Locale locale

VERBOSE

private static boolean VERBOSE

modelNameUniqPropName

public static final String modelNameUniqPropName
See Also:
Constant Field Values

docNumberValid

private static final int docNumberValid
See Also:
Constant Field Values

docNumberBlank

private static final int docNumberBlank
See Also:
Constant Field Values

docNumberTooLong

private static final int docNumberTooLong
See Also:
Constant Field Values

modelNameBlank

private static final int modelNameBlank
See Also:
Constant Field Values

modelNameTooLong

private static final int modelNameTooLong
See Also:
Constant Field Values

modelNameHasInvalidChars

private static final int modelNameHasInvalidChars
See Also:
Constant Field Values

modelNameHasInvalidExtn

private static final int modelNameHasInvalidExtn
See Also:
Constant Field Values

modelNameExists

private static final int modelNameExists
See Also:
Constant Field Values

modelNameValid

private static final int modelNameValid
See Also:
Constant Field Values

DESC_MAX_LENGTH

public static final int DESC_MAX_LENGTH
See Also:
Constant Field Values
Constructor Detail

NewCadDocTask

public NewCadDocTask()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class AtomicTask
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class AtomicTask
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(NewCadDocTask thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

_run

protected TaskResult _run()
                   throws WTException


Supported API: false

Specified by:
_run in class AtomicTask
Returns:
TaskResult
Throws:
WTException

processNewCadDocAction

private boolean processNewCadDocAction(DefaultTaskData taskData)
                                throws WTException
Throws:
WTException

checkDocumentNumber

public int checkDocumentNumber()
                        throws WTException
Throws:
WTException

validateData

public boolean validateData()

createDocument

public boolean createDocument()
                       throws WTException
Throws:
WTException

setEntityAttributes

private EPMDocument setEntityAttributes(EPMDocument document)
                                 throws WTException
Set soft type attributes for the specified CAD Document.

Parameters:
document - persisted cad doc
Returns:
Throws:
WTException

isNonModeledAttributesPresentInForm

private boolean isNonModeledAttributesPresentInForm(Map taskData)
Returns true if any non modeled attributes are present in the form

Returns:

handleCheckNumberPressed

public void handleCheckNumberPressed()

addToWorkspace

public boolean addToWorkspace()
                       throws WTException
Throws:
WTException

handleCheckCADModelNamePressed

public void handleCheckCADModelNamePressed()

checkCADModelName

public int checkCADModelName()
                      throws WTException
Throws:
WTException

getTemplateEPMDocument

private EPMDocument getTemplateEPMDocument(String modelType)
                                    throws WTException
For the specified model type, get the template EPMDocument.

Throws:
WTException

getTemplateByConfiguredDocNumber

private EPMDocument getTemplateByConfiguredDocNumber(String modelType)
                                              throws WTException
For the specified model type, get the template EPMDocument as per the template cad doc number specified in the configuration file for this type of model. For example, the cad doc number could be specified in the .ini file.

Throws:
WTException

getTemplateCadDocForContainer

private EPMDocument getTemplateCadDocForContainer(String modelType)
                                           throws WTException
For the specified model type, get the template cad doc as found in the container.

Throws:
WTException

getReferencedDocument

public EPMDocument getReferencedDocument(EPMDocument srcDoc)
                                  throws WTException
Throws:
WTException

getNewNumberForReferencedDocument

private String getNewNumberForReferencedDocument(String docNo,
                                                 String referredModelType)

additionalValidation

private boolean additionalValidation(EPMDocument tmplDoc)
This method must be called after validateData (). All the basic and common validation is done in that method. Any model type specific validation is done in this method.


initializeEPMReferenceLink

private void initializeEPMReferenceLink(EPMReferenceLink newLink,
                                        EPMReferenceLink srcLink,
                                        EPMDocument srcObj,
                                        EPMDocument refObj)
                                 throws WTPropertyVetoException
Throws:
WTPropertyVetoException

removeUnwantedReferencedLinks

private void removeUnwantedReferencedLinks(EPMDocument srcObj)
                                    throws WTException
During copy, the EPMReferenceLink gets copied too when a EPMDocument with reference link is copied. However, the link will point to the original template referenced CAD Document(s). This is not expected. So, these links need to be removed manually. For example, the link "newMfg -> templateAsm" and "newAsm -> templateMfg" would need to be removed. As per Ram Bhatt and Alan Siegler, this issue will be fixed in 7.0 as structure copy will be implemented.

Throws:
WTException

isContainerValid

private boolean isContainerValid(String containerName)
Check to see if the specified container is a valid container. If it is valid, store container as instance variable for later use.


isFolderValid

private boolean isFolderValid(String docFolder,
                              WTContainer container)
                       throws WTException
Validate if the specified doc folder is valid one. As folder could have been entered manually (rather than using Browse), check that this folder is owned by the specified container.

Throws:
WTException

getName

public String getName()
Description copied from class: Task
Gets the value of the attribute: name; Localized String that represents the "user task" label

Supported API: false

Overrides:
getName in class Task
Returns:
String