Posted by
jonesde on
Aug 07, 2006; 7:26am
URL: http://ofbiz.116.s1.nabble.com/svn-commit-r429250-in-incubator-ofbiz-trunk-framework-common-config-CommonEntityLabels-properties-coa-tp208751.html
Author: jonesde
Date: Sun Aug 6 23:26:49 2006
New Revision: 429250
URL:
http://svn.apache.org/viewvc?rev=429250&view=revLog:
Applied patch from Marco Risaliti, plus formatting correction and a name improvement to avoid confusion with a object variable; allows view entities to get i18n'ed labels from their member entities; Apache Jira #OFBIZ-129
Modified:
incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels.properties
incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels_it.properties
incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
Modified: incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels.properties
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels.properties?rev=429250&r1=429249&r2=429250&view=diff==============================================================================
--- incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels.properties (original)
+++ incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels.properties Sun Aug 6 23:26:49 2006
@@ -586,6 +586,19 @@
StatusItem.description.SHIPMENT_DELIVERED=Delivered
StatusItem.description.SHIPMENT_CANCELLED=Cancelled
+StatusValidChange.transitionName.SHIPMENT_INPUT.SHIPMENT_SCHEDULED=Schedule
+StatusValidChange.transitionName.SHIPMENT_INPUT.SHIPMENT_PICKED=Pick
+StatusValidChange.transitionName.SHIPMENT_INPUT.SHIPMENT_PACKED=Pack
+StatusValidChange.transitionName.SHIPMENT_SCHEDULED.SHIPMENT_PICKED=Pick
+StatusValidChange.transitionName.SHIPMENT_SCHEDULED.SHIPMENT_PACKED=Pack
+StatusValidChange.transitionName.SHIPMENT_PICKED.SHIPMENT_PACKED=Pack
+StatusValidChange.transitionName.SHIPMENT_PACKED.SHIPMENT_SHIPPED=Ship
+StatusValidChange.transitionName.SHIPMENT_SHIPPED.SHIPMENT_DELIVERED=Deliver
+StatusValidChange.transitionName.SHIPMENT_INPUT.SHIPMENT_CANCELLED=Cancel
+StatusValidChange.transitionName.SHIPMENT_SCHEDULED.SHIPMENT_CANCELLED=Cancel
+StatusValidChange.transitionName.SHIPMENT_PICKED.SHIPMENT_CANCELLED=Cancel
+StatusValidChange.transitionName.SHIPMENT_PACKED.SHIPMENT_CANCELLED=Cancel
+
StatusType.description.PURCH_SHIP_STATUS=Purchase Shipment
StatusItem.description.PURCH_SHIP_CREATED=Created
StatusItem.description.PURCH_SHIP_SHIPPED=Shipped
Modified: incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels_it.properties
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels_it.properties?rev=429250&r1=429249&r2=429250&view=diff==============================================================================
--- incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels_it.properties (original)
+++ incubator/ofbiz/trunk/framework/common/config/CommonEntityLabels_it.properties Sun Aug 6 23:26:49 2006
@@ -586,6 +586,19 @@
StatusItem.description.SHIPMENT_DELIVERED=Consegnata
StatusItem.description.SHIPMENT_CANCELLED=Cancellata
+StatusValidChange.transitionName.SHIPMENT_INPUT.SHIPMENT_SCHEDULED=Schedula
+StatusValidChange.transitionName.SHIPMENT_INPUT.SHIPMENT_PICKED=Preleva
+StatusValidChange.transitionName.SHIPMENT_INPUT.SHIPMENT_PACKED=Imballa
+StatusValidChange.transitionName.SHIPMENT_SCHEDULED.SHIPMENT_PICKED=Preleva
+StatusValidChange.transitionName.SHIPMENT_SCHEDULED.SHIPMENT_PACKED=Imballa
+StatusValidChange.transitionName.SHIPMENT_PICKED.SHIPMENT_PACKED=Imballa
+StatusValidChange.transitionName.SHIPMENT_PACKED.SHIPMENT_SHIPPED=Spedire
+StatusValidChange.transitionName.SHIPMENT_SHIPPED.SHIPMENT_DELIVERED=Consegna
+StatusValidChange.transitionName.SHIPMENT_INPUT.SHIPMENT_CANCELLED=Cancellare
+StatusValidChange.transitionName.SHIPMENT_SCHEDULED.SHIPMENT_CANCELLED=Cancellare
+StatusValidChange.transitionName.SHIPMENT_PICKED.SHIPMENT_CANCELLED=Cancellare
+StatusValidChange.transitionName.SHIPMENT_PACKED.SHIPMENT_CANCELLED=Cancellare
+
StatusType.description.PURCH_SHIP_STATUS=Spedizione Acquisto
StatusItem.description.PURCH_SHIP_CREATED=Creata
StatusItem.description.PURCH_SHIP_SHIPPED=Spedita
Modified: incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=429250&r1=429249&r2=429250&view=diff==============================================================================
--- incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original)
+++ incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Sun Aug 6 23:26:49 2006
@@ -54,6 +54,9 @@
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.model.ModelField;
import org.ofbiz.entity.model.ModelFieldType;
+import org.ofbiz.entity.model.ModelViewEntity;
+import org.ofbiz.entity.model.ModelViewEntity.ModelAlias;
+
import org.ofbiz.entity.util.ByteWrapper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -73,7 +76,6 @@
*/
public class GenericEntity extends Observable implements Map, LocalizedMap, Serializable, Comparable, Cloneable, Reusable {
public static final String module = GenericEntity.class.getName();
-
public static final GenericEntity NULL_ENTITY = new NullGenericEntity();
public static final NullField NULL_FIELD = new NullField();
@@ -662,8 +664,22 @@
fieldValue = null;
}
+ // In case of view entity try to retrieve the field heading from the real entity linked to the view
+ ModelEntity modelEntityToUse = (ModelEntity) this.getModelEntity();
+ if (modelEntityToUse instanceof ModelViewEntity) {
+ ModelViewEntity modelViewEntity = (ModelViewEntity) modelEntityToUse;
+ Iterator it = modelViewEntity.getAliasesIterator();
+ while (it.hasNext()) {
+ ModelAlias modelAlias = (ModelAlias) it.next();
+ if (modelAlias.getName().equalsIgnoreCase(name)) {
+ modelEntityToUse = modelViewEntity.getMemberModelEntity(modelAlias.getEntityAlias());
+ name = modelAlias.getField();
+ break;
+ }
+ }
+ }
if (UtilValidate.isEmpty(resource)) {
- resource = this.getModelEntity().getDefaultResourceName();
+ resource = modelEntityToUse.getDefaultResourceName();
// still empty? return the fieldValue
if (UtilValidate.isEmpty(resource)) {
//Debug.logWarning("Tried to getResource value for field named " + name + " but no resource name was passed to the method or specified in the default-resource-name attribute of the entity definition", module);
@@ -683,12 +699,12 @@
StringBuffer keyBuffer = new StringBuffer();
// start with the Entity Name
- keyBuffer.append(this.getEntityName());
+ keyBuffer.append(modelEntityToUse.getEntityName());
// next add the Field Name
keyBuffer.append('.');
keyBuffer.append(name);
// finish off by adding the values of all PK fields
- Iterator iter = this.getModelEntity().getPksIterator();
+ Iterator iter = modelEntityToUse.getPksIterator();
while (iter != null && iter.hasNext()) {
ModelField curField = (ModelField) iter.next();
keyBuffer.append('.');
@@ -1054,7 +1070,7 @@
}
if (needsCdata) {
- // use valueStr instead of the escaped value, not needed or wanted in a CDATA block
+ // use valueStr instead of the escaped value, not needed or wanted in a CDATA block
cdataMap.put(name, valueStr);
} else {
writer.print(' ');