I have a WTPart object and it have some Describe link(as WTDocument) associated with it.Now I need to revise the describe link through code.
Following 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 which is linked as Describelink but not revising the Describelink. If I pass the Describe link object directly like this
localRevisionControlled=(RevisionControlled) VersionControlHelper.service.newVersion((Versioned)localPartlink);
means I'm getting error message like following
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:100)
at ext.gt.test.CheckLink.searchPart(CheckLink.java:52)
at ext.gt.test.CheckLink.main(CheckLink.java:32)
I don't know how to solve this issue but I need to revise the Part describelink by code.Suggest me the API which is needed for this or some example code snippet would be useful for me.