Quantcast
Channel: PTC Community : Unanswered Discussions - Windchill
Viewing all articles
Browse latest Browse all 3592

How to revise WTPartDescribeLink

$
0
0

I have WTPart object with describe links WTDocuments associated with that.Now I need to revise the PartDescribeLink through code.

Below is the code I have tried so far..

 

Vector localVector=new Vector();

QueryResult localQueryResult=WTPartHelper.service.getDescribedByWTDocuments(part,false);

System.out.println("size is "+localQueryResult.size());

                    if((localQueryResult!=null)&&(localQueryResult.hasMoreElements()))

                    {

                              while(localQueryResult.hasMoreElements())

                              {

     WTObject localObject=(WTObject) localQueryResult.nextElement();

      localVector.addElement(localObject);

                              }

                    }

                    if((localVector!=null)&&(localVector.size()>0))

                    {

                              for(int i=0;i<localVector.size();i++)

                              {

                                        WTPartDescribeLink localPartlink=(WTPartDescribeLink) localVector.elementAt(i);

   WTDocument localWTDocument=localPartlink.getDescribedBy();

   System.out.println("values are "+localWTDocument.getNumber());

                                        RevisionControlled localRevisionControlled=null;

                                        localRevisionControlled=(RevisionControlled) VersionControlHelper.service.newVersion(localWTDocument);

                                        localRevisionControlled=(RevisionControlled) PersistenceHelper.manager.save(localRevisionControlled);

}

                    }

 

This code is revising only the WTDocument object but not the partDescribelink.If I tried to pass the Describelink object directly like this

 

localRevisionControlled=(RevisionControlled) VersionControlHelper.service.newVersion((Versioned)localPartlink);

 

means it is showing the following error message.

Exception in thread "main" java.lang.ClassCastException: wt.part.WTPartDescribeLink cannot be cast to wt.vc.Versioned

          at ext.gt.test.CheckLink.getPartlink(CheckLink.java:94)

          at ext.gt.test.CheckLink.searchPart(CheckLink.java:52)

          at ext.gt.test.CheckLink.main(CheckLink.java:32)

 

I need to revise the link in code.Someone help me with giving the API or some example code snippets would be helpful for me.

 

Thank you


Viewing all articles
Browse latest Browse all 3592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>