diff --git a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/EntityConfig.java b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/EntityConfig.java index 3dfc5f2..c92fb7c 100644 --- a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/EntityConfig.java +++ b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/EntityConfig.java @@ -124,21 +124,16 @@ public class EntityConfig { private String uriPrefix = ""; - /** The HTTP method to use when creating a new entity. Default value: `PUT` */ - @Getter @Setter private String createMethod = "PUT"; + /** The HTTP method to use when creating a new entity. Default value: null (disabled) */ + @Getter @Setter private String createMethod; /** The API endpoint to use when creating a new entity. Default value: none */ @Getter @Setter private String createUri; - /** The HTTP method to use when updating an entity. Default value: `POST` */ - @Getter @Setter private String updateMethod = "POST"; + /** The HTTP method to use when updating an entity. Default value: null (disabled) */ + @Getter @Setter private String updateMethod; /** The API endpoint to use when updating an entity. Default value: none */ @Getter @Setter private String updateUri; - /** The HTTP method to use when searching entities. Default value: `POST` */ - @Getter @Setter private String searchMethod = "POST"; - /** The API endpoint to use when searching entities. Default value: none */ - @Getter @Setter private String searchUri; - /** * After using the `searchUri` to obtain some entities, the `searchFields` tells which fields should be * "columns" in the resulting data table. Fields not listed in `searchFields` will not be shown. @@ -151,8 +146,8 @@ public class EntityConfig { // AbstractEntityConfigsResource populates this, if the entity supports SQL queries @Getter @Setter private SqlViewField[] sqlViewFields; - /** The HTTP method to use when deleting an entity. Default value: `DELETE` */ - @Getter @Setter private String deleteMethod = "DELETE"; + /** The HTTP method to use when deleting an entity. Default value: null (disabled) */ + @Getter @Setter private String deleteMethod; @Setter private String deleteUri; /** The API endpoint to use when deleting an entity. Default value: Default value: the value of `updateUri` */ public String getDeleteUri() { return !empty(deleteUri) ? deleteUri : getUpdateUri(); } @@ -208,7 +203,6 @@ public class EntityConfig { updateWithAnnotation(clazz, clazz.getAnnotation(ECType.class)); updateWithAnnotation(clazz.getAnnotation(ECTypeList.class)); - updateWithAnnotation(clazz.getAnnotation(ECTypeSearch.class)); updateWithAnnotation(clazz.getAnnotation(ECTypeCreate.class)); updateWithAnnotation(clazz.getAnnotation(ECTypeUpdate.class)); updateWithAnnotation(clazz.getAnnotation(ECTypeDelete.class)); @@ -265,17 +259,6 @@ public class EntityConfig { return this; } - /** Update properties with values from the given annotation. Doesn't override existing non-empty values! */ - private EntityConfig updateWithAnnotation(ECTypeSearch annotation) { - if (annotation == null) return this; - - if (empty(searchFields)) setSearchFields(Arrays.asList(annotation.fields())); - if (empty(searchMethod)) setSearchMethod(annotation.method()); - if (empty(searchUri)) setSearchUri((annotation.uri().startsWith(":") ? "" : uriPrefix) + annotation.uri()); - - return this; - } - /** Update properties with values from the given annotation. Doesn't override existing non-empty values! */ private EntityConfig updateWithAnnotation(ECTypeCreate annotation) { if (annotation == null) return this; diff --git a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeCreate.java b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeCreate.java index c4874fa..a4c7a9b 100644 --- a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeCreate.java +++ b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeCreate.java @@ -7,6 +7,6 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface ECTypeCreate { - String method() default ""; - String uri(); + String method() default "PUT"; + String uri() default ""; } diff --git a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeDelete.java b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeDelete.java index 4e20d99..04721c1 100644 --- a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeDelete.java +++ b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeDelete.java @@ -7,6 +7,6 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface ECTypeDelete { - String method() default ""; + String method() default "DELETE"; String uri(); } diff --git a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeSearch.java b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeSearch.java deleted file mode 100644 index fb5638e..0000000 --- a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeSearch.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.cobbzilla.wizard.model.entityconfig.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -public @interface ECTypeSearch { - String[] fields() default {}; - String method() default ""; - String uri(); -} diff --git a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeUpdate.java b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeUpdate.java index f4f45b8..db8e630 100644 --- a/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeUpdate.java +++ b/wizard-common/src/main/java/org/cobbzilla/wizard/model/entityconfig/annotations/ECTypeUpdate.java @@ -7,6 +7,6 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface ECTypeUpdate { - String method() default ""; + String method() default "POST"; String uri(); }