mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
Onboarding Application Changes for OSS (#19203)
(cherry picked from commit d60327c448a0ac0e14c11ad4976bb405437fe4c9)
This commit is contained in:
parent
26829f73d9
commit
3e88f1ca30
@ -1155,6 +1155,21 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
||||
return response;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Transaction
|
||||
public final DeleteResponse<T> deleteByNameIfExists(
|
||||
String updatedBy, String name, boolean recursive, boolean hardDelete) {
|
||||
name = quoteFqn ? quoteName(name) : name;
|
||||
T entity = findByNameOrNull(name, ALL);
|
||||
if (entity != null) {
|
||||
DeleteResponse<T> response = deleteInternalByName(updatedBy, name, recursive, hardDelete);
|
||||
postDelete(response.entity());
|
||||
return response;
|
||||
} else {
|
||||
return new DeleteResponse<>(null, ENTITY_DELETED);
|
||||
}
|
||||
}
|
||||
|
||||
@Transaction
|
||||
public final DeleteResponse<T> deleteByName(
|
||||
String updatedBy, String name, boolean recursive, boolean hardDelete) {
|
||||
|
@ -17,6 +17,7 @@ import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
|
||||
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
|
||||
import static org.openmetadata.service.Entity.DASHBOARD;
|
||||
import static org.openmetadata.service.Entity.MLMODEL;
|
||||
import static org.openmetadata.service.Entity.getEntityReference;
|
||||
import static org.openmetadata.service.resources.tags.TagLabelUtil.checkMutuallyExclusive;
|
||||
import static org.openmetadata.service.util.EntityUtil.entityReferenceMatch;
|
||||
import static org.openmetadata.service.util.EntityUtil.mlFeatureMatch;
|
||||
@ -149,8 +150,7 @@ public class MlModelRepository extends EntityRepository<MlModel> {
|
||||
|
||||
private void validateMlDataSource(MlFeatureSource source) {
|
||||
if (source.getDataSource() != null) {
|
||||
Entity.getEntityReferenceById(
|
||||
source.getDataSource().getType(), source.getDataSource().getId(), Include.NON_DELETED);
|
||||
Entity.getEntityReference(source.getDataSource(), Include.NON_DELETED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ public class MlModelRepository extends EntityRepository<MlModel> {
|
||||
.getFeatureSources()
|
||||
.forEach(
|
||||
mlFeatureSource -> {
|
||||
EntityReference targetEntity = mlFeatureSource.getDataSource();
|
||||
EntityReference targetEntity = getEntityReference(mlFeatureSource.getDataSource(), Include.ALL);
|
||||
if (targetEntity != null) {
|
||||
addRelationship(
|
||||
targetEntity.getId(),
|
||||
|
@ -29,7 +29,6 @@ import static org.openmetadata.service.util.EntityUtil.taskMatch;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
import org.jdbi.v3.sqlobject.transaction.Transaction;
|
||||
import org.openmetadata.schema.EntityInterface;
|
||||
@ -173,8 +172,7 @@ public class PipelineRepository extends EntityRepository<Pipeline> {
|
||||
PipelineStatus.class);
|
||||
}
|
||||
|
||||
public RestUtil.PutResponse<?> addPipelineStatus(
|
||||
UriInfo uriInfo, String fqn, PipelineStatus pipelineStatus) {
|
||||
public RestUtil.PutResponse<?> addPipelineStatus(String fqn, PipelineStatus pipelineStatus) {
|
||||
// Validate the request content
|
||||
Pipeline pipeline = daoCollection.pipelineDAO().findEntityByName(fqn);
|
||||
pipeline.setService(getContainer(pipeline.getId()));
|
||||
|
@ -425,7 +425,7 @@ public class PipelineResource extends EntityResource<Pipeline, PipelineRepositor
|
||||
OperationContext operationContext =
|
||||
new OperationContext(entityType, MetadataOperation.EDIT_STATUS);
|
||||
authorizer.authorize(securityContext, operationContext, getResourceContextByName(fqn));
|
||||
return repository.addPipelineStatus(uriInfo, fqn, pipelineStatus).toResponse();
|
||||
return repository.addPipelineStatus(fqn, pipelineStatus).toResponse();
|
||||
}
|
||||
|
||||
@GET
|
||||
|
@ -39,6 +39,7 @@ import java.io.StringReader;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -640,6 +641,24 @@ public final class JsonUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static Map<String, Object> getMapFromJson(String json) {
|
||||
return (Map<String, Object>) (JsonUtils.readValue(json, Map.class));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static <T> T convertObjectWithFilteredFields(
|
||||
Object input, Set<String> fields, Class<T> clazz) {
|
||||
Map<String, Object> inputMap = JsonUtils.getMap(input);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
for (String field : fields) {
|
||||
if (inputMap.containsKey(field)) {
|
||||
result.put(field, inputMap.get(field));
|
||||
}
|
||||
}
|
||||
return JsonUtils.convertValue(result, clazz);
|
||||
}
|
||||
|
||||
public static JsonPatch convertFgeToJavax(com.github.fge.jsonpatch.JsonPatch fgeJsonPatch) {
|
||||
String jsonString = fgeJsonPatch.toString();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user