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

Pass typeGUIDs not typeNames to search #7630

Merged
merged 2 commits into from
Apr 26, 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 @@ -33,15 +33,15 @@
*/
public class OMAGServerAdminForAccessServices
{
private static RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminForAccessServices.class),
CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName());
private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminForAccessServices.class),
CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName());

private static final String defaultInTopicName = "InTopic";
private static final String defaultOutTopicName = "OutTopic";

private OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices();
private OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler();
private OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler();
private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices();
private final OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler();
private final OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler();


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public VoidResponse setEventBus(String userId,

if ((configurationProperties == null) || (configurationProperties.isEmpty()))
{
eventBusConfig.setConfigurationProperties(configurationProperties);
eventBusConfig.setConfigurationProperties(null);
}
else
{
Expand All @@ -617,7 +617,7 @@ public VoidResponse setEventBus(String userId,
configAuditTrail = new ArrayList<>();
}

configAuditTrail.add(new Date().toString() + " " + userId + " updated configuration for default event bus.");
configAuditTrail.add(new Date() + " " + userId + " updated configuration for default event bus.");

serverConfig.setAuditTrail(configAuditTrail);
serverConfig.setEventBusConfig(eventBusConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public OpenMetadataAPIGenericConverter<B> getConverter()

/**
* Set up a new security verifier (the handler runs with a default verifier until this method is called).
*
* <br><br>
* The security verifier provides authorization checks for access and maintenance
* changes to open metadata. Authorization checks are enabled through the
* OpenMetadataServerSecurityConnector.
Expand Down Expand Up @@ -3030,15 +3030,15 @@ public EntityDetail validateAnchorEntity(String userId,
/**
* Validates whether an operation is valid based on the type of entity it is connecting to, who the user is and whether it is a read or an
* update.
*
* <br><br>
* The first part of this method is looking to see if the connectToEntity is an anchor entity. In which case it calls any specific validation
* for that entity and returns the connectToEntity, assuming all is ok - exceptions are thrown if the entity is not valid or the user does not
* have access to it.
*
* <br><br>
* If the connectToEntity is of a type that has a lifecycle that is linked to the lifecycle of another entity - typically a referenceable -
* then that other entity is its anchor (examples are schema elements, comments, connections). The anchor entity needs to be retrieved and
* validated.
*
* <br><br>
* Some anchor entities have specific validation to perform.
*
* @param userId userId of user making request.
Expand Down Expand Up @@ -10674,7 +10674,7 @@ public List<EntityDetail> findEntities(String userId,
*
* @param userId caller's userId
* @param metadataElementTypeName type of interest (null means any element type)
* @param metadataElementSubtypeName optional list of the subtypes of the metadataElementTypeName to
* @param metadataElementSubtypeNames optional list of the subtypes of the metadataElementTypeName to
* include in the search results. Null means all subtypes.
* @param searchProperties Optional list of entity property conditions to match.
* @param limitResultsByStatus By default, entities in all statuses (other than DELETE) are returned. However, it is possible
Expand All @@ -10699,7 +10699,7 @@ public List<EntityDetail> findEntities(String userId,
*/
public List<EntityDetail> findEntities(String userId,
String metadataElementTypeName,
List<String> metadataElementSubtypeName,
List<String> metadataElementSubtypeNames,
SearchProperties searchProperties,
List<InstanceStatus> limitResultsByStatus,
SearchClassifications searchClassifications,
Expand All @@ -10722,15 +10722,44 @@ public List<EntityDetail> findEntities(String userId,

int queryPageSize = invalidParameterHandler.validatePaging(startingFrom, pageSize, methodName);

String typeGUID = invalidParameterHandler.validateTypeName(metadataElementTypeName,
OpenMetadataAPIMapper.OPEN_METADATA_ROOT_TYPE_NAME,
serviceName,
methodName,
repositoryHelper);

List<String> subTypeGUIDs = null;

if (metadataElementSubtypeNames != null)
{
subTypeGUIDs = new ArrayList<>();

for (String typeName : metadataElementSubtypeNames)
{
if (typeName != null)
{
String subTypeGUID = invalidParameterHandler.validateTypeName(typeName,
OpenMetadataAPIMapper.OPEN_METADATA_ROOT_TYPE_NAME,
serviceName,
methodName,
repositoryHelper);

if (subTypeGUID != null)
{
subTypeGUIDs.add(subTypeGUID);
}
}
}
}

/*
* Validate that the anchor guid means that the entity is visible to caller.
*/
RepositoryFindEntitiesIterator iterator = new RepositoryFindEntitiesIterator(repositoryHandler,
invalidParameterHandler,
userId,
metadataElementTypeName,
metadataElementSubtypeName,
typeGUID,
subTypeGUIDs,
searchProperties,
limitResultsByStatus,
searchClassifications,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.odpi.openmetadata.frameworks.governanceaction.search.SearchProperties;
import org.odpi.openmetadata.frameworks.governanceaction.search.SequencingOrder;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
Expand All @@ -27,7 +28,8 @@
@JsonIgnoreProperties(ignoreUnknown=true)
public class FindRequestBody implements Serializable
{
private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

private String metadataElementTypeName = null;
private List<String> metadataElementSubtypeName = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,18 @@ public RelatedMetadataElementListResponse getRelatedMetadataElements(@PathVariab
public OpenMetadataElementsResponse findMetadataElements(@PathVariable String serverName,
@PathVariable String serviceURLMarker,
@PathVariable String userId,
@RequestParam boolean forLineage,
@RequestParam boolean forDuplicateProcessing,
@RequestParam long effectiveTime,
@RequestParam int startFrom,
@RequestParam int pageSize,
@RequestBody FindRequestBody requestBody)
@RequestParam(required = false, defaultValue = "false")
boolean forLineage,
@RequestParam(required = false, defaultValue = "false")
boolean forDuplicateProcessing,
@RequestParam(required = false, defaultValue = "0")
long effectiveTime,
@RequestParam(required = false, defaultValue = "0")
int startFrom,
@RequestParam(required = false, defaultValue = "0")
int pageSize,
@RequestBody(required = false)
FindRequestBody requestBody)
{
return restAPI.findMetadataElements(serverName, serviceURLMarker, userId, forLineage, forDuplicateProcessing, effectiveTime, startFrom, pageSize, requestBody);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.odpi.openmetadata.frameworks.governanceaction.ffdc.GAFRuntimeException;


import java.io.Serial;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Objects;
Expand All @@ -26,7 +27,8 @@
@JsonIgnoreProperties(ignoreUnknown=true)
public class PrimitiveTypePropertyValue extends PropertyValue
{
private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

private PrimitiveTypeCategory primitiveTypeCategory = null;
private Object primitiveValue = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

Expand All @@ -24,7 +25,8 @@
@JsonIgnoreProperties(ignoreUnknown=true)
public class PropertyCondition implements Serializable
{
private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

private String property;
private PropertyComparisonOperator operator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.fasterxml.jackson.annotation.*;

import java.io.Serial;
import java.io.Serializable;
import java.util.*;
import java.util.function.Function;
Expand Down Expand Up @@ -31,7 +32,8 @@
})
public abstract class PropertyValue implements Serializable
{
private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

/*
* Common type information that is this is augmented by the subclasses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -24,7 +25,8 @@
public class SearchProperties implements Serializable
{

private static final long serialVersionUID = 1L;
@Serial
private static final long serialVersionUID = 1L;

private List<PropertyCondition> conditions = null;
private MatchCriteria matchCriteria = MatchCriteria.ALL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public enum PrimitiveDefCategory implements Serializable

private static final long serialVersionUID = 1L;

private int code;
private String name;
private String javaClassName;
private String guid;
private final int code;
private final String name;
private final String javaClassName;
private final String guid;


/**
Expand Down Expand Up @@ -74,7 +74,8 @@ public int getOrdinal() {
*
* @return String type name
*/
public String getName() {
public String getName()
{
return name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright Contributors to the ODPi Egeria project */
package org.odpi.openmetadata.viewservices.glossarybrowser.server.spring;

import io.swagger.v3.oas.annotations.Operation;
import org.odpi.openmetadata.accessservices.assetmanager.rest.*;
import org.odpi.openmetadata.viewservices.glossarybrowser.server.GlossaryBrowserRESTServices;
import org.springframework.web.bind.annotation.*;
Expand Down Expand Up @@ -44,6 +45,12 @@ public GlossaryBrowserResource()
*/
@GetMapping(path = "/glossaries/terms/status-list")

@Operation(summary="getGlossaryTermStatuses",
description="Return the list of glossary term status enum values.",
externalDocs=@ExternalDocumentation(description="Controlled glossary terms",
url="https://egeria-project.org/services/omas/asset-manager/overview"))


public GlossaryTermStatusListResponse getGlossaryTermStatuses(@PathVariable String serverName,
@PathVariable String userId)
{
Expand Down