Search in sources :

Example 1 with EntityMappingSASCatalog2OMRS

use of org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS in project egeria-connector-sas-viya by odpi.

the class RepositoryEventMapper method getMappedEntity.

/**
 * Retrieve the mapped OMRS entity for the provided SAS Catalog entity.
 *
 * @param entity the SAS Catalog entity to translate to OMRS
 * @return EntityDetail
 */
private EntityDetail getMappedEntity(SASCatalogObject entity, String prefix) {
    EntityDetail result = null;
    EntityMappingSASCatalog2OMRS mapping = new EntityMappingSASCatalog2OMRS(catalogOMRSRepositoryConnector, catalogOMRSMetadataCollection.getTypeDefStore(), null, /*catalogOMRSMetadataCollection.getAttributeTypeDefStore(),*/
    entity, prefix, null);
    try {
        result = mapping.getEntityDetail();
    } catch (RepositoryErrorException e) {
        log.error("Unable to map entity to OMRS EntityDetail: {}", entity, e);
    }
    return result;
}
Also used : RepositoryErrorException(org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException) EntityMappingSASCatalog2OMRS(org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS) EntityDetail(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail)

Example 2 with EntityMappingSASCatalog2OMRS

use of org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS in project egeria-connector-sas-viya by odpi.

the class MetadataCollection method getEntitySummary.

/**
 * {@inheritDoc}
 */
@Override
public EntitySummary getEntitySummary(String userId, String guid) throws InvalidParameterException, RepositoryErrorException, EntityNotKnownException {
    final String methodName = "getEntitySummary";
    super.getInstanceParameterValidation(userId, guid, methodName);
    // Guid cannot be null here, as validation above ensures it is non-null
    SASCatalogGuid catalogGuid = SASCatalogGuid.fromGuid(guid);
    String prefix = catalogGuid.getGeneratedPrefix();
    SASCatalogObject entity = getSASCatalogEntitySafe(catalogGuid.getSASCatalogGuid(), methodName);
    EntityMappingSASCatalog2OMRS mapping = new EntityMappingSASCatalog2OMRS(repositoryConnector, typeDefStore, attributeTypeDefStore, entity, prefix, userId);
    return mapping.getEntitySummary();
}
Also used : SASCatalogObject(org.odpi.openmetadata.connector.sas.repository.connector.mapping.SASCatalogObject) EntityMappingSASCatalog2OMRS(org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS) SASCatalogGuid(org.odpi.openmetadata.connector.sas.repository.connector.model.SASCatalogGuid)

Example 3 with EntityMappingSASCatalog2OMRS

use of org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS in project egeria-connector-sas-viya by odpi.

the class MetadataCollection method getEntityDetail.

/**
 * {@inheritDoc}
 */
@Override
public EntityDetail getEntityDetail(String userId, String guid) throws InvalidParameterException, RepositoryErrorException, EntityNotKnownException {
    final String methodName = "getEntityDetail";
    log.info("Get Entity Detail: " + guid);
    super.getInstanceParameterValidation(userId, guid, methodName);
    // Guid cannot be null here, as validation above ensures it is non-null
    SASCatalogGuid sasCatalogGuid = SASCatalogGuid.fromGuid(guid);
    String prefix = sasCatalogGuid.getGeneratedPrefix();
    SASCatalogObject entity = getSASCatalogEntitySafe(sasCatalogGuid.getSASCatalogGuid(), methodName);
    // TODO: Do we need an attributeTypeDefStore like Atlas?
    EntityMappingSASCatalog2OMRS mapping = new EntityMappingSASCatalog2OMRS(repositoryConnector, typeDefStore, null, /*attributeTypeDefStore */
    entity, prefix, userId);
    return mapping.getEntityDetail();
// return null;
}
Also used : SASCatalogObject(org.odpi.openmetadata.connector.sas.repository.connector.mapping.SASCatalogObject) EntityMappingSASCatalog2OMRS(org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS) SASCatalogGuid(org.odpi.openmetadata.connector.sas.repository.connector.model.SASCatalogGuid)

Example 4 with EntityMappingSASCatalog2OMRS

use of org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS in project egeria-connector-sas-viya by odpi.

the class MetadataCollection method getRelationshipsForEntity.

@Override
public List<Relationship> getRelationshipsForEntity(String userId, String entityGUID, String relationshipTypeGUID, int fromRelationshipElement, List<InstanceStatus> limitResultsByStatus, Date asOfTime, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize) throws InvalidParameterException, TypeErrorException, RepositoryErrorException, EntityNotKnownException, PagingErrorException, FunctionNotSupportedException, UserNotAuthorizedException {
    final String methodName = "getRelationshipsForEntity";
    getRelationshipsForEntityParameterValidation(userId, entityGUID, relationshipTypeGUID, fromRelationshipElement, limitResultsByStatus, asOfTime, sequencingProperty, sequencingOrder, pageSize);
    List<Relationship> alRelationships = null;
    // Immediately throw unimplemented exception if trying to retrieve historical view or sequence by property
    if (asOfTime != null) {
        raiseFunctionNotSupportedException(ErrorCode.NO_HISTORY, methodName, repositoryName);
    } else if (limitResultsByStatus == null || (limitResultsByStatus.size() == 1 && limitResultsByStatus.contains(InstanceStatus.ACTIVE))) {
        // Otherwise, only bother searching if we are after ACTIVE (or "all") entities -- non-ACTIVE means we
        // will just return an empty list
        // Guid cannot be null here, as validation above ensures it is non-null
        SASCatalogGuid sasCatalogGuid = SASCatalogGuid.fromGuid(entityGUID);
        String prefix = sasCatalogGuid.getGeneratedPrefix();
        // 1. retrieve entity from Catalog by GUID (and its relationships)
        SASCatalogObject asset = null;
        List<SASCatalogObject> relationships = null;
        try {
            asset = repositoryConnector.getEntityByGUID(sasCatalogGuid.getSASCatalogGuid());
            relationships = repositoryConnector.getRelationshipsForEntity(sasCatalogGuid.getSASCatalogGuid());
        } catch (Exception e) {
            raiseEntityNotKnownException(ErrorCode.ENTITY_NOT_KNOWN, methodName, e, entityGUID, methodName, repositoryName);
        }
        // Ensure the entity actually exists (if not, throw error to that effect)
        if (asset == null || relationships == null) {
            raiseEntityNotKnownException(ErrorCode.ENTITY_NOT_KNOWN, methodName, null, entityGUID, methodName, repositoryName);
        } else {
            EntityMappingSASCatalog2OMRS entityMap = new EntityMappingSASCatalog2OMRS(repositoryConnector, typeDefStore, attributeTypeDefStore, asset, prefix, userId);
            // 2. Apply the mapping to the object, and retrieve the resulting relationships
            alRelationships = entityMap.getRelationships(relationships, relationshipTypeGUID, fromRelationshipElement, sequencingProperty, sequencingOrder, pageSize);
        }
    }
    return alRelationships;
}
Also used : SASCatalogObject(org.odpi.openmetadata.connector.sas.repository.connector.mapping.SASCatalogObject) Relationship(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship) EntityMappingSASCatalog2OMRS(org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS) ArrayList(java.util.ArrayList) List(java.util.List) SASCatalogGuid(org.odpi.openmetadata.connector.sas.repository.connector.model.SASCatalogGuid) TypeDefNotSupportedException(org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeDefNotSupportedException) FunctionNotSupportedException(org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException) TypeDefConflictException(org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeDefConflictException) TypeDefKnownException(org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeDefKnownException) PagingErrorException(org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException) RelationshipNotKnownException(org.odpi.openmetadata.repositoryservices.ffdc.exception.RelationshipNotKnownException) PropertyErrorException(org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException) InvalidTypeDefException(org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidTypeDefException) EntityNotKnownException(org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException) TypeErrorException(org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException) UserNotAuthorizedException(org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException) RepositoryErrorException(org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException) InvalidParameterException(org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException)

Aggregations

EntityMappingSASCatalog2OMRS (org.odpi.openmetadata.connector.sas.repository.connector.mapping.EntityMappingSASCatalog2OMRS)4 SASCatalogObject (org.odpi.openmetadata.connector.sas.repository.connector.mapping.SASCatalogObject)3 SASCatalogGuid (org.odpi.openmetadata.connector.sas.repository.connector.model.SASCatalogGuid)3 RepositoryErrorException (org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 EntityDetail (org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail)1 Relationship (org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship)1 EntityNotKnownException (org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException)1 FunctionNotSupportedException (org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException)1 InvalidParameterException (org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException)1 InvalidTypeDefException (org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidTypeDefException)1 PagingErrorException (org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException)1 PropertyErrorException (org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException)1 RelationshipNotKnownException (org.odpi.openmetadata.repositoryservices.ffdc.exception.RelationshipNotKnownException)1 TypeDefConflictException (org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeDefConflictException)1 TypeDefKnownException (org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeDefKnownException)1 TypeDefNotSupportedException (org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeDefNotSupportedException)1 TypeErrorException (org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException)1 UserNotAuthorizedException (org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException)1