Skip to content
Snippets Groups Projects
Commit bcbee66f authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

Merge branch 'master' of https://sissource.ethz.ch/sispub/openbis

Conflicts:
	openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt
parents a619f317 50616086
No related branches found
No related tags found
No related merge requests found
Showing
with 396 additions and 9 deletions
......@@ -164,6 +164,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.DataSetTypeCreation = dtos.DataSetTypeCreation;
this.MaterialTypeCreation = dtos.MaterialTypeCreation;
this.PropertyTypeCreation = dtos.PropertyTypeCreation;
this.PropertyTypeUpdate = dtos.PropertyTypeUpdate;
this.WebAppSettings = dtos.WebAppSettings;
// operations
......@@ -215,6 +216,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.UpdateDataSetTypesOperation = dtos.UpdateDataSetTypesOperation;
this.UpdateMaterialsOperation = dtos.UpdateMaterialsOperation;
this.UpdateMaterialTypesOperation = dtos.UpdateMaterialTypesOperation;
this.UpdatePropertyTypesOperation = dtos.UpdatePropertyTypesOperation;
this.UpdateVocabulariesOperation = dtos.UpdateVocabulariesOperation;
this.UpdateVocabularyTermsOperation = dtos.UpdateVocabularyTermsOperation;
this.UpdateExternalDmsOperation = dtos.UpdateExternalDmsOperation;
......@@ -269,6 +271,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.DeleteDataSetsOperation = dtos.DeleteDataSetsOperation;
this.DeleteMaterialsOperation = dtos.DeleteMaterialsOperation;
this.DeleteExternalDmsOperation = dtos.DeleteExternalDmsOperation;
this.DeletePropertyTypesOperation = dtos.DeletePropertyTypesOperation;
this.DeleteVocabulariesOperation = dtos.DeleteVocabulariesOperation;
this.DeleteVocabularyTermsOperation = dtos.DeleteVocabularyTermsOperation;
this.DeleteEntityTypesOperation = dtos.DeleteEntityTypesOperation;
......@@ -782,6 +785,13 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
return facade.deleteEntityTypes([ id ], options);
}.bind(this);
this.deletePropertyType = function(facade, id) {
var c = this;
var options = new dtos.PropertyTypeDeletionOptions();
options.setReason("test reason");
return facade.deletePropertyTypes([ id ], options);
}.bind(this);
this.deleteVocabulary = function(facade, id) {
var c = this;
var options = new dtos.VocabularyDeletionOptions();
......
......@@ -429,6 +429,9 @@ var sources = [
'as/dto/property/create/PropertyTypeCreation',
'as/dto/property/create/CreatePropertyTypesOperation',
'as/dto/property/create/CreatePropertyTypesOperationResult',
'as/dto/property/delete/DeletePropertyTypesOperation',
'as/dto/property/delete/PropertyTypeDeletionOptions',
'as/dto/property/delete/DeletePropertyTypesOperationResult',
'as/dto/property/get/GetPropertyTypesOperation',
'as/dto/property/get/GetPropertyTypesOperationResult',
'as/dto/property/id/PropertyTypePermId',
......@@ -444,6 +447,9 @@ var sources = [
'as/dto/property/search/SearchPropertyTypesOperationResult',
'as/dto/property/search/SearchPropertyAssignmentsOperation',
'as/dto/property/search/SearchPropertyAssignmentsOperationResult',
'as/dto/property/update/PropertyTypeUpdate',
'as/dto/property/update/UpdatePropertyTypesOperation',
'as/dto/property/update/UpdatePropertyTypesOperationResult',
'as/dto/property/DataType',
'as/dto/property/PropertyAssignment',
'as/dto/property/PropertyType',
......
......@@ -205,6 +205,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) {
return this._executeUpdateOperation(new c.UpdateVocabulariesOperation(updates));
}
this.updatePropertyTypes = function(updates) {
return this._executeUpdateOperation(new c.UpdatePropertyTypesOperation(updates));
}
this.updateVocabularyTerms = function(updates) {
return this._executeUpdateOperation(new c.UpdateVocabularyTermsOperation(updates));
}
......@@ -425,6 +429,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) {
return this._executeDeleteOperation(new c.DeleteExternalDmsOperation(ids, deletionOptions));
}
this.deletePropertyTypes = function(ids, deletionOptions) {
return this._executeDeleteOperation(new c.DeletePropertyTypesOperation(ids, deletionOptions));
}
this.deleteVocabularies = function(ids, deletionOptions) {
return this._executeDeleteOperation(new c.DeleteVocabulariesOperation(ids, deletionOptions));
}
......
......@@ -633,7 +633,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
var fCreate = function(facade) {
var personCreation = new c.PersonCreation();
personCreation.setUserId(userId);
personCreation.setHomeSpaceId(new c.SpacePermId("TEST"))
personCreation.setSpaceId(new c.SpacePermId("TEST"))
return facade.createPersons([ personCreation ]);
}
......
......@@ -216,6 +216,11 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
testDeleteWithoutTrash(c, c.createMaterial, c.findMaterial, c.deleteMaterial);
});
QUnit.test("deletePropertyTypes()", function(assert) {
var c = new common(assert, openbis);
testDeleteWithoutTrash(c, c.createPropertyType, c.findPropertyType, c.deletePropertyType);
});
QUnit.test("deleteVocabularies()", function(assert) {
var c = new common(assert, openbis);
testDeleteWithoutTrash(c, c.createVocabulary, c.findVocabulary, c.deleteVocabulary);
......
......@@ -705,17 +705,49 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
testUpdate(c, fCreate, fUpdate, c.findMaterial, fCheck);
});
QUnit.test("updatePropertyTypes()", function(assert) {
var c = new common(assert, openbis);
var code = c.generateId("PROPERTY_TYPE");
var description = "Description of " + code;
var label = "Label of " + code;
var fCreate = function(facade) {
var creation = new c.PropertyTypeCreation();
creation.setCode(code);
creation.setLabel("Testing");
creation.setDescription("testing");
creation.setDataType(c.DataType.VARCHAR);
return facade.createPropertyTypes([ creation ]);
}
var fUpdate = function(facade, permId) {
var update = new c.PropertyTypeUpdate();
update.setTypeId(new c.PropertyTypePermId(code));
update.setDescription(description);
update.setLabel(label);
return facade.updatePropertyTypes([ update ]);
}
var fCheck = function(propertyType) {
c.assertEqual(propertyType.getCode(), code, "Code");
c.assertEqual(propertyType.getDescription(), description, "Description");
c.assertEqual(propertyType.getLabel(), label, "Label");
}
testUpdate(c, fCreate, fUpdate, c.findPropertyType, fCheck);
});
QUnit.test("updateVocabularies()", function(assert) {
var c = new common(assert, openbis);
var code = c.generateId("VOCABULARY");
var description = "Description of " + code;
var fCreate = function(facade) {
var creation = new c.VocabularyCreation();
creation.setCode(code);
return facade.createVocabularies([ creation ]);
}
var fUpdate = function(facade, permId) {
var update = new c.VocabularyUpdate();
update.setVocabularyId(permId);
......@@ -724,14 +756,14 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
update.setUrlTemplate("https://www.ethz.ch")
return facade.updateVocabularies([ update ]);
}
var fCheck = function(vocabulary) {
c.assertEqual(vocabulary.getCode(), code, "Code");
c.assertEqual(vocabulary.getPermId().getPermId(), code, "Perm id");
c.assertEqual(vocabulary.getDescription(), description, "Description");
c.assertEqual(vocabulary.getUrlTemplate(), "https://www.ethz.ch", "URL template");
}
testUpdate(c, fCreate, fUpdate, c.findVocabulary, fCheck);
});
......@@ -876,7 +908,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
var fUpdate = function(facade, permId) {
var update = new c.PersonUpdate();
update.setUserId(permId);
update.setHomeSpaceId(new c.SpacePermId("TEST"))
update.setSpaceId(new c.SpacePermId("TEST"))
return facade.updatePersons([ update ]);
}
......
......@@ -223,6 +223,8 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.create.CreatePropertyTypesOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.create.CreatePropertyTypesOperationResult;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.create.PropertyTypeCreation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.delete.DeletePropertyTypesOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.delete.PropertyTypeDeletionOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyTypeFetchOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.get.GetPropertyTypesOperation;
......@@ -235,6 +237,8 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.search.SearchPropertyAs
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.search.SearchPropertyAssignmentsOperationResult;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.search.SearchPropertyTypesOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.search.SearchPropertyTypesOperationResult;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.update.PropertyTypeUpdate;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.update.UpdatePropertyTypesOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.roleassignment.RoleAssignment;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.roleassignment.create.CreateRoleAssignmentsOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.roleassignment.create.CreateRoleAssignmentsOperationResult;
......@@ -658,6 +662,12 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
executeOperation(sessionToken, new UpdateDataSetTypesOperation(dataSetTypeUpdates));
}
@Override
public void updatePropertyTypes(String sessionToken, List<PropertyTypeUpdate> propertyTypeUpdates)
{
executeOperation(sessionToken, new UpdatePropertyTypesOperation(propertyTypeUpdates));
}
@Override
public void updateVocabularies(String sessionToken, List<VocabularyUpdate> vocabularyUpdates)
{
......@@ -1057,6 +1067,12 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
executeOperation(sessionToken, new DeleteMaterialsOperation(materialIds, deletionOptions));
}
@Override
public void deletePropertyTypes(String sessionToken, List<? extends IPropertyTypeId> propertyTypeIds, PropertyTypeDeletionOptions deletionOptions)
{
executeOperation(sessionToken, new DeletePropertyTypesOperation(propertyTypeIds, deletionOptions));
}
@Override
public void deleteVocabularies(String sessionToken, List<? extends IVocabularyId> ids, VocabularyDeletionOptions deletionOptions)
{
......
......@@ -121,12 +121,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.update.ProjectUpdate;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.create.PropertyTypeCreation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.delete.PropertyTypeDeletionOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyTypeFetchOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyTypeId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.PropertyTypePermId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.search.PropertyAssignmentSearchCriteria;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.search.PropertyTypeSearchCriteria;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.update.PropertyTypeUpdate;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.roleassignment.RoleAssignment;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.roleassignment.create.RoleAssignmentCreation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.roleassignment.delete.RoleAssignmentDeletionOptions;
......@@ -436,6 +438,12 @@ public class ApplicationServerApiLogger extends AbstractServerLogger implements
logAccess(sessionToken, "update-material-types", "MATERIAL_TYPE_UPDATES(%s)", abbreviate(materialTypeUpdates));
}
@Override
public void updatePropertyTypes(String sessionToken, List<PropertyTypeUpdate> propertyTypeUpdates)
{
logAccess(sessionToken, "update-property_types", "PROPERTY_TYPE_UPDATES(%s)", abbreviate(propertyTypeUpdates));
}
@Override
public void updateVocabularies(String sessionToken, List<VocabularyUpdate> vocabularyUpdates)
{
......@@ -753,6 +761,12 @@ public class ApplicationServerApiLogger extends AbstractServerLogger implements
logAccess(sessionToken, "delete-materials", "MATERIAL_IDS(%s) DELETION_OPTIONS(%s)", abbreviate(materialIds), deletionOptions);
}
@Override
public void deletePropertyTypes(String sessionToken, List<? extends IPropertyTypeId> propertyTypeIds, PropertyTypeDeletionOptions deletionOptions)
{
logAccess(sessionToken, "delete-property-types", "PROPERTY_TYPES_IDS(%s) DELETION_OPTIONS(%s)", abbreviate(propertyTypeIds), deletionOptions);
}
@Override
public void deleteVocabularies(String sessionToken, List<? extends IVocabularyId> ids, VocabularyDeletionOptions deletionOptions)
{
......
......@@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.id.IObjectId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.update.FieldUpdateValue;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.update.IUpdate;
import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.ObjectNotFoundException;
import ch.ethz.sis.openbis.generic.asapi.v3.exceptions.UnauthorizedObjectAccessException;
......@@ -216,6 +217,12 @@ public abstract class AbstractUpdateEntityExecutor<UPDATE extends IUpdate, PE ex
entry.setValue(idToEntityMap.get(entry.getValue().getId()));
}
}
protected <T> T getNewValue(FieldUpdateValue<T> fieldUpdateValue, T currentValue)
{
return fieldUpdateValue != null && fieldUpdateValue.isModified() ? fieldUpdateValue.getValue() : currentValue;
}
protected abstract ID getId(UPDATE update);
......
......@@ -88,9 +88,11 @@ import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.project.IGetProjects
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.project.ISearchProjectsOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.project.IUpdateProjectsOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property.ICreatePropertyTypesOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property.IDeletePropertyTypesOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property.IGetPropertyTypesOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property.ISearchPropertyAssignmentsOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property.ISearchPropertyTypesOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property.IUpdatePropertyTypesOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.roleassignment.ICreateRoleAssignmentsOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.roleassignment.IDeleteRoleAssignmentsOperationExecutor;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.roleassignment.IGetRoleAssignmentsOperationExecutor;
......@@ -178,8 +180,11 @@ public class OperationsExecutor implements IOperationsExecutor
private IDeleteEntityTypeOperationExecutor deleteEntityTypesExecutor;
@Autowired
private IDeleteVocabulariesOperationExecutor deleteVocabulariesExecutor;
private IDeletePropertyTypesOperationExecutor deletePropertyTypesExecutor;
@Autowired
private IDeleteVocabulariesOperationExecutor deleteVocabulariesExecutor;
@Autowired
private IDeleteVocabularyTermsOperationExecutor deleteVocabularyTermsExecutor;
......@@ -287,6 +292,9 @@ public class OperationsExecutor implements IOperationsExecutor
@Autowired
private IUpdateExternalDmsOperationExecutor updateExternalDmsExecutor;
@Autowired
private IUpdatePropertyTypesOperationExecutor updatePropertyTypesExecutor;
@Autowired
private IUpdateVocabulariesOperationExecutor updateVocabulariesExecutor;
......@@ -574,6 +582,7 @@ public class OperationsExecutor implements IOperationsExecutor
resultMap.putAll(updateSemanticAnnotationsExecutor.execute(context, operations));
resultMap.putAll(updateOperationExecutionsExecutor.execute(context, operations));
resultMap.putAll(updateVocabulariesExecutor.execute(context, operations));
resultMap.putAll(updatePropertyTypesExecutor.execute(context, operations));
resultMap.putAll(updateVocabularyTermsExecutor.execute(context, operations));
resultMap.putAll(updateMaterialTypesExecutor.execute(context, operations));
resultMap.putAll(updateExperimentTypesExecutor.execute(context, operations));
......@@ -630,6 +639,7 @@ public class OperationsExecutor implements IOperationsExecutor
resultMap.putAll(deleteRoleAssignmentsExecutor.execute(context, operations));
resultMap.putAll(deleteAuthorizationGroupsExecutor.execute(context, operations));
resultMap.putAll(deleteEntityTypesExecutor.execute(context, operations));
resultMap.putAll(deletePropertyTypesExecutor.execute(context, operations));
resultMap.putAll(deleteVocabularyTermsExecutor.execute(context, operations));
resultMap.putAll(deleteVocabulariesExecutor.execute(context, operations));
resultMap.putAll(deleteOperationExecutionsExecutor.execute(context, operations));
......
......@@ -50,7 +50,7 @@ public class SetPersonSpaceExecutor
@Override
protected ISpaceId getRelatedId(PersonCreation creation)
{
return creation.getHomeSpaceId();
return creation.getSpaceId();
}
@Override
......
......@@ -69,7 +69,7 @@ public class UpdateHomeSpaceExecutor
@Override
protected FieldUpdateValue<ISpaceId> getRelatedUpdate(PersonUpdate update)
{
return update.getHomeSpaceId();
return update.getSpaceId();
}
@Override
......
/*
* Copyright 2018 ETH Zuerich, SIS
*
* 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.asapi.v3.executor.property;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.delete.PropertyTypeDeletionOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyTypeId;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.entity.AbstractDeleteEntityExecutor;
import ch.systemsx.cisd.openbis.generic.server.ComponentNames;
import ch.systemsx.cisd.openbis.generic.server.business.bo.ICommonBusinessObjectFactory;
import ch.systemsx.cisd.openbis.generic.server.business.bo.IPropertyTypeBO;
import ch.systemsx.cisd.openbis.generic.shared.basic.TechId;
import ch.systemsx.cisd.openbis.generic.shared.dto.PropertyTypePE;
/**
* @author Franz-Josef Elmer
*/
@Component
public class DeletePropertyTypeExecutor
extends AbstractDeleteEntityExecutor<Void, IPropertyTypeId, PropertyTypePE, PropertyTypeDeletionOptions>
implements IDeletePropertyTypeExecutor
{
@Resource(name = ComponentNames.COMMON_BUSINESS_OBJECT_FACTORY)
private ICommonBusinessObjectFactory businessObjectFactory;
@Autowired
private IPropertyTypeAuthorizationExecutor authorizationExecutor;
@Autowired
private IMapPropertyTypeByIdExecutor mapPropertyTypeByIdExeceutor;
@Override
protected Map<IPropertyTypeId, PropertyTypePE> map(IOperationContext context, List<? extends IPropertyTypeId> entityIds)
{
return mapPropertyTypeByIdExeceutor.map(context, entityIds);
}
@Override
protected void checkAccess(IOperationContext context, IPropertyTypeId entityId, PropertyTypePE entity)
{
authorizationExecutor.canDelete(context, entityId, entity);
}
@Override
protected void updateModificationDateAndModifier(IOperationContext context, PropertyTypePE entity)
{
}
@Override
protected Void delete(IOperationContext context, Collection<PropertyTypePE> entities, PropertyTypeDeletionOptions deletionOptions)
{
IPropertyTypeBO propertyTypeBO = businessObjectFactory.createPropertyTypeBO(context.getSession());
String reason = deletionOptions.getReason();
for (PropertyTypePE propertyType : entities)
{
propertyTypeBO.deleteByTechId(new TechId(propertyType.getId()), reason);
}
return null;
}
}
/*
* Copyright 2018 ETH Zuerich, SIS
*
* 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.asapi.v3.executor.property;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.delete.DeleteObjectsOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.delete.DeleteObjectsOperationResult;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.delete.DeletePropertyTypesOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.delete.DeletePropertyTypesOperationResult;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.delete.PropertyTypeDeletionOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyTypeId;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.delete.DeleteObjectsOperationExecutor;
/**
* @author Franz-Josef Elmer
*/
@Component
public class DeletePropertyTypesOperationExecutor
extends DeleteObjectsOperationExecutor<IPropertyTypeId, PropertyTypeDeletionOptions>
implements IDeletePropertyTypesOperationExecutor
{
@Autowired
private IDeletePropertyTypeExecutor exeutor;
@Override
protected Class<? extends DeleteObjectsOperation<IPropertyTypeId, PropertyTypeDeletionOptions>> getOperationClass()
{
return DeletePropertyTypesOperation.class;
}
@Override
protected DeleteObjectsOperationResult doExecute(IOperationContext context,
DeleteObjectsOperation<IPropertyTypeId, PropertyTypeDeletionOptions> operation)
{
exeutor.delete(context, operation.getObjectIds(), operation.getOptions());
return new DeletePropertyTypesOperationResult();
}
}
/*
* Copyright 2018 ETH Zuerich, SIS
*
* 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.asapi.v3.executor.property;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.delete.PropertyTypeDeletionOptions;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyTypeId;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.entity.IDeleteEntityExecutor;
/**
* @author Franz-Josef Elmer
*
*/
public interface IDeletePropertyTypeExecutor extends IDeleteEntityExecutor<Void, IPropertyTypeId, PropertyTypeDeletionOptions>
{
}
/*
* Copyright 2018 ETH Zuerich, SIS
*
* 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.asapi.v3.executor.property;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.delete.IDeleteObjectsOperationExecutor;
/**
* @author Franz-Josef Elmer
*
*/
public interface IDeletePropertyTypesOperationExecutor extends IDeleteObjectsOperationExecutor
{
}
......@@ -16,8 +16,10 @@
package ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyTypeId;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.IObjectAuthorizationExecutor;
import ch.systemsx.cisd.openbis.generic.shared.dto.PropertyTypePE;
/**
* @author pkupczyk
......@@ -31,4 +33,8 @@ public interface IPropertyTypeAuthorizationExecutor extends IObjectAuthorization
void canCreate(IOperationContext context);
void canUpdate(IOperationContext context, IPropertyTypeId id, PropertyTypePE entity);
void canDelete(IOperationContext context, IPropertyTypeId entityId, PropertyTypePE entity);
}
/*
* Copyright 2018 ETH Zuerich, SIS
*
* 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.asapi.v3.executor.property;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.PropertyTypePermId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.update.PropertyTypeUpdate;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.entity.IUpdateEntityExecutor;
/**
* @author Franz-Josef Elmer
*
*/
public interface IUpdatePropertyTypeExecutor extends IUpdateEntityExecutor<PropertyTypeUpdate, PropertyTypePermId>
{
}
/*
* Copyright 2018 ETH Zuerich, SIS
*
* 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.asapi.v3.executor.property;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.update.IUpdateObjectsOperationExecutor;
/**
* @author Franz-Josef Elmer
*
*/
public interface IUpdatePropertyTypesOperationExecutor extends IUpdateObjectsOperationExecutor
{
}
......@@ -18,10 +18,12 @@ package ch.ethz.sis.openbis.generic.server.asapi.v3.executor.property;
import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.id.IPropertyTypeId;
import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext;
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.PropertyTypePE;
/**
* @author pkupczyk
......@@ -51,4 +53,18 @@ public class PropertyTypeAuthorizationExecutor implements IPropertyTypeAuthoriza
{
}
@Override
@RolesAllowed(RoleWithHierarchy.INSTANCE_ADMIN)
@Capability("UPDATE_PROPERTY_TYPE")
public void canUpdate(IOperationContext context, IPropertyTypeId id, PropertyTypePE entity)
{
}
@Override
@RolesAllowed(RoleWithHierarchy.INSTANCE_ADMIN)
@Capability("DELETE_PROPERTY_TYPE")
public void canDelete(IOperationContext context, IPropertyTypeId entityId, PropertyTypePE entity)
{
}
}
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