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 2012/12/05 00:41:10 UTC

[31/52] [partial] ISIS-188: consolidating isis-core

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maskannot/MaskAnnotationForPropertyFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maskannot/MaskAnnotationForPropertyFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maskannot/MaskAnnotationForPropertyFacetFactory.java
new file mode 100644
index 0000000..9efff5a
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maskannot/MaskAnnotationForPropertyFacetFactory.java
@@ -0,0 +1,96 @@
+/*
+ *  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.progmodel.facets.properties.validate.maskannot;
+
+import org.apache.isis.applib.annotation.Mask;
+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.title.TitleFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskFacet;
+import org.apache.isis.core.progmodel.facets.object.mask.TitleFacetBasedOnMask;
+
+public class MaskAnnotationForPropertyFacetFactory extends FacetFactoryAbstract {
+
+    public MaskAnnotationForPropertyFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    /**
+     * In readiness for supporting <tt>@Value</tt> in the future.
+     */
+    @Override
+    public void process(final ProcessClassContext processClassContaxt) {
+        final Mask annotation = Annotations.getAnnotation(processClassContaxt.getCls(), Mask.class);
+        FacetUtil.addFacet(createMaskFacet(annotation, processClassContaxt.getFacetHolder()));
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        if (processMethodContext.getMethod().getReturnType() == void.class) {
+            return;
+        }
+
+        final Mask annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Mask.class);
+        addMaskFacetAndCorrespondingTitleFacet(processMethodContext.getFacetHolder(), annotation, processMethodContext.getMethod().getReturnType());
+    }
+
+    @Override
+    public void processParams(final ProcessParameterContext processParameterContext) {
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
+        if (processParameterContext.getParamNum() >= parameterTypes.length) {
+            // ignore
+            return;
+        }
+
+        final java.lang.annotation.Annotation[] parameterAnnotations = Annotations.getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (int i = 0; i < parameterAnnotations.length; i++) {
+            if (parameterAnnotations[i] instanceof Mask) {
+                final Mask annotation = (Mask) parameterAnnotations[i];
+                addMaskFacetAndCorrespondingTitleFacet(processParameterContext.getFacetHolder(), annotation, parameterTypes[i]);
+                return;
+            }
+        }
+    }
+
+    private MaskFacet createMaskFacet(final Mask annotation, final FacetHolder holder) {
+        return annotation != null ? new MaskFacetAnnotationForProperty(annotation.value(), null, holder) : null;
+    }
+
+    private boolean addMaskFacetAndCorrespondingTitleFacet(final FacetHolder holder, final Mask annotation, final Class<?> cls) {
+        final MaskFacet maskFacet = createMaskFacet(annotation, holder);
+        if (maskFacet == null) {
+            return false;
+        }
+        FacetUtil.addFacet(maskFacet);
+
+        final ObjectSpecification type = getSpecificationLoader().loadSpecification(cls);
+        final TitleFacet underlyingTitleFacet = type.getFacet(TitleFacet.class);
+        if (underlyingTitleFacet != null) {
+            final TitleFacet titleFacet = new TitleFacetBasedOnMask(maskFacet, underlyingTitleFacet);
+            FacetUtil.addFacet(titleFacet);
+        }
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maskannot/MaskFacetAnnotationForProperty.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maskannot/MaskFacetAnnotationForProperty.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maskannot/MaskFacetAnnotationForProperty.java
new file mode 100644
index 0000000..c1f4ce8
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maskannot/MaskFacetAnnotationForProperty.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.core.progmodel.facets.properties.validate.maskannot;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskEvaluator;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskFacetAbstract;
+
+public class MaskFacetAnnotationForProperty extends MaskFacetAbstract {
+    private final MaskEvaluator evaluator;
+
+    public MaskFacetAnnotationForProperty(final String outputMask, final String inputMask, final FacetHolder holder) {
+        super(outputMask, holder);
+        evaluator = inputMask == null ? null : new MaskEvaluator(inputMask);
+    }
+
+    @Override
+    public boolean doesNotMatch(final ObjectAdapter adapter) {
+        if (evaluator == null) {
+            return false;
+        } else {
+            if (adapter == null) {
+                return false;
+            }
+            final Object object = adapter.getObject();
+            if (object == null) {
+                return false;
+            }
+            return !evaluator.evaluate(object.toString());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maxlenannot/MaxLengthAnnotationForPropertyFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maxlenannot/MaxLengthAnnotationForPropertyFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maxlenannot/MaxLengthAnnotationForPropertyFacetFactory.java
new file mode 100644
index 0000000..30b8889
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maxlenannot/MaxLengthAnnotationForPropertyFacetFactory.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.progmodel.facets.properties.validate.maxlenannot;
+
+import org.apache.isis.applib.annotation.MaxLength;
+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.maxlen.MaxLengthFacet;
+
+public class MaxLengthAnnotationForPropertyFacetFactory extends FacetFactoryAbstract {
+
+    public MaxLengthAnnotationForPropertyFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        final MaxLength annotation = Annotations.getAnnotation(processMethodContext.getMethod(), MaxLength.class);
+        FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
+    }
+
+    private MaxLengthFacet create(final MaxLength annotation, final FacetHolder holder) {
+        return annotation == null ? null : new MaxLengthFacetAnnotationForProperty(annotation.value(), holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maxlenannot/MaxLengthFacetAnnotationForProperty.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maxlenannot/MaxLengthFacetAnnotationForProperty.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maxlenannot/MaxLengthFacetAnnotationForProperty.java
new file mode 100644
index 0000000..1d07ba6
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/maxlenannot/MaxLengthFacetAnnotationForProperty.java
@@ -0,0 +1,31 @@
+/*
+ *  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.progmodel.facets.properties.validate.maxlenannot;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.maxlen.MaxLengthFacetAbstract;
+
+public class MaxLengthFacetAnnotationForProperty extends MaxLengthFacetAbstract {
+
+    public MaxLengthFacetAnnotationForProperty(final int value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/perspec/MustSatisfySpecificationOnPropertyFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/perspec/MustSatisfySpecificationOnPropertyFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/perspec/MustSatisfySpecificationOnPropertyFacet.java
new file mode 100644
index 0000000..faf20a5
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/perspec/MustSatisfySpecificationOnPropertyFacet.java
@@ -0,0 +1,63 @@
+/*
+ *  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.progmodel.facets.properties.validate.perspec;
+
+import java.util.List;
+
+import org.apache.isis.applib.events.ValidityEvent;
+import org.apache.isis.applib.spec.Specification;
+import org.apache.isis.applib.util.ReasonBuffer;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.interactions.ProposedHolder;
+import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
+import org.apache.isis.core.metamodel.interactions.ValidityContext;
+
+public class MustSatisfySpecificationOnPropertyFacet extends FacetAbstract implements ValidatingInteractionAdvisor {
+
+    public static Class<? extends Facet> type() {
+        return MustSatisfySpecificationOnPropertyFacet.class;
+    }
+
+    private final List<Specification> specifications;
+
+    public MustSatisfySpecificationOnPropertyFacet(final List<Specification> specifications, final FacetHolder holder) {
+        super(type(), holder, Derivation.NOT_DERIVED);
+        this.specifications = specifications;
+    }
+
+    @Override
+    public String invalidates(final ValidityContext<? extends ValidityEvent> validityContext) {
+        if (!(validityContext instanceof ProposedHolder)) {
+            return null;
+        }
+        final ProposedHolder proposedHolder = (ProposedHolder) validityContext;
+        final ObjectAdapter targetNO = proposedHolder.getProposed();
+        final Object targetObject = targetNO.getObject();
+        final ReasonBuffer buf = new ReasonBuffer();
+        for (final Specification specification : specifications) {
+            buf.append(specification.satisfies(targetObject));
+        }
+        return buf.getReason();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/perspec/MustSatisfySpecificationOnPropertyFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/perspec/MustSatisfySpecificationOnPropertyFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/perspec/MustSatisfySpecificationOnPropertyFacetFactory.java
new file mode 100644
index 0000000..4a199a5
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/perspec/MustSatisfySpecificationOnPropertyFacetFactory.java
@@ -0,0 +1,78 @@
+/*
+ *  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.progmodel.facets.properties.validate.perspec;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.applib.annotation.MustSatisfy;
+import org.apache.isis.applib.spec.Specification;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+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 MustSatisfySpecificationOnPropertyFacetFactory extends FacetFactoryAbstract {
+
+    public MustSatisfySpecificationOnPropertyFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        FacetUtil.addFacet(create(processMethodContext.getMethod(), processMethodContext.getFacetHolder()));
+    }
+
+    private Facet create(final Method method, final FacetHolder holder) {
+        return create(Annotations.getAnnotation(method, MustSatisfy.class), holder);
+    }
+
+    private Facet create(final MustSatisfy annotation, final FacetHolder holder) {
+        if (annotation == null) {
+            return null;
+        }
+        final Class<?>[] values = annotation.value();
+        final List<Specification> specifications = new ArrayList<Specification>();
+        for (final Class<?> value : values) {
+            final Specification specification = newSpecificationElseNull(value);
+            if (specification != null) {
+                specifications.add(specification);
+            }
+        }
+        return specifications.size() > 0 ? new MustSatisfySpecificationOnPropertyFacet(specifications, holder) : null;
+    }
+
+    private static Specification newSpecificationElseNull(final Class<?> value) {
+        if (!(Specification.class.isAssignableFrom(value))) {
+            return null;
+        }
+        try {
+            return (Specification) value.newInstance();
+        } catch (final InstantiationException e) {
+            return null;
+        } catch (final IllegalAccessException e) {
+            return null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/regexannot/RegExFacetAnnotationForProperty.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/regexannot/RegExFacetAnnotationForProperty.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/regexannot/RegExFacetAnnotationForProperty.java
new file mode 100644
index 0000000..42ce601
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/regexannot/RegExFacetAnnotationForProperty.java
@@ -0,0 +1,59 @@
+/*
+ *  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.progmodel.facets.properties.validate.regexannot;
+
+import java.util.regex.Pattern;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.regex.RegExFacetAbstract;
+
+public class RegExFacetAnnotationForProperty extends RegExFacetAbstract {
+
+    private final Pattern pattern;
+
+    public RegExFacetAnnotationForProperty(final String validation, final String format, final boolean caseSensitive, final FacetHolder holder) {
+        super(validation, format, caseSensitive, holder);
+        pattern = Pattern.compile(validation(), patternFlags());
+    }
+
+    @Override
+    public String format(final String text) {
+        if (text == null) {
+            return "<not a string>";
+        }
+        if (format() == null || format().length() == 0) {
+            return text;
+        }
+        return pattern.matcher(text).replaceAll(format());
+    }
+
+    @Override
+    public boolean doesNotMatch(final String text) {
+        if (text == null) {
+            return true;
+        }
+        return !pattern.matcher(text).matches();
+    }
+
+    private int patternFlags() {
+        return !caseSensitive() ? Pattern.CASE_INSENSITIVE : 0;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/regexannot/RegExFacetAnnotationForPropertyFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/regexannot/RegExFacetAnnotationForPropertyFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/regexannot/RegExFacetAnnotationForPropertyFacetFactory.java
new file mode 100644
index 0000000..d64e93b
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/validate/regexannot/RegExFacetAnnotationForPropertyFacetFactory.java
@@ -0,0 +1,75 @@
+/*
+ *  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.progmodel.facets.properties.validate.regexannot;
+
+import org.apache.isis.applib.annotation.RegEx;
+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.title.TitleFacet;
+import org.apache.isis.core.progmodel.facets.object.regex.RegExFacet;
+import org.apache.isis.core.progmodel.facets.object.regex.TitleFacetFormattedByRegex;
+
+public class RegExFacetAnnotationForPropertyFacetFactory extends FacetFactoryAbstract {
+
+    public RegExFacetAnnotationForPropertyFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        final Class<?> returnType = processMethodContext.getMethod().getReturnType();
+        if (!Annotations.isString(returnType)) {
+            return;
+        }
+        final RegEx annotation = Annotations.getAnnotation(processMethodContext.getMethod(), RegEx.class);
+        addRegexFacetAndCorrespondingTitleFacet(processMethodContext.getFacetHolder(), annotation);
+    }
+
+    private void addRegexFacetAndCorrespondingTitleFacet(final FacetHolder holder, final RegEx annotation) {
+        final RegExFacet regexFacet = createRegexFacet(annotation, holder);
+        if (regexFacet == null) {
+            return;
+        }
+        FacetUtil.addFacet(regexFacet);
+
+        final TitleFacet titleFacet = createTitleFacet(regexFacet);
+        FacetUtil.addFacet(titleFacet);
+    }
+
+    private RegExFacet createRegexFacet(final RegEx annotation, final FacetHolder holder) {
+        if (annotation == null) {
+            return null;
+        }
+
+        final String validationExpression = annotation.validation();
+        final boolean caseSensitive = annotation.caseSensitive();
+        final String formatExpression = annotation.format();
+
+        return new RegExFacetAnnotationForProperty(validationExpression, formatExpression, caseSensitive, holder);
+    }
+
+    private TitleFacet createTitleFacet(final RegExFacet regexFacet) {
+        return new TitleFacetFormattedByRegex(regexFacet);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/DateAndTimeValueSemanticsProviderAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/DateAndTimeValueSemanticsProviderAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/DateAndTimeValueSemanticsProviderAbstract.java
new file mode 100644
index 0000000..1f81cf5
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/DateAndTimeValueSemanticsProviderAbstract.java
@@ -0,0 +1,111 @@
+/*
+ *  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.progmodel.facets.value;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public abstract class DateAndTimeValueSemanticsProviderAbstract<T> extends ValueSemanticsProviderAbstractTemporal<T> {
+
+    private static Map<String, DateFormat> formats = Maps.newHashMap();
+
+    static {
+        formats.put(ISO_ENCODING_FORMAT, createDateEncodingFormat("yyyyMMdd'T'HHmmssSSS"));
+        formats.put("iso", createDateFormat("yyyy-MM-dd HH:mm"));
+        formats.put("medium", DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT));
+    }
+
+    private static final Object DEFAULT_VALUE = null; // no default
+    private static final int TYPICAL_LENGTH = 18;
+
+    @SuppressWarnings("unchecked")
+    public DateAndTimeValueSemanticsProviderAbstract(final FacetHolder holder, final Class<T> adaptedClass, final Immutability immutability, final EqualByContent equalByContent, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super("datetime", holder, adaptedClass, TYPICAL_LENGTH, immutability, equalByContent, (T) DEFAULT_VALUE, configuration, context);
+
+        final String formatRequired = configuration.getString(ConfigurationConstants.ROOT + "value.format.datetime");
+        if (formatRequired == null) {
+            format = formats().get(defaultFormat());
+        } else {
+            setMask(formatRequired);
+        }
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // temporal-specific stuff
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String defaultFormat() {
+        return "medium";
+    }
+
+    @Override
+    protected Map<String, DateFormat> formats() {
+        return formats;
+    }
+
+    @Override
+    protected DateFormat format(final Localization localization) {
+        final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, localization.getLocale());
+        dateFormat.setTimeZone(localization.getTimeZone());
+        return dateFormat;
+    }
+
+    @Override
+    public String toString() {
+        return "JavaDateTimeValueSemanticsProvider: " + format;
+    }
+
+    protected List<DateFormat> formatsToTry(Localization localization) {
+        List<DateFormat> formats = new ArrayList<DateFormat>();
+
+        Locale locale = localization == null ? Locale.getDefault() : localization.getLocale();
+        formats.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale));
+        formats.add(createDateFormat("yyyy-MM-dd HH:mm:ss.SSS"));
+        formats.add(createDateFormat("yyyyMMdd'T'HHmmssSSS"));
+        formats.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, locale));
+        formats.add(createDateFormat("yyyy-MM-dd HH:mm:ss"));
+        formats.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale));
+        formats.add(createDateFormat("yyyyMMdd'T'HHmmss"));
+        formats.add(createDateFormat("yyyy-MM-dd HH:mm"));
+        formats.add(createDateFormat("yyyyMMdd'T'HHmm"));
+        formats.add(createDateFormat("dd-MMM-yyyy HH:mm"));
+
+        for (DateFormat format : formats) {
+            format.setTimeZone(localization == null ? TimeZone.getDefault() : localization.getTimeZone());
+        }
+
+        return formats;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstractTemporal.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstractTemporal.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstractTemporal.java
new file mode 100644
index 0000000..1e5ed6a
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/ValueSemanticsProviderAbstractTemporal.java
@@ -0,0 +1,370 @@
+/*
+ *  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.progmodel.facets.value;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.TimeZone;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.adapters.EncodingException;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.apache.isis.core.progmodel.facets.value.date.DateValueFacet;
+
+public abstract class ValueSemanticsProviderAbstractTemporal<T> extends ValueSemanticsProviderAndFacetAbstract<T> implements DateValueFacet {
+
+    /**
+     * Introduced to allow BDD tests to provide a different format string
+     * "mid-flight".
+     */
+    public static void setFormat(final String propertyType, final String formatStr) {
+        FORMATS.get().put(propertyType, formatStr);
+    }
+
+    private final static ThreadLocal<Map<String, String>> FORMATS = new ThreadLocal<Map<String, String>>() {
+        @Override
+        protected java.util.Map<String, String> initialValue() {
+            return Maps.newHashMap();
+        }
+    };
+
+    protected static final String ISO_ENCODING_FORMAT = "iso_encoding";
+    protected static final TimeZone UTC_TIME_ZONE;
+
+    public final static String FORMAT_KEY_PREFIX = ConfigurationConstants.ROOT + "value.format.";
+
+    static {
+        TimeZone timeZone = TimeZone.getTimeZone("Etc/UTC");
+        if (timeZone == null) {
+            timeZone = TimeZone.getTimeZone("UTC");
+        }
+        UTC_TIME_ZONE = timeZone;
+    }
+
+    /**
+     * The facet type, used if not specified explicitly in the constructor.
+     */
+    public static Class<? extends Facet> type() {
+        return DateValueFacet.class;
+    }
+
+    protected static DateFormat createDateFormat(final String mask) {
+        return new SimpleDateFormat(mask);
+    }
+    
+    /**
+     * for encoding always use UTC.
+     */
+    protected static DateFormat createDateEncodingFormat(final String mask) {
+        DateFormat encodingFormat = createDateFormat(mask);
+        encodingFormat.setTimeZone(UTC_TIME_ZONE);
+        return encodingFormat;
+    }
+ 
+    private final DateFormat encodingFormat;
+    protected DateFormat format;
+    private String configuredFormat;
+    private String propertyType;
+
+    /**
+     * Uses {@link #type()} as the facet type.
+     */
+    public ValueSemanticsProviderAbstractTemporal(final String propertyName, final FacetHolder holder, final Class<T> adaptedClass, final int typicalLength, final Immutability immutability, final EqualByContent equalByContent, final T defaultValue, final IsisConfiguration configuration,
+            final ValueSemanticsProviderContext context) {
+        this(propertyName, type(), holder, adaptedClass, typicalLength, immutability, equalByContent, defaultValue, configuration, context);
+    }
+
+    /**
+     * Allows the specific facet subclass to be specified (rather than use
+     * {@link #type()}.
+     */
+    public ValueSemanticsProviderAbstractTemporal(final String propertyType, final Class<? extends Facet> facetType, final FacetHolder holder, final Class<T> adaptedClass, final int typicalLength, final Immutability immutability, final EqualByContent equalByContent, final T defaultValue,
+            final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(facetType, holder, adaptedClass, typicalLength, immutability, equalByContent, defaultValue, configuration, context);
+        configureFormats();
+
+        this.propertyType = propertyType;
+        configuredFormat = getConfiguration().getString(FORMAT_KEY_PREFIX + propertyType, defaultFormat()).toLowerCase().trim();
+        buildFormat(configuredFormat);
+
+        encodingFormat = formats().get(ISO_ENCODING_FORMAT);
+    }
+
+    protected void configureFormats() {
+        final Map<String, DateFormat> formats = formats();
+        for (final Map.Entry<String, DateFormat> mapEntry : formats.entrySet()) {
+            final DateFormat format = mapEntry.getValue();
+            format.setLenient(false);
+            if (ignoreTimeZone()) {
+                format.setTimeZone(UTC_TIME_ZONE);
+            }
+        }
+    }
+
+    protected void buildDefaultFormatIfRequired() {
+        final Map<String, String> map = FORMATS.get();
+        final String currentlyConfiguredFormat = map.get(propertyType);
+        if (currentlyConfiguredFormat == null || configuredFormat.equals(currentlyConfiguredFormat)) {
+            return;
+        }
+
+        // (re)create format
+        configuredFormat = currentlyConfiguredFormat;
+        buildFormat(configuredFormat);
+    }
+
+    protected void buildFormat(final String configuredFormat) {
+        final Map<String, DateFormat> formats = formats();
+        format = formats.get(configuredFormat);
+        if (format == null) {
+            setMask(configuredFormat);
+        }
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Parsing
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected T doParse(final Object context, final String entry, final Localization localization) {
+        buildDefaultFormatIfRequired();
+        final String dateString = entry.trim();
+        final String str = dateString.toLowerCase();
+        if (str.equals("today") || str.equals("now")) {
+            return now();
+        } else if (dateString.startsWith("+")) {
+            return relativeDate(context == null ? now() : context, dateString, true);
+        } else if (dateString.startsWith("-")) {
+            return relativeDate(context == null ? now() : context, dateString, false);
+        } else {
+            return parseDate(dateString, context == null ? now() : context, localization);
+        }
+    }
+
+    private T parseDate(final String dateString, final Object original, final Localization localization) {
+        List<DateFormat> elements = formatsToTry(localization);
+        return setDate(parseDate(dateString, elements.iterator()));
+    }
+
+    protected abstract List<DateFormat> formatsToTry(Localization localization);
+
+    private Date parseDate(final String dateString, final Iterator<DateFormat> elements) {
+        final DateFormat format = elements.next();
+        try {
+            return format.parse(dateString);
+        } catch (final ParseException e) {
+            if (elements.hasNext()) {
+                return parseDate(dateString, elements);
+            } else {
+                throw new TextEntryParseException("Not recognised as a date: " + dateString);
+            }
+        }
+    }
+
+    private T relativeDate(final Object object, final String str, final boolean add) {
+        if (str.equals("")) {
+            return now();
+        }
+
+        try {
+            T date = (T) object;
+            final StringTokenizer st = new StringTokenizer(str.substring(1), " ");
+            while (st.hasMoreTokens()) {
+                final String token = st.nextToken();
+                date = relativeDate2(date, token, add);
+            }
+            return date;
+        } catch (final Exception e) {
+            return now();
+        }
+    }
+
+    private T relativeDate2(final T original, String str, final boolean add) {
+        int hours = 0;
+        int minutes = 0;
+        int days = 0;
+        int months = 0;
+        int years = 0;
+
+        if (str.endsWith("H")) {
+            str = str.substring(0, str.length() - 1);
+            hours = Integer.valueOf(str).intValue();
+        } else if (str.endsWith("M")) {
+            str = str.substring(0, str.length() - 1);
+            minutes = Integer.valueOf(str).intValue();
+        } else if (str.endsWith("w")) {
+            str = str.substring(0, str.length() - 1);
+            days = 7 * Integer.valueOf(str).intValue();
+        } else if (str.endsWith("y")) {
+            str = str.substring(0, str.length() - 1);
+            years = Integer.valueOf(str).intValue();
+        } else if (str.endsWith("m")) {
+            str = str.substring(0, str.length() - 1);
+            months = Integer.valueOf(str).intValue();
+        } else if (str.endsWith("d")) {
+            str = str.substring(0, str.length() - 1);
+            days = Integer.valueOf(str).intValue();
+        } else {
+            days = Integer.valueOf(str).intValue();
+        }
+
+        if (add) {
+            return add(original, years, months, days, hours, minutes);
+        } else {
+            return add(original, -years, -months, -days, -hours, -minutes);
+        }
+    }
+
+    // ///////////////////////////////////////////////////////////////////////////
+    // TitleProvider
+    // ///////////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String titleString(final Object value, final Localization localization) {
+        if (value == null) {
+            return null;
+        }
+        final Date date = dateValue(value);
+        DateFormat f = format;
+        if (localization != null) {
+            f = format(localization);
+        }
+        return titleString(f, date);
+    }
+
+    protected DateFormat format(final Localization localization) {
+        return format;
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        final Date date = dateValue(value);
+        return titleString(new SimpleDateFormat(usingMask), date);
+    }
+
+    private String titleString(final DateFormat formatter, final Date date) {
+        return date == null ? "" : formatter.format(date);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // EncoderDecoder
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        final Date date = dateValue(object);
+        return encode(date);
+    }
+
+    private synchronized String encode(final Date date) {
+        return encodingFormat.format(date);
+    }
+
+    @Override
+    protected T doRestore(final String data) {
+        final Calendar cal = Calendar.getInstance();
+        cal.setTimeZone(UTC_TIME_ZONE);
+
+        // TODO allow restoring of dates where datetime expected, and datetimes where date expected - to allow for changing of field types. 
+        try {
+            cal.setTime(parse(data));
+            clearFields(cal);
+            return setDate(cal.getTime());
+        } catch (final ParseException e) {
+            if (data.charAt(0) == 'T') {
+                final long millis = Long.parseLong(data.substring(1));
+                cal.setTimeInMillis(millis);
+                clearFields(cal);
+                return setDate(cal.getTime());
+            } else {
+                throw new EncodingException(e);
+            }
+        }
+    }
+
+    private synchronized Date parse(final String data) throws ParseException {
+        return encodingFormat.parse(data);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // DateValueFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public final Date dateValue(final ObjectAdapter object) {
+        return object == null ? null : dateValue(object.getObject());
+    }
+
+    @Override
+    public final ObjectAdapter createValue(final Date date) {
+        return getAdapterManager().adapterFor(setDate(date));
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // temporal-specific stuff
+    // //////////////////////////////////////////////////////////////////
+
+    protected abstract T add(T original, int years, int months, int days, int hours, int minutes);
+
+    protected void clearFields(final Calendar cal) {
+    }
+
+    protected abstract Date dateValue(Object value);
+
+    protected abstract String defaultFormat();
+
+    protected abstract Map<String, DateFormat> formats();
+
+    protected boolean ignoreTimeZone() {
+        return false;
+    }
+
+    protected abstract T now();
+
+    protected abstract T setDate(Date date);
+
+    public void setMask(final String mask) {
+        format = new SimpleDateFormat(mask);
+        format.setTimeZone(UTC_TIME_ZONE);
+        format.setLenient(false);
+    }
+
+    protected boolean isEmpty() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueFacet.java
new file mode 100644
index 0000000..1d8fa10
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueFacet.java
@@ -0,0 +1,26 @@
+/*
+ *  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.progmodel.facets.value.bigdecimal;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface BigDecimalValueFacet extends Facet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueSemanticsProvider.java
new file mode 100644
index 0000000..1cd3f63
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueSemanticsProvider.java
@@ -0,0 +1,123 @@
+/*
+ *  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.progmodel.facets.value.bigdecimal;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.Locale;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public class BigDecimalValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<BigDecimal> implements BigDecimalValueFacet {
+
+    private static Class<? extends Facet> type() {
+        return BigDecimalValueFacet.class;
+    }
+
+    private static final int TYPICAL_LENGTH = 10;
+    private static final BigDecimal DEFAULT_VALUE = new BigDecimal(0);
+
+    private final NumberFormat format;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public BigDecimalValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public BigDecimalValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, BigDecimal.class, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, DEFAULT_VALUE, configuration, context);
+        format = determineNumberFormat("value.format.decimal");
+    }
+
+    public void setLocale(final Locale l) {
+        // TODO Auto-generated method stub
+
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected BigDecimal doParse(final Object context, final String entry) {
+        try {
+            return new BigDecimal(entry);
+        } catch (final NumberFormatException e) {
+            throw new TextEntryParseException("Not an decimal " + entry, e);
+        }
+    }
+
+    @Override
+    public String titleString(final Object object, final Localization localization) {
+        return titleString(format, object);
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(new DecimalFormat(usingMask), value);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // EncoderDecoder
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        // for dotnet compatibility - toString pre 1.3 was equivalent to
+        // toPlainString later.
+        try {
+            final Class<?> type = object.getClass();
+            try {
+                return (String) type.getMethod("toPlainString", (Class[]) null).invoke(object, (Object[]) null);
+            } catch (final NoSuchMethodException nsm) {
+                return (String) type.getMethod("toString", (Class[]) null).invoke(object, (Object[]) null);
+            }
+        } catch (final Exception e) {
+            throw new IsisException(e);
+        }
+
+    }
+
+    @Override
+    protected BigDecimal doRestore(final String data) {
+        return new BigDecimal(data);
+    }
+
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "BigDecimalValueSemanticsProvider: " + format;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueTypeFacetFactory.java
new file mode 100644
index 0000000..d634df6
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/bigdecimal/BigDecimalValueTypeFacetFactory.java
@@ -0,0 +1,44 @@
+/*
+ *  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.progmodel.facets.value.bigdecimal;
+
+import java.math.BigDecimal;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class BigDecimalValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<BigDecimal> {
+
+    public BigDecimalValueTypeFacetFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+        if (type != BigDecimal.class) {
+            return;
+        }
+        addFacets(new BigDecimalValueSemanticsProvider(holder, getConfiguration(), getContext()));
+        return;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueFacet.java
new file mode 100644
index 0000000..b3899d9
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueFacet.java
@@ -0,0 +1,26 @@
+/*
+ *  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.progmodel.facets.value.biginteger;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface BigIntegerValueFacet extends Facet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueSemanticsProvider.java
new file mode 100644
index 0000000..e43febf
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueSemanticsProvider.java
@@ -0,0 +1,106 @@
+/*
+ *  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.progmodel.facets.value.biginteger;
+
+import java.math.BigInteger;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.TextEntryParseException;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public class BigIntegerValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<BigInteger> implements BigIntegerValueFacet {
+
+    private static final int TYPICAL_LENGTH = 10;
+
+    private static Class<? extends Facet> type() {
+        return BigIntegerValueFacet.class;
+    }
+
+    private static final BigInteger DEFAULT_VALUE = BigInteger.valueOf(0);
+
+    private final NumberFormat format;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public BigIntegerValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public BigIntegerValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+
+        super(type(), holder, BigInteger.class, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, DEFAULT_VALUE, configuration, context);
+        format = determineNumberFormat("value.format.int");
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected BigInteger doParse(final Object context, final String entry) {
+        try {
+            return new BigInteger(entry);
+        } catch (final NumberFormatException e) {
+            throw new TextEntryParseException("Not an integer " + entry, e);
+        }
+    }
+
+    @Override
+    public String titleString(final Object object, final Localization localization) {
+        return titleString(format, object);
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(new DecimalFormat(usingMask), value);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // EncoderDecoder
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        return object.toString();
+    }
+
+    @Override
+    protected BigInteger doRestore(final String data) {
+        return new BigInteger(data);
+    }
+
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "BigIntegerValueSemanticsProvider: " + format;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueTypeFacetFactory.java
new file mode 100644
index 0000000..5c2d5e3
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/biginteger/BigIntegerValueTypeFacetFactory.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.biginteger;
+
+import java.math.BigInteger;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class BigIntegerValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<BigInteger> {
+
+    public BigIntegerValueTypeFacetFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+        if (type != BigInteger.class) {
+            return;
+        }
+        addFacets(new BigIntegerValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueFacet.java
new file mode 100644
index 0000000..aa72e29
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueFacet.java
@@ -0,0 +1,26 @@
+/*
+ *  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.progmodel.facets.value.blobs;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface BlobValueFacet extends Facet {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueSemanticsProvider.java
new file mode 100644
index 0000000..1434548
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueSemanticsProvider.java
@@ -0,0 +1,119 @@
+/*
+ *  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.progmodel.facets.value.blobs;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.isis.applib.adapters.DefaultsProvider;
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.applib.value.Blob;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public class BlobValueSemanticsProvider extends ValueSemanticsProviderAndFacetAbstract<Blob> implements BlobValueFacet {
+
+    private static final int TYPICAL_LENGTH = 0;
+
+    private static Class<? extends Facet> type() {
+        return BlobValueFacet.class;
+    }
+
+    private static final Blob DEFAULT_VALUE = null;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public BlobValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public BlobValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, Blob.class, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.NOT_HONOURED, DEFAULT_VALUE, configuration, context);
+    }
+
+    @Override
+    public String titleString(final Object object, final Localization localization) {
+        return object != null? ((Blob)object).getName(): "[null]";
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return titleString(value, null);
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public Parser<Blob> getParser() {
+        return null;
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // DefaultsProvider
+    // //////////////////////////////////////////////////////////////////
+    
+    @Override
+    public DefaultsProvider<Blob> getDefaultsProvider() {
+        return null;
+    }
+    
+    // //////////////////////////////////////////////////////////////////
+    // EncoderDecoder
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected String doEncode(final Object object) {
+        Blob blob = (Blob)object;
+        return blob.getName() + ":" + blob.getMimeType().getBaseType() + ":" + Base64.encodeBase64String((blob.getBytes()));
+    }
+
+    @Override
+    protected Blob doRestore(final String data) {
+        final int colonIdx = data.indexOf(':');
+        final String name  = data.substring(0, colonIdx);
+        final int colon2Idx  = data.indexOf(":", colonIdx+1);
+        final String mimeTypeBase = data.substring(colonIdx+1, colon2Idx);
+        final byte[] bytes = Base64.decodeBase64(data.substring(colon2Idx+1));
+        try {
+            return new Blob(name, new MimeType(mimeTypeBase), bytes);
+        } catch (MimeTypeParseException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "BlobValueSemanticsProvider";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueTypeFacetFactory.java
new file mode 100644
index 0000000..878fcc7
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/blobs/BlobValueTypeFacetFactory.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.progmodel.facets.value.blobs;
+
+import org.apache.isis.applib.value.Blob;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class BlobValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Blob> {
+
+    public BlobValueTypeFacetFactory() {
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+        if (type != Blob.class) {
+            return;
+        }
+        addFacets(new BlobValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanPrimitiveValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanPrimitiveValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanPrimitiveValueSemanticsProvider.java
new file mode 100644
index 0000000..57cf511
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanPrimitiveValueSemanticsProvider.java
@@ -0,0 +1,76 @@
+/*
+ *  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.progmodel.facets.value.booleans;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public class BooleanPrimitiveValueSemanticsProvider extends BooleanValueSemanticsProviderAbstract implements PropertyDefaultFacet {
+
+    private static final Boolean DEFAULT_VALUE = Boolean.FALSE;
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public BooleanPrimitiveValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public BooleanPrimitiveValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, boolean.class, DEFAULT_VALUE, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // PropertyDefault
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public ObjectAdapter getDefault(final ObjectAdapter inObject) {
+        return createAdapter(boolean.class, Boolean.FALSE);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // BooleanValueFacet impl
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public void reset(final ObjectAdapter object) {
+        object.replacePojo(Boolean.FALSE);
+    }
+
+    @Override
+    public void set(final ObjectAdapter object) {
+        object.replacePojo(Boolean.TRUE);
+    }
+
+    @Override
+    public void toggle(final ObjectAdapter object) {
+        final boolean current = ((Boolean) object.getObject()).booleanValue();
+        final boolean toggled = !current;
+        object.replacePojo(Boolean.valueOf(toggled));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanPrimitiveValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanPrimitiveValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanPrimitiveValueTypeFacetFactory.java
new file mode 100644
index 0000000..d09856f
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanPrimitiveValueTypeFacetFactory.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.progmodel.facets.value.booleans;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class BooleanPrimitiveValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Boolean> {
+
+    public BooleanPrimitiveValueTypeFacetFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != boolean.class) {
+            return;
+        }
+        addFacets(new BooleanPrimitiveValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanValueFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanValueFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanValueFacet.java
new file mode 100644
index 0000000..5c06685
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/booleans/BooleanValueFacet.java
@@ -0,0 +1,34 @@
+/*
+ *  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.progmodel.facets.value.booleans;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface BooleanValueFacet extends Facet {
+
+    boolean isSet(ObjectAdapter object);
+
+    void set(ObjectAdapter object);
+
+    void reset(ObjectAdapter object);
+
+    void toggle(ObjectAdapter object);
+}