Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Asset Manager setupLineageMapping to return relationship guid #7682

Merged
merged 2 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1560,17 +1560,17 @@ List<ProcessCallElement> getProcessCallers(String userId,
* @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 setupLineageMapping(String userId,
String assetManagerGUID,
String assetManagerName,
String sourceElementGUID,
String destinationElementGUID,
LineageMappingProperties properties,
Date effectiveTime,
boolean forLineage,
boolean forDuplicateProcessing) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;
String setupLineageMapping(String userId,
String assetManagerGUID,
String assetManagerName,
String sourceElementGUID,
String destinationElementGUID,
LineageMappingProperties properties,
Date effectiveTime,
boolean forLineage,
boolean forDuplicateProcessing) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2826,17 +2826,17 @@ public List<ProcessCallElement> getProcessCallers(String userId,
* @throws PropertyServerException there is a problem reported in the open metadata server(s)
*/
@Override
public void setupLineageMapping(String userId,
String assetManagerGUID,
String assetManagerName,
String sourceElementGUID,
String destinationElementGUID,
LineageMappingProperties properties,
Date effectiveTime,
boolean forLineage,
boolean forDuplicateProcessing) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
public String setupLineageMapping(String userId,
String assetManagerGUID,
String assetManagerName,
String sourceElementGUID,
String destinationElementGUID,
LineageMappingProperties properties,
Date effectiveTime,
boolean forLineage,
boolean forDuplicateProcessing) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
{
final String methodName = "setupLineageMapping";
final String sourceElementGUIDParameterName = "sourceElementGUID";
Expand All @@ -2848,15 +2848,17 @@ public void setupLineageMapping(String userId,

final String urlTemplate = serverPlatformURLRoot + urlTemplatePrefix + "/lineage-mappings/sources/{2}/destinations/{3}?forLineage={4}&forDuplicateProcessing={5}";

restClient.callVoidPostRESTCall(methodName,
urlTemplate,
getRelationshipRequestBody(assetManagerGUID, assetManagerName, effectiveTime, properties),
serverName,
userId,
sourceElementGUID,
destinationElementGUID,
forLineage,
forDuplicateProcessing);
GUIDResponse guidResponse = restClient.callGUIDPostRESTCall(methodName,
urlTemplate,
getRelationshipRequestBody(assetManagerGUID, assetManagerName, effectiveTime, properties),
serverName,
userId,
sourceElementGUID,
destinationElementGUID,
forLineage,
forDuplicateProcessing);

return guidResponse.getGUID();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3141,38 +3141,38 @@ public List<ProcessCallElement> getProcessCallers(String userId,
* @throws UserNotAuthorizedException the user is not authorized to issue this request
* @throws PropertyServerException there is a problem reported in the open metadata server(s)
*/
public void setupLineageMapping(String userId,
String assetManagerGUID,
String assetManagerName,
String sourceElementGUID,
String destinationElementGUID,
String qualifiedName,
String description,
Date effectiveFrom,
Date effectiveTo,
boolean forLineage,
boolean forDuplicateProcessing,
Date effectiveTime,
String methodName) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
public String setupLineageMapping(String userId,
String assetManagerGUID,
String assetManagerName,
String sourceElementGUID,
String destinationElementGUID,
String qualifiedName,
String description,
Date effectiveFrom,
Date effectiveTo,
boolean forLineage,
boolean forDuplicateProcessing,
Date effectiveTime,
String methodName) throws InvalidParameterException,
UserNotAuthorizedException,
PropertyServerException
{
final String sourceElementGUIDParameterName = "sourceElementGUID";
final String destinationElementGUIDParameterName = "destinationElementGUID";

processHandler.setupLineageMapping(userId,
sourceElementGUID,
sourceElementGUIDParameterName,
destinationElementGUID,
destinationElementGUIDParameterName,
qualifiedName,
description,
effectiveFrom,
effectiveTo,
forLineage,
forDuplicateProcessing,
effectiveTime,
methodName);
String guid = processHandler.setupLineageMapping(userId,
sourceElementGUID,
sourceElementGUIDParameterName,
destinationElementGUID,
destinationElementGUIDParameterName,
qualifiedName,
description,
effectiveFrom,
effectiveTo,
forLineage,
forDuplicateProcessing,
effectiveTime,
methodName);

externalIdentifierHandler.logRelationshipCreation(assetManagerGUID,
assetManagerName,
Expand All @@ -3182,6 +3182,8 @@ public void setupLineageMapping(String userId,
destinationElementGUID,
OpenMetadataAPIMapper.REFERENCEABLE_TYPE_NAME,
methodName);

return guid;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3594,7 +3594,7 @@ public ProcessCallElementsResponse getProcessCallers(String
* UserNotAuthorizedException the user is not authorized to issue this request
* PropertyServerException there is a problem reported in the open metadata server(s)
*/
public VoidResponse setupLineageMapping(String serverName,
public GUIDResponse setupLineageMapping(String serverName,
String userId,
String sourceElementGUID,
String destinationElementGUID,
Expand All @@ -3606,7 +3606,7 @@ public VoidResponse setupLineageMapping(String serverName,

RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName);

VoidResponse response = new VoidResponse();
GUIDResponse response = new GUIDResponse();
AuditLog auditLog = null;

try
Expand All @@ -3615,58 +3615,61 @@ public VoidResponse setupLineageMapping(String serverName,

ProcessExchangeHandler handler = instanceHandler.getProcessExchangeHandler(userId, serverName, methodName);

String guid = null;
if (requestBody != null)
{
if (requestBody.getProperties() instanceof DataFlowProperties)
{
DataFlowProperties properties = (DataFlowProperties)requestBody.getProperties();
handler.setupLineageMapping(userId,
requestBody.getAssetManagerGUID(),
requestBody.getAssetManagerName(),
sourceElementGUID,
destinationElementGUID,
properties.getQualifiedName(),
properties.getDescription(),
properties.getEffectiveFrom(),
properties.getEffectiveTo(),
forLineage,
forDuplicateProcessing,
requestBody.getEffectiveTime(),
methodName);
guid = handler.setupLineageMapping(userId,
requestBody.getAssetManagerGUID(),
requestBody.getAssetManagerName(),
sourceElementGUID,
destinationElementGUID,
properties.getQualifiedName(),
properties.getDescription(),
properties.getEffectiveFrom(),
properties.getEffectiveTo(),
forLineage,
forDuplicateProcessing,
requestBody.getEffectiveTime(),
methodName);
}
else
{
handler.setupLineageMapping(userId,
null,
null,
sourceElementGUID,
destinationElementGUID,
null,
null,
null,
null,
forLineage,
forDuplicateProcessing,
requestBody.getEffectiveTime(),
methodName);
guid = handler.setupLineageMapping(userId,
null,
null,
sourceElementGUID,
destinationElementGUID,
null,
null,
null,
null,
forLineage,
forDuplicateProcessing,
requestBody.getEffectiveTime(),
methodName);
}
}
else
{
handler.setupLineageMapping(userId,
null,
null,
sourceElementGUID,
destinationElementGUID,
null,
null,
null,
null,
forLineage,
forDuplicateProcessing,
new Date(),
methodName);
}
guid = handler.setupLineageMapping(userId,
null,
null,
sourceElementGUID,
destinationElementGUID,
null,
null,
null,
null,
forLineage,
forDuplicateProcessing,
new Date(),
methodName);
}

response.setGUID(guid);
}
catch (Exception error)
{
Expand Down
Loading