FileSet upload in progress
This commit is contained in:
parent
3df7ab1787
commit
541c190820
|
@ -1,5 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +9,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-entry-app-1.3.0-SNAPSHOT">
|
<wb-module deploy-name="geoportal-data-entry-app-1.3.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +19,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +29,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +39,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +52,9 @@
|
||||||
<dependent-module archiveName="geoportal-data-common-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
<dependent-module archiveName="geoportal-data-common-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +62,9 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +72,9 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +82,9 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,4 +75,22 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
String getJSONRecord(String itemId, RECORD_TYPE recordType) throws Exception;
|
String getJSONRecord(String itemId, RECORD_TYPE recordType) throws Exception;
|
||||||
|
|
||||||
ConcessioneDV updateRecord(String itemId, String jsonUpdate, RECORD_TYPE recordType) throws Exception;
|
ConcessioneDV updateRecord(String itemId, String jsonUpdate, RECORD_TYPE recordType) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read file set paths.
|
||||||
|
*
|
||||||
|
* @return the list
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
List<String> readFileSetPaths() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the record.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param recordType the record type
|
||||||
|
* @return the record
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
ConcessioneDV getRecord(String itemId, RECORD_TYPE recordType) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,4 +60,10 @@ public interface GeoportalDataEntryServiceAsync
|
||||||
|
|
||||||
|
|
||||||
void updateRecord(String itemId, String jsonUpdate, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
void updateRecord(String itemId, String jsonUpdate, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
||||||
|
|
||||||
|
|
||||||
|
void readFileSetPaths(AsyncCallback<List<String>> callback);
|
||||||
|
|
||||||
|
|
||||||
|
void getRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
|
|
||||||
|
@ -80,9 +82,28 @@ public class EditModeRecord extends Composite {
|
||||||
this.appManagerBus = appManagerBus;
|
this.appManagerBus = appManagerBus;
|
||||||
|
|
||||||
instanceJSONEditor();
|
instanceJSONEditor();
|
||||||
|
instanceUpdateFilesetEditor();
|
||||||
bindEvents();
|
bindEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void instanceUpdateFilesetEditor() {
|
||||||
|
GeoPortalDataEntryApp.geoportalDataEntryService.readFileSetPaths(new AsyncCallback<List<String>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<String> listFileSetPaths) {
|
||||||
|
UpdateFileset updateFileset = new UpdateFileset(selectedConcessione, recordType, listFileSetPaths);
|
||||||
|
filesUpdatePanel.add(updateFileset);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void instanceJSONEditor() {
|
private void instanceJSONEditor() {
|
||||||
|
|
||||||
rawUpdatePanel.clear();
|
rawUpdatePanel.clear();
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<b:Tab icon="PENCIL" active="true" heading="Edit the source"
|
<b:Tab icon="PENCIL" active="true" heading="Edit the source"
|
||||||
ui:field="tabRawUpdate">
|
ui:field="tabRawUpdate">
|
||||||
<b:Heading size="3">Source Project Editor</b:Heading>
|
<b:Heading size="3">Source Project Editor</b:Heading>
|
||||||
<b:Label>You can update the Source Project by editing its JSON model
|
<b:Label type="INFO">You can update the Source Project by editing its JSON model
|
||||||
data displayed in the following Editor.</b:Label>
|
data displayed in the following Editor.</b:Label>
|
||||||
<g:HTML addStyleNames="{style.info-panel}">
|
<g:HTML addStyleNames="{style.info-panel}">
|
||||||
<p style='color: #585858'>
|
<p style='color: #585858'>
|
||||||
|
@ -54,8 +54,7 @@
|
||||||
<b:Tab icon="UPLOAD_ALT" heading="Update File/s"
|
<b:Tab icon="UPLOAD_ALT" heading="Update File/s"
|
||||||
ui:field="tabUploadFiles">
|
ui:field="tabUploadFiles">
|
||||||
<b:Heading size="3">Update the file/s</b:Heading>
|
<b:Heading size="3">Update the file/s</b:Heading>
|
||||||
<b:Label>By choosing a section (e.g. "RELAZIONE di
|
<b:Label type="INFO">By choosing a section (e.g. "relazione") and
|
||||||
SCAVO") and
|
|
||||||
uploading new file/s the old one/s will be replaced</b:Label>
|
uploading new file/s the old one/s will be replaced</b:Label>
|
||||||
<g:FlowPanel ui:field="filesUpdatePanel">
|
<g:FlowPanel ui:field="filesUpdatePanel">
|
||||||
</g:FlowPanel>
|
</g:FlowPanel>
|
||||||
|
|
|
@ -0,0 +1,199 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||||
|
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.MultipleDilaogUpload;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Label;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class UpdateFileset.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Sep 27, 2021
|
||||||
|
*/
|
||||||
|
public class UpdateFileset extends Composite {
|
||||||
|
|
||||||
|
private static UpdateFilesetUiBinder uiBinder = GWT.create(UpdateFilesetUiBinder.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface UpdateFilesetUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Sep 27, 2021
|
||||||
|
*/
|
||||||
|
interface UpdateFilesetUiBinder extends UiBinder<Widget, UpdateFileset> {
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
ListBox listBoxPaths;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
ListBox listBoxIndex;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
ControlGroup cgSelectFile;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel uploadFileContainer;
|
||||||
|
|
||||||
|
private List<String> listFileSetPaths;
|
||||||
|
|
||||||
|
private boolean placeholderRemoved = false;
|
||||||
|
|
||||||
|
private String recordId;
|
||||||
|
|
||||||
|
private BaseConcessioneDV selectedConcessione;
|
||||||
|
|
||||||
|
private ConcessioneDV fullConcessione;
|
||||||
|
|
||||||
|
private RECORD_TYPE recordType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new update fileset.
|
||||||
|
*
|
||||||
|
* @param listFileSetPaths the list file set paths
|
||||||
|
*/
|
||||||
|
public UpdateFileset(BaseConcessioneDV selectedConcessione, RECORD_TYPE recordType, List<String> listFileSetPaths) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.selectedConcessione = selectedConcessione;
|
||||||
|
this.recordType = recordType;
|
||||||
|
this.listFileSetPaths = listFileSetPaths;
|
||||||
|
listBoxPaths.addItem("Select a section...");
|
||||||
|
for (String path : listFileSetPaths) {
|
||||||
|
listBoxPaths.addItem(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add handler on select
|
||||||
|
listBoxPaths.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(ChangeEvent event) {
|
||||||
|
GWT.log("Profile type selection changed...");
|
||||||
|
cgSelectFile.setVisible(false);
|
||||||
|
|
||||||
|
if (!placeholderRemoved) {
|
||||||
|
listBoxPaths.removeItem(0); // this is the placeholder
|
||||||
|
placeholderRemoved = true;
|
||||||
|
}
|
||||||
|
showUploadFileGUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
GeoPortalDataEntryApp.geoportalDataEntryService.getRecord(selectedConcessione.getItemId(), recordType,
|
||||||
|
new AsyncCallback<ConcessioneDV>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ConcessioneDV theRecord) {
|
||||||
|
fullConcessione = theRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Window.alert(caught.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show upload file GUI.
|
||||||
|
*/
|
||||||
|
private void showUploadFileGUI() {
|
||||||
|
uploadFileContainer.setVisible(true);
|
||||||
|
uploadFileContainer.clear();
|
||||||
|
|
||||||
|
listBoxIndex.clear();
|
||||||
|
cgSelectFile.setVisible(true);
|
||||||
|
|
||||||
|
if (listBoxPaths.getSelectedItemText().contains("abstract_relazione")) {
|
||||||
|
AbstractRelazioneScavoDV ar = fullConcessione.getAbstractRelazioneScavo();
|
||||||
|
if (ar == null) {
|
||||||
|
showMessage("abstract_relazione " + " NOT AVAILABLE", LabelType.WARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fillListBoxToBeReplaced("abstract_relazione", ar.getListWsContent());
|
||||||
|
} else if (listBoxPaths.getSelectedItemText().contains("immagini")) {
|
||||||
|
List<UploadedImageDV> listImmagini = fullConcessione.getImmaginiRappresentative();
|
||||||
|
if (listImmagini == null || listImmagini.isEmpty()) {
|
||||||
|
showMessage("immagini " + " NOT AVAILABLE", LabelType.WARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (UploadedImageDV uploadedImageDV : listImmagini) {
|
||||||
|
fillListBoxToBeReplaced("immagini", uploadedImageDV.getListWsContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listBoxIndex.getItemCount() > 1) {
|
||||||
|
listBoxIndex.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(ChangeEvent event) {
|
||||||
|
showFileUploadInteraction();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillListBoxToBeReplaced(String section, List<WorkspaceContentDV> listWSC) {
|
||||||
|
|
||||||
|
listBoxIndex.clear();
|
||||||
|
|
||||||
|
listBoxIndex.addItem("Select a file...");
|
||||||
|
|
||||||
|
if (listWSC == null || listWSC.isEmpty()) {
|
||||||
|
showMessage(section + " DOES NOT CONTAIN FILES", LabelType.WARNING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (WorkspaceContentDV wsContent : listWSC) {
|
||||||
|
String name = wsContent.getName() == null || wsContent.getName().isEmpty() ? wsContent.getLink()
|
||||||
|
: wsContent.getName();
|
||||||
|
listBoxIndex.addItem(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showFileUploadInteraction() {
|
||||||
|
uploadFileContainer.clear();
|
||||||
|
HTML label = new HTML();
|
||||||
|
label.setHTML("<i>Going to replace the file into section: " + listBoxIndex.getSelectedItemText() + " with</i>");
|
||||||
|
|
||||||
|
uploadFileContainer.add(label);
|
||||||
|
MultipleDilaogUpload holder = new MultipleDilaogUpload();
|
||||||
|
uploadFileContainer.add(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showMessage(String txt, LabelType type) {
|
||||||
|
Label l = new Label();
|
||||||
|
l.setType(type);
|
||||||
|
l.setText(txt);
|
||||||
|
uploadFileContainer.add(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.important {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<b:Form type="INLINE">
|
||||||
|
<b:Fieldset>
|
||||||
|
<b:ControlGroup>
|
||||||
|
<b:ControlLabel>Section</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:ListBox ui:field="listBoxPaths"></b:ListBox>
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
<b:ControlGroup ui:field="cgSelectFile" visible="false">
|
||||||
|
<b:ControlLabel>Select File to be replaced</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:ListBox ui:field="listBoxIndex"></b:ListBox>
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
</b:Fieldset>
|
||||||
|
</b:Form>
|
||||||
|
<g:HTMLPanel ui:field="uploadFileContainer"></g:HTMLPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -672,7 +672,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
Concessione concessione = clientMongo.getById(itemId);
|
Concessione concessione = clientMongo.getById(itemId);
|
||||||
return serviceUtil.toJSON(concessione);
|
return serviceUtil.toJSON(concessione);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -681,4 +681,57 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
"Error occurred on reading the JSON project with id: " + itemId + ". Error: " + e.getMessage());
|
"Error occurred on reading the JSON project with id: " + itemId + ". Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the record.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param recordType the record type
|
||||||
|
* @return the record
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ConcessioneDV getRecord(String itemId, RECORD_TYPE recordType) throws Exception {
|
||||||
|
LOG.info("getRecord called with itemId: " + itemId + ", recordType: " + recordType);
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (itemId == null)
|
||||||
|
throw new Exception("Item id is null");
|
||||||
|
|
||||||
|
if (recordType.equals(RECORD_TYPE.CONCESSIONE)) {
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
||||||
|
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||||
|
Concessione concessione = clientMongo.getById(itemId);
|
||||||
|
return ConvertToDataViewModel.toConcessione(concessione);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error on reading the record with item id: " + itemId, e);
|
||||||
|
throw new Exception(
|
||||||
|
"Error occurred on reading the record with id: " + itemId + ". Error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read file set paths.
|
||||||
|
*
|
||||||
|
* @return the list
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<String> readFileSetPaths() throws Exception {
|
||||||
|
LOG.info("readFileSetPaths called");
|
||||||
|
List<String> fileSetPaths = new ArrayList<String>();
|
||||||
|
fileSetPaths.add(Concessione.Paths.ABSTRACT_RELAZIONE);
|
||||||
|
fileSetPaths.add(Concessione.Paths.RELAZIONE);
|
||||||
|
fileSetPaths.add(Concessione.Paths.IMMAGINI);
|
||||||
|
fileSetPaths.add(Concessione.Paths.POSIZIONAMENTO);
|
||||||
|
fileSetPaths.add(Concessione.Paths.PIANTE);
|
||||||
|
return fileSetPaths;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue