You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2024/02/11 16:17:59 UTC
(causeway) 02/08: CAUSEWAY-3676: refactors top level query/mutation a little
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch CAUSEWAY-3676
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit aaabbd110dd6a8efd745b14e6c6c5ba9f8e8156d
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Feb 11 12:29:46 2024 +0000
CAUSEWAY-3676: refactors top level query/mutation a little
---
.../viewer/graphql/model/context/Context.java | 14 ++
viewers/graphql/test/src/test/resources/schema.gql | 158 +++++++++++++++------
.../integration/GraphQlSourceForCauseway.java | 53 +------
.../viewer/toplevel/GqlvTopLevelMutation.java | 23 +++
.../graphql/viewer/toplevel/GqlvTopLevelQuery.java | 22 +++
5 files changed, 179 insertions(+), 91 deletions(-)
diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/context/Context.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/context/Context.java
index a073e2e694..0a9ffe1fbc 100644
--- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/context/Context.java
+++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/context/Context.java
@@ -20,17 +20,23 @@ package org.apache.causeway.viewer.graphql.model.context;
import graphql.schema.GraphQLCodeRegistry;
+import org.apache.causeway.applib.id.HasLogicalType;
import org.apache.causeway.applib.services.bookmark.BookmarkService;
import org.apache.causeway.applib.services.registry.ServiceRegistry;
import org.apache.causeway.commons.collections.ImmutableEnumSet;
+import org.apache.causeway.commons.functional.Either;
import org.apache.causeway.core.config.CausewayConfiguration;
import org.apache.causeway.core.config.environment.CausewaySystemEnvironment;
import org.apache.causeway.core.metamodel.spec.ActionScope;
+import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
import org.apache.causeway.core.metamodel.specloader.SpecificationLoader;
import org.apache.causeway.viewer.graphql.model.types.TypeMapper;
import lombok.RequiredArgsConstructor;
+import java.util.Comparator;
+import java.util.List;
+
@RequiredArgsConstructor
public class Context {
public final GraphQLCodeRegistry.Builder codeRegistryBuilder;
@@ -47,4 +53,12 @@ public class Context {
: ActionScope.ANY;
}
+ public List<ObjectSpecification> objectSpecifications() {
+ return specificationLoader.snapshotSpecifications()
+ .filter(x -> x.getCorrespondingClass().getPackage() != Either.class.getPackage()) // exclude the org.apache_causeway.commons.functional
+ .distinct((a, b) -> a.getLogicalTypeName().equals(b.getLogicalTypeName()))
+ .filter(x -> x.isEntityOrViewModelOrAbstract() || x.getBeanSort().isManagedBeanContributing())
+ .sorted(Comparator.comparing(HasLogicalType::getLogicalTypeName))
+ .toList();
+ }
}
diff --git a/viewers/graphql/test/src/test/resources/schema.gql b/viewers/graphql/test/src/test/resources/schema.gql
index b7d6eb65ee..65b53a6d18 100644
--- a/viewers/graphql/test/src/test/resources/schema.gql
+++ b/viewers/graphql/test/src/test/resources/schema.gql
@@ -22,50 +22,6 @@ directive @specifiedBy(
url: String!
) on SCALAR
-type Mutation {
- causeway_applib_PropertyNode__mixedIn(_gqlv_target: causeway_applib_PropertyNode__gqlv_input, mixedIn: Boolean!): causeway_applib_PropertyNode
- causeway_applib_node_ActionNode__mixedIn(_gqlv_target: causeway_applib_node_ActionNode__gqlv_input, mixedIn: Boolean!): causeway_applib_node_ActionNode
- causeway_applib_node_CollectionNode__mixedIn(_gqlv_target: causeway_applib_node_CollectionNode__gqlv_input, mixedIn: Boolean!): causeway_applib_node_CollectionNode
- causeway_applib_node_FacetNode__shadowed(_gqlv_target: causeway_applib_node_FacetNode__gqlv_input, shadowed: Boolean!): causeway_applib_node_FacetNode
- causeway_conf_ConfigurationProperty__key(_gqlv_target: causeway_conf_ConfigurationProperty__gqlv_input, key: String!): causeway_conf_ConfigurationProperty
- causeway_conf_ConfigurationProperty__value(_gqlv_target: causeway_conf_ConfigurationProperty__gqlv_input, value: String!): causeway_conf_ConfigurationProperty
- causeway_schema_metamodel_v2_DomainClassDto__actions(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, actions: String!): causeway_schema_metamodel_v2_DomainClassDto
- causeway_schema_metamodel_v2_DomainClassDto__annotations(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, annotations: String!): causeway_schema_metamodel_v2_DomainClassDto
- causeway_schema_metamodel_v2_DomainClassDto__collections(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, collections: String!): causeway_schema_metamodel_v2_DomainClassDto
- causeway_schema_metamodel_v2_DomainClassDto__facets(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, facets: String!): causeway_schema_metamodel_v2_DomainClassDto
- causeway_schema_metamodel_v2_DomainClassDto__id(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, id: String!): causeway_schema_metamodel_v2_DomainClassDto
- causeway_schema_metamodel_v2_DomainClassDto__majorVersion(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, majorVersion: String): causeway_schema_metamodel_v2_DomainClassDto
- causeway_schema_metamodel_v2_DomainClassDto__minorVersion(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, minorVersion: String): causeway_schema_metamodel_v2_DomainClassDto
- causeway_schema_metamodel_v2_DomainClassDto__properties(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, properties: String!): causeway_schema_metamodel_v2_DomainClassDto
- causeway_schema_metamodel_v2_DomainClassDto__service(_gqlv_target: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input, service: Boolean!): causeway_schema_metamodel_v2_DomainClassDto
- causeway_testing_fixtures_FixtureResult__fixtureScriptClassName(_gqlv_target: causeway_testing_fixtures_FixtureResult__gqlv_input, fixtureScriptClassName: String): causeway_testing_fixtures_FixtureResult
- causeway_testing_fixtures_FixtureResult__key(_gqlv_target: causeway_testing_fixtures_FixtureResult__gqlv_input, key: String!): causeway_testing_fixtures_FixtureResult
- causeway_testing_fixtures_FixtureResult__object(_gqlv_target: causeway_testing_fixtures_FixtureResult__gqlv_input, object: String!): causeway_testing_fixtures_FixtureResult
- org_apache_causeway_core_metamodel_inspect_model_MemberNode__mixedIn(_gqlv_target: org_apache_causeway_core_metamodel_inspect_model_MemberNode__gqlv_input, mixedIn: Boolean!): org_apache_causeway_core_metamodel_inspect_model_MemberNode
- org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript__friendlyName(_gqlv_target: org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript__gqlv_input, friendlyName: String!): org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript
- university_admin_AdminMenu__actionWithDisabledParam(firstParam: String!, secondParam: String!, thirdParameter: String!): String
- university_admin_AdminMenu__actionWithHiddenParam(firstParam: String!, secondParam: String!): String
- university_admin_AdminMenu__adminAction: String
- university_admin_AdminMenu__otherAdminAction: String
- university_dept_Department__addStaffMember(_gqlv_target: university_dept_Department__gqlv_input, staffMember: university_dept_StaffMember__gqlv_input!): university_dept_Department
- university_dept_Department__addStaffMembers(_gqlv_target: university_dept_Department__gqlv_input, staffMembers: [university_dept_StaffMember__gqlv_input]): university_dept_Department
- university_dept_Department__changeDeptHead(_gqlv_target: university_dept_Department__gqlv_input, newDeptHead: university_dept_DeptHead__gqlv_input!): university_dept_Department
- university_dept_Department__changeName(_gqlv_target: university_dept_Department__gqlv_input, newName: String!): university_dept_Department
- university_dept_Department__deptHead(_gqlv_target: university_dept_Department__gqlv_input, deptHead: university_dept_DeptHead__gqlv_input): university_dept_Department
- university_dept_Department__name(_gqlv_target: university_dept_Department__gqlv_input, name: String!): university_dept_Department
- university_dept_Department__removeStaffMember(_gqlv_target: university_dept_Department__gqlv_input, staffMember: university_dept_StaffMember__gqlv_input!): university_dept_Department
- university_dept_Departments__createDepartment(deptHead: university_dept_DeptHead__gqlv_input, name: String!): university_dept_Department
- university_dept_DeptHead__changeDepartment(_gqlv_target: university_dept_DeptHead__gqlv_input, department: university_dept_Department__gqlv_input!): university_dept_DeptHead
- university_dept_DeptHead__changeName(_gqlv_target: university_dept_DeptHead__gqlv_input, newName: String!): university_dept_DeptHead
- university_dept_DeptHead__department(_gqlv_target: university_dept_DeptHead__gqlv_input, department: university_dept_Department__gqlv_input): university_dept_DeptHead
- university_dept_DeptHead__name(_gqlv_target: university_dept_DeptHead__gqlv_input, name: String): university_dept_DeptHead
- university_dept_StaffMember__department(_gqlv_target: university_dept_StaffMember__gqlv_input, department: university_dept_Department__gqlv_input): university_dept_StaffMember
- university_dept_StaffMember__grade(_gqlv_target: university_dept_StaffMember__gqlv_input, grade: String!): university_dept_StaffMember
- university_dept_StaffMember__name(_gqlv_target: university_dept_StaffMember__gqlv_input, name: String!): university_dept_StaffMember
- university_dept_StaffMember__photo(_gqlv_target: university_dept_StaffMember__gqlv_input, photo: String): university_dept_StaffMember
- university_dept_Staff__createStaffMember(department: university_dept_Department__gqlv_input!, name: String!): university_dept_StaffMember
-}
-
type Query {
_gqlv_lookup__causeway_applib_DomainObjectList(object: causeway_applib_DomainObjectList__gqlv_input): causeway_applib_DomainObjectList
_gqlv_lookup__causeway_applib_FacetGroupNode(object: causeway_applib_FacetGroupNode__gqlv_input): causeway_applib_FacetGroupNode
@@ -128,6 +84,7 @@ type causeway_applib_DomainObjectList__actionArguments__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(actionArguments: String): causeway_applib_DomainObjectList
validate(actionArguments: String): String
}
@@ -135,6 +92,7 @@ type causeway_applib_DomainObjectList__actionId__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(actionId: String): causeway_applib_DomainObjectList
validate(actionId: String): String
}
@@ -142,6 +100,7 @@ type causeway_applib_DomainObjectList__actionOwningFqcn__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(actionOwningFqcn: String): causeway_applib_DomainObjectList
validate(actionOwningFqcn: String): String
}
@@ -149,6 +108,7 @@ type causeway_applib_DomainObjectList__elementTypeFqcn__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(elementTypeFqcn: String!): causeway_applib_DomainObjectList
validate(elementTypeFqcn: String): String
}
@@ -166,6 +126,7 @@ type causeway_applib_DomainObjectList__title__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(title: String!): causeway_applib_DomainObjectList
validate(title: String): String
}
@@ -185,6 +146,7 @@ type causeway_applib_FacetGroupNode__facets__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(facets: String!): causeway_applib_FacetGroupNode
validate(facets: String): String
}
@@ -196,6 +158,7 @@ type causeway_applib_FacetGroupNode__gqlv_meta {
type causeway_applib_FacetGroupNode__parentNode__gqlv_property {
disabled: String
hidden: Boolean
+ set(parentNode: org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input!): causeway_applib_FacetGroupNode
validate(parentNode: org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input): String
}
@@ -220,6 +183,7 @@ type causeway_applib_ParameterNode__parameter__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(parameter: String!): causeway_applib_ParameterNode
validate(parameter: String): String
}
@@ -227,6 +191,7 @@ type causeway_applib_ParameterNode__parentNode__gqlv_property {
disabled: String
get: causeway_applib_node_ActionNode!
hidden: Boolean
+ set(parentNode: causeway_applib_node_ActionNode__gqlv_input!): causeway_applib_ParameterNode
validate(parentNode: causeway_applib_node_ActionNode__gqlv_input): String
}
@@ -252,6 +217,7 @@ type causeway_applib_PropertyNode__mixedIn__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
+ set(mixedIn: Boolean!): causeway_applib_PropertyNode
validate(mixedIn: Boolean): String
}
@@ -259,6 +225,7 @@ type causeway_applib_PropertyNode__parentNode__gqlv_property {
disabled: String
get: causeway_applib_TypeNode!
hidden: Boolean
+ set(parentNode: causeway_applib_TypeNode__gqlv_input!): causeway_applib_PropertyNode
validate(parentNode: causeway_applib_TypeNode__gqlv_input): String
}
@@ -266,6 +233,7 @@ type causeway_applib_PropertyNode__property__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(property: String!): causeway_applib_PropertyNode
validate(property: String): String
}
@@ -279,6 +247,7 @@ type causeway_applib_RoleMemento__description__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(description: String!): causeway_applib_RoleMemento
validate(description: String): String
}
@@ -291,6 +260,7 @@ type causeway_applib_RoleMemento__name__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(name: String!): causeway_applib_RoleMemento
validate(name: String): String
}
@@ -310,6 +280,7 @@ type causeway_applib_TypeNode__domainClassDto__gqlv_property {
disabled: String
get: causeway_schema_metamodel_v2_DomainClassDto!
hidden: Boolean
+ set(domainClassDto: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input!): causeway_applib_TypeNode
validate(domainClassDto: causeway_schema_metamodel_v2_DomainClassDto__gqlv_input): String
}
@@ -321,6 +292,7 @@ type causeway_applib_TypeNode__gqlv_meta {
type causeway_applib_TypeNode__parentNode__gqlv_property {
disabled: String
hidden: Boolean
+ set(parentNode: org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input!): causeway_applib_TypeNode
validate(parentNode: org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input): String
}
@@ -343,6 +315,7 @@ type causeway_applib_UserMemento__authenticationCode__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(authenticationCode: String!): causeway_applib_UserMemento
validate(authenticationCode: String): String
}
@@ -351,6 +324,7 @@ type causeway_applib_UserMemento__authenticationSource__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(authenticationSource: String!): causeway_applib_UserMemento
validate(authenticationSource: String): String
}
@@ -358,6 +332,7 @@ type causeway_applib_UserMemento__avatarUrl__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(avatarUrl: String): causeway_applib_UserMemento
validate(avatarUrl: String): String
}
@@ -370,6 +345,7 @@ type causeway_applib_UserMemento__impersonating__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
+ set(impersonating: Boolean!): causeway_applib_UserMemento
validate(impersonating: Boolean): String
}
@@ -377,6 +353,7 @@ type causeway_applib_UserMemento__languageLocale__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(languageLocale: String): causeway_applib_UserMemento
validate(languageLocale: String): String
}
@@ -384,6 +361,7 @@ type causeway_applib_UserMemento__multiTenancyToken__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(multiTenancyToken: String): causeway_applib_UserMemento
validate(multiTenancyToken: String): String
}
@@ -391,6 +369,7 @@ type causeway_applib_UserMemento__name__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(name: String!): causeway_applib_UserMemento
validate(name: String): String
}
@@ -398,6 +377,7 @@ type causeway_applib_UserMemento__numberFormatLocale__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(numberFormatLocale: String): causeway_applib_UserMemento
validate(numberFormatLocale: String): String
}
@@ -405,6 +385,7 @@ type causeway_applib_UserMemento__realName__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(realName: String): causeway_applib_UserMemento
validate(realName: String): String
}
@@ -418,6 +399,7 @@ type causeway_applib_UserMemento__timeFormatLocale__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(timeFormatLocale: String): causeway_applib_UserMemento
validate(timeFormatLocale: String): String
}
@@ -444,6 +426,7 @@ type causeway_applib_node_ActionNode__action__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(action: String!): causeway_applib_node_ActionNode
validate(action: String): String
}
@@ -461,6 +444,7 @@ type causeway_applib_node_ActionNode__mixedIn__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
+ set(mixedIn: Boolean!): causeway_applib_node_ActionNode
validate(mixedIn: Boolean): String
}
@@ -468,6 +452,7 @@ type causeway_applib_node_ActionNode__parentNode__gqlv_property {
disabled: String
get: causeway_applib_TypeNode!
hidden: Boolean
+ set(parentNode: causeway_applib_TypeNode__gqlv_input!): causeway_applib_node_ActionNode
validate(parentNode: causeway_applib_TypeNode__gqlv_input): String
}
@@ -488,6 +473,7 @@ type causeway_applib_node_CollectionNode__collection__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(collection: String!): causeway_applib_node_CollectionNode
validate(collection: String): String
}
@@ -500,6 +486,7 @@ type causeway_applib_node_CollectionNode__mixedIn__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
+ set(mixedIn: Boolean!): causeway_applib_node_CollectionNode
validate(mixedIn: Boolean): String
}
@@ -507,6 +494,7 @@ type causeway_applib_node_CollectionNode__parentNode__gqlv_property {
disabled: String
get: causeway_applib_TypeNode!
hidden: Boolean
+ set(parentNode: causeway_applib_TypeNode__gqlv_input!): causeway_applib_node_CollectionNode
validate(parentNode: causeway_applib_TypeNode__gqlv_input): String
}
@@ -526,6 +514,7 @@ type causeway_applib_node_FacetAttrNode__facetAttr__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(facetAttr: String!): causeway_applib_node_FacetAttrNode
validate(facetAttr: String): String
}
@@ -538,6 +527,7 @@ type causeway_applib_node_FacetAttrNode__parentNode__gqlv_property {
disabled: String
get: causeway_applib_node_FacetNode!
hidden: Boolean
+ set(parentNode: causeway_applib_node_FacetNode__gqlv_input!): causeway_applib_node_FacetAttrNode
validate(parentNode: causeway_applib_node_FacetNode__gqlv_input): String
}
@@ -558,6 +548,7 @@ type causeway_applib_node_FacetNode__facet__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(facet: String!): causeway_applib_node_FacetNode
validate(facet: String): String
}
@@ -569,6 +560,7 @@ type causeway_applib_node_FacetNode__gqlv_meta {
type causeway_applib_node_FacetNode__parentNode__gqlv_property {
disabled: String
hidden: Boolean
+ set(parentNode: org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input!): causeway_applib_node_FacetNode
validate(parentNode: org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input): String
}
@@ -576,6 +568,7 @@ type causeway_applib_node_FacetNode__shadowed__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
+ set(shadowed: Boolean!): causeway_applib_node_FacetNode
validate(shadowed: Boolean): String
}
@@ -605,6 +598,7 @@ type causeway_conf_ConfigurationProperty__key__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(key: String!): causeway_conf_ConfigurationProperty
validate(key: String): String
}
@@ -612,6 +606,7 @@ type causeway_conf_ConfigurationProperty__value__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(value: String!): causeway_conf_ConfigurationProperty
validate(value: String): String
}
@@ -662,6 +657,7 @@ type causeway_feat_ApplicationFeatureViewModel__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(memberName: String!): causeway_feat_ApplicationFeatureViewModel
validate(memberName: String): String
}
@@ -669,12 +665,14 @@ type causeway_feat_ApplicationFeatureViewModel__namespaceName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(namespaceName: String!): causeway_feat_ApplicationFeatureViewModel
validate(namespaceName: String): String
}
type causeway_feat_ApplicationFeatureViewModel__parent__gqlv_property {
disabled: String
hidden: Boolean
+ set(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input!): causeway_feat_ApplicationFeatureViewModel
validate(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input): String
}
@@ -682,6 +680,7 @@ type causeway_feat_ApplicationFeatureViewModel__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(typeSimpleName: String!): causeway_feat_ApplicationFeatureViewModel
validate(typeSimpleName: String): String
}
@@ -708,6 +707,7 @@ type causeway_feat_ApplicationNamespace__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(memberName: String!): causeway_feat_ApplicationNamespace
validate(memberName: String): String
}
@@ -715,12 +715,14 @@ type causeway_feat_ApplicationNamespace__namespaceName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(namespaceName: String!): causeway_feat_ApplicationNamespace
validate(namespaceName: String): String
}
type causeway_feat_ApplicationNamespace__parent__gqlv_property {
disabled: String
hidden: Boolean
+ set(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input!): causeway_feat_ApplicationNamespace
validate(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input): String
}
@@ -728,6 +730,7 @@ type causeway_feat_ApplicationNamespace__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(typeSimpleName: String!): causeway_feat_ApplicationNamespace
validate(typeSimpleName: String): String
}
@@ -757,6 +760,7 @@ type causeway_feat_ApplicationTypeAction__actionSemantics__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(actionSemantics: String!): causeway_feat_ApplicationTypeAction
validate(actionSemantics: String): String
}
@@ -769,6 +773,7 @@ type causeway_feat_ApplicationTypeAction__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(memberName: String!): causeway_feat_ApplicationTypeAction
validate(memberName: String): String
}
@@ -776,12 +781,14 @@ type causeway_feat_ApplicationTypeAction__namespaceName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(namespaceName: String!): causeway_feat_ApplicationTypeAction
validate(namespaceName: String): String
}
type causeway_feat_ApplicationTypeAction__parent__gqlv_property {
disabled: String
hidden: Boolean
+ set(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input!): causeway_feat_ApplicationTypeAction
validate(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input): String
}
@@ -789,6 +796,7 @@ type causeway_feat_ApplicationTypeAction__returnType__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(returnType: String!): causeway_feat_ApplicationTypeAction
validate(returnType: String): String
}
@@ -796,6 +804,7 @@ type causeway_feat_ApplicationTypeAction__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(typeSimpleName: String!): causeway_feat_ApplicationTypeAction
validate(typeSimpleName: String): String
}
@@ -813,6 +822,7 @@ type causeway_feat_ApplicationTypeCollection__derived__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
+ set(derived: Boolean!): causeway_feat_ApplicationTypeCollection
validate(derived: Boolean): String
}
@@ -820,6 +830,7 @@ type causeway_feat_ApplicationTypeCollection__elementType__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(elementType: String!): causeway_feat_ApplicationTypeCollection
validate(elementType: String): String
}
@@ -832,6 +843,7 @@ type causeway_feat_ApplicationTypeCollection__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(memberName: String!): causeway_feat_ApplicationTypeCollection
validate(memberName: String): String
}
@@ -839,12 +851,14 @@ type causeway_feat_ApplicationTypeCollection__namespaceName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(namespaceName: String!): causeway_feat_ApplicationTypeCollection
validate(namespaceName: String): String
}
type causeway_feat_ApplicationTypeCollection__parent__gqlv_property {
disabled: String
hidden: Boolean
+ set(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input!): causeway_feat_ApplicationTypeCollection
validate(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input): String
}
@@ -852,6 +866,7 @@ type causeway_feat_ApplicationTypeCollection__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(typeSimpleName: String!): causeway_feat_ApplicationTypeCollection
validate(typeSimpleName: String): String
}
@@ -872,6 +887,7 @@ type causeway_feat_ApplicationTypeMember__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(memberName: String!): causeway_feat_ApplicationTypeMember
validate(memberName: String): String
}
@@ -879,12 +895,14 @@ type causeway_feat_ApplicationTypeMember__namespaceName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(namespaceName: String!): causeway_feat_ApplicationTypeMember
validate(namespaceName: String): String
}
type causeway_feat_ApplicationTypeMember__parent__gqlv_property {
disabled: String
hidden: Boolean
+ set(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input!): causeway_feat_ApplicationTypeMember
validate(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input): String
}
@@ -892,6 +910,7 @@ type causeway_feat_ApplicationTypeMember__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(typeSimpleName: String!): causeway_feat_ApplicationTypeMember
validate(typeSimpleName: String): String
}
@@ -911,6 +930,7 @@ type causeway_feat_ApplicationTypeProperty__derived__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
+ set(derived: Boolean!): causeway_feat_ApplicationTypeProperty
validate(derived: Boolean): String
}
@@ -923,6 +943,7 @@ type causeway_feat_ApplicationTypeProperty__maxLength__gqlv_property {
disabled: String
get: Int
hidden: Boolean
+ set(maxLength: Int): causeway_feat_ApplicationTypeProperty
validate(maxLength: Int): String
}
@@ -930,6 +951,7 @@ type causeway_feat_ApplicationTypeProperty__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(memberName: String!): causeway_feat_ApplicationTypeProperty
validate(memberName: String): String
}
@@ -937,12 +959,14 @@ type causeway_feat_ApplicationTypeProperty__namespaceName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(namespaceName: String!): causeway_feat_ApplicationTypeProperty
validate(namespaceName: String): String
}
type causeway_feat_ApplicationTypeProperty__parent__gqlv_property {
disabled: String
hidden: Boolean
+ set(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input!): causeway_feat_ApplicationTypeProperty
validate(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input): String
}
@@ -950,6 +974,7 @@ type causeway_feat_ApplicationTypeProperty__returnType__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(returnType: String!): causeway_feat_ApplicationTypeProperty
validate(returnType: String): String
}
@@ -957,6 +982,7 @@ type causeway_feat_ApplicationTypeProperty__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(typeSimpleName: String!): causeway_feat_ApplicationTypeProperty
validate(typeSimpleName: String): String
}
@@ -964,6 +990,7 @@ type causeway_feat_ApplicationTypeProperty__typicalLength__gqlv_property {
disabled: String
get: Int
hidden: Boolean
+ set(typicalLength: Int): causeway_feat_ApplicationTypeProperty
validate(typicalLength: Int): String
}
@@ -988,6 +1015,7 @@ type causeway_feat_ApplicationType__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(memberName: String!): causeway_feat_ApplicationType
validate(memberName: String): String
}
@@ -995,12 +1023,14 @@ type causeway_feat_ApplicationType__namespaceName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(namespaceName: String!): causeway_feat_ApplicationType
validate(namespaceName: String): String
}
type causeway_feat_ApplicationType__parent__gqlv_property {
disabled: String
hidden: Boolean
+ set(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input!): causeway_feat_ApplicationType
validate(parent: causeway_feat_ApplicationFeatureViewModel__gqlv_input): String
}
@@ -1014,6 +1044,7 @@ type causeway_feat_ApplicationType__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(typeSimpleName: String!): causeway_feat_ApplicationType
validate(typeSimpleName: String): String
}
@@ -1034,6 +1065,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__actions__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(actions: String!): causeway_schema_metamodel_v2_DomainClassDto
validate(actions: String): String
}
@@ -1041,6 +1073,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__annotations__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(annotations: String!): causeway_schema_metamodel_v2_DomainClassDto
validate(annotations: String): String
}
@@ -1048,6 +1081,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__collections__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(collections: String!): causeway_schema_metamodel_v2_DomainClassDto
validate(collections: String): String
}
@@ -1055,6 +1089,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__facets__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(facets: String!): causeway_schema_metamodel_v2_DomainClassDto
validate(facets: String): String
}
@@ -1067,6 +1102,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__id__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(id: String!): causeway_schema_metamodel_v2_DomainClassDto
validate(id: String): String
}
@@ -1074,6 +1110,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__majorVersion__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(majorVersion: String): causeway_schema_metamodel_v2_DomainClassDto
validate(majorVersion: String): String
}
@@ -1081,6 +1118,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__minorVersion__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(minorVersion: String): causeway_schema_metamodel_v2_DomainClassDto
validate(minorVersion: String): String
}
@@ -1088,6 +1126,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__properties__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(properties: String!): causeway_schema_metamodel_v2_DomainClassDto
validate(properties: String): String
}
@@ -1095,6 +1134,7 @@ type causeway_schema_metamodel_v2_DomainClassDto__service__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
+ set(service: Boolean!): causeway_schema_metamodel_v2_DomainClassDto
validate(service: Boolean): String
}
@@ -1130,6 +1170,7 @@ type causeway_testing_fixtures_FixtureResult__className__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(className: String!): causeway_testing_fixtures_FixtureResult
validate(className: String): String
}
@@ -1137,6 +1178,7 @@ type causeway_testing_fixtures_FixtureResult__fixtureScriptClassName__gqlv_prope
disabled: String
get: String
hidden: Boolean
+ set(fixtureScriptClassName: String): causeway_testing_fixtures_FixtureResult
validate(fixtureScriptClassName: String): String
}
@@ -1149,12 +1191,14 @@ type causeway_testing_fixtures_FixtureResult__key__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(key: String!): causeway_testing_fixtures_FixtureResult
validate(key: String): String
}
type causeway_testing_fixtures_FixtureResult__object__gqlv_property {
disabled: String
hidden: Boolean
+ set(object: String!): causeway_testing_fixtures_FixtureResult
validate(object: String): String
}
@@ -1249,6 +1293,7 @@ type org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_meta {
type org_apache_causeway_core_metamodel_inspect_model_MMNode__parentNode__gqlv_property {
disabled: String
hidden: Boolean
+ set(parentNode: org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input!): org_apache_causeway_core_metamodel_inspect_model_MMNode
validate(parentNode: org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input): String
}
@@ -1273,6 +1318,7 @@ type org_apache_causeway_core_metamodel_inspect_model_MemberNode__mixedIn__gqlv_
disabled: String
get: Boolean!
hidden: Boolean
+ set(mixedIn: Boolean!): org_apache_causeway_core_metamodel_inspect_model_MemberNode
validate(mixedIn: Boolean): String
}
@@ -1280,6 +1326,7 @@ type org_apache_causeway_core_metamodel_inspect_model_MemberNode__parentNode__gq
disabled: String
get: causeway_applib_TypeNode!
hidden: Boolean
+ set(parentNode: causeway_applib_TypeNode__gqlv_input!): org_apache_causeway_core_metamodel_inspect_model_MemberNode
validate(parentNode: causeway_applib_TypeNode__gqlv_input): String
}
@@ -1293,6 +1340,7 @@ type org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript__f
disabled: String
get: String!
hidden: Boolean
+ set(friendlyName: String!): org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript
validate(friendlyName: String): String
}
@@ -1305,6 +1353,7 @@ type org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript__q
disabled: String
get: String!
hidden: Boolean
+ set(qualifiedName: String!): org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript
validate(qualifiedName: String): String
}
@@ -1324,6 +1373,7 @@ type university_admin_AdminMenu__actionWithDisabledParam__firstParam__gqlv_actio
type university_admin_AdminMenu__actionWithDisabledParam__gqlv_action {
disabled: String
hidden: Boolean
+ invokeNonIdempotent(firstParam: String!, secondParam: String!, thirdParameter: String!): String
params: university_admin_AdminMenu__actionWithDisabledParam__gqlv_action_params
validate(firstParam: String, secondParam: String, thirdParameter: String): String
}
@@ -1355,6 +1405,7 @@ type university_admin_AdminMenu__actionWithHiddenParam__firstParam__gqlv_action_
type university_admin_AdminMenu__actionWithHiddenParam__gqlv_action {
disabled: String
hidden: Boolean
+ invokeNonIdempotent(firstParam: String!, secondParam: String!): String
params: university_admin_AdminMenu__actionWithHiddenParam__gqlv_action_params
validate(firstParam: String, secondParam: String): String
}
@@ -1373,12 +1424,14 @@ type university_admin_AdminMenu__actionWithHiddenParam__secondParam__gqlv_action
type university_admin_AdminMenu__adminAction__gqlv_action {
disabled: String
hidden: Boolean
+ invokeNonIdempotent: String
validate: String
}
type university_admin_AdminMenu__otherAdminAction__gqlv_action {
disabled: String
hidden: Boolean
+ invokeNonIdempotent: String
validate: String
}
@@ -1881,6 +1934,7 @@ type university_dept_Department {
type university_dept_Department__addStaffMember__gqlv_action {
disabled: String
hidden: Boolean
+ invokeIdempotent(staffMember: university_dept_StaffMember__gqlv_input!): university_dept_Department
params: university_dept_Department__addStaffMember__gqlv_action_params
validate(staffMember: university_dept_StaffMember__gqlv_input): String
}
@@ -1899,6 +1953,7 @@ type university_dept_Department__addStaffMember__staffMember__gqlv_action_parame
type university_dept_Department__addStaffMembers__gqlv_action {
disabled: String
hidden: Boolean
+ invokeIdempotent(staffMembers: [university_dept_StaffMember__gqlv_input]): university_dept_Department
params: university_dept_Department__addStaffMembers__gqlv_action_params
validate(staffMembers: [university_dept_StaffMember__gqlv_input]): String
}
@@ -1917,6 +1972,7 @@ type university_dept_Department__addStaffMembers__staffMembers__gqlv_action_para
type university_dept_Department__changeDeptHead__gqlv_action {
disabled: String
hidden: Boolean
+ invokeIdempotent(newDeptHead: university_dept_DeptHead__gqlv_input!): university_dept_Department
params: university_dept_Department__changeDeptHead__gqlv_action_params
validate(newDeptHead: university_dept_DeptHead__gqlv_input): String
}
@@ -1936,6 +1992,7 @@ type university_dept_Department__changeDeptHead__newDeptHead__gqlv_action_parame
type university_dept_Department__changeName__gqlv_action {
disabled: String
hidden: Boolean
+ invokeIdempotent(newName: String!): university_dept_Department
params: university_dept_Department__changeName__gqlv_action_params
validate(newName: String): String
}
@@ -1956,6 +2013,7 @@ type university_dept_Department__deptHead__gqlv_property {
disabled: String
get: university_dept_DeptHead
hidden: Boolean
+ set(deptHead: university_dept_DeptHead__gqlv_input): university_dept_Department
validate(deptHead: university_dept_DeptHead__gqlv_input): String
}
@@ -1969,12 +2027,14 @@ type university_dept_Department__name__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(name: String!): university_dept_Department
validate(name: String): String
}
type university_dept_Department__removeStaffMember__gqlv_action {
disabled: String
hidden: Boolean
+ invokeIdempotent(staffMember: university_dept_StaffMember__gqlv_input!): university_dept_Department
params: university_dept_Department__removeStaffMember__gqlv_action_params
validate(staffMember: university_dept_StaffMember__gqlv_input): String
}
@@ -2012,6 +2072,7 @@ type university_dept_Departments__createDepartment__deptHead__gqlv_action_parame
type university_dept_Departments__createDepartment__gqlv_action {
disabled: String
hidden: Boolean
+ invokeNonIdempotent(deptHead: university_dept_DeptHead__gqlv_input, name: String!): university_dept_Department
params: university_dept_Departments__createDepartment__gqlv_action_params
validate(deptHead: university_dept_DeptHead__gqlv_input, name: String): String
}
@@ -2070,6 +2131,7 @@ type university_dept_DeptHead__changeDepartment__department__gqlv_action_paramet
type university_dept_DeptHead__changeDepartment__gqlv_action {
disabled: String
hidden: Boolean
+ invokeIdempotent(department: university_dept_Department__gqlv_input!): university_dept_DeptHead
params: university_dept_DeptHead__changeDepartment__gqlv_action_params
validate(department: university_dept_Department__gqlv_input): String
}
@@ -2081,6 +2143,7 @@ type university_dept_DeptHead__changeDepartment__gqlv_action_params {
type university_dept_DeptHead__changeName__gqlv_action {
disabled: String
hidden: Boolean
+ invokeIdempotent(newName: String!): university_dept_DeptHead
params: university_dept_DeptHead__changeName__gqlv_action_params
validate(newName: String): String
}
@@ -2101,6 +2164,7 @@ type university_dept_DeptHead__department__gqlv_property {
disabled: String
get: university_dept_Department
hidden: Boolean
+ set(department: university_dept_Department__gqlv_input): university_dept_DeptHead
validate(department: university_dept_Department__gqlv_input): String
}
@@ -2114,6 +2178,7 @@ type university_dept_DeptHead__name__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(name: String): university_dept_DeptHead
validate(name: String): String
}
@@ -2166,6 +2231,7 @@ type university_dept_StaffMember__department__gqlv_property {
disabled: String
get: university_dept_Department
hidden: Boolean
+ set(department: university_dept_Department__gqlv_input): university_dept_StaffMember
validate(department: university_dept_Department__gqlv_input): String
}
@@ -2180,6 +2246,7 @@ type university_dept_StaffMember__grade__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(grade: String!): university_dept_StaffMember
validate(grade: String): String
}
@@ -2187,6 +2254,7 @@ type university_dept_StaffMember__name__gqlv_property {
disabled: String
get: String!
hidden: Boolean
+ set(name: String!): university_dept_StaffMember
validate(name: String): String
}
@@ -2194,6 +2262,7 @@ type university_dept_StaffMember__photo__gqlv_property {
disabled: String
get: String
hidden: Boolean
+ set(photo: String): university_dept_StaffMember
validate(photo: String): String
}
@@ -2207,6 +2276,7 @@ type university_dept_Staff__createStaffMember__department__gqlv_action_parameter
type university_dept_Staff__createStaffMember__gqlv_action {
disabled: String
hidden: Boolean
+ invokeNonIdempotent(department: university_dept_Department__gqlv_input!, name: String!): university_dept_StaffMember
params: university_dept_Staff__createStaffMember__gqlv_action_params
validate(department: university_dept_Department__gqlv_input, name: String): String
}
diff --git a/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/integration/GraphQlSourceForCauseway.java b/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/integration/GraphQlSourceForCauseway.java
index 45cfaf186b..4860a59f26 100644
--- a/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/integration/GraphQlSourceForCauseway.java
+++ b/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/integration/GraphQlSourceForCauseway.java
@@ -109,22 +109,11 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
val codeRegistryBuilder = GraphQLCodeRegistry.newCodeRegistry();
val context = new Context(codeRegistryBuilder, bookmarkService, specificationLoader, typeMapper, serviceRegistry, causewayConfiguration, causewaySystemEnvironment);
- val objectSpecifications = specificationLoader.snapshotSpecifications()
- .filter(x -> x.getCorrespondingClass().getPackage() != Either.class.getPackage()) // exclude the org.apache_causeway.commons.functional
- .distinct((a, b) -> a.getLogicalTypeName().equals(b.getLogicalTypeName()))
- .filter(x -> x.isEntityOrViewModelOrAbstract() || x.getBeanSort().isManagedBeanContributing())
- .sorted(Comparator.comparing(HasLogicalType::getLogicalTypeName))
- .toList();
-
// top-level query type and (dependent on configuration) the top-level mutation type
val topLevelQuery = new GqlvTopLevelQuery(context);
- val topLevelMutation =
- causewayConfiguration.getViewer().getGraphql().getApiVariant() == CausewayConfiguration.Viewer.Graphql.ApiVariant.QUERY_AND_MUTATIONS ?
- new GqlvTopLevelMutation(context)
- : null;
-
// domain objects
+ val objectSpecifications = context.objectSpecifications();
val domainObjects = new LinkedHashMap<ObjectSpecification, GqlvDomainObject>();
objectSpecifications.forEach(objectSpec -> {
switch (objectSpec.getBeanSort()) {
@@ -143,44 +132,14 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
}
});
-
- // add services to top-level query
- objectSpecifications.forEach(objectSpec -> {
- switch (objectSpec.getBeanSort()) {
- case MANAGED_BEAN_CONTRIBUTING: // @DomainService
- serviceRegistry.lookupBeanById(objectSpec.getLogicalTypeName())
- .ifPresent(servicePojo -> {
- topLevelQuery.addDomainService(objectSpec, servicePojo, context);
- topLevelQuery.addDataFetchers();
- });
- break;
- }
- });
-
// add lookup to top-level query
- domainObjects.forEach((objectSpec, domainObject) -> {
- topLevelQuery.addLookupFor(objectSpec, domainObject);
- });
-
+ domainObjects.forEach(topLevelQuery::addLookupFor);
topLevelQuery.buildQueryType();
- // add top-level mutation (if application configuration requires it)
- if (topLevelMutation != null) {
- objectSpecifications.forEach(objectSpec -> {
- objectSpec.streamActions(context.getActionScope(), MixedIn.INCLUDED)
- .filter(x -> ! x.getSemantics().isSafeInNature())
- .forEach(objectAction -> topLevelMutation.addAction(objectSpec, objectAction));
- objectSpec.streamProperties(MixedIn.INCLUDED)
- .filter(property -> ! property.isAlwaysHidden())
- .filter(property -> property.containsFacet(PropertySetterFacet.class))
- .forEach(property -> topLevelMutation.addProperty(objectSpec, property));
-
- });
- topLevelMutation.buildMutationType();
- topLevelMutation.addDataFetchers();
- }
-
-
+ val topLevelMutation =
+ causewayConfiguration.getViewer().getGraphql().getApiVariant() == CausewayConfiguration.Viewer.Graphql.ApiVariant.QUERY_AND_MUTATIONS ?
+ new GqlvTopLevelMutation(context)
+ : null;
// finalize the fetcher/mutator code that's been registered
diff --git a/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/toplevel/GqlvTopLevelMutation.java b/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/toplevel/GqlvTopLevelMutation.java
index 822f2948ca..9f11f63532 100644
--- a/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/toplevel/GqlvTopLevelMutation.java
+++ b/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/toplevel/GqlvTopLevelMutation.java
@@ -1,6 +1,7 @@
package org.apache.causeway.viewer.graphql.viewer.toplevel;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.List;
import graphql.schema.FieldCoordinates;
@@ -9,7 +10,11 @@ import graphql.schema.GraphQLObjectType;
import static graphql.schema.GraphQLObjectType.newObject;
+import org.apache.causeway.applib.id.HasLogicalType;
+import org.apache.causeway.commons.functional.Either;
+import org.apache.causeway.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
+import org.apache.causeway.core.metamodel.spec.feature.MixedIn;
import org.apache.causeway.core.metamodel.spec.feature.ObjectAction;
import org.apache.causeway.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.causeway.viewer.graphql.model.context.Context;
@@ -17,6 +22,7 @@ import org.apache.causeway.viewer.graphql.model.domain.GqlvMutationForAction;
import org.apache.causeway.viewer.graphql.model.domain.GqlvMutationForProperty;
import lombok.Getter;
+import lombok.val;
public class GqlvTopLevelMutation
implements GqlvMutationForAction.Holder, GqlvMutationForProperty.Holder {
@@ -38,6 +44,23 @@ public class GqlvTopLevelMutation
this.context = context;
gqlObjectTypeBuilder = newObject().name("Mutation");
+ val objectSpecifications = context.objectSpecifications();
+
+ objectSpecifications.forEach(objectSpec -> {
+ objectSpec.streamActions(context.getActionScope(), MixedIn.INCLUDED)
+ .filter(x -> ! x.getSemantics().isSafeInNature())
+ .forEach(objectAction -> addAction(objectSpec, objectAction));
+ objectSpec.streamProperties(MixedIn.INCLUDED)
+ .filter(property -> ! property.isAlwaysHidden())
+ .filter(property -> property.containsFacet(PropertySetterFacet.class))
+ .forEach(property -> addProperty(objectSpec, property));
+
+ });
+
+ buildMutationType();
+
+ addDataFetchers();
+
}
diff --git a/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/toplevel/GqlvTopLevelQuery.java b/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/toplevel/GqlvTopLevelQuery.java
index 3404f8f05a..cb2c7d5643 100644
--- a/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/toplevel/GqlvTopLevelQuery.java
+++ b/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/toplevel/GqlvTopLevelQuery.java
@@ -1,6 +1,8 @@
package org.apache.causeway.viewer.graphql.viewer.toplevel;
import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.LinkedHashMap;
import java.util.List;
import graphql.schema.DataFetcher;
@@ -13,6 +15,8 @@ import graphql.schema.GraphQLObjectType;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLObjectType.newObject;
+import org.apache.causeway.applib.id.HasLogicalType;
+import org.apache.causeway.commons.functional.Either;
import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
import org.apache.causeway.viewer.graphql.model.context.Context;
import org.apache.causeway.viewer.graphql.model.domain.GqlvAction;
@@ -40,6 +44,24 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
public GqlvTopLevelQuery(Context context) {
this.context = context;
queryBuilder = newObject().name("Query");
+
+ val objectSpecifications = context.objectSpecifications();
+
+
+ // add services to top-level query
+ objectSpecifications.forEach(objectSpec -> {
+ switch (objectSpec.getBeanSort()) {
+ case MANAGED_BEAN_CONTRIBUTING: // @DomainService
+ context.serviceRegistry.lookupBeanById(objectSpec.getLogicalTypeName())
+ .ifPresent(servicePojo -> {
+ addDomainService(objectSpec, servicePojo, context);
+ addDataFetchers();
+ });
+ break;
+ }
+ });
+
+
}