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 2014/12/10 08:09:12 UTC
[2/2] isis git commit: ISIS-964, ISIS-969: rename @ClassLayout to
@DomainObjectLayout;
introduce @DomainServiceLayout and move @DomainService(menuBar=... over to it)
and replace DomainServiceFacet#getMenuOrder() with
DomainServiceLayout#getMenuOrder().
ISIS-964, ISIS-969: rename @ClassLayout to @DomainObjectLayout; introduce @DomainServiceLayout and move @DomainService(menuBar=... over to it) and replace DomainServiceFacet#getMenuOrder() with DomainServiceLayout#getMenuOrder().
Also updated ServicesInstallerFromAnnotation that reads directly from the annotation (no facets are available at the point at which it runs).
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/de47485a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/de47485a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/de47485a
Branch: refs/heads/master
Commit: de47485a546431ccf030b2aa9f6c5e15c4fb8241
Parents: 5f3ea05
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Dec 9 23:30:16 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Dec 10 07:08:15 2014 +0000
----------------------------------------------------------------------
.../model/models/ServiceActionsModel.java | 16 +--
.../ServiceActionsPanelFactory.java | 4 +-
.../TertiaryMenuPanelFactory.java | 4 +-
.../viewer/wicket/ui/pages/PageAbstract.java | 10 +-
.../apache/isis/applib/annotation/Audited.java | 1 -
.../isis/applib/annotation/ClassLayout.java | 71 ----------
.../apache/isis/applib/annotation/CssClass.java | 2 +-
.../isis/applib/annotation/DescribedAs.java | 2 +-
.../applib/annotation/DomainObjectLayout.java | 71 ++++++++++
.../isis/applib/annotation/DomainService.java | 14 +-
.../applib/annotation/DomainServiceLayout.java | 64 +++++++++
.../apache/isis/applib/annotation/Named.java | 2 +-
.../apache/isis/applib/annotation/Paged.java | 2 +-
.../apache/isis/applib/annotation/Plural.java | 2 +-
.../applib/fixturescripts/FixtureResult.java | 12 +-
.../applib/fixturescripts/FixtureScript.java | 20 ++-
.../fixturescripts/SimpleFixtureScript.java | 4 +-
.../applib/service/DomainChangeJdoAbstract.java | 14 +-
.../domainservice/DomainServiceFacet.java | 15 ---
.../DomainServiceFacetAbstract.java | 14 +-
.../DomainServiceFacetAnnotation.java | 5 +-
.../DomainServiceFacetAnnotationFactory.java | 2 +-
.../DomainServiceLayoutFacet.java | 45 +++++++
.../DomainServiceLayoutFacetAbstract.java | 52 ++++++++
.../DomainServiceLayoutFactory.java | 84 ++++++++++++
...edFacetForDomainServiceLayoutAnnotation.java | 42 ++++++
.../DomainServiceLayoutFacetAnnotation.java | 35 +++++
.../object/layout/ClassLayoutFactory.java | 53 --------
.../CssClassFacetForClassLayoutAnnotation.java | 42 ------
...assFacetForDomainObjectLayoutAnnotation.java | 42 ++++++
...escribedAsFacetForClassLayoutAnnotation.java | 42 ------
...dAsFacetForDomainObjectLayoutAnnotation.java | 42 ++++++
.../layout/DomainObjectLayoutFactory.java | 53 ++++++++
.../NamedFacetForClassLayoutAnnotation.java | 42 ------
...medFacetForDomainObjectLayoutAnnotation.java | 42 ++++++
.../PagedFacetForClassLayoutAnnotation.java | 41 ------
...gedFacetForDomainObjectLayoutAnnotation.java | 41 ++++++
.../PluralFacetForClassLayoutAnnotation.java | 42 ------
...ralFacetForDomainObjectLayoutAnnotation.java | 42 ++++++
.../dflt/ProgrammingModelFacetsJava5.java | 9 +-
...DomainServiceFacetAnnotationFactoryTest.java | 70 ----------
...DomainServiceFacetAnnotationFactoryTest.java | 66 ++++++++++
.../DomainServiceLayoutFactoryTest.java | 129 +++++++++++++++++++
.../ServicesInstallerFromAnnotation.java | 14 +-
.../simple/SimpleObjectsFixturesService.java | 6 +-
.../simple/objects/SimpleObjectAbstract.java | 2 +-
.../dom/src/main/java/app/ToDoItemAnalysis.java | 6 +-
.../java/app/ToDoItemsByCategoryViewModel.java | 6 +-
.../java/app/ToDoItemsByDateRangeViewModel.java | 4 +-
.../java/dom/todo/ToDoItemSubscriptions.java | 4 +-
.../dom/src/main/java/dom/todo/ToDoItems.java | 6 +-
.../fixture/todo/ToDoItemsFixturesService.java | 8 +-
.../complete/ToDoItemCompleteAbstract.java | 20 +--
.../todo/items/create/ToDoItemAbstract.java | 2 +-
.../todo/items/delete/ToDoItemsDelete.java | 15 ---
.../prototyping/ExternalLinksService.java | 5 +-
.../prototyping/WicketDeveloperUtilities.java | 4 +-
57 files changed, 958 insertions(+), 551 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java
index 2a816de..89afe12 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ServiceActionsModel.java
@@ -23,9 +23,9 @@ import java.util.List;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.domainservice.DomainServiceFacet;
+import org.apache.isis.core.metamodel.facets.object.domainservicelayout.DomainServiceLayoutFacet;
/**
* Backing model for actions of application services menu bar (typically, as
@@ -35,24 +35,24 @@ public class ServiceActionsModel extends ModelAbstract<List<ObjectAdapter>> {
private static final long serialVersionUID = 1L;
- private final DomainService.MenuBar menuBar;
+ private final DomainServiceLayout.MenuBar menuBar;
- private static Predicate<ObjectAdapter> with(final DomainService.MenuBar menuBar) {
+ private static Predicate<ObjectAdapter> with(final DomainServiceLayout.MenuBar menuBar) {
return new Predicate<ObjectAdapter>() {
@Override
public boolean apply(ObjectAdapter input) {
- final DomainServiceFacet facet = input.getSpecification().getFacet
- (DomainServiceFacet.class);
+ final DomainServiceLayoutFacet facet = input.getSpecification().getFacet
+ (DomainServiceLayoutFacet.class);
return facet != null && facet.getMenuBar() == menuBar;
}
};
}
- public ServiceActionsModel(DomainService.MenuBar menuBar) {
+ public ServiceActionsModel(final DomainServiceLayout.MenuBar menuBar) {
this.menuBar = menuBar;
}
- public DomainService.MenuBar getMenuBar() {
+ public DomainServiceLayout.MenuBar getMenuBar() {
return menuBar;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java
index d60dce1..4040fe5 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/ServiceActionsPanelFactory.java
@@ -21,7 +21,7 @@ package org.apache.isis.viewer.wicket.ui.components.actionmenu.serviceactions;
import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;
-import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.viewer.wicket.model.models.ServiceActionsModel;
import org.apache.isis.viewer.wicket.ui.ComponentFactory;
import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
@@ -48,7 +48,7 @@ public class ServiceActionsPanelFactory extends ComponentFactoryAbstract {
return ApplicationAdvice.DOES_NOT_APPLY;
}
final ServiceActionsModel serviceActionsModel = (ServiceActionsModel) model;
- return appliesIf(serviceActionsModel.getMenuBar() != DomainService.MenuBar.TERTIARY);
+ return appliesIf(serviceActionsModel.getMenuBar() != DomainServiceLayout.MenuBar.TERTIARY);
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java
index 0e303ec..0776c20 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/TertiaryMenuPanelFactory.java
@@ -21,7 +21,7 @@ package org.apache.isis.viewer.wicket.ui.components.actionmenu.serviceactions;
import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;
-import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.viewer.wicket.model.models.ServiceActionsModel;
import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
import org.apache.isis.viewer.wicket.ui.ComponentType;
@@ -47,7 +47,7 @@ public class TertiaryMenuPanelFactory extends ComponentFactoryAbstract {
return ApplicationAdvice.DOES_NOT_APPLY;
}
final ServiceActionsModel serviceActionsModel = (ServiceActionsModel) model;
- return appliesIf(serviceActionsModel.getMenuBar() == DomainService.MenuBar.TERTIARY);
+ return appliesIf(serviceActionsModel.getMenuBar() == DomainServiceLayout.MenuBar.TERTIARY);
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
index 424b23f..eee315f 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
@@ -60,7 +60,7 @@ import org.apache.wicket.request.resource.PackageResource;
import org.apache.wicket.request.resource.ResourceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer;
import org.apache.isis.applib.services.exceprecog.ExceptionRecognizerComposite;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
@@ -333,12 +333,12 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
}
private void addServiceActionMenuBars(MarkupContainer container) {
- addMenuBar(container, "primaryMenuBar", DomainService.MenuBar.PRIMARY);
- addMenuBar(container, "secondaryMenuBar", DomainService.MenuBar.SECONDARY);
- addMenuBar(container, "tertiaryMenuBar", DomainService.MenuBar.TERTIARY);
+ addMenuBar(container, "primaryMenuBar", DomainServiceLayout.MenuBar.PRIMARY);
+ addMenuBar(container, "secondaryMenuBar", DomainServiceLayout.MenuBar.SECONDARY);
+ addMenuBar(container, "tertiaryMenuBar", DomainServiceLayout.MenuBar.TERTIARY);
}
- private void addMenuBar(MarkupContainer container, String id, DomainService.MenuBar menuBar) {
+ private void addMenuBar(MarkupContainer container, String id, DomainServiceLayout.MenuBar menuBar) {
final ServiceActionsModel model = new ServiceActionsModel(menuBar);
getComponentFactoryRegistry().addOrReplaceComponent(container, id, ComponentType.SERVICE_ACTIONS, model);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/Audited.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Audited.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Audited.java
index bad809f..6081f40 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Audited.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Audited.java
@@ -44,7 +44,6 @@ import org.apache.isis.applib.services.audit.AuditingService3;
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Audited {
-
/**
* If set to <tt>true</tt>, acts as an override to <i>disable</i> auditing when it is otherwise (eg through
* configuration) configured as the default.
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/ClassLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/ClassLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/ClassLayout.java
deleted file mode 100644
index d2ac7a3..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/ClassLayout.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.annotation;
-
-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;
-
-/**
- * Layout hints for collections.
- */
-@Inherited
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ClassLayout {
-
- /**
- * Indicates the css class that a domain class (type) should have.
- */
- String cssClass() default "";
-
- /**
- * Description of this class, eg to be rendered in a tooltip.
- */
- String describedAs() default "";
-
- /**
- * Name of this class (overriding the name derived from its name in code).
- */
- String named() default "";
-
- /**
- * The page size for instances of this class when rendered within
- * a table.
- *
- * <p>
- * If annotated on a collection, then the page size refers to
- * parented collections (eg <tt>Order#lineItems</tt>).
- *
- * <p>
- * If annotated on a type, then the page size refers to standalone
- * collections (eg as returned from a repository query).
- */
- public int paged() default -1;
-
- /**
- * The plural name of the class.
- */
- String plural() default "";
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClass.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClass.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClass.java
index ec98578..98fca77 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClass.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClass.java
@@ -26,7 +26,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * @deprecated - use {@link ClassLayout#cssClass()}, {@link PropertyLayout#cssClass()}, {@link CollectionLayout#cssClass()}, {@link ActionLayout#cssClass()} and {@link ParameterLayout#cssClass()}.
+ * @deprecated - use {@link DomainObjectLayout#cssClass()}, {@link PropertyLayout#cssClass()}, {@link CollectionLayout#cssClass()}, {@link ActionLayout#cssClass()} and {@link ParameterLayout#cssClass()}.
*/
@Deprecated
@Inherited
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/DescribedAs.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/DescribedAs.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/DescribedAs.java
index c0735b8..08244b5 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/DescribedAs.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/DescribedAs.java
@@ -26,7 +26,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * @deprecated - see {@link ClassLayout#describedAs()}, {@link PropertyLayout#describedAs()},
+ * @deprecated - see {@link DomainObjectLayout#describedAs()}, {@link PropertyLayout#describedAs()},
* {@link CollectionLayout#describedAs()}, {@link ActionLayout#describedAs()} and {@link ParameterLayout#describedAs()}.
*/
@Deprecated
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObjectLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObjectLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObjectLayout.java
new file mode 100644
index 0000000..6a605e5
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObjectLayout.java
@@ -0,0 +1,71 @@
+/*
+ * 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.annotation;
+
+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;
+
+/**
+ * Layout hints for domain objects.
+ */
+@Inherited
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DomainObjectLayout {
+
+ /**
+ * Indicates the css class that a domain class (type) should have.
+ */
+ String cssClass() default "";
+
+ /**
+ * Description of this class, eg to be rendered in a tooltip.
+ */
+ String describedAs() default "";
+
+ /**
+ * Name of this class (overriding the name derived from its name in code).
+ */
+ String named() default "";
+
+ /**
+ * The page size for instances of this class when rendered within
+ * a table.
+ *
+ * <p>
+ * If annotated on a collection, then the page size refers to
+ * parented collections (eg <tt>Order#lineItems</tt>).
+ *
+ * <p>
+ * If annotated on a type, then the page size refers to standalone
+ * collections (eg as returned from a repository query).
+ */
+ public int paged() default -1;
+
+ /**
+ * The plural name of the class.
+ */
+ String plural() default "";
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java
index 670361f..8f4321b 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainService.java
@@ -33,29 +33,21 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
public @interface DomainService {
- public enum MenuBar {
- PRIMARY,
- SECONDARY,
- TERTIARY
- }
-
/**
* If this domain service acts as a repository for an entity type, specify that entity type.
*/
Class<?> repositoryFor() default Object.class;
/**
- * The menubar in which the menu that hold's this service's actions should reside.
- */
- MenuBar menuBar() default MenuBar.PRIMARY;
-
- /**
* Number in Dewey Decimal format representing the order.
*
* <p>
* Same convention as {@link MemberOrder#sequence()}. If not specified, placed after any named.
* </p>
+ *
+ * @deprecated - use {@link DomainServiceLayout#menuOrder()} instead.
*/
+ @Deprecated
String menuOrder() default "" + Integer.MAX_VALUE;
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainServiceLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainServiceLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainServiceLayout.java
new file mode 100644
index 0000000..abcc705
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainServiceLayout.java
@@ -0,0 +1,64 @@
+/*
+ * 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.annotation;
+
+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;
+
+/**
+ * Layout hints for domain services.
+ *
+ * <p>
+ * Also indicates whether the domain service acts as a repository for an entity, and menu ordering UI hints.
+ * </p>
+ */
+@Inherited
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DomainServiceLayout {
+
+ /**
+ * Name of this class (overriding the name derived from its name in code).
+ */
+ String named() default "";
+
+ public enum MenuBar {
+ PRIMARY,
+ SECONDARY,
+ TERTIARY
+ }
+
+ /**
+ * The menubar in which the menu that holds this service's actions should reside.
+ */
+ MenuBar menuBar() default MenuBar.PRIMARY;
+
+ /**
+ * Number in Dewey Decimal format representing the order.
+ *
+ * <p>
+ * Same convention as {@link org.apache.isis.applib.annotation.MemberOrder#sequence()}. If not specified, placed after any named.
+ * </p>
+ */
+ String menuOrder() default "" + Integer.MAX_VALUE;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/Named.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Named.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Named.java
index ba4d495..09267fa 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Named.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Named.java
@@ -26,7 +26,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * @deprecated - use instead {@link ClassLayout#named()}, {@link PropertyLayout#named()}, {@link CollectionLayout#named()}, {@link ActionLayout#named()} and {@link ParameterLayout#named()}.
+ * @deprecated - use instead {@link DomainServiceLayout#named()}, {@link DomainObjectLayout#named()}, {@link PropertyLayout#named()}, {@link CollectionLayout#named()}, {@link ActionLayout#named()} and {@link ParameterLayout#named()}.
*/
@Deprecated
@Inherited
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java
index 62ee436..867c7fe 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java
@@ -26,7 +26,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * @deprecated - use instead {@link ClassLayout#paged()} or {@link CollectionLayout#paged()}.
+ * @deprecated - use instead {@link DomainObjectLayout#paged()} or {@link CollectionLayout#paged()}.
*/
@Deprecated
@Inherited
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/annotation/Plural.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Plural.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Plural.java
index fbc22d0..0b76c2e 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Plural.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Plural.java
@@ -26,7 +26,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * @deprecated - use {@link ClassLayout#plural()}.
+ * @deprecated - use {@link DomainObjectLayout#plural()}.
*/
@Deprecated
@Inherited
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java
index c2938b3..131b8a1 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java
@@ -21,7 +21,7 @@ package org.apache.isis.applib.fixturescripts;
import org.apache.isis.applib.annotation.*;
@ViewModel
-@Paged(500)
+@DomainObjectLayout(paged=500)
public class FixtureResult {
@@ -29,7 +29,7 @@ public class FixtureResult {
private String fixtureScriptClassName;
- @Named("Fixture script")
+ @PropertyLayout(named="Fixture script")
@Optional
@MemberOrder(sequence="1")
public String getFixtureScriptClassName() {
@@ -60,7 +60,7 @@ public class FixtureResult {
private String key;
- @Named("Result key")
+ @PropertyLayout(named="Result key")
@Title(sequence="1", append=": ")
@MemberOrder(sequence="1")
public String getKey() {
@@ -76,7 +76,7 @@ public class FixtureResult {
private Object object;
- @Named("Result")
+ @PropertyLayout(named="Result")
@Title(sequence="2")
@MemberOrder(sequence="1")
public Object getObject() {
@@ -91,7 +91,7 @@ public class FixtureResult {
//region > className (derived property)
- @Named("Result class")
+ @PropertyLayout(named="Result class")
@MemberOrder(sequence="3")
public String getClassName() {
return object != null? object.getClass().getName(): null;
@@ -106,6 +106,4 @@ public class FixtureResult {
//endregion
-
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
index bbd9015..8b63c4f 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
@@ -31,14 +31,14 @@ import com.google.common.collect.Maps;
import com.google.common.io.CharSource;
import org.apache.isis.applib.AbstractViewModel;
import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.Title;
import org.apache.isis.applib.fixtures.FixtureType;
import org.apache.isis.applib.fixtures.InstallableFixture;
-@Named("Script")
+@DomainObjectLayout(named="Script")
public abstract class FixtureScript
extends AbstractViewModel
implements InstallableFixture {
@@ -328,12 +328,28 @@ public abstract class FixtureScript
return fixtureResultList.getResults();
}
+ /**
+ * @deprecated - use {@link #addResult(FixtureScript, Object)} instead.
+ */
+ @Deprecated
public <T> T add(final FixtureScript script, final T object) {
+ return addResult(script, object);
+ }
+
+ public <T> T addResult(final FixtureScript script, final T object) {
fixtureResultList.add(script, object);
return object;
}
+ /**
+ * @deprecated - use {@link #addResult(FixtureScript, String, Object)} instead.
+ */
+ @Deprecated
public <T> T add(final FixtureScript script, final String key, final T object) {
+ return addResult(script, key, object);
+ }
+
+ public <T> T addResult(final FixtureScript script, final String key, final T object) {
fixtureResultList.add(script, key, object);
return object;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java
index 886c96f..db11683 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java
@@ -18,9 +18,9 @@
*/
package org.apache.isis.applib.fixturescripts;
-import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
-@Named("Simple Script")
+@DomainObjectLayout(named="Simple Script")
public abstract class SimpleFixtureScript extends FixtureScript {
private static Discoverability defaultDiscoverability() {
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/applib/src/main/java/org/apache/isis/objectstore/jdo/applib/service/DomainChangeJdoAbstract.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/objectstore/jdo/applib/service/DomainChangeJdoAbstract.java b/core/applib/src/main/java/org/apache/isis/objectstore/jdo/applib/service/DomainChangeJdoAbstract.java
index 28f73eb..344daa2 100644
--- a/core/applib/src/main/java/org/apache/isis/objectstore/jdo/applib/service/DomainChangeJdoAbstract.java
+++ b/core/applib/src/main/java/org/apache/isis/objectstore/jdo/applib/service/DomainChangeJdoAbstract.java
@@ -36,7 +36,7 @@ import org.apache.isis.applib.util.ObjectContracts;
columnSpans={6,0,6,12},
left={"Identifiers"},
right={"Target","Detail"})
-@Named("Domain Change")
+@DomainObjectLayout(named="Domain Change")
@Immutable
public abstract class DomainChangeJdoAbstract {
@@ -120,7 +120,7 @@ public abstract class DomainChangeJdoAbstract {
* subclasses override with the "real" implementation.
*/
@MemberOrder(name="Target", sequence = "10")
- @Named("Class")
+ @PropertyLayout(named="Class")
public String getTargetClass() {
return null;
}
@@ -151,10 +151,12 @@ public abstract class DomainChangeJdoAbstract {
* This dummy implementation is a trick so that Isis will render the property in a standalone table. Each of the
* subclasses override with the "real" implementation.
*/
- @Hidden(where=Where.ALL_EXCEPT_STANDALONE_TABLES)
@Optional
@MemberOrder(name="Target", sequence = "20")
- @Named("Action")
+ @PropertyLayout(
+ named="Action",
+ hidden = Where.ALL_EXCEPT_STANDALONE_TABLES
+ )
public String getTargetAction() {
return targetAction;
}
@@ -170,7 +172,7 @@ public abstract class DomainChangeJdoAbstract {
* subclasses override with the "real" implementation.
*/
@MemberOrder(name="Target", sequence="30")
- @Named("Object")
+ @PropertyLayout(named="Object")
public String getTargetStr() {
return null;
}
@@ -186,7 +188,7 @@ public abstract class DomainChangeJdoAbstract {
@Bulk
@ActionSemantics(Of.SAFE)
@MemberOrder(name="TargetStr", sequence="1")
- @Named("Open")
+ @PropertyLayout(named="Open")
public Object openTargetObject() {
return Util.lookupBookmark(getTarget(), bookmarkService, container);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacet.java
index 250aba4..1d9258e 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacet.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacet.java
@@ -19,7 +19,6 @@
package org.apache.isis.core.metamodel.facets.object.domainservice;
-import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.core.metamodel.facetapi.Facet;
@@ -29,20 +28,6 @@ import org.apache.isis.core.metamodel.facetapi.Facet;
public interface DomainServiceFacet extends Facet {
/**
- * Corresponds to {@link org.apache.isis.applib.annotation.DomainService#menuBar()}.
- */
- public DomainService.MenuBar getMenuBar();
-
- /**
- * Corresponds to {@link org.apache.isis.applib.annotation.DomainService#menuOrder()}.
- *
- * <p>
- * May be null.
- * </p>
- */
- public String getMenuOrder();
-
- /**
* Corresponds to {@link org.apache.isis.applib.annotation.DomainService#repositoryFor()}.
*
* <p>
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacetAbstract.java
index d1aa190..fb63eb2 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/DomainServiceFacetAbstract.java
@@ -19,7 +19,6 @@
package org.apache.isis.core.metamodel.facets.object.domainservice;
-import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
@@ -33,24 +32,13 @@ public abstract class DomainServiceFacetAbstract
return DomainServiceFacet.class;
}
- private final DomainService.MenuBar menuBar;
- private final String menuOrder;
private final Class<?> repositoryFor;
- public DomainServiceFacetAbstract(final FacetHolder facetHolder, final DomainService.MenuBar menuBar, final String menuOrder, final Class<?> repositoryFor) {
+ public DomainServiceFacetAbstract(final FacetHolder facetHolder, final Class<?> repositoryFor) {
super(DomainServiceFacetAbstract.type(), facetHolder, Derivation.NOT_DERIVED);
- this.menuBar = menuBar;
- this.menuOrder = menuOrder;
this.repositoryFor = repositoryFor;
}
- public DomainService.MenuBar getMenuBar() {
- return menuBar;
- }
-
- public String getMenuOrder() {
- return menuOrder;
- }
public Class<?> getRepositoryFor() {
return repositoryFor;
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotation.java
index 9448bf8..7c391ef 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotation.java
@@ -19,7 +19,6 @@
package org.apache.isis.core.metamodel.facets.object.domainservice.annotation;
-import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
import org.apache.isis.core.metamodel.facets.object.domainservice.DomainServiceFacetAbstract;
@@ -28,9 +27,7 @@ public class DomainServiceFacetAnnotation extends DomainServiceFacetAbstract {
public DomainServiceFacetAnnotation(
final FacetHolder facetHolder,
- final DomainService.MenuBar menubar,
- final String menuOrder,
final Class<?> repositoryFor) {
- super(facetHolder, menubar, menuOrder, repositoryFor);
+ super(facetHolder, repositoryFor);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java
index 78f42b6..c81cf37 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java
@@ -42,7 +42,7 @@ public class DomainServiceFacetAnnotationFactory extends FacetFactoryAbstract {
FacetUtil.addFacet(
new DomainServiceFacetAnnotation(
processClassContext.getFacetHolder(),
- annotation.menuBar(), annotation.menuOrder(), annotation.repositoryFor()));
+ annotation.repositoryFor()));
if(annotation.repositoryFor() != null) {
FacetUtil.addFacet(
new IconFacetDerivedFromDomainServiceAnnotation(
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacet.java
new file mode 100644
index 0000000..a3e95e3
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacet.java
@@ -0,0 +1,45 @@
+/*
+ * 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.facets.object.domainservicelayout;
+
+
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+
+/**
+ * Corresponds to annotating the class with the {@link org.apache.isis.applib.annotation.DomainServiceLayout} annotation.
+ */
+public interface DomainServiceLayoutFacet extends Facet {
+
+ /**
+ * Corresponds to {@link org.apache.isis.applib.annotation.DomainServiceLayout#menuBar()}.
+ */
+ public DomainServiceLayout.MenuBar getMenuBar();
+
+ /**
+ * Corresponds to {@link org.apache.isis.applib.annotation.DomainService#menuOrder()}.
+ *
+ * <p>
+ * May be null.
+ * </p>
+ */
+ public String getMenuOrder();
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacetAbstract.java
new file mode 100644
index 0000000..d653516
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacetAbstract.java
@@ -0,0 +1,52 @@
+/*
+ * 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.facets.object.domainservicelayout;
+
+
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public abstract class DomainServiceLayoutFacetAbstract
+ extends FacetAbstract
+ implements DomainServiceLayoutFacet {
+
+ public static Class<? extends Facet> type() {
+ return DomainServiceLayoutFacet.class;
+ }
+
+ private final DomainServiceLayout.MenuBar menuBar;
+ private final String menuOrder;
+
+ public DomainServiceLayoutFacetAbstract(final FacetHolder facetHolder, final DomainServiceLayout.MenuBar menuBar, final String menuOrder) {
+ super(DomainServiceLayoutFacetAbstract.type(), facetHolder, Derivation.NOT_DERIVED);
+ this.menuBar = menuBar;
+ this.menuOrder = menuOrder;
+ }
+
+ public DomainServiceLayout.MenuBar getMenuBar() {
+ return menuBar;
+ }
+
+ public String getMenuOrder() {
+ return menuOrder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFactory.java
new file mode 100644
index 0000000..9803198
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFactory.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 org.apache.isis.core.metamodel.facets.object.domainservicelayout;
+
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.object.domainservicelayout.annotation.DomainServiceLayoutFacetAnnotation;
+
+
+public class DomainServiceLayoutFactory extends FacetFactoryAbstract {
+
+ public DomainServiceLayoutFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(ProcessClassContext processClassContext) {
+ final Class<?> cls = processClassContext.getCls();
+
+ final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+ final DomainService domainService = Annotations.getAnnotation(cls, DomainService.class);
+ final DomainServiceLayout domainServiceLayout = Annotations.getAnnotation(cls, DomainServiceLayout.class);
+
+ if (domainService == null && domainServiceLayout == null) {
+ return;
+ }
+
+ final String domainServiceMenuOrder =
+ domainService != null && !domainService.menuOrder().equals("" + Integer.MAX_VALUE)
+ ? domainService.menuOrder()
+ : null;
+ final String domainServiceLayoutMenuOrder =
+ domainServiceLayout != null && !domainServiceLayout.menuOrder().equals("" + Integer.MAX_VALUE)
+ ? domainServiceLayout.menuOrder()
+ : null;
+ final String menuOrder = coalesce(domainServiceLayoutMenuOrder, domainServiceMenuOrder);
+
+ DomainServiceLayout.MenuBar menuBar =
+ domainServiceLayout != null
+ ? domainServiceLayout.menuBar()
+ : DomainServiceLayout.MenuBar.PRIMARY;
+
+ FacetUtil.addFacet(
+ new DomainServiceLayoutFacetAnnotation(
+ facetHolder,
+ menuBar, menuOrder));
+
+ FacetUtil.addFacet(NamedFacetForDomainServiceLayoutAnnotation.create(domainServiceLayout, facetHolder));
+ }
+
+
+ private static String coalesce(final String... reasons) {
+ for (final String reason : reasons) {
+ if(reason != null) {
+ return reason;
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/NamedFacetForDomainServiceLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/NamedFacetForDomainServiceLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/NamedFacetForDomainServiceLayoutAnnotation.java
new file mode 100644
index 0000000..c764004
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/NamedFacetForDomainServiceLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ * 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.facets.object.domainservicelayout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+
+public class NamedFacetForDomainServiceLayoutAnnotation extends NamedFacetAbstract {
+
+ public static NamedFacet create(final DomainServiceLayout domainServiceLayout, final FacetHolder holder) {
+ if(domainServiceLayout == null) {
+ return null;
+ }
+ final String named = Strings.emptyToNull(domainServiceLayout.named());
+ return named != null ? new NamedFacetForDomainServiceLayoutAnnotation(named, holder) : null;
+ }
+
+ private NamedFacetForDomainServiceLayoutAnnotation(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/annotation/DomainServiceLayoutFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/annotation/DomainServiceLayoutFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/annotation/DomainServiceLayoutFacetAnnotation.java
new file mode 100644
index 0000000..565c869
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/annotation/DomainServiceLayoutFacetAnnotation.java
@@ -0,0 +1,35 @@
+/*
+ * 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.facets.object.domainservicelayout.annotation;
+
+
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.domainservicelayout.DomainServiceLayoutFacetAbstract;
+
+
+public class DomainServiceLayoutFacetAnnotation extends DomainServiceLayoutFacetAbstract {
+
+ public DomainServiceLayoutFacetAnnotation(
+ final FacetHolder facetHolder,
+ final DomainServiceLayout.MenuBar menubar,
+ final String menuOrder) {
+ super(facetHolder, menubar, menuOrder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/ClassLayoutFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/ClassLayoutFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/ClassLayoutFactory.java
deleted file mode 100644
index 799883e..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/ClassLayoutFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.facets.object.layout;
-
-
-import org.apache.isis.applib.annotation.ClassLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-
-
-public class ClassLayoutFactory extends FacetFactoryAbstract {
-
- public ClassLayoutFactory() {
- super(FeatureType.OBJECTS_ONLY);
- }
-
- @Override
- public void process(ProcessClassContext processClassContext) {
- final Class<?> cls = processClassContext.getCls();
- final ClassLayout classLayout = Annotations.getAnnotation(cls, ClassLayout.class);
-
- final FacetHolder facetHolder = processClassContext.getFacetHolder();
-
- FacetUtil.addFacet(CssClassFacetForClassLayoutAnnotation.create(classLayout, facetHolder));
- FacetUtil.addFacet(DescribedAsFacetForClassLayoutAnnotation.create(classLayout, facetHolder));
- FacetUtil.addFacet(NamedFacetForClassLayoutAnnotation.create(classLayout, facetHolder));
- FacetUtil.addFacet(PagedFacetForClassLayoutAnnotation.create(classLayout, facetHolder));
- FacetUtil.addFacet(PluralFacetForClassLayoutAnnotation.create(classLayout, facetHolder));
-
- return;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForClassLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForClassLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForClassLayoutAnnotation.java
deleted file mode 100644
index 5f114f3..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForClassLayoutAnnotation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.facets.object.layout;
-
-
-import com.google.common.base.Strings;
-import org.apache.isis.applib.annotation.ClassLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
-
-
-public class CssClassFacetForClassLayoutAnnotation extends CssClassFacetAbstract {
-
- public static CssClassFacet create(ClassLayout classLayout, FacetHolder holder) {
- if(classLayout == null) {
- return null;
- }
- final String cssClass = Strings.emptyToNull(classLayout.cssClass());
- return cssClass != null ? new CssClassFacetForClassLayoutAnnotation(cssClass, holder) : null;
- }
-
- private CssClassFacetForClassLayoutAnnotation(String value, FacetHolder holder) {
- super(value, holder);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..30eda4e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ * 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.facets.object.layout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+
+public class CssClassFacetForDomainObjectLayoutAnnotation extends CssClassFacetAbstract {
+
+ public static CssClassFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+ if(domainObjectLayout == null) {
+ return null;
+ }
+ final String cssClass = Strings.emptyToNull(domainObjectLayout.cssClass());
+ return cssClass != null ? new CssClassFacetForDomainObjectLayoutAnnotation(cssClass, holder) : null;
+ }
+
+ private CssClassFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForClassLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForClassLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForClassLayoutAnnotation.java
deleted file mode 100644
index c5cf03e..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForClassLayoutAnnotation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.facets.object.layout;
-
-
-import com.google.common.base.Strings;
-import org.apache.isis.applib.annotation.ClassLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
-import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
-
-
-public class DescribedAsFacetForClassLayoutAnnotation extends DescribedAsFacetAbstract {
-
- public static DescribedAsFacet create(ClassLayout classLayout, FacetHolder holder) {
- if(classLayout == null) {
- return null;
- }
- final String describedAs = Strings.emptyToNull(classLayout.describedAs());
- return describedAs != null ? new DescribedAsFacetForClassLayoutAnnotation(describedAs, holder) : null;
- }
-
- private DescribedAsFacetForClassLayoutAnnotation(String value, FacetHolder holder) {
- super(value, holder);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..0eed585
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ * 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.facets.object.layout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
+
+
+public class DescribedAsFacetForDomainObjectLayoutAnnotation extends DescribedAsFacetAbstract {
+
+ public static DescribedAsFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+ if(domainObjectLayout == null) {
+ return null;
+ }
+ final String describedAs = Strings.emptyToNull(domainObjectLayout.describedAs());
+ return describedAs != null ? new DescribedAsFacetForDomainObjectLayoutAnnotation(describedAs, holder) : null;
+ }
+
+ private DescribedAsFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DomainObjectLayoutFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DomainObjectLayoutFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DomainObjectLayoutFactory.java
new file mode 100644
index 0000000..ad99218
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DomainObjectLayoutFactory.java
@@ -0,0 +1,53 @@
+/*
+ * 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.facets.object.layout;
+
+
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+
+public class DomainObjectLayoutFactory extends FacetFactoryAbstract {
+
+ public DomainObjectLayoutFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(ProcessClassContext processClassContext) {
+ final Class<?> cls = processClassContext.getCls();
+ final DomainObjectLayout domainObjectLayout = Annotations.getAnnotation(cls, DomainObjectLayout.class);
+
+ final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+ FacetUtil.addFacet(CssClassFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+ FacetUtil.addFacet(DescribedAsFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+ FacetUtil.addFacet(NamedFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+ FacetUtil.addFacet(PagedFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+ FacetUtil.addFacet(PluralFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+
+ return;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForClassLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForClassLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForClassLayoutAnnotation.java
deleted file mode 100644
index e32c678..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForClassLayoutAnnotation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.facets.object.layout;
-
-
-import com.google.common.base.Strings;
-import org.apache.isis.applib.annotation.ClassLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
-import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
-
-
-public class NamedFacetForClassLayoutAnnotation extends NamedFacetAbstract {
-
- public static NamedFacet create(ClassLayout classLayout, FacetHolder holder) {
- if(classLayout == null) {
- return null;
- }
- final String named = Strings.emptyToNull(classLayout.named());
- return named != null ? new NamedFacetForClassLayoutAnnotation(named, holder) : null;
- }
-
- private NamedFacetForClassLayoutAnnotation(String value, FacetHolder holder) {
- super(value, holder);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..474d243
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ * 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.facets.object.layout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+
+public class NamedFacetForDomainObjectLayoutAnnotation extends NamedFacetAbstract {
+
+ public static NamedFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+ if(domainObjectLayout == null) {
+ return null;
+ }
+ final String named = Strings.emptyToNull(domainObjectLayout.named());
+ return named != null ? new NamedFacetForDomainObjectLayoutAnnotation(named, holder) : null;
+ }
+
+ private NamedFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForClassLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForClassLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForClassLayoutAnnotation.java
deleted file mode 100644
index df5bd37..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForClassLayoutAnnotation.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.facets.object.layout;
-
-
-import org.apache.isis.applib.annotation.ClassLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet;
-import org.apache.isis.core.metamodel.facets.object.paged.PagedFacetAbstract;
-
-
-public class PagedFacetForClassLayoutAnnotation extends PagedFacetAbstract {
-
- public static PagedFacet create(ClassLayout classLayout, FacetHolder holder) {
- if(classLayout == null) {
- return null;
- }
- final int paged = classLayout.paged();
- return paged > 1 ? new PagedFacetForClassLayoutAnnotation(paged, holder) : null;
- }
-
- private PagedFacetForClassLayoutAnnotation(int value, FacetHolder holder) {
- super(value, holder);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..7d910da
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,41 @@
+/*
+ * 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.facets.object.layout;
+
+
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet;
+import org.apache.isis.core.metamodel.facets.object.paged.PagedFacetAbstract;
+
+
+public class PagedFacetForDomainObjectLayoutAnnotation extends PagedFacetAbstract {
+
+ public static PagedFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+ if(domainObjectLayout == null) {
+ return null;
+ }
+ final int paged = domainObjectLayout.paged();
+ return paged > 1 ? new PagedFacetForDomainObjectLayoutAnnotation(paged, holder) : null;
+ }
+
+ private PagedFacetForDomainObjectLayoutAnnotation(int value, FacetHolder holder) {
+ super(value, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForClassLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForClassLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForClassLayoutAnnotation.java
deleted file mode 100644
index bf76b56..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForClassLayoutAnnotation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.facets.object.layout;
-
-
-import com.google.common.base.Strings;
-import org.apache.isis.applib.annotation.ClassLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.plural.PluralFacet;
-import org.apache.isis.core.metamodel.facets.object.plural.PluralFacetAbstract;
-
-
-public class PluralFacetForClassLayoutAnnotation extends PluralFacetAbstract {
-
- public static PluralFacet create(ClassLayout classLayout, FacetHolder holder) {
- if(classLayout == null) {
- return null;
- }
- final String plural = Strings.emptyToNull(classLayout.plural());
- return plural != null ? new PluralFacetForClassLayoutAnnotation(plural, holder) : null;
- }
-
- private PluralFacetForClassLayoutAnnotation(String value, FacetHolder holder) {
- super(value, holder);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/de47485a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..f5499fd
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ * 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.facets.object.layout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.plural.PluralFacet;
+import org.apache.isis.core.metamodel.facets.object.plural.PluralFacetAbstract;
+
+
+public class PluralFacetForDomainObjectLayoutAnnotation extends PluralFacetAbstract {
+
+ public static PluralFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+ if(domainObjectLayout == null) {
+ return null;
+ }
+ final String plural = Strings.emptyToNull(domainObjectLayout.plural());
+ return plural != null ? new PluralFacetForDomainObjectLayoutAnnotation(plural, holder) : null;
+ }
+
+ private PluralFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+}