removed legacy methods for export
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@71323 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
17133b5c31
commit
bd21447225
5
pom.xml
5
pom.xml
|
@ -130,11 +130,6 @@
|
|||
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>${setScope}</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-docx-generator</artifactId>
|
||||
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>report-exporter-widget</groupId>
|
||||
<artifactId>report-exporter-widget</artifactId>
|
||||
|
|
|
@ -33,16 +33,6 @@ public interface ReportService extends RemoteService{
|
|||
* @return .
|
||||
*/
|
||||
Model readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param model .
|
||||
* @param type .
|
||||
* @return .
|
||||
*/
|
||||
boolean generateManifestation(Model model, ExportManifestationType type);
|
||||
|
||||
/**
|
||||
* each portlet instance runs in a scope
|
||||
* each portlet instance is used by a unique username from within the portal
|
||||
|
@ -80,8 +70,6 @@ public interface ReportService extends RemoteService{
|
|||
void updateWorkflowDocument(boolean update);
|
||||
|
||||
void renewLock();
|
||||
|
||||
String generateTempDocx(Model model);
|
||||
/**
|
||||
*
|
||||
* @param tempPath
|
||||
|
|
|
@ -37,15 +37,6 @@ public interface ReportServiceAsync {
|
|||
*/
|
||||
void readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting, AsyncCallback<Model> callback);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param model .
|
||||
* @param type .
|
||||
* @param callback .
|
||||
*/
|
||||
void generateManifestation(Model model, ExportManifestationType type, AsyncCallback<Boolean> callback);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param model .
|
||||
|
@ -80,8 +71,7 @@ public interface ReportServiceAsync {
|
|||
AsyncCallback<Model> callback);
|
||||
void updateWorkflowDocument(boolean update, AsyncCallback<Void> callback);
|
||||
void renewLock(AsyncCallback<Void> callback);
|
||||
void generateTempDocx(Model model,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
void readImportedModel(String tempPath,
|
||||
AsyncCallback<Model> callback);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
|
@ -536,7 +535,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
out.write(buf,0,len);
|
||||
out.close();
|
||||
inputStream.close();
|
||||
_log.info("Successfully got ReportTemplate from Basket: " + pathToFile);
|
||||
_log.info("Successfully got ReportTemplate from HL: " + pathToFile);
|
||||
return true;
|
||||
}
|
||||
catch (IOException e){
|
||||
|
@ -544,122 +543,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String generateTempDocx(Model model) {
|
||||
|
||||
|
||||
_log.info("Generating docx file");
|
||||
DocxGenerator docxGenerator = new DocxGenerator(model);
|
||||
_log.debug("DocxGenerator instanciated:");
|
||||
//boolean result = new DocxGenerator(model, true, true);
|
||||
// logger.trace("RESULT:" + result);
|
||||
// if (! result)
|
||||
// return "ERROR";
|
||||
|
||||
File docx = null;
|
||||
try {
|
||||
docx = docxGenerator.outputTmpFile();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "ERROR";
|
||||
}
|
||||
_log.info("Generated docx file: " + docx.getAbsolutePath());
|
||||
return docx.getAbsolutePath();
|
||||
}
|
||||
/**
|
||||
* @param model the model
|
||||
* @param type the type
|
||||
* @return true if the generatePDF is successful
|
||||
*/
|
||||
public boolean generateManifestation(Model model, ExportManifestationType type) {
|
||||
|
||||
//in case there are dynamic images need to get the from the HL
|
||||
importDynamicImagesFromHL(model);
|
||||
|
||||
|
||||
//in case there are dynamic TS need to get the CSV from HL and add it to the component
|
||||
for (BasicSection section : model.getSections()) {
|
||||
for (BasicComponent tc : section.getComponents()) {
|
||||
if (tc.getType() == ComponentType.TIME_SERIES) {
|
||||
RepTimeSeries sts = (RepTimeSeries) tc.getPossibleContent();
|
||||
File toPass = getTimeSeriesFromWorkspace(sts);
|
||||
if (toPass == null)
|
||||
tc.setPossibleContent(null);
|
||||
else {
|
||||
sts.setCsvFile(toPass.getAbsolutePath());
|
||||
tc.setPossibleContent(sts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean result = false;
|
||||
ServiceUtil myUtil = new ServiceUtil(getASLSession());
|
||||
_log.info("Generating docx file");
|
||||
_log.debug("Model Converted");
|
||||
DocxGenerator docxGenerator = new DocxGenerator(model);
|
||||
_log.info("DocxGenerator instanciated:");
|
||||
// result = docxGenerator.exportInDocx(model, true, true);
|
||||
_log.trace("RESULT:" + result);
|
||||
//remove the extension
|
||||
String exportName = model.getTemplateName();
|
||||
if (exportName.endsWith(".d4sT") || exportName.endsWith(".d4sR") )
|
||||
exportName = model.getTemplateName().substring(0, model.getTemplateName().length() - 5);
|
||||
|
||||
|
||||
if (result) {
|
||||
switch (type) {
|
||||
case DOCX:
|
||||
try {
|
||||
File docx = docxGenerator.outputTmpFile();
|
||||
_log.debug("Generated docx file: " + docx.getAbsolutePath());
|
||||
|
||||
|
||||
File toMoveTo = new File(myUtil.getTemplateFolder(getVreName(), getUsername()) + EXPORTS_DIR + File.separator + exportName + ".docx");
|
||||
String folder = (myUtil.getTemplateFolder(getVreName(), getUsername()) + EXPORTS_DIR + File.separator);
|
||||
myUtil.copyFile(docx, toMoveTo, folder);
|
||||
_log.trace("1 File Copied to " + toMoveTo.getAbsolutePath());
|
||||
|
||||
String name = exportName+".docx";
|
||||
String desc = name;
|
||||
String mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
saveInWorkSpace(name, desc, mimeType, toMoveTo, type);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case HTML:
|
||||
try {
|
||||
File html = docxGenerator.outputHTMLTmpFile();
|
||||
_log.info("Generated HTML file: " + html.getAbsolutePath());
|
||||
|
||||
File toMoveTo = new File(myUtil.getTemplateFolder(getVreName(), getUsername()) + EXPORTS_DIR + File.separator + exportName + ".html");
|
||||
String folder = (myUtil.getTemplateFolder(getVreName(), getUsername()) + EXPORTS_DIR + File.separator);
|
||||
myUtil.copyFile(html, toMoveTo, folder);
|
||||
_log.trace("1 File Copied to " + toMoveTo.getAbsolutePath());
|
||||
|
||||
String name = exportName+".html";
|
||||
String desc = name;
|
||||
String mimeType = "text/html";
|
||||
saveInWorkSpace(name, desc, mimeType, toMoveTo, type);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* save the manifestation in default folder, overwrites if the file name exists already
|
||||
*
|
||||
|
|
Reference in New Issue