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 523b3cf23ce8174beaf7fc92f69e5456e210999b Author: danhaywood <[email protected]> AuthorDate: Thu Feb 22 21:05:31 2024 +0000 CAUSEWAY-3676: moves remaining GqlvMeta up to common --- .../domain/{simple => common}/query/GqlvMeta.java | 5 +- .../{simple => common}/query/GqlvMetaCssClass.java | 2 +- .../{simple => common}/query/GqlvMetaGrid.java | 2 +- .../{simple => common}/query/GqlvMetaIcon.java | 2 +- .../{simple => common}/query/GqlvMetaId.java | 2 +- .../{simple => common}/query/GqlvMetaLayout.java | 2 +- .../query/GqlvMetaLogicalTypeName.java | 2 +- .../{simple => common}/query/GqlvMetaTitle.java | 2 +- .../{simple => common}/query/GqlvMetaVersion.java | 2 +- .../model/domain/rich/SchemaStrategyRich.java | 7 +- .../graphql/model/domain/rich/query/GqlvMeta.java | 135 --------------------- .../model/domain/rich/query/GqlvMetaCssClass.java | 43 ------- .../model/domain/rich/query/GqlvMetaGrid.java | 43 ------- .../model/domain/rich/query/GqlvMetaIcon.java | 43 ------- .../model/domain/rich/query/GqlvMetaId.java | 44 ------- .../model/domain/rich/query/GqlvMetaLayout.java | 43 ------- .../domain/rich/query/GqlvMetaLogicalTypeName.java | 44 ------- .../model/domain/rich/query/GqlvMetaTitle.java | 44 ------- .../model/domain/rich/query/GqlvMetaVersion.java | 43 ------- .../model/domain/simple/SchemaStrategySimple.java | 6 +- .../test/schema/GqlSchema_print_IntegTest.java | 1 - 21 files changed, 11 insertions(+), 506 deletions(-) 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/common/query/GqlvMeta.java similarity index 93% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMeta.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMeta.java index 499fbe1b9f..a200872c06 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/common/query/GqlvMeta.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.schema.DataFetchingEnvironment; @@ -25,9 +25,6 @@ import org.apache.causeway.core.config.CausewayConfiguration; 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.domain.common.query.GqlvMetaFetcher; -import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMetaHolder; -import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMetaSaveAs; import lombok.val; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaCssClass.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaCssClass.java similarity index 96% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaCssClass.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaCssClass.java index a17c3de695..bbca91cbcc 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaCssClass.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaCssClass.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaGrid.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaGrid.java similarity index 96% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaGrid.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaGrid.java index efc4a59c0e..bf6bcf054b 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaGrid.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaGrid.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaIcon.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaIcon.java similarity index 96% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaIcon.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaIcon.java index ccd373c591..dd00666788 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaIcon.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaIcon.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaId.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaId.java similarity index 96% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaId.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaId.java index 3bae79df2b..af2a676dec 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaId.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaId.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaLayout.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaLayout.java similarity index 96% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaLayout.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaLayout.java index 34d188b7dc..681e2c9b43 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaLayout.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaLayout.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaLogicalTypeName.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaLogicalTypeName.java similarity index 96% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaLogicalTypeName.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaLogicalTypeName.java index 0de4985277..38a1b8cdbe 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaLogicalTypeName.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaLogicalTypeName.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaTitle.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaTitle.java similarity index 96% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaTitle.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaTitle.java index 1fb39f3e0e..3186c5c753 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaTitle.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaTitle.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaVersion.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaVersion.java similarity index 96% rename from viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaVersion.java rename to viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaVersion.java index 590a8d11b2..fb55642e9a 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvMetaVersion.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvMetaVersion.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.model.domain.simple.query; +package org.apache.causeway.viewer.graphql.model.domain.common.query; import graphql.Scalars; import graphql.schema.DataFetchingEnvironment; 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 81ff464708..e7c8745352 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 @@ -1,9 +1,6 @@ package org.apache.causeway.viewer.graphql.model.domain.rich; -import java.util.Map; - import org.apache.causeway.core.config.CausewayConfiguration; -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.OneToManyAssociation; import org.apache.causeway.core.metamodel.spec.feature.OneToOneAssociation; @@ -12,13 +9,11 @@ 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.common.SchemaStrategy; 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.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.common.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 { 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 deleted file mode 100644 index 87a57bc9eb..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMeta.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import java.util.Optional; - -import graphql.schema.DataFetchingEnvironment; - -import org.apache.causeway.applib.services.bookmark.Bookmark; -import org.apache.causeway.applib.services.bookmark.BookmarkService; -import org.apache.causeway.applib.services.metamodel.BeanSort; -import org.apache.causeway.core.config.CausewayConfiguration; -import org.apache.causeway.core.metamodel.facets.members.cssclass.CssClassFacet; -import org.apache.causeway.core.metamodel.facets.object.entity.EntityFacet; -import org.apache.causeway.core.metamodel.facets.object.layout.LayoutFacet; -import org.apache.causeway.core.metamodel.object.Bookmarkable; -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.TypeNames; -import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMetaFetcher; -import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMetaHolder; -import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMetaSaveAs; - -import lombok.val; - -public class GqlvMeta extends GqlvAbstractCustom { - - private final GqlvMetaHolder holder; - private final GqlvMetaId metaId; - private final GqlvMetaLogicalTypeName metaLogicalTypeName; - private final GqlvMetaVersion metaVersion; - private final GqlvMetaTitle metaTitle; - private final GqlvMetaIcon metaIcon; - private final GqlvMetaCssClass metaCssClass; - private final GqlvMetaLayout metaLayout; - private final GqlvMetaGrid metaGrid; - private final GqlvMetaSaveAs metaSaveAs; - - private final CausewayConfiguration.Viewer.Graphql graphqlConfiguration; - - public GqlvMeta( - final GqlvMetaHolder holder, - final Context context - ) { - super(TypeNames.metaTypeNameFor(holder.getObjectSpecification(), holder.getSchemaType()), context); - this.holder = holder; - - this.graphqlConfiguration = context.causewayConfiguration.getViewer().getGraphql(); - - if(isBuilt()) { - this.metaId = null; - this.metaLogicalTypeName = null; - this.metaVersion = null; - this.metaTitle = null; - this.metaIcon = null; - this.metaCssClass = null; - this.metaLayout = null; - this.metaGrid = null; - this.metaSaveAs = null; - return; - } - - addChildFieldFor(this.metaId = new GqlvMetaId(context)); - addChildFieldFor(this.metaLogicalTypeName = new GqlvMetaLogicalTypeName(context)); - addChildFieldFor(this.metaVersion = isEntity() ? new GqlvMetaVersion(context) : null); - addChildFieldFor(this.metaTitle = new GqlvMetaTitle(context)); - addChildFieldFor(this.metaCssClass = new GqlvMetaCssClass(context)); - addChildFieldFor(this.metaLayout = new GqlvMetaLayout(context)); - addChildFieldFor(this.metaSaveAs = new GqlvMetaSaveAs(context)); - - addChildFieldFor(this.metaIcon = isResourceNotForbidden() ? new GqlvMetaIcon(context) : null); - addChildFieldFor(this.metaGrid = isResourceNotForbidden() ? new GqlvMetaGrid(context) : null); - - val fieldName = graphqlConfiguration.getMetaData().getFieldName(); - buildObjectTypeAndField(fieldName, "Object metadata"); - } - - private boolean isResourceNotForbidden() { - return graphqlConfiguration.getResources().getResponseType() != CausewayConfiguration.Viewer.Graphql.ResponseType.FORBIDDEN; - } - - private boolean isEntity() { - return holder.getObjectSpecification().getBeanSort() == BeanSort.ENTITY; - } - - @Override - protected void addDataFetchersForChildren() { - if (metaId == null) { - // none of the fields will have been initialized - return; - } - metaId.addDataFetcher(this); - metaLogicalTypeName.addDataFetcher(this); - if (isEntity()) { - metaVersion.addDataFetcher(this); - } - metaTitle.addDataFetcher(this); - metaCssClass.addDataFetcher(this); - metaLayout.addDataFetcher(this); - metaSaveAs.addDataFetcher(this); - if (metaGrid != null) { - metaGrid.addDataFetcher(this); - } - if (metaIcon != null) { - metaIcon.addDataFetcher(this); - } - } - - @Override - public Object fetchData(final DataFetchingEnvironment environment) { - return context.bookmarkService.bookmarkFor(environment.getSource()) - .map(bookmark -> new GqlvMetaFetcher(bookmark, context.bookmarkService, context.objectManager, context.causewayConfiguration)) - .orElseThrow(); - } - - -} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaCssClass.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaCssClass.java deleted file mode 100644 index 69bf9eeab7..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaCssClass.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import graphql.Scalars; -import graphql.schema.DataFetchingEnvironment; - -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.GqlvMetaFetcher; - -public class GqlvMetaCssClass extends GqlvAbstract { - - public GqlvMetaCssClass(final Context context) { - super(context); - - setField(newFieldDefinition().name("cssClass").type(Scalars.GraphQLString).build()); - } - - @Override - protected String fetchData(DataFetchingEnvironment environment) { - return environment.<GqlvMetaFetcher>getSource().cssClass(); - } - -} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaGrid.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaGrid.java deleted file mode 100644 index 6326500dde..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaGrid.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import graphql.Scalars; -import graphql.schema.DataFetchingEnvironment; - -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.GqlvMetaFetcher; - -public class GqlvMetaGrid extends GqlvAbstract { - - public GqlvMetaGrid(final Context context) { - super(context); - - setField(newFieldDefinition().name("grid").type(Scalars.GraphQLString).build()); - } - - @Override - protected String fetchData(DataFetchingEnvironment environment) { - return environment.<GqlvMetaFetcher>getSource().grid(); - } - -} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaIcon.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaIcon.java deleted file mode 100644 index a4e10e298f..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaIcon.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import graphql.Scalars; -import graphql.schema.DataFetchingEnvironment; - -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.GqlvMetaFetcher; - -public class GqlvMetaIcon extends GqlvAbstract { - - public GqlvMetaIcon(final Context context) { - super(context); - - setField(newFieldDefinition().name("icon").type(Scalars.GraphQLString).build()); - } - - @Override - protected String fetchData(DataFetchingEnvironment environment) { - return environment.<GqlvMetaFetcher>getSource().icon(); - } - -} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaId.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaId.java deleted file mode 100644 index 977c124d95..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaId.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import graphql.Scalars; -import graphql.schema.DataFetchingEnvironment; - -import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; -import static graphql.schema.GraphQLNonNull.nonNull; - -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.GqlvMetaFetcher; - -public class GqlvMetaId extends GqlvAbstract { - - public GqlvMetaId(final Context context) { - super(context); - - setField(newFieldDefinition().name("id").type(nonNull(Scalars.GraphQLString)).build()); - } - - @Override - protected String fetchData(DataFetchingEnvironment environment) { - return environment.<GqlvMetaFetcher>getSource().id(); - } - -} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaLayout.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaLayout.java deleted file mode 100644 index fbf418fde6..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaLayout.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import graphql.Scalars; -import graphql.schema.DataFetchingEnvironment; - -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.GqlvMetaFetcher; - -public class GqlvMetaLayout extends GqlvAbstract { - - public GqlvMetaLayout(final Context context) { - super(context); - - setField(newFieldDefinition().name("layout").type(Scalars.GraphQLString).build()); - } - - @Override - protected String fetchData(DataFetchingEnvironment environment) { - return environment.<GqlvMetaFetcher>getSource().layout(); - } - -} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaLogicalTypeName.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaLogicalTypeName.java deleted file mode 100644 index 3e4c969168..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaLogicalTypeName.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import graphql.Scalars; -import graphql.schema.DataFetchingEnvironment; - -import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; -import static graphql.schema.GraphQLNonNull.nonNull; - -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.GqlvMetaFetcher; - -public class GqlvMetaLogicalTypeName extends GqlvAbstract { - - public GqlvMetaLogicalTypeName(final Context context) { - super(context); - - setField(newFieldDefinition().name("logicalTypeName").type(nonNull(Scalars.GraphQLString)).build()); - } - - @Override - protected String fetchData(DataFetchingEnvironment environment) { - return environment.<GqlvMetaFetcher>getSource().logicalTypeName(); - } - -} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaTitle.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaTitle.java deleted file mode 100644 index 00490327c4..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaTitle.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import graphql.Scalars; -import graphql.schema.DataFetchingEnvironment; - -import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; -import static graphql.schema.GraphQLNonNull.nonNull; - -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.GqlvMetaFetcher; - -public class GqlvMetaTitle extends GqlvAbstract { - - public GqlvMetaTitle(final Context context) { - super(context); - - setField(newFieldDefinition().name("title").type(nonNull(Scalars.GraphQLString)).build()); - } - - @Override - protected String fetchData(DataFetchingEnvironment environment) { - return environment.<GqlvMetaFetcher>getSource().title(); - } - -} diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaVersion.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaVersion.java deleted file mode 100644 index 5005a3506f..0000000000 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaVersion.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.causeway.viewer.graphql.model.domain.rich.query; - -import graphql.Scalars; -import graphql.schema.DataFetchingEnvironment; - -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.GqlvMetaFetcher; - -public class GqlvMetaVersion extends GqlvAbstract { - - public GqlvMetaVersion(final Context context) { - super(context); - - setField(newFieldDefinition().name("version").type(Scalars.GraphQLString).build()); - } - - @Override - protected String fetchData(DataFetchingEnvironment environment) { - return environment.<GqlvMetaFetcher>getSource().version(); - } - -} 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 49db064006..204ad82ad2 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 @@ -1,9 +1,6 @@ package org.apache.causeway.viewer.graphql.model.domain.simple; -import java.util.Map; - import org.apache.causeway.core.config.CausewayConfiguration; -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.OneToManyAssociation; import org.apache.causeway.core.metamodel.spec.feature.OneToOneAssociation; @@ -12,11 +9,10 @@ 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.common.SchemaStrategy; 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.GqlvMeta; 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; public class SchemaStrategySimple implements SchemaStrategy { diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/GqlSchema_print_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/GqlSchema_print_IntegTest.java index 03795a5be1..c9a076e763 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/GqlSchema_print_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/GqlSchema_print_IntegTest.java @@ -45,7 +45,6 @@ import static org.apache.causeway.commons.internal.assertions._Assert.assertNotN import lombok.val; @Transactional -@DirtiesContext public class GqlSchema_print_IntegTest extends CausewayViewerGraphqlTestModuleIntegTestAbstract { @Inject private CausewaySystemEnvironment causewaySystemEnvironment;
