Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 60393 Details for
Bug 166098
CSV Log Report: extendedDataElements' values are missing, creationTime is the same for all events
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to fix the extendedPr4operties and the multi-line problems
patch.txt (text/plain), 6.24 KB, created by
Rohit Shetty
on 2007-03-07 14:32:32 EST
(
hide
)
Description:
Patch to fix the extendedPr4operties and the multi-line problems
Filename:
MIME Type:
Creator:
Rohit Shetty
Created:
2007-03-07 14:32:32 EST
Size:
6.24 KB
patch
obsolete
>Index: cbe/org/eclipse/tptp/monitoring/log/provisional/export/CSVExportHandler.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.la.core/cbe/org/eclipse/tptp/monitoring/log/provisional/export/CSVExportHandler.java,v >retrieving revision 1.3 >diff -u -r1.3 CSVExportHandler.java >--- cbe/org/eclipse/tptp/monitoring/log/provisional/export/CSVExportHandler.java 1 Mar 2007 17:13:29 -0000 1.3 >+++ cbe/org/eclipse/tptp/monitoring/log/provisional/export/CSVExportHandler.java 7 Mar 2007 19:19:47 -0000 >@@ -15,6 +15,8 @@ > import java.io.IOException; > import java.io.OutputStreamWriter; > import java.io.Writer; >+import java.util.ArrayList; >+import java.util.HashMap; > import java.util.Hashtable; > import java.util.Iterator; > import java.util.List; >@@ -89,13 +91,34 @@ > .append(",").append("sourceComponentId_location").append(",").append("sourceComponentId_locationType") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ > .append(",").append("sourceComponentId_processId").append(",").append("sourceComponentId_subComponent") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ > .append(",").append("sourceComponentId_threadId") //$NON-NLS-1$ //$NON-NLS-2$ >- .append(",").append("situation_categoryName").append(",").append("situation_reasoningScope") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >- .append(",").append("extendedProperties_name") //$NON-NLS-1$ //$NON-NLS-2$ >- .append(newLine); >+ .append(",").append("situation_categoryName").append(",").append("situation_reasoningScope"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ // ExtendedDataElements will be appended dynamically later on >+ //.append(",").append("extendedProperties_name") //$NON-NLS-1$ //$NON-NLS-2$ >+ //.append(newLine); > > // Write out the CBEs > if (events!=null) { > >+ ArrayList edeNames = new ArrayList(); >+ for (int idx=0; idx<events.size(); idx++) >+ { >+ Object event = events.get(idx); >+ if (event instanceof CBECommonBaseEvent) { >+ CBECommonBaseEvent cbe = (CBECommonBaseEvent)event; >+ //prepare a list of extended properties to help create the report structure >+ //Bugzilla 166098 >+ listExtendedDataElements(cbe.getExtendedProperties(),null,edeNames); >+ } >+ } >+ >+ for(Iterator ite = edeNames.iterator();ite.hasNext();) >+ { >+ buffer.append(",").append("extendedProperties-" + ite.next());//$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ buffer.append(newLine); >+ >+ > for (int idx=0; idx<events.size(); idx++) > { > Object event = events.get(idx); >@@ -146,20 +169,19 @@ > buffer.append(",").append(","); //$NON-NLS-1$ //$NON-NLS-2$ > } > >- //extended properties >- Iterator iterator = cbe.getExtendedProperties().iterator(); >- while(iterator.hasNext()) >- { >- Object obj = iterator.next(); >- if(obj != null && obj instanceof CBEDefaultElement) >- { >- CBEDefaultElement ev = (CBEDefaultElement)obj; >- buffer.append(",").append(getCSVFormat(ev.getName())); //$NON-NLS-1$ >- } >+ HashMap edeMap = new HashMap(); >+ //For each event retrieve the complete list of extended properties >+ //Bugzilla 166098 >+ retrieveExtendedDataElements(cbe.getExtendedProperties(),null,edeMap); >+ >+ // Append the extended properties information to the report based on >+ // the format/order required in the report. refer Bugzilla 166098 >+ for(Iterator ite = edeNames.iterator();ite.hasNext();) >+ { >+ buffer.append(",").append(edeMap.get(ite.next())); //$NON-NLS-1$ //$NON-NLS-2$ > } > >- buffer.append(newLine); >- >+ buffer.append(newLine); > } > } > } >@@ -173,12 +195,82 @@ > } > } > >+ /* >+ * This method is used to create a list of the extended properties >+ * available in the list of events supplied to the report generator. >+ * Bugzilla 166098 >+ */ >+ private void listExtendedDataElements(List edes,String parent,ArrayList edeNames) >+ { >+ for(Iterator iterator = edes.iterator();iterator.hasNext();) >+ { >+ Object obj = iterator.next(); >+ if(obj != null && obj instanceof CBEDefaultElement) >+ { >+ CBEDefaultElement ev = (CBEDefaultElement)obj; >+ >+ String edeName = parent == null?ev.getName():parent + "." + ev.getName();//$NON-NLS-1$ //$NON-NLS-2$ >+ >+ if(!ev.getValues().isEmpty()) >+ { >+ if(!edeNames.contains(edeName)) >+ { >+ edeNames.add(edeName); >+ } >+ } >+ >+ if(ev.getChildren() != null) >+ { >+ listExtendedDataElements(ev.getChildren(),edeName,edeNames); >+ } >+ } >+ } >+ } >+ >+ /* >+ * retrieve all extendedDataElements for an event and store them in the HashMap so that it can be used >+ * later on to display based on the order in which it needs to be displayed >+ * Bugzilla 166098 >+ */ >+ private void retrieveExtendedDataElements(List edes,String parent,HashMap edeMap) >+ { >+ for(Iterator iterator = edes.iterator();iterator.hasNext();) >+ { >+ Object obj = iterator.next(); >+ if(obj != null && obj instanceof CBEDefaultElement) >+ { >+ CBEDefaultElement ev = (CBEDefaultElement)obj; >+ >+ String edeName = parent == null?ev.getName():parent + "." + ev.getName();//$NON-NLS-1$ //$NON-NLS-2$ >+ >+ if(!ev.getValues().isEmpty()) >+ { >+ edeMap.put(edeName, getCSVFormat(getListStringRepresentation(ev.getValues()))); >+ } >+ >+ if(ev.getChildren() != null) >+ { >+ retrieveExtendedDataElements(ev.getChildren(),edeName,edeMap); >+ } >+ } >+ } >+ } >+ >+ private String getListStringRepresentation(List lst) >+ { >+ if(lst.size()==1) >+ { >+ return lst.get(0).toString(); >+ } >+ return lst.toString(); >+ } >+ > private String getCSVFormat(String text) > { > if(text == null) > return text; >- >- if(text.indexOf(",") == -1 && text.indexOf("\"") == -1) //$NON-NLS-1$ //$NON-NLS-2$ >+ // '\n' and '\r' need to be added here to display multi-line records correctly >+ if(text.indexOf(",") == -1 && text.indexOf("\"") == -1 && text.indexOf('\n') == -1 && text.indexOf('\r') == -1) //$NON-NLS-1$ //$NON-NLS-2$ > return text; > > text = text.replaceAll("\"", "\"\""); //$NON-NLS-1$ //$NON-NLS-2$
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 166098
: 60393 |
60395