Skip to content

Commit

Permalink
Merge pull request #8495 from mandy-chessell/oak2024
Browse files Browse the repository at this point in the history
Fixes for Postgres Repository
  • Loading branch information
mandy-chessell authored Nov 21, 2024
2 parents aea88e9 + 8b18ab0 commit 92cfb7a
Show file tree
Hide file tree
Showing 111 changed files with 4,654 additions and 1,220 deletions.
2 changes: 1 addition & 1 deletion EgeriaContentPacksGUIDMap.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ logging.level.root=OFF
logging.level.org.springframework=ERROR
logging.level.org.springframework.boot.web.embedded.tomcat=INFO
logging.level.org.odpi.openmetadata.platformchassis.springboot=INFO
#tracing SQL calls
# tracing SQL calls
#logging.level.org.odpi.openmetadata.adapters.connectors.resource.jdbc=DEBUG
#tracing REST calls
# tracing REST calls
#logging.level.org.odpi.openmetadata.commonservices.ffdc.RESTCallLogger=DEBUG

################################################
Expand Down
4 changes: 3 additions & 1 deletion container.application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ logging.level.root=OFF
logging.level.org.springframework=ERROR
logging.level.org.springframework.boot.web.embedded.tomcat=INFO
logging.level.org.odpi.openmetadata.platformchassis.springboot=INFO
#tracing REST calls
# tracing SQL calls
#logging.level.org.odpi.openmetadata.adapters.connectors.resource.jdbc=DEBUG
# tracing REST calls
#logging.level.org.odpi.openmetadata.commonservices.ffdc.RESTCallLogger=DEBUG

################################################
Expand Down
2 changes: 1 addition & 1 deletion content-packs/APIsContentPack.omarchive

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ void addExternalIdentifier(String userId,
UserNotAuthorizedException,
PropertyServerException;

/**
* Add a new external identifier to an existing open metadata element.
*
* @param userId calling user
* @param assetManagerGUID unique identifier of software capability representing the caller
* @param assetManagerName unique name of software capability representing the caller
* @param assetManagerTypeName type name of the software capability describing the asset manager
* @param openMetadataElementGUID unique identifier (GUID) of the element in the open metadata ecosystem
* @param openMetadataElementTypeName type name for the open metadata element
* @param externalIdentifierProperties optional properties used to define an external identifier
*
* @throws InvalidParameterException one of the parameters is invalid
* @throws UserNotAuthorizedException user not authorized to issue this request
* @throws PropertyServerException problem accessing the property server
*/
void addExternalIdentifier(String userId,
String assetManagerGUID,
String assetManagerName,
String assetManagerTypeName,
String openMetadataElementGUID,
String openMetadataElementTypeName,
ExternalIdentifierProperties externalIdentifierProperties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;



/**
* Update the description of a specific external identifier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.odpi.openmetadata.frameworks.openmetadata.properties.FindProperties;
import org.odpi.openmetadata.frameworks.openmetadata.properties.ReferenceableProperties;
import org.odpi.openmetadata.frameworks.openmetadata.properties.RelationshipProperties;
import org.odpi.openmetadata.frameworks.openmetadata.types.OpenMetadataType;

import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -685,6 +686,36 @@ public void addExternalIdentifier(String userId,
ExternalIdentifierProperties externalIdentifierProperties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
{
this.addExternalIdentifier(userId, assetManagerGUID, assetManagerName, OpenMetadataType.INVENTORY_CATALOG.typeName, openMetadataElementGUID, openMetadataElementTypeName, externalIdentifierProperties);
}


/**
* Add a new external identifier to an existing open metadata element.
*
* @param userId calling user
* @param assetManagerGUID unique identifier of software server capability representing the caller
* @param assetManagerName unique name of software server capability representing the caller
* @param assetManagerTypeName type name of the software capability describing the asset manager
* @param openMetadataElementGUID unique identifier (GUID) of the element in the open metadata ecosystem
* @param openMetadataElementTypeName type name for the open metadata element
* @param externalIdentifierProperties optional properties used to define an external identifier
*
* @throws InvalidParameterException one of the parameters is invalid
* @throws UserNotAuthorizedException user not authorized to issue this request
* @throws PropertyServerException problem accessing the property server
*/
@Override
public void addExternalIdentifier(String userId,
String assetManagerGUID,
String assetManagerName,
String assetManagerTypeName,
String openMetadataElementGUID,
String openMetadataElementTypeName,
ExternalIdentifierProperties externalIdentifierProperties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
{
final String methodName = "addExternalIdentifier";
final String openMetadataGUIDParameterName = "openMetadataElementGUID";
Expand All @@ -706,6 +737,7 @@ public void addExternalIdentifier(String userId,

requestBody.setExternalScopeGUID(assetManagerGUID);
requestBody.setExternalScopeName(assetManagerName);
requestBody.setExternalScopeTypeName(assetManagerTypeName);

restClient.callVoidPostRESTCall(methodName,
urlTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public B getNewComplexBean(Class<B> beanClass,
bean.setSynchronizationDescription(this.removeDescription(instanceProperties));

bean.setExternalScopeGUID(relationship.getEntityOneProxy().getGUID());
bean.setExternalScopeTypeName(relationship.getEntityOneProxy().getType().getTypeDefName());

instanceProperties = new InstanceProperties(relationship.getEntityOneProxy().getUniqueProperties());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void createExternalIdentifier(String userId,
correlationProperties.getExternalScopeGUID(),
assetManagerGUIDParameterName,
correlationProperties.getExternalScopeName(),
OpenMetadataType.CATALOG.typeName,
OpenMetadataType.INVENTORY_CATALOG.typeName,
OpenMetadataType.SOFTWARE_CAPABILITY.typeName,
getPermittedSynchronization(correlationProperties.getSynchronizationDirection()),
correlationProperties.getSynchronizationDescription(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public GUIDResponse createExternalAssetManager(String serverName
String softwareCapabilityGUID = handler.createSoftwareCapability(userId,
null,
null,
OpenMetadataType.CATALOG.typeName,
OpenMetadataType.INVENTORY_CATALOG.typeName,
OpenMetadataType.ASSET_MANAGER.typeName,
assetManagerProperties.getQualifiedName(),
assetManagerProperties.getResourceName(),
Expand All @@ -167,7 +167,7 @@ public GUIDResponse createExternalAssetManager(String serverName
handler.maintainSupplementaryProperties(userId,
softwareCapabilityGUID,
softwareCapabilityGUIDParameterName,
OpenMetadataType.CATALOG.typeName,
OpenMetadataType.INVENTORY_CATALOG.typeName,
OpenMetadataType.SOFTWARE_CAPABILITY.typeName,
assetManagerProperties.getQualifiedName(),
assetManagerProperties.getResourceName(),
Expand Down Expand Up @@ -348,7 +348,7 @@ public VoidResponse addExternalIdentifier(String serverNa
requestBody.getExternalScopeGUID(),
assetManagerGUIDParameterName,
requestBody.getExternalScopeName(),
OpenMetadataType.CATALOG.typeName,
requestBody.getExternalScopeTypeName(),
OpenMetadataType.SOFTWARE_CAPABILITY.typeName,
permittedSynchronizationOrdinal,
requestBody.getSynchronizationDescription(),
Expand Down Expand Up @@ -458,7 +458,7 @@ public VoidResponse updateExternalIdentifier(String serve
requestBody.getExternalScopeName(),
assetManagerGUIDParameterName,
requestBody.getExternalScopeName(),
OpenMetadataType.CATALOG.typeName,
OpenMetadataType.SOFTWARE_CAPABILITY.typeName,
OpenMetadataType.SOFTWARE_CAPABILITY.typeName,
permittedSynchronizationOrdinal,
requestBody.getSynchronizationDescription(),
Expand Down Expand Up @@ -661,7 +661,7 @@ public VoidResponse removeExternalIdentifier(String serverName,
requestBody.getMetadataCorrelationProperties().getExternalScopeGUID(),
assetManagerGUIDParameterName,
requestBody.getMetadataCorrelationProperties().getExternalScopeName(),
OpenMetadataType.ASSET_MANAGER.typeName,
OpenMetadataType.SOFTWARE_CAPABILITY.typeName,
permittedSynchronizationOrdinal,
requestBody.getMetadataCorrelationProperties().getSynchronizationDescription(),
forLineage,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.adapters.connectors.postgres.controls;

import org.odpi.openmetadata.frameworks.connectors.controls.TemplateType;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* TemplateTypeEnum characterises the type of templates supported by an integration connector. It should be copied
* by developers of an integration connector to help populate the supportedTemplates property of its provider.
*/
public enum PostgreSQLTemplateType
{
POSTGRES_SERVER_TEMPLATE(PostgresDeployedImplementationType.POSTGRESQL_SERVER.getDeployedImplementationType(),
"Create a " + PostgresDeployedImplementationType.POSTGRESQL_DATABASE.getAssociatedTypeName() + " asset.",
PostgresDeployedImplementationType.POSTGRESQL_SERVER.getAssociatedTypeName(),
false,
"542134e6-b9ce-4dce-8aef-22e8daf34fdb",
null),

POSTGRES_DATABASE_TEMPLATE(PostgresDeployedImplementationType.POSTGRESQL_DATABASE.getDeployedImplementationType(),
"Create a " + PostgresDeployedImplementationType.POSTGRESQL_DATABASE.getAssociatedTypeName() + " asset.",
PostgresDeployedImplementationType.POSTGRESQL_DATABASE.getAssociatedTypeName(),
false,
"3d398b3f-7ae6-4713-952a-409f3dea8520",
null),

POSTGRES_SCHEMA_TEMPLATE(PostgresDeployedImplementationType.POSTGRESQL_DATABASE_SCHEMA.getDeployedImplementationType(),
"Create a " + PostgresDeployedImplementationType.POSTGRESQL_DATABASE_SCHEMA.getAssociatedTypeName() + " asset.",
PostgresDeployedImplementationType.POSTGRESQL_DATABASE_SCHEMA.getAssociatedTypeName(),
false,
"82a5417c-d882-4271-8444-4c6a996a8bfc",
null),
;


/**
* Symbolic name of the template.
*/
private final String templateName;

/**
* Description of the value to provide for this template.
*/
private final String templateDescription;

/**
* Open metadata type name of the template.
*/
private final String typeName;

/**
* Is this catalog template required for the connector to work successfully.
*/
private final boolean required;


/**
* Option guid for a template to use if no template is specified.
*/
private final String defaultTemplateGUID;

/**
* A map of property name to property value for values that should match in the catalog template for it to be compatible with this integration
* connector.
*/
private final Map<String, String> otherPropertyValues;


/**
* Constructor for Enum
*
* @param templateName catalog template name
* @param typeName open metadata type name for the linked element
* @param templateDescription deployed implementation type for the linked element
* @param required is this template required bu the connector
* @param defaultTemplateGUID is there a default template
* @param otherPropertyValues other values
*/
PostgreSQLTemplateType(String templateName,
String templateDescription,
String typeName,
boolean required,
String defaultTemplateGUID,
Map<String, String> otherPropertyValues)
{
this.templateName = templateName;
this.templateDescription = templateDescription;
this.typeName = typeName;
this.required = required;
this.defaultTemplateGUID = defaultTemplateGUID;
this.otherPropertyValues = otherPropertyValues;
}


/**
* Return the name of the template.
*
* @return name
*/
public String getTemplateName()
{
return templateName;
}


/**
* Return the description of the template, such as its content.
*
* @return description
*/
public String getTemplateDescription()
{
return templateDescription;
}


/**
* Return the open metadata type name.
*
* @return open metadata type name
*/
public String getTypeName()
{
return typeName;
}


/**
* Return whether this catalog template is required for this service to work successful.
*
* @return boolean flag
*/
public boolean getRequired()
{
return required;
}


/**
* Return the unique identifier of the default template to use with this connector - this is optional.
*
* @return string
*/
public String getDefaultTemplateGUID()
{
return defaultTemplateGUID;
}


/**
* Return a map of property name to property value that the catalog template should have to be valid for this integration connector.
*
* @return map of string to string
*/
public Map<String, String> getOtherPropertyValues()
{
return otherPropertyValues;
}


/**
* Return all the template types defined by this enum.
*
* @return list of catalog template type
*/
public static List<TemplateType> getTemplateTypes()
{
List<TemplateType> templateTypes = new ArrayList<>();

for (PostgreSQLTemplateType templateTypeEnum : PostgreSQLTemplateType.values())
{
templateTypes.add(templateTypeEnum.getTemplateType());
}

return templateTypes;
}


/**
* Return the catalog template type for a specific catalog template enum.
*
* @return catalog template type
*/
public TemplateType getTemplateType()
{
TemplateType templateType = new TemplateType();

templateType.setTemplateName(templateName);
templateType.setTypeName(typeName);
templateType.setTemplateDescription(templateDescription);
templateType.setRequired(required);
templateType.setDefaultTemplateGUID(defaultTemplateGUID);
templateType.setOtherPropertyValues(otherPropertyValues);

return templateType;
}


/**
* JSON-style toString
*
* @return return string containing the property names and values
*/
@Override
public String toString()
{
return "TemplateType{templateName='" + templateName + "'}";
}
}
Loading

0 comments on commit 92cfb7a

Please sign in to comment.