2021-09-23 18:18:02 +02:00
|
|
|
package org.gcube.portlets.user.geoportaldataviewer;
|
|
|
|
|
|
|
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
|
|
import org.gcube.common.scope.api.ScopeProvider;
|
|
|
|
|
|
|
|
public class ConcessioneReader {
|
|
|
|
|
|
|
|
private static final String YOUR_TOKEN = "";
|
|
|
|
|
|
|
|
public static String SCOPE = "/gcube/devsec/devVRE";
|
|
|
|
public static String mongoConcessioneID = "6102c07002ad3d05b5f81ddc";
|
|
|
|
|
|
|
|
//@Before
|
|
|
|
public void setEnviroment() {
|
|
|
|
ScopeProvider.instance.set(SCOPE);
|
|
|
|
SecurityTokenProvider.instance.set(YOUR_TOKEN);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//@Test
|
|
|
|
public void readConcessione() throws Exception {
|
|
|
|
System.out.println("getConcessioneForId " + mongoConcessioneID + "called");
|
|
|
|
|
2022-10-11 15:00:39 +02:00
|
|
|
/*ConcessioneDV concessionDV = null;
|
2021-09-23 18:18:02 +02:00
|
|
|
|
|
|
|
if (mongoConcessioneID == null)
|
|
|
|
throw new Exception("Invalid parameter. The Id is null");
|
|
|
|
|
|
|
|
try {
|
|
|
|
System.out.println("Trying to get record for id " + mongoConcessioneID);
|
|
|
|
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
|
|
|
Concessione concessione = concessioniManager.getById(mongoConcessioneID);
|
|
|
|
System.out.println("For id " + mongoConcessioneID + ", got concessione " + concessione);
|
|
|
|
System.out.println("Immagini Rappresentative are: " + concessione.getImmaginiRappresentative());
|
|
|
|
System.out.println("Relazione scavo: " + concessione.getRelazioneScavo());
|
|
|
|
System.out.println("Pianta Fine scavo: " + concessione.getPianteFineScavo());
|
|
|
|
System.out.println("Posizionamento scavo: " + concessione.getPosizionamentoScavo());
|
|
|
|
|
|
|
|
if (concessione != null) {
|
|
|
|
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (concessionDV == null)
|
|
|
|
throw new Exception("Concessione not retrieved");
|
|
|
|
|
|
|
|
System.out.println("Got concessione: " + concessionDV);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
String erroMsg = Concessione.class.getSimpleName() + " with id " + mongoConcessioneID + " not available";
|
|
|
|
throw new Exception(erroMsg);
|
2022-10-11 15:00:39 +02:00
|
|
|
}*/
|
2021-09-23 18:18:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|