001// -------------------------------------------------------------------------------- 002// Copyright 2002-2024 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016 017package com.echothree.model.control.search.server.graphql; 018 019import com.echothree.model.control.core.server.graphql.CoreSecurityUtils; 020import com.echothree.model.control.core.server.graphql.EntityAttributeObject; 021import com.echothree.model.data.core.server.entity.EntityAttribute; 022import graphql.annotations.annotationTypes.GraphQLDescription; 023import graphql.annotations.annotationTypes.GraphQLField; 024import graphql.annotations.annotationTypes.GraphQLName; 025import graphql.annotations.annotationTypes.GraphQLNonNull; 026import graphql.schema.DataFetchingEnvironment; 027import java.util.Collection; 028 029@GraphQLDescription("user visit search facet object") 030@GraphQLName("UserVisitSearchFacet") 031public class UserVisitSearchFacetObject { 032 033 final private EntityAttribute entityAttribute; 034 final private Collection<UserVisitSearchFacetListItemObject> userVisitSearchFacetListItems; 035 final private Collection<UserVisitSearchFacetIntegerObject> userVisitSearchFacetIntegers; 036 final private Collection<UserVisitSearchFacetLongObject> userVisitSearchFacetLongs; 037 038 /** Creates a new instance of UserVisitSearchFacetIntegerObject */ 039 public UserVisitSearchFacetObject(EntityAttribute entityAttribute, Collection<UserVisitSearchFacetListItemObject> userVisitSearchFacetListItems, 040 Collection<UserVisitSearchFacetIntegerObject> userVisitSearchFacetIntegers, Collection<UserVisitSearchFacetLongObject> userVisitSearchFacetLongs) { 041 this.entityAttribute = entityAttribute; 042 this.userVisitSearchFacetListItems = userVisitSearchFacetListItems; 043 this.userVisitSearchFacetIntegers = userVisitSearchFacetIntegers; 044 this.userVisitSearchFacetLongs = userVisitSearchFacetLongs; 045 } 046 047 @GraphQLField 048 @GraphQLDescription("entity attribute") 049 public EntityAttributeObject getEntityAttribute(final DataFetchingEnvironment env) { 050 return CoreSecurityUtils.getHasEntityAttributeAccess(env) ? new EntityAttributeObject(entityAttribute, null) : null; 051 } 052 053 @GraphQLField 054 @GraphQLDescription("entity list items") 055 public Collection<UserVisitSearchFacetListItemObject> getEntityListItems() { 056 return userVisitSearchFacetListItems; 057 } 058 059 @GraphQLField 060 @GraphQLDescription("entity integer ranges") 061 public Collection<UserVisitSearchFacetIntegerObject> getEntityIntegerRanges() { 062 return userVisitSearchFacetIntegers; 063 } 064 065 @GraphQLField 066 @GraphQLDescription("entity long ranges") 067 public Collection<UserVisitSearchFacetLongObject> getEntityLongRanges() { 068 return userVisitSearchFacetLongs; 069 } 070 071}