mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-04 22:52:54 +00:00
This change should've been made in datahub-gma instead. This reverts commit 127d84e3f9bc8b0638df535a594f21d8e34a508b.
This commit is contained in:
parent
127d84e3f9
commit
230ecce9d6
@ -38,7 +38,6 @@ public final class AzkabanFlowUrn extends Urn {
|
||||
}
|
||||
|
||||
public static AzkabanFlowUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String content = new Urn(rawUrn).getContent();
|
||||
String[] parts = content.substring(1, content.length() - 1).split(",");
|
||||
return new AzkabanFlowUrn(parts[0], parts[1], parts[2]);
|
||||
|
||||
@ -31,7 +31,6 @@ public final class AzkabanJobUrn extends Urn {
|
||||
}
|
||||
|
||||
public static AzkabanJobUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String content = new Urn(rawUrn).getContent();
|
||||
String flowParts = content.substring(1, content.lastIndexOf(",") + 1);
|
||||
String[] parts = content.substring(1, content.length() - 1).split(",");
|
||||
|
||||
@ -31,8 +31,9 @@ public final class ChartUrn extends Urn {
|
||||
}
|
||||
|
||||
public static ChartUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String[] urnParts = new Urn(rawUrn).getContent().split(",");
|
||||
Urn urn = new Urn(rawUrn);
|
||||
validateUrn(urn, ENTITY_TYPE);
|
||||
String[] urnParts = urn.getContent().split(",");
|
||||
return new ChartUrn(urnParts[0], urnParts[1]);
|
||||
}
|
||||
|
||||
|
||||
@ -25,13 +25,14 @@ public final class CorpGroupUrn extends Urn {
|
||||
}
|
||||
|
||||
public static CorpGroupUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String groupName = new Urn(rawUrn).getContent();
|
||||
return new CorpGroupUrn(groupName);
|
||||
}
|
||||
|
||||
public static CorpGroupUrn createFromUrn(Urn urn) throws URISyntaxException {
|
||||
validateUrn(urn, ENTITY_TYPE);
|
||||
if (!ENTITY_TYPE.equals(urn.getEntityType())) {
|
||||
throw new URISyntaxException(urn.toString(), "Can't cast URN to CorpGroupUrn, not same ENTITY");
|
||||
}
|
||||
|
||||
Matcher matcher = URN_PATTERN.matcher(urn.toString());
|
||||
if (matcher.find()) {
|
||||
|
||||
@ -26,13 +26,14 @@ public final class CorpuserUrn extends Urn {
|
||||
}
|
||||
|
||||
public static CorpuserUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String username = new Urn(rawUrn).getContent();
|
||||
return new CorpuserUrn(username);
|
||||
}
|
||||
|
||||
public static CorpuserUrn createFromUrn(Urn urn) throws URISyntaxException {
|
||||
validateUrn(urn, ENTITY_TYPE);
|
||||
if (!ENTITY_TYPE.equals(urn.getEntityType())) {
|
||||
throw new URISyntaxException(urn.toString(), "Can't cast URN to CorpuserUrn, not same ENTITY");
|
||||
}
|
||||
|
||||
Matcher matcher = URN_PATTERN.matcher(urn.toString());
|
||||
if (matcher.find()) {
|
||||
|
||||
@ -31,8 +31,9 @@ public final class DashboardUrn extends Urn {
|
||||
}
|
||||
|
||||
public static DashboardUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String[] urnParts = new Urn(rawUrn).getContent().split(",");
|
||||
Urn urn = new Urn(rawUrn);
|
||||
validateUrn(urn, ENTITY_TYPE);
|
||||
String[] urnParts = urn.getContent().split(",");
|
||||
return new DashboardUrn(urnParts[0], urnParts[1]);
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,6 @@ public final class DataPlatformUrn extends Urn {
|
||||
}
|
||||
|
||||
public static DataPlatformUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String platformName = new Urn(rawUrn).getContent();
|
||||
return new DataPlatformUrn(platformName);
|
||||
}
|
||||
|
||||
@ -40,7 +40,6 @@ public class DataProcessUrn extends Urn {
|
||||
}
|
||||
|
||||
public static DataProcessUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String content = new Urn(rawUrn).getContent();
|
||||
String[] parts = content.substring(1, content.length() - 1).split(",");
|
||||
return new DataProcessUrn(parts[0], parts[1], toFabricType(parts[2]));
|
||||
|
||||
@ -41,7 +41,6 @@ public final class DatasetUrn extends Urn {
|
||||
}
|
||||
|
||||
public static DatasetUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String content = new Urn(rawUrn).getContent();
|
||||
String[] parts = content.substring(1, content.length() - 1).split(",");
|
||||
return new DatasetUrn(DataPlatformUrn.createFromString(parts[0]), parts[1], toFabricType(parts[2]));
|
||||
|
||||
@ -39,7 +39,6 @@ public final class MLModelUrn extends Urn {
|
||||
}
|
||||
|
||||
public static MLModelUrn createFromString(String rawUrn) throws URISyntaxException {
|
||||
validateUrn(rawUrn, ENTITY_TYPE);
|
||||
String content = new Urn(rawUrn).getContent();
|
||||
String[] parts = content.substring(1, content.length() - 1).split(",");
|
||||
return new MLModelUrn(DataPlatformUrn.createFromString(parts[0]), parts[1], toFabricType(parts[2]));
|
||||
|
||||
@ -91,12 +91,6 @@ public class Urn {
|
||||
return createFromString(rawUrn);
|
||||
}
|
||||
|
||||
public static void validateUrn(@Nonnull String rawUrn, @Nonnull String entityType)
|
||||
throws URISyntaxException {
|
||||
final Urn urn = new Urn(rawUrn);
|
||||
validateUrn(urn, entityType);
|
||||
}
|
||||
|
||||
public static void validateUrn(@Nonnull Urn urn, @Nonnull String entityType)
|
||||
throws URISyntaxException {
|
||||
if (!entityType.equals(urn.getEntityType())) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user