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

Add integration report havesting to data manager based OMISs #7544

Merged
merged 2 commits into from
Mar 20, 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 @@ -44,7 +44,7 @@ public class IntegrationConnectorConfig extends AdminServicesConfigHeader
private long refreshTimeInterval = 0L;
private boolean usesBlockingCalls = false;
private PermittedSynchronization permittedSynchronization = null;
private boolean generateIntegrationReports = true;
private boolean generateIntegrationReports = false;


/**
Expand Down Expand Up @@ -272,7 +272,7 @@ public void setPermittedSynchronization(PermittedSynchronization permittedSynchr
/**
* Return a flag indicating whether the integration connector should create an integration report.
*
* @return boolean flag (default = true)
* @return boolean flag (default = false)
*/
public boolean getGenerateIntegrationReports()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ public class IntegrationContext
protected final String integrationConnectorGUID;
protected final PermittedSynchronization permittedSynchronization;

private final IntegrationGovernanceContext integrationGovernanceContext;

private final IntegrationReportWriter integrationReportWriter;
private final IntegrationGovernanceContext integrationGovernanceContext;
protected final IntegrationReportWriter integrationReportWriter;


/**
Expand All @@ -51,7 +50,6 @@ public class IntegrationContext
* @param externalSourceGUID unique identifier of the software server capability for the source of metadata
* @param externalSourceName unique name of the software server capability for the source of metadata
* @param integrationConnectorGUID unique identifier of the integration connector entity (maybe null)
* @param integrationGovernanceContext populated governance context for the connector's use
*/
public IntegrationContext(String connectorId,
String connectorName,
Expand All @@ -63,8 +61,7 @@ public IntegrationContext(String connectorId,
PermittedSynchronization permittedSynchronization,
String externalSourceGUID,
String externalSourceName,
String integrationConnectorGUID,
IntegrationGovernanceContext integrationGovernanceContext)
String integrationConnectorGUID)
{
this.openIntegrationClient = openIntegrationClient;
this.openMetadataStoreClient = openMetadataStoreClient;
Expand All @@ -73,7 +70,6 @@ public IntegrationContext(String connectorId,
this.externalSourceGUID = externalSourceGUID;
this.externalSourceName = externalSourceName;
this.integrationConnectorGUID = integrationConnectorGUID;
this.integrationGovernanceContext = integrationGovernanceContext;

if (generateIntegrationReport)
{
Expand All @@ -88,9 +84,52 @@ public IntegrationContext(String connectorId,
{
this.integrationReportWriter = null;
}

this.integrationGovernanceContext = constructIntegrationGovernanceContext(openMetadataStoreClient,
connectorUserId,
externalSourceGUID,
externalSourceName,
integrationReportWriter);

}



/**
* Return a new integrationGovernanceContext for a specific connector.
*
* @param openMetadataStore client implementation
* @param userId calling user
* @param externalSourceGUID unique identifier for external source (or null)
* @param externalSourceName unique name for external source (or null)
* @param integrationReportWriter report writer (maybe null)
* @return new context
*/
private IntegrationGovernanceContext constructIntegrationGovernanceContext(OpenMetadataClient openMetadataStore,
String userId,
String externalSourceGUID,
String externalSourceName,
IntegrationReportWriter integrationReportWriter)
{
if (openMetadataStoreClient != null)
{
OpenMetadataAccess openMetadataAccess = new OpenMetadataAccess(openMetadataStore,
userId,
externalSourceGUID,
externalSourceName,
integrationReportWriter);
MultiLanguageManagement multiLanguageManagement = new MultiLanguageManagement(openMetadataStore, userId);
StewardshipAction stewardshipAction = new StewardshipAction(openMetadataStore, userId);
ValidMetadataValues validMetadataValues = new ValidMetadataValues(openMetadataStore, userId);

return new IntegrationGovernanceContext(openMetadataAccess, multiLanguageManagement, stewardshipAction, validMetadataValues);
}

return null;
}



/**
* Retrieve the identifiers of the metadata elements identified as catalog targets with an integration connector.
* Each catalog target may be configured with an optional symbolic name to guide the integration connector on how to use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.odpi.openmetadata.frameworks.governanceaction.search.SearchClassifications;
import org.odpi.openmetadata.frameworks.governanceaction.search.SearchProperties;
import org.odpi.openmetadata.frameworks.governanceaction.search.SequencingOrder;
import org.odpi.openmetadata.frameworks.integration.reports.IntegrationReportWriter;

import java.util.Date;
import java.util.List;
Expand All @@ -25,10 +26,11 @@
*/
public class OpenMetadataAccess
{
private final OpenMetadataClient openMetadataStore;
private final String userId;
private final String externalSourceGUID;
private final String externalSourceName;
private final OpenMetadataClient openMetadataStore;
private final String userId;
private final String externalSourceGUID;
private final String externalSourceName;
private final IntegrationReportWriter reportWriter;


/**
Expand All @@ -38,16 +40,19 @@ public class OpenMetadataAccess
* @param userId calling user
* @param externalSourceGUID unique identifier for external source (or null)
* @param externalSourceName unique name for external source (or null)
* @param reportWriter report writer (maybe null)
*/
public OpenMetadataAccess(OpenMetadataClient openMetadataStore,
String userId,
String externalSourceGUID,
String externalSourceName)
public OpenMetadataAccess(OpenMetadataClient openMetadataStore,
String userId,
String externalSourceGUID,
String externalSourceName,
IntegrationReportWriter reportWriter)
{
this.openMetadataStore = openMetadataStore;
this.userId = userId;
this.externalSourceGUID = externalSourceGUID;
this.externalSourceName = externalSourceName;
this.reportWriter = reportWriter;
}


Expand Down Expand Up @@ -340,15 +345,22 @@ public String createMetadataElementInStore(String metadataElementType
UserNotAuthorizedException,
PropertyServerException
{
return openMetadataStore.createMetadataElementInStore(userId,
externalSourceGUID,
externalSourceName,
metadataElementTypeName,
initialStatus,
effectiveFrom,
effectiveTo,
properties,
templateGUID);
String metadataElementGUID = openMetadataStore.createMetadataElementInStore(userId,
externalSourceGUID,
externalSourceName,
metadataElementTypeName,
initialStatus,
effectiveFrom,
effectiveTo,
properties,
templateGUID);

if ((metadataElementGUID != null) && (reportWriter != null))
{
reportWriter.reportElementCreation(metadataElementGUID);
}

return metadataElementGUID;
}


Expand Down Expand Up @@ -387,6 +399,11 @@ public void updateMetadataElementInStore(String metadataElementGUID,
forDuplicateProcessing,
properties,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(metadataElementGUID);
}
}


Expand Down Expand Up @@ -420,6 +437,11 @@ public void updateMetadataElementStatusInStore(String metadataElementGUID
forDuplicateProcessing,
newElementStatus,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(metadataElementGUID);
}
}


Expand Down Expand Up @@ -456,6 +478,11 @@ public void updateMetadataElementEffectivityInStore(String metadataElemen
effectiveFrom,
effectiveTo,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(metadataElementGUID);
}
}


Expand Down Expand Up @@ -485,6 +512,11 @@ public void deleteMetadataElementInStore(String metadataElementGUID,
forLineage,
forDuplicateProcessing,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementDelete(metadataElementGUID);
}
}


Expand Down Expand Up @@ -529,6 +561,11 @@ public void classifyMetadataElementInStore(String metadataElementGUID
effectiveTo,
properties,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(metadataElementGUID);
}
}


Expand Down Expand Up @@ -569,6 +606,11 @@ public void reclassifyMetadataElementInStore(String metadataElementGU
forDuplicateProcessing,
properties,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(metadataElementGUID);
}
}


Expand Down Expand Up @@ -608,6 +650,11 @@ public void updateClassificationEffectivityInStore(String metadataElementGUID,
effectiveFrom,
effectiveTo,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(metadataElementGUID);
}
}


Expand Down Expand Up @@ -640,6 +687,11 @@ public void declassifyMetadataElementInStore(String metadataElementGUID,
forLineage,
forDuplicateProcessing,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(metadataElementGUID);
}
}


Expand Down Expand Up @@ -677,18 +729,25 @@ public String createRelatedElementsInStore(String relationshipTypeNam
UserNotAuthorizedException,
PropertyServerException
{
return openMetadataStore.createRelatedElementsInStore(userId,
externalSourceGUID,
externalSourceName,
relationshipTypeName,
metadataElement1GUID,
metadataElement2GUID,
forLineage,
forDuplicateProcessing,
effectiveFrom,
effectiveTo,
properties,
effectiveTime);
String relationshipGUID = openMetadataStore.createRelatedElementsInStore(userId,
externalSourceGUID,
externalSourceName,
relationshipTypeName,
metadataElement1GUID,
metadataElement2GUID,
forLineage,
forDuplicateProcessing,
effectiveFrom,
effectiveTo,
properties,
effectiveTime);

if ((relationshipGUID != null) && (reportWriter != null))
{
reportWriter.reportElementCreation(relationshipGUID);
}

return relationshipGUID;
}


Expand Down Expand Up @@ -726,6 +785,11 @@ public void updateRelatedElementsInStore(String relationshipGUID,
forDuplicateProcessing,
properties,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(relationshipGUID);
}
}


Expand Down Expand Up @@ -763,6 +827,11 @@ public void updateRelatedElementsEffectivityInStore(String relationshipGUID,
effectiveFrom,
effectiveTo,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementUpdate(relationshipGUID);
}
}


Expand Down Expand Up @@ -792,5 +861,10 @@ public void deleteRelatedElementsInStore(String relationshipGUID,
forLineage,
forDuplicateProcessing,
effectiveTime);

if (reportWriter != null)
{
reportWriter.reportElementDelete(relationshipGUID);
}
}
}
Loading