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.file.HeaderPresence;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
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.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.OperationMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||||
|
@ -517,7 +518,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
public String startCSVImport(CSVImportSession csvImportSession)
|
public String startCSVImport(CSVImportSession csvImportSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
// Export CSV
|
// Export CSV
|
||||||
/**
|
/**
|
||||||
* Start CSV Export and invokes the client library
|
* Start CSV Export and invokes the client library
|
||||||
|
@ -553,7 +553,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
ChangeTableTypeSession changeTableTypeSession)
|
ChangeTableTypeSession changeTableTypeSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Union and invokes the client library
|
* Start Union and invokes the client library
|
||||||
*
|
*
|
||||||
|
@ -575,7 +574,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
public String startEditRow(EditRowSession editRowSession)
|
public String startEditRow(EditRowSession editRowSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start delete rows
|
* Start delete rows
|
||||||
*
|
*
|
||||||
|
@ -586,8 +584,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
public String startDeleteRows(DeleteRowsSession deleteRowsSession)
|
public String startDeleteRows(DeleteRowsSession deleteRowsSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start operation on duplicates
|
* Start operation on duplicates
|
||||||
*
|
*
|
||||||
|
@ -600,8 +596,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
|
|
||||||
// Column Operation
|
// Column Operation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start change column type
|
* Start change column type
|
||||||
*
|
*
|
||||||
|
@ -614,7 +608,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
ChangeColumnTypeSession changeColumnTypeSession)
|
ChangeColumnTypeSession changeColumnTypeSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start add column
|
* Start add column
|
||||||
*
|
*
|
||||||
|
@ -625,7 +618,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
public String startAddColumn(AddColumnSession addColumnSession)
|
public String startAddColumn(AddColumnSession addColumnSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start delete column
|
* Start delete column
|
||||||
*
|
*
|
||||||
|
@ -646,8 +638,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
public String startLabelColumn(LabelColumnSession labelColumnSession)
|
public String startLabelColumn(LabelColumnSession labelColumnSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start split column
|
* Start split column
|
||||||
*
|
*
|
||||||
|
@ -658,8 +648,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
* splitColumnSession) throws TDGWTServiceException;
|
* splitColumnSession) throws TDGWTServiceException;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start merge column
|
* Start merge column
|
||||||
*
|
*
|
||||||
|
@ -670,8 +658,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
* mergeColumnSession) throws TDGWTServiceException;
|
* mergeColumnSession) throws TDGWTServiceException;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start group by
|
* Start group by
|
||||||
*
|
*
|
||||||
|
@ -695,7 +681,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
OccurrencesForReplaceBatchColumnSession occurrencesForReplaceBatchColumnSession)
|
OccurrencesForReplaceBatchColumnSession occurrencesForReplaceBatchColumnSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start batch replace on column
|
* Start batch replace on column
|
||||||
*
|
*
|
||||||
|
@ -728,8 +713,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
public ArrayList<TemplateData> getTemplates() throws TDGWTServiceException;
|
public ArrayList<TemplateData> getTemplates() throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Apply Template
|
* Start Apply Template
|
||||||
*
|
*
|
||||||
|
@ -758,6 +741,15 @@ public interface TDGWTService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> getLocales() throws TDGWTServiceException;
|
public ArrayList<String> getLocales() throws TDGWTServiceException;
|
||||||
|
|
||||||
|
// Licences
|
||||||
|
/**
|
||||||
|
* Retrieve licences supported
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public ArrayList<LicenceData> getLicences() throws TDGWTServiceException;
|
||||||
|
|
||||||
// History
|
// History
|
||||||
/**
|
/**
|
||||||
* Retrieve History
|
* Retrieve History
|
||||||
|
@ -825,7 +817,6 @@ public interface TDGWTService extends RemoteService {
|
||||||
CodelistMappingSession codelistMappingSession)
|
CodelistMappingSession codelistMappingSession)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Codelist Mapping Import
|
* Start Codelist Mapping Import
|
||||||
*
|
*
|
||||||
|
|
|
@ -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.file.HeaderPresence;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
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.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.OperationMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||||
|
@ -277,6 +278,9 @@ public interface TDGWTServiceAsync {
|
||||||
// Locales
|
// Locales
|
||||||
void getLocales(AsyncCallback<ArrayList<String>> callback);
|
void getLocales(AsyncCallback<ArrayList<String>> callback);
|
||||||
|
|
||||||
|
// Licences
|
||||||
|
void getLicences(AsyncCallback<ArrayList<LicenceData>> callback);
|
||||||
|
|
||||||
// History
|
// History
|
||||||
void getHistory(AsyncCallback<ArrayList<OpHistory>> callback);
|
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.CSVFileUploadSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.file.CodelistMappingFileUploadSession;
|
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.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.codelisthelper.CodelistMappingSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||||
|
@ -75,10 +76,10 @@ public class SessionUtil {
|
||||||
ASLSession session;
|
ASLSession session;
|
||||||
if (username == null) {
|
if (username == null) {
|
||||||
logger.warn("no user found in session, using test one");
|
logger.warn("no user found in session, using test one");
|
||||||
throw new TDGWTSessionExpiredException("Session Expired!");
|
/*throw new TDGWTSessionExpiredException("Session Expired!");*/
|
||||||
|
|
||||||
// Remove comment for Test
|
// Remove comment for Test
|
||||||
/*
|
|
||||||
username = Constants.DEFAULT_USER;
|
username = Constants.DEFAULT_USER;
|
||||||
String scope = Constants.DEFAULT_SCOPE;
|
String scope = Constants.DEFAULT_SCOPE;
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ public class SessionUtil {
|
||||||
session = SessionManager.getInstance().getASLSession(
|
session = SessionManager.getInstance().getASLSession(
|
||||||
httpSession.getId(), username);
|
httpSession.getId(), username);
|
||||||
session.setScope(scope);
|
session.setScope(scope);
|
||||||
*/
|
|
||||||
} else {
|
} else {
|
||||||
session = SessionManager.getInstance().getASLSession(
|
session = SessionManager.getInstance().getASLSession(
|
||||||
httpSession.getId(), username);
|
httpSession.getId(), username);
|
||||||
|
|
|
@ -8,12 +8,15 @@ import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
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.TabularResourceId;
|
||||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.AgencyMetadata;
|
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.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.NameMetadata;
|
||||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.RightsMetadata;
|
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.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.data.analysis.tabulardata.service.template.TemplateId;
|
||||||
import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryDescriptor;
|
import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryDescriptor;
|
||||||
import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryInterfaceType;
|
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.opexecution.OpExecutionDirector;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
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.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.OperationDefinitionMap;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TDTypeValueMap;
|
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.file.HeaderPresence;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
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.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.OperationMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorCreator;
|
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorCreator;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.monitor.OperationMonitorSession;
|
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.groupby.GroupBySession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRAgencyMetadata;
|
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.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.TRLocalizedText;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata;
|
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.TRNameMetadata;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRRightsMetadata;
|
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.DenormalizationSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.NormalizationSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.normalization.NormalizationSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
|
||||||
|
@ -471,8 +483,26 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
.setRight(((TRRightsMetadata) trMetadata)
|
.setRight(((TRRightsMetadata) trMetadata)
|
||||||
.getValue());
|
.getValue());
|
||||||
} else {
|
} 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 {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1484,6 +1514,46 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
tr.setMetadata(new RightsMetadata(tabResource.getRight()));
|
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.setAgency("");
|
||||||
}
|
}
|
||||||
t.setDate(sdf.format(tr.getCreationDate().getTime()));
|
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);
|
// logger.debug("TabResource: "+t);
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
|
@ -3005,8 +3115,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
.getValue());
|
.getValue());
|
||||||
listTRMetadata.add(trRightsMetadata);
|
listTRMetadata.add(trRightsMetadata);
|
||||||
} else {
|
} 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}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//TODO
|
|
||||||
public String startLabelColumn(LabelColumnSession labelColumnSession)
|
public String startLabelColumn(LabelColumnSession labelColumnSession)
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
|
@ -4274,6 +4407,45 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
tr.setMetadata(rights);
|
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 (tabResource.isFinalized()) {
|
||||||
if (!tr.isFinalized()) {
|
if (!tr.isFinalized()) {
|
||||||
tr.finalize();
|
tr.finalize();
|
||||||
|
@ -6027,4 +6199,40 @@ 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 right;
|
||||||
protected String validFrom;
|
protected String validFrom;
|
||||||
protected String validUntilTo;
|
protected String validUntilTo;
|
||||||
|
protected String licence;
|
||||||
protected Contacts owner;
|
protected Contacts owner;
|
||||||
protected boolean valid;
|
protected boolean valid;
|
||||||
protected boolean finalized;
|
protected boolean finalized;
|
||||||
|
@ -32,7 +33,7 @@ public class TabResource implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TabResource(String id, String name, String description,
|
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.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
@ -41,6 +42,7 @@ public class TabResource implements Serializable {
|
||||||
this.validFrom = validFrom;
|
this.validFrom = validFrom;
|
||||||
this.validUntilTo = validUntilTo;
|
this.validUntilTo = validUntilTo;
|
||||||
this.right = right;
|
this.right = right;
|
||||||
|
this.licence = licence;
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,15 +158,25 @@ public class TabResource implements Serializable {
|
||||||
this.validUntilTo = validUntilTo;
|
this.validUntilTo = validUntilTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLicence() {
|
||||||
|
return licence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicence(String licence) {
|
||||||
|
this.licence = licence;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TabResource [trId=" + trId + ", id=" + id + ", name=" + name
|
return "TabResource [trId=" + trId + ", id=" + id + ", name=" + name
|
||||||
+ ", description=" + description + ", agency=" + agency
|
+ ", description=" + description + ", agency=" + agency
|
||||||
+ ", date=" + date + ", right=" + right + ", validFrom="
|
+ ", date=" + date + ", right=" + right + ", validFrom="
|
||||||
+ validFrom + ", validUntilTo=" + validUntilTo + ", owner="
|
+ validFrom + ", validUntilTo=" + validUntilTo + ", licence="
|
||||||
+ owner + ", valid=" + valid + ", finalized=" + finalized + "]";
|
+ 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