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:57 UTC
(causeway) branch CAUSEWAY-3676 updated (47474a365a -> fe9f4b6b2c)
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a change to branch CAUSEWAY-3676
in repository https://gitbox.apache.org/repos/asf/causeway.git
from 47474a365a CAUSEWAY-3676: updates docs further
add e3dfa01a12 Merge pull request #2204 from apache/CAUSEWAY-3676
new 0fb031950f CAUSEWAY-3676: adds causeway-viewer-graphql-testsupport
new aaabbd110d CAUSEWAY-3676: refactors top level query/mutation a little
new 7db94e3cfd CAUSEWAY-3676: refactors top level query/mutation a little more
new 1c173b110a CAUSEWAY-3676: further refactors
new 584912817e CAUSEWAY-3676: further refactors
new 1281d96aaa CAUSEWAY-3676: further refactorings
new 90c7d99815 CAUSEWAY-3676: further refactorings
new fe9f4b6b2c CAUSEWAY-3676: further minor polishing
The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
bom/pom.xml | 10 +++
viewers/graphql/applib/pom.xml | 4 +-
viewers/graphql/model/pom.xml | 4 +-
.../viewer/graphql/model/context/Context.java | 19 ++++
.../graphql/model/domain/GqlvDomainObject.java | 72 +++++++++++----
.../viewer/graphql/model/domain/GqlvMeta.java | 47 +++++-----
viewers/graphql/pom.xml | 1 +
viewers/graphql/test/pom.xml | 4 +-
.../graphql/testsupport}/pom.xml | 50 ++++++-----
viewers/graphql/viewer/pom.xml | 4 +-
.../integration/GraphQlSourceForCauseway.java | 91 ++-----------------
.../viewer/toplevel/GqlvTopLevelMutation.java | 42 ++++-----
.../graphql/viewer/toplevel/GqlvTopLevelQuery.java | 100 ++++++++-------------
13 files changed, 207 insertions(+), 241 deletions(-)
copy {regressiontests/stable-domainmodel => viewers/graphql/testsupport}/pom.xml (53%)
(causeway) 06/08: CAUSEWAY-3676: further refactorings
Posted by da...@apache.org.
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 1281d96aaaa56d07c319b6cbd83ebea4b1541e12
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Feb 11 16:05:27 2024 +0000
CAUSEWAY-3676: further refactorings
---
.../graphql/model/domain/GqlvDomainObject.java | 59 ++++++++++++++--------
.../integration/GraphQlSourceForCauseway.java | 45 ++++-------------
.../viewer/toplevel/GqlvTopLevelMutation.java | 38 ++------------
.../graphql/viewer/toplevel/GqlvTopLevelQuery.java | 57 +++++++++------------
4 files changed, 77 insertions(+), 122 deletions(-)
diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
index 997f780cd8..7595c0fefb 100644
--- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
+++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
@@ -23,6 +23,7 @@ import java.util.SortedMap;
import java.util.TreeMap;
import graphql.Scalars;
+import graphql.schema.DataFetcher;
import graphql.schema.FieldCoordinates;
import graphql.schema.GraphQLArgument;
import graphql.schema.GraphQLFieldDefinition;
@@ -44,19 +45,22 @@ import org.apache.causeway.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.causeway.viewer.graphql.model.context.Context;
import org.apache.causeway.viewer.graphql.model.registry.GraphQLTypeRegistry;
-import static org.apache.causeway.core.config.CausewayConfiguration.Viewer.Graphql.ApiVariant.QUERY_WITH_MUTATIONS_NON_SPEC_COMPLIANT;
-
import lombok.Getter;
import lombok.val;
/**
* Exposes a domain object (view model or entity) via the GQL viewer.
*/
-public class GqlvDomainObject implements GqlvAction.Holder, GqlvProperty.Holder, GqlvCollection.Holder, GqlvMeta.Holder {
+public class GqlvDomainObject
+ implements GqlvAction.Holder, GqlvProperty.Holder, GqlvCollection.Holder, GqlvMeta.Holder {
+ private final Holder holder;
@Getter private final ObjectSpecification objectSpecification;
private final Context context;
+ @Getter
+ private final GraphQLFieldDefinition lookupField;
+
private final GqlvMeta meta;
private final GraphQLObjectType.Builder gqlObjectTypeBuilder;
@@ -70,10 +74,12 @@ public class GqlvDomainObject implements GqlvAction.Holder, GqlvProperty.Holder,
@Getter private final GraphQLInputObjectType gqlInputObjectType;
public GqlvDomainObject(
+ final GqlvDomainObject.Holder holder,
final ObjectSpecification objectSpecification,
final Context context,
final ObjectManager objectManager,
final GraphQLTypeRegistry graphQLTypeRegistry) {
+ this.holder = holder;
this.objectSpecification = objectSpecification;
this.context = context;
@@ -90,32 +96,35 @@ public class GqlvDomainObject implements GqlvAction.Holder, GqlvProperty.Holder,
.build());
gqlInputObjectType = inputTypeBuilder.build();
+ this.lookupField = buildFieldDefinition(gqlInputObjectType);
+
addMembers();
+
+ gqlObjectType = gqlObjectTypeBuilder.build();
+ graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlObjectType);
+ meta.registerTypesInto(graphQLTypeRegistry);
+ graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlInputObjectType);
+
}
- public GraphQLFieldDefinition getField() {
+ private GraphQLFieldDefinition buildFieldDefinition(GraphQLInputObjectType gqlInputObjectType) {
val lookupConfig = this.context.causewayConfiguration.getViewer().getGraphql().getLookup();
- ObjectSpecification objectSpec = getObjectSpecification();
+ val objectSpec = getObjectSpecification();
+ val fieldName = String.format("%s%s%s",
+ lookupConfig.getFieldNamePrefix(), // eg "_gqlv_lookup__"
+ TypeNames.objectTypeNameFor(objectSpec),
+ lookupConfig.getFieldNameSuffix());
+
return newFieldDefinition()
- .name(String.format("%s%s%s",
- lookupConfig.getFieldNamePrefix(), // eg "_gqlv_lookup__"
- TypeNames.objectTypeNameFor(objectSpec),
- lookupConfig.getFieldNameSuffix()) // eg ""
- )
+ .name(fieldName)
.type(this.context.typeMapper.outputTypeFor(objectSpec))
.argument(GraphQLArgument.newArgument()
.name(lookupConfig.getArgument()) // eg "object"
- .type(getGqlInputObjectType())
+ .type(gqlInputObjectType)
.build())
.build();
}
- public void addTypesInto(GraphQLTypeRegistry graphQLTypeRegistry) {
- gqlObjectType = gqlObjectTypeBuilder.build();
- graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlObjectType);
- meta.registerTypesInto(graphQLTypeRegistry);
- graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlInputObjectType);
- }
private void addMembers() {
@@ -156,6 +165,15 @@ public class GqlvDomainObject implements GqlvAction.Holder, GqlvProperty.Holder,
public void addDataFetchers() {
+
+ this.context.codeRegistryBuilder.dataFetcher(
+ holder.coordinatesFor(getLookupField()),
+ (DataFetcher<Object>) environment -> {
+ Object target = environment.getArgument("object");
+ return GqlvAction.asPojo(getObjectSpecification(), target, this.context.bookmarkService)
+ .orElse(null);
+ });
+
meta.addDataFetchers();
properties.forEach((id, property) -> property.addDataFetcher());
collections.forEach((id, collection) -> collection.addDataFetcher());
@@ -165,10 +183,6 @@ public class GqlvDomainObject implements GqlvAction.Holder, GqlvProperty.Holder,
@Override
public FieldCoordinates coordinatesFor(final GraphQLFieldDefinition fieldDefinition) {
- if (gqlObjectType == null) {
- throw new IllegalStateException(String.format(
- "GraphQLObjectType has not yet been built for %s", objectSpecification.getLogicalTypeName()));
- }
return FieldCoordinates.coordinates(gqlObjectType, fieldDefinition);
}
@@ -178,4 +192,7 @@ public class GqlvDomainObject implements GqlvAction.Holder, GqlvProperty.Holder,
return objectSpecification.getLogicalTypeName();
}
+ public interface Holder extends GqlvHolder {
+ }
+
}
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 86a1b923e8..0c0c4c0420 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
@@ -19,12 +19,10 @@
package org.apache.causeway.viewer.graphql.viewer.integration;
import java.util.ArrayList;
-import java.util.LinkedHashMap;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
-import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
import org.apache.causeway.viewer.graphql.viewer.toplevel.GqlvTopLevelMutation;
import org.springframework.graphql.execution.GraphQlSource;
@@ -105,49 +103,28 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
val codeRegistryBuilder = GraphQLCodeRegistry.newCodeRegistry();
val context = new Context(codeRegistryBuilder, bookmarkService, specificationLoader, typeMapper, serviceRegistry, causewayConfiguration, causewaySystemEnvironment);
- // domain objects
- val domainObjects = new LinkedHashMap<ObjectSpecification, GqlvDomainObject>();
- val domainObjectList = new ArrayList<GqlvDomainObject>();
- context.objectSpecifications().forEach(objectSpec -> {
- switch (objectSpec.getBeanSort()) {
-
- case ABSTRACT:
- case VIEW_MODEL: // @DomainObject(nature=VIEW_MODEL)
- case ENTITY: // @DomainObject(nature=ENTITY)
-
- val domainObject = new GqlvDomainObject(objectSpec, context, objectManager, graphQLTypeRegistry);
- domainObject.addTypesInto(graphQLTypeRegistry);
- domainObject.addDataFetchers();
-
- domainObjectList.add(domainObject);
- domainObjects.put(objectSpec, domainObject);
-
- break;
- }
- });
-
- // top-level query type and (dependent on configuration) the top-level mutation type
- val topLevelQuery = new GqlvTopLevelQuery(context, domainObjectList);
-
-
+ // top-level query and mutation type
+ val topLevelQuery = new GqlvTopLevelQuery(context, objectManager, graphQLTypeRegistry);
val topLevelMutation =
causewayConfiguration.getViewer().getGraphql().getApiVariant() == CausewayConfiguration.Viewer.Graphql.ApiVariant.QUERY_AND_MUTATIONS ?
new GqlvTopLevelMutation(context)
: null;
+ // add the data fetchers
+ topLevelQuery.addDataFetchers();
+ if (topLevelMutation != null) {
+ topLevelMutation.addDataFetchers();
+ }
- // finalize the fetcher/mutator code that's been registered
+ // finalize the fetcher/mutator code that's been added
val codeRegistry = codeRegistryBuilder.build();
// build the schema
- val schemaBuilder = GraphQLSchema.newSchema()
+ return GraphQLSchema.newSchema()
.query(topLevelQuery.getObjectType())
.additionalTypes(graphQLTypeRegistry.getGraphQLTypes())
- .codeRegistry(codeRegistry);
- if (topLevelMutation != null) {
- schemaBuilder.mutation(topLevelMutation.getGqlObjectType());
- }
- return schemaBuilder
+ .codeRegistry(codeRegistry)
+ .mutation(topLevelMutation != null ? topLevelMutation.getObjectType() : null)
.build();
}
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 8b19244dc1..4bce77cc6c 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,7 +1,6 @@
package org.apache.causeway.viewer.graphql.viewer.toplevel;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.List;
import graphql.schema.FieldCoordinates;
@@ -10,8 +9,6 @@ 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;
@@ -29,13 +26,10 @@ public class GqlvTopLevelMutation
private final Context context;
- @Getter final GraphQLObjectType.Builder gqlObjectTypeBuilder;
+ private final GraphQLObjectType.Builder gqlObjectTypeBuilder;
-
- /**
- * Built using {@link #buildMutationType()}
- */
- private GraphQLObjectType gqlObjectType;
+ @Getter
+ private final GraphQLObjectType objectType;
private final List<GqlvMutationForAction> actions = new ArrayList<>();
private final List<GqlvMutationForProperty> properties = new ArrayList<>();
@@ -57,29 +51,7 @@ public class GqlvTopLevelMutation
});
- buildMutationType();
-
- addDataFetchers();
- }
-
-
-
- public GraphQLObjectType buildMutationType() {
- if (gqlObjectType != null) {
- throw new IllegalStateException("Mutation type has already been built");
- }
- return gqlObjectType = gqlObjectTypeBuilder.build();
- }
-
- /**
- *
- * @see #buildMutationType()
- */
- public GraphQLObjectType getGqlObjectType() {
- if (gqlObjectType == null) {
- throw new IllegalStateException("Mutation type has not yet been built");
- }
- return gqlObjectType;
+ objectType = gqlObjectTypeBuilder.build();
}
@@ -99,7 +71,7 @@ public class GqlvTopLevelMutation
@Override
public FieldCoordinates coordinatesFor(GraphQLFieldDefinition fieldDefinition) {
- return FieldCoordinates.coordinates(gqlObjectType, fieldDefinition);
+ return FieldCoordinates.coordinates(objectType, fieldDefinition);
}
public void 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 f8dd4cbd35..53f87e4887 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
@@ -3,52 +3,50 @@ package org.apache.causeway.viewer.graphql.viewer.toplevel;
import java.util.ArrayList;
import java.util.List;
-import graphql.schema.DataFetcher;
import graphql.schema.FieldCoordinates;
-import graphql.schema.GraphQLArgument;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLObjectType;
-import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLObjectType.newObject;
+import org.apache.causeway.core.metamodel.objectmanager.ObjectManager;
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;
import org.apache.causeway.viewer.graphql.model.domain.GqlvDomainObject;
import org.apache.causeway.viewer.graphql.model.domain.GqlvDomainService;
-import org.apache.causeway.viewer.graphql.model.domain.TypeNames;
+import org.apache.causeway.viewer.graphql.model.registry.GraphQLTypeRegistry;
import lombok.Getter;
import lombok.val;
-public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
+public class GqlvTopLevelQuery implements GqlvDomainService.Holder, GqlvDomainObject.Holder {
+
+ private static final String OBJECT_TYPE_NAME = "Query";
final GraphQLObjectType.Builder objectTypeBuilder;
+ @Getter private final GraphQLObjectType objectType;
private final List<GqlvDomainService> domainServices = new ArrayList<>();
+ private final List<GqlvDomainObject> domainObjects = new ArrayList<>();
private final Context context;
- private final List<GqlvDomainObject> domainObjects;
-
-
- @Getter private final GraphQLObjectType objectType;
-
public GqlvTopLevelQuery(
final Context context,
- final List<GqlvDomainObject> domainObjects) {
+ final ObjectManager objectManager,
+ final GraphQLTypeRegistry graphQLTypeRegistry) {
+
this.context = context;
- this.domainObjects = domainObjects;
- this.objectTypeBuilder = newObject().name("Query");
+ this.objectTypeBuilder = newObject().name(OBJECT_TYPE_NAME);
- // add services to top-level query
context.objectSpecifications().forEach(objectSpec -> {
switch (objectSpec.getBeanSort()) {
- case MANAGED_BEAN_CONTRIBUTING: // @DomainService
- context.serviceRegistry.lookupBeanById(objectSpec.getLogicalTypeName())
- .ifPresent(servicePojo -> {
- addDomainService(objectSpec, servicePojo, context);
- });
+
+ case ABSTRACT:
+ case VIEW_MODEL: // @DomainObject(nature=VIEW_MODEL)
+ case ENTITY: // @DomainObject(nature=ENTITY)
+
+ domainObjects.add(new GqlvDomainObject(this, objectSpec, context, objectManager, graphQLTypeRegistry));
+
break;
}
});
@@ -59,7 +57,7 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
case MANAGED_BEAN_CONTRIBUTING: // @DomainService
context.serviceRegistry.lookupBeanById(objectSpec.getLogicalTypeName())
.ifPresent(servicePojo -> {
- addDataFetchers();
+ addDomainService(objectSpec, servicePojo, context);
});
break;
}
@@ -67,10 +65,9 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
// add lookup to top-level query
for (GqlvDomainObject domainObject : this.domainObjects) {
- addField(domainObject.getField());
+ addField(domainObject.getLookupField());
}
-
objectType = objectTypeBuilder.build();
}
@@ -82,7 +79,7 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
@Override
public FieldCoordinates coordinatesFor(GraphQLFieldDefinition fieldDefinition) {
- return FieldCoordinates.coordinates("Query", fieldDefinition.getName());
+ return FieldCoordinates.coordinates(OBJECT_TYPE_NAME, fieldDefinition.getName());
}
@Override
@@ -99,16 +96,8 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
}
});
- domainObjects.forEach(domainObject -> {
- ObjectSpecification objectSpec = domainObject.getObjectSpecification();
- this.context.codeRegistryBuilder.dataFetcher(
- coordinatesFor(domainObject.getField()),
- (DataFetcher<Object>) environment -> {
- Object target = environment.getArgument("object");
- return GqlvAction.asPojo(objectSpec, target, this.context.bookmarkService)
- .orElse(null);
- });
- });
+
+ domainObjects.forEach(GqlvDomainObject::addDataFetchers);
}
(causeway) 07/08: CAUSEWAY-3676: further refactorings
Posted by da...@apache.org.
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 90c7d99815a1af0ba74b3cb03c0211bc383ce209
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Feb 11 16:15:31 2024 +0000
CAUSEWAY-3676: further refactorings
---
.../viewer/graphql/model/context/Context.java | 5 +++
.../graphql/model/domain/GqlvDomainObject.java | 22 +++++-----
.../viewer/graphql/model/domain/GqlvMeta.java | 47 +++++++++++-----------
.../integration/GraphQlSourceForCauseway.java | 7 +---
.../graphql/viewer/toplevel/GqlvTopLevelQuery.java | 12 +-----
5 files changed, 43 insertions(+), 50 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 0a9ffe1fbc..aeced311fe 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
@@ -27,9 +27,11 @@ 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.objectmanager.ObjectManager;
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.registry.GraphQLTypeRegistry;
import org.apache.causeway.viewer.graphql.model.types.TypeMapper;
import lombok.RequiredArgsConstructor;
@@ -39,6 +41,7 @@ import java.util.List;
@RequiredArgsConstructor
public class Context {
+
public final GraphQLCodeRegistry.Builder codeRegistryBuilder;
public final BookmarkService bookmarkService;
public final SpecificationLoader specificationLoader;
@@ -46,6 +49,8 @@ public class Context {
public final ServiceRegistry serviceRegistry;
public final CausewayConfiguration causewayConfiguration;
public final CausewaySystemEnvironment causewaySystemEnvironment;
+ public final ObjectManager objectManager;
+ public final GraphQLTypeRegistry graphQLTypeRegistry;
public ImmutableEnumSet<ActionScope> getActionScope() {
return causewaySystemEnvironment.getDeploymentType().isProduction()
diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
index 7595c0fefb..11016e04b6 100644
--- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
+++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
@@ -36,7 +36,6 @@ import static graphql.schema.GraphQLInputObjectType.newInputObject;
import static graphql.schema.GraphQLNonNull.nonNull;
import static graphql.schema.GraphQLObjectType.newObject;
-import org.apache.causeway.core.metamodel.objectmanager.ObjectManager;
import org.apache.causeway.core.metamodel.spec.ActionScope;
import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
import org.apache.causeway.core.metamodel.spec.feature.MixedIn;
@@ -54,8 +53,9 @@ import lombok.val;
public class GqlvDomainObject
implements GqlvAction.Holder, GqlvProperty.Holder, GqlvCollection.Holder, GqlvMeta.Holder {
- private final Holder holder;
@Getter private final ObjectSpecification objectSpecification;
+
+ private final Holder holder;
private final Context context;
@Getter
@@ -69,16 +69,14 @@ public class GqlvDomainObject
private final SortedMap<String, GqlvCollection> collections = new TreeMap<>();
private final Map<String, GqlvAction> actions = new TreeMap<>();
- private GraphQLObjectType gqlObjectType;
+ private GraphQLObjectType objectType;
@Getter private final GraphQLInputObjectType gqlInputObjectType;
public GqlvDomainObject(
final GqlvDomainObject.Holder holder,
final ObjectSpecification objectSpecification,
- final Context context,
- final ObjectManager objectManager,
- final GraphQLTypeRegistry graphQLTypeRegistry) {
+ final Context context) {
this.holder = holder;
this.objectSpecification = objectSpecification;
@@ -86,7 +84,7 @@ public class GqlvDomainObject
this.gqlObjectTypeBuilder = newObject().name(TypeNames.objectTypeNameFor(objectSpecification));
- this.meta = new GqlvMeta(this, context, objectManager);
+ this.meta = new GqlvMeta(this, context);
GraphQLInputObjectType.Builder inputTypeBuilder = newInputObject().name(TypeNames.inputTypeNameFor(objectSpecification));
inputTypeBuilder
@@ -100,10 +98,10 @@ public class GqlvDomainObject
addMembers();
- gqlObjectType = gqlObjectTypeBuilder.build();
- graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlObjectType);
- meta.registerTypesInto(graphQLTypeRegistry);
- graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlInputObjectType);
+ objectType = gqlObjectTypeBuilder.build();
+
+ context.graphQLTypeRegistry.addTypeIfNotAlreadyPresent(objectType);
+ context.graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlInputObjectType);
}
@@ -183,7 +181,7 @@ public class GqlvDomainObject
@Override
public FieldCoordinates coordinatesFor(final GraphQLFieldDefinition fieldDefinition) {
- return FieldCoordinates.coordinates(gqlObjectType, fieldDefinition);
+ return FieldCoordinates.coordinates(objectType, fieldDefinition);
}
diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvMeta.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvMeta.java
index c8a6482f79..bf0c5f2e1a 100644
--- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvMeta.java
+++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvMeta.java
@@ -38,7 +38,6 @@ import org.apache.causeway.core.metamodel.facets.object.entity.EntityFacet;
import org.apache.causeway.core.metamodel.objectmanager.ObjectManager;
import org.apache.causeway.viewer.graphql.model.context.Context;
import org.apache.causeway.viewer.graphql.model.mmproviders.ObjectSpecificationProvider;
-import org.apache.causeway.viewer.graphql.model.registry.GraphQLTypeRegistry;
import lombok.Getter;
import lombok.val;
@@ -52,60 +51,62 @@ public class GqlvMeta {
private final Holder holder;
private final Context context;
- private final ObjectManager objectManager;
- @Getter private final GraphQLFieldDefinition metaField;
+ private final GraphQLObjectType objectType;
+
+ @Getter private final GraphQLFieldDefinition field;
public GqlvMeta(
final Holder holder,
- final Context context,
- final ObjectManager objectManager
+ final Context context
) {
this.holder = holder;
this.context = context;
- this.objectManager = objectManager;
// we can build the metafield and meta type eagerly because we know exactly which fields it has.
- val metaTypeBuilder = newObject().name(TypeNames.metaTypeNameFor(this.holder.getObjectSpecification()));
- metaTypeBuilder.field(id);
- metaTypeBuilder.field(logicalTypeName);
+ val objectTypeBuilder = newObject().name(TypeNames.metaTypeNameFor(this.holder.getObjectSpecification()));
+
+ objectTypeBuilder.field(id);
+ objectTypeBuilder.field(logicalTypeName);
if (this.holder.getObjectSpecification().getBeanSort() == BeanSort.ENTITY) {
- metaTypeBuilder.field(version);
+ objectTypeBuilder.field(version);
}
- metaField = newFieldDefinition().name(context.causewayConfiguration.getViewer().getGraphql().getMetaData().getFieldName()).type(metaTypeBuilder.build()).build();
- holder.addField(metaField);
- }
+ val fieldName = context.causewayConfiguration.getViewer().getGraphql().getMetaData().getFieldName();
- GraphQLObjectType getMetaType() {
- return (GraphQLObjectType) metaField.getType();
- }
+ this.objectType = objectTypeBuilder.build();
+ field = newFieldDefinition()
+ .name(fieldName)
+ .type(objectType)
+ .build();
+
+ holder.addField(field);
- void registerTypesInto(GraphQLTypeRegistry graphQLTypeRegistry) {
- graphQLTypeRegistry.addTypeIfNotAlreadyPresent(getMetaType());
+ context.graphQLTypeRegistry.addTypeIfNotAlreadyPresent(objectType);
}
+
public void addDataFetchers() {
context.codeRegistryBuilder.dataFetcher(
- holder.coordinatesFor(getMetaField()),
+ holder.coordinatesFor(getField()),
(DataFetcher<Object>) environment ->
context.bookmarkService.bookmarkFor(environment.getSource())
- .map(bookmark -> new Fetcher(bookmark, context.bookmarkService, objectManager))
+ .map(bookmark -> new Fetcher(bookmark, context.bookmarkService, context.objectManager))
.orElseThrow());
context.codeRegistryBuilder.dataFetcher(
- coordinates(getMetaType(), logicalTypeName),
+ coordinates(objectType, logicalTypeName),
(DataFetcher<Object>) environment -> environment.<Fetcher>getSource().logicalTypeName());
context.codeRegistryBuilder.dataFetcher(
- coordinates(getMetaType(), id),
+ coordinates(objectType, id),
(DataFetcher<Object>) environment -> environment.<Fetcher>getSource().id());
if (holder.getObjectSpecification().getBeanSort() == BeanSort.ENTITY) {
context.codeRegistryBuilder.dataFetcher(
- coordinates(getMetaType(), version),
+ coordinates(objectType, version),
(DataFetcher<Object>) environment -> environment.<Fetcher>getSource().version());
}
}
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 0c0c4c0420..c2827adf8a 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
@@ -18,8 +18,6 @@
*/
package org.apache.causeway.viewer.graphql.viewer.integration;
-import java.util.ArrayList;
-
import javax.annotation.PostConstruct;
import javax.inject.Inject;
@@ -37,7 +35,6 @@ import org.apache.causeway.core.metamodel.objectmanager.ObjectManager;
import org.apache.causeway.core.metamodel.specloader.SpecificationLoader;
import org.apache.causeway.viewer.graphql.model.types.TypeMapper;
import org.apache.causeway.viewer.graphql.model.context.Context;
-import org.apache.causeway.viewer.graphql.model.domain.GqlvDomainObject;
import org.apache.causeway.viewer.graphql.model.registry.GraphQLTypeRegistry;
import org.apache.causeway.viewer.graphql.viewer.toplevel.GqlvTopLevelQuery;
@@ -101,10 +98,10 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
}
val codeRegistryBuilder = GraphQLCodeRegistry.newCodeRegistry();
- val context = new Context(codeRegistryBuilder, bookmarkService, specificationLoader, typeMapper, serviceRegistry, causewayConfiguration, causewaySystemEnvironment);
+ val context = new Context(codeRegistryBuilder, bookmarkService, specificationLoader, typeMapper, serviceRegistry, causewayConfiguration, causewaySystemEnvironment, objectManager, graphQLTypeRegistry);
// top-level query and mutation type
- val topLevelQuery = new GqlvTopLevelQuery(context, objectManager, graphQLTypeRegistry);
+ val topLevelQuery = new GqlvTopLevelQuery(context);
val topLevelMutation =
causewayConfiguration.getViewer().getGraphql().getApiVariant() == CausewayConfiguration.Viewer.Graphql.ApiVariant.QUERY_AND_MUTATIONS ?
new GqlvTopLevelMutation(context)
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 53f87e4887..693996f8bb 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
@@ -9,15 +9,12 @@ import graphql.schema.GraphQLObjectType;
import static graphql.schema.GraphQLObjectType.newObject;
-import org.apache.causeway.core.metamodel.objectmanager.ObjectManager;
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.GqlvDomainObject;
import org.apache.causeway.viewer.graphql.model.domain.GqlvDomainService;
-import org.apache.causeway.viewer.graphql.model.registry.GraphQLTypeRegistry;
import lombok.Getter;
-import lombok.val;
public class GqlvTopLevelQuery implements GqlvDomainService.Holder, GqlvDomainObject.Holder {
@@ -28,14 +25,9 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder, GqlvDomainOb
private final List<GqlvDomainService> domainServices = new ArrayList<>();
private final List<GqlvDomainObject> domainObjects = new ArrayList<>();
- private final Context context;
- public GqlvTopLevelQuery(
- final Context context,
- final ObjectManager objectManager,
- final GraphQLTypeRegistry graphQLTypeRegistry) {
+ public GqlvTopLevelQuery(final Context context) {
- this.context = context;
this.objectTypeBuilder = newObject().name(OBJECT_TYPE_NAME);
context.objectSpecifications().forEach(objectSpec -> {
@@ -45,7 +37,7 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder, GqlvDomainOb
case VIEW_MODEL: // @DomainObject(nature=VIEW_MODEL)
case ENTITY: // @DomainObject(nature=ENTITY)
- domainObjects.add(new GqlvDomainObject(this, objectSpec, context, objectManager, graphQLTypeRegistry));
+ domainObjects.add(new GqlvDomainObject(this, objectSpec, context));
break;
}
(causeway) 01/08: CAUSEWAY-3676: adds causeway-viewer-graphql-testsupport
Posted by da...@apache.org.
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 0fb031950f0ec3b42e2429c70955d1eedc3335a0
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Feb 10 15:04:59 2024 +0000
CAUSEWAY-3676: adds causeway-viewer-graphql-testsupport
placeholder for Scenario etc
---
bom/pom.xml | 10 ++++
viewers/graphql/applib/pom.xml | 4 +-
viewers/graphql/model/pom.xml | 4 +-
viewers/graphql/pom.xml | 1 +
viewers/graphql/test/pom.xml | 4 +-
viewers/graphql/{viewer => testsupport}/pom.xml | 67 +++++++++++--------------
viewers/graphql/viewer/pom.xml | 4 +-
7 files changed, 49 insertions(+), 45 deletions(-)
diff --git a/bom/pom.xml b/bom/pom.xml
index 10425e5a6f..4f49c6aef1 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -513,6 +513,16 @@ It is therefore a copy of org.apache:apache, with customisations clearly identif
<artifactId>causeway-viewer-graphql-model</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.causeway.viewer</groupId>
+ <artifactId>causeway-viewer-graphql-testsupport</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.causeway.viewer</groupId>
+ <artifactId>causeway-viewer-graphql-test</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.causeway.viewer</groupId>
<artifactId>causeway-viewer-graphql-viewer</artifactId>
diff --git a/viewers/graphql/applib/pom.xml b/viewers/graphql/applib/pom.xml
index 86edc7a0ea..2788f45e04 100644
--- a/viewers/graphql/applib/pom.xml
+++ b/viewers/graphql/applib/pom.xml
@@ -33,8 +33,8 @@
<name>Apache Causeway Viewer - GraphQL (Applib)</name>
<properties>
- <jar-plugin.automaticModuleName>org.apache.causeway.incubator.viewer.graphql.applib</jar-plugin.automaticModuleName>
- <git-plugin.propertiesDir>org/apache/causeway/incubator/viewer/graphql/applib</git-plugin.propertiesDir>
+ <jar-plugin.automaticModuleName>org.apache.causeway.viewer.graphql.applib</jar-plugin.automaticModuleName>
+ <git-plugin.propertiesDir>org/apache/causeway/viewer/graphql/applib</git-plugin.propertiesDir>
</properties>
<dependencies>
diff --git a/viewers/graphql/model/pom.xml b/viewers/graphql/model/pom.xml
index f03dc54daf..6006583e39 100644
--- a/viewers/graphql/model/pom.xml
+++ b/viewers/graphql/model/pom.xml
@@ -33,8 +33,8 @@
<name>Apache Causeway Viewer - GraphQL (Model)</name>
<properties>
- <jar-plugin.automaticModuleName>org.apache.causeway.incubator.viewer.graphql.model</jar-plugin.automaticModuleName>
- <git-plugin.propertiesDir>org/apache/causeway/incubator/viewer/graphql/model</git-plugin.propertiesDir>
+ <jar-plugin.automaticModuleName>org.apache.causeway.viewer.graphql.model</jar-plugin.automaticModuleName>
+ <git-plugin.propertiesDir>org/apache/causeway/viewer/graphql/model</git-plugin.propertiesDir>
</properties>
<dependencies>
diff --git a/viewers/graphql/pom.xml b/viewers/graphql/pom.xml
index d370efce48..4c7c3bbbdf 100644
--- a/viewers/graphql/pom.xml
+++ b/viewers/graphql/pom.xml
@@ -52,6 +52,7 @@
<module>model</module>
<module>viewer</module>
<module>test</module>
+ <module>testsupport</module>
</modules>
</project>
diff --git a/viewers/graphql/test/pom.xml b/viewers/graphql/test/pom.xml
index 7efc32f6da..399401cb5c 100644
--- a/viewers/graphql/test/pom.xml
+++ b/viewers/graphql/test/pom.xml
@@ -33,8 +33,8 @@
<name>Apache Causeway Viewer - GraphQL (Test)</name>
<properties>
- <jar-plugin.automaticModuleName>org.apache.causeway.incubator.viewer.graphql.test</jar-plugin.automaticModuleName>
- <git-plugin.propertiesDir>org/apache/causeway/incubator/viewer/graphql/test</git-plugin.propertiesDir>
+ <jar-plugin.automaticModuleName>org.apache.causeway.viewer.graphql.test</jar-plugin.automaticModuleName>
+ <git-plugin.propertiesDir>org/apache/causeway/viewer/graphql/test</git-plugin.propertiesDir>
<maven.install.skip>true</maven.install.skip>
<maven.deploy.skip>true</maven.deploy.skip>
diff --git a/viewers/graphql/viewer/pom.xml b/viewers/graphql/testsupport/pom.xml
similarity index 53%
copy from viewers/graphql/viewer/pom.xml
copy to viewers/graphql/testsupport/pom.xml
index d9ddfb6ad8..867117a6a0 100644
--- a/viewers/graphql/viewer/pom.xml
+++ b/viewers/graphql/testsupport/pom.xml
@@ -29,54 +29,47 @@
<version>2.0.0-SNAPSHOT</version>
</parent>
- <artifactId>causeway-viewer-graphql-viewer</artifactId>
- <name>Apache Causeway Viewer - GraphQL (Viewer)</name>
+ <artifactId>causeway-viewer-graphql-testsupport</artifactId>
+ <name>Apache Causeway Viewer - GraphQL (Test Support)</name>
<properties>
- <jar-plugin.automaticModuleName>org.apache.causeway.incubator.viewer.graphql.viewer</jar-plugin.automaticModuleName>
- <git-plugin.propertiesDir>org/apache/causeway/incubator/viewer/graphql/viewer</git-plugin.propertiesDir>
- </properties>
+ <jar-plugin.automaticModuleName>org.apache.causeway.viewer.graphql.testsupport</jar-plugin.automaticModuleName>
+ <git-plugin.propertiesDir>org/apache/causeway/viewer/graphql/testsupport</git-plugin.propertiesDir>
+ <maven.install.skip>true</maven.install.skip>
+ <maven.deploy.skip>true</maven.deploy.skip>
- <build>
+ <java.version>17</java.version>
+
+ <datasource-proxy-spring-boot-starter.version>1.8.1</datasource-proxy-spring-boot-starter.version>
+ <sql-formatter.version>2.0.4</sql-formatter.version>
+
+ </properties>
+
+ <build>
<testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
<testResource>
<directory>src/test/java</directory>
<filtering>false</filtering>
</testResource>
</testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.11.0</version>
+ <configuration>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
- <dependencies>
-
- <dependency>
- <groupId>org.apache.causeway.viewer</groupId>
- <artifactId>causeway-viewer-graphql-model</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.causeway.core</groupId>
- <artifactId>causeway-core-webapp</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-websocket</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependencies>
</dependencies>
diff --git a/viewers/graphql/viewer/pom.xml b/viewers/graphql/viewer/pom.xml
index d9ddfb6ad8..f83bdf9a1c 100644
--- a/viewers/graphql/viewer/pom.xml
+++ b/viewers/graphql/viewer/pom.xml
@@ -33,8 +33,8 @@
<name>Apache Causeway Viewer - GraphQL (Viewer)</name>
<properties>
- <jar-plugin.automaticModuleName>org.apache.causeway.incubator.viewer.graphql.viewer</jar-plugin.automaticModuleName>
- <git-plugin.propertiesDir>org/apache/causeway/incubator/viewer/graphql/viewer</git-plugin.propertiesDir>
+ <jar-plugin.automaticModuleName>org.apache.causeway.viewer.graphql.viewer</jar-plugin.automaticModuleName>
+ <git-plugin.propertiesDir>org/apache/causeway/viewer/graphql/viewer</git-plugin.propertiesDir>
</properties>
<build>
(causeway) 08/08: CAUSEWAY-3676: further minor polishing
Posted by da...@apache.org.
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 fe9f4b6b2c44913a4da4645d9fd8050fa7234144
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Feb 11 16:17:43 2024 +0000
CAUSEWAY-3676: further minor polishing
---
.../viewer/graphql/viewer/toplevel/GqlvTopLevelQuery.java | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
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 693996f8bb..dfff9fe35c 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
@@ -9,7 +9,6 @@ import graphql.schema.GraphQLObjectType;
import static graphql.schema.GraphQLObjectType.newObject;
-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.GqlvDomainObject;
import org.apache.causeway.viewer.graphql.model.domain.GqlvDomainService;
@@ -49,13 +48,13 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder, GqlvDomainOb
case MANAGED_BEAN_CONTRIBUTING: // @DomainService
context.serviceRegistry.lookupBeanById(objectSpec.getLogicalTypeName())
.ifPresent(servicePojo -> {
- addDomainService(objectSpec, servicePojo, context);
+ domainServices.add(new GqlvDomainService(this, objectSpec, servicePojo, context));
});
break;
}
});
- // add lookup to top-level query
+ // add domain object lookup to top-level query
for (GqlvDomainObject domainObject : this.domainObjects) {
addField(domainObject.getLookupField());
}
@@ -64,11 +63,6 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder, GqlvDomainOb
}
- public void addDomainService(ObjectSpecification objectSpec, Object servicePojo, Context context) {
- domainServices.add(new GqlvDomainService(this, objectSpec, servicePojo, context));
- }
-
-
@Override
public FieldCoordinates coordinatesFor(GraphQLFieldDefinition fieldDefinition) {
return FieldCoordinates.coordinates(OBJECT_TYPE_NAME, fieldDefinition.getName());
(causeway) 02/08: CAUSEWAY-3676: refactors top level query/mutation a little
Posted by da...@apache.org.
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;
+ }
+ });
+
+
}
(causeway) 05/08: CAUSEWAY-3676: further refactors
Posted by da...@apache.org.
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 584912817e006fe2f34f0ef1ba8bcc6469696521
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Feb 11 15:27:55 2024 +0000
CAUSEWAY-3676: further refactors
---
.../graphql/model/domain/GqlvDomainObject.java | 19 ++++++++
.../integration/GraphQlSourceForCauseway.java | 12 ++---
.../graphql/viewer/toplevel/GqlvTopLevelQuery.java | 54 ++++++++--------------
3 files changed, 43 insertions(+), 42 deletions(-)
diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
index 10c1ab2491..997f780cd8 100644
--- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
+++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
@@ -24,10 +24,12 @@ import java.util.TreeMap;
import graphql.Scalars;
import graphql.schema.FieldCoordinates;
+import graphql.schema.GraphQLArgument;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLInputObjectType;
import graphql.schema.GraphQLObjectType;
+import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLInputObjectField.newInputObjectField;
import static graphql.schema.GraphQLInputObjectType.newInputObject;
import static graphql.schema.GraphQLNonNull.nonNull;
@@ -91,6 +93,23 @@ public class GqlvDomainObject implements GqlvAction.Holder, GqlvProperty.Holder,
addMembers();
}
+ public GraphQLFieldDefinition getField() {
+ val lookupConfig = this.context.causewayConfiguration.getViewer().getGraphql().getLookup();
+ ObjectSpecification objectSpec = getObjectSpecification();
+ return newFieldDefinition()
+ .name(String.format("%s%s%s",
+ lookupConfig.getFieldNamePrefix(), // eg "_gqlv_lookup__"
+ TypeNames.objectTypeNameFor(objectSpec),
+ lookupConfig.getFieldNameSuffix()) // eg ""
+ )
+ .type(this.context.typeMapper.outputTypeFor(objectSpec))
+ .argument(GraphQLArgument.newArgument()
+ .name(lookupConfig.getArgument()) // eg "object"
+ .type(getGqlInputObjectType())
+ .build())
+ .build();
+ }
+
public void addTypesInto(GraphQLTypeRegistry graphQLTypeRegistry) {
gqlObjectType = gqlObjectTypeBuilder.build();
graphQLTypeRegistry.addTypeIfNotAlreadyPresent(gqlObjectType);
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 e2d6773dc3..86a1b923e8 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
@@ -18,22 +18,18 @@
*/
package org.apache.causeway.viewer.graphql.viewer.integration;
-import java.util.Comparator;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
-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.viewer.graphql.viewer.toplevel.GqlvTopLevelMutation;
import org.springframework.graphql.execution.GraphQlSource;
import org.springframework.stereotype.Service;
-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.core.config.CausewayConfiguration;
@@ -111,6 +107,7 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
// domain objects
val domainObjects = new LinkedHashMap<ObjectSpecification, GqlvDomainObject>();
+ val domainObjectList = new ArrayList<GqlvDomainObject>();
context.objectSpecifications().forEach(objectSpec -> {
switch (objectSpec.getBeanSort()) {
@@ -122,6 +119,7 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
domainObject.addTypesInto(graphQLTypeRegistry);
domainObject.addDataFetchers();
+ domainObjectList.add(domainObject);
domainObjects.put(objectSpec, domainObject);
break;
@@ -129,7 +127,7 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
});
// top-level query type and (dependent on configuration) the top-level mutation type
- val topLevelQuery = new GqlvTopLevelQuery(context, domainObjects);
+ val topLevelQuery = new GqlvTopLevelQuery(context, domainObjectList);
val topLevelMutation =
@@ -143,7 +141,7 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
// build the schema
val schemaBuilder = GraphQLSchema.newSchema()
- .query(topLevelQuery.getQueryType())
+ .query(topLevelQuery.getObjectType())
.additionalTypes(graphQLTypeRegistry.getGraphQLTypes())
.codeRegistry(codeRegistry);
if (topLevelMutation != null) {
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 e8a4c3487b..f8dd4cbd35 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
@@ -2,10 +2,8 @@ package org.apache.causeway.viewer.graphql.viewer.toplevel;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import graphql.schema.DataFetcher;
-import graphql.schema.DataFetchingEnvironment;
import graphql.schema.FieldCoordinates;
import graphql.schema.GraphQLArgument;
import graphql.schema.GraphQLFieldDefinition;
@@ -30,18 +28,19 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
private final List<GqlvDomainService> domainServices = new ArrayList<>();
private final Context context;
+ private final List<GqlvDomainObject> domainObjects;
- @Getter private final GraphQLObjectType queryType;
+ @Getter private final GraphQLObjectType objectType;
public GqlvTopLevelQuery(
final Context context,
- final Map<ObjectSpecification, GqlvDomainObject> domainObjects) {
+ final List<GqlvDomainObject> domainObjects) {
this.context = context;
+ this.domainObjects = domainObjects;
this.objectTypeBuilder = newObject().name("Query");
-
// add services to top-level query
context.objectSpecifications().forEach(objectSpec -> {
switch (objectSpec.getBeanSort()) {
@@ -67,9 +66,12 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
});
// add lookup to top-level query
- domainObjects.forEach(this::addLookupFor);
+ for (GqlvDomainObject domainObject : this.domainObjects) {
+ addField(domainObject.getField());
+ }
+
- queryType = objectTypeBuilder.build();
+ objectType = objectTypeBuilder.build();
}
@@ -96,36 +98,18 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
domainService.addDataFetchers();
}
});
- }
- public void addLookupFor(
- final ObjectSpecification objectSpec,
- final GqlvDomainObject domainObject) {
- val lookupConfig = context.causewayConfiguration.getViewer().getGraphql().getLookup();
- val field = newFieldDefinition()
- .name(String.format("%s%s%s",
- lookupConfig.getFieldNamePrefix(), // eg "_gqlv_lookup__"
- TypeNames.objectTypeNameFor(objectSpec),
- lookupConfig.getFieldNameSuffix()) // eg ""
- )
- .type(context.typeMapper.outputTypeFor(objectSpec))
- .argument(GraphQLArgument.newArgument()
- .name(lookupConfig.getArgument()) // eg "object"
- .type(domainObject.getGqlInputObjectType())
- .build())
- .build();
- addField(field);
-
- context.codeRegistryBuilder.dataFetcher(
- coordinatesFor(field),
- (DataFetcher<Object>) environment -> lookup(objectSpec, environment));
-
- }
+ domainObjects.forEach(domainObject -> {
+ ObjectSpecification objectSpec = domainObject.getObjectSpecification();
+ this.context.codeRegistryBuilder.dataFetcher(
+ coordinatesFor(domainObject.getField()),
+ (DataFetcher<Object>) environment -> {
+ Object target = environment.getArgument("object");
+ return GqlvAction.asPojo(objectSpec, target, this.context.bookmarkService)
+ .orElse(null);
+ });
+ });
- private Object lookup(ObjectSpecification objectSpec, DataFetchingEnvironment dataFetchingEnvironment) {
- Object target = dataFetchingEnvironment.getArgument("object");
- return GqlvAction.asPojo(objectSpec, target, context.bookmarkService)
- .orElse(null);
}
(causeway) 03/08: CAUSEWAY-3676: refactors top level query/mutation a little more
Posted by da...@apache.org.
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 7db94e3cfd621007a14d4a417fe19842542d09ed
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Feb 11 12:36:00 2024 +0000
CAUSEWAY-3676: refactors top level query/mutation a little more
---
viewers/graphql/test/src/test/resources/schema.gql | 158 ++++++---------------
.../integration/GraphQlSourceForCauseway.java | 10 +-
.../viewer/toplevel/GqlvTopLevelMutation.java | 1 -
.../graphql/viewer/toplevel/GqlvTopLevelQuery.java | 17 ++-
4 files changed, 61 insertions(+), 125 deletions(-)
diff --git a/viewers/graphql/test/src/test/resources/schema.gql b/viewers/graphql/test/src/test/resources/schema.gql
index 65b53a6d18..b7d6eb65ee 100644
--- a/viewers/graphql/test/src/test/resources/schema.gql
+++ b/viewers/graphql/test/src/test/resources/schema.gql
@@ -22,6 +22,50 @@ 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
@@ -84,7 +128,6 @@ type causeway_applib_DomainObjectList__actionArguments__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(actionArguments: String): causeway_applib_DomainObjectList
validate(actionArguments: String): String
}
@@ -92,7 +135,6 @@ type causeway_applib_DomainObjectList__actionId__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(actionId: String): causeway_applib_DomainObjectList
validate(actionId: String): String
}
@@ -100,7 +142,6 @@ type causeway_applib_DomainObjectList__actionOwningFqcn__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(actionOwningFqcn: String): causeway_applib_DomainObjectList
validate(actionOwningFqcn: String): String
}
@@ -108,7 +149,6 @@ type causeway_applib_DomainObjectList__elementTypeFqcn__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(elementTypeFqcn: String!): causeway_applib_DomainObjectList
validate(elementTypeFqcn: String): String
}
@@ -126,7 +166,6 @@ type causeway_applib_DomainObjectList__title__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(title: String!): causeway_applib_DomainObjectList
validate(title: String): String
}
@@ -146,7 +185,6 @@ type causeway_applib_FacetGroupNode__facets__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(facets: String!): causeway_applib_FacetGroupNode
validate(facets: String): String
}
@@ -158,7 +196,6 @@ 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
}
@@ -183,7 +220,6 @@ type causeway_applib_ParameterNode__parameter__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(parameter: String!): causeway_applib_ParameterNode
validate(parameter: String): String
}
@@ -191,7 +227,6 @@ 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
}
@@ -217,7 +252,6 @@ type causeway_applib_PropertyNode__mixedIn__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
- set(mixedIn: Boolean!): causeway_applib_PropertyNode
validate(mixedIn: Boolean): String
}
@@ -225,7 +259,6 @@ 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
}
@@ -233,7 +266,6 @@ type causeway_applib_PropertyNode__property__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(property: String!): causeway_applib_PropertyNode
validate(property: String): String
}
@@ -247,7 +279,6 @@ type causeway_applib_RoleMemento__description__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(description: String!): causeway_applib_RoleMemento
validate(description: String): String
}
@@ -260,7 +291,6 @@ type causeway_applib_RoleMemento__name__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(name: String!): causeway_applib_RoleMemento
validate(name: String): String
}
@@ -280,7 +310,6 @@ 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
}
@@ -292,7 +321,6 @@ 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
}
@@ -315,7 +343,6 @@ type causeway_applib_UserMemento__authenticationCode__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(authenticationCode: String!): causeway_applib_UserMemento
validate(authenticationCode: String): String
}
@@ -324,7 +351,6 @@ type causeway_applib_UserMemento__authenticationSource__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(authenticationSource: String!): causeway_applib_UserMemento
validate(authenticationSource: String): String
}
@@ -332,7 +358,6 @@ type causeway_applib_UserMemento__avatarUrl__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(avatarUrl: String): causeway_applib_UserMemento
validate(avatarUrl: String): String
}
@@ -345,7 +370,6 @@ type causeway_applib_UserMemento__impersonating__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
- set(impersonating: Boolean!): causeway_applib_UserMemento
validate(impersonating: Boolean): String
}
@@ -353,7 +377,6 @@ type causeway_applib_UserMemento__languageLocale__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(languageLocale: String): causeway_applib_UserMemento
validate(languageLocale: String): String
}
@@ -361,7 +384,6 @@ type causeway_applib_UserMemento__multiTenancyToken__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(multiTenancyToken: String): causeway_applib_UserMemento
validate(multiTenancyToken: String): String
}
@@ -369,7 +391,6 @@ type causeway_applib_UserMemento__name__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(name: String!): causeway_applib_UserMemento
validate(name: String): String
}
@@ -377,7 +398,6 @@ type causeway_applib_UserMemento__numberFormatLocale__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(numberFormatLocale: String): causeway_applib_UserMemento
validate(numberFormatLocale: String): String
}
@@ -385,7 +405,6 @@ type causeway_applib_UserMemento__realName__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(realName: String): causeway_applib_UserMemento
validate(realName: String): String
}
@@ -399,7 +418,6 @@ type causeway_applib_UserMemento__timeFormatLocale__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(timeFormatLocale: String): causeway_applib_UserMemento
validate(timeFormatLocale: String): String
}
@@ -426,7 +444,6 @@ 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
}
@@ -444,7 +461,6 @@ 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
}
@@ -452,7 +468,6 @@ 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
}
@@ -473,7 +488,6 @@ 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
}
@@ -486,7 +500,6 @@ 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
}
@@ -494,7 +507,6 @@ 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
}
@@ -514,7 +526,6 @@ 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
}
@@ -527,7 +538,6 @@ 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
}
@@ -548,7 +558,6 @@ 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
}
@@ -560,7 +569,6 @@ 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
}
@@ -568,7 +576,6 @@ 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
}
@@ -598,7 +605,6 @@ type causeway_conf_ConfigurationProperty__key__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(key: String!): causeway_conf_ConfigurationProperty
validate(key: String): String
}
@@ -606,7 +612,6 @@ type causeway_conf_ConfigurationProperty__value__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(value: String!): causeway_conf_ConfigurationProperty
validate(value: String): String
}
@@ -657,7 +662,6 @@ type causeway_feat_ApplicationFeatureViewModel__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(memberName: String!): causeway_feat_ApplicationFeatureViewModel
validate(memberName: String): String
}
@@ -665,14 +669,12 @@ 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
}
@@ -680,7 +682,6 @@ type causeway_feat_ApplicationFeatureViewModel__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(typeSimpleName: String!): causeway_feat_ApplicationFeatureViewModel
validate(typeSimpleName: String): String
}
@@ -707,7 +708,6 @@ type causeway_feat_ApplicationNamespace__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(memberName: String!): causeway_feat_ApplicationNamespace
validate(memberName: String): String
}
@@ -715,14 +715,12 @@ 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
}
@@ -730,7 +728,6 @@ type causeway_feat_ApplicationNamespace__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(typeSimpleName: String!): causeway_feat_ApplicationNamespace
validate(typeSimpleName: String): String
}
@@ -760,7 +757,6 @@ type causeway_feat_ApplicationTypeAction__actionSemantics__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(actionSemantics: String!): causeway_feat_ApplicationTypeAction
validate(actionSemantics: String): String
}
@@ -773,7 +769,6 @@ type causeway_feat_ApplicationTypeAction__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(memberName: String!): causeway_feat_ApplicationTypeAction
validate(memberName: String): String
}
@@ -781,14 +776,12 @@ 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
}
@@ -796,7 +789,6 @@ type causeway_feat_ApplicationTypeAction__returnType__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(returnType: String!): causeway_feat_ApplicationTypeAction
validate(returnType: String): String
}
@@ -804,7 +796,6 @@ type causeway_feat_ApplicationTypeAction__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(typeSimpleName: String!): causeway_feat_ApplicationTypeAction
validate(typeSimpleName: String): String
}
@@ -822,7 +813,6 @@ type causeway_feat_ApplicationTypeCollection__derived__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
- set(derived: Boolean!): causeway_feat_ApplicationTypeCollection
validate(derived: Boolean): String
}
@@ -830,7 +820,6 @@ type causeway_feat_ApplicationTypeCollection__elementType__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(elementType: String!): causeway_feat_ApplicationTypeCollection
validate(elementType: String): String
}
@@ -843,7 +832,6 @@ type causeway_feat_ApplicationTypeCollection__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(memberName: String!): causeway_feat_ApplicationTypeCollection
validate(memberName: String): String
}
@@ -851,14 +839,12 @@ 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
}
@@ -866,7 +852,6 @@ type causeway_feat_ApplicationTypeCollection__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(typeSimpleName: String!): causeway_feat_ApplicationTypeCollection
validate(typeSimpleName: String): String
}
@@ -887,7 +872,6 @@ type causeway_feat_ApplicationTypeMember__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(memberName: String!): causeway_feat_ApplicationTypeMember
validate(memberName: String): String
}
@@ -895,14 +879,12 @@ 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
}
@@ -910,7 +892,6 @@ type causeway_feat_ApplicationTypeMember__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(typeSimpleName: String!): causeway_feat_ApplicationTypeMember
validate(typeSimpleName: String): String
}
@@ -930,7 +911,6 @@ type causeway_feat_ApplicationTypeProperty__derived__gqlv_property {
disabled: String
get: Boolean!
hidden: Boolean
- set(derived: Boolean!): causeway_feat_ApplicationTypeProperty
validate(derived: Boolean): String
}
@@ -943,7 +923,6 @@ type causeway_feat_ApplicationTypeProperty__maxLength__gqlv_property {
disabled: String
get: Int
hidden: Boolean
- set(maxLength: Int): causeway_feat_ApplicationTypeProperty
validate(maxLength: Int): String
}
@@ -951,7 +930,6 @@ type causeway_feat_ApplicationTypeProperty__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(memberName: String!): causeway_feat_ApplicationTypeProperty
validate(memberName: String): String
}
@@ -959,14 +937,12 @@ 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
}
@@ -974,7 +950,6 @@ type causeway_feat_ApplicationTypeProperty__returnType__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(returnType: String!): causeway_feat_ApplicationTypeProperty
validate(returnType: String): String
}
@@ -982,7 +957,6 @@ type causeway_feat_ApplicationTypeProperty__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(typeSimpleName: String!): causeway_feat_ApplicationTypeProperty
validate(typeSimpleName: String): String
}
@@ -990,7 +964,6 @@ type causeway_feat_ApplicationTypeProperty__typicalLength__gqlv_property {
disabled: String
get: Int
hidden: Boolean
- set(typicalLength: Int): causeway_feat_ApplicationTypeProperty
validate(typicalLength: Int): String
}
@@ -1015,7 +988,6 @@ type causeway_feat_ApplicationType__memberName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(memberName: String!): causeway_feat_ApplicationType
validate(memberName: String): String
}
@@ -1023,14 +995,12 @@ 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
}
@@ -1044,7 +1014,6 @@ type causeway_feat_ApplicationType__typeSimpleName__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(typeSimpleName: String!): causeway_feat_ApplicationType
validate(typeSimpleName: String): String
}
@@ -1065,7 +1034,6 @@ 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
}
@@ -1073,7 +1041,6 @@ 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
}
@@ -1081,7 +1048,6 @@ 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
}
@@ -1089,7 +1055,6 @@ 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
}
@@ -1102,7 +1067,6 @@ 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
}
@@ -1110,7 +1074,6 @@ 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
}
@@ -1118,7 +1081,6 @@ 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
}
@@ -1126,7 +1088,6 @@ 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
}
@@ -1134,7 +1095,6 @@ 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
}
@@ -1170,7 +1130,6 @@ 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
}
@@ -1178,7 +1137,6 @@ 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
}
@@ -1191,14 +1149,12 @@ 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
}
@@ -1293,7 +1249,6 @@ 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
}
@@ -1318,7 +1273,6 @@ 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
}
@@ -1326,7 +1280,6 @@ 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
}
@@ -1340,7 +1293,6 @@ 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
}
@@ -1353,7 +1305,6 @@ 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
}
@@ -1373,7 +1324,6 @@ 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
}
@@ -1405,7 +1355,6 @@ 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
}
@@ -1424,14 +1373,12 @@ 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
}
@@ -1934,7 +1881,6 @@ 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
}
@@ -1953,7 +1899,6 @@ 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
}
@@ -1972,7 +1917,6 @@ 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
}
@@ -1992,7 +1936,6 @@ 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
}
@@ -2013,7 +1956,6 @@ 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
}
@@ -2027,14 +1969,12 @@ 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
}
@@ -2072,7 +2012,6 @@ 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
}
@@ -2131,7 +2070,6 @@ 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
}
@@ -2143,7 +2081,6 @@ 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
}
@@ -2164,7 +2101,6 @@ 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
}
@@ -2178,7 +2114,6 @@ type university_dept_DeptHead__name__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(name: String): university_dept_DeptHead
validate(name: String): String
}
@@ -2231,7 +2166,6 @@ 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
}
@@ -2246,7 +2180,6 @@ type university_dept_StaffMember__grade__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(grade: String!): university_dept_StaffMember
validate(grade: String): String
}
@@ -2254,7 +2187,6 @@ type university_dept_StaffMember__name__gqlv_property {
disabled: String
get: String!
hidden: Boolean
- set(name: String!): university_dept_StaffMember
validate(name: String): String
}
@@ -2262,7 +2194,6 @@ type university_dept_StaffMember__photo__gqlv_property {
disabled: String
get: String
hidden: Boolean
- set(photo: String): university_dept_StaffMember
validate(photo: String): String
}
@@ -2276,7 +2207,6 @@ 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 4860a59f26..222c7707b3 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,13 +109,9 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
val codeRegistryBuilder = GraphQLCodeRegistry.newCodeRegistry();
val context = new Context(codeRegistryBuilder, bookmarkService, specificationLoader, typeMapper, serviceRegistry, causewayConfiguration, causewaySystemEnvironment);
- // top-level query type and (dependent on configuration) the top-level mutation type
- val topLevelQuery = new GqlvTopLevelQuery(context);
-
// domain objects
- val objectSpecifications = context.objectSpecifications();
val domainObjects = new LinkedHashMap<ObjectSpecification, GqlvDomainObject>();
- objectSpecifications.forEach(objectSpec -> {
+ context.objectSpecifications().forEach(objectSpec -> {
switch (objectSpec.getBeanSort()) {
case ABSTRACT:
@@ -132,8 +128,12 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
}
});
+ // top-level query type and (dependent on configuration) the top-level mutation type
+ val topLevelQuery = new GqlvTopLevelQuery(context);
+
// add lookup to top-level query
domainObjects.forEach(topLevelQuery::addLookupFor);
+
topLevelQuery.buildQueryType();
val topLevelMutation =
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 9f11f63532..8b19244dc1 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
@@ -60,7 +60,6 @@ public class GqlvTopLevelMutation
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 cb2c7d5643..dcdedbb5ff 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
@@ -45,23 +45,30 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
this.context = context;
queryBuilder = newObject().name("Query");
- val objectSpecifications = context.objectSpecifications();
-
// add services to top-level query
- objectSpecifications.forEach(objectSpec -> {
+ context.objectSpecifications().forEach(objectSpec -> {
switch (objectSpec.getBeanSort()) {
case MANAGED_BEAN_CONTRIBUTING: // @DomainService
context.serviceRegistry.lookupBeanById(objectSpec.getLogicalTypeName())
.ifPresent(servicePojo -> {
addDomainService(objectSpec, servicePojo, context);
- addDataFetchers();
});
break;
}
});
-
+ // add services to top-level query
+ context.objectSpecifications().forEach(objectSpec -> {
+ switch (objectSpec.getBeanSort()) {
+ case MANAGED_BEAN_CONTRIBUTING: // @DomainService
+ context.serviceRegistry.lookupBeanById(objectSpec.getLogicalTypeName())
+ .ifPresent(servicePojo -> {
+ addDataFetchers();
+ });
+ break;
+ }
+ });
}
(causeway) 04/08: CAUSEWAY-3676: further refactors
Posted by da...@apache.org.
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 1c173b110afc31f0f438d01ba77035cf829848e3
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Feb 11 12:58:17 2024 +0000
CAUSEWAY-3676: further refactors
---
.../integration/GraphQlSourceForCauseway.java | 6 +---
.../graphql/viewer/toplevel/GqlvTopLevelQuery.java | 40 ++++++----------------
2 files changed, 12 insertions(+), 34 deletions(-)
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 222c7707b3..e2d6773dc3 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
@@ -129,12 +129,8 @@ public class GraphQlSourceForCauseway implements GraphQlSource {
});
// top-level query type and (dependent on configuration) the top-level mutation type
- val topLevelQuery = new GqlvTopLevelQuery(context);
+ val topLevelQuery = new GqlvTopLevelQuery(context, domainObjects);
- // add lookup to top-level query
- domainObjects.forEach(topLevelQuery::addLookupFor);
-
- topLevelQuery.buildQueryType();
val topLevelMutation =
causewayConfiguration.getViewer().getGraphql().getApiVariant() == CausewayConfiguration.Viewer.Graphql.ApiVariant.QUERY_AND_MUTATIONS ?
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 dcdedbb5ff..e8a4c3487b 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,9 +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 java.util.Map;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
@@ -15,8 +14,6 @@ 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;
@@ -29,21 +26,20 @@ import lombok.val;
public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
- @Getter final GraphQLObjectType.Builder queryBuilder;
+ final GraphQLObjectType.Builder objectTypeBuilder;
private final List<GqlvDomainService> domainServices = new ArrayList<>();
private final Context context;
- /**
- * Built using {@link #buildQueryType()}
- */
- private GraphQLObjectType queryType;
+ @Getter private final GraphQLObjectType queryType;
- public GqlvTopLevelQuery(Context context) {
+ public GqlvTopLevelQuery(
+ final Context context,
+ final Map<ObjectSpecification, GqlvDomainObject> domainObjects) {
this.context = context;
- queryBuilder = newObject().name("Query");
+ this.objectTypeBuilder = newObject().name("Query");
// add services to top-level query
@@ -69,27 +65,13 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
break;
}
});
- }
-
+ // add lookup to top-level query
+ domainObjects.forEach(this::addLookupFor);
- public GraphQLObjectType buildQueryType() {
- if (queryType != null) {
- throw new IllegalStateException("QueryType has already been built");
- }
- return queryType = queryBuilder.build();
+ queryType = objectTypeBuilder.build();
}
- /**
- *
- * @see #buildQueryType()
- */
- public GraphQLObjectType getQueryType() {
- if (queryType == null) {
- throw new IllegalStateException("QueryType has not yet been built");
- }
- return queryType;
- }
public void addDomainService(ObjectSpecification objectSpec, Object servicePojo, Context context) {
domainServices.add(new GqlvDomainService(this, objectSpec, servicePojo, context));
@@ -103,7 +85,7 @@ public class GqlvTopLevelQuery implements GqlvDomainService.Holder {
@Override
public GraphQLFieldDefinition addField(GraphQLFieldDefinition field) {
- queryBuilder.field(field);
+ objectTypeBuilder.field(field);
return field;
}