forked from I-TECH-UW/OpenELIS-Global-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request I-TECH-UW#1243 from CalebSLane/develop
Add Method to analysis and attach to WHONet report
- Loading branch information
Showing
23 changed files
with
360 additions
and
809 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,6 @@ | |
import net.sf.jasperreports.engine.JRField; | ||
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; | ||
|
||
/** | ||
* @author pahill ([email protected]) | ||
* @since Mar 17, 2011 | ||
*/ | ||
public abstract class WHONETCSVRoutineExportReport extends Report implements JRDataSource { | ||
|
||
/** | ||
|
@@ -74,4 +70,4 @@ public Object getFieldValue(JRField arg0) throws JRException { | |
public boolean next() throws JRException { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,29 +13,16 @@ | |
*/ | ||
package org.openelisglobal.reports.action.implementation; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.io.UnsupportedEncodingException; | ||
import java.sql.SQLException; | ||
import java.text.ParseException; | ||
import org.apache.commons.validator.GenericValidator; | ||
import org.jfree.util.Log; | ||
import org.openelisglobal.common.util.StringUtil; | ||
import org.openelisglobal.internationalization.MessageUtil; | ||
import org.openelisglobal.project.service.ProjectService; | ||
import org.openelisglobal.reports.action.implementation.reportBeans.WHONETRoutineColumnBuilder; | ||
import org.openelisglobal.reports.action.implementation.reportBeans.WHONETCSVRoutineColumnBuilder; | ||
import org.openelisglobal.reports.form.ReportForm; | ||
import org.openelisglobal.spring.util.SpringContext; | ||
|
||
/** | ||
* @author Paul A. Hill ([email protected]) | ||
* @since Jan 26, 2011 | ||
*/ | ||
public class WHONETExportRoutineByDate extends WHONETCSVRoutineSampleExportReport | ||
implements IReportParameterSetter, IReportCreator { | ||
public class WHONETExportRoutineByDate extends WHONETCSVRoutineSampleExportReport implements IReportParameterSetter { | ||
protected final ProjectService projectService = SpringContext.getBean(ProjectService.class); | ||
// private String projectStr; | ||
// private Project project; | ||
|
||
@Override | ||
protected String reportFileName() { | ||
|
@@ -48,8 +35,6 @@ public void setRequestParameters(ReportForm form) { | |
form.setReportName(getReportNameForParameterPage()); | ||
form.setUseLowerDateRange(Boolean.TRUE); | ||
form.setUseUpperDateRange(Boolean.TRUE); | ||
// form.setUseProjectCode(Boolean.TRUE); | ||
// form.setProjectCodeList(getProjectList()); | ||
} catch (RuntimeException e) { | ||
Log.error("Error in ExportRoutineByDate.setRequestParemeters: ", e); | ||
} | ||
|
@@ -59,11 +44,6 @@ protected String getReportNameForParameterPage() { | |
return MessageUtil.getMessage("reports.label.project.export") + " " | ||
+ MessageUtil.getContextualMessage("sample.collectionDate"); | ||
} | ||
/* | ||
* protected void createReportParameters() { super.createReportParameters(); | ||
* reportParameters.put("studyName", (project == null) ? null : | ||
* project.getLocalizedName()); } | ||
*/ | ||
|
||
@Override | ||
public void initializeReport(ReportForm form) { | ||
|
@@ -72,7 +52,6 @@ public void initializeReport(ReportForm form) { | |
|
||
lowDateStr = form.getLowerDateRange(); | ||
highDateStr = form.getUpperDateRange(); | ||
// projectStr = form.getProjectCode(); | ||
dateRange = new DateRange(lowDateStr, highDateStr); | ||
|
||
createReportParameters(); | ||
|
@@ -91,23 +70,6 @@ private boolean validateSubmitParameters() { | |
return dateRange.validateHighLowDate("report.error.message.date.received.missing"); | ||
} | ||
|
||
// ------------------------------- | ||
|
||
/** | ||
* @return true, if location is not blank or "0" is is found in the DB; false | ||
* otherwise | ||
*/ | ||
// -------------------------- | ||
/* | ||
* private boolean validateProject() { if (isBlankOrNull(projectStr) || | ||
* "0".equals(Integer.getInteger(projectStr))) { | ||
* add1LineErrorMessage("report.error.message.project.missing"); return false; } | ||
* ProjectService Service = new ProjectServiceImpl(); project = | ||
* Service.getProjectById(projectStr); if (project == null) { | ||
* add1LineErrorMessage("report.error.message.project.missing"); return false; } | ||
* return true; } | ||
*/ | ||
// ------------------------- | ||
/** creating the list for generation to the report */ | ||
private void createReportItems() { | ||
try { | ||
|
@@ -119,75 +81,8 @@ private void createReportItems() { | |
} | ||
} | ||
|
||
@Override | ||
protected void writeResultsToBuffer(ByteArrayOutputStream buffer) | ||
throws IOException, UnsupportedEncodingException, SQLException, ParseException { | ||
|
||
String currentAccessionNumber = null; | ||
String[] splitBase = null; | ||
while (WHONETcsvRoutineColumnBuilder.next()) { | ||
String line = WHONETcsvRoutineColumnBuilder.nextLine(); | ||
String[] splitLine = StringUtil.separateCSVWithMixedEmbededQuotes(line); | ||
|
||
if (splitLine[0].equals(currentAccessionNumber)) { | ||
merge(splitBase, splitLine); | ||
} else { | ||
if (currentAccessionNumber != null) { | ||
writeConsolidatedBaseToBuffer(buffer, splitBase); | ||
} | ||
splitBase = splitLine; | ||
currentAccessionNumber = splitBase[0]; | ||
} | ||
} | ||
|
||
writeConsolidatedBaseToBuffer(buffer, splitBase); | ||
} | ||
|
||
private void merge(String[] base, String[] line) { | ||
for (int i = 0; i < base.length; ++i) { | ||
if (GenericValidator.isBlankOrNull(base[i])) { | ||
base[i] = line[i]; | ||
} | ||
} | ||
} | ||
|
||
protected void writeConsolidatedBaseToBuffer(ByteArrayOutputStream buffer, String[] splitBase) | ||
throws IOException, UnsupportedEncodingException { | ||
|
||
if (splitBase != null) { | ||
StringBuffer consolidatedLine = new StringBuffer(); | ||
for (String value : splitBase) { | ||
consolidatedLine.append(value); | ||
consolidatedLine.append(","); | ||
} | ||
|
||
consolidatedLine.deleteCharAt(consolidatedLine.lastIndexOf(",")); | ||
buffer.write(consolidatedLine.toString().getBytes("windows-1252")); | ||
} | ||
} | ||
|
||
private WHONETRoutineColumnBuilder getColumnBuilder() { | ||
return new WHONETRoutineColumnBuilder(dateRange); | ||
private WHONETCSVRoutineColumnBuilder getColumnBuilder() { | ||
return new WHONETCSVRoutineColumnBuilder(dateRange); | ||
} | ||
|
||
/** | ||
* @return a list of the correct projects for display | ||
*/ | ||
/* | ||
* protected List<Project> getProjectList() { List<Project> projects = new | ||
* ArrayList<Project>(); Project project = new Project(); | ||
* project.setProjectName("Antiretroviral Study"); | ||
* projects.add(projectService.getProjectByName(project, false, false)); | ||
* project.setProjectName("Antiretroviral Followup Study"); | ||
* projects.add(projectService.getProjectByName(project, false, false)); | ||
* project.setProjectName("Routine HIV Testing"); | ||
* projects.add(projectService.getProjectByName(project, false, false)); | ||
* project.setProjectName("Early Infant Diagnosis for HIV Study"); | ||
* projects.add(projectService.getProjectByName(project, false, false)); | ||
* project.setProjectName("Viral Load Results"); | ||
* projects.add(projectService.getProjectByName(project, false, false)); | ||
* project.setProjectName("Indeterminate Results"); | ||
* projects.add(projectService.getProjectByName(project, false, false)); return | ||
* projects; } | ||
*/ | ||
} | ||
} |
65 changes: 0 additions & 65 deletions
65
src/main/java/org/openelisglobal/reports/action/implementation/WHONETReport.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.