Source:
<code>protected APIResult update(Entity newEntity, String type, String entityName, Boolean skipDryRun) { List<Entity> tokenList = new ArrayList<>(); try { EntityType entityType = EntityType.getEnum(type); Entity oldEntity = EntityUtil.getEntity(type, entityName); decorateEntityWithACL(newEntity); validate(newEntity); validateUpdate(oldEntity, newEntity); configStore.initiateUpdate(newEntity); obtainEntityLocks(oldEntity, "update", tokenList); StringBuilder result = new StringBuilder("Updated successfully"); if (!DeploymentUtil.isPrism() && !entityType.equals(EntityType.CLUSTER) && !entityType.equals(EntityType.DATASOURCE)) { Set<String> oldClusters = EntityUtil.getClustersDefinedInColos(oldEntity); Set<String> newClusters = EntityUtil.getClustersDefinedInColos(newEntity); newClusters.retainAll(oldClusters); oldClusters.removeAll(newClusters); for (String cluster : newClusters) { result.append(getWorkflowEngine(oldEntity).update(oldEntity, newEntity, cluster, skipDryRun)); } for (String cluster : oldClusters) { getWorkflowEngine(oldEntity).delete(oldEntity, cluster); } } configStore.update(entityType, newEntity); <START> if (entityType.equals(EntityType.DATASOURCE)) { <END> ConfigurationStore.get().cleanupUpdateInit(); releaseEntityLocks(entityName, tokenList); updateDatasourceDependents(entityName, skipDryRun); } return new APIResult(APIResult.Status.SUCCEEDED, result.toString()); } catch (Throwable e) { LOG.error("Update failed", e); throw FalconWebException.newAPIException(e); } finally { ConfigurationStore.get().cleanupUpdateInit(); releaseEntityLocks(entityName, tokenList); } }</code><technical_language>Minor suggestion feel free ignore : tasks performed for entityType. a switch entityType moving update commands right case more readable</technical_language>

Target:
protected APIResult update(Entity newEntity, String type, String entityName, Boolean skipDryRun) { List<Entity> tokenList = new ArrayList<>(); try { EntityType entityType = EntityType.getEnum(type); Entity oldEntity = EntityUtil.getEntity(type, entityName); decorateEntityWithACL(newEntity); validate(newEntity); validateUpdate(oldEntity, newEntity); configStore.initiateUpdate(newEntity); obtainEntityLocks(oldEntity, "update", tokenList); StringBuilder result = new StringBuilder("Updated successfully"); switch(entityType) { case CLUSTER: configStore.update(entityType, newEntity); break; case DATASOURCE: configStore.update(entityType, newEntity); if (entityType.equals(EntityType.DATASOURCE)) { ConfigurationStore.get().cleanupUpdateInit(); releaseEntityLocks(entityName, tokenList); updateDatasourceDependents(entityName, skipDryRun); } break; case FEED: case PROCESS: if (!DeploymentUtil.isPrism()) { Set<String> oldClusters = EntityUtil.getClustersDefinedInColos(oldEntity); Set<String> newClusters = EntityUtil.getClustersDefinedInColos(newEntity); newClusters.retainAll(oldClusters); oldClusters.removeAll(newClusters); for (String cluster : newClusters) { result.append(getWorkflowEngine(oldEntity).update(oldEntity, newEntity, cluster, skipDryRun)); } for (String cluster : oldClusters) { getWorkflowEngine(oldEntity).delete(oldEntity, cluster); } } configStore.update(entityType, newEntity); break; default: throw FalconWebException.newAPIException("Unknown entity type in update : " + entityType); } return new APIResult(APIResult.Status.SUCCEEDED, result.toString()); } catch (Throwable e) { LOG.error("Update failed", e); throw FalconWebException.newAPIException(e); } finally { ConfigurationStore.get().cleanupUpdateInit(); releaseEntityLocks(entityName, tokenList); } }