Skip to content

Commit

Permalink
Merge pull request #7555 from mandy-chessell/code2023
Browse files Browse the repository at this point in the history
Extend reference data value relationship and re-add getDatabaseManagerName
  • Loading branch information
mandy-chessell authored Mar 23, 2023
2 parents a6920e5 + 90be6b8 commit 1097708
Show file tree
Hide file tree
Showing 31 changed files with 657 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.fasterxml.jackson.annotation.*;

import java.io.Serial;
import java.util.Objects;

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
Expand All @@ -18,7 +19,8 @@
@JsonIgnoreProperties(ignoreUnknown=true)
public class GlossaryProperties extends ReferenceableProperties
{
private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

private String displayName = null;
private String description = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

Expand All @@ -23,8 +24,10 @@
@JsonIgnoreProperties(ignoreUnknown=true)
public class ReferenceValueAssignmentProperties extends RelationshipProperties
{
private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

private String attributeName = null;
private int confidence = 0;
private String steward = null;
private String stewardTypeName = null;
Expand All @@ -51,6 +54,7 @@ public ReferenceValueAssignmentProperties(ReferenceValueAssignmentProperties tem

if (template != null)
{
attributeName = template.getAttributeName();
confidence = template.getConfidence();
steward = template.getSteward();
stewardTypeName = template.getStewardTypeName();
Expand All @@ -60,6 +64,28 @@ public ReferenceValueAssignmentProperties(ReferenceValueAssignmentProperties tem
}


/**
* Return the name of the attribute that this reference data value represents.
*
* @return string
*/
public String getAttributeName()
{
return attributeName;
}


/**
* Set up the name of the attribute that this reference data value represents.
*
* @param attributeName string
*/
public void setAttributeName(String attributeName)
{
this.attributeName = attributeName;
}


/**
* Return the confidence level (0-100) that the mapping is correct.
*
Expand Down Expand Up @@ -180,6 +206,7 @@ public String toString()
{
return "ReferenceValueAssignmentProperties{" +
"confidence=" + confidence +
", attributeName='" + attributeName + '\'' +
", steward='" + steward + '\'' +
", stewardTypeName='" + stewardTypeName + '\'' +
", stewardPropertyName='" + stewardPropertyName + '\'' +
Expand Down Expand Up @@ -213,9 +240,12 @@ public boolean equals(Object objectToCompare)
return false;
}
ReferenceValueAssignmentProperties that = (ReferenceValueAssignmentProperties) objectToCompare;
return confidence == that.confidence && Objects.equals(steward, that.steward) && Objects.equals(stewardTypeName,
that.stewardTypeName) && Objects.equals(
stewardPropertyName, that.stewardPropertyName) && Objects.equals(notes, that.notes);
return confidence == that.confidence &&
Objects.equals(attributeName, that.attributeName) &&
Objects.equals(steward, that.steward) &&
Objects.equals(stewardTypeName, that.stewardTypeName) &&
Objects.equals(stewardPropertyName, that.stewardPropertyName) &&
Objects.equals(notes, that.notes);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ public VoidResponse setupReferenceValueTag(String serverName,
requestBody.getExternalSourceName(),
validValueGUID,
elementGUID,
properties.getAttributeName(),
properties.getConfidence(),
properties.getSteward(),
properties.getStewardTypeName(),
Expand All @@ -594,6 +595,7 @@ else if (requestBody.getProperties() == null)
requestBody.getExternalSourceName(),
validValueGUID,
elementGUID,
null,
100,
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serial;
import java.util.Objects;

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
Expand All @@ -22,8 +23,10 @@
@JsonIgnoreProperties(ignoreUnknown=true)
public class ReferenceValueAssignmentProperties extends RelationshipProperties
{
private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

private String attributeName = null;
private int confidence = 0;
private String steward = null;
private String stewardTypeName = null;
Expand All @@ -50,6 +53,7 @@ public ReferenceValueAssignmentProperties(ReferenceValueAssignmentProperties tem

if (template != null)
{
attributeName = template.getAttributeName();
confidence = template.getConfidence();
steward = template.getSteward();
stewardTypeName = template.getStewardTypeName();
Expand All @@ -59,6 +63,28 @@ public ReferenceValueAssignmentProperties(ReferenceValueAssignmentProperties tem
}


/**
* Return the name of the attribute that this reference data value represents.
*
* @return string
*/
public String getAttributeName()
{
return attributeName;
}


/**
* Set up the name of the attribute that this reference data value represents.
*
* @param attributeName string
*/
public void setAttributeName(String attributeName)
{
this.attributeName = attributeName;
}


/**
* Return the confidence level (0-100) that the mapping is correct.
*
Expand Down Expand Up @@ -179,6 +205,7 @@ public String toString()
{
return "ReferenceValueAssignmentProperties{" +
"confidence=" + confidence +
", attributeName='" + attributeName + '\'' +
", steward='" + steward + '\'' +
", stewardTypeName='" + stewardTypeName + '\'' +
", stewardPropertyName='" + stewardPropertyName + '\'' +
Expand Down Expand Up @@ -212,9 +239,12 @@ public boolean equals(Object objectToCompare)
return false;
}
ReferenceValueAssignmentProperties that = (ReferenceValueAssignmentProperties) objectToCompare;
return confidence == that.confidence && Objects.equals(steward, that.steward) && Objects.equals(stewardTypeName,
that.stewardTypeName) && Objects.equals(
stewardPropertyName, that.stewardPropertyName) && Objects.equals(notes, that.notes);
return confidence == that.confidence &&
Objects.equals(attributeName, that.attributeName) &&
Objects.equals(steward, that.steward) &&
Objects.equals(stewardTypeName, that.stewardTypeName) &&
Objects.equals(stewardPropertyName, that.stewardPropertyName) &&
Objects.equals(notes, that.notes);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ public VoidResponse setupReferenceValueTag(String serverName,
requestBody.getExternalSourceName(),
validValueGUID,
elementGUID,
properties.getAttributeName(),
properties.getConfidence(),
properties.getSteward(),
properties.getStewardTypeName(),
Expand All @@ -594,6 +595,7 @@ else if (requestBody.getProperties() == null)
requestBody.getExternalSourceName(),
validValueGUID,
elementGUID,
null,
100,
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package org.odpi.openmetadata.accessservices.digitalarchitecture.api;

import org.odpi.openmetadata.accessservices.digitalarchitecture.metadataelements.*;
import org.odpi.openmetadata.accessservices.digitalarchitecture.properties.ReferenceValueAssignmentProperties;
import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException;
import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException;
import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException;
Expand Down Expand Up @@ -312,22 +313,18 @@ void unassignValidValueFromConsumer(String userId,
* @param userId calling user.
* @param validValueGUID unique identifier of the valid value.
* @param referenceableGUID unique identifier of the element to link to.
* @param confidence how confident is the steward that this mapping is correct (0-100).
* @param steward identifier of steward
* @param notes additional notes from the steward
* @param properties details of the relationship
*
* @throws InvalidParameterException one of the parameters is invalid.
* @throws UserNotAuthorizedException the user is not authorized to make this request.
* @throws PropertyServerException the repository is not available or not working properly.
*/
void assignReferenceValueToItem(String userId,
String validValueGUID,
String referenceableGUID,
int confidence,
String steward,
String notes) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;
void assignReferenceValueToItem(String userId,
String validValueGUID,
String referenceableGUID,
ReferenceValueAssignmentProperties properties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serial;
import java.util.Objects;

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
Expand All @@ -22,8 +23,10 @@
@JsonIgnoreProperties(ignoreUnknown=true)
public class ReferenceValueAssignmentProperties extends RelationshipProperties
{
private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

private String attributeName = null;
private int confidence = 0;
private String steward = null;
private String stewardTypeName = null;
Expand All @@ -50,6 +53,7 @@ public ReferenceValueAssignmentProperties(ReferenceValueAssignmentProperties tem

if (template != null)
{
attributeName = template.getAttributeName();
confidence = template.getConfidence();
steward = template.getSteward();
stewardTypeName = template.getStewardTypeName();
Expand All @@ -59,6 +63,28 @@ public ReferenceValueAssignmentProperties(ReferenceValueAssignmentProperties tem
}


/**
* Return the name of the attribute that this reference data value represents.
*
* @return string
*/
public String getAttributeName()
{
return attributeName;
}


/**
* Set up the name of the attribute that this reference data value represents.
*
* @param attributeName string
*/
public void setAttributeName(String attributeName)
{
this.attributeName = attributeName;
}


/**
* Return the confidence level (0-100) that the mapping is correct.
*
Expand Down Expand Up @@ -179,6 +205,7 @@ public String toString()
{
return "ReferenceValueAssignmentProperties{" +
"confidence=" + confidence +
", attributeName='" + attributeName + '\'' +
", steward='" + steward + '\'' +
", stewardTypeName='" + stewardTypeName + '\'' +
", stewardPropertyName='" + stewardPropertyName + '\'' +
Expand Down Expand Up @@ -212,9 +239,12 @@ public boolean equals(Object objectToCompare)
return false;
}
ReferenceValueAssignmentProperties that = (ReferenceValueAssignmentProperties) objectToCompare;
return confidence == that.confidence && Objects.equals(steward, that.steward) && Objects.equals(stewardTypeName,
that.stewardTypeName) && Objects.equals(
stewardPropertyName, that.stewardPropertyName) && Objects.equals(notes, that.notes);
return confidence == that.confidence &&
Objects.equals(attributeName, that.attributeName) &&
Objects.equals(steward, that.steward) &&
Objects.equals(stewardTypeName, that.stewardTypeName) &&
Objects.equals(stewardPropertyName, that.stewardPropertyName) &&
Objects.equals(notes, that.notes);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,23 +696,19 @@ public void unassignValidValueFromConsumer(String userId,
* @param userId calling user.
* @param validValueGUID unique identifier of the valid value.
* @param referenceableGUID unique identifier of the element to link to.
* @param confidence how confident is the steward that this mapping is correct (0-100).
* @param steward identifier of steward
* @param notes additional notes from the steward
* @param properties properties for the relationship
*
* @throws InvalidParameterException one of the parameters is invalid.
* @throws UserNotAuthorizedException the user is not authorized to make this request.
* @throws PropertyServerException the repository is not available or not working properly.
*/
@Override
public void assignReferenceValueToItem(String userId,
String validValueGUID,
String referenceableGUID,
int confidence,
String steward,
String notes) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
public void assignReferenceValueToItem(String userId,
String validValueGUID,
String referenceableGUID,
ReferenceValueAssignmentProperties properties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
{
final String methodName = "assignReferenceValueToItem";
final String validValueGUIDParameter = "validValueGUID";
Expand All @@ -724,14 +720,9 @@ public void assignReferenceValueToItem(String userId,

final String urlTemplate = serverPlatformURLRoot + "/servers/{0}/open-metadata/access-services/digital-architecture/users/{1}/reference-values/{2}/items/{3}";

ReferenceValueAssignmentProperties requestBody = new ReferenceValueAssignmentProperties();
requestBody.setConfidence(confidence);
requestBody.setSteward(steward);
requestBody.setNotes(notes);

restClient.callVoidPostRESTCall(methodName,
urlTemplate,
requestBody,
properties,
serverName,
userId,
validValueGUID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public B getNewBean(Class<B> beanClass,
{
InstanceProperties instanceProperties = relationship.getProperties();

bean.setAttributeName(this.getAttributeName(instanceProperties));
bean.setConfidence(this.getConfidence(instanceProperties));
bean.setSteward(this.getSteward(instanceProperties));
bean.setStewardTypeName(this.getStewardTypeName(instanceProperties));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public B getNewBean(Class<B> beanClass,
{
instanceProperties = relationship.getProperties();

bean.setAttributeName(this.getAttributeName(instanceProperties));
bean.setConfidence(this.getConfidence(instanceProperties));
bean.setSteward(this.getSteward(instanceProperties));
bean.setStewardTypeName(this.getStewardTypeName(instanceProperties));
Expand Down
Loading

0 comments on commit 1097708

Please sign in to comment.