Added Licences
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@99403 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d2825e5bf7
commit
f7f1b4498e
|
@ -16,6 +16,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
|
@ -517,7 +518,6 @@ public interface TDGWTService extends RemoteService {
|
|||
public String startCSVImport(CSVImportSession csvImportSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
// Export CSV
|
||||
/**
|
||||
* Start CSV Export and invokes the client library
|
||||
|
@ -541,7 +541,7 @@ public interface TDGWTService extends RemoteService {
|
|||
throws TDGWTServiceException;
|
||||
|
||||
// Table Operations
|
||||
|
||||
|
||||
/**
|
||||
* Start change table type
|
||||
*
|
||||
|
@ -553,7 +553,6 @@ public interface TDGWTService extends RemoteService {
|
|||
ChangeTableTypeSession changeTableTypeSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Start Union and invokes the client library
|
||||
*
|
||||
|
@ -575,7 +574,6 @@ public interface TDGWTService extends RemoteService {
|
|||
public String startEditRow(EditRowSession editRowSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Start delete rows
|
||||
*
|
||||
|
@ -586,8 +584,6 @@ public interface TDGWTService extends RemoteService {
|
|||
public String startDeleteRows(DeleteRowsSession deleteRowsSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start operation on duplicates
|
||||
*
|
||||
|
@ -600,8 +596,6 @@ public interface TDGWTService extends RemoteService {
|
|||
|
||||
// Column Operation
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start change column type
|
||||
*
|
||||
|
@ -614,10 +608,9 @@ public interface TDGWTService extends RemoteService {
|
|||
ChangeColumnTypeSession changeColumnTypeSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Start add column
|
||||
*
|
||||
*
|
||||
* @param addColumnSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
|
@ -625,7 +618,6 @@ public interface TDGWTService extends RemoteService {
|
|||
public String startAddColumn(AddColumnSession addColumnSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Start delete column
|
||||
*
|
||||
|
@ -646,8 +638,6 @@ public interface TDGWTService extends RemoteService {
|
|||
public String startLabelColumn(LabelColumnSession labelColumnSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start split column
|
||||
*
|
||||
|
@ -658,8 +648,6 @@ public interface TDGWTService extends RemoteService {
|
|||
* splitColumnSession) throws TDGWTServiceException;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start merge column
|
||||
*
|
||||
|
@ -670,8 +658,6 @@ public interface TDGWTService extends RemoteService {
|
|||
* mergeColumnSession) throws TDGWTServiceException;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start group by
|
||||
*
|
||||
|
@ -695,7 +681,6 @@ public interface TDGWTService extends RemoteService {
|
|||
OccurrencesForReplaceBatchColumnSession occurrencesForReplaceBatchColumnSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Start batch replace on column
|
||||
*
|
||||
|
@ -728,8 +713,6 @@ public interface TDGWTService extends RemoteService {
|
|||
*/
|
||||
public ArrayList<TemplateData> getTemplates() throws TDGWTServiceException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start Apply Template
|
||||
*
|
||||
|
@ -758,6 +741,15 @@ public interface TDGWTService extends RemoteService {
|
|||
*/
|
||||
public ArrayList<String> getLocales() throws TDGWTServiceException;
|
||||
|
||||
// Licences
|
||||
/**
|
||||
* Retrieve licences supported
|
||||
*
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public ArrayList<LicenceData> getLicences() throws TDGWTServiceException;
|
||||
|
||||
// History
|
||||
/**
|
||||
* Retrieve History
|
||||
|
@ -815,7 +807,7 @@ public interface TDGWTService extends RemoteService {
|
|||
public void setCodelistMappingSession(
|
||||
CodelistMappingSession codelistMappingSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param codelistMappingSession
|
||||
|
@ -825,10 +817,9 @@ public interface TDGWTService extends RemoteService {
|
|||
CodelistMappingSession codelistMappingSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Start Codelist Mapping Import
|
||||
*
|
||||
*
|
||||
* @param codelistMappingSession
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
|
@ -276,7 +277,10 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
// Locales
|
||||
void getLocales(AsyncCallback<ArrayList<String>> callback);
|
||||
|
||||
|
||||
// Licences
|
||||
void getLicences(AsyncCallback<ArrayList<LicenceData>> callback);
|
||||
|
||||
// History
|
||||
void getHistory(AsyncCallback<ArrayList<OpHistory>> callback);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|||
import org.gcube.portlets.user.td.gwtservice.server.file.CSVFileUploadSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.codelisthelper.CodelistMappingSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
|
@ -75,10 +76,10 @@ public class SessionUtil {
|
|||
ASLSession session;
|
||||
if (username == null) {
|
||||
logger.warn("no user found in session, using test one");
|
||||
throw new TDGWTSessionExpiredException("Session Expired!");
|
||||
/*throw new TDGWTSessionExpiredException("Session Expired!");*/
|
||||
|
||||
// Remove comment for Test
|
||||
/*
|
||||
|
||||
username = Constants.DEFAULT_USER;
|
||||
String scope = Constants.DEFAULT_SCOPE;
|
||||
|
||||
|
@ -86,7 +87,7 @@ public class SessionUtil {
|
|||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
session.setScope(scope);
|
||||
*/
|
||||
|
||||
} else {
|
||||
session = SessionManager.getInstance().getASLSession(
|
||||
httpSession.getId(), username);
|
||||
|
|
|
@ -8,12 +8,15 @@ import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -86,9 +89,13 @@ import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
|
|||
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.AgencyMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.DescriptionMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.Licence;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.LicenceMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.NameMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.RightsMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.TabularResourceMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.ValidSinceMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.ValidUntilMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.service.template.TemplateId;
|
||||
import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryDescriptor;
|
||||
import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryInterfaceType;
|
||||
|
@ -120,6 +127,7 @@ import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecution4Unio
|
|||
import org.gcube.portlets.user.td.gwtservice.server.opexecution.OpExecutionDirector;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractReferences;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.LicenceMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TDTypeValueMap;
|
||||
|
@ -142,6 +150,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorCreator;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||
|
@ -185,10 +194,13 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnT
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.tr.groupby.GroupBySession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRAgencyMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRDescriptionMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRLicenceMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRLocalizedText;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRNameMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRRightsMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRValidSinceMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRValidUntilMetadata;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.DenormalizationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.NormalizationSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
||||
|
@ -471,7 +483,25 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
.setRight(((TRRightsMetadata) trMetadata)
|
||||
.getValue());
|
||||
} else {
|
||||
if (trMetadata instanceof TRValidSinceMetadata) {
|
||||
tabResource
|
||||
.setValidFrom(((TRValidSinceMetadata) trMetadata)
|
||||
.getValue());
|
||||
} else {
|
||||
if (trMetadata instanceof TRValidUntilMetadata) {
|
||||
tabResource
|
||||
.setValidUntilTo(((TRValidUntilMetadata) trMetadata)
|
||||
.getValue());
|
||||
} else {
|
||||
if (trMetadata instanceof TRLicenceMetadata) {
|
||||
tabResource
|
||||
.setLicence(((TRLicenceMetadata) trMetadata)
|
||||
.getValue());
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1483,7 +1513,47 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
tr.setMetadata(new AgencyMetadata(tabResource.getAgency()));
|
||||
}
|
||||
tr.setMetadata(new RightsMetadata(tabResource.getRight()));
|
||||
|
||||
|
||||
if(tabResource.getValidFrom()!=null&& !tabResource.getValidFrom().isEmpty()){
|
||||
try{
|
||||
Date dateF=sdfDate.parse(tabResource.getValidFrom());
|
||||
Calendar validFromC= Calendar.getInstance();
|
||||
validFromC.setTime(dateF);
|
||||
ValidSinceMetadata validSince=new ValidSinceMetadata();
|
||||
validSince.setValue(validFromC);
|
||||
tr.setMetadata(validSince);
|
||||
} catch(ParseException e){
|
||||
logger.info("ValidFromMetadata is not set, no valid calendar present");
|
||||
}
|
||||
}
|
||||
|
||||
if(tabResource.getValidUntilTo()!=null&& !tabResource.getValidUntilTo().isEmpty()){
|
||||
try{
|
||||
Date dateU=sdfDate.parse(tabResource.getValidUntilTo());
|
||||
Calendar validUntilToC= Calendar.getInstance();
|
||||
validUntilToC.setTime(dateU);
|
||||
ValidUntilMetadata validUntil=new ValidUntilMetadata();
|
||||
validUntil.setValue(validUntilToC);
|
||||
tr.setMetadata(validUntil);
|
||||
} catch(ParseException e){
|
||||
logger.info("ValidUntilMetadata is not set, no valid calendar present");
|
||||
}
|
||||
}
|
||||
|
||||
if(tabResource.getLicence()!=null && !tabResource.getLicence().isEmpty()){
|
||||
LicenceMetadata licenceMetadata=new LicenceMetadata();
|
||||
Licence licence=LicenceMap.map(tabResource.getLicence());
|
||||
if(licence!=null){
|
||||
licenceMetadata.setValue(licence);
|
||||
tr.setMetadata(licenceMetadata);
|
||||
} else {
|
||||
logger.error("Licence type not found: "+tabResource.getLicence());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1543,6 +1613,46 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
t.setAgency("");
|
||||
}
|
||||
t.setDate(sdf.format(tr.getCreationDate().getTime()));
|
||||
|
||||
if (tr.contains(ValidSinceMetadata.class)) {
|
||||
ValidSinceMetadata validSinceMeta = tr
|
||||
.getMetadata(ValidSinceMetadata.class);
|
||||
if (validSinceMeta != null && validSinceMeta.getValue() != null) {
|
||||
Calendar validSinceC=validSinceMeta.getValue();
|
||||
t.setValidFrom(sdfDate.format(validSinceC));
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if (tr.contains(ValidUntilMetadata.class)) {
|
||||
ValidUntilMetadata validUntilMeta = tr
|
||||
.getMetadata(ValidUntilMetadata.class);
|
||||
if (validUntilMeta != null && validUntilMeta.getValue() != null) {
|
||||
Calendar validUntilC=validUntilMeta.getValue();
|
||||
t.setValidUntilTo(sdfDate.format(validUntilC));
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if (tr.contains(LicenceMetadata.class)) {
|
||||
LicenceMetadata licenceMeta = tr
|
||||
.getMetadata(LicenceMetadata.class);
|
||||
if (licenceMeta != null && licenceMeta.getValue() != null) {
|
||||
t.setLicence(licenceMeta.getValue().toString());
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// logger.debug("TabResource: "+t);
|
||||
return t;
|
||||
|
||||
|
@ -3005,7 +3115,32 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
.getValue());
|
||||
listTRMetadata.add(trRightsMetadata);
|
||||
} else {
|
||||
if (trMetadata instanceof ValidSinceMetadata) {
|
||||
TRValidSinceMetadata validSinceMetadata = new TRValidSinceMetadata();
|
||||
Calendar cal= ((ValidSinceMetadata) trMetadata)
|
||||
.getValue();
|
||||
validSinceMetadata
|
||||
.setValue(sdfDate.format(cal.getTime()));
|
||||
listTRMetadata.add(validSinceMetadata);
|
||||
} else {
|
||||
if (trMetadata instanceof ValidUntilMetadata) {
|
||||
TRValidUntilMetadata validUntilMetadata = new TRValidUntilMetadata();
|
||||
Calendar cal= ((ValidUntilMetadata) trMetadata)
|
||||
.getValue();
|
||||
validUntilMetadata
|
||||
.setValue(sdfDate.format(cal.getTime()));
|
||||
listTRMetadata.add(validUntilMetadata);
|
||||
} else {
|
||||
if (trMetadata instanceof LicenceMetadata) {
|
||||
TRLicenceMetadata licenceMetadata = new TRLicenceMetadata();
|
||||
licenceMetadata
|
||||
.setValue(((LicenceMetadata) trMetadata).getValue().toString());
|
||||
listTRMetadata.add(licenceMetadata);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3683,8 +3818,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
//TODO
|
||||
public String startLabelColumn(LabelColumnSession labelColumnSession)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
|
@ -4273,7 +4406,46 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
tabResource.getRight());
|
||||
tr.setMetadata(rights);
|
||||
}
|
||||
|
||||
if(tabResource.getValidFrom()!=null&& !tabResource.getValidFrom().isEmpty()){
|
||||
try{
|
||||
Date dateF=sdfDate.parse(tabResource.getValidFrom());
|
||||
Calendar validFromC= Calendar.getInstance();
|
||||
validFromC.setTime(dateF);
|
||||
ValidSinceMetadata validSince=new ValidSinceMetadata();
|
||||
validSince.setValue(validFromC);
|
||||
tr.setMetadata(validSince);
|
||||
} catch(ParseException e){
|
||||
logger.info("ValidFromMetadata is not set, no valid calendar present");
|
||||
}
|
||||
}
|
||||
|
||||
if(tabResource.getValidUntilTo()!=null&& !tabResource.getValidUntilTo().isEmpty()){
|
||||
try{
|
||||
Date dateU=sdfDate.parse(tabResource.getValidUntilTo());
|
||||
Calendar validUntilToC= Calendar.getInstance();
|
||||
validUntilToC.setTime(dateU);
|
||||
ValidUntilMetadata validUntil=new ValidUntilMetadata();
|
||||
validUntil.setValue(validUntilToC);
|
||||
tr.setMetadata(validUntil);
|
||||
} catch(ParseException e){
|
||||
logger.info("ValidUntilMetadata is not set, no valid calendar present");
|
||||
}
|
||||
}
|
||||
|
||||
if(tabResource.getLicence()!=null && !tabResource.getLicence().isEmpty()){
|
||||
LicenceMetadata licenceMetadata=new LicenceMetadata();
|
||||
Licence licence=LicenceMap.map(tabResource.getLicence());
|
||||
if(licence!=null){
|
||||
licenceMetadata.setValue(licence);
|
||||
tr.setMetadata(licenceMetadata);
|
||||
} else {
|
||||
logger.error("Licence type not found: "+tabResource.getLicence());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (tabResource.isFinalized()) {
|
||||
if (!tr.isFinalized()) {
|
||||
tr.finalize();
|
||||
|
@ -6026,5 +6198,41 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<LicenceData> getLicences() throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.getAslSession(session);
|
||||
|
||||
ArrayList<LicenceData> licences=new ArrayList<LicenceData>();
|
||||
Licence[] licencesArray=Licence.values();
|
||||
Licence licence;
|
||||
LicenceData licenceData;
|
||||
for(int i=0; i<licencesArray.length;i++){
|
||||
licence=licencesArray[i];
|
||||
licenceData=new LicenceData(i, licence.toString());
|
||||
licences.add(licenceData);
|
||||
}
|
||||
|
||||
logger.debug("Licences: "+licences.size());
|
||||
return licences;
|
||||
|
||||
} catch (TDGWTSessionExpiredException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Security exception, you haven't rights!");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error in get Licences: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.server.trservice;
|
||||
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.Licence;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class LicenceMap {
|
||||
|
||||
public static Licence map(String licence){
|
||||
Licence[] licences=Licence.values();
|
||||
for(int i=0; i<licences.length; i++){
|
||||
if(licences[i].toString().compareTo(licence)==0){
|
||||
return licences[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.licenses;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class LicenceData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1489720811451521606L;
|
||||
protected int id; // For insert in table only
|
||||
protected String licence; // licence
|
||||
|
||||
public LicenceData(){
|
||||
super();
|
||||
}
|
||||
|
||||
public LicenceData(int id, String licence) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.licence = licence;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLicence() {
|
||||
return licence;
|
||||
}
|
||||
|
||||
public void setLicence(String licence) {
|
||||
this.licence = licence;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LicenceData [id=" + id + ", licence=" + licence + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -24,6 +24,7 @@ public class TabResource implements Serializable {
|
|||
protected String right;
|
||||
protected String validFrom;
|
||||
protected String validUntilTo;
|
||||
protected String licence;
|
||||
protected Contacts owner;
|
||||
protected boolean valid;
|
||||
protected boolean finalized;
|
||||
|
@ -32,7 +33,7 @@ public class TabResource implements Serializable {
|
|||
}
|
||||
|
||||
public TabResource(String id, String name, String description,
|
||||
String agency, String date, String right, String validFrom, String validUntilTo, TRId trId) {
|
||||
String agency, String date, String right, String validFrom, String validUntilTo, String licence, TRId trId) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
|
@ -41,6 +42,7 @@ public class TabResource implements Serializable {
|
|||
this.validFrom = validFrom;
|
||||
this.validUntilTo = validUntilTo;
|
||||
this.right = right;
|
||||
this.licence = licence;
|
||||
this.trId = trId;
|
||||
}
|
||||
|
||||
|
@ -155,16 +157,26 @@ public class TabResource implements Serializable {
|
|||
public void setValidUntilTo(String validUntilTo) {
|
||||
this.validUntilTo = validUntilTo;
|
||||
}
|
||||
|
||||
public String getLicence() {
|
||||
return licence;
|
||||
}
|
||||
|
||||
public void setLicence(String licence) {
|
||||
this.licence = licence;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TabResource [trId=" + trId + ", id=" + id + ", name=" + name
|
||||
+ ", description=" + description + ", agency=" + agency
|
||||
+ ", date=" + date + ", right=" + right + ", validFrom="
|
||||
+ validFrom + ", validUntilTo=" + validUntilTo + ", owner="
|
||||
+ owner + ", valid=" + valid + ", finalized=" + finalized + "]";
|
||||
+ validFrom + ", validUntilTo=" + validUntilTo + ", licence="
|
||||
+ licence + ", owner=" + owner + ", valid=" + valid
|
||||
+ ", finalized=" + finalized + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.tr.metadata;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TRLicenceMetadata implements TRMetadata {
|
||||
|
||||
private static final long serialVersionUID = 4127072595380574045L;
|
||||
String id="LicenceMetadata";
|
||||
String title="Licence";
|
||||
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TRLicenceMetadata [id=" + id + ", title=" + title + ", value="
|
||||
+ value + "]";
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.tr.metadata;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TRValidSinceMetadata implements TRMetadata {
|
||||
|
||||
private static final long serialVersionUID = 5425320654892310426L;
|
||||
String id="ValidSinceMetadata";
|
||||
String title="Valid Since";
|
||||
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TRValidSinceMetadata [value=" + value + "]";
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.tr.metadata;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TRValidUntilMetadata implements TRMetadata {
|
||||
|
||||
private static final long serialVersionUID = 4127072595380574045L;
|
||||
String id="ValidUntilMetadata";
|
||||
String title="Valid Until";
|
||||
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TRValidUntilMetadata [value=" + value + "]";
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue