I am using Windchill 10.2. I am trying to download assembly as well as its child parts with correct version(Not latest) using JAVA APIs.
Here is the situation -
I created one Assembly A with version 1.1 has 2 parts P1 with version 1.1 and P2 with version 1.1. Now I changed P2 and checked-in assembly again. So assembly version becomes 1.2, P1 is still 1.1 but P2 moves to 1.2.
A (1.1) A (1.2)
|---- P1 (1.1) |---- P1 (1.1)
|---- P2 (1.1) |---- P2 (1.2)
Now, I want to download Assembly with version 1.1 and its children, P1 and P2, both having version 1.1. I am doing following to get EPMDocument of assembly.
QuerySpec qSpec = new QuerySpec( EPMDocumentMaster.class );
qSpec.appendWhere( new SearchCondition( EPMDocumentMaster.class, EPMDocumentMaster.NAME, SearchCondition.EQUAL, "abc.asm") );
QueryResult qrMasters = PersistenceHelper.manager.find( qSpec );
QueryResult qr = VersionControlHelper.service.allVersionsOf( (Mastered)qrMasters.nextElement() );
EPMDocument epmDocument;
while ( qr.hasMoreElements() ) {
epmDocument= (EPMDocument) qr.nextElement(); <-- Here I got EPMDocument of Assembly
VersionInfo versionInfo = epmDocumentTemp.getVersionInfo();
if ( versionInfo.getIdentifier().getValue().equals("1") ) {
break;
}
}
Now I got EPMDocument. I want to know its children. For this,
QueryResult qr = EPMStructureHelper.service.navigateUses( epmDocument, null, false);
Enumeration enum1 = qr.getEnumeration();
while (enum1.hasMoreElements()) {
EPMMemberLink aEPMMemberLink = (EPMMemberLink) enum1.nextElement();
}
Here, I want to know EPMDocument of each child of assembly.
When I do,
EPMDocumentMaster aEPMDocumentMaster = (EPMDocumentMaster) aEPMMemberLink.getUses();
QueryResult qr1 = VersionControlHelper.service.allVersionsOf(aEPMDocumentMaster);
EPMDocument doc = (EPMDocument) qr1.nextElement();
I always get document of latest iteration. I want the one that is referenced by assembly of earlier version. How do I find this? I am more interested in knowing its iteration number.