fixed bug when opening reports created with reports modeler
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@84608 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
58c22e49f4
commit
9dea2bb6d8
|
@ -311,7 +311,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
fromBasket = getReportFromBasket(zippedTemplate, zipPath, zipFilename);
|
fromBasket = getReportFromBasket(zippedTemplate, zipPath, zipFilename);
|
||||||
zipToExtract = zipPath + zipFilename;
|
zipToExtract = zipPath + zipFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.info("\n\n** zipToExtract: " + zipToExtract);
|
_log.info("\n\n** zipToExtract: " + zipToExtract);
|
||||||
|
|
||||||
if (bi.getFolderItemType() == FolderItemType.REPORT || bi.getFolderItemType() == FolderItemType.REPORT_TEMPLATE) {
|
if (bi.getFolderItemType() == FolderItemType.REPORT || bi.getFolderItemType() == FolderItemType.REPORT_TEMPLATE) {
|
||||||
|
@ -352,7 +352,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
|
|
||||||
// changes the template name model
|
// changes the template name model
|
||||||
toReturn.setTemplateName(templateName);
|
toReturn.setTemplateName(templateName);
|
||||||
|
|
||||||
File toDelete = new File(fileToRead); //to delete the file extracted from the workspace
|
File toDelete = new File(fileToRead); //to delete the file extracted from the workspace
|
||||||
|
|
||||||
File toDelete1 = new File( myUtil.getTemplatePath(templateName, getVreName(), getUsername()));
|
File toDelete1 = new File( myUtil.getTemplatePath(templateName, getVreName(), getUsername()));
|
||||||
|
@ -831,7 +831,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
return d4Session.getAttribute(CURRENT_REPORT_ID_ATTRIBUTE).toString();
|
return d4Session.getAttribute(CURRENT_REPORT_ID_ATTRIBUTE).toString();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* used to save the report in the same folder *
|
* used to save the report in the same folder
|
||||||
*/
|
*/
|
||||||
public void saveReport(Model toSave) {
|
public void saveReport(Model toSave) {
|
||||||
Workspace root = null;
|
Workspace root = null;
|
||||||
|
@ -910,16 +910,19 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
|
|
||||||
String templateName = newname;
|
String templateName = newname;
|
||||||
|
|
||||||
|
boolean isUpdate = false;
|
||||||
if (templateName.endsWith("d4sR") ) {
|
if (templateName.endsWith("d4sR") ) {
|
||||||
if (toSaveIn.exists(templateName)) {
|
if (toSaveIn.exists(templateName)) {
|
||||||
_log.warn("Item exists already, deleting and creating new one");
|
_log.warn("Item exists already, updating");
|
||||||
toSaveIn.removeChild(toSaveIn.find(templateName));
|
//toSaveIn.removeChild(toSaveIn.find(templateName));
|
||||||
|
isUpdate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toSaveIn.exists(templateName + ".d4sR")) {
|
if (toSaveIn.exists(templateName + ".d4sR")) {
|
||||||
_log.warn("Item exists already, deleting and creating new one");
|
_log.warn("Item exists already, updating");
|
||||||
toSaveIn.removeChild(toSaveIn.find(templateName + ".d4sR"));
|
//toSaveIn.removeChild(toSaveIn.find(templateName + ".d4sR"));
|
||||||
|
isUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove the template extension
|
//remove the template extension
|
||||||
|
@ -927,17 +930,21 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
||||||
if (! templateToInsert.endsWith(".d4sR"))
|
if (! templateToInsert.endsWith(".d4sR"))
|
||||||
templateToInsert+=".d4sR";
|
templateToInsert+=".d4sR";
|
||||||
|
|
||||||
Calendar dateCreated = Calendar.getInstance();
|
Report rep = null;
|
||||||
dateCreated.setTime(model.getDateCreated());
|
if (isUpdate) {
|
||||||
|
rep = (Report) toSaveIn.find(templateName);
|
||||||
|
getWorkspaceArea().updateItem(rep.getId(), isZip);
|
||||||
|
} else { //is new
|
||||||
|
Calendar dateCreated = Calendar.getInstance();
|
||||||
|
dateCreated.setTime(model.getDateCreated());
|
||||||
|
|
||||||
Calendar lastEdit = Calendar.getInstance();
|
Calendar lastEdit = Calendar.getInstance();
|
||||||
lastEdit.setTime(model.getLastEdit());
|
lastEdit.setTime(model.getLastEdit());
|
||||||
|
|
||||||
Report rep = toSaveIn.createReportItem(templateToInsert, templateToInsert, dateCreated, lastEdit,
|
rep = toSaveIn.createReportItem(templateToInsert, templateToInsert, dateCreated, lastEdit,
|
||||||
model.getAuthor(), model.getLastEditBy(), templateToInsert, model.getSections().size(), "no-status", isZip);
|
model.getAuthor(), model.getLastEditBy(), templateToInsert, model.getSections().size(), "no-status", isZip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Report rep = toSaveIn.createReportItem(templateToInsert, templateToInsert, isZip);
|
|
||||||
storeReportItemIDInSession(rep.getId());
|
storeReportItemIDInSession(rep.getId());
|
||||||
|
|
||||||
if (toSaveIn.getType() == WorkspaceItemType.SHARED_FOLDER) {
|
if (toSaveIn.getType() == WorkspaceItemType.SHARED_FOLDER) {
|
||||||
|
|
Reference in New Issue