This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch jpa-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/isis-app-helloworld.git
The following commit(s) were added to refs/heads/jpa-SNAPSHOT by this push:
new 61f3b02 updates wrt changes to layout constants
61f3b02 is described below
commit 61f3b02ba7f144280a40f6d1162244d4d64c6d12
Author: Dan Haywood <[email protected]>
AuthorDate: Sun Jul 31 22:05:07 2022 +0100
updates wrt changes to layout constants
---
.../hello/dom/hwo/HelloWorldObject.columnOrder.txt | 2 +
.../modules/hello/dom/hwo/HelloWorldObject.java | 54 +++++++++++++++-------
.../hello/dom/hwo/HelloWorldObject.layout.xml | 7 +--
.../modules/hello/dom/hwo/HelloWorldObjects.java | 13 ++++--
4 files changed, 49 insertions(+), 27 deletions(-)
diff --git
a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.columnOrder.txt
b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.columnOrder.txt
new file mode 100644
index 0000000..a5606b1
--- /dev/null
+++
b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.columnOrder.txt
@@ -0,0 +1,2 @@
+name
+#notes
diff --git
a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.java
b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.java
index 5afb2cc..1d3bd7e 100644
--- a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.java
+++ b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.java
@@ -3,6 +3,17 @@ package domainapp.modules.hello.dom.hwo;
import java.util.Comparator;
import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EntityListeners;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.UniqueConstraint;
+import javax.persistence.Version;
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.ActionLayout;
@@ -12,6 +23,7 @@ import org.apache.isis.applib.annotation.PropertyLayout;
import org.apache.isis.applib.annotation.Publishing;
import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.annotation.Title;
+import org.apache.isis.applib.layout.LayoutConstants;
import org.apache.isis.applib.services.message.MessageService;
import org.apache.isis.applib.services.repository.RepositoryService;
import org.apache.isis.applib.services.title.TitleService;
@@ -20,28 +32,29 @@ import
org.apache.isis.persistence.jpa.applib.integration.IsisEntityListener;
import domainapp.modules.hello.types.Name;
import domainapp.modules.hello.types.Notes;
[email protected]
[email protected](
+@Entity
+@Table(
schema="hello",
name = "HelloWorldObject",
uniqueConstraints = {
- @javax.persistence.UniqueConstraint(name =
"HelloWorldObject__name__UNQ", columnNames = {"name"})
+ @UniqueConstraint(name = "HelloWorldObject__name__UNQ",
columnNames = {"name"})
}
)
[email protected](IsisEntityListener.class) // injection
support
-@DomainObject(logicalTypeName = "hello.HelloWorldObject",
entityChangePublishing = Publishing.ENABLED)
+@EntityListeners(IsisEntityListener.class) // injection support
+@Named("hello.HelloWorldObject")
+@DomainObject()
@DomainObjectLayout() // causes UI events to be triggered
public class HelloWorldObject implements Comparable<HelloWorldObject> {
protected HelloWorldObject(){}
- @javax.persistence.Id
- @javax.persistence.GeneratedValue(strategy =
javax.persistence.GenerationType.AUTO)
- @javax.persistence.Column(nullable = false, name = "id")
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(nullable = false, name = "id")
private Long id;
- @javax.persistence.Version
- @javax.persistence.Column(nullable = false, name = "version")
+ @Version
+ @Column(nullable = false, name = "version")
private int version;
@@ -50,12 +63,13 @@ public class HelloWorldObject implements
Comparable<HelloWorldObject> {
}
- @javax.persistence.Column(length = Name.MAX_LEN, nullable = false, name =
"name")
+
+ @Column(length = Name.MAX_LEN, nullable = false, name = "name")
private String name;
@Title(prepend = "Object: ")
@Name
- @PropertyLayout(fieldSetId = "identity", sequence = "1")
+ @PropertyLayout(fieldSetId = LayoutConstants.FieldSetId.IDENTITY, sequence
= "1")
public String getName() {
return name;
}
@@ -64,11 +78,12 @@ public class HelloWorldObject implements
Comparable<HelloWorldObject> {
}
- @javax.persistence.Column(length = Notes.MAX_LEN, nullable = true, name =
"notes")
+
+ @Column(length = Notes.MAX_LEN, nullable = true, name = "notes")
private String notes;
@Notes
- @PropertyLayout(fieldSetId = "details", sequence = "1")
+ @PropertyLayout(fieldSetId = LayoutConstants.FieldSetId.DETAILS, sequence
= "1")
public String getNotes() {
return notes;
}
@@ -77,6 +92,7 @@ public class HelloWorldObject implements
Comparable<HelloWorldObject> {
}
+
@Action(
semantics = SemanticsOf.IDEMPOTENT,
executionPublishing = Publishing.ENABLED
@@ -95,10 +111,12 @@ public class HelloWorldObject implements
Comparable<HelloWorldObject> {
}
+
@Action(
semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE
)
@ActionLayout(
+ fieldSetId = LayoutConstants.FieldSetId.IDENTITY,
describedAs = "Deletes this object from the database",
position = ActionLayout.Position.PANEL
)
@@ -108,6 +126,8 @@ public class HelloWorldObject implements
Comparable<HelloWorldObject> {
repositoryService.removeAndFlush(this);
}
+
+
@Override
public String toString() {
return getName();
@@ -119,8 +139,8 @@ public class HelloWorldObject implements
Comparable<HelloWorldObject> {
}
- @Inject @javax.persistence.Transient RepositoryService repositoryService;
- @Inject @javax.persistence.Transient TitleService titleService;
- @Inject @javax.persistence.Transient MessageService messageService;
+ @Inject @Transient RepositoryService repositoryService;
+ @Inject @Transient TitleService titleService;
+ @Inject @Transient MessageService messageService;
}
diff --git
a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.layout.xml
b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.layout.xml
index 019f38d..deaca8e 100644
--- a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.layout.xml
+++ b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.layout.xml
@@ -14,10 +14,7 @@
<bs3:tab name="Identity">
<bs3:row>
<bs3:col span="12">
- <c:fieldSet name="Identity" id="identity">
- <c:action id="clearHints"
position="PANEL_DROPDOWN"/>
- <c:action id="delete"
position="PANEL"/>
- </c:fieldSet>
+ <c:fieldSet name="Identity" id="identity"/>
</bs3:col>
</bs3:row>
</bs3:tab>
@@ -38,7 +35,7 @@
</bs3:tabGroup>
</bs3:col>
<bs3:col span="12">
- <c:fieldSet name="" id="details"/>
+ <c:fieldSet name="Details" id="details"/>
</bs3:col>
</bs3:row>
</bs3:col>
diff --git
a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObjects.java
b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObjects.java
index ad00415..2bb54dc 100644
--- a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObjects.java
+++ b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObjects.java
@@ -2,6 +2,10 @@ package domainapp.modules.hello.dom.hwo;
import java.util.List;
+import javax.annotation.Priority;
+import javax.inject.Inject;
+import javax.inject.Named;
+
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.ActionLayout;
import org.apache.isis.applib.annotation.DomainService;
@@ -14,16 +18,15 @@ import
org.apache.isis.applib.services.repository.RepositoryService;
import domainapp.modules.hello.types.Name;
-@DomainService(
- nature = NatureOfService.VIEW,
- logicalTypeName = "hello.HelloWorldObjects"
-)
[email protected](PriorityPrecedence.EARLY)
+@Named("hello.HelloWorldObjects")
+@DomainService(nature = NatureOfService.VIEW)
+@Priority(PriorityPrecedence.EARLY)
public class HelloWorldObjects {
private final RepositoryService repositoryService;
private final HelloWorldRepository helloWorldRepository;
+ @Inject
public HelloWorldObjects(
final RepositoryService repositoryService,
final HelloWorldRepository helloWorldRepository) {