Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
[GF#32966] Unable to Export XML from CART. [KLO, 091013]
Browse files Browse the repository at this point in the history
  • Loading branch information
kimong committed Sep 10, 2013
1 parent a80fb4f commit b4c9914
Showing 1 changed file with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
import org.LexGrid.LexBIG.DataModel.Core.ConceptReference;
import org.LexGrid.LexBIG.DataModel.Core.CodingSchemeVersionOrTag;
import org.LexGrid.LexBIG.Utility.Iterators.ResolvedConceptReferencesIterator;
import org.lexgrid.valuesets.impl.LexEVSValueSetDefinitionServicesImpl;

import gov.nih.nci.evs.browser.utils.*;


/**
* <!-- LICENSE_TEXT_START -->
* Copyright 2008,2009 NGIT. This software was developed in conjunction
Expand Down Expand Up @@ -451,6 +453,7 @@ public String unselectAllInCart() {
return null;
}


/**
* Export cart in XML format
* @return
Expand All @@ -477,6 +480,8 @@ public String exportCartXML() throws Exception {
return null;
}

LexEVSValueSetDefinitionServices vsd_service = null;

// Get Entities to be exported and build export XML string
// in memory

Expand All @@ -486,8 +491,7 @@ public String exportCartXML() throws Exception {
versionList = getSchemeVersionList(search);

// Setup lexbig service
LexEVSValueSetDefinitionServices vsd_service = RemoteServerUtil
.getLexEVSValueSetDefinitionServices();
vsd_service = RemoteServerUtil.getLexEVSValueSetDefinitionServices();

//instantiate the mappings
Mappings maps = new Mappings();
Expand Down Expand Up @@ -573,6 +577,7 @@ public String exportCartXML() throws Exception {
}
}

/*
// Add list of coding schemes version reference
AbsoluteCodingSchemeVersionReferenceList csvList = new AbsoluteCodingSchemeVersionReferenceList();
HashSet uri_hset = new HashSet();
Expand All @@ -589,16 +594,21 @@ public String exportCartXML() throws Exception {
}
}
}

*/
// Build a buffer holding the XML data

StringBuffer buf = null;
InputStream reader = null;

try {
reader = vsd_service.exportValueSetResolution(vsd, null,
csvList, null, false);
HashMap<String, ValueSetDefinition> referencedVSDs = null;
String csVersionTag = null;
boolean failOnAllErrors = false;

//public InputStream exportValueSetResolution(ValueSetDefinition valueSetDefinition, HashMap<String, ValueSetDefinition> referencedVSDs, AbsoluteCodingSchemeVersionReferenceList csVersionList, String csVersionTag, boolean failOnAllErrors)
/*
try {
//reader = vsd_service.exportValueSetResolution(vsd, null, csvList, null, false);
reader = vsd_service.exportValueSetResolution(vsd, referencedVSDs, csvList, csVersionTag, failOnAllErrors);
if (reader != null) {
buf = new StringBuffer();
for (int c = reader.read(); c != -1; c = reader.read()) {
Expand All @@ -608,6 +618,7 @@ public String exportCartXML() throws Exception {
buf = new StringBuffer("<error>exportValueSetResolution returned null.</error>");
}
} catch (Exception e) {
e.printStackTrace();
buf = new StringBuffer("<error>The VSD export service is not supported by your current LexEVS setup.</error>");
buf.append("<!-- " + e.getMessage() + " -->");
} finally {
Expand All @@ -617,6 +628,22 @@ public String exportCartXML() throws Exception {
new StringBuffer("<error>" + e.getMessage() + "</error>");
}
}
*/

// [GF#32966] Unable to Export XML from CART
try {
buf = vsd_service.exportValueSetDefinition(vsd);

} catch (Exception e) {
buf = new StringBuffer("<error>The VSD export service is not supported by your current LexEVS setup.</error>");
buf.append("<!-- " + e.getMessage() + " -->");
} finally {
try {
//reader.close();
} catch (Exception e) {
new StringBuffer("<error>" + e.getMessage() + "</error>");
}
}

// Send export XML string to browser

Expand Down Expand Up @@ -1298,7 +1325,7 @@ public String exportCartCSV() throws Exception {
public void formatListener(ActionEvent evt) {
FacesContext ctx = FacesContext.getCurrentInstance();
String format = (String) ctx.getExternalContext().getRequestParameterMap().get("format");
System.out.println("formatListener format: " + format);
//System.out.println("formatListener format: " + format);
}

} // End of CartActionBean

0 comments on commit b4c9914

Please sign in to comment.