vyommani commented on code in PR #1309:
URL: https://github.com/apache/ranger/pull/1309#discussion_r4286048173
##########
agents-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java:
##########
@@ -3742,4 +3782,426 @@ public String toString() {
return sb.toString();
}
}
+
+ @JsonAutoDetect(fieldVisibility = Visibility.ANY)
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class RangerConstraintDef implements java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private Long itemId;
+ private String name;
+ private String label;
+ private String description;
+ private String rbKeyLabel;
+ private String rbKeyDescription;
+ private List<String> resources;
+ private List<String> accessTypes;
+ private List<RangerConstraintParamDef> parameters;
+ private Map<String, String> options;
+
+ public RangerConstraintDef() {
+ setResources(null);
+ setAccessTypes(null);
+ setParameters(null);
+ setOptions(null);
+ }
+
+ public RangerConstraintDef(RangerConstraintDef other) {
+ setItemId(other.getItemId());
+ setName(other.getName());
+ setLabel(other.getLabel());
+ setDescription(other.getDescription());
+ setRbKeyLabel(other.getRbKeyLabel());
+ setRbKeyDescription(other.getRbKeyDescription());
+ setResources(other.getResources());
+ setAccessTypes(other.getAccessTypes());
+ setParameters(other.getParameters());
+ setOptions(other.getOptions() == null ? null : new
HashMap<>(other.getOptions()));
+ }
+
+ public Long getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(Long itemId) {
+ this.itemId = itemId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getRbKeyLabel() {
+ return rbKeyLabel;
+ }
+
+ public void setRbKeyLabel(String rbKeyLabel) {
+ this.rbKeyLabel = rbKeyLabel;
+ }
+
+ public String getRbKeyDescription() {
+ return rbKeyDescription;
+ }
+
+ public void setRbKeyDescription(String rbKeyDescription) {
+ this.rbKeyDescription = rbKeyDescription;
+ }
+
+ public List<String> getResources() {
+ return resources;
+ }
+
+ public void setResources(List<String> resources) {
+ if (this.resources == null) {
+ this.resources = new ArrayList<>();
+ }
+
+ if (this.resources == resources) {
+ return;
+ }
+
+ this.resources.clear();
+
+ if (resources != null) {
+ this.resources.addAll(resources);
+ }
+ }
+
+ public List<String> getAccessTypes() {
+ return accessTypes;
+ }
+
+ public void setAccessTypes(List<String> accessTypes) {
+ if (this.accessTypes == null) {
+ this.accessTypes = new ArrayList<>();
+ }
+
+ if (this.accessTypes == accessTypes) {
+ return;
+ }
+
+ this.accessTypes.clear();
+
+ if (accessTypes != null) {
+ this.accessTypes.addAll(accessTypes);
+ }
+ }
+
+ public List<RangerConstraintParamDef> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(List<RangerConstraintParamDef> parameters) {
+ if (this.parameters == null) {
+ this.parameters = new ArrayList<>();
+ }
+
+ if (this.parameters == parameters) {
+ return;
+ }
+
+ this.parameters.clear();
+
+ if (parameters != null) {
+ this.parameters.addAll(parameters);
+ }
+ }
+
+ public Map<String, String> getOptions() {
+ return options;
+ }
+
+ public void setOptions(Map<String, String> options) {
+ this.options = options == null ? new HashMap<>() : options;
+ }
+
+ public void dedupStrings(Map<String, String> strTbl) {
+ name = StringUtil.dedupString(name, strTbl);
+ label = StringUtil.dedupString(label, strTbl);
+ description = StringUtil.dedupString(description, strTbl);
+ rbKeyLabel = StringUtil.dedupString(rbKeyLabel, strTbl);
+ rbKeyDescription = StringUtil.dedupString(rbKeyDescription,
strTbl);
+ resources = StringUtil.dedupStringsList(resources, strTbl);
+ accessTypes = StringUtil.dedupStringsList(accessTypes,
strTbl);
+ options = StringUtil.dedupStringsMap(options, strTbl);
+
+ if (parameters != null) {
+ for (RangerConstraintParamDef parameter : parameters) {
+ parameter.dedupStrings(strTbl);
+ }
+ }
+ }
+
+ public StringBuilder toString(StringBuilder sb) {
+ sb.append("RangerConstraintDef={");
+ sb.append("itemId={").append(itemId).append("} ");
+ sb.append("name={").append(name).append("} ");
+ sb.append("label={").append(label).append("} ");
+ sb.append("description={").append(description).append("} ");
+ sb.append("rbKeyLabel={").append(rbKeyLabel).append("} ");
+ sb.append("rbKeyDescription={").append(rbKeyDescription).append("}
");
+
+ sb.append("resources={");
+ if (resources != null) {
+ for (String resource : resources) {
+ if (resource != null) {
+ sb.append(resource).append(" ");
+ }
+ }
+ }
+ sb.append("} ");
+
+ sb.append("accessTypes={");
+ if (accessTypes != null) {
+ for (String accessType : accessTypes) {
+ if (accessType != null) {
+ sb.append(accessType).append(" ");
+ }
+ }
+ }
+ sb.append("} ");
+
+ sb.append("parameters={");
+ if (parameters != null) {
+ for (RangerConstraintParamDef parameter : parameters) {
+ if (parameter != null) {
+ parameter.toString(sb);
+ }
+ }
+ }
+ sb.append("} ");
+
+ sb.append("options={").append(options).append("} ");
+ sb.append("}");
+
+ return sb;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(itemId, name, label, description, rbKeyLabel,
rbKeyDescription, resources, accessTypes, parameters, options);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ } else if (obj == null) {
+ return false;
+ } else if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ RangerConstraintDef other = (RangerConstraintDef) obj;
+
+ return Objects.equals(itemId, other.itemId) &&
+ Objects.equals(name, other.name) &&
+ Objects.equals(label, other.label) &&
+ Objects.equals(description, other.description) &&
+ Objects.equals(rbKeyLabel, other.rbKeyLabel) &&
+ Objects.equals(rbKeyDescription, other.rbKeyDescription) &&
+ Objects.equals(resources, other.resources) &&
+ Objects.equals(accessTypes, other.accessTypes) &&
+ Objects.equals(parameters, other.parameters) &&
+ Objects.equals(options, other.options);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ toString(sb);
+
+ return sb.toString();
+ }
+ }
+
+ @JsonAutoDetect(fieldVisibility = Visibility.ANY)
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class RangerConstraintParamDef implements
java.io.Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private Long itemId;
+ private String name;
+ private String label;
+ private String description;
+ private String type;
Review Comment:
Added subType to RangerConstraintParamDef, following RangerServiceConfigDef:
for type = enum, subType names an enum in the service-def’s enums.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]