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
|
@ -831,7 +831,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
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) {
|
||||
Workspace root = null;
|
||||
|
@ -910,16 +910,19 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
|
||||
String templateName = newname;
|
||||
|
||||
boolean isUpdate = false;
|
||||
if (templateName.endsWith("d4sR") ) {
|
||||
if (toSaveIn.exists(templateName)) {
|
||||
_log.warn("Item exists already, deleting and creating new one");
|
||||
toSaveIn.removeChild(toSaveIn.find(templateName));
|
||||
_log.warn("Item exists already, updating");
|
||||
//toSaveIn.removeChild(toSaveIn.find(templateName));
|
||||
isUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (toSaveIn.exists(templateName + ".d4sR")) {
|
||||
_log.warn("Item exists already, deleting and creating new one");
|
||||
toSaveIn.removeChild(toSaveIn.find(templateName + ".d4sR"));
|
||||
_log.warn("Item exists already, updating");
|
||||
//toSaveIn.removeChild(toSaveIn.find(templateName + ".d4sR"));
|
||||
isUpdate = true;
|
||||
}
|
||||
|
||||
//remove the template extension
|
||||
|
@ -927,17 +930,21 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
if (! templateToInsert.endsWith(".d4sR"))
|
||||
templateToInsert+=".d4sR";
|
||||
|
||||
Report rep = null;
|
||||
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();
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
//Report rep = toSaveIn.createReportItem(templateToInsert, templateToInsert, isZip);
|
||||
storeReportItemIDInSession(rep.getId());
|
||||
|
||||
if (toSaveIn.getType() == WorkspaceItemType.SHARED_FOLDER) {
|
||||
|
|
Reference in New Issue