@Test void updateProcess_noChanges() throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException { EntityDetail mockedOriginalProcessEntity = Mockito.mock(EntityDetail.class); when(mockedOriginalProcessEntity.getGUID()).thenReturn(PROCESS_GUID); EntityDetail mockedUpdatedProcessEntity = Mockito.mock(EntityDetail.class); when(dataEngineCommonHandler.buildEntityDetail(PROCESS_GUID, null)).thenReturn(mockedUpdatedProcessEntity); EntityDetailDifferences mockedDifferences = mock(EntityDetailDifferences.class); when(mockedDifferences.hasInstancePropertiesDifferences()).thenReturn(Boolean.FALSE); when(repositoryHelper.getEntityDetailDifferences(mockedOriginalProcessEntity, mockedUpdatedProcessEntity, true)).thenReturn(mockedDifferences); processHandler.updateProcess(USER, mockedOriginalProcessEntity, getProcess()); verify(assetHandler, times(1)).reclassifyAsset(any(), originalProcessCaptor.capture(), any(), any(), any(), any(), any()); verify(dataEngineCommonHandler, times(0)).updateEntity(USER, PROCESS_GUID, null, ProcessPropertiesMapper.PROCESS_TYPE_NAME); }
public void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "updateProcess"; initializeAssetZoneMembership(updatedProcess); validateProcessParameters(userId, updatedProcess.getQualifiedName(), methodName); String processGUID = originalProcessEntity.getGUID(); ProcessConverter processConverter = new ProcessConverter(originalProcessEntity, null, repositoryHelper, methodName); Process originalProcess = processConverter.getProcessBean(); validateZoneMembership(userId, originalProcess, updatedProcess, processConverter.getAssetAuditHeader()); ProcessPropertiesBuilder updatedProcessBuilder = new ProcessPropertiesBuilder(updatedProcess.getQualifiedName(), updatedProcess.getName(), updatedProcess.getDisplayName(), updatedProcess.getDescription(), updatedProcess.getOwner(), updatedProcess.getOwnerType(), updatedProcess.getZoneMembership(), updatedProcess.getLatestChange(), updatedProcess.getFormula(), null, null, repositoryHelper, serverName, serviceName); assetHandler.reclassifyAsset(userId, originalProcess, updatedProcess, updatedProcessBuilder.getZoneMembershipProperties(methodName), updatedProcessBuilder.getOwnerProperties(methodName), null, methodName); EntityDetail updatedProcessEntity = dataEngineCommonHandler.buildEntityDetail(processGUID, updatedProcessBuilder.getInstanceProperties(methodName)); EntityDetailDifferences entityDetailDifferences = repositoryHelper.getEntityDetailDifferences(originalProcessEntity, updatedProcessEntity, true); if (!entityDetailDifferences.hasInstancePropertiesDifferences()) { return; } dataEngineCommonHandler.updateEntity(userId, processGUID, updatedProcessBuilder.getInstanceProperties(methodName), ProcessPropertiesMapper.PROCESS_TYPE_NAME); }
ProcessHandler { public void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "updateProcess"; initializeAssetZoneMembership(updatedProcess); validateProcessParameters(userId, updatedProcess.getQualifiedName(), methodName); String processGUID = originalProcessEntity.getGUID(); ProcessConverter processConverter = new ProcessConverter(originalProcessEntity, null, repositoryHelper, methodName); Process originalProcess = processConverter.getProcessBean(); validateZoneMembership(userId, originalProcess, updatedProcess, processConverter.getAssetAuditHeader()); ProcessPropertiesBuilder updatedProcessBuilder = new ProcessPropertiesBuilder(updatedProcess.getQualifiedName(), updatedProcess.getName(), updatedProcess.getDisplayName(), updatedProcess.getDescription(), updatedProcess.getOwner(), updatedProcess.getOwnerType(), updatedProcess.getZoneMembership(), updatedProcess.getLatestChange(), updatedProcess.getFormula(), null, null, repositoryHelper, serverName, serviceName); assetHandler.reclassifyAsset(userId, originalProcess, updatedProcess, updatedProcessBuilder.getZoneMembershipProperties(methodName), updatedProcessBuilder.getOwnerProperties(methodName), null, methodName); EntityDetail updatedProcessEntity = dataEngineCommonHandler.buildEntityDetail(processGUID, updatedProcessBuilder.getInstanceProperties(methodName)); EntityDetailDifferences entityDetailDifferences = repositoryHelper.getEntityDetailDifferences(originalProcessEntity, updatedProcessEntity, true); if (!entityDetailDifferences.hasInstancePropertiesDifferences()) { return; } dataEngineCommonHandler.updateEntity(userId, processGUID, updatedProcessBuilder.getInstanceProperties(methodName), ProcessPropertiesMapper.PROCESS_TYPE_NAME); } }
ProcessHandler { public void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "updateProcess"; initializeAssetZoneMembership(updatedProcess); validateProcessParameters(userId, updatedProcess.getQualifiedName(), methodName); String processGUID = originalProcessEntity.getGUID(); ProcessConverter processConverter = new ProcessConverter(originalProcessEntity, null, repositoryHelper, methodName); Process originalProcess = processConverter.getProcessBean(); validateZoneMembership(userId, originalProcess, updatedProcess, processConverter.getAssetAuditHeader()); ProcessPropertiesBuilder updatedProcessBuilder = new ProcessPropertiesBuilder(updatedProcess.getQualifiedName(), updatedProcess.getName(), updatedProcess.getDisplayName(), updatedProcess.getDescription(), updatedProcess.getOwner(), updatedProcess.getOwnerType(), updatedProcess.getZoneMembership(), updatedProcess.getLatestChange(), updatedProcess.getFormula(), null, null, repositoryHelper, serverName, serviceName); assetHandler.reclassifyAsset(userId, originalProcess, updatedProcess, updatedProcessBuilder.getZoneMembershipProperties(methodName), updatedProcessBuilder.getOwnerProperties(methodName), null, methodName); EntityDetail updatedProcessEntity = dataEngineCommonHandler.buildEntityDetail(processGUID, updatedProcessBuilder.getInstanceProperties(methodName)); EntityDetailDifferences entityDetailDifferences = repositoryHelper.getEntityDetailDifferences(originalProcessEntity, updatedProcessEntity, true); if (!entityDetailDifferences.hasInstancePropertiesDifferences()) { return; } dataEngineCommonHandler.updateEntity(userId, processGUID, updatedProcessBuilder.getInstanceProperties(methodName), ProcessPropertiesMapper.PROCESS_TYPE_NAME); } ProcessHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                          RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, AssetHandler assetHandler,
                          DataEngineCommonHandler dataEngineCommonHandler, List<String> defaultZones, List<String> supportedZones); }
ProcessHandler { public void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "updateProcess"; initializeAssetZoneMembership(updatedProcess); validateProcessParameters(userId, updatedProcess.getQualifiedName(), methodName); String processGUID = originalProcessEntity.getGUID(); ProcessConverter processConverter = new ProcessConverter(originalProcessEntity, null, repositoryHelper, methodName); Process originalProcess = processConverter.getProcessBean(); validateZoneMembership(userId, originalProcess, updatedProcess, processConverter.getAssetAuditHeader()); ProcessPropertiesBuilder updatedProcessBuilder = new ProcessPropertiesBuilder(updatedProcess.getQualifiedName(), updatedProcess.getName(), updatedProcess.getDisplayName(), updatedProcess.getDescription(), updatedProcess.getOwner(), updatedProcess.getOwnerType(), updatedProcess.getZoneMembership(), updatedProcess.getLatestChange(), updatedProcess.getFormula(), null, null, repositoryHelper, serverName, serviceName); assetHandler.reclassifyAsset(userId, originalProcess, updatedProcess, updatedProcessBuilder.getZoneMembershipProperties(methodName), updatedProcessBuilder.getOwnerProperties(methodName), null, methodName); EntityDetail updatedProcessEntity = dataEngineCommonHandler.buildEntityDetail(processGUID, updatedProcessBuilder.getInstanceProperties(methodName)); EntityDetailDifferences entityDetailDifferences = repositoryHelper.getEntityDetailDifferences(originalProcessEntity, updatedProcessEntity, true); if (!entityDetailDifferences.hasInstancePropertiesDifferences()) { return; } dataEngineCommonHandler.updateEntity(userId, processGUID, updatedProcessBuilder.getInstanceProperties(methodName), ProcessPropertiesMapper.PROCESS_TYPE_NAME); } ProcessHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                          RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, AssetHandler assetHandler,
                          DataEngineCommonHandler dataEngineCommonHandler, List<String> defaultZones, List<String> supportedZones); void setSecurityVerifier(OpenMetadataServerSecurityVerifier securityVerifier); String createProcess(String userId, Process process, String externalSourceName); void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess); Optional<EntityDetail> findProcessEntity(String userId, String qualifiedName); void addProcessPortRelationship(String userId, String processGUID, String portGUID, String externalSourceName); void updateProcessStatus(String userId, String guid, InstanceStatus instanceStatus); Set<String> getPortsForProcess(String userId, String processGUID, String portTypeName); void createOrUpdateProcessHierarchyRelationship(String userId, ParentProcess parentProcess, String processGUID,
                                                           String externalSourceName); }
ProcessHandler { public void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String methodName = "updateProcess"; initializeAssetZoneMembership(updatedProcess); validateProcessParameters(userId, updatedProcess.getQualifiedName(), methodName); String processGUID = originalProcessEntity.getGUID(); ProcessConverter processConverter = new ProcessConverter(originalProcessEntity, null, repositoryHelper, methodName); Process originalProcess = processConverter.getProcessBean(); validateZoneMembership(userId, originalProcess, updatedProcess, processConverter.getAssetAuditHeader()); ProcessPropertiesBuilder updatedProcessBuilder = new ProcessPropertiesBuilder(updatedProcess.getQualifiedName(), updatedProcess.getName(), updatedProcess.getDisplayName(), updatedProcess.getDescription(), updatedProcess.getOwner(), updatedProcess.getOwnerType(), updatedProcess.getZoneMembership(), updatedProcess.getLatestChange(), updatedProcess.getFormula(), null, null, repositoryHelper, serverName, serviceName); assetHandler.reclassifyAsset(userId, originalProcess, updatedProcess, updatedProcessBuilder.getZoneMembershipProperties(methodName), updatedProcessBuilder.getOwnerProperties(methodName), null, methodName); EntityDetail updatedProcessEntity = dataEngineCommonHandler.buildEntityDetail(processGUID, updatedProcessBuilder.getInstanceProperties(methodName)); EntityDetailDifferences entityDetailDifferences = repositoryHelper.getEntityDetailDifferences(originalProcessEntity, updatedProcessEntity, true); if (!entityDetailDifferences.hasInstancePropertiesDifferences()) { return; } dataEngineCommonHandler.updateEntity(userId, processGUID, updatedProcessBuilder.getInstanceProperties(methodName), ProcessPropertiesMapper.PROCESS_TYPE_NAME); } ProcessHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler,
                          RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, AssetHandler assetHandler,
                          DataEngineCommonHandler dataEngineCommonHandler, List<String> defaultZones, List<String> supportedZones); void setSecurityVerifier(OpenMetadataServerSecurityVerifier securityVerifier); String createProcess(String userId, Process process, String externalSourceName); void updateProcess(String userId, EntityDetail originalProcessEntity, Process updatedProcess); Optional<EntityDetail> findProcessEntity(String userId, String qualifiedName); void addProcessPortRelationship(String userId, String processGUID, String portGUID, String externalSourceName); void updateProcessStatus(String userId, String guid, InstanceStatus instanceStatus); Set<String> getPortsForProcess(String userId, String processGUID, String portTypeName); void createOrUpdateProcessHierarchyRelationship(String userId, ParentProcess parentProcess, String processGUID,
                                                           String externalSourceName);  }