Changeset 16264
- Timestamp:
- 18/07/08 16:58:44 (1 month ago)
- Files:
-
- tickets/ticket-1673/bio/network/webapp/src/org/intermine/bio/web/ProteinInteractionExporter.java (modified) (5 diffs)
- tickets/ticket-1673/bio/tutorial/malariamine/webapp/resources/struts-config-form-model.xml (added)
- tickets/ticket-1673/bio/tutorial/malariamine/webapp/resources/struts-config-model.xml (modified) (1 diff)
- tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/export/GFF3HttpExporter.java (modified) (5 diffs)
- tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/export/SequenceExporter.java (modified) (2 diffs)
- tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/export/SequenceHttpExporter.java (modified) (7 diffs)
- tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/struts/SequenceExportAction.java (modified) (1 diff)
- tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/struts/SequenceExportForm.java (added)
- tickets/ticket-1673/flymine/webapp/build.xml (modified) (1 diff)
- tickets/ticket-1673/flymine/webapp/resources/struts-config-form-model.xml (added)
- tickets/ticket-1673/flymine/webapp/resources/struts-config-model.xml (modified) (2 diffs)
- tickets/ticket-1673/flymine/webapp/resources/webapp/WEB-INF/webconfig-model.xml (modified) (1 diff)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/config/TableExportConfig.java (modified) (5 diffs)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/config/WebConfig.java (modified) (1 diff)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/ExportHelper.java (modified) (3 diffs)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/ExporterImpl.java (modified) (1 diff)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/http/ExcelHttpExporter.java (modified) (4 diffs)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/http/HttpExporterBase.java (modified) (3 diffs)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/http/TableHttpExporter.java (modified) (3 diffs)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/struts/ExportController.java (modified) (5 diffs)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/struts/ExportOptionsController.java (added)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/struts/TableController.java (modified) (2 diffs)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/struts/TableExportAction.java (modified) (11 diffs)
- tickets/ticket-1673/intermine/web/main/src/org/intermine/web/struts/TableExportForm.java (added)
- tickets/ticket-1673/intermine/web/test/src/org/intermine/web/logic/config/WebConfigTest.java (modified) (1 diff)
- tickets/ticket-1673/intermine/webapp/main/resources/webapp/WEB-INF/classes/InterMineWebApp.properties (modified) (2 diffs)
- tickets/ticket-1673/intermine/webapp/main/resources/webapp/WEB-INF/struts-config.xml (modified) (4 diffs)
- tickets/ticket-1673/intermine/webapp/main/resources/webapp/WEB-INF/tiles-defs.xml (modified) (2 diffs)
- tickets/ticket-1673/intermine/webapp/main/resources/webapp/export.jsp (modified) (2 diffs)
- tickets/ticket-1673/intermine/webapp/main/resources/webapp/exportOptions.jsp (added)
- tickets/ticket-1673/modmine/webapp/resources/struts-config-form-model.xml (added)
- tickets/ticket-1673/modmine/webapp/resources/struts-config-model.xml (modified) (1 diff)
- tickets/ticket-1673/stemcellmine/webapp/resources/struts-config-form-model.xml (added)
- tickets/ticket-1673/testmodel/webapp/main/src/org/intermine/model/testmodel/web/EmployeeExporter.java (modified) (4 diffs)
- tickets/ticket-1673/unimine/webapp/resources/struts-config-form-model.xml (added)
- tickets/ticket-1673/unimine/webapp/resources/struts-config-model.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tickets/ticket-1673/bio/network/webapp/src/org/intermine/bio/web/ProteinInteractionExporter.java
r15326 r16264 19 19 * @author Richard Smith 20 20 */ 21 import java. io.PrintWriter;21 import java.util.ArrayList; 22 22 import java.util.Collection; 23 23 import java.util.Collections; … … 26 26 import java.util.Set; 27 27 28 import javax.servlet.http.HttpServletRequest;29 import javax.servlet.http.HttpServletResponse;30 31 import org.flymine.model.genomic.ProteinInteraction;32 28 import org.intermine.bio.networkview.FlyNetworkCreator; 33 29 import org.intermine.bio.networkview.network.FlyNetwork; 34 30 import org.intermine.model.InterMineObject; 35 31 import org.intermine.objectstore.ObjectStoreException; 32 import org.intermine.path.Path; 36 33 import org.intermine.util.StringUtil; 37 34 import org.intermine.web.logic.export.ExportException; … … 42 39 import org.intermine.web.logic.results.ResultElement; 43 40 import org.intermine.web.logic.results.WebTable; 41 import org.intermine.web.struts.TableExportForm; 42 43 import org.flymine.model.genomic.ProteinInteraction; 44 45 import java.io.PrintWriter; 46 47 import javax.servlet.http.HttpServletRequest; 48 import javax.servlet.http.HttpServletResponse; 44 49 45 50 /** … … 60 65 * @param response The HTTP response we are creating 61 66 */ 62 public void export(PagedTable pt, HttpServletRequest request, HttpServletResponse response) { 67 public void export(PagedTable pt, HttpServletRequest request, HttpServletResponse response, 68 TableExportForm form) { 63 69 64 70 response.setContentType("text/plain"); … … 128 134 129 135 /** 136 * For ProteinInteractionExporter we always return an empty list because all columns and classes are 137 * equal for this exporter. 138 * {@inheritDoc} 139 */ 140 public List<Path> getExportClassPaths(@SuppressWarnings("unused") PagedTable pt) { 141 return new ArrayList<Path>(); 142 } 143 144 /** 145 * The intial export path list is just the paths from the columns of the PagedTable. 146 * {@inheritDoc} 147 */ 148 public List<Path> getInitialExportPaths(PagedTable pt) { 149 return ExportHelper.getColumnPaths(pt); 150 } 151 152 /** 130 153 * {@inheritDoc} 131 154 * @param pt the PagedTable containing the results tickets/ticket-1673/bio/tutorial/malariamine/webapp/resources/struts-config-model.xml
r13670 r16264 1 1 <!-- this comment is here to prevent ant from setting model.struts.config to null --> 2 2 3 <!-- used by the fasta... buttons on object details pages --> 3 4 <action path="/sequenceExporter" 4 5 type="org.intermine.bio.web.export.SequenceExporter"/> tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/export/GFF3HttpExporter.java
r16254 r16264 11 11 */ 12 12 13 import java.io.InputStream; 14 import java.io.PrintWriter; 13 import java.util.ArrayList; 15 14 import java.util.List; 16 15 import java.util.Map; 17 16 import java.util.Properties; 18 17 19 import javax.servlet.ServletContext; 20 import javax.servlet.ServletException; 21 import javax.servlet.http.HttpServletRequest; 22 import javax.servlet.http.HttpServletResponse; 23 import javax.servlet.http.HttpSession; 24 25 import org.flymine.model.genomic.LocatedSequenceFeature; 18 import org.intermine.path.Path; 26 19 import org.intermine.util.StringUtil; 27 20 import org.intermine.web.logic.export.ExportException; … … 32 25 import org.intermine.web.logic.export.http.TableHttpExporter; 33 26 import org.intermine.web.logic.results.PagedTable; 27 import org.intermine.web.struts.TableExportForm; 28 29 import org.flymine.model.genomic.LocatedSequenceFeature; 30 31 import java.io.InputStream; 32 import java.io.PrintWriter; 33 34 import javax.servlet.ServletContext; 35 import javax.servlet.ServletException; 36 import javax.servlet.http.HttpServletRequest; 37 import javax.servlet.http.HttpServletResponse; 38 import javax.servlet.http.HttpSession; 34 39 35 40 /** … … 51 56 * there is exactly one LocatedSequenceFeature column and the other columns (if any), are simple 52 57 * attributes (rather than objects). 53 * @param pt PagedTable 54 * @param request The HTTP request we are processing 55 * @param response The HTTP response we are creating 58 * {@inheritDoc} 56 59 */ 57 public void export(PagedTable pt, HttpServletRequest request, 58 HttpServletResponse response) {60 public void export(PagedTable pt, HttpServletRequest request, HttpServletResponse response, 61 TableExportForm form) { 59 62 HttpSession session = request.getSession(); 60 63 ServletContext servletContext = session.getServletContext(); … … 82 85 private void setGFF3Header(HttpServletResponse response) { 83 86 ResponseUtil.setPlainTextHeader(response, "table" + StringUtil.uniqueString() + ".gff3"); 87 } 88 89 /** 90 * The intial export path list is just the paths from the columns of the PagedTable. 91 * {@inheritDoc} 92 */ 93 public List<Path> getInitialExportPaths(PagedTable pt) { 94 return ExportHelper.getColumnPaths(pt); 84 95 } 85 96 … … 116 127 return GFF3Exporter.canExportStatic(ExportHelper.getColumnClasses(pt)); 117 128 } 129 130 /** 131 * {@inheritDoc} 132 */ 133 public List<Path> getExportClassPaths(@SuppressWarnings("unused") PagedTable pt) { 134 return new ArrayList<Path>(); 135 } 118 136 } tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/export/SequenceExporter.java
r16254 r16264 20 20 import org.intermine.model.InterMineObject; 21 21 import org.intermine.objectstore.ObjectStore; 22 import org.intermine.path.Path; 22 23 import org.intermine.util.IntPresentSet; 23 24 import org.intermine.util.TypeUtil; … … 26 27 import org.intermine.web.logic.export.Exporter; 27 28 import org.intermine.web.logic.results.Column; 29 import org.intermine.web.logic.results.PagedTable; 28 30 import org.intermine.web.logic.results.ResultElement; 29 31 tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/export/SequenceHttpExporter.java
r16254 r16264 11 11 */ 12 12 13 import java.io.IOException; 14 import java.io.OutputStream; 13 import java.util.ArrayList; 15 14 import java.util.List; 16 15 17 import javax.servlet.http.HttpServletRequest; 18 import javax.servlet.http.HttpServletResponse; 19 import javax.servlet.http.HttpSession; 20 21 import org.flymine.model.genomic.LocatedSequenceFeature; 22 import org.flymine.model.genomic.Protein; 23 import org.flymine.model.genomic.Sequence; 24 import org.flymine.model.genomic.Translation; 16 import org.intermine.metadata.Model; 25 17 import org.intermine.objectstore.ObjectStore; 18 import org.intermine.path.Path; 26 19 import org.intermine.util.StringUtil; 27 20 import org.intermine.web.logic.Constants; … … 31 24 import org.intermine.web.logic.export.http.TableHttpExporter; 32 25 import org.intermine.web.logic.results.PagedTable; 26 import org.intermine.web.struts.TableExportForm; 27 28 import org.flymine.model.genomic.LocatedSequenceFeature; 29 import org.flymine.model.genomic.Protein; 30 import org.flymine.model.genomic.Sequence; 31 import org.flymine.model.genomic.Translation; 32 33 import java.io.IOException; 34 import java.io.OutputStream; 35 36 import javax.servlet.ServletContext; 37 import javax.servlet.http.HttpServletRequest; 38 import javax.servlet.http.HttpServletResponse; 39 import javax.servlet.http.HttpSession; 33 40 34 41 /** … … 40 47 public class SequenceHttpExporter implements TableHttpExporter 41 48 { 42 43 49 /** 44 50 * Set response proper header. … … 55 61 * @param response The HTTP response we are creating 56 62 */ 57 public void export(PagedTable pt, HttpServletRequest request, 58 HttpServletResponse response) {63 public void export(PagedTable pt, HttpServletRequest request, HttpServletResponse response, 64 TableExportForm form) { 59 65 60 66 HttpSession session = request.getSession(); 61 ObjectStore os =62 (ObjectStore) session.getServletContext().getAttribute(Constants.OBJECTSTORE);67 ServletContext servletContext = session.getServletContext(); 68 ObjectStore os = (ObjectStore) servletContext.getAttribute(Constants.OBJECTSTORE); 63 69 setSequenceExportHeader(response); 64 70 … … 73 79 int realFeatureIndex = getFeatureColumnIndex(pt); 74 80 75 SequenceExporter exporter = new SequenceExporter(os, outputStream, 76 realFeatureIndex); 81 SequenceExporter exporter = new SequenceExporter(os, outputStream, realFeatureIndex); 77 82 78 83 exporter.export(pt.getRearrangedResults(), pt.getColumns()); … … 82 87 } 83 88 89 /** 90 * The intial export path list is just the paths from the columns of the PagedTable with 91 * chromosomeLocation added (if appropriate) 92 * {@inheritDoc} 93 */ 94 public List<Path> getInitialExportPaths(PagedTable pt) { 95 List<Path> paths = new ArrayList<Path>(ExportHelper.getColumnPaths(pt)); 84 96 97 // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx 98 99 // XXX TODO FIXME 100 101 // the Path we need is the parent of one of the paths in the columns 102 paths.add(new Path(Model.getInstanceByName("genomic"), "Gene.chromosomeLocation")); 103 return paths; 104 } 105 106 /** 107 * Return the first column that contains Sequence objects or features that have a sequence 108 * reference. 109 */ 85 110 private int getFeatureColumnIndex(PagedTable pt) { 86 111 List<Class> clazzes = ExportHelper.getColumnClasses(pt); … … 102 127 return SequenceExporter.canExportStatic(ExportHelper.getColumnClasses(pt)); 103 128 } 129 130 /** 131 * {@inheritDoc} 132 */ 133 public List<Path> getExportClassPaths(@SuppressWarnings("unused") PagedTable pt) { 134 return new ArrayList<Path>(); 135 } 104 136 } tickets/ticket-1673/bio/webapp/src/org/intermine/bio/web/struts/SequenceExportAction.java
r15759 r16264 103 103 } 104 104 Annotation annotation = bioSequence.getAnnotation(); 105 // try hard to find an identifier 105 106 String identifier = bioEntity.getPrimaryIdentifier(); 106 107 if (identifier == null) { 107 identifier = bioEntity.get Name();108 identifier = bioEntity.getSecondaryIdentifier(); 108 109 if (identifier == null) { 109 if (bioEntity instanceof Gene) { 110 Gene gene = ((Gene) bioEntity); 111 identifier = gene.getPrimaryIdentifier(); 110 identifier = bioEntity.getName(); 111 if (identifier == null) { 112 try { 113 identifier = (String) TypeUtil.getFieldValue(bioEntity, "primaryAccession"); 114 } catch (RuntimeException e) { 115 // ignore 116 } 112 117 if (identifier == null) { 113 try { 114 identifier = (String) TypeUtil.getFieldValue(gene, "accession"); 115 } catch (RuntimeException e) { 116 // ignore 117 } 118 if (identifier == null) { 119 identifier = "[no_identifier]"; 120 } 118 identifier = "[no_identifier]"; 121 119 } 122 120 } tickets/ticket-1673/flymine/webapp/build.xml
r14486 r16264 32 32 </replace> 33 33 34 <loadfile property="model.struts.form.config" 35 srcFile="./resources/struts-config-form-model.xml"/> 36 37 <replace file="${build.dir}/webapp/WEB-INF/struts-config.xml" 38 value="${model.struts.form.config}"> 39 <!-- can't use normal token as xml must be parseable before this replacement --> 40 <replacetoken><![CDATA[<!--@MODEL_FORM_INCLUDE@-->]]></replacetoken> 41 </replace> 42 34 43 <loadfile property="model.tiles.defs" srcFile="./resources/tiles-defs-model.xml"/> 35 44 tickets/ticket-1673/flymine/webapp/resources/struts-config-model.xml
r16060 r16264 1 1 <!-- this comment is here to prevent ant from setting model.struts.config to null --> 2 2 3 <!-- used by the fasta... buttons on object details pages --> 3 4 <action path="/sequenceExporter" 4 type="org.intermine.bio.web.struts.SequenceExportAction"/>5 type="org.intermine.bio.web.struts.SequenceExportAction" /> 5 6 6 7 <action path="/chartRenderer" … … 22 23 type="org.intermine.bio.web.AttributeLinkDisplayerController"/> 23 24 25 <action path="/sequenceExportAction" name="tabExportForm" 26 type="org.intermine.web.struts.TableExportAction" parameter="method"/> 27 28 <action path="/gff3ExportAction" name="gff3ExportForm" 29 type="org.intermine.web.struts.TableExportAction" parameter="method"/> tickets/ticket-1673/flymine/webapp/resources/webapp/WEB-INF/webconfig-model.xml
r16253 r16264 759 759 </class> 760 760 761 <tableExportConfig id="sequence Exporter" actionPath="/exportAction?type=sequenceExporter"761 <tableExportConfig id="sequence" 762 762 className="org.intermine.bio.web.export.SequenceHttpExporter"/> 763 <tableExportConfig id="gff3 Exporter" actionPath="/exportAction?type=gff3Exporter"763 <tableExportConfig id="gff3" 764 764 className="org.intermine.bio.web.export.GFF3HttpExporter"/> 765 <tableExportConfig id="proteinInteraction Exporter" actionPath="/exportAction?type=proteinInteractionExporter"765 <tableExportConfig id="proteinInteraction" 766 766 className="org.intermine.bio.web.ProteinInteractionExporter"/> 767 767 tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/config/TableExportConfig.java
r14641 r16264 19 19 public class TableExportConfig 20 20 { 21 String id, actionPath,className;21 String id, className; 22 22 23 23 /** … … 38 38 39 39 /** 40 * Get the actionPath 41 * @return the actionPath 42 */ 43 public String getActionPath() { 44 return actionPath; 45 } 46 47 /** 48 * Set the actionPath of this TableExportConfig 49 * @param actionPath the new actionPath 50 */ 51 public void setActionPath(String actionPath) { 52 this.actionPath = actionPath; 53 } 54 55 /** 56 * Get the className 40 * Get the class name of the exporter eg. org.intermine.bio.web.export.SequenceHttpExporter 57 41 * @return the className 58 42 */ … … 78 62 if (obj instanceof TableExportConfig) { 79 63 TableExportConfig exporterObj = (TableExportConfig) obj; 80 return exporterObj.id.equals(id) && exporterObj.actionPath.equals(actionPath)64 return exporterObj.id.equals(id) 81 65 && exporterObj.className.equals(className); 82 66 } else { … … 91 75 */ 92 76 public int hashCode() { 93 return id.hashCode() * 5 + actionPath.hashCode() +3 * className.hashCode();77 return id.hashCode() * 5 + 3 * className.hashCode(); 94 78 } 95 79 … … 98 82 */ 99 83 public String toString() { 100 return "<tableExportConfig id=\"" + id + "\" actionPath=\"" + actionPath84 return "<tableExportConfig id=\"" + id 101 85 + "\" className=\"" + className + "\"/>"; 102 86 } tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/config/WebConfig.java
r16259 r16264 121 121 digester.addObjectCreate("webconfig/tableExportConfig", TableExportConfig.class); 122 122 digester.addSetProperties("webconfig/tableExportConfig", "id", "id"); 123 digester.addSetProperties("webconfig/tableExportConfig", "actionPath", "actionPath");124 123 digester.addSetProperties("webconfig/tableExportConfig", "className", "className"); 125 124 tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/ExportHelper.java
r15326 r16264 13 13 import java.util.List; 14 14 15 import org.intermine.path.Path; 15 16 import org.intermine.web.logic.results.Column; 16 17 import org.intermine.web.logic.results.PagedTable; … … 48 49 return -1; 49 50 } 50 51 51 52 /** 52 53 * @param clazzes classes … … 93 94 return getClassIndex(getColumnClasses(pt), cls); 94 95 } 95 96 97 /** 98 * Return a List containing the Path objects from the Columns of this PagedTable. 99 * @param pt the paged table 100 * @return the Paths 101 */ 102 public static List<Path> getColumnPaths(PagedTable pt) { 103 List<Path> paths = new ArrayList<Path>(); 104 for (Column col: pt.getColumns()) { 105 paths.add(col.getPath()); 106 } 107 return paths; 108 } 109 96 110 } tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/ExporterImpl.java
r16254 r16264 64 64 * Exports results. 65 65 * @param results results to be exported 66 * @param columns the columns descriptions 66 67 */ 67 68 public void export(List<List<ResultElement>> results, List<Column> columns) { tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/http/ExcelHttpExporter.java
r15692 r16264 11 11 */ 12 12 13 import java.io.OutputStream;14 15 import javax.servlet.http.HttpServletRequest;16 import javax.servlet.http.HttpServletResponse;17 18 13 import org.intermine.web.logic.WebUtil; 19 14 import org.intermine.web.logic.export.ExcelExporter; … … 22 17 import org.intermine.web.logic.export.ResponseUtil; 23 18 import org.intermine.web.logic.results.PagedTable; 19 import org.intermine.web.struts.TableExportForm; 20 21 import java.io.OutputStream; 22 23 import javax.servlet.http.HttpServletRequest; 24 import javax.servlet.http.HttpServletResponse; 24 25 25 26 … … 30 31 public class ExcelHttpExporter extends HttpExporterBase implements TableHttpExporter 31 32 { 32 33 /**34 * Constructor.35 */36 public ExcelHttpExporter() { }37 38 33 /** 39 34 * {@inheritDoc} 40 35 */ 41 36 @Override 42 public void export(PagedTable pt, HttpServletRequest request, HttpServletResponse response) { 37 public void export(PagedTable pt, HttpServletRequest request, HttpServletResponse response, 38 TableExportForm form) { 43 39 int defaultMax = 10000; 44 40 … … 54 50 + maxExcelSize + " rows."); 55 51 } 56 super.export(pt, request, response );52 super.export(pt, request, response, form); 57 53 } 58 54 tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/http/HttpExporterBase.java
r16254 r16264 11 11 */ 12 12 13 import java.util.ArrayList; 14 import java.util.List; 15 16 import org.intermine.path.Path; 17 import org.intermine.web.logic.RequestUtil; 18 import org.intermine.web.logic.export.ExportException; 19 import org.intermine.web.logic.export.ExportHelper; 20 import org.intermine.web.logic.export.Exporter; 21 import org.intermine.web.logic.results.PagedTable; 22 import org.intermine.web.logic.results.ResultElement; 23 import org.intermine.web.struts.TableExportForm; 24 13 25 import java.io.IOException; 14 26 import java.io.OutputStream; 15 import java.util.List;16 27 17 28 import javax.servlet.http.HttpServletRequest; 18 29 import javax.servlet.http.HttpServletResponse; 19 30 20 import org.intermine.web.logic.RequestUtil; 21 import org.intermine.web.logic.export.ExportException; 22 import org.intermine.web.logic.export.Exporter; 23 import org.intermine.web.logic.results.PagedTable; 24 import org.intermine.web.logic.results.ResultElement; 31 import org.jfree.data.xy.TableXYDataset; 25 32 26 33 … … 55 62 */ 56 63 public void export(PagedTable pt, HttpServletRequest request, 57 HttpServletResponse response) {64 HttpServletResponse response, TableExportForm form) { 58 65 59 66 List<List<ResultElement>> results = pt.getRearrangedResults(); … … 80 87 81 88 /** 89 * For TableHttpExporter we always return an empty list because all columns and classes are 90 * equal for this exporter. 91 * {@inheritDoc} 92 */ 93 public List<Path> getExportClassPaths(@SuppressWarnings("unused") PagedTable pt) { 94 return new ArrayList<Path>(); 95 } 96 97 /** 98 * The intial export path list is just the paths from the columns of the PagedTable. 99 * {@inheritDoc} 100 */ 101 public List<Path> getInitialExportPaths(PagedTable pt) { 102 return ExportHelper.getColumnPaths(pt); 103 } 104 105 /** 82 106 * @param out output stream 83 107 * @param separator line separator tickets/ticket-1673/intermine/web/main/src/org/intermine/web/logic/export/http/TableHttpExporter.java
r14800 r16264 11 11 */ 12 12 13 import java.util.List; 14 15 import org.intermine.path.Path; 16 import org.intermine.web.logic.results.PagedTable; 17 import org.intermine.web.struts.TableExportForm; 18 13 19 import javax.servlet.http.HttpServletRequest; 14 20 import javax.servlet.http.HttpServletResponse; 15 21 16 import org.intermine.web.logic.results.PagedTable;17 18 22 /** 19 * Implemented by objects that can export PagedTable. 23 * Implemented by objects that can export PagedTable. 20 24 * 21 25 * @author Kim Rutherford … … 29 33 * @param request The HTTP request we are processing 30 34 * @param response The HTTP response we are creating 35 * @param form the form containing the columns paths to export 31 36 */ 32 37 public void export(PagedTable pt, HttpServletRequest request, 33 HttpServletResponse response);38 HttpServletResponse response, TableExportForm form); 34 39 35 40 /** … … 39 44 */ 40 45 public boolean canExport(PagedTable pt); 46 47 /** 48 * From the columns of the PagedTable, return a List of the Paths that this exporter will treat 49 * specially. 50 * eg. if the columns are ("Gene.primaryIdentifier", "Gene.secondaryIdentifier", 51 * "Gene.proteins.primaryIdentifier") return ("Gene", "Gene.proteins"). This is needed for 52 * exporters like SequenceExporter that act on certain classes only (for SequenceExporter, 53 * classes that have a sequence reference) 54 * @param pt the PagedTable 55 * @return the list of possible Paths that can be exported or an empty List if this exporter can 56 * only export all columns at once and doesn't treat some classes specially 57 */ 58 public List<Path> getExportClassPaths(PagedTable pt); 59 60 /** 61 * Return a list of the Paths to show the user as initial export columns or header contents. 62 * The List is likely to be based on the columns of the PagedTable plus or minus special cases 63 * for this exporter. 64 * @param pt the PagedTable 65 * @return the Paths 66 */ 67 public List<Path> getInitialExportPaths(PagedTable pt); 41 68 } tickets/ticket-1673/intermine/web/main/src/org/intermine/web/struts/ExportController.java
r14894 r16264 15 15 import java.util.Map; 16 16 17 import org.intermine.web.logic.Constants; 18 import org.intermine.web.logic.config.TableExportConfig; 19 import org.intermine.web.logic.config.WebConfig; 20 import org.intermine.web.logic.export.http.TableHttpExporter; 21 import org.intermine.web.logic.results.PagedTable; 22 import org.intermine.web.logic.session.SessionMethods; 23 17 24 import javax.servlet.ServletContext; 18 25 import javax.servlet.http.HttpServletRequest; … … 26 33 import org.apache.struts.tiles.ComponentContext; 27 34 import org.apache.struts.tiles.actions.TilesAction; 28 import org.intermine.web.logic.Constants;29 import org.intermine.web.logic.config.TableExportConfig;30 import org.intermine.web.logic.config.WebConfig;31 import org.intermine.web.logic.export.http.TableHttpExporter;32 import org.intermine.web.logic.results.PagedTable;33 import org.intermine.web.logic.session.SessionMethods;34 35 35 36 /** … … 46 47 * {@inheritDoc} 47 48 */ 49 @Override 48 50 public ActionForward execute(@SuppressWarnings("unused") ComponentContext context, 49 51 @SuppressWarnings("unused") ActionMapping mapping, … … 65 67 } 66 68 67 Map allExporters = wc.getTableExportConfigs(); 68 Map usableExporters = new HashMap(); 69 Map<String, TableExportConfig> allExporters = wc.getTableExportConfigs(); 70 Map<String, Map<String, String>> usableExporters = 71 new HashMap<String, Map<String, String>>(); 69 72 70 for (Iterator i = allExporters.keySet().73 for (Iterator<String> i = allExporters.keySet(). 71 74 iterator(); i.hasNext(); ) { 72 String exporterId = (String)i.next();73 TableExportConfig tableExportConfig = (TableExportConfig)allExporters.get(exporterId);75 String exporterId = i.next(); 76 TableExportConfig tableExportConfig = allExporters.get(exporterId); 74 77 75 78 TableHttpExporter tableExporter = … … 83 86 } 84 87 if (canExport) { 85 usableExporters.put(exporterId, tableExportConfig); 88 // parameters to pass via the URL to the exportOptions page 89 Map<String, String> config = new HashMap<String, String>(); 90 config.put("id", tableExportConfig.getId()); 91 config.put("className", tableExportConfig.getClassName()); 92 usableExporters.put(exporterId, config); 86 93 } else { 87 94 usableExporters.put(exporterId, null); tickets/ticket-1673/intermine/web/main/src/org/intermine/web/struts/TableController.java
r16025 r16264 85 85 } 86 86 87 PagedTable pt = SessionMethods.getResultsTable(session, request.getParameter("table")); 87 String table = request.getParameter("table"); 88 PagedTable pt = SessionMethods.getResultsTable(session, table); 88 89 if (pt == null) { 89 LOG.error("PagedTable for " + request.getParameter("table")+ " is null");90 LOG.error("PagedTable for " + table + " is null"); 90 91 return null; 91 92 } … … 214 215 request.setAttribute("columnsToHighlight", jsonWriter.write(columnsToHighlightMap)); 215 216 request.setAttribute("pathQuery", pt.getWebTable().getPathQuery()); 216 request.setAttribute("table", request.getParameter("table"));217 request.setAttribute("table", table); 217 218 218 219 Map<Path, String> pathNames = new HashMap<Path, String> (); tickets/ticket-1673/intermine/web/main/src/org/intermine/web/struts/TableExportAction.java
r15553 r16264 24 24 import org.apache.struts.action.ActionMapping; 25 25 import org.apache.struts.action.ActionMessage; 26 import org.jfree.data.xy.TableXYDataset; 27 28 import org.intermine.web.logic.config.WebConfig; 26 29 import org.intermine.web.logic.export.ExportException; 27 30 import org.intermine.web.logic.export.http.TableExporterFactory; … … 32 35 33 36 /** 34 * Implementation of <strong>Action</strong> that allows the user to export a 37 * Implementation of <strong>Action</strong> that allows the user to export a 35 38 * PagedTable to a file. 36 39 * 37 40 * @author Kim Rutherford 38 * @author Jakub Kulaviak 41 * @author Jakub Kulaviak 39 42 */ 40 43 public class TableExportAction extends InterMineAction … … 43 46 44 47 private static final String ERROR_MSG = "Export failed. Please contact support."; 45 48 46 49 // timeout for export is 1 day 47 50 private static final int TIMEOUT = 24 * 60 * 60; … … 58 61 * an exception 59 62 */ 63 @Override 60 64 public ActionForward execute(ActionMapping mapping, 61 65 ActionForm form, … … 64 68 throws Exception { 65 69 request.getSession().setMaxInactiveInterval(TIMEOUT); 66 String type = request.getParameter("type"); 70 TableExportForm tef = (TableExportForm) form; 71 String type = tef.getType(); 72 String table = tef.getTable(); 67 73 PagedTable pt = null; 68 74 try { 69 TableExporterFactory factory = new TableExporterFactory(70 SessionMethods.getWebConfig(request));75 WebConfig webConfig = SessionMethods.getWebConfig(request); 76 TableExporterFactory factory = new TableExporterFactory(webConfig); 71 77 TableHttpExporter exporter = factory.getExporter(type); 72 pt = getPagedTable(request, request.getSession());78 pt = SessionMethods.getResultsTable(request.getSession(), table); 73 79 74 80 if (pt == null) { 75 81 throw new ExportException("Export failed."); 76 82 } 77 83 78 84 if (pt.getExactSize() > pt.getMaxRetrievableIndex()) { 79 85 throw new ExportException("Result is too big for export. " … … 81 87 + pt.getMaxRetrievableIndex() + " rows."); 82 88 } 83 84 89 90 85 91 if (pt.getWebTable() instanceof WebResults) { 86 92 ((WebResults) pt.getWebTable()).goFaster(); 87 93 } 88 89 exporter.export(pt, request, response );90 // If null is returned then no forwarding is performed and 94 95 exporter.export(pt, request, response, tef); 96 // If null is returned then no forwarding is performed and 91 97 // to the output is not flushed any jsp output, so user 92 98 // will get only required export data 93 99 return null; 94 100 } catch (RuntimeException e) { 95 return processException(mapping, request, response, e); 101 return processException(mapping, request, response, e); 96 102 } finally { 97 103
