mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-02 11:49:23 +00:00
fix(protobuf) Set undeprecated ownership type & fix case sentitive urn corpGroup (#5425)
This commit is contained in:
parent
9d79fd3767
commit
e9c943f3b9
@ -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`.
|
||||
|
||||
|
||||
@ -37,14 +37,14 @@ public class OwnershipVisitor implements ProtobufModelVisitor<Owner> {
|
||||
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;
|
||||
|
||||
@ -27,17 +27,17 @@ public class OwnershipVisitorTest {
|
||||
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()));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user