Skip to content
Snippets Groups Projects
Commit 6db40fc6 authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-5661 : AS V3 API : Support for semantic annotations - create/get methods...

SSDM-5661 : AS V3 API : Support for semantic annotations - create/get methods (JS tests still missing) - bugfixes

SVN: 38757
parent 96de9c0d
No related branches found
No related tags found
No related merge requests found
...@@ -49,9 +49,11 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.DataSetPermId; ...@@ -49,9 +49,11 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.DataSetPermId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search.DataSetSearchCriteria; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search.DataSetSearchCriteria;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.DataStorePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.DataStorePermId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.IDataStoreId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.IDataStoreId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.id.IExperimentId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.id.IExperimentId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.ISampleId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.ISampleId;
import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.UnsupportedObjectIdException;
import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi; import ch.ethz.sis.openbis.generic.dssapi.v3.IDataStoreServerApi;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.dataset.create.FullDataSetCreation; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.dataset.create.FullDataSetCreation;
import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile; import ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.DataSetFile;
...@@ -92,6 +94,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.utils.PathInfoDataSourceProvi ...@@ -92,6 +94,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.utils.PathInfoDataSourceProvi
import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.RolesAllowed; import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.RolesAllowed;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy;
import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.IQueryApiServer; import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.IQueryApiServer;
import net.lemnik.eodsql.QueryTool; import net.lemnik.eodsql.QueryTool;
/** /**
...@@ -356,31 +359,44 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp ...@@ -356,31 +359,44 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp
ownerType = DataSetOwnerType.EXPERIMENT; ownerType = DataSetOwnerType.EXPERIMENT;
owner = new NewDataSetDTO.DataSetOwner(ownerType, experimentIdentifier.toString()); owner = new NewDataSetDTO.DataSetOwner(ownerType, experimentIdentifier.toString());
} }
if(owner == null) { if (owner == null)
{
throw new UserFailureException("A dataset needs either a Sample or Experiment as owner."); throw new UserFailureException("A dataset needs either a Sample or Experiment as owner.");
} }
IEntityTypeId typeId = dataSetCreation.getMetadataCreation().getTypeId(); IEntityTypeId typeId = dataSetCreation.getMetadataCreation().getTypeId();
String typeCode = null;
if (typeId != null)
{
if (typeId instanceof EntityTypePermId)
{
typeCode = ((EntityTypePermId) typeId).getPermId();
} else
{
throw new UnsupportedObjectIdException(typeId);
}
}
List<FileInfoDssDTO> fileInfos = FileInfoDssBuilder.getFileInfos(temporaryIncomingDir); List<FileInfoDssDTO> fileInfos = FileInfoDssBuilder.getFileInfos(temporaryIncomingDir);
NewDataSetDTO dataSet = new NewDataSetDTO(typeId.toString(), owner, null, fileInfos); NewDataSetDTO dataSet = new NewDataSetDTO(typeCode, owner, null, fileInfos);
return dataSet; return dataSet;
} }
private List<FullDataSetCreation> filterPhysicalDataSets(List<FullDataSetCreation> newDataSets) private List<FullDataSetCreation> filterPhysicalDataSets(List<FullDataSetCreation> newDataSets)
{ {
return newDataSets return newDataSets
.stream() .stream()
.filter((dataSetCreation) -> dataSetCreation.getMetadataCreation().getPhysicalData() != null) .filter((dataSetCreation) -> dataSetCreation.getMetadataCreation().getPhysicalData() != null)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
private List<FullDataSetCreation> filterNonPhysicalDataSets(List<FullDataSetCreation> newDataSets) private List<FullDataSetCreation> filterNonPhysicalDataSets(List<FullDataSetCreation> newDataSets)
{ {
return newDataSets return newDataSets
.stream() .stream()
.filter((dataSetCreation) -> dataSetCreation.getMetadataCreation().getPhysicalData() == null) .filter((dataSetCreation) -> dataSetCreation.getMetadataCreation().getPhysicalData() == null)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@Override @Override
...@@ -442,29 +458,37 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp ...@@ -442,29 +458,37 @@ public class DataStoreServerApi extends AbstractDssServiceRpc<IDataStoreServerAp
for (FullDataSetCreation dataSetCreation : newDataSets) for (FullDataSetCreation dataSetCreation : newDataSets)
{ {
PutDataSetService putService = PutDataSetService putService =
new PutDataSetService(ServiceProvider.getOpenBISService(), operationLog); new PutDataSetService(ServiceProvider.getOpenBISService(), operationLog);
putService.setStoreDirectory(ServiceProvider.getConfigProvider().getStoreRoot()); putService.setStoreDirectory(ServiceProvider.getConfigProvider().getStoreRoot());
NewDataSetDTO newDataset; NewDataSetDTO newDataset;
try try
{ DataSetCreation metadataCreation = dataSetCreation.getMetadataCreation(); {
DataSetCreation metadataCreation = dataSetCreation.getMetadataCreation();
CreationId creationId = metadataCreation.getCreationId(); CreationId creationId = metadataCreation.getCreationId();
String dataSetTypeCodeNull = null; String dataSetTypeCodeNull = null;
IEntityTypeId typeId = metadataCreation.getTypeId(); IEntityTypeId typeId = metadataCreation.getTypeId();
if(null != typeId) { if (null != typeId)
dataSetTypeCodeNull = typeId.toString(); {
if (typeId instanceof EntityTypePermId)
{
dataSetTypeCodeNull = ((EntityTypePermId) typeId).getPermId();
} else
{
throw new UnsupportedObjectIdException(typeId);
}
} }
File temporaryIncomingDir = putService.getTemporaryIncomingDir(dataSetTypeCodeNull, creationId.toString()); File temporaryIncomingDir = putService.getTemporaryIncomingDir(dataSetTypeCodeNull, creationId.toString());
newDataset = getNewDataSet(dataSetCreation, temporaryIncomingDir); newDataset = getNewDataSet(dataSetCreation, temporaryIncomingDir);
String code = dataSetCreation.getMetadataCreation().getCode(); String code = dataSetCreation.getMetadataCreation().getCode();
putService.putDataSet(sessionToken, newDataset, creationId.toString(), code); putService.putDataSet(sessionToken, newDataset, creationId.toString(), code);
} catch (IOException e) } catch (IOException e)
{ {
operationLog.error(e.getMessage()); operationLog.error(e.getMessage());
} }
} }
} }
private void injectDataStoreIdAndCodesIfNeeded(List<FullDataSetCreation> newDataSets) private void injectDataStoreIdAndCodesIfNeeded(List<FullDataSetCreation> newDataSets)
{ {
String dataStoreCode = configProvider.getDataStoreCode(); String dataStoreCode = configProvider.getDataStoreCode();
......
...@@ -127,4 +127,4 @@ GRANT SELECT ON TABLE METAPROJECTS TO GROUP OPENBIS_READONLY; ...@@ -127,4 +127,4 @@ GRANT SELECT ON TABLE METAPROJECTS TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE METAPROJECT_ASSIGNMENTS_ALL TO GROUP OPENBIS_READONLY; GRANT SELECT ON TABLE METAPROJECT_ASSIGNMENTS_ALL TO GROUP OPENBIS_READONLY;
GRANT SELECT ON METAPROJECT_ASSIGNMENTS TO GROUP OPENBIS_READONLY; GRANT SELECT ON METAPROJECT_ASSIGNMENTS TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE OPERATION_EXECUTIONS TO GROUP OPENBIS_READONLY; GRANT SELECT ON TABLE OPERATION_EXECUTIONS TO GROUP OPENBIS_READONLY;
GRANT SELECT ON TABLE ANNOTATIONS TO GROUP OPENBIS_READONLY; GRANT SELECT ON TABLE SEMANTIC_ANNOTATIONS TO GROUP OPENBIS_READONLY;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment