EPMDocument文档信息的获取

You call the nextElement() three times. When the first time you call the nextElement() method in the line of "System.out.println", it gets the first element. When you call the second  time in the line "epmDoc = ", it will get the second element in the query result. Assuming you only have one describing document, you never get the one to pass to the epmDoc object.

建议如下修改:
QueryResult epmQr = wt.part.WTPartHelper.service.getDescribedByDocuments(obj);
wt.epm.EPMDocument epmDoc = null;
                    while (epmQr.hasMoreElements()) {
                        try {
                           Object temp = empQr.nextElement();
                           System.out.println("文档类型:"+temp.getClass()) ;
                           if(temp instanceof wt.epm.EPMDocument)
                           {
                               wt.epm.EPMDocument epmDoc = (wt.epm.EPMDocument) temp;
                               System.out.println("==EPM=" + epmDoc.getName());
                           }
                        } catch (Exception ex1) {
                            ex1.printStackTrace();
                        }
                      }

你可能感兴趣的:(Windchill)