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/01/24 19:53:42 UTC
(causeway) 02/09: CAUSEWAY-3676: deletes comments
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 1ba67f1828ea48ba06a3500580ddd3ba094861d7
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 24 09:01:05 2024 +0000
CAUSEWAY-3676: deletes comments
---
.../graphql/model/domain/GqlvDomainObject.java | 9 ---
.../graphql/model/domain/GqlvPropertySimple.java | 90 ----------------------
2 files changed, 99 deletions(-)
diff --git a/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java b/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
index f44848cfb8..0e7475df42 100644
--- a/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
+++ b/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainObject.java
@@ -64,7 +64,6 @@ public class GqlvDomainObject implements GqlvActionHolder, GqlvPropertyHolder, G
private final GraphQLObjectType.Builder gqlObjectTypeBuilder;
private final SortedMap<String, GqlvProperty> properties = new TreeMap<>();
-// private final SortedMap<String, GqlvPropertySimple> propertySimples = new TreeMap<>();
private final SortedMap<String, GqlvCollection> collections = new TreeMap<>();
private final Map<String, GqlvAction> safeActions = new TreeMap<>();
@@ -115,13 +114,6 @@ public class GqlvDomainObject implements GqlvActionHolder, GqlvPropertyHolder, G
}
private void addProperty(final OneToOneAssociation otoa) {
-// GqlvPropertySimple propertySimple = new GqlvPropertySimple(this, otoa, codeRegistryBuilder);
-// if (propertySimple.hasFieldDefinition()) {
-// String propertyId = propertySimple.getId();
-// if (!propertySimples.containsKey(propertyId)) {
-// propertySimples.put(propertyId, propertySimple);
-// }
-// }
GqlvProperty property = new GqlvProperty(this, otoa, codeRegistryBuilder, bookmarkService);
if (property.hasFieldDefinition()) {
String propertyId = property.getId();
@@ -176,7 +168,6 @@ public class GqlvDomainObject implements GqlvActionHolder, GqlvPropertyHolder, G
public void addDataFetchers() {
meta.addDataFetchers();
properties.forEach((id, property) -> property.addDataFetcher());
-// propertySimples.forEach((id, property) -> property.addDataFetcher());
collections.forEach((id, collection) -> collection.addDataFetcher());
safeActions.forEach((id, action) -> action.addDataFetcher());
mutations.addDataFetchers();
diff --git a/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvPropertySimple.java b/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvPropertySimple.java
deleted file mode 100644
index fc8d2aaf94..0000000000
--- a/incubator/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvPropertySimple.java
+++ /dev/null
@@ -1,90 +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;
-
-import org.springframework.lang.Nullable;
-
-import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
-import org.apache.causeway.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.causeway.viewer.graphql.model.util.TypeNames;
-
-import graphql.Scalars;
-import graphql.schema.GraphQLCodeRegistry;
-import graphql.schema.GraphQLFieldDefinition;
-import graphql.schema.GraphQLOutputType;
-import graphql.schema.GraphQLTypeReference;
-
-import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
-import static graphql.schema.GraphQLNonNull.nonNull;
-import static graphql.schema.GraphQLTypeReference.typeRef;
-
-public class GqlvPropertySimple extends GqlvAssociation<OneToOneAssociation, GqlvPropertyHolder> {
-
- public GqlvPropertySimple(
- final GqlvPropertyHolder domainObject,
- final OneToOneAssociation oneToOneAssociation,
- final GraphQLCodeRegistry.Builder codeRegistryBuilder
- ) {
- super(domainObject, oneToOneAssociation, fieldDefinition(domainObject, oneToOneAssociation), codeRegistryBuilder);
- }
-
- @Nullable private static GraphQLFieldDefinition fieldDefinition(
- final GqlvPropertyHolder domainObject,
- final OneToOneAssociation otoa) {
-
- GraphQLOutputType type = outputTypeFor(otoa);
-
- GraphQLFieldDefinition fieldDefinition = null;
- if (type != null) {
- fieldDefinition = newFieldDefinition()
- .name(otoa.getId())
- .type(type).build();
- domainObject.addField(fieldDefinition);
- }
- return fieldDefinition;
- }
-
- private static GraphQLOutputType outputTypeFor(final OneToOneAssociation otoa) {
- ObjectSpecification otoaObjectSpec = otoa.getElementType();
- switch (otoaObjectSpec.getBeanSort()) {
-
- case VIEW_MODEL:
- case ENTITY:
-
- GraphQLTypeReference fieldTypeRef = typeRef(TypeNames.objectTypeNameFor(otoaObjectSpec));
- return otoa.isOptional()
- ? fieldTypeRef
- : nonNull(fieldTypeRef);
-
- case VALUE:
-
- // todo: map ...
-
- return otoa.isOptional()
- ? Scalars.GraphQLString
- : nonNull(Scalars.GraphQLString);
- }
- return null;
- }
-
- public OneToOneAssociation getOneToOneAssociation() {
- return getObjectAssociation();
- }
-
-}