use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto in project CzechIdMng by bcvsolutions.
the class DefaultFormServiceItegrationTest method testFindDefinitionByDtoClass.
@Test
public void testFindDefinitionByDtoClass() {
IdmFormDefinitionDto definitionByEntityClass = formService.getDefinition(IdmIdentity.class, null);
IdmFormDefinitionDto definitionByDtoClass = formService.getDefinition(IdmIdentityDto.class, null);
//
Assert.assertNotNull(definitionByEntityClass);
Assert.assertEquals(definitionByEntityClass, definitionByDtoClass);
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto in project CzechIdMng by bcvsolutions.
the class AbstractWorkingPositionFilterIntegrationTest method createPosition.
private IdmTreeNodeDto createPosition(IdmTreeTypeDto type, IdmTreeNodeDto parent) {
IdmTreeNodeDto node = helper.createTreeNode(type, parent);
IdmFormDefinitionDto formDefinition = formService.getDefinition(IdmTreeNode.class, FormService.DEFAULT_DEFINITION_CODE);
IdmFormAttributeDto attr = formDefinition.getMappedAttributeByCode(EavCodeSubordinatesFilter.DEFAULT_FORM_ATTRIBUTE_CODE);
if (attr == null) {
attr = new IdmFormAttributeDto();
attr.setName("Parent code");
attr.setCode(EavCodeSubordinatesFilter.DEFAULT_FORM_ATTRIBUTE_CODE);
attr.setFormDefinition(formDefinition.getId());
attr.setPersistentType(PersistentType.TEXT);
attr.setUnmodifiable(true);
attr = formService.saveAttribute(attr);
}
//
formService.saveValues(node, attr, Lists.newArrayList(parent.getCode()));
//
return node;
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemServiceTest method testCreateConnectorConfiguration.
@Test
public void testCreateConnectorConfiguration() {
// TODO: test system will be moved here, after UI eav form implementation
@SuppressWarnings("deprecation") IcConnectorKey connectorKey = systemService.getTestConnectorKey();
// create connector instance impl with connector key
IcConnectorInstance connectorInstance = new IcConnectorInstanceImpl(null, connectorKey, false);
IcConnectorConfiguration conf = icConfigurationAggregatorService.getConnectorConfiguration(connectorInstance);
IdmFormDefinitionDto savedFormDefinition = systemService.getConnectorFormDefinition(connectorInstance);
assertEquals(conf.getConfigurationProperties().getProperties().size(), savedFormDefinition.getFormAttributes().size());
assertEquals(conf.getConfigurationProperties().getProperties().get(3).getDisplayName(), savedFormDefinition.getFormAttributes().get(3).getName());
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto in project CzechIdMng by bcvsolutions.
the class SysSystemController method getConnectorFormDefinition.
/**
* Returns connector form definition to given system
* or throws exception with code {@code CONNECTOR_CONFIGURATION_FOR_SYSTEM_NOT_FOUND}, when system is wrong configured
*
* @param backendId
* @return
*/
@ResponseBody
@PreAuthorize("hasAuthority('" + AccGroupPermission.SYSTEM_READ + "')")
@RequestMapping(value = "/{backendId}/connector-form-definition", method = RequestMethod.GET)
@ApiOperation(value = "Connector configuration - form definition", nickname = "getConnectorFormDefinition", tags = { SysSystemController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_READ, description = "") }) })
public ResponseEntity<?> getConnectorFormDefinition(@ApiParam(value = "System's uuid identifier or code.", required = true) @PathVariable @NotNull String backendId) {
SysSystemDto system = getDto(backendId);
if (system == null) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("entity", backendId));
}
IdmFormDefinitionDto formDefinition = getConnectorFormDefinition(system);
//
return new ResponseEntity<>(new Resource<>(formDefinition), HttpStatus.OK);
}
use of eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto in project CzechIdMng by bcvsolutions.
the class SysSystemController method saveConnectorFormValues.
/**
* Saves connector configuration form values
*
* @param backendId
* @param formValues
* @return
*/
@ResponseBody
@PreAuthorize("hasAuthority('" + AccGroupPermission.SYSTEM_UPDATE + "')")
@RequestMapping(value = "/{backendId}/connector-form-values", method = RequestMethod.POST)
@ApiOperation(value = "Connector configuration - save values", nickname = "postConnectorFormValues", tags = { SysSystemController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_UPDATE, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_UPDATE, description = "") }) })
public Resource<?> saveConnectorFormValues(@ApiParam(value = "System's uuid identifier or code.", required = true) @PathVariable @NotNull String backendId, @RequestBody @Valid List<IdmFormValueDto> formValues) {
SysSystemDto entity = getDto(backendId);
if (entity == null) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("entity", backendId));
}
IdmFormDefinitionDto formDefinition = getConnectorFormDefinition(entity);
return formDefinitionController.saveFormValues(entity, formDefinition, formValues);
}
Aggregations