From: <tri...@us...> - 2008-09-28 13:08:46
|
Revision: 738 http://equanda.svn.sourceforge.net/equanda/?rev=738&view=rev Author: triathlon98 Date: 2008-09-28 13:08:15 +0000 (Sun, 28 Sep 2008) Log Message: ----------- EQ-215 ExtendedMappingTranslator support Modified Paths: -------------- trunk/equanda-client/src/main/java/org/equanda/subjectory/MappingTranslator.java Added Paths: ----------- trunk/equanda-client/src/main/java/org/equanda/subjectory/ExtendedMappingTranslator.java Added: trunk/equanda-client/src/main/java/org/equanda/subjectory/ExtendedMappingTranslator.java =================================================================== --- trunk/equanda-client/src/main/java/org/equanda/subjectory/ExtendedMappingTranslator.java (rev 0) +++ trunk/equanda-client/src/main/java/org/equanda/subjectory/ExtendedMappingTranslator.java 2008-09-28 13:08:15 UTC (rev 738) @@ -0,0 +1,61 @@ +/** + * This file is part of the equanda project. + * + * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF + * ANY KIND, either express or implied. See the License for the specific language governing rights and + * limitations under the License. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + */ + +package org.equanda.subjectory; + +import org.equanda.persistence.EquandaProxy; + +/** + * Translator for handling specific mappings in the subjectory "mapping". + * This extended version allows sideeffect on the objects in which the result is applied. + * + * @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a> + */ +public interface ExtendedMappingTranslator<EXTERNALTYPE, INTERNALTYPE> + extends MappingTranslator<EXTERNALTYPE, INTERNALTYPE> +{ + static final Object TRANSLATED_AND_SET = new Object(); + + /** + * Get the internal representation of an external object to be mapped. + * + * @param external object in external mapping + * @param proxy proxy in which the value needs to be set + * @return object internal (domain model) mapping, when null the normal translator is still applied, when TRANSLATED_AND_SET thevalue is presumed set in result object + * @throws MappingTranslatorException oops + */ + INTERNALTYPE getInternalExtended( EXTERNALTYPE external, EquandaProxy proxy ) + throws MappingTranslatorException; + + /** + * Get the external representation of an external object to be mapped. + * + * @param internal object in internal (domain model) mapping + * @param proxy proxy from which the value is read + * @return object external mapping + * @throws MappingTranslatorException oops + */ + EXTERNALTYPE getExternalExtended( INTERNALTYPE internal, EquandaProxy proxy ) + throws MappingTranslatorException; +} Modified: trunk/equanda-client/src/main/java/org/equanda/subjectory/MappingTranslator.java =================================================================== --- trunk/equanda-client/src/main/java/org/equanda/subjectory/MappingTranslator.java 2008-09-28 13:04:02 UTC (rev 737) +++ trunk/equanda-client/src/main/java/org/equanda/subjectory/MappingTranslator.java 2008-09-28 13:08:15 UTC (rev 738) @@ -36,6 +36,7 @@ * * @param external object in external mapping * @return object internal (domain model) mapping + * @throws MappingTranslatorException oops */ INTERNALTYPE getInternal( EXTERNALTYPE external ) throws MappingTranslatorException; @@ -45,6 +46,7 @@ * * @param internal object in internal (domain model) mapping * @return object external mapping + * @throws MappingTranslatorException oops */ EXTERNALTYPE getExternal( INTERNALTYPE internal ) throws MappingTranslatorException; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |