use of co.cask.cdap.proto.id.DatasetId in project cdap by caskdata.
the class LineageAdmin method getRollupRelations.
private Multimap<RelationKey, Relation> getRollupRelations(Multimap<RelationKey, Relation> relations, Map<ProgramRunId, RunRecordMeta> runRecordMap, Map<String, ProgramRunId> workflowIdMap) throws NotFoundException {
Multimap<RelationKey, Relation> relationsNew = HashMultimap.create();
for (Map.Entry<RelationKey, Collection<Relation>> entry : relations.asMap().entrySet()) {
for (Relation relation : entry.getValue()) {
ProgramRunId workflowProgramRunId = getWorkflowProgramRunid(relation, runRecordMap, workflowIdMap);
if (workflowProgramRunId == null) {
relationsNew.put(entry.getKey(), relation);
} else {
ProgramId workflowProgramId = new ProgramId(workflowProgramRunId.getNamespace(), workflowProgramRunId.getApplication(), workflowProgramRunId.getType(), workflowProgramRunId.getProgram());
Relation workflowRelation;
NamespacedEntityId data = relation.getData();
if (data instanceof DatasetId) {
workflowRelation = new Relation((DatasetId) data, workflowProgramId, relation.getAccess(), RunIds.fromString(workflowProgramRunId.getRun()));
} else {
workflowRelation = new Relation((StreamId) data, workflowProgramId, relation.getAccess(), RunIds.fromString(workflowProgramRunId.getRun()));
}
relationsNew.put(entry.getKey(), workflowRelation);
}
}
}
return relationsNew;
}
use of co.cask.cdap.proto.id.DatasetId in project cdap by caskdata.
the class MetadataHttpHandler method removeDatasetProperty.
@DELETE
@Path("/namespaces/{namespace-id}/datasets/{dataset-id}/metadata/properties/{property}")
public void removeDatasetProperty(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("dataset-id") String datasetId, @PathParam("property") String property) throws NotFoundException {
DatasetId dataset = new DatasetId(namespaceId, datasetId);
metadataAdmin.removeProperties(dataset, property);
responder.sendString(HttpResponseStatus.OK, String.format("Metadata property %s for dataset %s deleted successfully.", property, dataset));
}
use of co.cask.cdap.proto.id.DatasetId in project cdap by caskdata.
the class MetadataHttpHandler method addDatasetProperties.
@POST
@Path("/namespaces/{namespace-id}/datasets/{dataset-id}/metadata/properties")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void addDatasetProperties(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("dataset-id") String datasetId) throws BadRequestException, NotFoundException {
DatasetId dataset = new DatasetId(namespaceId, datasetId);
metadataAdmin.addProperties(dataset, readMetadata(request));
responder.sendString(HttpResponseStatus.OK, "Metadata added successfully to " + dataset);
}
use of co.cask.cdap.proto.id.DatasetId in project cdap by caskdata.
the class MetadataHttpHandler method addDatasetTags.
@POST
@Path("/namespaces/{namespace-id}/datasets/{dataset-id}/metadata/tags")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void addDatasetTags(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("dataset-id") String datasetId) throws BadRequestException, NotFoundException {
DatasetId dataset = new DatasetId(namespaceId, datasetId);
metadataAdmin.addTags(dataset, readArray(request));
responder.sendString(HttpResponseStatus.OK, String.format("Added tags to dataset %s successfully.", dataset));
}
use of co.cask.cdap.proto.id.DatasetId in project cdap by caskdata.
the class MetadataHttpHandler method removeDatasetProperties.
@DELETE
@Path("/namespaces/{namespace-id}/datasets/{dataset-id}/metadata/properties")
public void removeDatasetProperties(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("dataset-id") String datasetId) throws NotFoundException {
DatasetId dataset = new DatasetId(namespaceId, datasetId);
metadataAdmin.removeProperties(dataset);
responder.sendString(HttpResponseStatus.OK, String.format("Metadata properties for dataset %s deleted successfully.", dataset));
}
Aggregations