You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/05/24 07:02:06 UTC
[isis] branch master updated: ISIS-2513: Demo: add JPA support for
Tenanted
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new e9ba95b ISIS-2513: Demo: add JPA support for Tenanted
e9ba95b is described below
commit e9ba95ba8eb70876575f1227d9d9d263dc9529c4
Author: andi-huber <ah...@apache.org>
AuthorDate: Mon May 24 09:01:53 2021 +0200
ISIS-2513: Demo: add JPA support for Tenanted
---
.../src/main/java/demoapp/dom/DemoModuleJpa.java | 4 ++
.../secman/apptenancy/jpa/TenantedJpa.java | 84 ++++++++++++++++++++++
.../secman/apptenancy/jpa/TenantedJpaEntities.java | 40 +++++++++++
3 files changed, 128 insertions(+)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java
index 53a1fa7..c2abcfc 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/DemoModuleJpa.java
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Profile;
import org.apache.isis.extensions.commandlog.jpa.IsisModuleExtCommandLogJpa;
import org.apache.isis.persistence.jpa.eclipselink.IsisModuleJpaEclipselink;
+import demoapp.dom.services.extensions.secman.apptenancy.jpa.TenantedJpa;
import demoapp.dom.types.isis.blobs.jpa.IsisBlobJpa;
import demoapp.dom.types.isis.clobs.jpa.IsisClobJpa;
import demoapp.dom.types.isis.localresourcepaths.jpa.IsisLocalResourcePathJpa;
@@ -115,6 +116,9 @@ import demoapp.dom.types.primitive.shorts.jpa.PrimitiveShortJpa;
WrapperIntegerJpa.class,
WrapperShortJpa.class,
WrapperByteJpa.class,
+
+ TenantedJpa.class,
+
})
public class DemoModuleJpa {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/jpa/TenantedJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/jpa/TenantedJpa.java
new file mode 100644
index 0000000..8fdd669
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/jpa/TenantedJpa.java
@@ -0,0 +1,84 @@
+/*
+ * 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 demoapp.dom.services.extensions.secman.apptenancy.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.EntityListeners;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.springframework.context.annotation.Profile;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.annotation.Title;
+import org.apache.isis.persistence.jpa.applib.integration.JpaEntityInjectionPointResolver;
+
+import demoapp.dom.services.extensions.secman.apptenancy.persistence.TenantedEntity;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Profile("demo-jpa")
+//tag::class[]
+@Entity
+@Table(
+ schema = "demo",
+ name = "TenantedJpa"
+)
+@EntityListeners(JpaEntityInjectionPointResolver.class)
+@DomainObject(
+ objectType = "demo.TenantedEntity"
+)
+@NoArgsConstructor
+public class TenantedJpa
+ extends TenantedEntity {
+
+ public TenantedJpa(String name) {
+ this.name = name;
+ }
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @Title
+ @Property(editing = Editing.ENABLED)
+ @PropertyLayout(fieldSetId = "General", sequence = "1")
+ @Getter @Setter
+ private String name;
+
+ @Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(associateWith = "name", sequence = "1")
+ public TenantedJpa updateName(final String name) {
+ this.name = name;
+ return this;
+ }
+ public String default0UpdateName() {
+ return this.name;
+ }
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/jpa/TenantedJpaEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/jpa/TenantedJpaEntities.java
new file mode 100644
index 0000000..e121b59
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/jpa/TenantedJpaEntities.java
@@ -0,0 +1,40 @@
+/*
+ * 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 demoapp.dom.services.extensions.secman.apptenancy.jpa;
+
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Service;
+
+import demoapp.dom._infra.values.ValueHolderRepository;
+
+@Profile("demo-jpa")
+@Service
+public class TenantedJpaEntities
+extends ValueHolderRepository<String, TenantedJpa> {
+
+ protected TenantedJpaEntities() {
+ super(TenantedJpa.class);
+ }
+
+ @Override
+ protected TenantedJpa newDetachedEntity(String value) {
+ return new TenantedJpa(value);
+ }
+
+}
\ No newline at end of file