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:11 UTC

[33/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/value/datejodalocal/JodaLocalDateValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datejodalocal/JodaLocalDateValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datejodalocal/JodaLocalDateValueTypeFacetFactory.java
new file mode 100644
index 0000000..d9b0cd8
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datejodalocal/JodaLocalDateValueTypeFacetFactory.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.value.datejodalocal;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class JodaLocalDateValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<LocalDate> {
+
+    public JodaLocalDateValueTypeFacetFactory() {
+     // as per inherited DateTimeValueSemanticsProvider#facetType
+        super(); 
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != LocalDate.class) {
+            return;
+        }
+        addFacets(new JodaLocalDateValueSemanticsProvider(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/datesql/JavaSqlDateValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datesql/JavaSqlDateValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datesql/JavaSqlDateValueSemanticsProvider.java
new file mode 100644
index 0000000..88e5193
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datesql/JavaSqlDateValueSemanticsProvider.java
@@ -0,0 +1,91 @@
+/*
+ *  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.datesql;
+
+import java.sql.Date;
+import java.util.Calendar;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.clock.Clock;
+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;
+import org.apache.isis.core.progmodel.facets.value.date.DateValueSemanticsProviderAbstract;
+import org.apache.isis.core.progmodel.facets.value.dateutil.JavaUtilDateValueSemanticsProvider;
+import org.apache.isis.core.progmodel.facets.value.timesql.JavaSqlTimeValueSemanticsProvider;
+
+/**
+ * An adapter that handles {@link java.sql.Date} with only date component.
+ * 
+ * @see JavaUtilDateValueSemanticsProvider
+ * @see JavaSqlTimeValueSemanticsProvider
+ */
+public class JavaSqlDateValueSemanticsProvider extends DateValueSemanticsProviderAbstract<Date> {
+
+    private static final Date DEFAULT_VALUE = null; // no default
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public JavaSqlDateValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public JavaSqlDateValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, Date.class, Immutability.NOT_IMMUTABLE, EqualByContent.NOT_HONOURED, DEFAULT_VALUE, configuration, context);
+    }
+
+    @Override
+    protected Date add(final Date original, final int years, final int months, final int days, final int hours, final int minutes) {
+        final Date date = original;
+        final Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.HOUR, 0);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.AM_PM, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+
+        cal.add(Calendar.YEAR, years);
+        cal.add(Calendar.MONTH, months);
+        cal.add(Calendar.DAY_OF_MONTH, days);
+
+        return setDate(cal.getTime());
+    }
+
+    @Override
+    protected java.util.Date dateValue(final Object value) {
+        return (java.util.Date) value;
+    }
+
+    @Override
+    protected Date setDate(final java.util.Date date) {
+        return new Date(date.getTime());
+    }
+
+    @Override
+    protected Date now() {
+        return new Date(Clock.getTime());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datesql/JavaSqlDateValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datesql/JavaSqlDateValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datesql/JavaSqlDateValueTypeFacetFactory.java
new file mode 100644
index 0000000..b1331b4
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datesql/JavaSqlDateValueTypeFacetFactory.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.value.datesql;
+
+import java.sql.Date;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class JavaSqlDateValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Date> {
+
+    public JavaSqlDateValueTypeFacetFactory() {
+        // as per inherited TimeValueSemanticsProvider#facetType 
+        super(); 
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != Date.class) {
+            return;
+        }
+        addFacets(new JavaSqlDateValueSemanticsProvider(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/datetime/DateTimeValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetime/DateTimeValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetime/DateTimeValueSemanticsProvider.java
new file mode 100644
index 0000000..1a56366
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetime/DateTimeValueSemanticsProvider.java
@@ -0,0 +1,69 @@
+/*
+ *  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.datetime;
+
+import java.util.Date;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.value.DateTime;
+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;
+import org.apache.isis.core.progmodel.facets.value.DateAndTimeValueSemanticsProviderAbstract;
+
+public class DateTimeValueSemanticsProvider extends DateAndTimeValueSemanticsProviderAbstract<DateTime> {
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public DateTimeValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public DateTimeValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, DateTime.class, Immutability.NOT_IMMUTABLE, EqualByContent.NOT_HONOURED, configuration, context);
+    }
+
+    @Override
+    protected Date dateValue(final Object value) {
+        final DateTime date = (DateTime) value;
+        return date == null ? null : date.dateValue();
+    }
+
+    @Override
+    protected DateTime add(final DateTime original, final int years, final int months, final int days, final int hours, final int minutes) {
+        DateTime date = original;
+        date = date.add(years, months, days, hours, minutes);
+        return date;
+    }
+
+    @Override
+    protected DateTime now() {
+        return new DateTime();
+    }
+
+    @Override
+    protected DateTime setDate(final Date date) {
+        return new DateTime(date);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetime/DateTimeValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetime/DateTimeValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetime/DateTimeValueTypeFacetFactory.java
new file mode 100644
index 0000000..937f4b2
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetime/DateTimeValueTypeFacetFactory.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.datetime;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class DateTimeValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<org.apache.isis.applib.value.DateTime> {
+
+    public DateTimeValueTypeFacetFactory() {
+        super(); // as per inherited
+                                     // DateTimeValueSemanticsProvider#facetType
+        // (inherited)
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != org.apache.isis.applib.value.DateTime.class) {
+            return;
+        }
+        addFacets(new DateTimeValueSemanticsProvider(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/datetimejoda/JodaDateTimeValueFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueFacet.java
new file mode 100644
index 0000000..7c91563
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueFacet.java
@@ -0,0 +1,33 @@
+/*
+ *  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.datetimejoda;
+
+import org.joda.time.DateTime;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface JodaDateTimeValueFacet extends Facet {
+
+    DateTime dateValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(DateTime date);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.java
new file mode 100644
index 0000000..9f29f30
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.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.core.progmodel.facets.value.datetimejoda;
+
+import java.util.Date;
+
+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.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.joda.time.DateTime;
+
+public class JodaDateTimeValueSemanticsProvider extends JodaDateTimeValueSemanticsProviderAbstract<DateTime> {
+
+    // no default
+    private static final DateTime DEFAULT_VALUE = null;
+
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public JodaDateTimeValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public JodaDateTimeValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, DateTime.class, DEFAULT_VALUE, configuration, context);
+    }
+
+    @Override
+    protected DateTime add(final DateTime original, final int years, final int months, final int days, final int hours, final int minutes) {
+        if(hours != 0 || minutes != 0) {
+            throw new IllegalArgumentException("cannot add non-zero hours or minutes to a DateTime");
+        }
+        return original.plusYears(years).plusMonths(months).plusDays(days);
+    }
+
+    @Override
+    protected DateTime now() {
+        return new DateTime();
+    }
+
+    @Override
+    protected Date dateValue(final Object value) {
+        return ((DateTime) value).toDateTime().toDate();
+    }
+
+    @Override
+    protected DateTime setDate(final Date date) {
+        return new DateTime(date.getTime());
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java
new file mode 100644
index 0000000..2966972
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java
@@ -0,0 +1,118 @@
+/*
+ *  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.datetimejoda;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+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;
+import org.apache.isis.core.progmodel.facets.value.ValueSemanticsProviderAbstractTemporal;
+
+public abstract class JodaDateTimeValueSemanticsProviderAbstract<T> extends ValueSemanticsProviderAbstractTemporal<T> {
+
+    private static Map<String, DateFormat> formats = Maps.newHashMap();
+
+    static {
+        formats.put(ISO_ENCODING_FORMAT, createDateEncodingFormat("yyyyMMdd"));
+        formats.put("iso", createDateFormat("yyyy-MM-dd"));
+        formats.put("medium", DateFormat.getDateInstance(DateFormat.MEDIUM));
+    }
+
+    public JodaDateTimeValueSemanticsProviderAbstract(final FacetHolder holder, final Class<T> adaptedClass, final T defaultValue, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super("date", holder, adaptedClass, 12, Immutability.IMMUTABLE, EqualByContent.HONOURED, defaultValue, configuration, context);
+
+        final String formatRequired = configuration.getString(ConfigurationConstants.ROOT + "value.format.date");
+        if (formatRequired == null) {
+            format = formats().get(defaultFormat());
+        } else {
+            setMask(formatRequired);
+        }
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // temporal-specific stuff
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected void clearFields(final Calendar cal) {
+        cal.set(Calendar.HOUR, 0);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.AM_PM, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+    }
+
+    @Override
+    protected String defaultFormat() {
+        return "medium";
+    }
+
+    @Override
+    protected boolean ignoreTimeZone() {
+        return true;
+    }
+
+    @Override
+    protected Map<String, DateFormat> formats() {
+        return formats;
+    }
+
+    @Override
+    public String toString() {
+        return "DateValueSemanticsProvider: " + format;
+    }
+
+    @Override
+    protected DateFormat format(final Localization localization) {
+        final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, localization.getLocale());
+        dateFormat.setTimeZone(UTC_TIME_ZONE);
+        return dateFormat;
+    }
+
+    protected List<DateFormat> formatsToTry(Localization localization) {
+        List<DateFormat> formats = new ArrayList<DateFormat>();
+
+        Locale locale = localization == null ? Locale.getDefault() : localization.getLocale();
+        formats.add(DateFormat.getDateInstance(DateFormat.LONG, locale));
+        formats.add(DateFormat.getDateInstance(DateFormat.MEDIUM, locale));
+        formats.add(DateFormat.getDateInstance(DateFormat.SHORT, locale));
+        formats.add(createDateFormat("yyyy-MM-dd"));
+        formats.add(createDateFormat("yyyyMMdd"));
+
+        for (DateFormat format : formats) {
+            format.setTimeZone(UTC_TIME_ZONE);
+        }
+
+        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/datetimejoda/JodaDateTimeValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueTypeFacetFactory.java
new file mode 100644
index 0000000..1543640
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueTypeFacetFactory.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.value.datetimejoda;
+
+import org.joda.time.DateTime;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class JodaDateTimeValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<DateTime> {
+
+    public JodaDateTimeValueTypeFacetFactory() {
+     // as per inherited DateTimeValueSemanticsProvider#facetType
+        super(); 
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != DateTime.class) {
+            return;
+        }
+        addFacets(new JodaDateTimeValueSemanticsProvider(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/datetimejodalocal/JodaLocalDateTimeValueFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueFacet.java
new file mode 100644
index 0000000..c03acba
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueFacet.java
@@ -0,0 +1,33 @@
+/*
+ *  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.datetimejodalocal;
+
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface JodaLocalDateTimeValueFacet extends Facet {
+
+    LocalDateTime dateValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(LocalDateTime date);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.java
new file mode 100644
index 0000000..85635b2
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.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.core.progmodel.facets.value.datetimejodalocal;
+
+import java.util.Date;
+
+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.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.joda.time.LocalDateTime;
+
+public class JodaLocalDateTimeValueSemanticsProvider extends JodaLocalDateTimeValueSemanticsProviderAbstract<LocalDateTime> {
+
+    // no default
+    private static final LocalDateTime DEFAULT_VALUE = null;
+
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public JodaLocalDateTimeValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public JodaLocalDateTimeValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, LocalDateTime.class, DEFAULT_VALUE, configuration, context);
+    }
+
+    @Override
+    protected LocalDateTime add(final LocalDateTime original, final int years, final int months, final int days, final int hours, final int minutes) {
+        if(hours != 0 || minutes != 0) {
+            throw new IllegalArgumentException("cannot add non-zero hours or minutes to a LocalDateTime");
+        }
+        return original.plusYears(years).plusMonths(months).plusDays(days);
+    }
+
+    @Override
+    protected LocalDateTime now() {
+        return new LocalDateTime();
+    }
+
+    @Override
+    protected Date dateValue(final Object value) {
+        return ((LocalDateTime) value).toDateTime().toDate();
+    }
+
+    @Override
+    protected LocalDateTime setDate(final Date date) {
+        return new LocalDateTime(date.getTime());
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java
new file mode 100644
index 0000000..dc94786
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java
@@ -0,0 +1,118 @@
+/*
+ *  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.datetimejodalocal;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+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;
+import org.apache.isis.core.progmodel.facets.value.ValueSemanticsProviderAbstractTemporal;
+
+public abstract class JodaLocalDateTimeValueSemanticsProviderAbstract<T> extends ValueSemanticsProviderAbstractTemporal<T> {
+
+    private static Map<String, DateFormat> formats = Maps.newHashMap();
+
+    static {
+        formats.put(ISO_ENCODING_FORMAT, createDateEncodingFormat("yyyyMMdd"));
+        formats.put("iso", createDateFormat("yyyy-MM-dd"));
+        formats.put("medium", DateFormat.getDateInstance(DateFormat.MEDIUM));
+    }
+
+    public JodaLocalDateTimeValueSemanticsProviderAbstract(final FacetHolder holder, final Class<T> adaptedClass, final T defaultValue, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super("date", holder, adaptedClass, 12, Immutability.IMMUTABLE, EqualByContent.HONOURED, defaultValue, configuration, context);
+
+        final String formatRequired = configuration.getString(ConfigurationConstants.ROOT + "value.format.date");
+        if (formatRequired == null) {
+            format = formats().get(defaultFormat());
+        } else {
+            setMask(formatRequired);
+        }
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // temporal-specific stuff
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected void clearFields(final Calendar cal) {
+        cal.set(Calendar.HOUR, 0);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.AM_PM, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+    }
+
+    @Override
+    protected String defaultFormat() {
+        return "medium";
+    }
+
+    @Override
+    protected boolean ignoreTimeZone() {
+        return true;
+    }
+
+    @Override
+    protected Map<String, DateFormat> formats() {
+        return formats;
+    }
+
+    @Override
+    public String toString() {
+        return "DateValueSemanticsProvider: " + format;
+    }
+
+    @Override
+    protected DateFormat format(final Localization localization) {
+        final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, localization.getLocale());
+        dateFormat.setTimeZone(UTC_TIME_ZONE);
+        return dateFormat;
+    }
+
+    protected List<DateFormat> formatsToTry(Localization localization) {
+        List<DateFormat> formats = new ArrayList<DateFormat>();
+
+        Locale locale = localization == null ? Locale.getDefault() : localization.getLocale();
+        formats.add(DateFormat.getDateInstance(DateFormat.LONG, locale));
+        formats.add(DateFormat.getDateInstance(DateFormat.MEDIUM, locale));
+        formats.add(DateFormat.getDateInstance(DateFormat.SHORT, locale));
+        formats.add(createDateFormat("yyyy-MM-dd"));
+        formats.add(createDateFormat("yyyyMMdd"));
+
+        for (DateFormat format : formats) {
+            format.setTimeZone(UTC_TIME_ZONE);
+        }
+
+        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/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.java
new file mode 100644
index 0000000..768bd38
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.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.value.datetimejodalocal;
+
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class JodaLocalDateTimeValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<LocalDateTime> {
+
+    public JodaLocalDateTimeValueTypeFacetFactory() {
+     // as per inherited DateTimeValueSemanticsProvider#facetType
+        super(); 
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != LocalDateTime.class) {
+            return;
+        }
+        addFacets(new JodaLocalDateTimeValueSemanticsProvider(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/dateutil/JavaUtilDateValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/dateutil/JavaUtilDateValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/dateutil/JavaUtilDateValueSemanticsProvider.java
new file mode 100644
index 0000000..e227dd7
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/dateutil/JavaUtilDateValueSemanticsProvider.java
@@ -0,0 +1,87 @@
+/*
+ *  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.dateutil;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.clock.Clock;
+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;
+import org.apache.isis.core.progmodel.facets.value.DateAndTimeValueSemanticsProviderAbstract;
+import org.apache.isis.core.progmodel.facets.value.datesql.JavaSqlDateValueSemanticsProvider;
+import org.apache.isis.core.progmodel.facets.value.timesql.JavaSqlTimeValueSemanticsProvider;
+
+/**
+ * An adapter that handles {@link java.util.Date} as both a date AND time
+ * component.
+ * 
+ * @see JavaSqlDateValueSemanticsProvider
+ * @see JavaSqlTimeValueSemanticsProvider
+ */
+public class JavaUtilDateValueSemanticsProvider extends DateAndTimeValueSemanticsProviderAbstract<java.util.Date> {
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public JavaUtilDateValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public JavaUtilDateValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, Date.class, Immutability.NOT_IMMUTABLE, EqualByContent.NOT_HONOURED, configuration, context);
+    }
+
+    @Override
+    protected Date dateValue(final Object value) {
+        return value == null ? null : (Date) value;
+    }
+
+    @Override
+    protected Date add(final Date original, final int years, final int months, final int days, final int hours, final int minutes) {
+        final Date date = original;
+        final Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+
+        cal.add(Calendar.YEAR, years);
+        cal.add(Calendar.MONTH, months);
+        cal.add(Calendar.DAY_OF_MONTH, days);
+        cal.add(Calendar.HOUR, hours);
+        cal.add(Calendar.MINUTE, minutes);
+
+        return setDate(cal.getTime());
+    }
+
+    @Override
+    protected Date now() {
+        return new Date(Clock.getTime());
+    }
+
+    @Override
+    protected Date setDate(final Date date) {
+        return date;
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/dateutil/JavaUtilDateValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/dateutil/JavaUtilDateValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/dateutil/JavaUtilDateValueTypeFacetFactory.java
new file mode 100644
index 0000000..0babe69
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/dateutil/JavaUtilDateValueTypeFacetFactory.java
@@ -0,0 +1,46 @@
+/*
+ *  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.dateutil;
+
+import java.util.Date;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class JavaUtilDateValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Date> {
+
+    public JavaUtilDateValueTypeFacetFactory() {
+        super(); // as per inherited
+                                     // TimeValueSemanticsProvider#facetType
+                                     // (inherited)
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != Date.class) {
+            return;
+        }
+        addFacets(new JavaUtilDateValueSemanticsProvider(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/floats/FloatPrimitiveValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatPrimitiveValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatPrimitiveValueSemanticsProvider.java
new file mode 100644
index 0000000..457a689
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatPrimitiveValueSemanticsProvider.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.progmodel.facets.value.floats;
+
+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 FloatPrimitiveValueSemanticsProvider extends FloatValueSemanticsProviderAbstract implements PropertyDefaultFacet {
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public FloatPrimitiveValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public FloatPrimitiveValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, float.class, configuration, context);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // PropertyDefaultFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public ObjectAdapter getDefault(final ObjectAdapter adapter) {
+        return createAdapter(float.class, new Float(0.0f));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatPrimitiveValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatPrimitiveValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatPrimitiveValueTypeFacetFactory.java
new file mode 100644
index 0000000..8c4d70d
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatPrimitiveValueTypeFacetFactory.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.floats;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class FloatPrimitiveValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Float> {
+
+    public FloatPrimitiveValueTypeFacetFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != float.class) {
+            return;
+        }
+        addFacets(new FloatPrimitiveValueSemanticsProvider(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/floats/FloatValueSemanticsProviderAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatValueSemanticsProviderAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatValueSemanticsProviderAbstract.java
new file mode 100644
index 0000000..040dbae
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatValueSemanticsProviderAbstract.java
@@ -0,0 +1,109 @@
+/*
+ *  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.floats;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.ParseException;
+
+import org.apache.isis.applib.profiles.Localization;
+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;
+
+public class FloatValueSemanticsProviderAbstract extends ValueSemanticsProviderAndFacetAbstract<Float> implements FloatingPointValueFacet {
+
+    public static Class<? extends Facet> type() {
+        return FloatingPointValueFacet.class;
+    }
+
+    private static final Float DEFAULT_VALUE = new Float(0.0f);
+    private static final int TYPICAL_LENGTH = 12;
+
+    private final NumberFormat format;
+
+    public FloatValueSemanticsProviderAbstract(final FacetHolder holder, final Class<Float> adaptedClass, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(type(), holder, adaptedClass, TYPICAL_LENGTH, Immutability.IMMUTABLE, EqualByContent.HONOURED, DEFAULT_VALUE, configuration, context);
+        format = determineNumberFormat("value.format.float");
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // Parser
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected Float doParse(final Object context, final String entry) {
+        try {
+            return new Float(format.parse(entry).floatValue());
+        } catch (final ParseException e) {
+            throw new TextEntryParseException("Not a floating point number " + entry, e);
+        }
+    }
+
+    @Override
+    public String titleString(final Object value, final Localization localization) {
+        return titleString(format, value);
+    }
+
+    @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 Float doRestore(final String data) {
+        return new Float(data);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // FloatingPointValueFacet
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    public Float floatValue(final ObjectAdapter object) {
+        return object == null ? null : (Float) object.getObject();
+    }
+
+    @Override
+    public ObjectAdapter createValue(final Float value) {
+        return getAdapterManager().adapterFor(value);
+    }
+
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "FloatValueSemanticsProvider: " + 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/floats/FloatWrapperValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatWrapperValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatWrapperValueSemanticsProvider.java
new file mode 100644
index 0000000..307a6a5
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatWrapperValueSemanticsProvider.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.floats;
+
+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.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public class FloatWrapperValueSemanticsProvider extends FloatValueSemanticsProviderAbstract {
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public FloatWrapperValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public FloatWrapperValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, Float.class, configuration, context);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatWrapperValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatWrapperValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatWrapperValueTypeFacetFactory.java
new file mode 100644
index 0000000..0e59641
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatWrapperValueTypeFacetFactory.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.floats;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class FloatWrapperValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<Float> {
+
+    public FloatWrapperValueTypeFacetFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != Float.class) {
+            return;
+        }
+        addFacets(new FloatWrapperValueSemanticsProvider(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/floats/FloatingPointValueFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatingPointValueFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatingPointValueFacet.java
new file mode 100644
index 0000000..0c55e76
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/floats/FloatingPointValueFacet.java
@@ -0,0 +1,30 @@
+/*
+ *  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.floats;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface FloatingPointValueFacet extends Facet {
+
+    Float floatValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(Float value);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueFacet.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueFacet.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueFacet.java
new file mode 100644
index 0000000..53e2328
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueFacet.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.image;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface ImageValueFacet extends Facet {
+
+    ObjectAdapter createValue(java.awt.Image image);
+
+    java.awt.Image getImage(ObjectAdapter object);
+
+    int getHeight(ObjectAdapter object);
+
+    int getWidth(ObjectAdapter object);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueSemanticsProvider.java
new file mode 100644
index 0000000..350cc64
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueSemanticsProvider.java
@@ -0,0 +1,101 @@
+/*
+ *  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.image;
+
+import org.apache.isis.applib.value.Image;
+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.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public class ImageValueSemanticsProvider extends ImageValueSemanticsProviderAbstract<Image> {
+
+    public ImageValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, Image.class, configuration, context);
+    }
+
+    @Override
+    public int getHeight(final ObjectAdapter object) {
+        return image(object).getHeight();
+    }
+
+    private Image image(final ObjectAdapter object) {
+        return (Image) object.getObject();
+    }
+
+    @Override
+    public java.awt.Image getImage(final ObjectAdapter object) {
+        return createImage(image(object).getImage());
+    }
+
+    @Override
+    protected int[][] getPixels(final Object object) {
+        return ((Image) object).getImage();
+    }
+
+    public Class<?> getValueClass() {
+        return Image.class;
+    }
+
+    @Override
+    public int getWidth(final ObjectAdapter object) {
+        return image(object).getWidth();
+    }
+
+    @Override
+    protected Image setPixels(final int[][] pixels) {
+        return new Image(pixels);
+    }
+
+    @Override
+    public Facet getUnderlyingFacet() {
+        return null;
+    }
+
+    /**
+     * Not required because {@link #alwaysReplace()} is <tt>false</tt>.
+     */
+    @Override
+    public void setUnderlyingFacet(final Facet underlyingFacet) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean alwaysReplace() {
+        return false;
+    }
+
+    @Override
+    public boolean isNoop() {
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return "ImageValueSemanticsProvider: ";
+    }
+
+    @Override
+    public ObjectAdapter createValue(final java.awt.Image image) {
+        return getAdapterManager().adapterFor(new Image(grabPixels(image)));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueSemanticsProviderAbstract.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueSemanticsProviderAbstract.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueSemanticsProviderAbstract.java
new file mode 100644
index 0000000..4f376f9
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueSemanticsProviderAbstract.java
@@ -0,0 +1,299 @@
+/*
+ *  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.image;
+
+import java.awt.Image;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.MemoryImageSource;
+import java.awt.image.PixelGrabber;
+
+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.commons.exceptions.UnexpectedCallException;
+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.progmodel.facets.object.value.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+
+public abstract class ImageValueSemanticsProviderAbstract<T> extends ValueSemanticsProviderAndFacetAbstract<T> implements ImageValueFacet {
+
+    private static final int TYPICAL_LENGTH = 18;
+    private static final Object DEFAULT_VALUE = null; // no default
+
+    private static final char[] BASE_64_CHARS = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
+            'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', };
+
+    protected static final byte[] REVERSE_BASE_64_CHARS = new byte[0x100];
+
+    static {
+        for (int i = 0; i < REVERSE_BASE_64_CHARS.length; i++) {
+            REVERSE_BASE_64_CHARS[i] = -1;
+        }
+        for (byte i = 0; i < BASE_64_CHARS.length; i++) {
+            REVERSE_BASE_64_CHARS[BASE_64_CHARS[i]] = i;
+        }
+    }
+
+    private FacetHolder facetHolder;
+
+    @SuppressWarnings("unchecked")
+    public ImageValueSemanticsProviderAbstract(final FacetHolder holder, final Class<T> adaptedClass, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(ImageValueFacet.class, holder, adaptedClass, TYPICAL_LENGTH, Immutability.NOT_IMMUTABLE, EqualByContent.NOT_HONOURED, (T) DEFAULT_VALUE, configuration, context);
+    }
+
+    /**
+     * Returns null to indicate that this value does not parse entry strings
+     */
+    @Override
+    public Parser<T> getParser() {
+        return null;
+    }
+
+    @Override
+    protected T doParse(final Object original, final String entry) {
+        throw new UnexpectedCallException();
+    }
+
+    public byte[] getAsByteArray(final ObjectAdapter object) {
+        final int[] flatIntArray = flatten(object);
+        final byte[] byteArray = new byte[flatIntArray.length * 4];
+        for (int i = 0; i < flatIntArray.length; i++) {
+            final int value = flatIntArray[i];
+            byteArray[i * 4] = (byte) ((value >> 24) & 0xff);
+            byteArray[i * 4 + 1] = (byte) ((value >> 16) & 0xff);
+            byteArray[i * 4 + 2] = (byte) ((value >> 8) & 0xff);
+            byteArray[i * 4 + 3] = (byte) (value & 0xff);
+        }
+        return byteArray;
+    }
+
+    private static int byteArrayToInt(final byte[] byteArray, final int offset) {
+        int value = 0;
+        for (int i = 0; i < 4; i++) {
+            final int shift = (4 - 1 - i) * 8;
+            value += (byteArray[i + offset] & 0x000000FF) << shift;
+        }
+        return value;
+    }
+
+    @Override
+    public boolean alwaysReplace() {
+        return false;
+    }
+
+    @Override
+    public Facet getUnderlyingFacet() {
+        return null;
+    }
+
+    /**
+     * Not required because {@link #alwaysReplace()} is <tt>false</tt>.
+     */
+    @Override
+    public void setUnderlyingFacet(final Facet underlyingFacet) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isDerived() {
+        return false;
+    }
+
+    public T restoreFromByteArray(final byte[] byteArray) {
+        final int[] flatIntArray = new int[byteArray.length / 4];
+        for (int i = 0; i < flatIntArray.length; i++) {
+            flatIntArray[i] = byteArrayToInt(byteArray, i * 4);
+        }
+        return setPixels(inflate(flatIntArray));
+    }
+
+    private int[] flatten(final ObjectAdapter object) {
+        final int[][] image = getPixels(object);
+        final int[] flatArray = new int[(getHeight(object) * getWidth(object)) + 2];
+        int flatIndex = 0;
+        flatArray[flatIndex++] = getHeight(object);
+        flatArray[flatIndex++] = getWidth(object);
+        for (int i = 0; i < getHeight(object); i++) {
+            for (int j = 0; j < getWidth(object); j++) {
+                flatArray[flatIndex++] = image[i][j];
+            }
+        }
+        return flatArray;
+    }
+
+    private static int[][] inflate(final int[] flatIntArray) {
+        int flatIndex = 0;
+        final int height = flatIntArray[flatIndex++];
+        final int width = flatIntArray[flatIndex++];
+
+        final int[][] newImage = new int[height][width];
+
+        for (int i = 0; i < height; i++) {
+            for (int j = 0; j < width; j++) {
+                newImage[i][j] = flatIntArray[flatIndex++];
+            }
+        }
+        return newImage;
+    }
+
+    @Override
+    protected String doEncode(final Object object) {
+        final int[][] image = getPixels(object);
+        final int lines = image.length;
+        final int width = image[0].length;
+        final StringBuffer encodeData = new StringBuffer(lines * width * 4);
+        encodePixel(lines, encodeData);
+        encodePixel(width, encodeData);
+        for (int line = 0; line < lines; line++) {
+            for (int pixel = 0; pixel < width; pixel++) {
+                encodePixel(image[line][pixel], encodeData);
+            }
+        }
+        return encodeData.toString();
+    }
+
+    protected Image createImage(final int[][] pixels) {
+        final int lines = pixels.length;
+        final int width = pixels[0].length;
+        final int[] pix = new int[lines * width];
+        int offset = 0;
+        for (int line = 0; line < lines; line++) {
+            System.arraycopy(pixels[line], 0, pix, offset, width);
+            offset += width;
+        }
+        final MemoryImageSource source = new MemoryImageSource(width, lines, pix, 0, width);
+        return java.awt.Toolkit.getDefaultToolkit().createImage(source);
+    }
+
+    private int decodePixel(final String data, final int item) {
+        final int offset = item * 4;
+        int pixel = 0;
+        for (int i = 0; i < 4; i++) {
+            final char c = data.charAt(offset + i);
+            final byte b = REVERSE_BASE_64_CHARS[c];
+            if (i == 0 && b >= 32) {
+                pixel = 0xff;
+            }
+            pixel = (pixel << 6) + b;
+        }
+        return pixel;
+    }
+
+    private void encodePixel(final int pixel, final StringBuffer encodeData) {
+        // TODO the encoding is poor as the negative numbers are not dealt with
+        // properly because the 6 MSBs
+        // are not included.
+        if (pixel > 0x7FFFFF || pixel < -0x7FFFFF) {
+            // throw new IsisException("" + pixel);
+        }
+        for (int i = 3; i >= 0; i--) {
+            final int bitsToShift = i * 6;
+            final int c = pixel >> bitsToShift;
+            final char cc = BASE_64_CHARS[c & 0x3F];
+            encodeData.append(cc);
+        }
+    }
+
+    public String getIconName() {
+        return null;
+    }
+
+    protected abstract int[][] getPixels(Object object);
+
+    protected int[][] grabPixels(final Image image) {
+        final int width = image.getWidth(null);
+        final int lines = image.getHeight(null);
+        final int pixels[] = new int[width * lines];
+        final PixelGrabber grabber = new PixelGrabber(image, 0, 0, width, lines, pixels, 0, width);
+        grabber.setColorModel(ColorModel.getRGBdefault());
+        try {
+            if (grabber.grabPixels() && (grabber.status() & ImageObserver.ALLBITS) != 0) {
+                final int[][] array = new int[lines][width];
+                int srcPos = 0;
+                for (int line = 0; line < lines; line++) {
+                    array[line] = new int[width];
+                    System.arraycopy(pixels, srcPos, array[line], 0, width);
+                    for (int pixel = 0; pixel < array[line].length; pixel++) {
+                        array[line][pixel] = array[line][pixel] | 0xFF000000;
+                    }
+                    srcPos += width;
+                }
+                return array;
+            }
+            // TODO what happens if the grab fails?
+            return new int[lines][width];
+        } catch (final InterruptedException e) {
+            throw new IsisException(e);
+        }
+    }
+
+    @Override
+    public T doRestore(final String data) {
+        final int lines = decodePixel(data, 0);
+        final int width = decodePixel(data, 1);
+        final int[][] imageData = new int[lines][width];
+        int offset = 2;
+        for (int line = 0; line < lines; line++) {
+            for (int pixel = 0; pixel < width; pixel++) {
+                imageData[line][pixel] = decodePixel(data, offset++);
+                imageData[line][pixel] = imageData[line][pixel] | 0xFF000000;
+            }
+        }
+        final T image = setPixels(imageData);
+        return image;
+    }
+
+    protected abstract T setPixels(int[][] pixels);
+
+    public void setMask(final String mask) {
+    }
+
+    @Override
+    public String titleString(final Object value, final Localization localization) {
+        return "image";
+    }
+
+    @Override
+    public String titleStringWithMask(final Object value, final String usingMask) {
+        return "image";
+    }
+
+    @Override
+    public FacetHolder getFacetHolder() {
+        return facetHolder;
+    }
+
+    @Override
+    public void setFacetHolder(final FacetHolder facetHolder) {
+        this.facetHolder = facetHolder;
+    }
+
+    // /////// toString ///////
+
+    @Override
+    public String toString() {
+        return "ImageValueSemanticsProvider";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/e4735c72/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueTypeFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueTypeFacetFactory.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueTypeFacetFactory.java
new file mode 100644
index 0000000..98dfa03
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/image/ImageValueTypeFacetFactory.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.image;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class ImageValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<org.apache.isis.applib.value.Image> {
+
+    public ImageValueTypeFacetFactory() {
+        super();
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != org.apache.isis.applib.value.Image.class) {
+            return;
+        }
+        addFacets(new ImageValueSemanticsProvider(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/imageawt/JavaAwtImageValueSemanticsProvider.java
----------------------------------------------------------------------
diff --git a/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/imageawt/JavaAwtImageValueSemanticsProvider.java b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/imageawt/JavaAwtImageValueSemanticsProvider.java
new file mode 100644
index 0000000..ac56751
--- /dev/null
+++ b/framework/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/value/imageawt/JavaAwtImageValueSemanticsProvider.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.progmodel.facets.value.imageawt;
+
+import java.awt.Image;
+
+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.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.apache.isis.core.progmodel.facets.value.image.ImageValueSemanticsProviderAbstract;
+
+public class JavaAwtImageValueSemanticsProvider extends ImageValueSemanticsProviderAbstract<Image> {
+
+    public JavaAwtImageValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, Image.class, configuration, context);
+    }
+
+    @Override
+    public int getHeight(final ObjectAdapter object) {
+        return image(object).getHeight(null);
+    }
+
+    private Image image(final ObjectAdapter object) {
+        return (Image) object.getObject();
+    }
+
+    @Override
+    public Image getImage(final ObjectAdapter object) {
+        return image(object);
+    }
+
+    @Override
+    protected int[][] getPixels(final Object object) {
+        return grabPixels((Image) object);
+    }
+
+    public Class<?> getValueClass() {
+        return Image.class;
+    }
+
+    @Override
+    public int getWidth(final ObjectAdapter object) {
+        return image(object).getWidth(null);
+    }
+
+    @Override
+    protected Image setPixels(final int[][] pixels) {
+        return createImage(pixels);
+    }
+
+    @Override
+    public boolean isNoop() {
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return "JavaAwtImageValueSemanticsProvider: ";
+    }
+
+    @Override
+    public ObjectAdapter createValue(final Image image) {
+        return getAdapterManager().adapterFor(image);
+    }
+
+}