You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/10/25 14:37:22 UTC

[isis] 08/08: ISIS-1632: updates to helloworld just for testing @Meta

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1632-meta-annotations
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 9d15b171115798a59f2493694664c38e8efcf7e4
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Oct 23 17:32:05 2017 +0100

    ISIS-1632: updates to helloworld just for testing @Meta
---
 .../main/java/domainapp/dom/annot/AreYouSure.java  | 39 ++++++++++++++++++++
 .../src/main/java/domainapp/dom/annot/Name.java    | 43 ++++++++++++++++++++++
 .../src/main/java/domainapp/dom/annot/Notes.java   | 39 ++++++++++++++++++++
 .../java/domainapp/dom/impl/HelloWorldObject.java  | 16 ++++----
 4 files changed, 128 insertions(+), 9 deletions(-)

diff --git a/example/application/helloworld/src/main/java/domainapp/dom/annot/AreYouSure.java b/example/application/helloworld/src/main/java/domainapp/dom/annot/AreYouSure.java
new file mode 100644
index 0000000..be22801
--- /dev/null
+++ b/example/application/helloworld/src/main/java/domainapp/dom/annot/AreYouSure.java
@@ -0,0 +1,39 @@
+/*
+ *  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 domainapp.dom.annot;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.Meta;
+import org.apache.isis.applib.annotation.SemanticsOf;
+
+@Meta
+@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
+@Inherited
+@Target({ ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AreYouSure {
+
+}
\ No newline at end of file
diff --git a/example/application/helloworld/src/main/java/domainapp/dom/annot/Name.java b/example/application/helloworld/src/main/java/domainapp/dom/annot/Name.java
new file mode 100644
index 0000000..c4fd1c5
--- /dev/null
+++ b/example/application/helloworld/src/main/java/domainapp/dom/annot/Name.java
@@ -0,0 +1,43 @@
+/*
+ *  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 domainapp.dom.annot;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Meta;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+
+@Meta
+@Property(editing = Editing.DISABLED)
+@Parameter(maxLength = 40)
+@ParameterLayout(named = "Name")
+@Inherited
+@Target({ ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Name {
+
+}
\ No newline at end of file
diff --git a/example/application/helloworld/src/main/java/domainapp/dom/annot/Notes.java b/example/application/helloworld/src/main/java/domainapp/dom/annot/Notes.java
new file mode 100644
index 0000000..22fad39
--- /dev/null
+++ b/example/application/helloworld/src/main/java/domainapp/dom/annot/Notes.java
@@ -0,0 +1,39 @@
+/*
+ *  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 domainapp.dom.annot;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Meta;
+import org.apache.isis.applib.annotation.Property;
+
+@Meta
+@Property(editing = Editing.ENABLED)
+@Inherited
+@Target({ ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Notes {
+
+}
\ No newline at end of file
diff --git a/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java b/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
index b8bbcfa..85123a7 100644
--- a/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
+++ b/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
@@ -29,10 +29,6 @@ import org.apache.isis.applib.annotation.Auditing;
 import org.apache.isis.applib.annotation.CommandReification;
 import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.applib.annotation.Editing;
-import org.apache.isis.applib.annotation.Parameter;
-import org.apache.isis.applib.annotation.ParameterLayout;
-import org.apache.isis.applib.annotation.Property;
 import org.apache.isis.applib.annotation.Publishing;
 import org.apache.isis.applib.annotation.SemanticsOf;
 import org.apache.isis.applib.annotation.Title;
@@ -40,6 +36,9 @@ import org.apache.isis.applib.services.message.MessageService;
 import org.apache.isis.applib.services.repository.RepositoryService;
 import org.apache.isis.applib.services.title.TitleService;
 
+import domainapp.dom.annot.AreYouSure;
+import domainapp.dom.annot.Name;
+import domainapp.dom.annot.Notes;
 import lombok.AccessLevel;
 
 @javax.jdo.annotations.PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "helloworld" )
@@ -62,20 +61,19 @@ public class HelloWorldObject implements Comparable<HelloWorldObject> {
 
     @javax.jdo.annotations.Column(allowsNull = "false", length = 40)
     @lombok.NonNull
-    @Property(editing = Editing.DISABLED)
+    @Name
     @Title(prepend = "Object: ")
     private String name;
 
 
     @javax.jdo.annotations.Column(allowsNull = "true", length = 4000)
-    @Property(editing = Editing.ENABLED)
+    @Notes
     private String notes;
 
 
     @Action(semantics = SemanticsOf.IDEMPOTENT, command = CommandReification.ENABLED, publishing = Publishing.ENABLED)
     public HelloWorldObject updateName(
-            @Parameter(maxLength = 40)
-            @ParameterLayout(named = "Name")
+            @Name
             final String name) {
         setName(name);
         return this;
@@ -86,7 +84,7 @@ public class HelloWorldObject implements Comparable<HelloWorldObject> {
     }
 
 
-    @Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
+    @AreYouSure
     public void delete() {
         final String title = titleService.titleOf(this);
         messageService.informUser(String.format("'%s' deleted", title));

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.