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 a832b59adae9b6fabab03b2cd9c4acc02ce70f93 Author: danhaywood <[email protected]> AuthorDate: Thu Feb 22 07:22:31 2024 +0000 CAUSEWAY-3676: wip, SchemaStrategy --- .../model/domain/common/SchemaStrategy.java | 9 ++ .../domain/common/query/GqlvDomainObject.java | 13 +- .../model/domain/common/query/GqlvMetaHolder.java | 10 ++ .../query/GqlvTopLevelQueryAbstractSchema.java | 28 +--- .../model/domain/common/query/GvqlActionUtils.java | 162 +++++++++++++++++++++ .../model/domain/rich/SchemaStrategyRich.java | 8 + .../graphql/model/domain/rich/query/GqlvMeta.java | 13 +- .../rich/query/GqlvTopLevelQueryRichSchema.java | 9 +- .../model/domain/simple/SchemaStrategySimple.java | 8 + .../simple/mutation/GqlvMutationForAction.java | 8 +- .../simple/mutation/GqlvMutationForProperty.java | 4 +- .../model/domain/simple/query/GqlvAction.java | 143 +----------------- .../model/domain/simple/query/GqlvMeta.java | 12 +- .../model/domain/simple/query/GqlvMetaSaveAs.java | 7 +- .../query/GqlvTopLevelQuerySimpleSchema.java | 13 +- viewers/graphql/test/src/test/resources/schema.gql | 63 -------- 16 files changed, 237 insertions(+), 273 deletions(-) diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/SchemaStrategy.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/SchemaStrategy.java index 5c01d436d5..9eb1673ce1 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/SchemaStrategy.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/SchemaStrategy.java @@ -13,9 +13,14 @@ import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvDomainObject; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvDomainService; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMemberHolder; +import org.apache.causeway.viewer.graphql.model.domain.rich.SchemaStrategyRich; +import org.apache.causeway.viewer.graphql.model.domain.simple.SchemaStrategySimple; public interface SchemaStrategy { + SchemaStrategy RICH = new SchemaStrategyRich(); + SchemaStrategy SIMPLE = new SchemaStrategySimple(); + SchemaType getSchemaType(); Map<ObjectSpecification, GqlvDomainObject> domainObjectBySpec(Context context); @@ -42,4 +47,8 @@ public interface SchemaStrategy { final ObjectAction objectAction, final Context context ); + + GqlvAbstractCustom newGqlvMeta( + final GqlvDomainObject gqlvDomainObject, + final Context context); } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainObject.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainObject.java index b8b6939f61..bcee9d8177 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainObject.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainObject.java @@ -40,8 +40,8 @@ import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstractCustom; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; -import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvAction; -import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvMeta; +import org.apache.causeway.viewer.graphql.model.mmproviders.ObjectSpecificationProvider; +import org.apache.causeway.viewer.graphql.model.mmproviders.SchemaTypeProvider; import lombok.Getter; import lombok.val; @@ -51,7 +51,7 @@ import lombok.val; */ public class GqlvDomainObject extends GqlvAbstractCustom - implements GqlvMemberHolder, GqlvMeta.Holder { + implements GqlvMetaHolder, GqlvMemberHolder, ObjectSpecificationProvider, SchemaTypeProvider { private final SchemaStrategy schemaStrategy; @Getter private final ObjectSpecification objectSpecification; @@ -75,17 +75,16 @@ public class GqlvDomainObject final Context context) { super(TypeNames.objectTypeNameFor(objectSpecification, schemaStrategy.getSchemaType()), context); this.schemaStrategy = schemaStrategy; - this.objectSpecification = objectSpecification; - gqlObjectTypeBuilder.description(objectSpecification.getDescription()); if(isBuilt()) { this.meta = null; this.gqlInputObjectType = null; return; } + gqlObjectTypeBuilder.description(objectSpecification.getDescription()); - addChildFieldFor(this.meta = new GqlvMeta(this, context)); + addChildFieldFor(this.meta = schemaStrategy.newGqlvMeta(this, context)); val inputObjectTypeBuilder = newInputObject().name(TypeNames.inputTypeNameFor(objectSpecification, getSchemaType())); inputObjectTypeBuilder @@ -172,7 +171,7 @@ public class GqlvDomainObject @Override protected Object fetchData(DataFetchingEnvironment dataFetchingEnvironment) { Object target = dataFetchingEnvironment.getArgument("object"); - return GqlvAction.asPojo(getObjectSpecification(), target, new Environment.For(dataFetchingEnvironment), context) + return GvqlActionUtils.asPojo(schemaStrategy, getObjectSpecification(), target, new Environment.For(dataFetchingEnvironment), context) .orElse(null); } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaHolder.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaHolder.java new file mode 100644 index 0000000000..be2354ed88 --- /dev/null +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaHolder.java @@ -0,0 +1,10 @@ +package org.apache.causeway.viewer.graphql.model.domain.common.query; + +import org.apache.causeway.viewer.graphql.model.mmproviders.ObjectSpecificationProvider; +import org.apache.causeway.viewer.graphql.model.mmproviders.SchemaTypeProvider; + +public interface GqlvMetaHolder + extends ObjectSpecificationProvider, + SchemaTypeProvider { + +} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvTopLevelQueryAbstractSchema.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvTopLevelQueryAbstractSchema.java index f6d94eef15..683920affc 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvTopLevelQueryAbstractSchema.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvTopLevelQueryAbstractSchema.java @@ -5,29 +5,26 @@ import java.util.List; import graphql.schema.DataFetchingEnvironment; -import lombok.Getter; -import lombok.val; - -import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; - import org.apache.causeway.core.config.CausewayConfiguration; 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.GqlvAbstract; import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstractCustom; import org.apache.causeway.viewer.graphql.model.domain.Parent; import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvTopLevelQuerySimpleSchema; +import lombok.Getter; +import lombok.val; + public abstract class GqlvTopLevelQueryAbstractSchema extends GqlvAbstractCustom implements Parent { @Getter private final SchemaStrategy schemaStrategy; - private final CausewayConfiguration.Viewer.Graphql graphqlConfiguration; - - private final List<GqlvDomainService> domainServices = new ArrayList<>(); - private final List<GqlvDomainObject> domainObjects = new ArrayList<>(); + private final List<GqlvAbstract> domainServices = new ArrayList<>(); + private final List<GqlvAbstractCustom> domainObjects = new ArrayList<>(); public GqlvTopLevelQueryAbstractSchema( final SchemaStrategy schemaStrategy, @@ -35,8 +32,6 @@ public abstract class GqlvTopLevelQueryAbstractSchema super(schemaStrategy.getSchemaType().name() + "Schema", context); this.schemaStrategy = schemaStrategy; - graphqlConfiguration = context.causewayConfiguration.getViewer().getGraphql(); - // add domain object lookup to top-level query context.objectSpecifications().forEach(objectSpec -> { switch (objectSpec.getBeanSort()) { @@ -45,7 +40,7 @@ public abstract class GqlvTopLevelQueryAbstractSchema case VIEW_MODEL: // @DomainObject(nature=VIEW_MODEL) case ENTITY: // @DomainObject(nature=ENTITY) - domainObjects.add(addChildFieldFor(GqlvTopLevelQuerySimpleSchema.of(schemaStrategy, objectSpec, context))); + domainObjects.add(addChildFieldFor(schemaStrategy.newGqlvDomainObject(objectSpec, context))); break; } @@ -86,14 +81,7 @@ public abstract class GqlvTopLevelQueryAbstractSchema @Override protected void addDataFetchersForChildren() { - domainServices.forEach(domainService -> { - boolean actionsAdded = domainService.hasActions(); - if (actionsAdded) { - domainService.addDataFetcher(this); - } - }); - + domainServices.forEach(domainService -> domainService.addDataFetcher(this)); domainObjects.forEach(domainObject -> domainObject.addDataFetcher(this)); - } } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GvqlActionUtils.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GvqlActionUtils.java new file mode 100644 index 0000000000..3f1f5f4ffa --- /dev/null +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GvqlActionUtils.java @@ -0,0 +1,162 @@ +package org.apache.causeway.viewer.graphql.model.domain.common.query; + +import lombok.val; + +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.apache.causeway.applib.services.bookmark.Bookmark; +import org.apache.causeway.commons.collections.Can; +import org.apache.causeway.core.metamodel.object.ManagedObject; +import org.apache.causeway.core.metamodel.spec.ObjectSpecification; +import org.apache.causeway.core.metamodel.spec.feature.ObjectAction; +import org.apache.causeway.core.metamodel.spec.feature.ObjectActionParameter; +import org.apache.causeway.viewer.graphql.model.context.Context; +import org.apache.causeway.viewer.graphql.model.domain.Environment; +import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; +import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvMetaSaveAs; +import org.apache.causeway.viewer.graphql.model.fetcher.BookmarkedPojo; + +public class GvqlActionUtils { + + public static Optional<Object> asPojo( + final SchemaStrategy schemaStrategy, + final ObjectSpecification elementType, + final Object argumentValueObj, + final Environment environment, + final Context context + ) { + val argumentValue = (Map<String, String>) argumentValueObj; + + val refValue = argumentValue.get("ref"); + if (refValue != null) { + String key = keyFor(refValue); + BookmarkedPojo bookmarkedPojo = environment.getGraphQlContext().get(key); + if (bookmarkedPojo == null) { + throw new IllegalArgumentException(String.format( + "Could not find object referenced '%s' in the execution context; was it saved previously using \"saveAs\" ?", refValue)); + } + val targetPojoClass = bookmarkedPojo.getTargetPojo().getClass(); + val targetPojoSpec = context.specificationLoader.loadSpecification(targetPojoClass); + if (targetPojoSpec == null) { + throw new IllegalArgumentException(String.format( + "The object referenced '%s' is not part of the metamodel (has class '%s')", + refValue, targetPojoClass.getCanonicalName())); + } + if (!elementType.isPojoCompatible(bookmarkedPojo.getTargetPojo())) { + throw new IllegalArgumentException(String.format( + "The object referenced '%s' has a type '%s' that is not assignable to the required type '%s'", + refValue, targetPojoSpec.getLogicalTypeName(), elementType.getLogicalTypeName())); + } + return Optional.of(bookmarkedPojo).map(BookmarkedPojo::getTargetPojo); + } + + val idValue = argumentValue.get("id"); + if (idValue != null) { + Class<?> paramClass = elementType.getCorrespondingClass(); + Optional<Bookmark> bookmarkIfAny; + if(elementType.isAbstract()) { + val logicalTypeName = argumentValue.get("logicalTypeName"); + if (logicalTypeName == null) { + throw new IllegalArgumentException(String.format( + "The 'logicalTypeName' is required along with the 'id', because the input type '%s' is abstract", + elementType.getLogicalTypeName())); + } + if(context.specificationLoader.specForLogicalTypeName(logicalTypeName).isEmpty()) { + throw new IllegalArgumentException(String.format( + "The 'logicalTypeName' of '%s' is unknown in the metamodel", + logicalTypeName)); + } + + bookmarkIfAny = Optional.of(Bookmark.forLogicalTypeNameAndIdentifier(logicalTypeName, idValue)); + } else { + bookmarkIfAny = context.bookmarkService.bookmarkFor(paramClass, idValue); + } + return bookmarkIfAny + .map(context.bookmarkService::lookup) + .filter(Optional::isPresent) + .map(Optional::get); + } + throw new IllegalArgumentException("Either 'id' or 'ref' must be specified for a DomainObject input type"); + } + + /** + * @param schemaStrategy + * @param environment + * @param objectAction + * @param context + * @return + */ + public static Can<ManagedObject> argumentManagedObjectsFor( + SchemaStrategy schemaStrategy, + final Environment environment, + final ObjectAction objectAction, + final Context context) { + Map<String, Object> argumentPojos = environment.getArguments(); + Can<ObjectActionParameter> parameters = objectAction.getParameters(); + return parameters + .map(oap -> { + final ObjectSpecification elementType = oap.getElementType(); + Object argumentValue = argumentPojos.get(oap.getId()); + Object pojoOrPojoList; + + switch (elementType.getBeanSort()) { + + case VALUE: + return adaptValue(oap, argumentValue, context); + + case ENTITY: + case VIEW_MODEL: + if (argumentValue == null) { + return ManagedObject.empty(elementType); + } + // fall through + + case ABSTRACT: + // if the parameter is abstract, we still attempt to figure out the arguments. + // the arguments will need to either use 'ref' or else both 'id' AND 'logicalTypeName' + if (argumentValue instanceof List) { + val argumentValueList = (List<Object>) argumentValue; + pojoOrPojoList = argumentValueList.stream() + .map(value -> asPojo(schemaStrategy, oap.getElementType(), value, environment, context)) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toList()); + } else { + pojoOrPojoList = asPojo(schemaStrategy, oap.getElementType(), argumentValue, environment, context).orElse(null); + } + return ManagedObject.adaptParameter(oap, pojoOrPojoList); + + case COLLECTION: + case MANAGED_BEAN_CONTRIBUTING: + case VETOED: + case MANAGED_BEAN_NOT_CONTRIBUTING: + case MIXIN: + case UNKNOWN: + default: + throw new IllegalArgumentException(String.format( + "Cannot handle an input type for %s; beanSort is %s", elementType.getFullIdentifier(), elementType.getBeanSort())); + } + }); + } + + private static ManagedObject adaptValue( + final ObjectActionParameter oap, + final Object argumentValue, + final Context context) { + + val elementType = oap.getElementType(); + if (argumentValue == null) { + return ManagedObject.empty(elementType); + } + + val argPojo = context.typeMapper.unmarshal(argumentValue, elementType); + return ManagedObject.adaptParameter(oap, argPojo); + } + + public static String keyFor(String ref) { + return GvqlActionUtils.class.getName() + "#" + ref; + } +} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/SchemaStrategyRich.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/SchemaStrategyRich.java index 6152261071..7c53e0135c 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/SchemaStrategyRich.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/SchemaStrategyRich.java @@ -16,7 +16,9 @@ import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvDomainSe import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMemberHolder; import org.apache.causeway.viewer.graphql.model.domain.rich.query.GqlvAction; import org.apache.causeway.viewer.graphql.model.domain.rich.query.GqlvCollection; +import org.apache.causeway.viewer.graphql.model.domain.rich.query.GqlvMeta; import org.apache.causeway.viewer.graphql.model.domain.rich.query.GqlvProperty; +import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvTopLevelQuerySimpleSchema; public class SchemaStrategyRich implements SchemaStrategy { @@ -68,4 +70,10 @@ public class SchemaStrategyRich implements SchemaStrategy { ) { return new GqlvAction(holder, objectAction, context); } + + @Override + public GqlvAbstractCustom newGqlvMeta(GqlvDomainObject gqlvDomainObject, Context context) { + return new GqlvMeta(gqlvDomainObject, context); + } + } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMeta.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMeta.java index bd3ec0436b..0d8d7986aa 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMeta.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMeta.java @@ -34,16 +34,14 @@ import org.apache.causeway.core.metamodel.object.ManagedObject; import org.apache.causeway.core.metamodel.objectmanager.ObjectManager; import org.apache.causeway.viewer.graphql.model.context.Context; import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstractCustom; -import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; -import org.apache.causeway.viewer.graphql.model.mmproviders.ObjectSpecificationProvider; -import org.apache.causeway.viewer.graphql.model.mmproviders.SchemaTypeProvider; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMetaHolder; import lombok.val; public class GqlvMeta extends GqlvAbstractCustom { - private final Holder holder; + private final GqlvMetaHolder holder; private final GqlvMetaId metaId; private final GqlvMetaLogicalTypeName metaLogicalTypeName; private final GqlvMetaVersion metaVersion; @@ -57,7 +55,7 @@ public class GqlvMeta extends GqlvAbstractCustom { private final CausewayConfiguration.Viewer.Graphql graphqlConfiguration; public GqlvMeta( - final Holder holder, + final GqlvMetaHolder holder, final Context context ) { super(TypeNames.metaTypeNameFor(holder.getObjectSpecification(), holder.getSchemaType()), context); @@ -229,9 +227,4 @@ public class GqlvMeta extends GqlvAbstractCustom { } } - public interface Holder - extends ObjectSpecificationProvider, - SchemaTypeProvider { - - } } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvTopLevelQueryRichSchema.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvTopLevelQueryRichSchema.java index 81f45394a0..f70a8ee0b7 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvTopLevelQueryRichSchema.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvTopLevelQueryRichSchema.java @@ -6,22 +6,21 @@ import org.apache.causeway.viewer.graphql.model.context.Context; import org.apache.causeway.viewer.graphql.model.domain.GqlvScenario; import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvTopLevelQueryAbstractSchema; -import org.apache.causeway.viewer.graphql.model.domain.rich.SchemaStrategyRich; public class GqlvTopLevelQueryRichSchema extends GqlvTopLevelQueryAbstractSchema { - private static final SchemaStrategy STRATEGY_RICH = new SchemaStrategyRich(); + private static final SchemaStrategy SCHEMA_STRATEGY = SchemaStrategy.RICH; private final GqlvScenario scenario; public GqlvTopLevelQueryRichSchema(final Context context) { - super(STRATEGY_RICH, context); + super(SCHEMA_STRATEGY, context); var graphqlConfiguration = context.causewayConfiguration.getViewer().getGraphql(); if (graphqlConfiguration.isIncludeTestingFieldInRich()) { - addChildFieldFor(scenario = new GqlvScenario(STRATEGY_RICH, context)); + addChildFieldFor(scenario = new GqlvScenario(SCHEMA_STRATEGY, context)); } else { scenario = null; } @@ -30,7 +29,7 @@ public class GqlvTopLevelQueryRichSchema // the field is used if the schemaStyle is 'SIMPLE_AND_RICH', but is ignored/unused otherwise setField(newFieldDefinition() - .name(STRATEGY_RICH.topLevelFieldNameFrom(graphqlConfiguration)) + .name(SCHEMA_STRATEGY.topLevelFieldNameFrom(graphqlConfiguration)) .type(getGqlObjectType()) .build()); } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/SchemaStrategySimple.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/SchemaStrategySimple.java index b63399e901..fe7b004182 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/SchemaStrategySimple.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/SchemaStrategySimple.java @@ -16,7 +16,9 @@ import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvDomainSe import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvAction; import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvCollection; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMemberHolder; +import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvMeta; import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvProperty; +import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvTopLevelQuerySimpleSchema; public class SchemaStrategySimple implements SchemaStrategy { @@ -68,4 +70,10 @@ public class SchemaStrategySimple implements SchemaStrategy { ) { return new GqlvAction(holder, objectAction, context); } + + @Override + public GqlvAbstractCustom newGqlvMeta(GqlvDomainObject gqlvDomainObject, Context context) { + return new GqlvMeta(gqlvDomainObject, context); + } + } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForAction.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForAction.java index 9afe23cd43..ed121368e5 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForAction.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForAction.java @@ -32,8 +32,8 @@ import graphql.schema.GraphQLType; import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; -import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvAction; -import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvMetaSaveAs; +import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.springframework.lang.Nullable; @@ -158,7 +158,7 @@ public class GqlvMutationForAction extends GqlvAbstract { } else { String refValue = argumentValue.get("ref"); if (refValue != null) { - String key = GqlvMetaSaveAs.keyFor(refValue); + String key = GvqlActionUtils.keyFor(refValue); BookmarkedPojo value = ((Environment) environment).getGraphQlContext().get(key); result = Optional.of(value).map(BookmarkedPojo::getTargetPojo); } else { @@ -246,7 +246,7 @@ public class GqlvMutationForAction extends GqlvAbstract { private Can<ManagedObject> argumentManagedObjectsFor( final Environment dataFetchingEnvironment, final ObjectAction objectAction) { - return GqlvAction.argumentManagedObjectsFor(dataFetchingEnvironment, objectAction, context); + return GvqlActionUtils.argumentManagedObjectsFor(SchemaStrategy.SIMPLE, dataFetchingEnvironment, objectAction, context); } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForProperty.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForProperty.java index 7ebfc604d7..f47f730340 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForProperty.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForProperty.java @@ -39,7 +39,7 @@ import org.apache.causeway.viewer.graphql.model.domain.Environment; import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstract; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; -import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvMetaSaveAs; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.apache.causeway.viewer.graphql.model.exceptions.DisabledException; import org.apache.causeway.viewer.graphql.model.exceptions.HiddenException; import org.apache.causeway.viewer.graphql.model.exceptions.InvalidException; @@ -110,7 +110,7 @@ public class GqlvMutationForProperty extends GqlvAbstract { } else { String refValue = argumentValue1.get("ref"); if (refValue != null) { - String key = GqlvMetaSaveAs.keyFor(refValue); + String key = GvqlActionUtils.keyFor(refValue); BookmarkedPojo value = environment.getGraphQlContext().get(key); result = Optional.of(value).map(BookmarkedPojo::getTargetPojo); } else { diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvAction.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvAction.java index 447bfe5a23..068585661a 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvAction.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvAction.java @@ -18,15 +18,11 @@ */ package org.apache.causeway.viewer.graphql.model.domain.simple.query; -import java.util.List; -import java.util.Map; -import java.util.Optional; import java.util.stream.Collectors; import graphql.schema.GraphQLArgument; import graphql.schema.GraphQLFieldDefinition; -import org.apache.causeway.applib.services.bookmark.Bookmark; import org.apache.causeway.applib.services.bookmark.BookmarkService; import org.apache.causeway.commons.collections.Can; import org.apache.causeway.core.metamodel.object.ManagedObject; @@ -40,8 +36,9 @@ import org.apache.causeway.viewer.graphql.model.domain.Environment; import org.apache.causeway.viewer.graphql.model.domain.Parent; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; +import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMemberHolder; -import org.apache.causeway.viewer.graphql.model.fetcher.BookmarkedPojo; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.apache.causeway.viewer.graphql.model.types.TypeMapper; import lombok.val; @@ -115,141 +112,7 @@ public class GqlvAction final ObjectAction objectAction, final BookmarkService bookmarkService) { - return argumentManagedObjectsFor(dataFetchingEnvironment, objectAction, context); - } - - /** - * - * @param environment - * @param objectAction - * @param context - * @return - */ - public static Can<ManagedObject> argumentManagedObjectsFor( - final Environment environment, - final ObjectAction objectAction, - final Context context) { - Map<String, Object> argumentPojos = environment.getArguments(); - Can<ObjectActionParameter> parameters = objectAction.getParameters(); - return parameters - .map(oap -> { - final ObjectSpecification elementType = oap.getElementType(); - Object argumentValue = argumentPojos.get(oap.getId()); - Object pojoOrPojoList; - - switch (elementType.getBeanSort()) { - - case VALUE: - return adaptValue(oap, argumentValue, context); - - case ENTITY: - case VIEW_MODEL: - if (argumentValue == null) { - return ManagedObject.empty(elementType); - } - // fall through - - case ABSTRACT: - // if the parameter is abstract, we still attempt to figure out the arguments. - // the arguments will need to either use 'ref' or else both 'id' AND 'logicalTypeName' - if (argumentValue instanceof List) { - val argumentValueList = (List<Object>) argumentValue; - pojoOrPojoList = argumentValueList.stream() - .map(value -> asPojo(oap.getElementType(), value, environment, context)) - .filter(Optional::isPresent) - .map(Optional::get) - .collect(Collectors.toList()); - } else { - pojoOrPojoList = asPojo(oap.getElementType(), argumentValue, environment, context).orElse(null); - } - return ManagedObject.adaptParameter(oap, pojoOrPojoList); - - case COLLECTION: - case MANAGED_BEAN_CONTRIBUTING: - case VETOED: - case MANAGED_BEAN_NOT_CONTRIBUTING: - case MIXIN: - case UNKNOWN: - default: - throw new IllegalArgumentException(String.format( - "Cannot handle an input type for %s; beanSort is %s", elementType.getFullIdentifier(), elementType.getBeanSort())); - } - }); - } - - private static ManagedObject adaptValue( - final ObjectActionParameter oap, - final Object argumentValue, - final Context context) { - - val elementType = oap.getElementType(); - if (argumentValue == null) { - return ManagedObject.empty(elementType); - } - - val argPojo = context.typeMapper.unmarshal(argumentValue, elementType); - return ManagedObject.adaptParameter(oap, argPojo); - } - - - public static Optional<Object> asPojo( - final ObjectSpecification elementType, - final Object argumentValueObj, - final Environment environment, - final Context context - ) { - val argumentValue = (Map<String, String>) argumentValueObj; - - val refValue = argumentValue.get("ref"); - if (refValue != null) { - String key = GqlvMetaSaveAs.keyFor(refValue); - BookmarkedPojo bookmarkedPojo = environment.getGraphQlContext().get(key); - if (bookmarkedPojo == null) { - throw new IllegalArgumentException(String.format( - "Could not find object referenced '%s' in the execution context; was it saved previously using \"saveAs\" ?", refValue)); - } - val targetPojoClass = bookmarkedPojo.getTargetPojo().getClass(); - val targetPojoSpec = context.specificationLoader.loadSpecification(targetPojoClass); - if (targetPojoSpec == null) { - throw new IllegalArgumentException(String.format( - "The object referenced '%s' is not part of the metamodel (has class '%s')", - refValue, targetPojoClass.getCanonicalName())); - } - if (!elementType.isPojoCompatible(bookmarkedPojo.getTargetPojo())) { - throw new IllegalArgumentException(String.format( - "The object referenced '%s' has a type '%s' that is not assignable to the required type '%s'", - refValue, targetPojoSpec.getLogicalTypeName(), elementType.getLogicalTypeName())); - } - return Optional.of(bookmarkedPojo).map(BookmarkedPojo::getTargetPojo); - } - - val idValue = argumentValue.get("id"); - if (idValue != null) { - Class<?> paramClass = elementType.getCorrespondingClass(); - Optional<Bookmark> bookmarkIfAny; - if(elementType.isAbstract()) { - val logicalTypeName = argumentValue.get("logicalTypeName"); - if (logicalTypeName == null) { - throw new IllegalArgumentException(String.format( - "The 'logicalTypeName' is required along with the 'id', because the input type '%s' is abstract", - elementType.getLogicalTypeName())); - } - if(context.specificationLoader.specForLogicalTypeName(logicalTypeName).isEmpty()) { - throw new IllegalArgumentException(String.format( - "The 'logicalTypeName' of '%s' is unknown in the metamodel", - logicalTypeName)); - } - - bookmarkIfAny = Optional.of(Bookmark.forLogicalTypeNameAndIdentifier(logicalTypeName, idValue)); - } else { - bookmarkIfAny = context.bookmarkService.bookmarkFor(paramClass, idValue); - } - return bookmarkIfAny - .map(context.bookmarkService::lookup) - .filter(Optional::isPresent) - .map(Optional::get); - } - throw new IllegalArgumentException("Either 'id' or 'ref' must be specified for a DomainObject input type"); + return GvqlActionUtils.argumentManagedObjectsFor(SchemaStrategy.SIMPLE, dataFetchingEnvironment, objectAction, context); } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMeta.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMeta.java index 2e10020a99..0ad7ac091e 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMeta.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMeta.java @@ -35,14 +35,13 @@ import org.apache.causeway.core.metamodel.objectmanager.ObjectManager; import org.apache.causeway.viewer.graphql.model.context.Context; import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstractCustom; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; -import org.apache.causeway.viewer.graphql.model.mmproviders.ObjectSpecificationProvider; -import org.apache.causeway.viewer.graphql.model.mmproviders.SchemaTypeProvider; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMetaHolder; import lombok.val; public class GqlvMeta extends GqlvAbstractCustom { - private final Holder holder; + private final GqlvMetaHolder holder; private final GqlvMetaId metaId; private final GqlvMetaLogicalTypeName metaLogicalTypeName; private final GqlvMetaVersion metaVersion; @@ -56,7 +55,7 @@ public class GqlvMeta extends GqlvAbstractCustom { private final CausewayConfiguration.Viewer.Graphql graphqlConfiguration; public GqlvMeta( - final Holder holder, + final GqlvMetaHolder holder, final Context context ) { super(TypeNames.metaTypeNameFor(holder.getObjectSpecification(), holder.getSchemaType()), context); @@ -228,9 +227,4 @@ public class GqlvMeta extends GqlvAbstractCustom { } } - public interface Holder - extends ObjectSpecificationProvider, - SchemaTypeProvider { - - } } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaSaveAs.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaSaveAs.java index 4762a492f1..b8f8f682f1 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaSaveAs.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaSaveAs.java @@ -27,6 +27,7 @@ import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; import org.apache.causeway.viewer.graphql.model.context.Context; import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstract; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.apache.causeway.viewer.graphql.model.fetcher.BookmarkedPojo; public class GqlvMetaSaveAs extends GqlvAbstract { @@ -48,7 +49,7 @@ public class GqlvMetaSaveAs extends GqlvAbstract { protected Object fetchData(DataFetchingEnvironment environment) { String ref = environment.getArgument("ref"); GqlvMeta.Fetcher source = environment.getSource(); - String originalKey = keyFor(ref); + String originalKey = GvqlActionUtils.keyFor(ref); GraphQLContext graphQlContext = environment.getGraphQlContext(); // we ensure the key hasn't been used already @@ -61,8 +62,4 @@ public class GqlvMetaSaveAs extends GqlvAbstract { return ref; } - public static String keyFor(String ref) { - return GqlvMetaSaveAs.class.getName() + "#" + ref; - } - } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvTopLevelQuerySimpleSchema.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvTopLevelQuerySimpleSchema.java index de780e0942..b1c2e486e6 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvTopLevelQuerySimpleSchema.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvTopLevelQuerySimpleSchema.java @@ -1,26 +1,23 @@ package org.apache.causeway.viewer.graphql.model.domain.simple.query; -import lombok.val; - -import java.util.Map; - import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; 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.common.SchemaStrategy; -import org.apache.causeway.viewer.graphql.model.domain.simple.SchemaStrategySimple; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvDomainObject; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvDomainService; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvTopLevelQueryAbstractSchema; +import lombok.val; + public class GqlvTopLevelQuerySimpleSchema extends GqlvTopLevelQueryAbstractSchema { - private static final SchemaStrategy STRATEGY_SIMPLE = new SchemaStrategySimple(); + private static final SchemaStrategy SCHEMA_STRATEGY = SchemaStrategy.SIMPLE; public GqlvTopLevelQuerySimpleSchema(final Context context) { - super(STRATEGY_SIMPLE, context); + super(SCHEMA_STRATEGY, context); var graphqlConfiguration = context.causewayConfiguration.getViewer().getGraphql(); @@ -28,7 +25,7 @@ public class GqlvTopLevelQuerySimpleSchema // the field is used if the schemaStyle is 'SIMPLE_AND_RICH', but is ignored/unused otherwise setField(newFieldDefinition() - .name(STRATEGY_SIMPLE.topLevelFieldNameFrom(graphqlConfiguration)) + .name(SCHEMA_STRATEGY.topLevelFieldNameFrom(graphqlConfiguration)) .type(getGqlObjectType()) .build()); } diff --git a/viewers/graphql/test/src/test/resources/schema.gql b/viewers/graphql/test/src/test/resources/schema.gql index d8742a001b..8ddbaf62c8 100644 --- a/viewers/graphql/test/src/test/resources/schema.gql +++ b/viewers/graphql/test/src/test/resources/schema.gql @@ -183,53 +183,15 @@ type Scenario { } type ScenarioStep { - causeway_applib_DomainObjectList(object: rich__causeway_applib_DomainObjectList__gqlv_input): rich__causeway_applib_DomainObjectList - causeway_applib_FacetGroupNode(object: rich__causeway_applib_FacetGroupNode__gqlv_input): rich__causeway_applib_FacetGroupNode - causeway_applib_ParameterNode(object: rich__causeway_applib_ParameterNode__gqlv_input): rich__causeway_applib_ParameterNode - causeway_applib_PropertyNode(object: rich__causeway_applib_PropertyNode__gqlv_input): rich__causeway_applib_PropertyNode - causeway_applib_RoleMemento(object: rich__causeway_applib_RoleMemento__gqlv_input): rich__causeway_applib_RoleMemento - causeway_applib_TypeNode(object: rich__causeway_applib_TypeNode__gqlv_input): rich__causeway_applib_TypeNode - causeway_applib_UserMemento(object: rich__causeway_applib_UserMemento__gqlv_input): rich__causeway_applib_UserMemento causeway_applib_UserMenu: rich__causeway_applib_UserMenu - causeway_applib_node_ActionNode(object: rich__causeway_applib_node_ActionNode__gqlv_input): rich__causeway_applib_node_ActionNode - causeway_applib_node_CollectionNode(object: rich__causeway_applib_node_CollectionNode__gqlv_input): rich__causeway_applib_node_CollectionNode - causeway_applib_node_FacetAttrNode(object: rich__causeway_applib_node_FacetAttrNode__gqlv_input): rich__causeway_applib_node_FacetAttrNode - causeway_applib_node_FacetNode(object: rich__causeway_applib_node_FacetNode__gqlv_input): rich__causeway_applib_node_FacetNode causeway_conf_ConfigurationMenu: rich__causeway_conf_ConfigurationMenu - causeway_conf_ConfigurationProperty(object: rich__causeway_conf_ConfigurationProperty__gqlv_input): rich__causeway_conf_ConfigurationProperty - causeway_conf_ConfigurationViewmodel(object: rich__causeway_conf_ConfigurationViewmodel__gqlv_input): rich__causeway_conf_ConfigurationViewmodel - causeway_feat_ApplicationFeatureViewModel(object: rich__causeway_feat_ApplicationFeatureViewModel__gqlv_input): rich__causeway_feat_ApplicationFeatureViewModel - causeway_feat_ApplicationNamespace(object: rich__causeway_feat_ApplicationNamespace__gqlv_input): rich__causeway_feat_ApplicationNamespace - causeway_feat_ApplicationType(object: rich__causeway_feat_ApplicationType__gqlv_input): rich__causeway_feat_ApplicationType - causeway_feat_ApplicationTypeAction(object: rich__causeway_feat_ApplicationTypeAction__gqlv_input): rich__causeway_feat_ApplicationTypeAction - causeway_feat_ApplicationTypeCollection(object: rich__causeway_feat_ApplicationTypeCollection__gqlv_input): rich__causeway_feat_ApplicationTypeCollection - causeway_feat_ApplicationTypeMember(object: rich__causeway_feat_ApplicationTypeMember__gqlv_input): rich__causeway_feat_ApplicationTypeMember - causeway_feat_ApplicationTypeProperty(object: rich__causeway_feat_ApplicationTypeProperty__gqlv_input): rich__causeway_feat_ApplicationTypeProperty - causeway_schema_metamodel_v2_DomainClassDto(object: rich__causeway_schema_metamodel_v2_DomainClassDto__gqlv_input): rich__causeway_schema_metamodel_v2_DomainClassDto - causeway_security_LoginRedirect(object: rich__causeway_security_LoginRedirect__gqlv_input): rich__causeway_security_LoginRedirect causeway_security_LogoutMenu: rich__causeway_security_LogoutMenu - causeway_testing_fixtures_FixtureResult(object: rich__causeway_testing_fixtures_FixtureResult__gqlv_input): rich__causeway_testing_fixtures_FixtureResult - java_lang_Runnable(object: rich__java_lang_Runnable__gqlv_input): rich__java_lang_Runnable - java_util_Map(object: rich__java_util_Map__gqlv_input): rich__java_util_Map - java_util_SortedMap(object: rich__java_util_SortedMap__gqlv_input): rich__java_util_SortedMap - java_util_concurrent_Callable(object: rich__java_util_concurrent_Callable__gqlv_input): rich__java_util_concurrent_Callable - java_util_function_BiFunction(object: rich__java_util_function_BiFunction__gqlv_input): rich__java_util_function_BiFunction - java_util_function_Consumer(object: rich__java_util_function_Consumer__gqlv_input): rich__java_util_function_Consumer - java_util_function_Function(object: rich__java_util_function_Function__gqlv_input): rich__java_util_function_Function - java_util_stream_Stream(object: rich__java_util_stream_Stream__gqlv_input): rich__java_util_stream_Stream - org_apache_causeway_core_metamodel_inspect_model_MMNode(object: rich__org_apache_causeway_core_metamodel_inspect_model_MMNode__gqlv_input): rich__org_apache_causeway_core_metamodel_inspect_model_MMNode - org_apache_causeway_core_metamodel_inspect_model_MemberNode(object: rich__org_apache_causeway_core_metamodel_inspect_model_MemberNode__gqlv_input): rich__org_apache_causeway_core_metamodel_inspect_model_MemberNode - org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript(object: rich__org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript__gqlv_input): rich__org_apache_causeway_testing_fixtures_applib_fixturescripts_FixtureScript university_admin_AdminMenu: rich__university_admin_AdminMenu university_calc_Calculator: rich__university_calc_Calculator - university_dept_Department(object: rich__university_dept_Department__gqlv_input): rich__university_dept_Department university_dept_Departments: rich__university_dept_Departments - university_dept_DeptHead(object: rich__university_dept_DeptHead__gqlv_input): rich__university_dept_DeptHead university_dept_DeptHeads: rich__university_dept_DeptHeads university_dept_People: rich__university_dept_People - university_dept_Person(object: rich__university_dept_Person__gqlv_input): rich__university_dept_Person university_dept_Staff: rich__university_dept_Staff - university_dept_StaffMember(object: rich__university_dept_StaffMember__gqlv_input): rich__university_dept_StaffMember } type SimpleAndRich { @@ -5509,22 +5471,6 @@ type simple__causeway_schema_metamodel_v2_DomainClassDto__service__gqlv_property validate(service: Boolean): String } -type simple__causeway_schema_metamodel_v2_FacetHolder { - "Object metadata" - _meta: simple__causeway_schema_metamodel_v2_FacetHolder__gqlv_meta -} - -type simple__causeway_schema_metamodel_v2_FacetHolder__gqlv_meta { - cssClass: String - grid: String - icon: String - id: String! - layout: String - logicalTypeName: String! - saveAs(ref: String): String - title: String! -} - type simple__causeway_security_LoginRedirect { "Object metadata" _meta: simple__causeway_security_LoginRedirect__gqlv_meta @@ -8518,15 +8464,6 @@ input simple__causeway_schema_metamodel_v2_DomainClassDto__gqlv_input { ref: String } -input simple__causeway_schema_metamodel_v2_FacetHolder__gqlv_input { - "Use either 'id' or 'ref'; looks up an entity from the persistent data store, or if a view model, then recreates using the id as a memento of the object's state" - id: ID - "If object identified by 'id', then optionally specifies concrete type. This is only required if the parameter type defines a super class" - logicalTypeName: String - "Use either 'ref' or 'id'; looks up an object previously saved to the execution context using 'saveAs(ref: ...)'" - ref: String -} - input simple__causeway_security_LoginRedirect__gqlv_input { "Use either 'id' or 'ref'; looks up an entity from the persistent data store, or if a view model, then recreates using the id as a memento of the object's state" id: ID
