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 2018/06/03 12:10:43 UTC
[isis] branch master updated: ISIS-1742: new module
'transition-1-2' to ease the migration from Isis 1.16.x to 2.0.0
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 02bfd3a ISIS-1742: new module 'transition-1-2' to ease the migration from Isis 1.16.x to 2.0.0
02bfd3a is described below
commit 02bfd3af7c725acfdf001d8e7bc2ad20a7b31c0f
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun Jun 3 14:10:24 2018 +0200
ISIS-1742: new module 'transition-1-2' to ease the migration from Isis
1.16.x to 2.0.0
Task-Url: https://issues.apache.org/jira/browse/ISIS-1742
---
core/legacy/transition-1-2/.gitignore | 1 +
core/legacy/transition-1-2/pom.xml | 109 ++++
.../apache/isis/applib/DomainObjectContainer.java | 688 +++++++++++++++++++++
.../java/org/apache/isis/applib/filter/Filter.java | 51 ++
.../org/apache/isis/applib/filter/Filters.java | 108 ++++
.../services/eventbus/ActionDomainEvent.java | 223 +++++++
.../services/eventbus/CollectionDomainEvent.java | 151 +++++
.../services/eventbus/PropertyDomainEvent.java | 125 ++++
.../spec/feature/ObjectAssociationFilters.java | 256 ++++++++
9 files changed, 1712 insertions(+)
diff --git a/core/legacy/transition-1-2/.gitignore b/core/legacy/transition-1-2/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/core/legacy/transition-1-2/.gitignore
@@ -0,0 +1 @@
+/target-ide
diff --git a/core/legacy/transition-1-2/pom.xml b/core/legacy/transition-1-2/pom.xml
new file mode 100644
index 0000000..aa673aa
--- /dev/null
+++ b/core/legacy/transition-1-2/pom.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis</artifactId>
+ <version>${revision}</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>isis-core-transition-1-2</artifactId>
+
+ <name>Apache Isis Transition (1.16.x to 2.0.0)</name>
+ <description>
+ To ease migration from Apache Isis versions 1.16.x to 2.0.0.
+ </description>
+
+ <properties>
+ <jar-plugin.automaticModuleName>org.apache.isis.transition12</jar-plugin.automaticModuleName>
+ <git-plugin.propertiesDir>org/apache/isis/transition12</git-plugin.propertiesDir>
+ </properties>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <filtering>false</filtering>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+
+ <dependencies>
+
+ <!-- JDO API (non transient, provided by plugin) -->
+ <dependency>
+ <groupId>javax.jdo</groupId>
+ <artifactId>jdo-api</artifactId>
+ <version>${jdo-api.version}</version>
+ <!-- provided by plugins -->
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- LEGACY DEPENDENCY -->
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
+ <!-- CORE -->
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-runtime</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+
+ <!-- TEST DEPENDENCY -->
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <!-- whatever unittestsupport is dependent on, it should not be transitive -->
+ <exclusion>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git a/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/DomainObjectContainer.java b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
new file mode 100644
index 0000000..d4bf554
--- /dev/null
+++ b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
@@ -0,0 +1,688 @@
+/*
+ * 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.isis.applib;
+
+import static org.apache.isis.commons.internal.collections._Lists.lastElementIfAny;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.applib.query.Query;
+import org.apache.isis.applib.security.UserMemento;
+import org.apache.isis.applib.services.config.ConfigurationService;
+import org.apache.isis.applib.services.factory.FactoryService;
+import org.apache.isis.applib.services.i18n.TranslatableString;
+import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
+import org.apache.isis.applib.services.message.MessageService;
+import org.apache.isis.applib.services.metamodel.MetaModelService;
+import org.apache.isis.applib.services.registry.ServiceRegistry;
+import org.apache.isis.applib.services.repository.RepositoryService;
+import org.apache.isis.applib.services.title.TitleService;
+import org.apache.isis.applib.services.user.UserService;
+import org.apache.isis.applib.services.xactn.TransactionService;
+
+import com.google.common.base.Predicate;
+
+@DomainService(nature=NatureOfService.DOMAIN)
+@Deprecated
+public class DomainObjectContainer {
+
+ @Inject private RepositoryService repositoryService;
+ @Inject private MetaModelService metaModelService;
+ @Inject private IsisJdoSupport isisJdoSupport;
+ @Inject private FactoryService factoryService;
+ @Inject private TitleService titleService;
+ @Inject private TransactionService transactionService;
+ @Inject private ServiceRegistry serviceRegistry;
+ @Inject private MessageService messageService;
+ @Inject private ConfigurationService configurationService;
+ @Inject private UserService userService;
+
+ /**
+ * Return the title of the object, as rendered in the UI by the
+ * Isis viewers.
+ *
+ * @deprecated - use {@link TitleService#titleOf(Object)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public String titleOf(Object domainObject) {
+ return titleService.titleOf(domainObject);
+ }
+
+ /**
+ * Return the icon name of the object, as rendered in the UI by the
+ * Isis viewers.
+ *
+ * @deprecated - use {@link TitleService#iconNameOf(Object)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public String iconNameOf(Object domainObject) {
+ return titleService.iconNameOf(domainObject);
+ }
+
+ /**
+ * Re-initialises the fields of an object, using the
+ * JDO {@link javax.jdo.PersistenceManager#refresh(Object) refresh} API.
+ *
+ * <p>
+ * Previously this method was provided for manual control of lazy loading; with the JDO/DataNucleus objectstore
+ * that original functionality is performed automatically by the framework.
+ * </p>
+ *
+ * @deprecated - equivalent to {@link org.apache.isis.applib.services.jdosupport.IsisJdoSupport#refresh(Object)}.
+ */
+ @Programmatic
+ @Deprecated
+ public void resolve(Object domainObject) {
+ isisJdoSupport.refresh(domainObject);
+ }
+
+ /**
+ * Provided that the <tt>field</tt> parameter is <tt>null</tt>, re-initialises the fields of an object, using the
+ * JDO {@link javax.jdo.PersistenceManager#refresh(Object) refresh} API.
+ *
+ * <p>
+ * Previously this method was provided for manual control of lazy loading; with the JDO/DataNucleus objectstore
+ * that original functionality is performed automatically by the framework.
+ * </p>
+ *
+ * @deprecated - equivalent to {@link org.apache.isis.applib.services.jdosupport.IsisJdoSupport#refresh(Object)}.
+ */
+ @Programmatic
+ @Deprecated
+ public void resolve(Object domainObject, Object field) {
+ resolve(domainObject);
+ }
+
+ /**
+ * This method does nothing (is a no-op).
+ *
+ * <p>
+ * Previous this method was provided for manual control of object dirtyng; with the JDO/DataNucleus objectstore
+ * that original functionality is performed automatically by the framework.
+ * </p>
+ *
+ * @deprecated - is a no-op
+ */
+ @Programmatic
+ @Deprecated
+ public void objectChanged(Object domainObject) {
+ // do nothing
+ }
+
+
+ /**
+ * Flush all changes to the object store.
+ *
+ * <p>
+ * Occasionally useful to ensure that newly persisted domain objects
+ * are flushed to the database prior to a subsequent repository query.
+ *
+ * @return - is never used, always returns <tt>false</tt>.
+ *
+ * @deprecated - use {@link TransactionService#flushTransaction()}.
+ */
+ @Programmatic
+ @Deprecated
+ public boolean flush() {
+ transactionService.flushTransaction();
+ return false;
+ }
+
+ /**
+ * Commit all changes to the object store.
+ *
+ * <p>
+ * This has been deprecated because the demarcation of transaction
+ * boundaries is a framework responsibility rather than being a
+ * responsibility of the domain object model.
+ *
+ * @deprecated
+ */
+ @Programmatic
+ @Deprecated
+ public void commit() {
+ // do nothing
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.factory.FactoryService#instantiate(Class)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T newTransientInstance(final Class<T> ofType) {
+ return factoryService.instantiate(ofType);
+ }
+
+ /**
+ * Create a new {@link ViewModel} instance of the specified type, initializing with the specified memento.
+ *
+ * <p>
+ * Rather than use this constructor it is generally preferable to simply instantiate a
+ * class annotated with {@link org.apache.isis.applib.annotation.ViewModel annotation}.
+ * If services need injecting into it, use {@link #injectServicesInto(Object)}.
+ * </p>
+ */
+ @Programmatic
+ public <T> T newViewModelInstance(final Class<T> ofType, final String memento) {
+ if(memento!=null) {
+ throw new IllegalArgumentException("parameter 'memento' is no longer supported");
+ }
+ T obj = factoryService.instantiate(ofType);
+ serviceRegistry.injectServicesInto(obj);
+ return obj;
+ }
+
+ /**
+ * @deprecated - not supported, will throw a RuntimeException
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T newAggregatedInstance(Object parent, Class<T> ofType) {
+ throw new RuntimeException("method no longer supported");
+ }
+
+ /**
+ * (Deprecated) returns a new instance of the specified class that will have been
+ * persisted.
+ *
+ * @deprecated - in almost all cases the workflow is to {@link #newTransientInstance(Class)}, populate the object
+ * (eg with the arguments to an action) and then to
+ * {@link #persist(Object) persist) the object. It is exceptionally rare for
+ * an object to be created, and with no further data required - be in a state
+ * to be persisted immediately.
+ */
+ @Programmatic
+ @Deprecated
+ public <T> T newPersistentInstance(final Class<T> ofType) {
+ throw new RuntimeException("method no longer supported");
+ }
+
+ /**
+ * Returns a new instance of the specified class that has the same persisted
+ * state (either transient or persisted) as the provided object.
+ *
+ * <p>
+ * This method has been deprecated because it is a rare use case, causing
+ * unnecessary interface bloat for very little gain.
+ * <p></p>
+ *
+ * @deprecated
+ */
+ @Programmatic
+ @Deprecated
+ public <T> T newInstance(final Class<T> ofType, final Object object) {
+ throw new RuntimeException("method no longer supported");
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.factory.FactoryService#mixin(Class, Object)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T mixin( Class<T> mixinClass, Object mixedIn) {
+ return factoryService.mixin(mixinClass, mixedIn);
+ }
+
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.registry.ServiceRegistry#injectServicesInto(Object)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T injectServicesInto(final T domainObject) {
+ return serviceRegistry.injectServicesInto(domainObject);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.registry.ServiceRegistry#lookupService(Class)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T lookupService(Class<T> service) {
+ return serviceRegistry.lookupService(service);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.registry.ServiceRegistry#lookupServices(Class)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> Iterable<T> lookupServices(Class<T> service){
+ return serviceRegistry.lookupServices(service);
+ }
+
+ /**
+ * Whether the object is in a valid state, that is that none of the
+ * validation of properties, collections and object-level is vetoing.
+ *
+ * @see #validate(Object)
+ */
+ @Programmatic
+ public boolean isValid(Object domainObject) {
+ throw new RuntimeException("method no longer supported");
+ }
+
+ /**
+ * The reason, if any why the object is in a invalid state
+ *
+ * <p>
+ * Checks the validation of all of the properties, collections and
+ * object-level.
+ * </p>
+ *
+ * @see #isValid(Object)
+ */
+ public @Programmatic
+ String validate(Object domainObject) {
+ throw new RuntimeException("method no longer supported");
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.metamodel.MetaModelService#sortOf(Class, MetaModelService.Mode)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public boolean isViewModel(Object domainObject) {
+ return metaModelService.sortOf(domainObject.getClass(), MetaModelService.Mode.RELAXED).isViewModel();
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#isPersistent(Object)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public boolean isPersistent(Object domainObject) {
+ return repositoryService.isPersistent(domainObject);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#persist(Object)} instead. Please note that {@link org.apache.isis.applib.services.repository.RepositoryService#persist(Object)} will not throw an exception if the Domain Object is already persistent, so the implementation will be the same as that of {@link org.apache.isis.applib.services.repository.RepositoryService#persist(Object)}instead.
+ */
+ @Deprecated
+ @Programmatic
+ public void persist(Object domainObject) {
+ repositoryService.persist(domainObject);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#persist(Object)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public void persistIfNotAlready(Object domainObject) {
+ repositoryService.persist(domainObject);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#remove(Object)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public void remove(Object persistentDomainObject) {
+ repositoryService.remove(persistentDomainObject);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#remove(Object)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public void removeIfNotAlready(Object domainObject) {
+ repositoryService.remove(domainObject);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.message.MessageService#informUser(String)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public void informUser(String message) {
+ messageService.informUser(message);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.message.MessageService#informUser(TranslatableString, Class, String)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public String informUser(TranslatableString message, final Class<?> contextClass, final String contextMethod) {
+ return messageService.informUser(message, contextClass, contextMethod);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.message.MessageService#warnUser(String)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public void warnUser(String message) {
+ messageService.warnUser(message);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.message.MessageService#warnUser(TranslatableString, Class, String)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public String warnUser(TranslatableString message, final Class<?> contextClass, final String contextMethod) {
+ return messageService.warnUser(message, contextClass, contextMethod);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.message.MessageService#raiseError(String)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public void raiseError(String message) {
+ messageService.raiseError(message);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.message.MessageService#raiseError(TranslatableString, Class, String)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public String raiseError(TranslatableString message, final Class<?> contextClass, final String contextMethod) {
+ return messageService.raiseError(message, contextClass, contextMethod);
+ }
+
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.config.ConfigurationService#getProperty(String)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public String getProperty(String name) {
+ return configurationService.getProperty(name);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.config.ConfigurationService#getProperty(String, String)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public String getProperty(String name, String defaultValue) {
+ return configurationService.getProperty(name, defaultValue);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.config.ConfigurationService#getPropertyNames()} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public List<String> getPropertyNames() {
+ return configurationService.getPropertyNames();
+ }
+
+ /**
+ * @deprecated - use {@link UserService#getUser()} instead
+ */
+ @Deprecated
+ @Programmatic
+ public UserMemento getUser() {
+ return userService.getUser();
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#allInstances(Class, long...)} instead
+ */
+ @Deprecated
+ @Programmatic
+ public <T> List<T> allInstances(Class<T> ofType, long... range){
+ return repositoryService.allInstances(ofType, range);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#allMatches(Class, Predicate, long...)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> List<T> allMatches(final Class<T> ofType, final Predicate<? super T> predicate, long... range){
+ return repositoryService.allMatches(ofType, predicate::apply, range);
+ }
+
+ /**
+ * @deprecated - use {@link #allMatches(Class, Predicate, long...)} or (better) {@link #allMatches(Query)} instead
+ */
+ @Deprecated
+ @Programmatic
+ public <T> List<T> allMatches(final Class<T> ofType, final Filter<? super T> filter, long... range) {
+ return repositoryService.allMatches(ofType, filter::accept, range);
+ }
+
+ /**
+ * Returns all the instances of the specified type (including subtypes) that
+ * have the given title.
+ * If the optional range parameters are used, the dataset returned starts
+ * from (0 based) index, and consists of only up to count items.
+ *
+ * <p>
+ * If there are no instances the list will be empty. This method creates a
+ * new {@link List} object each time it is called so the caller is free to
+ * use or modify the returned {@link List}, but the changes will not be
+ * reflected back to the repository.
+ * </p>
+ *
+ * <p>
+ * This method is useful during exploration/prototyping, but - because the filtering is performed client-side -
+ * this method is only really suitable for initial development/prototyping, or for classes with very few
+ * instances. Use {@link #allMatches(Query)} for production code.
+ * </p>
+ *
+ * @param range 2 longs, specifying 0-based start and count.
+ *
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#allMatches(Class, Predicate, long...)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> List<T> allMatches(Class<T> ofType, String title, long... range) {
+ return repositoryService.allMatches(ofType, obj->title.equals(titleService.titleOf(obj)), range);
+ }
+
+ /**
+ * Returns all the instances of the specified type (including subtypes) that
+ * match the given object: where any property that is set will be tested and
+ * properties that are not set will be ignored.
+ * If the optional range parameters are used, the dataset returned starts
+ * from (0 based) index, and consists of only up to count items.
+ *
+ * <p>
+ * If there are no instances the list will be empty. This method creates a
+ * new {@link List} object each time it is called so the caller is free to
+ * use or modify the returned {@link List}, but the changes will not be
+ * reflected back to the repository.
+ * </p>
+ *
+ * <p>
+ * This method is useful during exploration/prototyping, but - because the filtering is performed client-side -
+ * this method is only really suitable for initial development/prototyping, or for classes with very few
+ * instances. Use {@link #allMatches(Query)} for production code.
+ * </p>
+ *
+ * @param range 2 longs, specifying 0-based start and count.
+ *
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#allMatches(Class, Predicate, long...)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> List<T> allMatches(Class<T> ofType, T pattern, long... range) {
+ throw new RuntimeException("method no longer supported");
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#allMatches(Query)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> List<T> allMatches(Query<T> query) {
+ return repositoryService.allMatches(query);
+ }
+
+ // //////////////////////////////////////
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#firstMatch(Class, Predicate)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T firstMatch(final Class<T> ofType, final Predicate<T> predicate) {
+ return lastElementIfAny(repositoryService.allMatches(ofType, predicate::apply, 0L, 1L));
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#firstMatch(Class, Predicate)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T firstMatch(final Class<T> ofType, final Filter<T> filter) {
+ return lastElementIfAny(repositoryService.allMatches(ofType, filter::accept, 0L, 1L));
+ }
+
+ /**
+ * Returns the first instance of the specified type (including subtypes)
+ * that matches the supplied title, or <tt>null</tt> if none.
+ *
+ * <p>
+ * This method is useful during exploration/prototyping, but - because the filtering is performed client-side -
+ * this method is only really suitable for initial development/prototyping, or for classes with very few
+ * instances. Use {@link #firstMatch(Query)} for production code.
+ * </p>
+ *
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#firstMatch(Class, Predicate)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T firstMatch(Class<T> ofType, String title) {
+ return lastElementIfAny(repositoryService.allMatches(ofType, obj->title.equals(titleService.titleOf(obj)), 0L, 1L));
+ }
+
+ /**
+ * Returns the first instance of the specified type (including subtypes)
+ * that matches the supplied object as a pattern, or <tt>null</tt> if none.
+ *
+ * <p>
+ * This method is useful during exploration/prototyping, but - because the filtering is performed client-side -
+ * this method is only really suitable for initial development/prototyping, or for classes with very few
+ * instances. Use {@link #firstMatch(Query)} for production code.
+ * </p>
+ *
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#firstMatch(Class, Predicate)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T firstMatch(Class<T> ofType, T pattern) {
+ throw new RuntimeException("method no longer supported");
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#firstMatch(Query)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T firstMatch(Query<T> query) {
+ Iterator<T> it = repositoryService.allMatches(query).iterator();
+ return it.hasNext() ? it.next() : null;
+ }
+
+ // //////////////////////////////////////
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#uniqueMatch(Class, Predicate)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T uniqueMatch(final Class<T> ofType, final Predicate<T> predicate) {
+ return repositoryService.uniqueMatch(ofType, predicate::apply);
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#uniqueMatch(Class, Predicate)} instead.
+ */
+ @Programmatic
+ @Deprecated
+ public <T> T uniqueMatch(final Class<T> ofType, final Filter<T> filter) {
+ return repositoryService.uniqueMatch(ofType, filter::accept);
+ }
+
+ /**
+ * Find the only instance of the specified type (including subtypes) that
+ * has the specified title.
+ *
+ * <p>
+ * If no instance is found then <tt>null</tt> will be returned, while if
+ * there is more that one instances a run-time exception will be thrown.
+ *
+ * <p>
+ * This method is useful during exploration/prototyping, but - because the filtering is performed client-side -
+ * this method is only really suitable for initial development/prototyping, or for classes with very few
+ * instances. Use {@link #uniqueMatch(Query)} for production code.
+ * </p>
+ *
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#uniqueMatch(Class, Predicate)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T uniqueMatch(Class<T> ofType, String title) {
+ return repositoryService.uniqueMatch(ofType, obj->title.equals(titleService.titleOf(obj)));
+ }
+
+ /**
+ * Find the only instance of the patterned object type (including subtypes)
+ * that matches the set fields in the pattern object: where any property
+ * that is set will be tested and properties that are not set will be
+ * ignored.
+ *
+ * <p>
+ * If no instance is found then null will be return, while if there is more
+ * that one instances a run-time exception will be thrown.
+ * </p>
+ *
+ * <p>
+ * This method is useful during exploration/prototyping, but - because the filtering is performed client-side -
+ * this method is only really suitable for initial development/prototyping, or for classes with very few
+ * instances. Use {@link #uniqueMatch(Query)} for production code.
+ * </p>
+ *
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#uniqueMatch(Class, Predicate)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T uniqueMatch(Class<T> ofType, T pattern) {
+ throw new RuntimeException("method no longer supported");
+ }
+
+ /**
+ * @deprecated - use {@link org.apache.isis.applib.services.repository.RepositoryService#uniqueMatch(Query)} instead.
+ */
+ @Deprecated
+ @Programmatic
+ public <T> T uniqueMatch(Query<T> query) {
+ return repositoryService.uniqueMatch(query);
+ }
+
+
+}
diff --git a/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/filter/Filter.java b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/filter/Filter.java
new file mode 100644
index 0000000..cc1edb8
--- /dev/null
+++ b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/filter/Filter.java
@@ -0,0 +1,51 @@
+/*
+ * 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.isis.applib.filter;
+
+import com.google.common.base.Predicate;
+
+
+/**
+ * For use by repository implementations to allow a set of objects returned by a
+ * back-end objectstore to be filtered before being returned to the caller.
+ *
+ * <p>
+ * Note that this is different from the pattern or criteria object accepted by
+ * some repositories' <tt>findXxx</tt> methods. Such criteria objects are
+ * implementation-specific to the configured objectstore and allow it to return
+ * an already-filtered set of rows. (For example, a Hibernate-based ObjectStore
+ * would accept a representation of a HQL query; an XML-based objectstore might
+ * accept an XPath query, etc.)
+ *
+ * @deprecated - use {@link Predicate} instead.
+ */
+@Deprecated
+public interface Filter<T> {
+
+ /**
+ * Whether or not the supplied pojo meets this criteria.
+ *
+ * @param pojo
+ * @return <tt>true</tt> if this pojo is acceptable, <tt>false</tt>
+ * otherwise.
+ */
+ public boolean accept(T t);
+
+}
diff --git a/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/filter/Filters.java b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/filter/Filters.java
new file mode 100644
index 0000000..ec840d5
--- /dev/null
+++ b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/filter/Filters.java
@@ -0,0 +1,108 @@
+/*
+ * 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.isis.applib.filter;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+/**
+ * @deprecated - use {@link Predicate} and {@link Predicates} instead.
+ */
+@Deprecated
+public final class Filters {
+
+ private Filters() {
+ }
+
+ @SafeVarargs
+ public static <T> Filter<T> and(final Filter<T>... filters) {
+ return new Filter<T>() {
+ @Override
+ public boolean accept(final T f) {
+ for(final Filter<T> filter: filters) {
+ if(!filter.accept(f)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+ }
+
+ @SafeVarargs
+ public static <T> Filter<T> or(final Filter<T>... filters) {
+ return new Filter<T>() {
+ @Override
+ public boolean accept(final T f) {
+ for(final Filter<T> filter: filters) {
+ if(filter.accept(f)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ }
+
+ public static <T> Filter<T> not(final Filter<T> f1) {
+ return new Filter<T>() {
+ @Override
+ public boolean accept(final T f) {
+ return !f1.accept(f);
+ }
+ };
+ }
+
+ public static <T> Filter<T> any() {
+ return new Filter<T>() {
+ @Override
+ public boolean accept(final T t) {
+ return true;
+ }
+ };
+ }
+
+ public final static <T> Filter<T> anyOfType(final Class<T> clazz) {
+ return any();
+ }
+
+ public static <T> Filter<T> none() {
+ return new Filter<T>() {
+ @Override
+ public boolean accept(final T f) {
+ return false;
+ }
+ };
+ }
+
+ public static <T> Filter<T> noneOfType(final Class<T> clazz) {
+ return none();
+ }
+
+ public static <T> Predicate<T> asPredicate(final Filter<T> filter) {
+ return new Predicate<T>() {
+ @Override
+ public boolean apply(T candidate) {
+ return filter.accept(candidate);
+ }
+ };
+ }
+
+}
diff --git a/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java
new file mode 100644
index 0000000..e857451
--- /dev/null
+++ b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java
@@ -0,0 +1,223 @@
+/*
+ * 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.isis.applib.services.eventbus;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.events.domain.AbstractDomainEvent;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.services.command.CommandContext;
+import org.apache.isis.applib.util.ObjectContracts;
+import org.apache.isis.applib.util.ToString;
+
+@Deprecated
+public abstract class ActionDomainEvent<S> extends AbstractDomainEvent<S> {
+
+ private static final long serialVersionUID = 1L;
+
+ // -- Default class
+ /**
+ * This class is the default for the
+ * {@link org.apache.isis.applib.annotation.Action#domainEvent()} annotation attribute. Whether this
+ * raises an event or not depends upon the "isis.reflector.facet.actionAnnotation.domainEvent.postForDefault"
+ * configuration property.
+ */
+ public static class Default extends ActionDomainEvent<Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+ // -- Noop class
+
+ /**
+ * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
+ * property setting for the {@link Default} event.
+ */
+ public static class Noop extends ActionDomainEvent<Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+ // -- Doop class
+
+ /**
+ * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
+ * property setting for the {@link Default} event..
+ */
+ public static class Doop extends ActionDomainEvent<Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+
+ /**
+ * If used then the framework will set state via (non-API) setters.
+ *
+ * <p>
+ * Recommended because it reduces the amount of boilerplate in the domain object classes.
+ * </p>
+ */
+ public ActionDomainEvent() {
+ }
+
+ // -- command
+ private Command command;
+
+ /**
+ * @deprecated - use {@link CommandContext#getCommand()} to obtain the current {@link Command}.
+ */
+ @Deprecated
+ public Command getCommand() {
+ return command;
+ }
+
+ /**
+ * Not API - set by the framework.
+ *
+ * @deprecated - the corresponding {@link #getCommand()} should not be called, instead use {@link CommandContext#getCommand()} to obtain the current {@link Command}.
+ */
+ @Deprecated
+ public void setCommand(Command command) {
+ this.command = command;
+ }
+
+
+ // -- actionSemantics
+ public SemanticsOf getSemantics() {
+ return actionSemantics;
+ }
+
+ private SemanticsOf actionSemantics;
+
+ /**
+ * @deprecated - use {@link #getSemantics()} instead.
+ */
+ @Deprecated
+ public SemanticsOf getActionSemantics() {
+ return actionSemantics;
+ }
+
+ /**
+ * Not API - set by the framework.
+ */
+ public void setActionSemantics(SemanticsOf actionSemantics) {
+ this.actionSemantics = actionSemantics;
+ }
+
+
+
+ // -- parameterNames
+ private List<String> parameterNames;
+ public List<String> getParameterNames() {
+ return parameterNames;
+ }
+ public void setParameterNames(final List<String> parameterNames) {
+ this.parameterNames = parameterNames;
+ }
+
+
+ // -- parameterTypes
+ private List<Class<?>> parameterTypes;
+ public List<Class<?>> getParameterTypes() {
+ return parameterTypes;
+ }
+
+ public void setParameterTypes(final List<Class<?>> parameterTypes) {
+ this.parameterTypes = parameterTypes;
+ }
+
+
+
+ // region > mixedIn
+ private Object mixedIn;
+
+ /**
+ * Populated only for mixins; holds the underlying domain object that the mixin contributes to.
+ */
+ public Object getMixedIn() {
+ return mixedIn;
+ }
+ /**
+ * Not API - set by the framework.
+ */
+ public void setMixedIn(final Object mixedIn) {
+ this.mixedIn = mixedIn;
+ }
+ // endregion
+
+ // -- arguments
+ private List<Object> arguments;
+ /**
+ * The arguments being used to invoke the action; populated at {@link Phase#VALIDATE} and subsequent phases
+ * (but null for {@link Phase#HIDE hidden} and {@link Phase#DISABLE disable} phases).
+ */
+ public List<Object> getArguments() {
+ return arguments;
+ }
+
+ /**
+ * Not API - set by the framework.
+ */
+ public void setArguments(List<Object> arguments) {
+ this.arguments = arguments;
+ }
+
+
+ // -- returnValue
+ /**
+ *
+ */
+ private Object returnValue;
+
+ /**
+ * The value returned by the action.
+ *
+ * <p>
+ * Only available for the {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#EXECUTED}
+ * {@link #getEventPhase() phase}.
+ * </p>
+ */
+ public Object getReturnValue() {
+ return returnValue;
+ }
+
+ /**
+ * Not API - set by the framework
+ */
+ public void setReturnValue(final Object returnValue) {
+ this.returnValue = returnValue;
+ }
+
+
+
+ private final static ToString<ActionDomainEvent<?>> toString = ObjectContracts.<ActionDomainEvent<?>>
+ toString("source", ActionDomainEvent::getSource)
+ .thenToString("identifier", ActionDomainEvent::getIdentifier)
+ .thenToString("eventPhase", ActionDomainEvent::getEventPhase)
+ ;
+
+ @Override
+ public String toString() {
+ return toString.toString(this);
+ }
+
+
+}
\ No newline at end of file
diff --git a/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/CollectionDomainEvent.java b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/CollectionDomainEvent.java
new file mode 100644
index 0000000..029b126
--- /dev/null
+++ b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/CollectionDomainEvent.java
@@ -0,0 +1,151 @@
+/*
+ * 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.isis.applib.services.eventbus;
+
+import org.apache.isis.applib.events.domain.AbstractDomainEvent;
+import org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase;
+import org.apache.isis.applib.util.ObjectContracts;
+import org.apache.isis.applib.util.ToString;
+
+@Deprecated
+public abstract class CollectionDomainEvent<S, T> extends AbstractDomainEvent<S> {
+
+ private static final long serialVersionUID = 1L;
+
+
+ // -- Default class
+ /**
+ * This class is the default for the
+ * {@link org.apache.isis.applib.annotation.Collection#domainEvent()} annotation attribute. Whether this
+ * raises an event or not depends upon the "isis.reflector.facet.collectionAnnotation.domainEvent.postForDefault"
+ * configuration property.
+ */
+ public static class Default extends CollectionDomainEvent<Object, Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+ // -- Noop class
+
+ /**
+ * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
+ * property setting for the {@link Default} event.
+ */
+ public static class Noop extends CollectionDomainEvent<Object, Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+ // -- Doop class
+
+ /**
+ * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
+ * property setting for the {@link Default} event..
+ */
+ public static class Doop extends CollectionDomainEvent<Object, Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+
+ // -- constructor
+
+ /**
+ * If used then the framework will set state via (non-API) setters.
+ *
+ * <p>
+ * Recommended because it reduces the amount of boilerplate in the domain object classes.
+ * </p>
+ */
+ public CollectionDomainEvent() {
+ }
+
+
+
+ // -- value
+ private T value;
+
+ /**
+ * The proposed reference to either add or remove (per {@link #getOf()}), populated at {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE}
+ * and subsequent phases (is null for {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable} phases).
+ */
+ public T getValue() {
+ return value;
+ }
+ /**
+ * Not API, set by the framework.
+ */
+ public void setValue(T value) {
+ this.value = value;
+ }
+
+
+ // -- Of
+ public static enum Of {
+ /**
+ * The collection is being accessed
+ * ({@link Phase#HIDE hide} and
+ * {@link Phase#DISABLE disable}) checks.
+ */
+ ACCESS,
+ /**
+ * The collection is being added to
+ * ({@link Phase#VALIDATE validity} check and
+ * {@link Phase#EXECUTED execution}).
+ */
+ ADD_TO,
+ /**
+ * The collection is being removed from
+ * ({@link Phase#VALIDATE validity} check and
+ * {@link Phase#EXECUTED execution}).
+ */
+ REMOVE_FROM
+ }
+
+ private Of of;
+
+ public Of getOf() {
+ return of;
+ }
+
+ /**
+ * Not API; updates from {@link Of#ACCESS} to either {@link Of#ADD_TO} or {@link Of#REMOVE_FROM} when hits the
+ * {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE validation phase}.
+ */
+ public void setOf(Of of) {
+ this.of = of;
+ }
+
+
+
+ private final static ToString<CollectionDomainEvent<?,?>> toString =
+ ObjectContracts.<CollectionDomainEvent<?,?>>
+ toString("source", CollectionDomainEvent::getSource)
+ .thenToString("identifier", CollectionDomainEvent::getIdentifier)
+ .thenToString("eventPhase", CollectionDomainEvent::getEventPhase)
+ .thenToString("of", CollectionDomainEvent::getOf)
+ .thenToString("value", CollectionDomainEvent::getValue)
+ ;
+
+ @Override
+ public String toString() {
+ return toString.toString(this);
+ }
+
+}
\ No newline at end of file
diff --git a/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/PropertyDomainEvent.java b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/PropertyDomainEvent.java
new file mode 100644
index 0000000..b0b7c45
--- /dev/null
+++ b/core/legacy/transition-1-2/src/main/java/org/apache/isis/applib/services/eventbus/PropertyDomainEvent.java
@@ -0,0 +1,125 @@
+/*
+ * 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.isis.applib.services.eventbus;
+
+import org.apache.isis.applib.events.domain.AbstractDomainEvent;
+import org.apache.isis.applib.util.ObjectContracts;
+import org.apache.isis.applib.util.ToString;
+
+public abstract class PropertyDomainEvent<S,T> extends AbstractDomainEvent<S> {
+
+ private static final long serialVersionUID = 1L;
+
+ // -- Default class
+ /**
+ * This class is the default for the
+ * {@link org.apache.isis.applib.annotation.Property#domainEvent()} annotation attribute. Whether this
+ * raises an event or not depends upon the "isis.reflector.facet.propertyAnnotation.domainEvent.postForDefault"
+ * configuration property.
+ */
+ public static class Default extends PropertyDomainEvent<Object, Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+ // -- Noop class
+
+ /**
+ * Convenience class to use indicating that an event should <i>not</i> be posted (irrespective of the configuration
+ * property setting for the {@link Default} event.
+ */
+ public static class Noop extends PropertyDomainEvent<Object, Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+ // -- Doop class
+
+ /**
+ * Convenience class meaning that an event <i>should</i> be posted (irrespective of the configuration
+ * property setting for the {@link Default} event..
+ */
+ public static class Doop extends PropertyDomainEvent<Object, Object> {
+ private static final long serialVersionUID = 1L;
+ }
+
+
+ // -- constructors
+
+ /**
+ * If used then the framework will set state via (non-API) setters.
+ *
+ * <p>
+ * Recommended because it reduces the amount of boilerplate in the domain object classes.
+ * </p>
+ */
+ public PropertyDomainEvent() {
+ }
+
+
+ // -- oldValue
+ private T oldValue;
+
+ /**
+ * The current (pre-modification) value of the property; populated at {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE} and subsequent phases
+ * (but null for {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable} phases).
+ */
+ public T getOldValue() {
+ return oldValue;
+ }
+ /**
+ * Not API; for framework use only.
+ */
+ public void setOldValue(T oldValue) {
+ this.oldValue = oldValue;
+ }
+
+
+ // -- newValue
+ private T newValue;
+ /**
+ * The proposed (post-modification) value of the property; populated at {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#VALIDATE} and subsequent phases
+ * (but null for {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.events.domain.AbstractDomainEvent.Phase#DISABLE disable} phases).
+ */
+ public T getNewValue() {
+ return newValue;
+ }
+ /**
+ * Not API; for framework use only.
+ */
+ public void setNewValue(T newValue) {
+ this.newValue = newValue;
+ }
+
+
+ private final static ToString<PropertyDomainEvent<?,?>> toString =
+ ObjectContracts.<PropertyDomainEvent<?,?>>
+ toString("source", PropertyDomainEvent::getSource)
+ .thenToString("identifier", PropertyDomainEvent::getIdentifier)
+ .thenToString("eventPhase", PropertyDomainEvent::getEventPhase)
+ .thenToString("oldValue", PropertyDomainEvent::getOldValue)
+ .thenToString("newValue", PropertyDomainEvent::getNewValue)
+ ;
+
+ @Override
+ public String toString() {
+ return toString.toString(this);
+ }
+
+}
\ No newline at end of file
diff --git a/core/legacy/transition-1-2/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAssociationFilters.java b/core/legacy/transition-1-2/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAssociationFilters.java
new file mode 100644
index 0000000..0a8e419
--- /dev/null
+++ b/core/legacy/transition-1-2/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAssociationFilters.java
@@ -0,0 +1,256 @@
+/*
+ * 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.isis.core.metamodel.spec.feature;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.WhereValueFacet;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.object.value.ValueFacet;
+//import org.apache.isis.core.metamodel.facets.WhenAndWhereValueFacet;
+
+/** @deprecated */
+@Deprecated
+public class ObjectAssociationFilters {
+ /** @deprecated */
+ @Deprecated
+ public static final Filter<ObjectAssociation> PROPERTIES;
+ /** @deprecated */
+ @Deprecated
+ public static final Filter<ObjectAssociation> REFERENCE_PROPERTIES;
+ /** @deprecated */
+ @Deprecated
+ public static final Filter<ObjectAssociation> WHERE_VISIBLE_IN_COLLECTION_TABLE;
+ /** @deprecated */
+ @Deprecated
+ public static final Filter<ObjectAssociation> WHERE_VISIBLE_IN_STANDALONE_TABLE;
+ /** @deprecated */
+ @Deprecated
+ public static final Filter<ObjectAssociation> ALL;
+ /** @deprecated */
+ @Deprecated
+ public static final Filter<ObjectAssociation> COLLECTIONS;
+ /** @deprecated */
+// @Deprecated
+// public static final Filter<ObjectAssociation> VISIBLE_AT_LEAST_SOMETIMES;
+
+ public ObjectAssociationFilters() {
+ }
+
+ /** @deprecated */
+ @Deprecated
+ public static final Filter<ObjectAssociation> staticallyVisible(Where context) {
+ return Filters.staticallyVisible(context);
+ }
+
+ /** @deprecated */
+ @Deprecated
+ public static Filter<ObjectAssociation> dynamicallyVisible(
+ AuthenticationSession session, ObjectAdapter target, Where where) {
+ return Filters.dynamicallyVisible(target, InteractionInitiatedBy.USER, where);
+ }
+
+ /** @deprecated */
+ @Deprecated
+ public static Filter<ObjectAssociation> enabled(AuthenticationSession session, ObjectAdapter adapter, Where where) {
+ return Filters.enabled(adapter, InteractionInitiatedBy.USER, where);
+ }
+
+ static {
+ PROPERTIES = Filters.PROPERTIES;
+ REFERENCE_PROPERTIES = Filters.REFERENCE_PROPERTIES;
+ WHERE_VISIBLE_IN_COLLECTION_TABLE = Filters.WHERE_VISIBLE_IN_COLLECTION_TABLE;
+ WHERE_VISIBLE_IN_STANDALONE_TABLE = Filters.WHERE_VISIBLE_IN_STANDALONE_TABLE;
+ ALL = Filters.ALL;
+ COLLECTIONS = Filters.COLLECTIONS;
+// VISIBLE_AT_LEAST_SOMETIMES = Filters.VISIBLE_AT_LEAST_SOMETIMES;
+ }
+
+ public static class Filters {
+
+ private Filters() {
+ }
+
+ /**
+ * Filters only fields that are for properties (ie 1:1 associations)
+ *
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public final static Filter<ObjectAssociation> PROPERTIES = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation association) {
+ return association.isOneToOneAssociation();
+ }
+ };
+
+ /**
+ * Filters only fields that are for reference properties (ie 1:1 associations)
+ *
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public final static Filter<ObjectAssociation> REFERENCE_PROPERTIES = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation association) {
+ return association.isOneToOneAssociation() &&
+ !association.getSpecification().containsDoOpFacet(ValueFacet.class);
+ }
+ };
+
+ /**
+ * Filters only fields that are for properties (ie 1:1 associations)
+ *
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public final static Filter<ObjectAssociation> WHERE_VISIBLE_IN_COLLECTION_TABLE = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation association) {
+ final HiddenFacet hiddenFacet = association.getFacet(HiddenFacet.class);
+ return hiddenFacet == null || !hiddenFacet.where().inParentedTable();
+ }
+ };
+
+ /**
+ * Filters only fields that are for properties (ie 1:1 associations)
+ *
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public final static Filter<ObjectAssociation> WHERE_VISIBLE_IN_STANDALONE_TABLE = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation association) {
+ final HiddenFacet hiddenFacet = association.getFacet(HiddenFacet.class);
+ return hiddenFacet == null || !hiddenFacet.where().inStandaloneTable();
+ }
+ };
+
+ /**
+ * Returns all fields (that is, filters out nothing).
+ *
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public final static Filter<ObjectAssociation> ALL = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation property) {
+ return true;
+ }
+ };
+
+ /**
+ * Filters only fields that are for collections (ie 1:m associations)
+ *
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public final static Filter<ObjectAssociation> COLLECTIONS = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation property) {
+ return property.isOneToManyAssociation();
+ }
+ };
+
+ /**
+ *
+ * [ahuber] not 100% equivalent to legacy code -> possible source of errors
+ *
+ * Filters only properties that are visible statically, ie have not been
+ * unconditionally hidden at compile time.
+ *
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public static final Filter<ObjectAssociation> VISIBLE_AT_LEAST_SOMETIMES = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation property) {
+ final HiddenFacet hiddenFacet = property.getFacet(HiddenFacet.class);
+ return hiddenFacet == null || hiddenFacet.where() != Where.EVERYWHERE;
+ }
+ };
+
+ /**
+ * [ahuber] not 100% equivalent to legacy code -> possible source of errors
+ *
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public static final Filter<ObjectAssociation> staticallyVisible(final Where context) {
+ return new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation association) {
+ final List<Facet> facets = association.getFacets((Facet facet)->
+ facet instanceof WhereValueFacet && facet instanceof HiddenFacet);
+ for (Facet facet : facets) {
+ final WhereValueFacet wawF = (WhereValueFacet) facet;
+ if (wawF.where().includes(context) && wawF.where() == Where.EVERYWHERE) {
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+ }
+
+ /**
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public static Filter<ObjectAssociation> dynamicallyVisible(
+ final ObjectAdapter target,
+ final InteractionInitiatedBy interactionInitiatedBy,
+ final Where where) {
+ return new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation objectAssociation) {
+ final Consent visible = objectAssociation.isVisible(target, interactionInitiatedBy, where);
+ return visible.isAllowed();
+ }
+ };
+ }
+
+ /**
+ * @deprecated -use {@link com.google.common.base.Predicate equivalent}
+ */
+ @Deprecated
+ public static Filter<ObjectAssociation> enabled(
+ final ObjectAdapter adapter,
+ final InteractionInitiatedBy interactionInitiatedBy,
+ final Where where) {
+ return new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation objectAssociation) {
+ final Consent usable = objectAssociation.isUsable(adapter, interactionInitiatedBy, where);
+ return usable.isAllowed();
+ }
+ };
+ }
+
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
ahuber@apache.org.