Skip to content

Commit

Permalink
Merge pull request #7231 from mandy-chessell/egeria-code
Browse files Browse the repository at this point in the history
Enable automated curation lab to use archives
  • Loading branch information
mandy-chessell committed Dec 7, 2022
2 parents e8bb344 + dfd9284 commit 360cca0
Show file tree
Hide file tree
Showing 189 changed files with 5,979 additions and 2,976 deletions.
2 changes: 1 addition & 1 deletion content-packs/OpenMetadataTypes.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private CommentType getCommentTypeFromProperties(InstanceProperties properties

if (instancePropertiesMap != null)
{
InstancePropertyValue instancePropertyValue = instancePropertiesMap.get(OpenMetadataAPIMapper.OWNER_TYPE_PROPERTY_NAME);
InstancePropertyValue instancePropertyValue = instancePropertiesMap.get(OpenMetadataAPIMapper.COMMENT_TYPE_PROPERTY_NAME);

if (instancePropertyValue instanceof EnumPropertyValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,71 @@ void clearSchemaTypeParent(String userId,
PropertyServerException;


/**
* Create a relationship between two schema elements. The name of the desired relationship, and any properties (including effectivity dates)
* are passed on the API.
*
* @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 assetManagerIsHome ensure that only the asset manager can update this relationship
* @param endOneGUID unique identifier of the schema element at end one of the relationship
* @param endTwoGUID unique identifier of the schema element at end two of the relationship
* @param relationshipTypeName type of the relationship to create
* @param effectiveTime optional date for effective time of the query. Null means any effective time
* @param forLineage return elements marked with the Memento classification?
* @param forDuplicateProcessing do not merge elements marked as duplicates?
* @param properties relationship properties
*
* @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 setupSchemaElementRelationship(String userId,
String assetManagerGUID,
String assetManagerName,
boolean assetManagerIsHome,
String endOneGUID,
String endTwoGUID,
String relationshipTypeName,
Date effectiveTime,
boolean forLineage,
boolean forDuplicateProcessing,
RelationshipProperties properties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
* Remove a relationship between two schema elements. The name of the desired relationship is passed on the API.
*
* @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 endOneGUID unique identifier of the schema element at end one of the relationship
* @param endTwoGUID unique identifier of the schema element at end two of the relationship
* @param relationshipTypeName type of the relationship to delete
* @param effectiveTime optional date for effective time of the query. Null means any effective time
* @param forLineage return elements marked with the Memento classification?
* @param forDuplicateProcessing do not merge elements marked as duplicates?
*
* @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 clearSchemaElementRelationship(String userId,
String assetManagerGUID,
String assetManagerName,
String endOneGUID,
String endTwoGUID,
String relationshipTypeName,
Date effectiveTime,
boolean forLineage,
boolean forDuplicateProcessing) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
* Remove the metadata element representing a schema type.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public enum AssetManagerErrorCode implements ExceptionMessageSet
"provide a scope for the external identifier.",
"Ensure that the asset manager's unique identifier is passed on the request and then retry it."),

BAD_PARAMETER(400, "OMAS-ASSET-MANAGER-400-002",
"At least one of the properties supplied for a new relationship of type {0} are invalid. The {1} exception was returned with error message: {2}",
"The system is unable to create the requested relationship because it can not parse the properties.",
"Correct the caller's logic so that the properties passed are correctly formatted and retry the request."),

OMRS_NOT_INITIALIZED(404, "OMAS-ASSET-MANAGER-404-001",
"The open metadata repository services are not initialized for the {0} operation",
"The system is unable to connect to an open metadata repository.",
Expand Down Expand Up @@ -68,6 +73,7 @@ public enum AssetManagerErrorCode implements ExceptionMessageSet
"Verify that the OMAG server is running and the OMAS service is correctly configured."),



;

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ public void setAliases(List<String> aliases)


/**
* Set up SchemaType for this schema attribute.
* Set up SchemaType for this schema attribute. Use a bean that is a subclass of SchemaTypeProperties that matches the type you wish to
* represent. When it is sent to server, it will use the type of the SchemaTypeProperties to set up the correct schema type information.
*
* @return schema type properties
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,122 @@ public void clearSchemaTypeParent(String userId,
}


/**
* Create a relationship between two schema elements. The name of the desired relationship, and any properties (including effectivity dates)
* are passed on the API.
*
* @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 assetManagerIsHome ensure that only the asset manager can update this relationship
* @param endOneGUID unique identifier of the schema element at end one of the relationship
* @param endTwoGUID unique identifier of the schema element at end two of the relationship
* @param relationshipTypeName type of the relationship to create
* @param effectiveTime optional date for effective time of the query. Null means any effective time
* @param forLineage return elements marked with the Memento classification?
* @param forDuplicateProcessing do not merge elements marked as duplicates?
* @param properties relationship properties
*
* @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)
*/
@Override
public void setupSchemaElementRelationship(String userId,
String assetManagerGUID,
String assetManagerName,
boolean assetManagerIsHome,
String endOneGUID,
String endTwoGUID,
String relationshipTypeName,
Date effectiveTime,
boolean forLineage,
boolean forDuplicateProcessing,
RelationshipProperties properties) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
{
final String methodName = "setupSchemaElementRelationship";
final String endOneGUIDParameterName = "endOneGUID";
final String endTwoGUIDParameterName = "endTwoGUID";
final String relationshipTypeNameParameterName = "relationshipTypeName";

invalidParameterHandler.validateUserId(userId, methodName);
invalidParameterHandler.validateGUID(endOneGUID, endOneGUIDParameterName, methodName);
invalidParameterHandler.validateGUID(endTwoGUID, endTwoGUIDParameterName, methodName);
invalidParameterHandler.validateName(relationshipTypeName, relationshipTypeNameParameterName, methodName);

final String urlTemplate = serverPlatformURLRoot + urlTemplatePrefix + "/schema-elements/{2}/relationships/{3}/schema-elements/{4}?assetManagerIsHome={5}&forLineage={6}&forDuplicateProcessing={7}";

restClient.callVoidPostRESTCall(methodName,
urlTemplate,
getRelationshipRequestBody(assetManagerGUID, assetManagerName, effectiveTime, properties),
serverName,
userId,
endOneGUID,
relationshipTypeName,
endTwoGUID,
assetManagerIsHome,
forLineage,
forDuplicateProcessing);
}


/**
* Remove a relationship between two schema elements. The name of the desired relationship is passed on the API.
*
* @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 endOneGUID unique identifier of the schema element at end one of the relationship
* @param endTwoGUID unique identifier of the schema element at end two of the relationship
* @param relationshipTypeName type of the relationship to delete
* @param effectiveTime optional date for effective time of the query. Null means any effective time
* @param forLineage return elements marked with the Memento classification?
* @param forDuplicateProcessing do not merge elements marked as duplicates?
*
* @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)
*/
@Override
public void clearSchemaElementRelationship(String userId,
String assetManagerGUID,
String assetManagerName,
String endOneGUID,
String endTwoGUID,
String relationshipTypeName,
Date effectiveTime,
boolean forLineage,
boolean forDuplicateProcessing) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
{
final String methodName = "clearSchemaElementRelationship";
final String endOneGUIDParameterName = "endOneGUID";
final String endTwoGUIDParameterName = "endTwoGUID";
final String relationshipTypeNameParameterName = "relationshipTypeName";

invalidParameterHandler.validateUserId(userId, methodName);
invalidParameterHandler.validateGUID(endOneGUID, endOneGUIDParameterName, methodName);
invalidParameterHandler.validateGUID(endTwoGUID, endTwoGUIDParameterName, methodName);
invalidParameterHandler.validateName(relationshipTypeName, relationshipTypeNameParameterName, methodName);

final String urlTemplate = serverPlatformURLRoot + urlTemplatePrefix + "/schema-elements/{2}/relationships/{3}/schema-elements/{4}/remove?forLineage={5}&forDuplicateProcessing={6}";

restClient.callVoidPostRESTCall(methodName,
urlTemplate,
getEffectiveTimeQueryRequestBody(assetManagerGUID, assetManagerName, effectiveTime),
serverName,
userId,
endOneGUID,
relationshipTypeName,
endTwoGUID,
forLineage,
forDuplicateProcessing);
}


/**
* Remove the metadata element representing a schema type.
*
Expand Down
Loading

0 comments on commit 360cca0

Please sign in to comment.