private static Element getCADElement(EPMDocument epmDocument, String fileLocation) throws WTException, PropertyVetoException, IOException { Element cadDocument = new BaseElement("CADDocument"); cadDocument.addAttribute("DocID", epmDocument.getNumber()); cadDocument.addAttribute("Revision", epmDocument.getIterationIdentifier().getValue()); cadDocument.addAttribute("Version", epmDocument.getVersionIdentifier().getValue()); epmDocument = (EPMDocument) ContentHelper.service.getContents(epmDocument); ContentItem contentHolder = ContentHelper.getPrimary(epmDocument); ApplicationData applicationdataPrimary = (ApplicationData) contentHolder; String docType = "CATPart"; if (epmDocument.getDocType().toString().equals("CADASSEMBLY")) docType = "CATProd"; else if (epmDocument.getDocType().toString().equals("CADDRAWING")) docType = "CATDraw"; Element cadAttr = new BaseElement("Attributes"); cadAttr.add(new BaseElement("DocName").addText(applicationdataPrimary.getFileName())); cadAttr.add(new BaseElement("DocType").addText(docType)); cadAttr.add( new BaseElement("TeamID") .addText(epmDocument.getCreator().getPrincipal().getOrganization().getName())); cadAttr.add(new BaseElement("CreatedBy").addText(epmDocument.getCreatorFullName())); cadAttr.add(new BaseElement("UpdatedBy").addText(epmDocument.getModifierFullName())); cadAttr.add( new BaseElement("CreatedTime") .addText( dateFormat.format( new Date(PersistenceHelper.getCreateStamp(epmDocument).getTime())))); cadAttr.add( new BaseElement("LastUpdated") .addText( dateFormat.format( new Date(PersistenceHelper.getModifyStamp(epmDocument).getTime())))); cadDocument.add(cadAttr); Element docContent = new BaseElement("DocContent"); if (applicationdataPrimary != null) { File file = new File(fileLocation + "/CONTENTS/"); if (!file.exists()) file.mkdirs(); ContentServerHelper.service.writeContentStream( applicationdataPrimary, fileLocation + "/CONTENTS/" + applicationdataPrimary.getFileName()); docContent.add( new BaseElement("ContentPath") .addText("CONTENTS/" + applicationdataPrimary.getFileName())); docContent.add( new BaseElement("ContentFileName").addText(applicationdataPrimary.getFileName())); docContent.add(new BaseElement("ContentType").addText("ApplicationData")); docContent.add(new BaseElement("ContentType").addText(contentHolder.getRole().toString())); } cadDocument.add(docContent); ; return cadDocument; }