Skip to content

Commit

Permalink
Merge pull request #7317 from mandy-chessell/code2023
Browse files Browse the repository at this point in the history
Add supplementary properties
  • Loading branch information
mandy-chessell authored Jan 13, 2023
2 parents a06a205 + 9985b82 commit c31a2b1
Show file tree
Hide file tree
Showing 35 changed files with 1,608 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ dependencies {
implementation project(':open-metadata-implementation:frameworks:audit-log-framework')
implementation project(':open-metadata-implementation:framework-services:ocf-metadata-management:ocf-metadata-api')
implementation project(':open-metadata-implementation:framework-services:ocf-metadata-management:ocf-metadata-client')
implementation project(':open-metadata-implementation:framework-services:gaf-metadata-management:gaf-metadata-api')
implementation project(':open-metadata-implementation:framework-services:gaf-metadata-management:gaf-metadata-client')
implementation 'org.springframework:spring-core'
compileOnly 'com.fasterxml.jackson.core:jackson-annotations'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@
<artifactId>ocf-metadata-client</artifactId>
</dependency>

</dependencies>
<dependency>
<groupId>org.odpi.egeria</groupId>
<artifactId>gaf-metadata-client</artifactId>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* SPDX-License-Identifier: Apache 2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.assetconsumer.client;

import org.odpi.openmetadata.commonservices.gaf.client.OpenMetadataStoreClientBase;
import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException;

/**
* OpenMetadataStoreClientBase provides an interface to the open metadata store. This is part of the Governance Action Framework (GAF)
* and provides a comprehensive interface for working with all types of metadata, subject to the user's (and this OMAS's) security permissions.
* the interface supports search, maintenance of metadata elements, classifications and relationships plus the ability to raise incident reports
* and todos along with the ability to work with metadata valid values and translations.
*/
public class OpenMetadataStoreClient extends OpenMetadataStoreClientBase
{
private final static String serviceURLMarker = "asset-consumer";

/**
* Create a new client with no authentication embedded in the HTTP request.
*
* @param serverName name of the server to connect to
* @param serverPlatformURLRoot the network address of the server running the OMAS REST servers
*
* @throws InvalidParameterException there is a problem creating the client-side components to issue any
* REST API calls.
*/
public OpenMetadataStoreClient(String serverName,
String serverPlatformURLRoot) throws InvalidParameterException
{
super(serviceURLMarker, serverName, serverPlatformURLRoot);
}


/**
* Create a new client that passes userId and password in each HTTP request. This is the
* userId/password of the calling server. The end user's userId is sent on each request.
*
* @param serverName name of the server to connect to
* @param serverPlatformURLRoot the network address of the server running the OMAS REST servers
* @param serverUserId caller's userId embedded in all HTTP requests
* @param serverPassword caller's password embedded in all HTTP requests
*
* @throws InvalidParameterException there is a problem creating the client-side components to issue any
* REST API calls.
*/
public OpenMetadataStoreClient(String serverName,
String serverPlatformURLRoot,
String serverUserId,
String serverPassword) throws InvalidParameterException
{
super(serviceURLMarker, serverName, serverPlatformURLRoot, serverUserId, serverPassword);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
{
@JsonSubTypes.Type(value = AssetProperties.class, name = "AssetProperties"),
@JsonSubTypes.Type(value = EndpointProperties.class, name = "EndpointProperties"),
@JsonSubTypes.Type(value = SchemaProperties.class, name = "SchemaProperties"),
@JsonSubTypes.Type(value = SoftwareCapabilitiesProperties.class, name = "SoftwareCapabilitiesProperties"),
})
public class SupplementaryProperties extends ReferenceableProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ public void updateDataAsset(String userId,
invalidParameterHandler.validateUserId(userId, methodName);
invalidParameterHandler.validateGUID(assetGUID, assetGUIDParameterName, methodName);
invalidParameterHandler.validateObject(assetProperties, propertiesParameterName, methodName);
invalidParameterHandler.validateName(assetProperties.getQualifiedName(), qualifiedNameParameterName, methodName);
if (! isMergeUpdate)
{
invalidParameterHandler.validateName(assetProperties.getQualifiedName(), qualifiedNameParameterName, methodName);
}

DataAssetRequestBody requestBody = new DataAssetRequestBody();
requestBody.setElementProperties(assetProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException;

/**
* OpenMetadataStoreClientBase sits in the governance context of a governance action service when it is running in the engine host OMAG server.
* It is however shared by all the governance action services running in an engine service so that we only need one connector to the topic
* listener for the watchdog governance services.
* OpenMetadataStoreClientBase provides an interface to the open metadata store. This is part of the Governance Action Framework (GAF)
* and provides a comprehensive interface for working with all types of metadata, subject to the user's (and this OMAS's) security permissions.
* the interface supports search, maintenance of metadata elements, classifications and relationships plus the ability to raise incident reports
* and todos along with the ability to work with metadata valid values and translations.
*/
public class OpenMetadataStoreClient extends OpenMetadataStoreClientBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ List<MetadataCorrelationHeader> getCorrelationProperties(String userId,
* @param isMergeUpdate should the new properties be merged with the existing properties, or replace them entirely
* @param forLineage return elements marked with the Memento classification?
* @param forDuplicateProcessing do not merge elements marked as duplicates?
* @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now)
* @param methodName calling method
* @throws InvalidParameterException the parameters are invalid
* @throws UserNotAuthorizedException user not authorized to issue this request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@
"header": [],
"body": {
"mode": "raw",
"raw": "home/my-table.csv",
"raw": "{\n \"class\" : \"NameRequestBody\",\n \"name\" : \"DropFoot\"\n}",
"options": {
"raw": {
"language": "text"
"language": "json"
}
}
},
Expand Down Expand Up @@ -141,16 +141,16 @@
"response": []
},
{
"name": "Get Assets by search string",
"name": "Find Assets",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": ".*file.*",
"raw": "{\n \"class\" : \"SearchStringRequestBody\",\n \"searchString\" : \".*.\"\n}",
"options": {
"raw": {
"language": "text"
"language": "json"
}
}
},
Expand Down Expand Up @@ -226,7 +226,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{baseURL}}/servers/{{server}}/open-metadata/access-services/asset-owner/users/{{user}}/assets/{{guid}}",
"raw": "{{baseURL}}/servers/{{server}}/open-metadata/access-services/asset-owner/users/{{user}}/assets/{{assetGUID}}",
"host": [
"{{baseURL}}"
],
Expand All @@ -239,33 +239,7 @@
"users",
"{{user}}",
"assets",
"{{guid}}"
]
}
},
"response": []
},
{
"name": "Get Asset Universe (root)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseURL}}/servers/{{server}}/open-metadata/common-services/asset-owner/connected-asset/users/{{user}}/assets/{{guid}}",
"host": [
"{{baseURL}}"
],
"path": [
"servers",
"{{server}}",
"open-metadata",
"common-services",
"asset-owner",
"connected-asset",
"users",
"{{user}}",
"assets",
"{{guid}}"
"{{assetGUID}}"
]
}
},
Expand All @@ -277,7 +251,7 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{baseURL}}/servers/{{server}}/open-metadata/common-services/asset-owner/connected-asset/users/{{user}}/assets/{{guid}}/connection",
"raw": "{{baseURL}}/servers/{{server}}/open-metadata/common-services/asset-owner/connected-asset/users/{{user}}/assets/{{assetGUID}}/connection",
"host": [
"{{baseURL}}"
],
Expand All @@ -291,7 +265,7 @@
"users",
"{{user}}",
"assets",
"{{guid}}",
"{{assetGUID}}",
"connection"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* AssetAttachmentManagementInterface defines the operations to manage the different types of attachments
* that can be made to an Asset. These attachments are used to define how th asset is to be governed.
* that can be made to an Asset. These attachments are used to define how the asset is to be governed.
*/
public interface AssetAttachmentManagementInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,26 @@ String addAssetToCatalogUsingTemplate(String userId,
PropertyServerException;


/**
* Update the metadata element representing an asset.
*
* @param userId calling user
* @param assetGUID unique identifier of the metadata element to update
* @param isMergeUpdate should the new properties be merged with existing properties (true) or completely replace them (false)?
* @param assetProperties new properties for this element
*
* @throws InvalidParameterException one of the parameters is invalid
* @throws UserNotAuthorizedException the user is not authorized to issue this request
* @throws PropertyServerException there is a problem reported in the open metadata server(s)
*/
void updateAsset(String userId,
String assetGUID,
boolean isMergeUpdate,
AssetProperties assetProperties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
* Stores the supplied schema details in the catalog and attaches it to the asset. If another schema is currently
* attached to the asset, it is unlinked and deleted. If more attributes need to be added in addition to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@
@JsonSubTypes({
@JsonSubTypes.Type(value = DataStoreProperties.class, name = "DataStoreProperties"),
})
public class AssetProperties extends ReferenceableProperties
public class AssetProperties extends SupplementaryProperties
{
private static final long serialVersionUID = 1L;

private String name = null;
private String versionIdentifier = null;
private String displayName = null;
private String description = null;
private String owner = null;
private OwnerType ownerType = null;
Expand Down Expand Up @@ -92,7 +91,6 @@ public AssetProperties(AssetProperties template)
{
name = template.getName();
versionIdentifier = template.getVersionIdentifier();
displayName = template.getDisplayName();
description = template.getDescription();
owner = template.getOwner();
ownerTypeName = template.getOwnerTypeName();
Expand All @@ -113,11 +111,6 @@ public AssetProperties(AssetProperties template)
*/
public String getName()
{
if (name == null)
{
return displayName;
}

return name;
}

Expand Down Expand Up @@ -155,34 +148,6 @@ public void setVersionIdentifier(String versionIdentifier)
}


/**
* Returns the stored display name property for the asset.
* If no display name is available then name is returned.
*
* @return String name
*/
public String getDisplayName()
{
if (displayName == null)
{
return name;
}

return displayName;
}


/**
* Set up the stored display name property for the asset.
*
* @param displayName String name
*/
public void setDisplayName(String displayName)
{
this.displayName = displayName;
}


/**
* Returns the stored description property for the asset.
* If no description is provided then null is returned.
Expand Down Expand Up @@ -417,7 +382,6 @@ public String toString()
return "AssetProperties{" +
"name='" + name + '\'' +
", versionIdentifier='" + versionIdentifier + '\'' +
", displayName='" + displayName + '\'' +
", description='" + description + '\'' +
", owner='" + owner + '\'' +
", ownerType=" + ownerType +
Expand All @@ -431,6 +395,11 @@ public String toString()
", qualifiedName='" + getQualifiedName() + '\'' +
", additionalProperties=" + getAdditionalProperties() +
", extendedProperties=" + getExtendedProperties() +
", displayName='" + getDisplayName() + '\'' +
", displaySummary='" + getDisplaySummary() + '\'' +
", displayDescription='" + getDisplayDescription() + '\'' +
", abbreviation='" + getAbbreviation() + '\'' +
", usage='" + getUsage() + '\'' +
'}';
}

Expand Down Expand Up @@ -467,10 +436,6 @@ public boolean equals(Object objectToCompare)
{
return false;
}
if (displayName != null ? ! displayName.equals(that.displayName) : that.displayName != null)
{
return false;
}
if (description != null ? ! description.equals(that.description) : that.description != null)
{
return false;
Expand Down Expand Up @@ -516,7 +481,7 @@ public boolean equals(Object objectToCompare)
@Override
public int hashCode()
{
return Objects.hash(super.hashCode(), name, versionIdentifier,displayName, description, owner, ownerTypeName, ownerPropertyName, ownerType,
return Objects.hash(super.hashCode(), name, versionIdentifier, description, owner, ownerTypeName, ownerPropertyName, ownerType,
zoneMembership, originOrganizationGUID, originBusinessCapabilityGUID, otherOriginValues);
}
}
Loading

0 comments on commit c31a2b1

Please sign in to comment.