Search in sources :

Example 31 with Type

use of com.yahoo.elide.core.type.Type in project elide by yahoo.

the class ElideStandaloneConfigStoreTest method init.

@BeforeAll
public void init() throws Exception {
    configRoot = Files.createTempDirectory("test");
    settings = new ElideStandaloneTestSettings() {

        @Override
        public EntityDictionary getEntityDictionary(ServiceLocator injector, ClassScanner scanner, Optional<DynamicConfiguration> dynamicConfiguration, Set<Type<?>> entitiesToExclude) {
            Map<String, Class<? extends Check>> checks = new HashMap<>();
            if (getAnalyticProperties().enableDynamicModelConfigAPI()) {
                checks.put(ConfigChecks.CAN_CREATE_CONFIG, ConfigChecks.CanCreate.class);
                checks.put(ConfigChecks.CAN_READ_CONFIG, ConfigChecks.CanRead.class);
                checks.put(ConfigChecks.CAN_DELETE_CONFIG, ConfigChecks.CanDelete.class);
                checks.put(ConfigChecks.CAN_UPDATE_CONFIG, ConfigChecks.CanNotUpdate.class);
            }
            EntityDictionary dictionary = new EntityDictionary(// Checks
            checks, // Role Checks
            new HashMap<>(), new Injector() {

                @Override
                public void inject(Object entity) {
                    injector.inject(entity);
                }

                @Override
                public <T> T instantiate(Class<T> cls) {
                    return injector.create(cls);
                }
            }, // Serde Lookup
            CoerceUtil::lookup, entitiesToExclude, scanner);
            dynamicConfiguration.map(DynamicConfiguration::getRoles).orElseGet(Collections::emptySet).forEach(role -> dictionary.addRoleCheck(role, new Role.RoleMemberCheck(role)));
            return dictionary;
        }

        @Override
        public ElideStandaloneAnalyticSettings getAnalyticProperties() {
            return new ElideStandaloneAnalyticSettings() {

                @Override
                public boolean enableDynamicModelConfig() {
                    return true;
                }

                @Override
                public boolean enableDynamicModelConfigAPI() {
                    return true;
                }

                @Override
                public String getDynamicConfigPath() {
                    return configRoot.toFile().getAbsolutePath();
                }

                @Override
                public boolean enableAggregationDataStore() {
                    return true;
                }

                @Override
                public boolean enableMetaDataStore() {
                    return true;
                }
            };
        }
    };
    elide = new ElideStandalone(settings);
    elide.start(false);
}
Also used : ElideStandalone(com.yahoo.elide.standalone.ElideStandalone) HttpStatus(com.yahoo.elide.core.exceptions.HttpStatus) DynamicConfiguration(com.yahoo.elide.modelconfig.DynamicConfiguration) JSONAPI_CONTENT_TYPE(com.yahoo.elide.Elide.JSONAPI_CONTENT_TYPE) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) ElideStandaloneSettings(com.yahoo.elide.standalone.config.ElideStandaloneSettings) HashMap(java.util.HashMap) Role(com.yahoo.elide.core.security.checks.prefab.Role) JsonApiDSL.attr(com.yahoo.elide.test.jsonapi.JsonApiDSL.attr) AfterAll(org.junit.jupiter.api.AfterAll) MediaType(javax.ws.rs.core.MediaType) TestInstance(org.junit.jupiter.api.TestInstance) BeforeAll(org.junit.jupiter.api.BeforeAll) GraphQLDSL.mutation(com.yahoo.elide.test.graphql.GraphQLDSL.mutation) ClassScanner(com.yahoo.elide.core.utils.ClassScanner) Injector(com.yahoo.elide.core.dictionary.Injector) Map(java.util.Map) RestAssured.when(io.restassured.RestAssured.when) GraphQLDSL.argument(com.yahoo.elide.test.graphql.GraphQLDSL.argument) JsonApiDSL.datum(com.yahoo.elide.test.jsonapi.JsonApiDSL.datum) Path(java.nio.file.Path) JsonApiDSL.type(com.yahoo.elide.test.jsonapi.JsonApiDSL.type) JsonApiDSL.links(com.yahoo.elide.test.jsonapi.JsonApiDSL.links) GraphQLDSL.selection(com.yahoo.elide.test.graphql.GraphQLDSL.selection) JsonApiDSL.attributes(com.yahoo.elide.test.jsonapi.JsonApiDSL.attributes) Check(com.yahoo.elide.core.security.checks.Check) Files(java.nio.file.Files) GraphQLDSL.selections(com.yahoo.elide.test.graphql.GraphQLDSL.selections) GraphQLDSL.field(com.yahoo.elide.test.graphql.GraphQLDSL.field) ElideStandaloneAnalyticSettings(com.yahoo.elide.standalone.config.ElideStandaloneAnalyticSettings) Set(java.util.Set) ConfigChecks(com.yahoo.elide.modelconfig.store.models.ConfigChecks) CoerceUtil(com.yahoo.elide.core.utils.coerce.CoerceUtil) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) JsonApiDSL.resource(com.yahoo.elide.test.jsonapi.JsonApiDSL.resource) GraphQLDSL(com.yahoo.elide.test.graphql.GraphQLDSL) Test(org.junit.jupiter.api.Test) JsonApiDSL.id(com.yahoo.elide.test.jsonapi.JsonApiDSL.id) GraphQLDSL.arguments(com.yahoo.elide.test.graphql.GraphQLDSL.arguments) JsonApiDSL.data(com.yahoo.elide.test.jsonapi.JsonApiDSL.data) Type(com.yahoo.elide.core.type.Type) Optional(java.util.Optional) RestAssured.given(io.restassured.RestAssured.given) ServiceLocator(org.glassfish.hk2.api.ServiceLocator) Collections(java.util.Collections) HashMap(java.util.HashMap) ClassScanner(com.yahoo.elide.core.utils.ClassScanner) DynamicConfiguration(com.yahoo.elide.modelconfig.DynamicConfiguration) Injector(com.yahoo.elide.core.dictionary.Injector) Collections(java.util.Collections) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) ElideStandaloneAnalyticSettings(com.yahoo.elide.standalone.config.ElideStandaloneAnalyticSettings) ServiceLocator(org.glassfish.hk2.api.ServiceLocator) Role(com.yahoo.elide.core.security.checks.prefab.Role) MediaType(javax.ws.rs.core.MediaType) Type(com.yahoo.elide.core.type.Type) ElideStandalone(com.yahoo.elide.standalone.ElideStandalone) HashMap(java.util.HashMap) Map(java.util.Map) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 32 with Type

use of com.yahoo.elide.core.type.Type in project elide by yahoo.

the class SwaggerBuilder method build.

/**
 * Builds a swagger object.
 * @return the constructed 'Swagger' object
 */
public Swagger build() {
    /* Used to convert Elide POJOs into Swagger Model objects */
    ModelConverters converters = ModelConverters.getInstance();
    ModelConverter converter = new JsonApiModelResolver(dictionary);
    converters.addConverter(converter);
    String apiVersion = swagger.getInfo().getVersion();
    if (apiVersion == null) {
        apiVersion = NO_VERSION;
    }
    if (allClasses.isEmpty()) {
        allClasses = dictionary.getBoundClassesByVersion(apiVersion);
    } else {
        allClasses = Sets.intersection(dictionary.getBoundClassesByVersion(apiVersion), allClasses);
        if (allClasses.isEmpty()) {
            throw new IllegalArgumentException("None of the provided classes are exported by Elide");
        }
    }
    /*
         * Create a Model for each Elide entity.
         * Elide entity could be of ClassType or DynamicType.
         * For ClassType, extract the class and pass it to ModelConverters#readAll method.
         * ModelConverters#readAll doesn't support Elide Dynamic Type, so calling the
         * JsonApiModelResolver#resolve method directly when its not a ClassType.
         */
    Map<String, Model> models = new HashMap<>();
    for (Type<?> clazz : allClasses) {
        if (clazz instanceof ClassType) {
            models.putAll(converters.readAll(((ClassType) clazz).getCls()));
        } else {
            ModelConverterContextImpl context = new ModelConverterContextImpl(Arrays.asList(converter));
            context.resolve(clazz);
            models.putAll(context.getDefinedModels());
        }
    }
    swagger.setDefinitions(models);
    rootClasses = allClasses.stream().filter(dictionary::isRoot).collect(Collectors.toSet());
    /* Find all the paths starting from the root entities. */
    Set<PathMetaData> pathData = rootClasses.stream().map(this::find).flatMap(Collection::stream).collect(Collectors.toSet());
    /* Prune the discovered paths to remove redundant elements */
    Set<PathMetaData> toRemove = new HashSet<>();
    pathData.stream().collect(Collectors.groupingBy(PathMetaData::getRootType)).values().forEach(pathSet -> {
        for (PathMetaData path : pathSet) {
            for (PathMetaData compare : pathSet) {
                /*
                             * We don't prune paths that are redundant with root collections to allow both BOTH
                             * root collection urls as well as relationship urls.
                             */
                if (compare.lineage.isEmpty() || path == compare) {
                    continue;
                }
                if (compare.shorterThan(path)) {
                    toRemove.add(path);
                    break;
                }
            }
        }
    });
    pathData = Sets.difference(pathData, toRemove);
    /* Each path constructs 3 URLs (collection, instance, and relationship) */
    for (PathMetaData pathDatum : pathData) {
        swagger.path(pathDatum.getCollectionUrl(), pathDatum.getCollectionPath());
        swagger.path(pathDatum.getUrl(), pathDatum.getInstancePath());
        /* We only construct relationship URLs if the entity is not a root collection */
        if (!pathDatum.lineage.isEmpty()) {
            swagger.path(pathDatum.getRelationshipUrl(), pathDatum.getRelationshipPath());
        }
    }
    /* We create Swagger 'tags' for each entity so Swagger UI organizes the paths by entities */
    List<Tag> tags = allClasses.stream().map((clazz) -> dictionary.getJsonAliasFor(clazz)).map((alias) -> new Tag().name(alias)).collect(Collectors.toList());
    swagger.tags(tags);
    return swagger;
}
Also used : Arrays(java.util.Arrays) ModelConverters(io.swagger.converter.ModelConverters) Getter(lombok.Getter) Swagger(io.swagger.models.Swagger) Tag(io.swagger.models.Tag) StringProperty(io.swagger.models.properties.StringProperty) Json(io.swagger.util.Json) HashMap(java.util.HashMap) ClassType(com.yahoo.elide.core.type.ClassType) Stack(java.util.Stack) Model(io.swagger.models.Model) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Path(io.swagger.models.Path) Map(java.util.Map) NO_VERSION(com.yahoo.elide.core.dictionary.EntityDictionary.NO_VERSION) Datum(com.yahoo.elide.swagger.model.Datum) ModelConverter(io.swagger.converter.ModelConverter) BodyParameter(io.swagger.models.parameters.BodyParameter) PathParameter(io.swagger.models.parameters.PathParameter) Collection(java.util.Collection) Set(java.util.Set) Parameter(io.swagger.models.parameters.Parameter) ModelConverterContextImpl(io.swagger.converter.ModelConverterContextImpl) Collectors(java.util.stream.Collectors) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) Sets(com.google.common.collect.Sets) Info(io.swagger.models.Info) QueryParameter(io.swagger.models.parameters.QueryParameter) Objects(java.util.Objects) Response(io.swagger.models.Response) List(java.util.List) Type(com.yahoo.elide.core.type.Type) Operator(com.yahoo.elide.core.filter.Operator) Relationship(com.yahoo.elide.swagger.property.Relationship) Queue(java.util.Queue) ArrayDeque(java.util.ArrayDeque) RelationshipType(com.yahoo.elide.core.dictionary.RelationshipType) Data(com.yahoo.elide.swagger.model.Data) HashMap(java.util.HashMap) ClassType(com.yahoo.elide.core.type.ClassType) ModelConverter(io.swagger.converter.ModelConverter) Model(io.swagger.models.Model) ModelConverters(io.swagger.converter.ModelConverters) Tag(io.swagger.models.Tag) ModelConverterContextImpl(io.swagger.converter.ModelConverterContextImpl) HashSet(java.util.HashSet)

Example 33 with Type

use of com.yahoo.elide.core.type.Type in project elide by yahoo.

the class PersistentResource method buildIdFilterExpression.

/**
 * Build an id filter expression for a particular entity type.
 *
 * @param ids        Ids to include in the filter expression
 * @param entityType Type of entity
 * @return Filter expression for given ids and type.
 */
private static FilterExpression buildIdFilterExpression(List<String> ids, Type<?> entityType, EntityDictionary dictionary, RequestScope scope) {
    Type<?> idType = dictionary.getIdType(entityType);
    String idField = dictionary.getIdFieldName(entityType);
    List<Object> coercedIds = ids.stream().filter(// these don't exist yet
    id -> scope.getObjectById(entityType, id) == null).map(id -> CoerceUtil.coerce(id, idType)).collect(Collectors.toList());
    /* construct a new SQL like filter expression, eg: book.id IN [1,2] */
    FilterExpression idFilter = new InPredicate(new Path.PathElement(entityType, idType, idField), coercedIds);
    return idFilter;
}
Also used : Resource(com.yahoo.elide.jsonapi.models.Resource) Data(com.yahoo.elide.jsonapi.models.Data) StringUtils(org.apache.commons.lang3.StringUtils) UpdatePermission(com.yahoo.elide.annotation.UpdatePermission) ClassType(com.yahoo.elide.core.type.ClassType) DeletePermission(com.yahoo.elide.annotation.DeletePermission) Argument(com.yahoo.elide.core.request.Argument) InvalidSyntaxException(com.yahoo.elide.core.audit.InvalidSyntaxException) Map(java.util.Map) DataStoreIterable(com.yahoo.elide.core.datastore.DataStoreIterable) LifeCycleHookBinding(com.yahoo.elide.annotation.LifeCycleHookBinding) EntityBinding(com.yahoo.elide.core.dictionary.EntityBinding) NonNull(lombok.NonNull) Collection(java.util.Collection) Set(java.util.Set) CoerceUtil(com.yahoo.elide.core.utils.coerce.CoerceUtil) Collectors(java.util.stream.Collectors) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) Sets(com.google.common.collect.Sets) Serializable(java.io.Serializable) Objects(java.util.Objects) ExpressionResult(com.yahoo.elide.core.security.permissions.ExpressionResult) List(java.util.List) Annotation(java.lang.annotation.Annotation) AndFilterExpression(com.yahoo.elide.core.filter.expression.AndFilterExpression) Optional(java.util.Optional) RelationshipType(com.yahoo.elide.core.dictionary.RelationshipType) Attribute(com.yahoo.elide.core.request.Attribute) InvalidAttributeException(com.yahoo.elide.core.exceptions.InvalidAttributeException) Function(java.util.function.Function) Supplier(java.util.function.Supplier) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) IterableUtils(org.apache.commons.collections4.IterableUtils) LogMessageImpl(com.yahoo.elide.core.audit.LogMessageImpl) DELETE(com.yahoo.elide.annotation.LifeCycleHookBinding.Operation.DELETE) EntityDictionary.getType(com.yahoo.elide.core.dictionary.EntityDictionary.getType) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) Predicates(com.google.common.base.Predicates) InternalServerErrorException(com.yahoo.elide.core.exceptions.InternalServerErrorException) CanPaginateVisitor(com.yahoo.elide.core.security.visitors.CanPaginateVisitor) Observable(io.reactivex.Observable) LogMessage(com.yahoo.elide.core.audit.LogMessage) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) LinkedHashSet(java.util.LinkedHashSet) UPDATE(com.yahoo.elide.annotation.LifeCycleHookBinding.Operation.UPDATE) DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) VerifyFieldAccessFilterExpressionVisitor(com.yahoo.elide.core.filter.visitors.VerifyFieldAccessFilterExpressionVisitor) ChangeSpec(com.yahoo.elide.core.security.ChangeSpec) COLLECTION_TYPE(com.yahoo.elide.core.type.ClassType.COLLECTION_TYPE) Sorting(com.yahoo.elide.core.request.Sorting) InvalidEntityBodyException(com.yahoo.elide.core.exceptions.InvalidEntityBodyException) InvalidObjectIdentifierException(com.yahoo.elide.core.exceptions.InvalidObjectIdentifierException) InPredicate(com.yahoo.elide.core.filter.predicates.InPredicate) EntityProjection(com.yahoo.elide.core.request.EntityProjection) Relationship(com.yahoo.elide.jsonapi.models.Relationship) ForbiddenAccessException(com.yahoo.elide.core.exceptions.ForbiddenAccessException) ReadPermission(com.yahoo.elide.annotation.ReadPermission) BadRequestException(com.yahoo.elide.core.exceptions.BadRequestException) Pagination(com.yahoo.elide.core.request.Pagination) ResourceIdentifier(com.yahoo.elide.jsonapi.models.ResourceIdentifier) TreeMap(java.util.TreeMap) CreatePermission(com.yahoo.elide.annotation.CreatePermission) CREATE(com.yahoo.elide.annotation.LifeCycleHookBinding.Operation.CREATE) Type(com.yahoo.elide.core.type.Type) Preconditions(com.google.common.base.Preconditions) Comparator(java.util.Comparator) Collections(java.util.Collections) EMPTY_BINDING(com.yahoo.elide.core.dictionary.EntityBinding.EMPTY_BINDING) Audit(com.yahoo.elide.annotation.Audit) NonTransferable(com.yahoo.elide.annotation.NonTransferable) AndFilterExpression(com.yahoo.elide.core.filter.expression.AndFilterExpression) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) InPredicate(com.yahoo.elide.core.filter.predicates.InPredicate)

Example 34 with Type

use of com.yahoo.elide.core.type.Type in project elide by yahoo.

the class SearchDataTransaction method search.

/**
 * Perform the full-text search.
 * @param entityType The class to search
 * @param filterExpression The filter expression to apply
 * @param sorting Optional sorting
 * @param pagination Optional pagination
 * @return A list of records of type entityClass.
 */
private <T> List<T> search(Type<?> entityType, FilterExpression filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination) {
    Query query;
    Class<?> entityClass = null;
    if (entityType != null) {
        Preconditions.checkState(entityType instanceof ClassType);
        entityClass = ((ClassType) entityType).getCls();
    }
    try {
        query = filterExpression.accept(new FilterExpressionToLuceneQuery(em, entityClass));
    } catch (IllegalArgumentException e) {
        throw new BadRequestException(e.getMessage());
    }
    FullTextQuery fullTextQuery = em.createFullTextQuery(query, entityClass);
    if (mustSort(sorting)) {
        fullTextQuery = fullTextQuery.setSort(buildSort(sorting.get(), entityType));
    }
    if (pagination.isPresent()) {
        fullTextQuery = fullTextQuery.setMaxResults(pagination.get().getLimit());
        fullTextQuery = fullTextQuery.setFirstResult(pagination.get().getOffset());
    }
    List<T[]> results = fullTextQuery.setProjection(ProjectionConstants.THIS).getResultList();
    if (pagination.filter(Pagination::returnPageTotals).isPresent()) {
        pagination.get().setPageTotals((long) fullTextQuery.getResultSize());
    }
    if (results.isEmpty()) {
        return Collections.emptyList();
    }
    return results.stream().map(result -> result[0]).collect(Collectors.toList());
}
Also used : PredicateExtractionVisitor(com.yahoo.elide.core.filter.expression.PredicateExtractionVisitor) Query(org.apache.lucene.search.Query) FilterPredicate(com.yahoo.elide.core.filter.predicates.FilterPredicate) Arrays(java.util.Arrays) Path(com.yahoo.elide.core.Path) DataStoreIterableBuilder(com.yahoo.elide.core.datastore.DataStoreIterableBuilder) ProjectionConstants(org.hibernate.search.engine.ProjectionConstants) SortableField(org.hibernate.search.annotations.SortableField) FullTextQuery(org.hibernate.search.jpa.FullTextQuery) Index(org.hibernate.search.annotations.Index) ClassType(com.yahoo.elide.core.type.ClassType) Fields(org.hibernate.search.annotations.Fields) ArrayList(java.util.ArrayList) Map(java.util.Map) DataStoreIterable(com.yahoo.elide.core.datastore.DataStoreIterable) TransactionWrapper(com.yahoo.elide.core.datastore.wrapped.TransactionWrapper) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) RequestScope(com.yahoo.elide.core.RequestScope) FullTextEntityManager(org.hibernate.search.jpa.FullTextEntityManager) DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) HttpStatusException(com.yahoo.elide.core.exceptions.HttpStatusException) Sorting(com.yahoo.elide.core.request.Sorting) Sort(org.apache.lucene.search.Sort) Collection(java.util.Collection) Field(org.hibernate.search.annotations.Field) EntityProjection(com.yahoo.elide.core.request.EntityProjection) Collectors(java.util.stream.Collectors) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) SortFieldContext(org.hibernate.search.query.dsl.sort.SortFieldContext) List(java.util.List) BadRequestException(com.yahoo.elide.core.exceptions.BadRequestException) Pagination(com.yahoo.elide.core.request.Pagination) InvalidValueException(com.yahoo.elide.core.exceptions.InvalidValueException) Type(com.yahoo.elide.core.type.Type) Operator(com.yahoo.elide.core.filter.Operator) Optional(java.util.Optional) Preconditions(com.google.common.base.Preconditions) Comparator(java.util.Comparator) Collections(java.util.Collections) QueryBuilder(org.hibernate.search.query.dsl.QueryBuilder) Query(org.apache.lucene.search.Query) FullTextQuery(org.hibernate.search.jpa.FullTextQuery) BadRequestException(com.yahoo.elide.core.exceptions.BadRequestException) ClassType(com.yahoo.elide.core.type.ClassType) FullTextQuery(org.hibernate.search.jpa.FullTextQuery)

Example 35 with Type

use of com.yahoo.elide.core.type.Type in project elide by yahoo.

the class NodeContainer method processFetch.

@Override
public Object processFetch(Environment context) {
    EntityDictionary entityDictionary = context.requestScope.getDictionary();
    NonEntityDictionary nonEntityDictionary = context.nonEntityDictionary;
    Type parentClass = context.parentResource.getResourceType();
    String fieldName = context.field.getName();
    String idFieldName = entityDictionary.getIdFieldName(parentClass);
    if (entityDictionary.isAttribute(parentClass, fieldName)) {
        /* fetch attribute properties */
        Attribute requested = context.requestScope.getProjectionInfo().getAttributeMap().getOrDefault(context.field.getSourceLocation(), null);
        Object attribute = context.parentResource.getAttribute(requested);
        if (attribute != null && nonEntityDictionary.hasBinding(EntityDictionary.getType(attribute))) {
            return new NonEntityContainer(attribute);
        }
        if (attribute instanceof Map) {
            return ((Map<Object, Object>) attribute).entrySet().stream().map(MapEntryContainer::new).collect(Collectors.toList());
        }
        if (attribute instanceof Collection) {
            Type<?> innerType = entityDictionary.getParameterizedType(parentClass, fieldName);
            if (nonEntityDictionary.hasBinding(innerType)) {
                return ((Collection) attribute).stream().map(NonEntityContainer::new).collect(Collectors.toList());
            }
        }
        return attribute;
    }
    if (entityDictionary.isRelation(parentClass, fieldName)) {
        /* fetch relationship properties */
        // get the relationship from constructed projections
        Relationship relationship = context.requestScope.getProjectionInfo().getRelationshipMap().getOrDefault(context.field.getSourceLocation(), null);
        if (relationship == null) {
            throw new BadRequestException("Relationship doesn't have projection " + context.parentResource.getTypeName() + "." + fieldName);
        }
        return fetchRelationship(context, relationship);
    }
    if (Objects.equals(idFieldName, fieldName)) {
        return new DeferredId(context.parentResource);
    }
    throw new BadRequestException("Unrecognized object: " + fieldName + " for: " + parentClass.getName() + " in node");
}
Also used : Attribute(com.yahoo.elide.core.request.Attribute) NonEntityDictionary(com.yahoo.elide.graphql.NonEntityDictionary) Type(com.yahoo.elide.core.type.Type) Relationship(com.yahoo.elide.core.request.Relationship) DeferredId(com.yahoo.elide.graphql.DeferredId) Collection(java.util.Collection) BadRequestException(com.yahoo.elide.core.exceptions.BadRequestException) NonEntityDictionary(com.yahoo.elide.graphql.NonEntityDictionary) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) Map(java.util.Map)

Aggregations

Type (com.yahoo.elide.core.type.Type)35 EntityDictionary (com.yahoo.elide.core.dictionary.EntityDictionary)22 Set (java.util.Set)17 List (java.util.List)16 Map (java.util.Map)16 ClassType (com.yahoo.elide.core.type.ClassType)15 Function (java.util.function.Function)14 FilterExpression (com.yahoo.elide.core.filter.expression.FilterExpression)13 Annotation (java.lang.annotation.Annotation)12 Collectors (java.util.stream.Collectors)12 Collection (java.util.Collection)11 ReadPermission (com.yahoo.elide.annotation.ReadPermission)10 ArrayList (java.util.ArrayList)10 HashSet (java.util.HashSet)10 DataStoreTransaction (com.yahoo.elide.core.datastore.DataStoreTransaction)9 Optional (java.util.Optional)9 RequestScope (com.yahoo.elide.core.RequestScope)8 Objects (java.util.Objects)8 Path (com.yahoo.elide.core.Path)7 RelationshipType (com.yahoo.elide.core.dictionary.RelationshipType)7