Author: jleroux
Date: Wed Sep 23 08:03:45 2015
New Revision: 1704769

URL: http://svn.apache.org/viewvc?rev=1704769&view=rev
Log:
No functional changes for https://issues.apache.org/jira/browse/OFBIZ-6651
Removes unused methods (not in Java code, FTL templates and Groovy scripts) in 
GenericValue and EntityUtil classes + misc related comments or logs
Adds log warning to spot possible use cases in templates and scripts of 
getRelated() and getRelatedOne() methods

Modified:
    
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
    ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=1704769&r1=1704768&r2=1704769&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
 Wed Sep 23 08:03:45 2015
@@ -683,7 +683,7 @@ public class ProductStoreWorker {
             try {
                 productFacilities = product.getRelated("ProductFacility", 
null, null, true);
             } catch (GenericEntityException e) {
-                Debug.logWarning(e, "Error invoking getRelatedCache in 
isCatalogInventoryAvailable", module);
+                Debug.logWarning(e, "Error invoking getRelated in 
isCatalogInventoryAvailable", module);
                 return false;
             }
 

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java?rev=1704769&r1=1704768&r2=1704769&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java 
(original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java Wed Sep 
23 08:03:45 2015
@@ -22,6 +22,7 @@ package org.ofbiz.entity;
 import java.util.List;
 import java.util.Map;
 
+import org.ofbiz.base.util.Debug;
 import org.ofbiz.entity.model.ModelEntity;
 
 /**
@@ -30,7 +31,7 @@ import org.ofbiz.entity.model.ModelEntit
  */
 @SuppressWarnings("serial")
 public class GenericValue extends GenericEntity {
-
+    
     public static final GenericValue NULL_VALUE = new NullGenericValue();
 
     /** Creates new GenericValue */
@@ -95,6 +96,7 @@ public class GenericValue extends Generi
      */
     @Deprecated
     public List<GenericValue> getRelated(String relationName) throws 
GenericEntityException {
+        Debug.logWarning("deprecated method, please replace as suggested in 
API Java Doc, and link to OFBIZ-6651", getStackTraceAsString());
         return this.getDelegator().getRelated(relationName, null, null, this, 
false);
     }
 
@@ -107,6 +109,7 @@ public class GenericValue extends Generi
      */
     @Deprecated
     public List<GenericValue> getRelated(String relationName, List<String> 
orderBy) throws GenericEntityException {
+        Debug.logWarning("deprecated method, please replace as suggested in 
API Java Doc, and link to OFBIZ-6651", getStackTraceAsString());
         return this.getDelegator().getRelated(relationName, null, orderBy, 
this, false);
     }
 
@@ -120,20 +123,10 @@ public class GenericValue extends Generi
      */
     @Deprecated
     public List<GenericValue> getRelated(String relationName, Map<String, ? 
extends Object> byAndFields, List<String> orderBy) throws 
GenericEntityException {
+        Debug.logWarning("deprecated method, please replace as suggested in 
API Java Doc, and link to OFBIZ-6651", getStackTraceAsString());
         return this.getDelegator().getRelated(relationName, byAndFields, 
orderBy, this, false);
     }
 
-    /** Get the named Related Entity for the GenericValue from the persistent
-     *  store, looking first in the global generic cache (for the moment this 
isn't true, is same as EmbeddedCache variant)
-     *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
-     *@return List of GenericValue instances as specified in the relation 
definition
-     *@deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public List<GenericValue> getRelatedCache(String relationName) throws 
GenericEntityException {
-        return this.getDelegator().getRelated(relationName, null, null, this, 
true);
-    }
-
     /** Get the named Related Entity for the GenericValue from the persistent 
store
      *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
      * @param byAndFields the fields that must equal in order to keep; may be 
null
@@ -174,33 +167,6 @@ public class GenericValue extends Generi
         return this.getDelegator().getMultiRelation(this, relationNameOne, 
relationNameTwo, null);
     }
 
-    /** Get the named Related Entity for the GenericValue from the persistent
-     *  store, looking first in the global generic cache (for the moment this 
isn't true, is same as EmbeddedCache variant)
-     *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
-     * @param byAndFields the fields that must equal in order to keep; may be 
null
-     * @param orderBy The fields of the named entity to order the query by; 
may be null;
-     *      optionally add a " ASC" for ascending or " DESC" for descending
-     *@return List of GenericValue instances as specified in the relation 
definition
-     *@deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public List<GenericValue> getRelatedCache(String relationName, Map<String, 
? extends Object> byAndFields, List<String> orderBy) throws 
GenericEntityException {
-        return this.getDelegator().getRelated(relationName, byAndFields, 
orderBy, this, true);
-    }
-
-    /** Get the named Related Entity for the GenericValue from the persistent
-     *  store, looking first in the global generic cache (for the moment this 
isn't true, is same as EmbeddedCache variant)
-     *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
-     * @param orderBy The fields of the named entity to order the query by; 
may be null;
-     *      optionally add a " ASC" for ascending or " DESC" for descending
-     *@return List of GenericValue instances as specified in the relation 
definition
-     *@deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public List<GenericValue> getRelatedCache(String relationName, 
List<String> orderBy) throws GenericEntityException {
-        return this.getDelegator().getRelated(relationName, null, orderBy, 
this, true);
-    }
-
     /** Get the named Related Entity for the GenericValue from the persistent 
store
      *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
      *@return List of GenericValue instances as specified in the relation 
definition
@@ -208,20 +174,10 @@ public class GenericValue extends Generi
      */
     @Deprecated
     public GenericValue getRelatedOne(String relationName) throws 
GenericEntityException {
+        Debug.logWarning("deprecated method, please replace as suggested in 
API Java Doc, and link to OFBIZ-6651", getStackTraceAsString());
         return this.getDelegator().getRelatedOne(relationName, this, false);
     }
 
-    /** Get the named Related Entity for the GenericValue from the persistent
-     *  store, looking first in the global generic cache (for the moment this 
isn't true, is same as EmbeddedCache variant)
-     *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
-     *@return List of GenericValue instances as specified in the relation 
definition
-     *@deprecated use {@link #getRelatedOne(String, boolean)}
-     */
-    @Deprecated
-    public GenericValue getRelatedOneCache(String relationName) throws 
GenericEntityException {
-        return this.getDelegator().getRelatedOne(relationName, this, true);
-    }
-
     /** Get the named Related Entity for the GenericValue from the persistent 
store
      *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
      *@param useCache Whether to cache the results
@@ -231,52 +187,6 @@ public class GenericValue extends Generi
         return this.getDelegator().getRelatedOne(relationName, this, useCache);
     }
 
-    /** Get the named Related Entity for the GenericValue from the persistent 
store and filter it
-     *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
-     *@param fields the fields that must equal in order to keep
-     *@return List of GenericValue instances as specified in the relation 
definition
-     *@deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public List<GenericValue> getRelatedByAnd(String relationName, Map<String, 
? extends Object> fields) throws GenericEntityException {
-        return this.getDelegator().getRelated(relationName, fields, null, 
this, false);
-    }
-
-    /** Get the named Related Entity for the GenericValue from the persistent
-     *  store and filter it, looking first in the global generic cache (for 
the moment this isn't true, is same as EmbeddedCache variant)
-     *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
-     *@param fields the fields that must equal in order to keep
-     *@return List of GenericValue instances as specified in the relation 
definition
-     *@deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public List<GenericValue> getRelatedByAndCache(String relationName, 
Map<String, ? extends Object> fields) throws GenericEntityException {
-        return this.getDelegator().getRelated(relationName, fields, null, 
this, true);
-    }
-
-    /** Get the named Related Entity for the GenericValue from the persistent 
store and order it
-     *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
-     *@param orderBy the order that they should be returned
-     *@return List of GenericValue instances as specified in the relation 
definition
-     *@deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public List<GenericValue> getRelatedOrderBy(String relationName, 
List<String> orderBy) throws GenericEntityException {
-        return this.getDelegator().getRelated(relationName, null, orderBy, 
this, false);
-    }
-
-    /** Get the named Related Entity for the GenericValue from the persistent
-     *  store and order it, looking first in the global generic cache (for the 
moment this isn't true, is same as EmbeddedCache variant)
-     *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
-     *@param orderBy the order that they should be returned
-     *@return List of GenericValue instances as specified in the relation 
definition
-     *@deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public List<GenericValue> getRelatedOrderByCache(String relationName, 
List<String> orderBy) throws GenericEntityException {
-        return this.getDelegator().getRelated(relationName, null, orderBy, 
this, true);
-    }
-
     /** Remove the named Related Entity for the GenericValue from the 
persistent store
      *@param relationName String containing the relation name which is the 
combination of relation.title and relation.rel-entity-name as specified in the 
entity XML definition file
      */
@@ -331,4 +241,8 @@ public class GenericValue extends Generi
             return "[null-entity-value]";
         }
     }
+    
+    public static String getStackTraceAsString() {
+        return Thread.currentThread().getStackTrace().toString();
+    }    
 }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java?rev=1704769&r1=1704768&r2=1704769&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java 
(original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java Wed 
Sep 23 08:03:45 2015
@@ -362,33 +362,10 @@ public class EntityUtil {
      */
     @Deprecated
     public static List<GenericValue> getRelated(String relationName, 
List<GenericValue> values) throws GenericEntityException {
+        Debug.logWarning("deprecated method, please replace as suggested in 
API Java Doc, and link to OFBIZ-6651", GenericValue.getStackTraceAsString());
         return getRelated(relationName, null, values, false);
     }
 
-    /**
-     * @deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public static List<GenericValue> getRelatedCache(String relationName, 
List<GenericValue> values) throws GenericEntityException {
-        return getRelated(relationName, null, values, true);
-    }
-
-    /**
-     * @deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public static List<GenericValue> getRelatedByAnd(String relationName, 
Map<String, ? extends Object> fields, List<GenericValue> values) throws 
GenericEntityException {
-        return getRelated(relationName, fields, values, false);
-    }
-
-    /**
-     * @deprecated use {@link #getRelated(String, Map, List, boolean)}
-     */
-    @Deprecated
-    public static List<GenericValue> getRelatedByAndCache(String relationName, 
Map<String, ? extends Object> fields, List<GenericValue> values) throws 
GenericEntityException {
-        return getRelated(relationName, fields, values, true);
-    }
-
     public static List<GenericValue> getRelated(String relationName, 
Map<String, ? extends Object> fields, List<GenericValue> values, boolean 
useCache) throws GenericEntityException {
         if (values == null) return null;
 

Modified: ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java?rev=1704769&r1=1704768&r2=1704769&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java (original)
+++ ofbiz/trunk/specialpurpose/solr/src/org/ofbiz/solr/SolrUtil.java Wed Sep 23 
08:03:45 2015
@@ -130,10 +130,6 @@ public abstract class SolrUtil {
             List<String> category = 
UtilGenerics.<String>checkList(context.get("category"));
             Iterator<String> catIter = category.iterator();
             while (catIter.hasNext()) {
-                /*
-                 * GenericValue cat = (GenericValue) catIter.next(); 
GenericValue prodCategory = cat.getRelatedOneCache("ProductCategory"); if 
(prodCategory.get("description") != null) {
-                 * doc1.addField("category", prodCategory.get("description")); 
} doc1.addField("cat", prodCategory.get("productCategoryId"));
-                 */
                 String cat = (String) catIter.next();
                 doc1.addField("cat", cat);
             }
@@ -240,4 +236,4 @@ public abstract class SolrUtil {
         return result;
     }
 
-}
\ No newline at end of file
+}


Reply via email to