You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2009/08/14 01:33:40 UTC

svn commit: r804060 [4/7] - in /ofbiz/branches/executioncontext20090812: applications/accounting/src/org/ofbiz/accounting/payment/ applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ applications/order/src/org/ofbiz/order/finaccount/ app...

Modified: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java?rev=804060&r1=804059&r2=804060&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java (original)
+++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntity.java Thu Aug 13 23:33:38 2009
@@ -1,28 +1,9 @@
-/*******************************************************************************
- * 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.ofbiz.entity.model;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasMember;
@@ -30,185 +11,89 @@
 import org.ofbiz.entity.model.ModelViewEntity.ModelAliasAll;
 import org.ofbiz.entity.model.ModelViewEntity.ModelMemberEntity;
 import org.ofbiz.entity.model.ModelViewEntity.ModelViewLink;
-/**
- * This class is used for declaring Dynamic View Entities, to be used and thrown away.
- * A special method exists on the GenericDelegator to accept a DynamicViewEntity instead
- * of an entity-name.
- *
- */
-public class DynamicViewEntity {
-    public static final String module = DynamicViewEntity.class.getName();
-
-    /** The entity-name of the Entity */
-    protected String entityName = "DynamicViewEntity";
-
-    /** The package-name of the Entity */
-    protected String packageName = "org.ofbiz.dynamicview";
-
-    /** The default-resource-name of the Entity, used with the getResource call to check for a value in a resource bundle */
-    protected String defaultResourceName = "";
-
-    /** The title for documentation purposes */
-    protected String title = "";
-
-    /** Contains member-entity alias name definitions: key is alias, value is ModelMemberEntity */
-    protected Map<String, ModelMemberEntity> memberModelMemberEntities = new HashMap<String, ModelMemberEntity>();
-
-    /** List of alias-alls which act as a shortcut for easily pulling over member entity fields */
-    protected List<ModelAliasAll> aliasAlls = new ArrayList<ModelAliasAll>();
-
-    /** List of aliases with information in addition to what is in the standard field list */
-    protected List<ModelAlias> aliases = new ArrayList<ModelAlias>();
-
-    /** List of view links to define how entities are connected (or "joined") */
-    protected List<ModelViewLink> viewLinks = new ArrayList<ModelViewLink>();
-
-    /** relations defining relationships between this entity and other entities */
-    protected List<ModelRelation> relations = new ArrayList<ModelRelation>();
-
-    public DynamicViewEntity() {
-    }
-
-    public ModelViewEntity makeModelViewEntity(GenericDelegator delegator) {
-        ModelViewEntity modelViewEntity = new ModelViewEntity(this, delegator.getModelReader());
-        return modelViewEntity;
-    }
-
-    public String getOneRealEntityName() {
-        // return first entity name for memberModelMemberEntities Map
-        if (this.memberModelMemberEntities.size() == 0) {
-            return null;
-        }
-
-        ModelMemberEntity modelMemberEntity = this.memberModelMemberEntities.entrySet().iterator().next().getValue();
-        return modelMemberEntity.getEntityName();
-    }
-
-    /** Getter for property entityName.
-     * @return Value of property entityName.
-     *
-     */
-    public String getEntityName() {
-        return entityName;
-    }
-
-    /** Setter for property entityName.
-     * @param entityName New value of property entityName.
-     *
-     */
-    public void setEntityName(String entityName) {
-        this.entityName = entityName;
-    }
-
-    /** Getter for property packageName.
-     * @return Value of property packageName.
-     *
-     */
-    public String getPackageName() {
-        return packageName;
-    }
-
-    /** Setter for property packageName.
-     * @param packageName New value of property packageName.
-     *
-     */
-    public void setPackageName(String packageName) {
-        this.packageName = packageName;
-    }
-
-    /** Getter for property defaultResourceName.
-     * @return Value of property defaultResourceName.
-     *
-     */
-    public String getDefaultResourceName() {
-        return defaultResourceName;
-    }
-
-    /** Setter for property defaultResourceName.
-     * @param defaultResourceName New value of property defaultResourceName.
-     *
-     */
-    public void setDefaultResourceName(String defaultResourceName) {
-        this.defaultResourceName = defaultResourceName;
-    }
-
-    /** Getter for property title.
-     * @return Value of property title.
-     *
-     */
-    public String getTitle() {
-        return title;
-    }
-
-    /** Setter for property title.
-     * @param title New value of property title.
-     *
-     */
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public void addMemberEntity(String entityAlias, String entityName) {
-        ModelMemberEntity modelMemberEntity = new ModelMemberEntity(entityAlias, entityName);
-        this.memberModelMemberEntities.put(entityAlias, modelMemberEntity);
-    }
-
-    public Iterator<Map.Entry<String, ModelMemberEntity>> getModelMemberEntitiesEntryIter() {
-        return this.memberModelMemberEntities.entrySet().iterator();
-    }
-
-    public void addAliasAll(String entityAlias, String prefix) {
-        ModelAliasAll aliasAll = new ModelAliasAll(entityAlias, prefix);
-        this.aliasAlls.add(aliasAll);
-    }
-
-    public void addAllAliasAllsToList(List<ModelAliasAll> addList) {
-        addList.addAll(this.aliasAlls);
-    }
-
-    public void addAlias(String entityAlias, String name) {
-        this.addAlias(entityAlias, name, null, null, null, null, null);
-    }
-
-    /** Add an alias, full detail. All parameters can be null except entityAlias and name. */
-    public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function) {
-        addAlias(entityAlias, name, field, colAlias, primKey, groupBy, function, null);
-    }
-
-    public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function, ComplexAliasMember complexAliasMember) {
-        if (entityAlias == null && complexAliasMember == null) {
-            throw new IllegalArgumentException("entityAlias cannot be null if this is not a complex alias in call to DynamicViewEntity.addAlias");
-        }
-        if (name == null) {
-            throw new IllegalArgumentException("name cannot be null in call to DynamicViewEntity.addAlias");
-        }
-
-        ModelAlias alias = new ModelAlias(entityAlias, name, field, colAlias, primKey, groupBy, function);
-        if (complexAliasMember != null) {
-            alias.setComplexAliasMember(complexAliasMember);
-        }
-        this.aliases.add(alias);
-    }
-
-    public void addAllAliasesToList(List<ModelAlias> addList) {
-        addList.addAll(this.aliases);
-    }
-
-    public void addViewLink(String entityAlias, String relEntityAlias, Boolean relOptional, List<ModelKeyMap> modelKeyMaps) {
-        ModelViewLink modelViewLink = new ModelViewLink(entityAlias, relEntityAlias, relOptional, modelKeyMaps);
-        this.viewLinks.add(modelViewLink);
-    }
-
-    public void addAllViewLinksToList(List<ModelViewLink> addList) {
-        addList.addAll(this.viewLinks);
-    }
-
-    public void addRelation(String type, String title, String relEntityName, List<ModelKeyMap> modelKeyMaps) {
-        ModelRelation relation = new ModelRelation(type, title, relEntityName, null, modelKeyMaps);
-        this.relations.add(relation);
-    }
-
-    public void addAllRelationsToList(List<ModelRelation> addList) {
-        addList.addAll(this.relations);
-    }
-}
+
+public interface DynamicViewEntity {
+
+	public ModelViewEntity makeModelViewEntity(GenericDelegator delegator);
+
+	public String getOneRealEntityName();
+
+	/** Getter for property entityName.
+	 * @return Value of property entityName.
+	 *
+	 */
+	public String getEntityName();
+
+	/** Setter for property entityName.
+	 * @param entityName New value of property entityName.
+	 *
+	 */
+	public void setEntityName(String entityName);
+
+	/** Getter for property packageName.
+	 * @return Value of property packageName.
+	 *
+	 */
+	public String getPackageName();
+
+	/** Setter for property packageName.
+	 * @param packageName New value of property packageName.
+	 *
+	 */
+	public void setPackageName(String packageName);
+
+	/** Getter for property defaultResourceName.
+	 * @return Value of property defaultResourceName.
+	 *
+	 */
+	public String getDefaultResourceName();
+
+	/** Setter for property defaultResourceName.
+	 * @param defaultResourceName New value of property defaultResourceName.
+	 *
+	 */
+	public void setDefaultResourceName(String defaultResourceName);
+
+	/** Getter for property title.
+	 * @return Value of property title.
+	 *
+	 */
+	public String getTitle();
+
+	/** Setter for property title.
+	 * @param title New value of property title.
+	 *
+	 */
+	public void setTitle(String title);
+
+	public void addMemberEntity(String entityAlias, String entityName);
+
+	public Iterator<Map.Entry<String, ModelMemberEntity>> getModelMemberEntitiesEntryIter();
+
+	public void addAliasAll(String entityAlias, String prefix);
+
+	public void addAllAliasAllsToList(List<ModelAliasAll> addList);
+
+	public void addAlias(String entityAlias, String name);
+
+	/** Add an alias, full detail. All parameters can be null except entityAlias and name. */
+	public void addAlias(String entityAlias, String name, String field,
+			String colAlias, Boolean primKey, Boolean groupBy, String function);
+
+	public void addAlias(String entityAlias, String name, String field,
+			String colAlias, Boolean primKey, Boolean groupBy, String function,
+			ComplexAliasMember complexAliasMember);
+
+	public void addAllAliasesToList(List<ModelAlias> addList);
+
+	public void addViewLink(String entityAlias, String relEntityAlias,
+			Boolean relOptional, List<ModelKeyMap> modelKeyMaps);
+
+	public void addAllViewLinksToList(List<ModelViewLink> addList);
+
+	public void addRelation(String type, String title, String relEntityName,
+			List<ModelKeyMap> modelKeyMaps);
+
+	public void addAllRelationsToList(List<ModelRelation> addList);
+
+}
\ No newline at end of file

Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java?rev=804060&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java (added)
+++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java Thu Aug 13 23:33:38 2009
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * 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.ofbiz.entity.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasMember;
+import org.ofbiz.entity.model.ModelViewEntity.ModelAlias;
+import org.ofbiz.entity.model.ModelViewEntity.ModelAliasAll;
+import org.ofbiz.entity.model.ModelViewEntity.ModelMemberEntity;
+import org.ofbiz.entity.model.ModelViewEntity.ModelViewLink;
+/**
+ * This class is used for declaring Dynamic View Entities, to be used and thrown away.
+ * A special method exists on the GenericDelegator to accept a DynamicViewEntity instead
+ * of an entity-name.
+ *
+ */
+public class DynamicViewEntityImpl implements DynamicViewEntity {
+    public static final String module = DynamicViewEntityImpl.class.getName();
+
+    /** The entity-name of the Entity */
+    protected String entityName = "DynamicViewEntity";
+
+    /** The package-name of the Entity */
+    protected String packageName = "org.ofbiz.dynamicview";
+
+    /** The default-resource-name of the Entity, used with the getResource call to check for a value in a resource bundle */
+    protected String defaultResourceName = "";
+
+    /** The title for documentation purposes */
+    protected String title = "";
+
+    /** Contains member-entity alias name definitions: key is alias, value is ModelMemberEntity */
+    protected Map<String, ModelMemberEntity> memberModelMemberEntities = new HashMap<String, ModelMemberEntity>();
+
+    /** List of alias-alls which act as a shortcut for easily pulling over member entity fields */
+    protected List<ModelAliasAll> aliasAlls = new ArrayList<ModelAliasAll>();
+
+    /** List of aliases with information in addition to what is in the standard field list */
+    protected List<ModelAlias> aliases = new ArrayList<ModelAlias>();
+
+    /** List of view links to define how entities are connected (or "joined") */
+    protected List<ModelViewLink> viewLinks = new ArrayList<ModelViewLink>();
+
+    /** relations defining relationships between this entity and other entities */
+    protected List<ModelRelation> relations = new ArrayList<ModelRelation>();
+
+    public DynamicViewEntityImpl() {
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#makeModelViewEntity(org.ofbiz.entity.GenericDelegator)
+	 */
+    public ModelViewEntity makeModelViewEntity(GenericDelegator delegator) {
+        ModelViewEntity modelViewEntity = new ModelViewEntity(this, delegator.getModelReader());
+        return modelViewEntity;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#getOneRealEntityName()
+	 */
+    public String getOneRealEntityName() {
+        // return first entity name for memberModelMemberEntities Map
+        if (this.memberModelMemberEntities.size() == 0) {
+            return null;
+        }
+
+        ModelMemberEntity modelMemberEntity = this.memberModelMemberEntities.entrySet().iterator().next().getValue();
+        return modelMemberEntity.getEntityName();
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#getEntityName()
+	 */
+    public String getEntityName() {
+        return entityName;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#setEntityName(java.lang.String)
+	 */
+    public void setEntityName(String entityName) {
+        this.entityName = entityName;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#getPackageName()
+	 */
+    public String getPackageName() {
+        return packageName;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#setPackageName(java.lang.String)
+	 */
+    public void setPackageName(String packageName) {
+        this.packageName = packageName;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#getDefaultResourceName()
+	 */
+    public String getDefaultResourceName() {
+        return defaultResourceName;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#setDefaultResourceName(java.lang.String)
+	 */
+    public void setDefaultResourceName(String defaultResourceName) {
+        this.defaultResourceName = defaultResourceName;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#getTitle()
+	 */
+    public String getTitle() {
+        return title;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#setTitle(java.lang.String)
+	 */
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addMemberEntity(java.lang.String, java.lang.String)
+	 */
+    public void addMemberEntity(String entityAlias, String entityName) {
+        ModelMemberEntity modelMemberEntity = new ModelMemberEntity(entityAlias, entityName);
+        this.memberModelMemberEntities.put(entityAlias, modelMemberEntity);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#getModelMemberEntitiesEntryIter()
+	 */
+    public Iterator<Map.Entry<String, ModelMemberEntity>> getModelMemberEntitiesEntryIter() {
+        return this.memberModelMemberEntities.entrySet().iterator();
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addAliasAll(java.lang.String, java.lang.String)
+	 */
+    public void addAliasAll(String entityAlias, String prefix) {
+        ModelAliasAll aliasAll = new ModelAliasAll(entityAlias, prefix);
+        this.aliasAlls.add(aliasAll);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addAllAliasAllsToList(java.util.List)
+	 */
+    public void addAllAliasAllsToList(List<ModelAliasAll> addList) {
+        addList.addAll(this.aliasAlls);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addAlias(java.lang.String, java.lang.String)
+	 */
+    public void addAlias(String entityAlias, String name) {
+        this.addAlias(entityAlias, name, null, null, null, null, null);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addAlias(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.String)
+	 */
+    public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function) {
+        addAlias(entityAlias, name, field, colAlias, primKey, groupBy, function, null);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addAlias(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.String, org.ofbiz.entity.model.ModelViewEntity.ComplexAliasMember)
+	 */
+    public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function, ComplexAliasMember complexAliasMember) {
+        if (entityAlias == null && complexAliasMember == null) {
+            throw new IllegalArgumentException("entityAlias cannot be null if this is not a complex alias in call to DynamicViewEntity.addAlias");
+        }
+        if (name == null) {
+            throw new IllegalArgumentException("name cannot be null in call to DynamicViewEntity.addAlias");
+        }
+
+        ModelAlias alias = new ModelAlias(entityAlias, name, field, colAlias, primKey, groupBy, function);
+        if (complexAliasMember != null) {
+            alias.setComplexAliasMember(complexAliasMember);
+        }
+        this.aliases.add(alias);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addAllAliasesToList(java.util.List)
+	 */
+    public void addAllAliasesToList(List<ModelAlias> addList) {
+        addList.addAll(this.aliases);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addViewLink(java.lang.String, java.lang.String, java.lang.Boolean, java.util.List)
+	 */
+    public void addViewLink(String entityAlias, String relEntityAlias, Boolean relOptional, List<ModelKeyMap> modelKeyMaps) {
+        ModelViewLink modelViewLink = new ModelViewLink(entityAlias, relEntityAlias, relOptional, modelKeyMaps);
+        this.viewLinks.add(modelViewLink);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addAllViewLinksToList(java.util.List)
+	 */
+    public void addAllViewLinksToList(List<ModelViewLink> addList) {
+        addList.addAll(this.viewLinks);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addRelation(java.lang.String, java.lang.String, java.lang.String, java.util.List)
+	 */
+    public void addRelation(String type, String title, String relEntityName, List<ModelKeyMap> modelKeyMaps) {
+        ModelRelation relation = new ModelRelationImpl(type, title, relEntityName, null, modelKeyMaps);
+        this.relations.add(relation);
+    }
+
+    /* (non-Javadoc)
+	 * @see org.ofbiz.entity.model.DynamicViewEntity#addAllRelationsToList(java.util.List)
+	 */
+    public void addAllRelationsToList(List<ModelRelation> addList) {
+        addList.addAll(this.relations);
+    }
+}

Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/model/DynamicViewEntityImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain