Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(protobuf): ownership fixes #5425

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metadata-integration/java/datahub-protobuf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ The following is a consolidated example for the possible field level term option

##### OWNER

One or more owners can be specified and can be any combination of `corpUser` and `corpGroup` entities. The default entity type is `corpGroup`. By default, the ownership type is set to `producer`, see the second example for setting the ownership type.
One or more owners can be specified and can be any combination of `corpUser` and `corpGroup` entities. The default entity type is `corpGroup`. By default, the ownership type is set to `technical_owner`, see the second example for setting the ownership type.

The following example assigns the ownership to a group of `myGroup` and a user called `myName`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public Stream<Owner> visitGraph(VisitContext context) {
try {
ownershipType = OwnershipType.valueOf(entry.getKey().getName().toUpperCase());
} catch (IllegalArgumentException e) {
ownershipType = OwnershipType.PRODUCER;
ownershipType = OwnershipType.TECHNICAL_OWNER;
}

String[] id = entry.getValue().toLowerCase().split(":", 2);
return new Owner()
.setType(ownershipType)
.setSource(new OwnershipSource().setType(OwnershipSourceType.MANUAL))
.setOwner(new Urn(id.length > 1 ? id[0] : "corpgroup", id[id.length - 1]));
.setOwner(new Urn(id.length > 1 ? id[0].replaceFirst("corpgroup", "corpGroup") : "corpGroup", id[id.length - 1]));
} catch (URISyntaxException e) {
System.err.println(e.getMessage());
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ public void visitorTest() throws IOException {
OwnershipVisitor test = new OwnershipVisitor();

assertEquals(Set.of(new Owner()
.setType(OwnershipType.PRODUCER)
.setType(OwnershipType.TECHNICAL_OWNER)
.setSource(new OwnershipSource().setType(OwnershipSourceType.MANUAL))
.setOwner(Urn.createFromTuple("corpgroup", "teamb")),
.setOwner(Urn.createFromTuple("corpGroup", "teamb")),
new Owner()
.setType(OwnershipType.PRODUCER)
.setType(OwnershipType.TECHNICAL_OWNER)
.setSource(new OwnershipSource().setType(OwnershipSourceType.MANUAL))
.setOwner(Urn.createFromTuple("corpuser", "datahub")),
new Owner()
.setType(OwnershipType.TECHNICAL_OWNER)
.setSource(new OwnershipSource().setType(OwnershipSourceType.MANUAL))
.setOwner(Urn.createFromTuple("corpgroup", "technicalowner"))
.setOwner(Urn.createFromTuple("corpGroup", "technicalowner"))
),
graph.accept(getVisitContextBuilder("extended_protobuf.MessageA"), List.of(test)).collect(Collectors.toSet()));
}
Expand Down