Skip to content
Snippets Groups Projects
Commit 286d680d authored by pkupczyk's avatar pkupczyk
Browse files

SSDM-1771 : V3 AS API - create tests to verify whether the capabilities work in the new API

SVN: 34372
parent cbc2604d
No related branches found
No related tags found
No related merge requests found
Showing
with 499 additions and 38 deletions
REGISTER_PROJECT: SPACE_OBSERVER
\ No newline at end of file
......@@ -258,7 +258,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.SPACE_ADMIN, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("REGISTER_SPACE")
@Capability("CREATE_SPACE")
@DatabaseCreateOrDeleteModification(value = ObjectKind.SPACE)
public List<SpacePermId> createSpaces(String sessionToken, List<SpaceCreation> creations)
{
......@@ -268,7 +268,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.SPACE_POWER_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("REGISTER_PROJECT")
@Capability("CREATE_PROJECT")
@DatabaseCreateOrDeleteModification(value = ObjectKind.PROJECT)
public List<ProjectPermId> createProjects(String sessionToken, List<ProjectCreation> creations)
{
......@@ -278,7 +278,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("WRITE_EXPERIMENT")
@Capability("CREATE_EXPERIMENT")
@DatabaseCreateOrDeleteModification(value = ObjectKind.EXPERIMENT)
public List<ExperimentPermId> createExperiments(String sessionToken,
List<ExperimentCreation> creations)
......@@ -289,7 +289,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("WRITE_SAMPLE")
@Capability("CREATE_SAMPLE")
@DatabaseCreateOrDeleteModification(value = ObjectKind.SAMPLE)
public List<SamplePermId> createSamples(String sessionToken,
List<SampleCreation> creations)
......@@ -300,7 +300,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.INSTANCE_ADMIN, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("WRITE_MATERIAL")
@Capability("CREATE_MATERIAL")
@DatabaseCreateOrDeleteModification(value = ObjectKind.MATERIAL)
public List<MaterialPermId> createMaterials(String sessionToken, List<MaterialCreation> creations)
{
......@@ -320,7 +320,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.SPACE_POWER_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("WRITE_PROJECT")
@Capability("UPDATE_PROJECT")
@DatabaseUpdateModification(value = ObjectKind.PROJECT)
public void updateProjects(String sessionToken, List<ProjectUpdate> updates)
{
......@@ -330,7 +330,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("WRITE_EXPERIMENT")
@Capability("UPDATE_EXPERIMENT")
@DatabaseUpdateModification(value = ObjectKind.EXPERIMENT)
public void updateExperiments(String sessionToken, List<ExperimentUpdate> updates)
{
......@@ -340,7 +340,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("WRITE_SAMPLE")
@Capability("UPDATE_SAMPLE")
@DatabaseUpdateModification(value = ObjectKind.SAMPLE)
public void updateSamples(String sessionToken, List<SampleUpdate> updates)
{
......@@ -360,7 +360,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override
@Transactional
@RolesAllowed({ RoleWithHierarchy.SPACE_POWER_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("WRITE_DATASET")
@Capability("UPDATE_DATASET")
@DatabaseUpdateModification(value = ObjectKind.DATA_SET)
public void updateDataSets(String sessionToken, List<DataSetUpdate> updates)
{
......@@ -510,7 +510,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Transactional
@DatabaseCreateOrDeleteModification(value = { ObjectKind.DATA_SET, ObjectKind.DELETION })
@RolesAllowed({ RoleWithHierarchy.SPACE_POWER_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("DELETE_DATA_SET")
@Capability("DELETE_DATASET")
public IDeletionId deleteDataSets(String sessionToken, List<? extends IDataSetId> dataSetIds, DataSetDeletionOptions deletionOptions)
{
return deleteDataSetExecutor.delete(sessionToken, dataSetIds, deletionOptions);
......@@ -539,7 +539,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@DatabaseCreateOrDeleteModification(value = ObjectKind.DELETION)
@DatabaseUpdateModification(value = { ObjectKind.EXPERIMENT, ObjectKind.SAMPLE, ObjectKind.DATA_SET })
@RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("RESTORE")
@Capability("REVERT_DELETION")
public void revertDeletions(String sessionToken, List<? extends IDeletionId> deletionIds)
{
revertDeletionExecutor.revert(sessionToken, deletionIds);
......@@ -549,7 +549,7 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Transactional
@DatabaseCreateOrDeleteModification(value = { ObjectKind.DELETION, ObjectKind.EXPERIMENT, ObjectKind.SAMPLE, ObjectKind.DATA_SET })
@RolesAllowed({ RoleWithHierarchy.SPACE_ADMIN, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("PURGE")
@Capability("CONFIRM_DELETION")
public void confirmDeletions(String sessionToken, List<? extends IDeletionId> deletionIds)
{
confirmDeletionExecutor.confirm(sessionToken, deletionIds);
......
......@@ -18,12 +18,13 @@ package ch.ethz.sis.openbis.generic.server.api.v3.context;
import java.util.Collection;
import ch.systemsx.cisd.openbis.generic.shared.dto.IAuthSessionProvider;
import ch.systemsx.cisd.openbis.generic.shared.dto.Session;
/**
* @author pkupczyk
*/
public interface IContext
public interface IContext extends IAuthSessionProvider
{
public void pushContextDescription(String description);
......@@ -32,6 +33,7 @@ public interface IContext
public Collection<String> getContextDescriptions();
@Override
public Session getSession();
public Object getAttribute(String attributeName);
......
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.attachment;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.AttachmentListUpdateValue;
import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentHolderPE;
/**
* @author pkupczyk
*/
public interface IAbstractUpdateAttachmentForEntityExecutor
{
public void update(IOperationContext context, AttachmentHolderPE attachmentHolder, AttachmentListUpdateValue updates);
}
......@@ -16,16 +16,10 @@
package ch.ethz.sis.openbis.generic.server.api.v3.executor.attachment;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.AttachmentListUpdateValue;
import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentHolderPE;
/**
* @author pkupczyk
*/
public interface IUpdateAttachmentForEntityExecutor
public interface IUpdateAttachmentForEntityExecutor extends IAbstractUpdateAttachmentForEntityExecutor
{
public void update(IOperationContext context, AttachmentHolderPE attachmentHolder, AttachmentListUpdateValue updates);
}
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.dataset;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IAbstractUpdateEntityPropertyExecutor;
/**
* @author pkupczyk
*/
public interface IUpdateDataSetPropertyExecutor extends IAbstractUpdateEntityPropertyExecutor
{
}
......@@ -27,7 +27,6 @@ import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractUpdateEntityExecutor;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IUpdateEntityPropertyExecutor;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.tag.IUpdateTagForEntityExecutor;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetUpdate;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.dataset.IDataSetId;
......@@ -67,7 +66,7 @@ public class UpdateDataSetExecutor extends AbstractUpdateEntityExecutor<DataSetU
private IUpdateDataSetRelatedDataSetsExecutor updateDataSetRelatedDataSetsExecutor;
@Autowired
private IUpdateEntityPropertyExecutor updateEntityPropertyExecutor;
private IUpdateDataSetPropertyExecutor updateDataSetPropertyExecutor;
@Autowired
private IUpdateTagForEntityExecutor updateTagForEntityExecutor;
......@@ -120,10 +119,17 @@ public class UpdateDataSetExecutor extends AbstractUpdateEntityExecutor<DataSetU
RelationshipUtils.updateModificationDateAndModifier(entity, context.getSession().tryGetPerson());
updateTagForEntityExecutor.update(context, entity, update.getTagIds());
propertyMap.put(entity, update.getProperties());
if (update.getProperties() != null && false == update.getProperties().isEmpty())
{
propertyMap.put(entity, update.getProperties());
}
}
updateEntityPropertyExecutor.update(context, propertyMap);
if (false == propertyMap.isEmpty())
{
updateDataSetPropertyExecutor.update(context, propertyMap);
}
}
@Override
......
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.dataset;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IUpdateEntityPropertyExecutor;
import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.Capability;
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.dto.IEntityPropertiesHolder;
/**
* @author pkupczyk
*/
@Component
public class UpdateDataSetPropertyExecutor implements IUpdateDataSetPropertyExecutor
{
@Autowired
private IUpdateEntityPropertyExecutor executor;
@Override
@RolesAllowed({ RoleWithHierarchy.SPACE_POWER_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("UPDATE_DATASET_PROPERTY")
public void update(IOperationContext context, Map<IEntityPropertiesHolder, Map<String, String>> entityToPropertiesMap)
{
executor.update(context, entityToPropertiesMap);
}
}
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.experiment;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.attachment.IAbstractUpdateAttachmentForEntityExecutor;
/**
* @author pkupczyk
*/
public interface IUpdateExperimentAttachmentExecutor extends IAbstractUpdateAttachmentForEntityExecutor
{
}
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.experiment;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IAbstractUpdateEntityPropertyExecutor;
/**
* @author pkupczyk
*/
public interface IUpdateExperimentPropertyExecutor extends IAbstractUpdateEntityPropertyExecutor
{
}
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.experiment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.attachment.IUpdateAttachmentForEntityExecutor;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.AttachmentListUpdateValue;
import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.Capability;
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.dto.AttachmentHolderPE;
/**
* @author pkupczyk
*/
@Component
public class UpdateExperimentAttachmentExecutor implements IUpdateExperimentAttachmentExecutor
{
@Autowired
private IUpdateAttachmentForEntityExecutor executor;
@Override
@RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("UPDATE_EXPERIMENT_ATTACHMENT")
public void update(IOperationContext context, AttachmentHolderPE attachmentHolder, AttachmentListUpdateValue updates)
{
executor.update(context, attachmentHolder, updates);
}
}
......@@ -26,9 +26,7 @@ import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.attachment.IUpdateAttachmentForEntityExecutor;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractUpdateEntityExecutor;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IUpdateEntityPropertyExecutor;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.tag.IUpdateTagForEntityExecutor;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentUpdate;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.experiment.IExperimentId;
......@@ -60,13 +58,13 @@ public class UpdateExperimentExecutor extends AbstractUpdateEntityExecutor<Exper
private IUpdateExperimentProjectExecutor updateExperimentProjectExecutor;
@Autowired
private IUpdateEntityPropertyExecutor updateEntityPropertyExecutor;
private IUpdateExperimentPropertyExecutor updateExperimentPropertyExecutor;
@Autowired
private IUpdateTagForEntityExecutor updateTagForEntityExecutor;
@Autowired
private IUpdateAttachmentForEntityExecutor updateAttachmentForEntityExecutor;
private IUpdateExperimentAttachmentExecutor updateExperimentAttachmentExecutor;
@Autowired
private IVerifyExperimentExecutor verifyExperimentExecutor;
......@@ -114,11 +112,22 @@ public class UpdateExperimentExecutor extends AbstractUpdateEntityExecutor<Exper
RelationshipUtils.updateModificationDateAndModifier(entity, context.getSession().tryGetPerson());
updateTagForEntityExecutor.update(context, entity, update.getTagIds());
updateAttachmentForEntityExecutor.update(context, entity, update.getAttachments());
propertyMap.put(entity, update.getProperties());
if (update.getAttachments() != null && update.getAttachments().hasActions())
{
updateExperimentAttachmentExecutor.update(context, entity, update.getAttachments());
}
if (update.getProperties() != null && false == update.getProperties().isEmpty())
{
propertyMap.put(entity, update.getProperties());
}
}
updateEntityPropertyExecutor.update(context, propertyMap);
if (false == propertyMap.isEmpty())
{
updateExperimentPropertyExecutor.update(context, propertyMap);
}
}
@Override
......
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.experiment;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IUpdateEntityPropertyExecutor;
import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.Capability;
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.dto.IEntityPropertiesHolder;
/**
* @author pkupczyk
*/
@Component
public class UpdateExperimentPropertyExecutor implements IUpdateExperimentPropertyExecutor
{
@Autowired
private IUpdateEntityPropertyExecutor executor;
@Override
@RolesAllowed({ RoleWithHierarchy.SPACE_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("UPDATE_EXPERIMENT_PROPERTY")
public void update(IOperationContext context, Map<IEntityPropertiesHolder, Map<String, String>> entityToPropertiesMap)
{
executor.update(context, entityToPropertiesMap);
}
}
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.material;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IAbstractUpdateEntityPropertyExecutor;
/**
* @author pkupczyk
*/
public interface IUpdateMaterialPropertyExecutor extends IAbstractUpdateEntityPropertyExecutor
{
}
......@@ -27,7 +27,6 @@ import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractUpdateEntityExecutor;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IUpdateEntityPropertyExecutor;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.tag.IUpdateTagForEntityExecutor;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.MaterialUpdate;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.material.IMaterialId;
......@@ -54,7 +53,7 @@ public class UpdateMaterialExecutor extends AbstractUpdateEntityExecutor<Materia
private IMapMaterialByIdExecutor mapMaterialByIdExecutor;
@Autowired
private IUpdateEntityPropertyExecutor updateEntityPropertyExecutor;
private IUpdateMaterialPropertyExecutor updateMaterialPropertyExecutor;
@Autowired
private IUpdateTagForEntityExecutor updateTagForEntityExecutor;
......@@ -101,10 +100,17 @@ public class UpdateMaterialExecutor extends AbstractUpdateEntityExecutor<Materia
MaterialUpdate update = entry.getKey();
MaterialPE entity = entry.getValue();
updateTagForEntityExecutor.update(context, entity, update.getTagIds());
propertyMap.put(entity, update.getProperties());
if (update.getProperties() != null && false == update.getProperties().isEmpty())
{
propertyMap.put(entity, update.getProperties());
}
}
updateEntityPropertyExecutor.update(context, propertyMap);
if (false == propertyMap.isEmpty())
{
updateMaterialPropertyExecutor.update(context, propertyMap);
}
}
@Override
......
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.material;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.property.IUpdateEntityPropertyExecutor;
import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.Capability;
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.dto.IEntityPropertiesHolder;
/**
* @author pkupczyk
*/
@Component
public class UpdateMaterialPropertyExecutor implements IUpdateMaterialPropertyExecutor
{
@Autowired
private IUpdateEntityPropertyExecutor executor;
@Override
@RolesAllowed({ RoleWithHierarchy.INSTANCE_ADMIN, RoleWithHierarchy.INSTANCE_ETL_SERVER })
@Capability("UPDATE_MATERIAL_PROPERTY")
public void update(IOperationContext context, Map<IEntityPropertiesHolder, Map<String, String>> entityToPropertiesMap)
{
executor.update(context, entityToPropertiesMap);
}
}
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.project;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.attachment.IAbstractUpdateAttachmentForEntityExecutor;
/**
* @author pkupczyk
*/
public interface IUpdateProjectAttachmentExecutor extends IAbstractUpdateAttachmentForEntityExecutor
{
}
/*
* Copyright 2015 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.attachment.IUpdateAttachmentForEntityExecutor;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.AttachmentListUpdateValue;
import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.Capability;
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.dto.AttachmentHolderPE;
/**
* @author pkupczyk
*/
@Component
public class UpdateProjectAttachmentExecutor implements IUpdateProjectAttachmentExecutor
{
@Autowired
private IUpdateAttachmentForEntityExecutor executor;
@Override
@RolesAllowed({ RoleWithHierarchy.SPACE_POWER_USER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("UPDATE_PROJECT_ATTACHMENT")
public void update(IOperationContext context, AttachmentHolderPE attachmentHolder, AttachmentListUpdateValue updates)
{
executor.update(context, attachmentHolder, updates);
}
}
......@@ -25,7 +25,6 @@ import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.attachment.IUpdateAttachmentForEntityExecutor;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.entity.AbstractUpdateEntityExecutor;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.project.ProjectUpdate;
import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.project.IProjectId;
......@@ -55,7 +54,7 @@ public class UpdateProjectExecutor extends AbstractUpdateEntityExecutor<ProjectU
private IUpdateProjectSpaceExecutor updateProjectSpaceExecutor;
@Autowired
private IUpdateAttachmentForEntityExecutor updateAttachmentForEntityExecutor;
private IUpdateProjectAttachmentExecutor updateProjectAttachmentExecutor;
@Override
protected IProjectId getId(ProjectUpdate update)
......@@ -104,7 +103,10 @@ public class UpdateProjectExecutor extends AbstractUpdateEntityExecutor<ProjectU
project.setDescription(update.getDescription().getValue());
}
updateAttachmentForEntityExecutor.update(context, project, update.getAttachments());
if (update.getAttachments() != null && update.getAttachments().hasActions())
{
updateProjectAttachmentExecutor.update(context, project, update.getAttachments());
}
}
}
......
/*
* Copyright 2014 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.ethz.sis.openbis.generic.server.api.v3.executor.property;
import java.util.Map;
import ch.ethz.sis.openbis.generic.server.api.v3.executor.IOperationContext;
import ch.systemsx.cisd.openbis.generic.shared.dto.IEntityPropertiesHolder;
/**
* @author pkupczyk
*/
public interface IAbstractUpdateEntityPropertyExecutor
{
public void update(IOperationContext context, Map<IEntityPropertiesHolder, Map<String, String>> entityToPropertiesMap);
}
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