Skip to content

Commit

Permalink
Merge pull request #8153 from mandy-chessell/oak2024
Browse files Browse the repository at this point in the history
Add Valid Metadata OMVS type support
  • Loading branch information
mandy-chessell authored Apr 24, 2024
2 parents 4085468 + 9e72a1a commit d8a0ef3
Show file tree
Hide file tree
Showing 101 changed files with 2,515 additions and 1,564 deletions.
2 changes: 1 addition & 1 deletion OpenConnectorsArchiveGUIDMap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/OpenConnectorsArchive.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/OpenConnectorsArchive.omarchive

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,11 @@ public VoidResponse addRatingToAsset(String serverName,
{
RatingHandler<OpenMetadataAPIDummyBean> handler = instanceHandler.getRatingHandler(userId, serverName, methodName);

int starRating = StarRating.NO_RECOMMENDATION.getOpenTypeOrdinal();
int starRating = StarRating.NOT_RECOMMENDED.getOrdinal();

if (requestBody.getStarRating() != null)
{
starRating = requestBody.getStarRating().getOpenTypeOrdinal();
starRating = requestBody.getStarRating().getOrdinal();
}
auditLog = instanceHandler.getAuditLog(userId, serverName, methodName);
handler.saveRating(userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ KeyPattern removeKeyPattern(InstanceProperties instanceProperties)

for (KeyPattern keyPattern : KeyPattern.values())
{
if (keyPattern.getOpenTypeOrdinal() == ordinal)
if (keyPattern.getOrdinal() == ordinal)
{
return keyPattern;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private StarRating removeStarRatingFromProperties(InstanceProperties propertie
*/
private StarRating getStarRatingFromProperties(InstanceProperties properties)
{
StarRating starRating = StarRating.NO_RECOMMENDATION;
StarRating starRating = StarRating.NOT_RECOMMENDED;

if (properties != null)
{
Expand All @@ -188,7 +188,7 @@ private StarRating getStarRatingFromProperties(InstanceProperties properties)
switch (enumPropertyValue.getOrdinal())
{
case 0:
starRating = StarRating.NO_RECOMMENDATION;
starRating = StarRating.NOT_RECOMMENDED;
break;

case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,11 @@ private int getPermittedSynchronization(SynchronizationDirection synchronization
*/
private int getKeyPattern(KeyPattern keyPattern)
{
int keyPatternOrdinal = KeyPattern.LOCAL_KEY.getOpenTypeOrdinal();
int keyPatternOrdinal = KeyPattern.LOCAL_KEY.getOrdinal();

if (keyPattern != null)
{
keyPatternOrdinal = keyPattern.getOpenTypeOrdinal();
keyPatternOrdinal = keyPattern.getOrdinal();
}

return keyPatternOrdinal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ public void setupColumnAsPrimaryKey(String userId,
int keyPatternOrdinal = 0;
if (primaryKeyPattern != null)
{
keyPatternOrdinal = primaryKeyPattern.getOpenTypeOrdinal();
keyPatternOrdinal = primaryKeyPattern.getOrdinal();
}

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ public VoidResponse addExternalIdentifier(String serverNa
permittedSynchronizationOrdinal = requestBody.getSynchronizationDirection().getOpenTypeOrdinal();
}

int keyPatternOrdinal = KeyPattern.LOCAL_KEY.getOpenTypeOrdinal();
int keyPatternOrdinal = KeyPattern.LOCAL_KEY.getOrdinal();
if (requestBody.getKeyPattern() != null)
{
keyPatternOrdinal = requestBody.getKeyPattern().getOpenTypeOrdinal();
keyPatternOrdinal = requestBody.getKeyPattern().getOrdinal();
}

handler.setUpExternalIdentifier(userId,
Expand Down Expand Up @@ -430,10 +430,10 @@ public VoidResponse updateExternalIdentifier(String serve
permittedSynchronizationOrdinal = requestBody.getSynchronizationDirection().getOpenTypeOrdinal();
}

int keyPatternOrdinal = KeyPattern.LOCAL_KEY.getOpenTypeOrdinal();
int keyPatternOrdinal = KeyPattern.LOCAL_KEY.getOrdinal();
if (requestBody.getKeyPattern() != null)
{
keyPatternOrdinal = requestBody.getKeyPattern().getOpenTypeOrdinal();
keyPatternOrdinal = requestBody.getKeyPattern().getOrdinal();
}

handler.setUpExternalIdentifier(userId,
Expand Down Expand Up @@ -634,10 +634,10 @@ public VoidResponse removeExternalIdentifier(String serverName,
permittedSynchronizationOrdinal = requestBody.getMetadataCorrelationProperties().getSynchronizationDirection().getOpenTypeOrdinal();
}

int keyPatternOrdinal = KeyPattern.LOCAL_KEY.getOpenTypeOrdinal();
int keyPatternOrdinal = KeyPattern.LOCAL_KEY.getOrdinal();
if (requestBody.getMetadataCorrelationProperties().getKeyPattern() != null)
{
keyPatternOrdinal = requestBody.getMetadataCorrelationProperties().getKeyPattern().getOpenTypeOrdinal();
keyPatternOrdinal = requestBody.getMetadataCorrelationProperties().getKeyPattern().getOrdinal();
}

handler.removeExternalIdentifier(userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public VoidResponse addRatingToElement(String serverName,
{
RatingHandler<RatingElement> handler = instanceHandler.getRatingHandler(userId, serverName, methodName);

int starRating = StarRating.NO_RECOMMENDATION.getOpenTypeOrdinal();
int starRating = StarRating.NOT_RECOMMENDED.getOrdinal();

if (requestBody.getStarRating() != null)
{
starRating = requestBody.getStarRating().getOpenTypeOrdinal();
starRating = requestBody.getStarRating().getOrdinal();
}

auditLog = instanceHandler.getAuditLog(userId, serverName, methodName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private StarRating removeStarRatingFromProperties(InstanceProperties propertie
*/
private StarRating getStarRatingFromProperties(InstanceProperties properties)
{
StarRating starRating = StarRating.NO_RECOMMENDATION;
StarRating starRating = StarRating.NOT_RECOMMENDED;

if (properties != null)
{
Expand All @@ -176,7 +176,7 @@ private StarRating getStarRatingFromProperties(InstanceProperties properties)
switch (enumPropertyValue.getOrdinal())
{
case 0:
starRating = StarRating.NO_RECOMMENDATION;
starRating = StarRating.NOT_RECOMMENDED;
break;

case 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ KeyPattern removeKeyPattern(InstanceProperties instanceProperties)

for (KeyPattern keyPattern : KeyPattern.values())
{
if (keyPattern.getOpenTypeOrdinal() == ordinal)
if (keyPattern.getOrdinal() == ordinal)
{
return keyPattern;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3584,15 +3584,13 @@ public VoidResponse setPrimaryKeyOnColumn(String serverName,

if (requestBody != null)
{
if (requestBody.getProperties() instanceof DatabasePrimaryKeyProperties)
if (requestBody.getProperties() instanceof DatabasePrimaryKeyProperties databasePrimaryKeyProperties)
{
DatabasePrimaryKeyProperties databasePrimaryKeyProperties = (DatabasePrimaryKeyProperties) requestBody.getProperties();

int keyPattern = KeyPattern.LOCAL_KEY.getOpenTypeOrdinal();
int keyPattern = KeyPattern.LOCAL_KEY.getOrdinal();

if (databasePrimaryKeyProperties.getKeyPattern() != null)
{
keyPattern = databasePrimaryKeyProperties.getKeyPattern().getOpenTypeOrdinal();
keyPattern = databasePrimaryKeyProperties.getKeyPattern().getOrdinal();
}

handler.setPrimaryKeyOnColumn(userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import org.odpi.openmetadata.frameworks.openmetadata.enums.ContactMethodType;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -22,7 +21,7 @@
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class ContactMethodProperties implements Serializable
public class ContactMethodProperties
{
private ContactMethodType type = null;
private String service = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies {
implementation project(':open-metadata-implementation:frameworks:audit-log-framework')
implementation project(':open-metadata-implementation:frameworks:open-connector-framework')
implementation project(':open-metadata-implementation:frameworks:open-metadata-framework')
implementation project(':open-metadata-implementation:frameworks:governance-action-framework')
implementation project(':open-metadata-implementation:repository-services:repository-services-apis')
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation project(':open-metadata-test:open-metadata-ut')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
package org.odpi.openmetadata.accessservices.digitalarchitecture.api;


import org.odpi.openmetadata.accessservices.digitalarchitecture.metadataelements.TemplateElement;
import org.odpi.openmetadata.accessservices.digitalarchitecture.properties.TemplateClassificationProperties;
import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException;
import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException;
import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
Expand All @@ -19,41 +23,110 @@ public interface ManageTemplates
* Classify an asset as suitable to be used as a template for cataloguing assets of a similar types.
*
* @param userId calling user
* @param assetGUID unique identifier of the asset to classify
* @param name name of the template
* @param versionIdentifier version identifier for the template eg 1.0
* @param description description of when, where and how to use the template
* @param additionalProperties any additional properties
* @param elementGUID unique identifier of the element to classify as a template
* @param properties properties of the template
* @param specification values required to use the template
*
* @throws InvalidParameterException asset or element not known, null userId or guid
* @throws InvalidParameterException element not known, null userId or guid
* @throws PropertyServerException problem accessing property server
* @throws UserNotAuthorizedException security access problem
*/
void addTemplateClassification(String userId,
String assetGUID,
String name,
String versionIdentifier,
String description,
Map<String, String> additionalProperties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;
void addTemplateClassification(String userId,
String elementGUID,
TemplateClassificationProperties properties,
Map<String, List<Map<String, String>>> specification) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
* Remove the classification that indicates that this asset can be used as a template.
*
* @param userId calling user
* @param assetGUID unique identifier of the asset to declassify
* @param elementGUID unique identifier of the element to declassify
*
* @throws InvalidParameterException asset or element not known, null userId or guid
* @throws InvalidParameterException element not known, null userId or guid
* @throws PropertyServerException problem accessing property server
* @throws UserNotAuthorizedException security access problem
*/
void removeTemplateClassification(String userId,
String assetGUID) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;
String elementGUID) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
* Return a list of templates for a particular open metadata type of element.
*
* @param userId calling user
* @param typeName type name to query
* @param effectiveTime optional effective time
* @param startFrom starting element
* @param pageSize maximum number of elements
*
* @return list of templates
*
* @throws InvalidParameterException element not known, null userId or guid
* @throws PropertyServerException problem accessing property server
* @throws UserNotAuthorizedException security access problem
*/
List<TemplateElement> getTemplatesForType(String userId,
String typeName,
Date effectiveTime,
int startFrom,
int pageSize) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
* Find templates with the requested RegEx in the string properties of the template properties.
*
* @param userId calling user
* @param searchString string to search for (regEx)
* @param typeName type name to query (if null, any type is returned)
* @param effectiveTime optional effective time
* @param startFrom starting element
* @param pageSize maximum number of elements
*
* @return list of templates
*
* @throws InvalidParameterException element not known, null userId or guid
* @throws PropertyServerException problem accessing property server
* @throws UserNotAuthorizedException security access problem
*/
List<TemplateElement> findTemplates(String userId,
String searchString,
String typeName,
Date effectiveTime,
int startFrom,
int pageSize) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
* Return the templates with the requested name.
*
* @param userId calling user
* @param name name to search for
* @param typeName type name to query (if null, any type is returned)
* @param effectiveTime optional effective time
* @param startFrom starting element
* @param pageSize maximum number of elements
*
* @return list of templates
*
* @throws InvalidParameterException element not known, null userId or guid
* @throws PropertyServerException problem accessing property server
* @throws UserNotAuthorizedException security access problem
*/
List<TemplateElement> getTemplatesByName(String userId,
String name,
String typeName,
Date effectiveTime,
int startFrom,
int pageSize) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementHeader;
import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementStub;

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

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
Expand All @@ -23,10 +22,8 @@
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
public class RelatedElement implements Serializable
public class RelatedElement
{
private static final long serialVersionUID = 1L;

private ElementHeader relationshipHeader = null;
private RelationshipProperties relationshipProperties = null;
private ElementStub relatedElement = null;
Expand Down
Loading

0 comments on commit d8a0ef3

Please sign in to comment.