ASF Bugzilla – Attachment 35729 Details for
Bug 62101
When writing the workbook to outputstream, getting weird error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Java code that creates the error
SupplierReportUtil.java (text/plain), 74.55 KB, created by
Laxmi Narayan
on 2018-02-13 10:14:03 UTC
(
hide
)
Description:
Java code that creates the error
Filename:
MIME Type:
Creator:
Laxmi Narayan
Created:
2018-02-13 10:14:03 UTC
Size:
74.55 KB
patch
obsolete
>package ext.ikea.icomp.report.util; > >import java.beans.PropertyVetoException; >import java.io.File; >import java.io.FileInputStream; >import java.io.FileOutputStream; >import java.io.IOException; >import java.io.InputStream; >import java.sql.Timestamp; >import java.text.SimpleDateFormat; >import java.util.ArrayList; >import java.util.Date; >import java.util.HashMap; >import java.util.Iterator; >import java.util.Locale; >import java.util.Map.Entry; >import java.util.Properties; >import java.util.Set; >import java.util.Vector; > >import org.apache.log4j.Logger; >import org.apache.poi.EncryptedDocumentException; >import org.apache.poi.hssf.usermodel.HSSFPrintSetup; >import org.apache.poi.openxml4j.exceptions.InvalidFormatException; >import org.apache.poi.ss.usermodel.Cell; >import org.apache.poi.ss.usermodel.CellStyle; >import org.apache.poi.ss.usermodel.Font; >import org.apache.poi.ss.usermodel.PrintSetup; >import org.apache.poi.ss.usermodel.Row; >import org.apache.poi.ss.usermodel.Sheet; >import org.apache.poi.ss.usermodel.Workbook; >import org.apache.poi.ss.usermodel.WorkbookFactory; >import org.apache.poi.ss.util.CellRangeAddress; >import org.apache.poi.xssf.usermodel.XSSFFont; >import org.apache.poi.xssf.usermodel.XSSFRichTextString; > >import com.ptc.core.lwc.server.PersistableAdapter; >import com.ptc.core.meta.common.TypeIdentifier; > >import ext.ikea.icomp.integration.MarshallPartData; >import ext.ikea.integration.CRCExtractionUtil; >import ext.ikea.integration.iba.IBAHelper; >import wt.change2.WTChangeOrder2; >import wt.configurablelink.ConfigurableDescribeLink; >import wt.content.ApplicationData; >import wt.content.ContentHelper; >import wt.content.ContentHolder; >import wt.content.ContentServerHelper; >import wt.doc.WTDocument; >import wt.epm.EPMDocument; >import wt.fc.ObjectReference; >import wt.fc.Persistable; >import wt.fc.PersistenceHelper; >import wt.fc.QueryResult; >import wt.fc.collections.WTCollection; >import wt.fc.collections.WTHashSet; >import wt.fc.collections.WTKeyedMap; >import wt.fv.FvFileDoesNotExist; >import wt.iba.definition.litedefinition.AttributeDefDefaultView; >import wt.iba.value.IBAHolder; >import wt.inf.sharing.SharedContainerMap; >import wt.part.PartDocHelper; >import wt.part.WTPart; >import wt.part.WTPartHelper; >import wt.projmgmt.admin.Project2; >import wt.query.QueryException; >import wt.query.QuerySpec; >import wt.query.SearchCondition; >import wt.session.SessionHelper; >import wt.type.ClientTypedUtility; >import wt.util.WTContext; >import wt.util.WTException; >import wt.vc.config.LatestConfigSpec; >import wt.viewmarkup.DerivedImage; > >public class SupplierReportUtil { > > private static Logger log = Logger.getLogger(SupplierReportUtil.class); > > private final Properties properties = new Properties(); > > private String materialPartInternalName; > > private String coatingPartInternalName; > > private String reportTemplatePath; > > private String agreedImplDateAtt; > > private String actualImplDate; > > private String specIdIntName; > > private String specTypIntName; > > private String tempReportPath; > > private String oldObjIdIntName; > > private HashMap<AttributeDefDefaultView, Object> all_softAttr = new HashMap<AttributeDefDefaultView, Object>(); > > private final SimpleDateFormat dateformatter = new SimpleDateFormat("dd-M-yyyy hh:mm:ss"); > > private final SimpleDateFormat simpledateformatter = new SimpleDateFormat("yyyy-MM-dd"); > > private InputStream inp; > > private int startingRowForEndItem = 11; > > public int getStartingRowForEndItem() { > > return startingRowForEndItem; > > } > > public void setStartingRowForEndItem(int startingRowForEndItem) { > > this.startingRowForEndItem = startingRowForEndItem; > > } > > private boolean isFirstRecord = false; > > private CellStyle style; > > private CellStyle endItemStyle; > > private CellStyle endItemSeperatorStyle; > > private CellStyle dottedSignSeperatorStyle; > > private Sheet sheet; > > private Workbook wb; > > private ArrayList<String> reportAttrList = null; > > private HashMap<String, Persistable> baselineObjects = new HashMap<>(); > > private WTPart callingPart = null; > > private String downloadPath = null; > > public SupplierReportUtil() { > > try { > > properties.load(WTContext.getContext().getResourceAsStream("icompProperty.properties")); > > materialPartInternalName = properties.getProperty("materialPartCheckType"); > > coatingPartInternalName = properties.getProperty("coatingPartCheckType"); > > agreedImplDateAtt = properties.getProperty("plannedImplDate"); > > actualImplDate = properties.getProperty("GDActualImplementationDate"); > > specIdIntName = properties.getProperty("specIDIntName"); > > specTypIntName = properties.getProperty("specTypIntName"); > > reportTemplatePath = properties.getProperty("templateReportPath"); > > tempReportPath = properties.getProperty("tempReportPath"); > > oldObjIdIntName = properties.getProperty("oldObjIdIntName"); > > SupplierReportAttributes suppReqAttObj = new SupplierReportAttributes(); > > reportAttrList = suppReqAttObj.getAllReportAttributes(); > > inp = new FileInputStream(reportTemplatePath); > > wb = WorkbookFactory.create(inp); > > style = wb.createCellStyle(); > > sheet = wb.getSheetAt(0); > > style.setWrapText(true); > > style.setVerticalAlignment(CellStyle.VERTICAL_TOP); > > endItemStyle = wb.createCellStyle(); > > endItemStyle.setWrapText(true); > > endItemSeperatorStyle = wb.createCellStyle(); > > endItemSeperatorStyle.setBorderBottom(CellStyle.BORDER_THICK); > > dottedSignSeperatorStyle = wb.createCellStyle(); > > dottedSignSeperatorStyle.setBorderBottom(CellStyle.BORDER_DOTTED); > > } catch (IOException e) { > > e.printStackTrace(); > > } catch (EncryptedDocumentException e) { > > e.printStackTrace(); > > } catch (InvalidFormatException e) { > > e.printStackTrace(); > > } > > } > > public void createReportHeaders(String projectName) throws EncryptedDocumentException, InvalidFormatException, IOException, WTException { > > Row header = sheet.getRow(0); > > Cell printDate = header.createCell(7); > > printDate.setCellStyle(style); > > Date today = new Date(System.currentTimeMillis()); > > printDate.setCellValue(simpledateformatter.format(today)); > > header = sheet.getRow(1); > > Cell printBy = header.createCell(7); > > printBy.setCellStyle(style); > > printBy.setCellValue(SessionHelper.manager.getPrincipal().getName()); > > header = sheet.getRow(2); > > Cell supplier = header.createCell(7); > > supplier.setCellStyle(style); > > supplier.setCellValue(projectName); > > } > > public void addAllConnectedPartsToReport(WTPart partObj, WTChangeOrder2 implObj) { > > try { > > QueryResult linkResult = WTPartHelper.service.getUsesWTParts(partObj, new LatestConfigSpec()); > > if (linkResult.hasMoreElements()) { > > for (int k = 0; k < linkResult.size(); k++) { > > Persistable[] persistables = (Persistable[]) linkResult.nextElement(); > > WTPart childPart = (WTPart) persistables[1]; > > if (!childPart.equals(callingPart)) { > > if (childPart.isEndItem()) > > addDetailsToReport(childPart, "EndItem", implObj); > > else > > addDetailsToReport(childPart, "", implObj); > > } > > addAllConnectedPartsToReport(childPart, implObj); > > } > > } > > } catch (WTException e) { > > e.printStackTrace(); > > } > > } > > public void addAllConnectedPartsToReport(WTPart partObj) { > > try { > > QueryResult linkResult = WTPartHelper.service.getUsesWTParts(partObj, new LatestConfigSpec()); > > if (linkResult.hasMoreElements()) { > > for (int k = 0; k < linkResult.size(); k++) { > > Persistable[] persistables = (Persistable[]) linkResult.nextElement(); > > WTPart childPart = (WTPart) persistables[1]; > > if (!childPart.equals(callingPart)) { > > if (childPart.isEndItem()) > > addDetailsToReport(childPart, "EndItem"); > > else > > addDetailsToReport(childPart, ""); > > } > > addAllConnectedPartsToReport(childPart); > > } > > } > > } catch (WTException e) { > > e.printStackTrace(); > > } > > } > > @SuppressWarnings({ "unchecked", "rawtypes" }) > protected ArrayList<EPMDocument> getAllConnectedCADDocument(WTPart partObj) { > > ArrayList<EPMDocument> connectedCADDocuments = new ArrayList<>(); > > WTCollection wtPartCollection = new WTHashSet(); > > wtPartCollection.add(partObj); > > try { > > WTKeyedMap associatedDocs = PartDocHelper.service.getAssociatedCADDocuments(wtPartCollection); > > Set<Entry> assDocMapEntrySet = associatedDocs.entrySet(); > > for (Entry entryObj : assDocMapEntrySet) { > > Object keyObj = entryObj.getKey(); > > Object valueObj = entryObj.getValue(); > > if (keyObj instanceof ObjectReference) { > > if (((ObjectReference) keyObj).getObject() instanceof WTPart) { > > WTPart keyPartObj = (WTPart) ((ObjectReference) keyObj).getObject(); > > if (keyPartObj.equals(partObj)) { > > if (valueObj instanceof WTHashSet) { > > WTHashSet hashSetCollection = (WTHashSet) valueObj; > > Iterator hashSetIterator = hashSetCollection.iterator(); > > while (hashSetIterator.hasNext()) { > > Object persDocObj = hashSetIterator.next(); > > if (persDocObj instanceof ObjectReference) { > > if (((ObjectReference) persDocObj).getObject() instanceof EPMDocument) { > > connectedCADDocuments.add((EPMDocument) ((ObjectReference) persDocObj).getObject()); > > } > > } > > } > > } > > } > > } > > } > > } > > } catch (WTException e) { > > e.printStackTrace(); > > } > > return connectedCADDocuments; > > } > > @SuppressWarnings({ "rawtypes", "unchecked" }) > protected ArrayList<WTDocument> getAllConnectedWTDocument(WTPart partObj) { > > ArrayList<WTDocument> connectedWTDocuments = new ArrayList<>(); > > WTCollection wtPartCollection = new WTHashSet(); > > wtPartCollection.add(partObj); > > try { > > WTKeyedMap associatedDocs = PartDocHelper.service.getAssociatedDescribeDocuments(wtPartCollection); > > Set<Entry> assDocMapEntrySet = associatedDocs.entrySet(); > > for (Entry entryObj : assDocMapEntrySet) { > > Object keyObj = entryObj.getKey(); > > Object valueObj = entryObj.getValue(); > > if (keyObj instanceof ObjectReference) { > > if (((ObjectReference) keyObj).getObject() instanceof WTPart) { > > WTPart keyPartObj = (WTPart) ((ObjectReference) keyObj).getObject(); > > if (keyPartObj.equals(partObj)) { > > if (valueObj instanceof WTHashSet) { > > WTHashSet hashSetCollection = (WTHashSet) valueObj; > > Iterator hashSetIterator = hashSetCollection.iterator(); > > while (hashSetIterator.hasNext()) { > > Object persDocObj = hashSetIterator.next(); > > if (persDocObj instanceof ObjectReference) { > > if (((ObjectReference) persDocObj).getObject() instanceof WTDocument) { > > connectedWTDocuments.add((WTDocument) ((ObjectReference) persDocObj).getObject()); > > } > > } > > } > > } > > } > > } > > } > > } > > } catch (WTException e) { > > e.printStackTrace(); > > } > > return connectedWTDocuments; > > } > > protected ArrayList<WTPart> getConnectedMaterials(WTPart ikeaPart) { > > ArrayList<WTPart> materialPartList = new ArrayList<>(); > > try { > > TypeIdentifier materialParttypeIdentifier = ClientTypedUtility.getTypeIdentifier(materialPartInternalName); > > QueryResult result = PersistenceHelper.manager.navigate(ikeaPart, ConfigurableDescribeLink.DESCRIBED_BY_ROLE, ConfigurableDescribeLink.class, false); > > while (result.hasMoreElements()) { > ConfigurableDescribeLink link = (ConfigurableDescribeLink) result.nextElement(); > > if (link.getRoleBObject() instanceof WTPart) { > > WTPart linkPart = (WTPart) link.getRoleBObject(); > > TypeIdentifier objPartType = ClientTypedUtility.getTypeIdentifier(linkPart); > > if (objPartType != null && objPartType.isDescendedFrom(materialParttypeIdentifier)) { > > materialPartList.add(linkPart); > > } > > } > } > > } catch (WTException e) { > e.printStackTrace(); > } > > return materialPartList; > > } > > protected ArrayList<WTPart> getConnectedCoating(WTPart ikeaPart) { > > ArrayList<WTPart> coatingPartList = new ArrayList<>(); > > try { > > TypeIdentifier coatingParttypeIdentifier = ClientTypedUtility.getTypeIdentifier(coatingPartInternalName); > > QueryResult result = PersistenceHelper.manager.navigate(ikeaPart, ConfigurableDescribeLink.DESCRIBED_BY_ROLE, ConfigurableDescribeLink.class, false); > > while (result.hasMoreElements()) { > ConfigurableDescribeLink link = (ConfigurableDescribeLink) result.nextElement(); > > if (link.getRoleBObject() instanceof WTPart) { > > WTPart linkPart = (WTPart) link.getRoleBObject(); > > TypeIdentifier objPartType = ClientTypedUtility.getTypeIdentifier(linkPart); > > if (objPartType != null && objPartType.isDescendedFrom(coatingParttypeIdentifier)) { > > coatingPartList.add(linkPart); > > } > > } > } > > } catch (WTException e) { > > e.printStackTrace(); > > } > > return coatingPartList; > > } > > @SuppressWarnings({ "rawtypes", "unchecked" }) > protected ArrayList<EPMDocument> relatedCadDocumentList(WTPart ikeaPartObj) { > > ArrayList<EPMDocument> connectedCADDocuments = new ArrayList<>(); > > WTCollection wtPartCollection = new WTHashSet(); > > wtPartCollection.add(ikeaPartObj); > > try { > > WTKeyedMap associatedCADDocs = PartDocHelper.service.getAssociatedCADDocuments(wtPartCollection); > > Set<Entry> assCADDocMapEntrySet = associatedCADDocs.entrySet(); > > for (Entry entryObj : assCADDocMapEntrySet) { > > Object keyObj = entryObj.getKey(); > > Object valueObj = entryObj.getValue(); > > if (keyObj instanceof ObjectReference) { > > if (((ObjectReference) keyObj).getObject() instanceof WTPart) { > > WTPart keyPartObj = (WTPart) ((ObjectReference) keyObj).getObject(); > > if (keyPartObj.equals(ikeaPartObj)) { > > if (valueObj instanceof WTHashSet) { > > WTHashSet hashSetCollection = (WTHashSet) valueObj; > > Iterator hashSetIterator = hashSetCollection.iterator(); > > while (hashSetIterator.hasNext()) { > > Object persDocObj = hashSetIterator.next(); > > if (persDocObj instanceof ObjectReference) { > > if (((ObjectReference) persDocObj).getObject() instanceof EPMDocument) { > > EPMDocument cadDoc = (EPMDocument) ((ObjectReference) persDocObj).getObject(); > > if (!cadDoc.getCADName().toLowerCase().endsWith("slddrw")) { > > if (!connectedCADDocuments.contains(cadDoc)) > > connectedCADDocuments.add(cadDoc); > > } > > } > > } > > } > > } > > } > > } > > } > > } > > } catch (WTException e) { > > e.printStackTrace(); > > } > > return connectedCADDocuments; > > } > > @SuppressWarnings({ "rawtypes", "unchecked" }) > protected ArrayList<EPMDocument> relatedCadDrawingList(WTPart ikeaPartObj) { > > ArrayList<EPMDocument> connectedCADDocuments = new ArrayList<>(); > > WTCollection wtPartCollection = new WTHashSet(); > > wtPartCollection.add(ikeaPartObj); > > try { > > WTKeyedMap associatedCADDocs = PartDocHelper.service.getAssociatedCADDocuments(wtPartCollection); > > Set<Entry> assCADDocMapEntrySet = associatedCADDocs.entrySet(); > > for (Entry entryObj : assCADDocMapEntrySet) { > > Object keyObj = entryObj.getKey(); > > Object valueObj = entryObj.getValue(); > > if (keyObj instanceof ObjectReference) { > > if (((ObjectReference) keyObj).getObject() instanceof WTPart) { > > WTPart keyPartObj = (WTPart) ((ObjectReference) keyObj).getObject(); > > if (keyPartObj.equals(ikeaPartObj)) { > > if (valueObj instanceof WTHashSet) { > > WTHashSet hashSetCollection = (WTHashSet) valueObj; > > Iterator hashSetIterator = hashSetCollection.iterator(); > > while (hashSetIterator.hasNext()) { > > Object persDocObj = hashSetIterator.next(); > > if (persDocObj instanceof ObjectReference) { > > if (((ObjectReference) persDocObj).getObject() instanceof EPMDocument) { > > EPMDocument cadDoc = (EPMDocument) ((ObjectReference) persDocObj).getObject(); > > if (cadDoc.getCADName().toLowerCase().endsWith("slddrw")) { > > if (!connectedCADDocuments.contains(cadDoc)) > > connectedCADDocuments.add(cadDoc); > > } > > } > > } > > } > > } > > } > > } > > } > > } > > } catch (WTException e) { > > e.printStackTrace(); > > } > > return connectedCADDocuments; > > } > > public void addDetailsToSimpleReport(WTPart partObj, String objType, WTChangeOrder2 implObj) { > > log.trace("In SupplierReportUtil : addDetailsToReport method, partObj : " + partObj.getDisplayIdentifier().toString() + " for IR : " + implObj.getDisplayIdentifier().toString()); > > if (partObj != null) { > > Row row = sheet.createRow(startingRowForEndItem++); > > Cell cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(partObj.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String ikeaPrtVersion = partObj.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()).replace("Design", "").replace("(", "").replace(")", ""); > > cell.setCellValue(ikeaPrtVersion); > > String oldObjIdAttVal = getAttributeValue(partObj, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > if (objType.equalsIgnoreCase("EndItem")) > > cell.setCellValue("EndItem"); > > else > > cell.setCellValue("SubPart"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(partObj.getName()); > > if (objType.equalsIgnoreCase("EndItem")) { > > Date ikeaPrtAgreedImplDate = getImplementationDateForImplReq(implObj, agreedImplDateAtt); > > if (ikeaPrtAgreedImplDate != null) { > > cell = row.createCell(6); > > cell.setCellValue(simpledateformatter.format(ikeaPrtAgreedImplDate)); > > } > > Date ikeaPlannedImplDate = getImplementationDateForImplReq(implObj, actualImplDate); > > if (ikeaPlannedImplDate != null) { > > cell = row.createCell(7); > > cell.setCellValue(simpledateformatter.format(ikeaPlannedImplDate)); > > } > > } > > } > > } > > @SuppressWarnings("rawtypes") > public void addDetailsToReport(WTPart partObj, String objType, WTChangeOrder2 implObj) throws WTException { > > log.trace("In SupplierReportUtil : addDetailsToReport method, partObj : " + partObj.getDisplayIdentifier().toString() + " for IR : " + implObj.getDisplayIdentifier().toString()); > partObj = (WTPart) getBaselineObjects().get(partObj.getNumber()); > > if (partObj != null) { > > Row row = sheet.createRow(startingRowForEndItem++); > > Cell cell = row.createCell(0); > > cell = row.createCell(0); > > if (partObj.isEndItem()) { > > XSSFFont boldFont = (XSSFFont) wb.createFont(); > > boldFont.setBold(true); > > endItemStyle.setFont(boldFont); > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > cell.setCellValue(partObj.getNumber()); > > cell = row.createCell(1); > > if (partObj.isEndItem()) { > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > String ikeaPrtVersion = partObj.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()).replace("Design", "").replace("(", "").replace(")", ""); > > cell.setCellValue(ikeaPrtVersion); > > String oldObjIdAttVal = getAttributeValue(partObj, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > if (partObj.isEndItem()) { > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > if (objType.equalsIgnoreCase("EndItem")) > > cell.setCellValue("EndItem"); > > else > > cell.setCellValue("SubPart"); > > cell = row.createCell(5); > > if (partObj.isEndItem()) { > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > cell.setCellValue(partObj.getName()); > > if (objType.equalsIgnoreCase("EndItem")) { > > Date ikeaPrtAgreedImplDate = getImplementationDateForImplReq(implObj, agreedImplDateAtt); > > if (ikeaPrtAgreedImplDate != null) { > > cell = row.createCell(6); > > if (partObj.isEndItem()) { > > XSSFFont boldFont = (XSSFFont) wb.createFont(); > > boldFont.setBold(true); > > endItemStyle.setFont(boldFont); > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > cell.setCellValue(simpledateformatter.format(ikeaPrtAgreedImplDate)); > > } > > Date ikeaPlannedImplDate = getImplementationDateForImplReq(implObj, actualImplDate); > > if (ikeaPlannedImplDate != null) { > > cell = row.createCell(7); > > if (partObj.isEndItem()) { > > XSSFFont boldFont = (XSSFFont) wb.createFont(); > > boldFont.setBold(true); > > endItemStyle.setFont(boldFont); > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > cell.setCellValue(simpledateformatter.format(ikeaPlannedImplDate)); > > } > > } > > log.trace("Added the Part number to report Before checking material " + partObj.getNumber()); > > log.trace("In SupplierReportUtil : addDetailsToReport method, Added the Part number to report Before checking material " + partObj.getNumber()); > > ArrayList<WTDocument> relatedDocumentList = getAllConnectedWTDocument(partObj); > > ArrayList<WTPart> materialPartList = getConnectedMaterials(partObj); > > ArrayList<WTPart> coatingPartList = getConnectedCoating(partObj); > > ArrayList<EPMDocument> relatedCADDocumentList = relatedCadDocumentList(partObj); > > ArrayList<EPMDocument> relatedCADDrawingList = relatedCadDrawingList(partObj); > > for (WTPart matPrt : materialPartList) { > > matPrt = (WTPart) getBaselineObjects().get(matPrt.getNumber()); > > if (matPrt != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(matPrt.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = matPrt.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()).replace("Design", "").replace("(", "").replace(")", ""); > > cell.setCellValue(version); > > // oldObjIdIntName > oldObjIdAttVal = getAttributeValue(matPrt, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("Material"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(matPrt.getName()); > > } > > } > > log.trace("Added the Part number to report Before checking coating " + partObj.getNumber()); > > for (WTPart colCoatPrt : coatingPartList) { > > colCoatPrt = (WTPart) getBaselineObjects().get(colCoatPrt.getNumber()); > > if (colCoatPrt != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(colCoatPrt.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = colCoatPrt.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()).replace("Design", "").replace("(", "").replace(")", ""); > > cell.setCellValue(version); > > // oldObjIdIntName > oldObjIdAttVal = getAttributeValue(colCoatPrt, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("Coating/Colour"); > > cell = row.createCell(5); > > String coatingName = colCoatPrt.getName(); > > String[] nameSplit = coatingName.split("\\|"); > > XSSFFont font1 = (XSSFFont) wb.createFont(); > > font1.setTypeOffset(Font.SS_NONE); > > XSSFFont font2 = (XSSFFont) wb.createFont(); > > font2.setTypeOffset(Font.SS_SUB); > > XSSFRichTextString rt = new XSSFRichTextString(); > > for (int i = 0; i < nameSplit.length; i++) { > > String splitName = nameSplit[i]; > > if (splitName.startsWith("v")) { > > rt.append(splitName.replace("v", ""), font2); > > } > > else { > > rt.append(splitName, font1); > > } > > } > > cell.setCellValue(rt); > > } > > } > > log.trace("Added the Part number to report Before checking CAD Objects " + partObj.getNumber()); > > for (EPMDocument cadObj : relatedCADDocumentList) { > > cadObj = (EPMDocument) getBaselineObjects().get(cadObj.getNumber()); > > if (cadObj != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(cadObj.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = cadObj.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()); > > cell.setCellValue(version); > > oldObjIdAttVal = getAttributeValue(cadObj, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("CAD Document"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(cadObj.getName()); > > try { > > // This will return primary & Secondary both > log.trace("In SupplierReportUtil : EPM block, calling getContentListAll...."); > ContentHolder contentHolder = ContentHelper.service.getContents(cadObj); > Vector appData = ContentHelper.getContentListAll(contentHolder); > > if (appData != null) { > log.trace("EPM block : appData from ContentHelper.getContentListAll is ---->" + appData.size()); > for (Object contObj : appData) { > > ApplicationData data = (ApplicationData) contObj; > > log.trace("Role Type->" + data.getRole().getDisplay()); > > if (!data.getRole().getDisplay().contains("Thumbnail")) { > > log.trace("EPM block, data.getDisplayIdentifier().toString() ---->" + data.getDisplayIdentifier().toString()); > log.trace("EPM block, new data ----> " + data.getFileName()); > > String downloadPath = getDownloadPath() + File.separator + cadObj.getCADName(); > log.trace("EPM block, appData downloadPath is -----> " + downloadPath + " Now calling write..."); > > ContentServerHelper.service.writeContentStream(data, downloadPath); > log.trace("EPM block, appdata writeContentStream DONE"); > > } > } > } else { > log.trace("In EPM block, appData is NULL...."); > } > > } catch (PropertyVetoException e) { > e.printStackTrace(); > } catch (IOException e) { > e.printStackTrace(); > } catch (FvFileDoesNotExist e) { > log.trace("In SupplierReportUtil : EPM FvFileDoesNotExist ,msg --->" + e.getMessage()); > e.printStackTrace(); > } catch (WTException e) { > log.trace("In SupplierReportUtil : EPM WTException ,msg --->" + e.getMessage()); > e.printStackTrace(); > } catch (Exception e) { > log.trace("In SupplierReportUtil : EPM Exception ,msg --->" + e.getMessage()); > e.printStackTrace(); > } > > } > > } > > log.trace("Added the Part number to report Before checking CAD Drawing " + partObj.getNumber()); > > for (EPMDocument cadDRWObj : relatedCADDrawingList) { > > cadDRWObj = (EPMDocument) getBaselineObjects().get(cadDRWObj.getNumber()); > > if (cadDRWObj != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(cadDRWObj.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = cadDRWObj.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()); > > cell.setCellValue(version); > > // oldObjIdIntName > oldObjIdAttVal = getAttributeValue(cadDRWObj, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("Drawing"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(cadDRWObj.getName()); > > try { > // This will return primary & Secondary both > log.trace("In SupplierReportUtil : EPM block, calling getContentListAll...."); > ContentHolder contentHolder = ContentHelper.service.getContents(cadDRWObj); > Vector appData = ContentHelper.getContentListAll(contentHolder); > > if (appData != null) { > log.trace("EPM block : appData from ContentHelper.getContentListAll is ---->" + appData.size()); > for (Object contObj : appData) { > > ApplicationData data = (ApplicationData) contObj; > > log.trace("Role Type->" + data.getRole().getDisplay()); > > if (!data.getRole().getDisplay().contains("Thumbnail")) { > > log.trace("EPM block, data.getDisplayIdentifier().toString() ---->" + data.getDisplayIdentifier().toString()); > log.trace("EPM block, new data ----> " + data.getFileName()); > String downloadPath = getDownloadPath() + File.separator + cadDRWObj.getCADName(); > log.trace("EPM block, appData downloadPath is -----> " + downloadPath + " Now calling write..."); > ContentServerHelper.service.writeContentStream(data, downloadPath); > log.trace("EPM block, appdata writeContentStream DONE"); > > } > > } > > } else { > > log.trace("In EPM block, appData is NULL...."); > > } > DerivedImage representation = CRCExtractionUtil.getRepresentation(cadDRWObj); > > if (representation != null) { > > ContentHolder pdmlinkRepHolder = ContentHelper.service.getContents((ContentHolder) representation); > > Vector reps = pdmlinkRepHolder.getContentVector(); > > for (int i = 0; i < reps.size(); i++) { > > ApplicationData primarydata = (ApplicationData) reps.get(i); > > String filename = primarydata.getFileName(); > > try { > if (filename.endsWith(".pdf")) { > > String downloadPath = getDownloadPath() + File.separator + cadDRWObj.getCADName().substring(0, cadDRWObj.getCADName().lastIndexOf(".")) + "-" + cadDRWObj.getVersionIdentifier().getValue() + ".pdf"; > > ContentServerHelper.service.writeContentStream(primarydata, downloadPath); > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > } > > } catch (PropertyVetoException e) { > e.printStackTrace(); > } catch (IOException e) { > e.printStackTrace(); > } catch (FvFileDoesNotExist e) { > log.trace("In SupplierReportUtil : CADDRW FvFileDoesNotExist ,msg --->" + e.getMessage()); > e.printStackTrace(); > } catch (WTException e) { > log.trace("In SupplierReportUtil : CADDRW WTException ,msg --->" + e.getMessage()); > e.printStackTrace(); > } catch (Exception e) { > log.trace("In SupplierReportUtil : CADDRW Exception ,msg --->" + e.getMessage()); > e.printStackTrace(); > } > > } > > } > > log.trace("Added the Part number to report Before checking WTDocument " + partObj.getNumber()); > > for (WTDocument wtDocument : relatedDocumentList) { > > wtDocument = (WTDocument) getBaselineObjects().get(wtDocument.getNumber()); > > if (wtDocument != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(wtDocument.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = wtDocument.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()); > > cell.setCellValue(version); > > TypeIdentifier objDocType = ClientTypedUtility.getTypeIdentifier(wtDocument); > > TypeIdentifier specificationtypeIdentifier = ClientTypedUtility.getTypeIdentifier(specTypIntName); > > if (objDocType != null && objDocType.isDescendedFrom(specificationtypeIdentifier)) { > > cell = row.createCell(2); > > cell.setCellValue(getAttributeValue(wtDocument, specIdIntName)); > > } > > // oldObjIdIntName > oldObjIdAttVal = getAttributeValue(wtDocument, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("Document"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(wtDocument.getName()); > > try { > // This will return primary & Secondary both > log.trace("In SupplierReportUtil : wtDocument block, calling getContentListAll for wtDocument : " + wtDocument.getDisplayIdentifier().toString()); > ContentHolder contentHolder = ContentHelper.service.getContents(wtDocument); > Vector appData = ContentHelper.getContentListAll(contentHolder); > if (appData != null) { > log.trace("wtDocument block : appData from ContentHelper.getContentListAll is ---->" + appData.size()); > for (Object contObj : appData) { > > ApplicationData data = (ApplicationData) contObj; > > log.trace("Role Type->" + data.getRole().getDisplay()); > > if (!data.getRole().getDisplay().contains("Thumbnail")) { > > log.trace("wtDocument block, new data data.getFileName() ----> " + data.getFileName() + " \n now calling ContentServerHelper.service.writeContentStream.."); > String downloadPath = getDownloadPath() + File.separator + data.getFileName(); > if (data.getFileName().toLowerCase().endsWith(".pdf")) { > downloadPath = downloadPath.substring(0, downloadPath.length() - 4) + ".pdf"; > } > log.trace("wtDocument block : appData, downloadPath is -----> " + downloadPath + " Now calling write..."); > ContentServerHelper.service.writeContentStream(data, downloadPath); > log.trace("wtDocument block : appData write DONE!!"); > > } > } > } else { > log.trace("In wtDocument block, appData is NULL...."); > } > DerivedImage representation = CRCExtractionUtil.getRepresentation(wtDocument); > > if (representation != null) { > > ContentHolder pdmlinkRepHolder = ContentHelper.service.getContents((ContentHolder) representation); > > Vector reps = pdmlinkRepHolder.getContentVector(); > > for (int i = 0; i < reps.size(); i++) { > > ApplicationData primarydata = (ApplicationData) reps.get(i); > > String filename = primarydata.getFileName(); > > try { > if (filename.endsWith(".pdf")) { > > String downloadPath = getDownloadPath() + File.separator + wtDocument.getName() + "-" + wtDocument.getVersionIdentifier().getValue() + ".pdf"; > > ContentServerHelper.service.writeContentStream(primarydata, downloadPath); > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > } > > } catch (PropertyVetoException e) { > > e.printStackTrace(); > > } catch (IOException e) { > > e.printStackTrace(); > > } catch (FvFileDoesNotExist e) { > log.trace("In SupplierReportUtil : wtDocument FvFileDoesNotExist ,msg --->" + e.getMessage()); > e.printStackTrace(); > } catch (WTException e) { > log.trace("In SupplierReportUtil : wtDocument WTException ,msg --->" + e.getMessage()); > e.printStackTrace(); > } catch (Exception e) { > log.trace("In SupplierReportUtil : wtDocument Exception ,msg --->" + e.getMessage()); > e.printStackTrace(); > } > > } > > } > > log.trace("Added the Part number to report Before adding report attributes " + partObj.getNumber()); > > if (reportAttrList != null) { > > int mergeStartRow = startingRowForEndItem++; > > int count = 0; > > int mergeEndRow = 0; > > for (String attrName : reportAttrList) { > > CellStyle wrapText = wb.createCellStyle(); > > wrapText.setWrapText(true); > > wrapText.setVerticalAlignment(CellStyle.VERTICAL_TOP); > > all_softAttr = MarshallPartData.getAllSoftAttributesWithDisplayName(partObj); > > Set<Entry<AttributeDefDefaultView, Object>> allSftAttrEntrySet = all_softAttr.entrySet(); > > for (Entry<AttributeDefDefaultView, Object> attrDefEntry : allSftAttrEntrySet) { > > AttributeDefDefaultView attrDef = attrDefEntry.getKey(); > > Object value = attrDefEntry.getValue(); > > if (attrDef.getName().equalsIgnoreCase(attrName)) { > > if (count == 0) { > > row = sheet.createRow(mergeStartRow); > > count++; > > } > > else { > > mergeEndRow = startingRowForEndItem++; > > row = sheet.createRow(mergeEndRow); > > } > > cell = row.createCell(4); > > cell.setCellValue(attrDef.getLocalizedDisplayString()); > > cell.setCellStyle(wrapText); > > cell = row.createCell(5); > > cell.setCellValue(value.toString()); > > cell.setCellStyle(wrapText); > > break; > > } > > } > > } > > try { > > if (mergeEndRow != mergeStartRow && mergeEndRow > mergeStartRow) { > > CellRangeAddress rangeAdd = new CellRangeAddress(mergeStartRow, mergeEndRow, 0, 3); > > sheet.addMergedRegion(rangeAdd); > > rangeAdd = new CellRangeAddress(mergeStartRow, mergeEndRow, 6, 7); > > sheet.addMergedRegion(rangeAdd); > > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > } > > } > > @SuppressWarnings("rawtypes") > public void addDetailsToReport(WTPart partObj, String objType) throws WTException { > > partObj = (WTPart) getBaselineObjects().get(partObj.getNumber()); > > if (partObj != null) { > > Row row = sheet.createRow(startingRowForEndItem++); > > Cell cell = row.createCell(0); > > cell = row.createCell(0); > > if (partObj.isEndItem()) { > > XSSFFont boldFont = (XSSFFont) wb.createFont(); > > boldFont.setBold(true); > > endItemStyle.setFont(boldFont); > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > cell.setCellValue(partObj.getNumber()); > > cell = row.createCell(1); > > if (partObj.isEndItem()) { > > XSSFFont boldFont = (XSSFFont) wb.createFont(); > > boldFont.setBold(true); > > endItemStyle.setFont(boldFont); > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > String ikeaPrtVersion = partObj.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()).replace("Design", "").replace("(", "").replace(")", ""); > > cell.setCellValue(ikeaPrtVersion); > > String oldObjIdAttVal = getAttributeValue(partObj, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(2); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > if (partObj.isEndItem()) { > > XSSFFont boldFont = (XSSFFont) wb.createFont(); > > boldFont.setBold(true); > > endItemStyle.setFont(boldFont); > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > if (objType.equalsIgnoreCase("EndItem")) { > > cell.setCellValue("EndItem"); > > } else { > > cell.setCellValue("SubPart"); > > } > > cell = row.createCell(5); > > if (partObj.isEndItem()) { > > XSSFFont boldFont = (XSSFFont) wb.createFont(); > > boldFont.setBold(true); > > endItemStyle.setFont(boldFont); > > cell.setCellStyle(endItemStyle); > > } else { > > cell.setCellStyle(style); > > } > > cell.setCellValue(partObj.getName()); > > log.trace("Added the Part number to report Before checking material " + partObj.getNumber()); > > log.trace("In SupplierReportUtil : addDetailsToReport method, Added the Part number to report Before checking material " + partObj.getNumber()); > > ArrayList<WTDocument> relatedDocumentList = getAllConnectedWTDocument(partObj); > > ArrayList<WTPart> materialPartList = getConnectedMaterials(partObj); > > ArrayList<WTPart> coatingPartList = getConnectedCoating(partObj); > > ArrayList<EPMDocument> relatedCADDocumentList = relatedCadDocumentList(partObj); > > ArrayList<EPMDocument> relatedCADDrawingList = relatedCadDrawingList(partObj); > > for (WTPart matPrt : materialPartList) { > > matPrt = (WTPart) getBaselineObjects().get(matPrt.getNumber()); > > if (matPrt != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(matPrt.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = matPrt.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()).replace("Design", "").replace("(", "").replace(")", ""); > > cell.setCellValue(version); > > // oldObjIdIntName > oldObjIdAttVal = getAttributeValue(matPrt, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("Material"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(matPrt.getName()); > > } > > } > > log.trace("Added the Part number to report Before checking coating " + partObj.getNumber()); > > for (WTPart colCoatPrt : coatingPartList) { > > colCoatPrt = (WTPart) getBaselineObjects().get(colCoatPrt.getNumber()); > > if (colCoatPrt != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(colCoatPrt.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = colCoatPrt.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()).replace("Design", "").replace("(", "").replace(")", ""); > > cell.setCellValue(version); > > // oldObjIdIntName > oldObjIdAttVal = getAttributeValue(colCoatPrt, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("Coating/Colour"); > > cell = row.createCell(5); > > String coatingName = colCoatPrt.getName(); > > String[] nameSplit = coatingName.split("\\|"); > > XSSFFont font1 = (XSSFFont) wb.createFont(); > > font1.setTypeOffset(Font.SS_NONE); > > XSSFFont font2 = (XSSFFont) wb.createFont(); > > font2.setTypeOffset(Font.SS_SUB); > > XSSFRichTextString rt = new XSSFRichTextString(); > > for (int i = 0; i < nameSplit.length; i++) { > > String splitName = nameSplit[i]; > > if (splitName.startsWith("v")) { > > rt.append(splitName.replace("v", ""), font2); > > } > > else { > > rt.append(splitName, font1); > > } > > } > > cell.setCellValue(rt); > > } > > } > > log.trace("Added the Part number to report Before checking CAD Objects " + partObj.getNumber()); > > for (EPMDocument cadObj : relatedCADDocumentList) { > > cadObj = (EPMDocument) getBaselineObjects().get(cadObj.getNumber()); > > if (cadObj != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(cadObj.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = cadObj.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()); > > cell.setCellValue(version); > > oldObjIdAttVal = getAttributeValue(cadObj, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("CAD Document"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(cadObj.getName()); > > try { > > // This will return primary & Secondary both > > log.trace("In SupplierReportUtil : EPM block, calling getContentListAll...."); > > ContentHolder contentHolder = ContentHelper.service.getContents(cadObj); > > Vector appData = ContentHelper.getContentListAll(contentHolder); > > if (appData != null) { > > log.trace("EPM block : appData from ContentHelper.getContentListAll is ---->" + appData.size()); > > for (Object contObj : appData) { > > ApplicationData data = (ApplicationData) contObj; > > log.trace("Role Type->" + data.getRole().getDisplay()); > > if (!data.getRole().getDisplay().contains("Thumbnail")) { > > log.trace("EPM block, data.getDisplayIdentifier().toString() ---->" + data.getDisplayIdentifier().toString()); > > log.trace("EPM block, new data ----> " + data.getFileName()); > > String downloadPath = getDownloadPath() + File.separator + cadObj.getCADName(); > > log.trace("EPM block, appData downloadPath is -----> " + downloadPath + " Now calling write..."); > > ContentServerHelper.service.writeContentStream(data, downloadPath); > > log.trace("EPM block, appdata writeContentStream DONE"); > > } > > } > > } else { > > log.trace("In EPM block, appData is NULL...."); > > } > > } catch (PropertyVetoException e) { > > e.printStackTrace(); > > } catch (IOException e) { > > e.printStackTrace(); > > } catch (FvFileDoesNotExist e) { > > log.error("In SupplierReportUtil : EPM FvFileDoesNotExist ,msg --->" + e.getMessage()); > > e.printStackTrace(); > > } catch (WTException e) { > > log.error("In SupplierReportUtil : EPM WTException ,msg --->" + e.getMessage()); > > e.printStackTrace(); > > } catch (Exception e) { > > log.error("In SupplierReportUtil : EPM Exception ,msg --->" + e.getMessage()); > > e.printStackTrace(); > > } > > } > > } > > log.trace("Added the Part number to report Before checking CAD Drawing " + partObj.getNumber()); > > for (EPMDocument cadDRWObj : relatedCADDrawingList) { > > cadDRWObj = (EPMDocument) getBaselineObjects().get(cadDRWObj.getNumber()); > > if (cadDRWObj != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(cadDRWObj.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = cadDRWObj.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()); > > cell.setCellValue(version); > > // oldObjIdIntName > oldObjIdAttVal = getAttributeValue(cadDRWObj, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("Drawing"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(cadDRWObj.getName()); > > try { > > // This will return primary & Secondary both > > log.trace("In SupplierReportUtil : EPM block, calling getContentListAll...."); > > ContentHolder contentHolder = ContentHelper.service.getContents(cadDRWObj); > > Vector appData = ContentHelper.getContentListAll(contentHolder); > > if (appData != null) { > > log.trace("EPM block : appData from ContentHelper.getContentListAll is ---->" + appData.size()); > > for (Object contObj : appData) { > > ApplicationData data = (ApplicationData) contObj; > > log.trace("Role Type->" + data.getRole().getDisplay()); > > if (!data.getRole().getDisplay().contains("Thumbnail")) { > > log.trace("EPM block, data.getDisplayIdentifier().toString() ---->" + data.getDisplayIdentifier().toString()); > > log.trace("EPM block, new data ----> " + data.getFileName()); > > String downloadPath = getDownloadPath() + File.separator + cadDRWObj.getCADName(); > > log.trace("EPM block, appData downloadPath is -----> " + downloadPath + " Now calling write..."); > > ContentServerHelper.service.writeContentStream(data, downloadPath); > > log.trace("EPM block, appdata writeContentStream DONE"); > > } > > } > > } else { > > log.trace("In EPM block, appData is NULL...."); > > } > > DerivedImage representation = CRCExtractionUtil.getRepresentation(cadDRWObj); > > if (representation != null) { > > ContentHolder pdmlinkRepHolder = ContentHelper.service.getContents((ContentHolder) representation); > > Vector reps = pdmlinkRepHolder.getContentVector(); > > for (int i = 0; i < reps.size(); i++) { > > ApplicationData primarydata = (ApplicationData) reps.get(i); > > String filename = primarydata.getFileName(); > > try { > if (filename.endsWith(".pdf")) { > > String downloadPath = getDownloadPath() + File.separator + cadDRWObj.getCADName().substring(0, cadDRWObj.getCADName().lastIndexOf(".")) + "-" + cadDRWObj.getVersionIdentifier().getValue() + ".pdf"; > > ContentServerHelper.service.writeContentStream(primarydata, downloadPath); > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > } > > } catch (PropertyVetoException e) { > > e.printStackTrace(); > > } catch (IOException e) { > > e.printStackTrace(); > > } catch (FvFileDoesNotExist e) { > > log.trace("In SupplierReportUtil : CADDRW FvFileDoesNotExist ,msg --->" + e.getMessage()); > > e.printStackTrace(); > > } catch (WTException e) { > > log.trace("In SupplierReportUtil : CADDRW WTException ,msg --->" + e.getMessage()); > > e.printStackTrace(); > > } catch (Exception e) { > > log.trace("In SupplierReportUtil : CADDRW Exception ,msg --->" + e.getMessage()); > > e.printStackTrace(); > } > > } > > } > > log.trace("Added the Part number to report Before checking WTDocument " + partObj.getNumber()); > > for (WTDocument wtDocument : relatedDocumentList) { > > wtDocument = (WTDocument) getBaselineObjects().get(wtDocument.getNumber()); > > if (wtDocument != null) { > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue(wtDocument.getNumber()); > > cell = row.createCell(1); > > cell.setCellStyle(style); > > String version = wtDocument.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault()); > > cell.setCellValue(version); > > TypeIdentifier objDocType = ClientTypedUtility.getTypeIdentifier(wtDocument); > > TypeIdentifier specificationtypeIdentifier = ClientTypedUtility.getTypeIdentifier(specTypIntName); > > if (objDocType != null && objDocType.isDescendedFrom(specificationtypeIdentifier)) { > > cell = row.createCell(2); > > cell.setCellValue(getAttributeValue(wtDocument, specIdIntName)); > > } > > // oldObjIdIntName > oldObjIdAttVal = getAttributeValue(wtDocument, oldObjIdIntName); > > if (oldObjIdAttVal != null) { > > cell = row.createCell(3); > > cell.setCellValue(oldObjIdAttVal); > > } > > cell = row.createCell(4); > > cell.setCellStyle(style); > > cell.setCellValue("Document"); > > cell = row.createCell(5); > > cell.setCellStyle(style); > > cell.setCellValue(wtDocument.getName()); > > try { > > // This will return primary & Secondary both > log.trace("In SupplierReportUtil : wtDocument block, calling getContentListAll for wtDocument : " + wtDocument.getDisplayIdentifier().toString()); > > ContentHolder contentHolder = ContentHelper.service.getContents(wtDocument); > > Vector appData = ContentHelper.getContentListAll(contentHolder); > > if (appData != null) { > > log.trace("wtDocument block : appData from ContentHelper.getContentListAll is ---->" + appData.size()); > > for (Object contObj : appData) { > > ApplicationData data = (ApplicationData) contObj; > > log.trace("Role Type->" + data.getRole().getDisplay()); > > if (!data.getRole().getDisplay().contains("Thumbnail")) { > > log.trace("wtDocument block, new data data.getFileName() ----> " + data.getFileName() + " \n now calling ContentServerHelper.service.writeContentStream.."); > > String downloadPath = getDownloadPath() + File.separator + data.getFileName(); > > log.trace("wtDocument block : appData, downloadPath is -----> " + downloadPath + " Now calling write..."); > if (data.getFileName().toLowerCase().endsWith(".pdf")) { > downloadPath = downloadPath.substring(0, downloadPath.length() - 4) + ".pdf"; > } > ContentServerHelper.service.writeContentStream(data, downloadPath); > > log.trace("wtDocument block : appData write DONE!!"); > > } > > } > > } else { > > log.trace("In wtDocument block, appData is NULL...."); > > } > > DerivedImage representation = CRCExtractionUtil.getRepresentation(wtDocument); > > if (representation != null) { > > ContentHolder pdmlinkRepHolder = ContentHelper.service.getContents((ContentHolder) representation); > > Vector reps = pdmlinkRepHolder.getContentVector(); > > for (int i = 0; i < reps.size(); i++) { > > ApplicationData primarydata = (ApplicationData) reps.get(i); > > String filename = primarydata.getFileName(); > > try { > if (filename.toLowerCase().endsWith(".pdf")) { > > String downloadPath = getDownloadPath() + File.separator + wtDocument.getName() + "-" + wtDocument.getVersionIdentifier().getValue() + ".pdf"; > > ContentServerHelper.service.writeContentStream(primarydata, downloadPath); > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > } > > } catch (PropertyVetoException e) { > > e.printStackTrace(); > > } catch (IOException e) { > > e.printStackTrace(); > > } catch (FvFileDoesNotExist e) { > log.trace("In SupplierReportUtil : wtDocument FvFileDoesNotExist ,msg --->" + e.getMessage()); > e.printStackTrace(); > } catch (WTException e) { > log.trace("In SupplierReportUtil : wtDocument WTException ,msg --->" + e.getMessage()); > e.printStackTrace(); > } catch (Exception e) { > log.trace("In SupplierReportUtil : wtDocument Exception ,msg --->" + e.getMessage()); > e.printStackTrace(); > } > > } > > } > > log.trace("Added the Part number to report Before adding report attributes " + partObj.getNumber()); > > if (reportAttrList != null) { > > int mergeStartRow = 0; > > int count = 0; > > int mergeEndRow = 0; > > for (String attrName : reportAttrList) { > > CellStyle wrapText = wb.createCellStyle(); > > wrapText.setWrapText(true); > > wrapText.setVerticalAlignment(CellStyle.VERTICAL_TOP); > > all_softAttr = MarshallPartData.getAllSoftAttributesWithDisplayName(partObj); > > Set<Entry<AttributeDefDefaultView, Object>> allSftAttrEntrySet = all_softAttr.entrySet(); > > for (Entry<AttributeDefDefaultView, Object> attrDefEntry : allSftAttrEntrySet) { > > AttributeDefDefaultView attrDef = attrDefEntry.getKey(); > > Object value = attrDefEntry.getValue(); > > if (attrDef.getName().equalsIgnoreCase(attrName)) { > > if (count == 0) { > > mergeStartRow = startingRowForEndItem++; > > row = sheet.createRow(mergeStartRow); > > count++; > > } > > else { > > mergeEndRow = startingRowForEndItem++; > > row = sheet.createRow(mergeEndRow); > > } > > cell = row.createCell(4); > > cell.setCellValue(attrDef.getLocalizedDisplayString()); > > cell.setCellStyle(wrapText); > > cell = row.createCell(5); > > cell.setCellValue(value.toString()); > > cell.setCellStyle(wrapText); > > break; > > } > > } > > } > > try { > > if (mergeEndRow != mergeStartRow && mergeEndRow > mergeStartRow) { > > CellRangeAddress rangeAdd = new CellRangeAddress(mergeStartRow, mergeEndRow, 0, 3); > > sheet.addMergedRegion(rangeAdd); > > rangeAdd = new CellRangeAddress(mergeStartRow, mergeEndRow, 6, 7); > > sheet.addMergedRegion(rangeAdd); > > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > > } > > } > > } > > private static String getAttributeValue(Persistable implObj, String attrName) { > > String ibaVal = null; > > try { > PersistableAdapter persAdap = new com.ptc.core.lwc.server.PersistableAdapter(implObj, null, java.util.Locale.getDefault(), new com.ptc.core.meta.common.UpdateOperationIdentifier()); > > persAdap.load(attrName); > > Object attrVal = persAdap.get(attrName); > > if (attrVal instanceof Timestamp) { > > Timestamp tsVal = (Timestamp) attrVal; > > ibaVal = tsVal.toString(); > > } else { > > ibaVal = (String) persAdap.get(attrName); > > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > try { > > if (ibaVal == null) { > > ibaVal = (String) IBAHelper.service.getIBAValue((IBAHolder) implObj, attrName); > > } > > } catch (Exception e) { > > e.printStackTrace(); > > } > > return ibaVal; > > } > > public static ArrayList<WTChangeOrder2> getAllChangeNoticesShareToproject(Project2 prjObj) { > > ArrayList<WTChangeOrder2> sharedChangeOrderObjList = new ArrayList<WTChangeOrder2>(); > > QuerySpec cnQuery; > > try { > > cnQuery = new QuerySpec(SharedContainerMap.class); > > cnQuery.appendWhere(new SearchCondition(SharedContainerMap.class, "targetContainerRef.key.id", SearchCondition.EQUAL, prjObj.getPersistInfo().getObjectIdentifier().getId()), new int[] { 0, 1 }); > > QueryResult cnQueryResult = PersistenceHelper.manager.find(cnQuery); > > log.debug("Before Querying"); > > while (cnQueryResult.hasMoreElements()) { > > SharedContainerMap shrcontmap = (SharedContainerMap) cnQueryResult.nextElement(); > > if (shrcontmap.getShared() instanceof wt.change2.WTChangeOrder2) { > > WTChangeOrder2 changeOrderObj = (WTChangeOrder2) shrcontmap.getSharedVersionRef().getObject(); > > sharedChangeOrderObjList.add(changeOrderObj); > > log.debug("IR Number: " + changeOrderObj.getNumber()); > > } > > } > > } catch (QueryException e) { > > e.printStackTrace(); > > } catch (WTException e) { > > e.printStackTrace(); > > } > > return sharedChangeOrderObjList; > > } > > public static ArrayList<WTPart> getIKEAPartShareToproject(Project2 prjObj, String partNumber) { > > ArrayList<WTPart> listOfSharedVersions = new ArrayList<WTPart>(); > > QuerySpec cnQuery; > > try { > > cnQuery = new QuerySpec(SharedContainerMap.class); > > cnQuery.appendWhere(new SearchCondition(SharedContainerMap.class, "targetContainerRef.key.id", SearchCondition.EQUAL, prjObj.getPersistInfo().getObjectIdentifier().getId()), new int[] { 0, 1 }); > > QueryResult cnQueryResult = PersistenceHelper.manager.find(cnQuery); > > log.debug("Before Querying"); > > while (cnQueryResult.hasMoreElements()) { > > SharedContainerMap shrcontmap = (SharedContainerMap) cnQueryResult.nextElement(); > > log.debug(shrcontmap.getSharedVersionRef().getObject()); > > if (shrcontmap.getSharedVersionRef().getObject() instanceof WTPart) { > > WTPart ikeaPartObj = (WTPart) shrcontmap.getSharedVersionRef().getObject(); > > if (ikeaPartObj.getNumber().equals(partNumber)) { > > log.trace(ikeaPartObj.getIterationDisplayIdentifier().getLocalizedMessage(Locale.getDefault())); > > if (!listOfSharedVersions.contains(ikeaPartObj)) { > > listOfSharedVersions.add(ikeaPartObj); > > } > > } > > } > > } > > } catch (QueryException e) { > > e.printStackTrace(); > > } catch (WTException e) { > > e.printStackTrace(); > > } > > return listOfSharedVersions; > > } > > private Timestamp getImplementationDateForImplReq(WTChangeOrder2 implObj, String attName) { > > Timestamp agreedImplDate = null; > > try { > PersistableAdapter persAdap = new PersistableAdapter(implObj, null, java.util.Locale.getDefault(), new com.ptc.core.meta.common.UpdateOperationIdentifier()); > > persAdap.load(attName); > > agreedImplDate = (Timestamp) persAdap.get(attName); > > } catch (Exception e) { > > e.printStackTrace(); > > } > > return agreedImplDate; > > } > > public void finalizeReport(Project2 projectObj) throws Exception { > > log.trace("In SupplierReportUtil : projectObj passed :: " + projectObj.getName()); > > style = wb.createCellStyle(); > > XSSFFont font = (XSSFFont) wb.createFont(); > > font.setBold(true); > > style.setFont(font); > > Row row = sheet.createRow(startingRowForEndItem++); > > Cell cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue("Supplier"); > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellValue("Date/Name/Signature"); > > createDottedLineForSignature(); > > sheet.autoSizeColumn(0); > > sheet.autoSizeColumn(1); > > sheet.autoSizeColumn(2); > > sheet.autoSizeColumn(3); > > sheet.autoSizeColumn(4); > > sheet.setColumnWidth(5, 25000); > > sheet.autoSizeColumn(6); > > sheet.autoSizeColumn(7); > > sheet.autoSizeColumn(8); > > sheet.getPrintSetup().setLandscape(true); > > sheet.getPrintSetup().setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); > > sheet.setFitToPage(true); > > PrintSetup ps = sheet.getPrintSetup(); > > ps.setFitWidth((short) 1); > > ps.setFitHeight((short) 0); > > File addUserFolder = new File(tempReportPath + SessionHelper.manager.getPrincipal().getName() + "-" + projectObj.getName()); > log.trace("In SupplierReportUtil : addUserFolder :: " + addUserFolder); > if (!addUserFolder.exists()) > addUserFolder.mkdir(); > > FileOutputStream outputStream = new FileOutputStream(tempReportPath + SessionHelper.manager.getPrincipal().getName() + "-" + projectObj.getName() + File.separator + projectObj.getProjectNumber() + ".xlsx"); > > wb.write(outputStream); > > wb.close(); > > if (outputStream != null) { > > outputStream.close(); > > } > } > > public void finalizeSimpleReport(Project2 projectObj) throws Exception { > > log.trace("In SupplierReportUtil : projectObj passed :: " + projectObj.getName()); > > style = wb.createCellStyle(); > > XSSFFont font = (XSSFFont) wb.createFont(); > > font.setBold(true); > > style.setFont(font); > > Row row = sheet.createRow(startingRowForEndItem++); > > Cell cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue("Supplier"); > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellValue("Date/Name/Signature"); > > createDottedLineForSignature(); > > sheet.autoSizeColumn(0); > > sheet.autoSizeColumn(1); > > sheet.autoSizeColumn(2); > > sheet.autoSizeColumn(3); > > sheet.autoSizeColumn(4); > > sheet.autoSizeColumn(5); > > sheet.autoSizeColumn(6); > > sheet.autoSizeColumn(7); > > sheet.getPrintSetup().setLandscape(true); > > sheet.getPrintSetup().setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); > > sheet.setFitToPage(true); > > PrintSetup ps = sheet.getPrintSetup(); > > ps.setFitWidth((short) 1); > > ps.setFitHeight((short) 0); > > FileOutputStream outputStream = new FileOutputStream(getDownloadPath() + projectObj.getProjectNumber() + ".xlsx"); > > wb.write(outputStream); > > wb.close(); > > if (outputStream != null) { > > outputStream.close(); > > } > } > > public boolean isFirstRecord() { > return isFirstRecord; > } > > public void setFirstRecord(boolean isFirstRecord) { > this.isFirstRecord = isFirstRecord; > } > > public HashMap<String, Persistable> getBaselineObjects() { > return baselineObjects; > } > > public void setBaselineObjects(HashMap<String, Persistable> baselineObjects) { > this.baselineObjects = baselineObjects; > } > > public WTPart getCallingPart() { > return callingPart; > } > > public void setCallingPart(WTPart callingPart) { > this.callingPart = callingPart; > } > > public String getDownloadPath() { > > File fileObj = new File(downloadPath); > > if (!fileObj.exists()) { > > fileObj.mkdirs(); > > } > > return downloadPath; > } > > public void setDownloadPath(String downloadPath) { > this.downloadPath = downloadPath; > } > > public void finalizeReport(String containerName) throws Exception { > > log.trace("In SupplierReportUtil : projectObj passed :: " + containerName); > > style = wb.createCellStyle(); > > XSSFFont font = (XSSFFont) wb.createFont(); > > font.setBold(true); > > style.setFont(font); > > Row row = sheet.createRow(startingRowForEndItem++); > > Cell cell = row.createCell(0); > > cell.setCellStyle(style); > > cell.setCellValue("Supplier"); > > row = sheet.createRow(startingRowForEndItem++); > > cell = row.createCell(0); > > cell.setCellValue("Date/Name/Signature"); > > createDottedLineForSignature(); > > sheet.autoSizeColumn(0); > > sheet.autoSizeColumn(1); > > sheet.autoSizeColumn(2); > > sheet.autoSizeColumn(3); > > // sheet.autoSizeColumn(4); > > sheet.autoSizeColumn(4); > > sheet.setColumnWidth(5, 25000); > > sheet.autoSizeColumn(6); > > sheet.autoSizeColumn(7); > > sheet.getPrintSetup().setLandscape(true); > > sheet.getPrintSetup().setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); > > sheet.setFitToPage(true); > > PrintSetup ps = sheet.getPrintSetup(); > > ps.setFitWidth((short) 1); > > ps.setFitHeight((short) 0); > > File addUserFolder = new File(tempReportPath + SessionHelper.manager.getPrincipal().getName() + "-" + containerName); > > log.trace("In SupplierReportUtil : addUserFolder :: " + addUserFolder); > > if (!addUserFolder.exists()) > addUserFolder.mkdir(); > > FileOutputStream outputStream = new FileOutputStream(tempReportPath + SessionHelper.manager.getPrincipal().getName() + "-" + containerName + File.separator + containerName + ".xlsx"); > > wb.write(outputStream); > > wb.close(); > > if (outputStream != null) { > > outputStream.close(); > > } > > } > > public static Project2 getCSIProject(String GDSupplierID) { > > Project2 supplierProj = null; > > try { > QuerySpec spec = new QuerySpec(Project2.class); > SearchCondition sc = new SearchCondition(Project2.class, Project2.NAME, SearchCondition.EQUAL, GDSupplierID.toString()); > spec.appendWhere(sc, new int[] { 0, 1 }); > QueryResult projresult = PersistenceHelper.manager.find(spec); > > while (projresult.hasMoreElements()) { > supplierProj = (Project2) projresult.nextElement(); > log.debug("supplierProj" + supplierProj); > } > } catch (Exception e) { > e.printStackTrace(); > } > return supplierProj; > } > > public void createLineForEndItem() { > > // endItemSeperatorStyle > > Row row = sheet.createRow(startingRowForEndItem - 1); > > Cell cell = row.createCell(0); > > cell.setCellStyle(endItemSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(1); > > cell.setCellStyle(endItemSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(2); > > cell.setCellStyle(endItemSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(3); > > cell.setCellStyle(endItemSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(4); > > cell.setCellStyle(endItemSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(5); > > cell.setCellStyle(endItemSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(6); > > cell.setCellStyle(endItemSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(7); > > cell.setCellStyle(endItemSeperatorStyle); > > cell.setCellValue(""); > > } > > public void createDottedLineForSignature() { > > // endItemSeperatorStyle > > Row row = sheet.createRow(++startingRowForEndItem); > > Cell cell = row.createCell(0); > > cell.setCellStyle(dottedSignSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(1); > > cell.setCellStyle(dottedSignSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(2); > > cell.setCellStyle(dottedSignSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(3); > > cell.setCellStyle(dottedSignSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(4); > > cell.setCellStyle(dottedSignSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(5); > > cell.setCellStyle(dottedSignSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(6); > > cell.setCellStyle(dottedSignSeperatorStyle); > > cell.setCellValue(""); > > cell = row.createCell(7); > > cell.setCellStyle(dottedSignSeperatorStyle); > > cell.setCellValue(""); > > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 62101
: 35729