|
Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java Mon Jul 5 10:07:56 2010 @@ -35,9 +35,10 @@ import org.ofbiz.entity.model.ModelEntit import org.ofbiz.entity.model.ModelField; /** - * Encapsulates operations between entities and entity fields. This is an immutable class. + * Base class for operators (less than, greater than, equals, etc). * */ +@SuppressWarnings("serial") public abstract class EntityOperator<L, R, T> extends EntityConditionBase { public static final int ID_EQUALS = 1; @@ -75,7 +76,7 @@ public abstract class EntityOperator<L, public static <L,R> EntityComparisonOperator<L,R> lookupComparison(String name) { EntityOperator<?,?,Boolean> operator = lookup(name); - if (!(operator instanceof EntityComparisonOperator)) + if (!(operator instanceof EntityComparisonOperator<?,?>)) throw new IllegalArgumentException(name + " is not a comparison operator"); return UtilGenerics.cast(operator); } @@ -233,7 +234,7 @@ public abstract class EntityOperator<L, if (this == obj) { return true; } - if (obj instanceof EntityOperator) { + if (obj instanceof EntityOperator<?,?,?>) { EntityOperator<?,?,?> otherOper = UtilGenerics.cast(obj); return this.idInt == otherOper.idInt; } @@ -247,7 +248,7 @@ public abstract class EntityOperator<L, protected void appendRHSList(List<EntityConditionParam> entityConditionParams, StringBuilder whereStringBuilder, ModelField field, R rhs) { whereStringBuilder.append('('); - if (rhs instanceof Collection) { + if (rhs instanceof Collection<?>) { Iterator<R> rhsIter = UtilGenerics.<Collection<R>>cast(rhs).iterator(); while (rhsIter.hasNext()) { @@ -265,7 +266,7 @@ public abstract class EntityOperator<L, } protected <X> void appendRHSBetweenList(List<EntityConditionParam> entityConditionParams, StringBuilder whereStringBuilder, ModelField field, X rhs) { - if (rhs instanceof Collection) { + if (rhs instanceof Collection<?>) { Iterator<R> rhsIter = UtilGenerics.<Collection<R>>cast(rhs).iterator(); while (rhsIter.hasNext()) { @@ -309,12 +310,22 @@ public abstract class EntityOperator<L, } }; + /** + * Comparison operator for <code>Collection</code> types. + * + * @param <E> + */ public static abstract class CollectionEntityComparisonOperator<E> extends EntityComparisonOperator<Comparable<E>, Collection<Comparable<E>>> { public CollectionEntityComparisonOperator(int id, String code) { super(id, code); } } + /** + * Comparison operator for <code>Comparable</code> types. + * + * @param <E> + */ public static abstract class ComparableEntityComparisonOperator<E> extends EntityComparisonOperator<Comparable<E>, E> { public ComparableEntityComparisonOperator(int id, String code) { super(id, code); Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java Mon Jul 5 10:07:56 2010 @@ -41,6 +41,7 @@ import org.ofbiz.entity.model.ModelEntit * encapsulate where conditions and don't require you to directly write SQL.</p> * */ +@SuppressWarnings("serial") public class EntityWhereString extends EntityCondition { protected static final ObjectFactory<EntityWhereString> entityWhereStringFactory = new ObjectFactory<EntityWhereString>() { Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Mon Jul 5 10:07:56 2010 @@ -1002,7 +1002,7 @@ public class GenericDAO { } else { sqlBuffer.append("COUNT(DISTINCT "); // this only seems to support a single column, which is not desirable but seems a lot better than no columns or in certain cases all columns - sqlBuffer.append(firstSelectField.getColName()); + sqlBuffer.append(firstSelectField.getColValue()); // sqlBuffer.append(modelEntity.colNameString(selectFields, ", ", "", datasourceInfo.aliasViews)); sqlBuffer.append(")"); } Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java Mon Jul 5 10:07:56 2010 @@ -199,7 +199,7 @@ public class EntityFinderUtil { } // If IN or BETWEEN operator, see if value is a literal list and split it - if ((operator.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN)) + if ((operator.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN) || operator.equals(EntityOperator.NOT_IN)) && value instanceof String) { String delim = null; if (((String)value).indexOf("|") >= 0) { @@ -217,7 +217,7 @@ public class EntityFinderUtil { } // don't convert the field to the desired type if this is an IN or BETWEEN operator and we have a Collection - if (!((operator.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN)) + if (!((operator.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN) || operator.equals(EntityOperator.NOT_IN)) && value instanceof Collection)) { // now to a type conversion for the target fieldName value = modelEntity.convertFieldValue(modelEntity.getField(fieldName), value, modelFieldTypeReader, context); Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java Mon Jul 5 10:07:56 2010 @@ -34,6 +34,8 @@ import java.sql.Statement; import java.sql.Types; import java.util.ArrayList; import java.util.List; + +import org.ofbiz.base.conversion.ConversionException; import org.ofbiz.base.util.Debug; import org.ofbiz.entity.GenericDataSourceException; import org.ofbiz.entity.GenericEntityException; @@ -526,6 +528,19 @@ public class SQLProcessor { /** * Set the next binding variable of the currently active prepared statement. * + * @param handler + * @param field + * + * @throws SQLException + */ + public void setValue(JdbcValueHandler handler, Object field) throws SQLException { + handler.setValue(_ps, _ind, field); + _ind++; + } + + /** + * Set the next binding variable of the currently active prepared statement. + * * @param field * * @throws SQLException Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Mon Jul 5 10:07:56 2010 @@ -42,8 +42,6 @@ import javax.sql.rowset.serial.SerialClo import javolution.util.FastMap; -import org.ofbiz.base.conversion.Converter; -import org.ofbiz.base.conversion.Converters; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.UtilGenerics; @@ -57,6 +55,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityConditionParam; import org.ofbiz.entity.condition.OrderByList; import org.ofbiz.entity.config.DatasourceInfo; +import org.ofbiz.entity.jdbc.JdbcValueHandler; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.model.ModelField; import org.ofbiz.entity.model.ModelFieldType; @@ -492,7 +491,6 @@ public class SqlJdbcUtil { } } - @SuppressWarnings("unchecked") public static void getValue(ResultSet rs, int ind, ModelField curField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException { ModelFieldType mft = modelFieldTypeReader.getModelFieldType(curField.getType()); @@ -501,48 +499,21 @@ public class SqlJdbcUtil { entity.getEntityName() + "." + curField.getName() + "."); } - // ----- Try out the new converter code ----- + // ----- Try out the new handler code ----- - Object sourceObject = null; - try { - sourceObject = rs.getObject(ind); - if (sourceObject == null) { - entity.dangerousSetNoCheckButFast(curField, null); - return; - } - } catch (SQLException e) { - throw new GenericEntityException(e); - } - Class<?> targetClass = mft.getJavaClass(); - if (targetClass != null) { - Class<?> sourceClass = sourceObject.getClass(); - if (targetClass.equals(sourceClass)) { - entity.dangerousSetNoCheckButFast(curField, sourceObject); + JdbcValueHandler handler = mft.getJdbcValueHandler(); + if (handler != null) { + try { + entity.dangerousSetNoCheckButFast(curField, handler.getValue(rs, ind)); return; + } catch (Exception e) { + Debug.logError(e, module); } - Converter<Object, Object> converter = (Converter<Object, Object>) mft.getSqlToJavaConverter(); - if (converter == null) { - if (mft.getSqlClass() == null) { - mft.setSqlClass(sourceClass); - } - try { - converter = (Converter<Object, Object>) Converters.getConverter(sourceClass, targetClass); - mft.setSqlToJavaConverter(converter); - } catch (Exception e) { - Debug.logError(e, module); - } - } - if (converter != null) { - try { - entity.dangerousSetNoCheckButFast(curField, converter.convert(sourceObject)); - return; - } catch (ClassCastException e) { - Debug.logError(e.toString(), module); - } catch (Exception e) { - Debug.logError(e, module); - } - } - Debug.logInfo("Unable to convert, falling back on switch statement", module); + } else { + Debug.logWarning("JdbcValueHandler not found for java-type " + mft.getJavaType() + + ", falling back on switch statement. Entity = " + + curField.getModelEntity().getEntityName() + + ", field = " + curField.getName() + ".", module); } // ------------------------------------------ @@ -777,6 +748,25 @@ public class SqlJdbcUtil { fieldValue = null; } + // ----- Try out the new handler code ----- + + JdbcValueHandler handler = mft.getJdbcValueHandler(); + if (handler != null) { + try { + sqlP.setValue(handler, fieldValue); + return; + } catch (SQLException e) { + throw new GenericDataSourceException("SQL Exception while setting value on field [" + modelField.getName() + "] of entity " + entityName + ": ", e); + } + } else { + Debug.logWarning("JdbcValueHandler not found for java-type " + mft.getJavaType() + + ", falling back on switch statement. Entity = " + + modelField.getModelEntity().getEntityName() + + ", field = " + modelField.getName() + ".", module); + } + + // ------------------------------------------ + String fieldType = mft.getJavaType(); if (fieldValue != null) { if (!ObjectType.instanceOf(fieldValue, fieldType)) { @@ -941,7 +931,13 @@ public class SqlJdbcUtil { if (field != null) { buffer.append('?'); } else { - buffer.append('\'').append(value).append('\''); + buffer.append('\''); + if (value instanceof String) { + buffer.append(((String) value).replaceAll("'", "''")); + } else { + buffer.append(value); + } + buffer.append('\''); } if (field != null && params != null) params.add(new EntityConditionParam(field, value)); } Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelFieldType.java Mon Jul 5 10:07:56 2010 @@ -19,16 +19,10 @@ package org.ofbiz.entity.model; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import org.ofbiz.base.conversion.Converter; -import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; - +import org.ofbiz.entity.jdbc.JdbcValueHandler; import org.w3c.dom.Element; -import org.w3c.dom.NodeList; /** * Generic Entity - FieldType model class @@ -46,23 +40,15 @@ public class ModelFieldType implements S /** The java-type of the Field */ protected String javaType = null; - /** The Java class of the Field */ - protected Class<?> javaClass = null; + /** The JDBC value handler for this Field */ + protected JdbcValueHandler jdbcValueHandler = null; /** The sql-type of the Field */ protected String sqlType = null; - /** The sql class of the Field */ - protected Class<?> sqlClass = null; - /** The sql-type-alias of the Field, this is optional */ protected String sqlTypeAlias = null; - protected Converter<?, ?> sqlToJavaConverter = null; - - /** validators to be called when an update is done */ - protected List<ModelFieldValidator> validators = new ArrayList<ModelFieldValidator>(); - /** Default Constructor */ public ModelFieldType() {} @@ -72,24 +58,7 @@ public class ModelFieldType implements S this.javaType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("java-type")).intern(); this.sqlType = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type")).intern(); this.sqlTypeAlias = UtilXml.checkEmpty(fieldTypeElement.getAttribute("sql-type-alias")).intern(); - NodeList validateList = fieldTypeElement.getElementsByTagName("validate"); - for (int i = 0; i < validateList.getLength(); i++) { - Element element = (Element) validateList.item(i); - String methodName = element.getAttribute("method"); - String className = element.getAttribute("class"); - if (methodName != null) { - this.validators.add(new ModelFieldValidator(className.intern(), methodName.intern())); - } - } - ((ArrayList<ModelFieldValidator>)this.validators).trimToSize(); - if (this.javaType != null) { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - try { - this.javaClass = loader.loadClass(this.javaType); - } catch (ClassNotFoundException e) { - Debug.logError(e, module); - } - } + this.jdbcValueHandler = JdbcValueHandler.getInstance(this.javaType, this.sqlType); } /** The type of the Field */ @@ -102,23 +71,9 @@ public class ModelFieldType implements S return this.javaType; } - /** The Java class of the Field */ - public Class<?> getJavaClass() { - return this.javaClass; - } - - /** Returns the SQL <code>Class</code> of the Field. The returned value might - * be <code>null</code>. The SQL class is unknown until a connection is made - * to the database. */ - public Class<?> getSqlClass() { - return this.sqlClass; - } - - /** Returns the SQL-object-type to Java-object-type <code>Converter</code> for - * the Field. The returned value might be <code>null</code>. The converter - * type is unknown until a connection is made to the database. */ - public Converter<?, ?> getSqlToJavaConverter() { - return this.sqlToJavaConverter; + /** Returns the JDBC value handler for this field type */ + public JdbcValueHandler getJdbcValueHandler() { + return this.jdbcValueHandler; } /** The sql-type of the Field */ @@ -131,26 +86,6 @@ public class ModelFieldType implements S return this.sqlTypeAlias; } - /** validators to be called when an update is done */ - public List<ModelFieldValidator> getValidators() { - return this.validators; - } - - /** Sets the SQL <code>Class</code> for this field. - * - * @param sqlClass - */ - public synchronized void setSqlClass(Class<?> sqlClass) { - this.sqlClass = sqlClass; - } - - /** Sets the SQL-object-type to Java-object-type <code>Converter</code> for - * the Field. - */ - public synchronized void setSqlToJavaConverter(Converter<?, ?> converter) { - this.sqlToJavaConverter = converter; - } - /** A simple function to derive the max length of a String created from the field value, based on the sql-type * @return max length of a String representing the Field value */ @@ -177,29 +112,4 @@ public class ModelFieldType implements S } return 20; } - - class ModelFieldValidator implements Serializable { - - protected String validatorClass = null; - protected String validatorMethod = null; - - public ModelFieldValidator(String className, String methodName) { - this.validatorClass = className; - this.validatorMethod = methodName; - } - - public String getClassName() { - if (UtilValidate.isNotEmpty(validatorClass) && UtilValidate.isNotEmpty(validatorMethod)) { - return validatorClass; - } - return null; - } - - public String getMethodName() { - if (UtilValidate.isNotEmpty(validatorClass) && UtilValidate.isNotEmpty(validatorMethod)) { - return validatorMethod; - } - return null; - } - } } Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Mon Jul 5 10:07:56 2010 @@ -1300,6 +1300,8 @@ public class ModelViewEntity extends Mod EntityOperator.OR, EntityCondition.makeCondition(lhs, EntityOperator.EQUALS, null)); } + } else if ( value == null && (operator.equals(EntityOperator.EQUALS) || operator.equals(EntityOperator.NOT_EQUAL))) { + return EntityCondition.makeCondition(lhs, UtilGenerics.<EntityComparisonOperator<?,?>>cast(operator), null); } else { if (ignoreCase) { // use the stuff to upper case both sides Modified: ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original) +++ ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Mon Jul 5 10:07:56 2010 @@ -18,14 +18,16 @@ *******************************************************************************/ package org.ofbiz.entity.test; +import java.math.BigDecimal; +import java.sql.Blob; +import java.sql.Date; +import java.sql.Time; import java.sql.Timestamp; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Map; -import junit.framework.TestCase; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; @@ -40,11 +42,13 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.config.DatasourceInfo; +import org.ofbiz.entity.config.EntityConfigUtil; +import org.ofbiz.entity.testtools.EntityTestCase; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; -import org.ofbiz.entity.testtools.EntityTestCase; public class EntityTestSuite extends EntityTestCase { @@ -249,6 +253,16 @@ public class EntityTestSuite extends Ent * Tests foreign key integrity by trying to remove an entity which has foreign-key dependencies. Should cause an exception. */ public void testForeignKeyCreate() { + try { + String helperName = delegator.getEntityHelper("Testing").getHelperName(); + DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); + if (!datasourceInfo.useFks) { + Debug.logInfo("Datasource " + datasourceInfo.name + " use-foreign-keys set to false, skipping testForeignKeyCreate", module); + return; + } + } catch (GenericEntityException e) { + Debug.logError(e, module); + } GenericEntityException caught = null; try { delegator.create("Testing", "testingId", delegator.getNextSeqId("Testing"), "testingTypeId", "NO-SUCH-KEY"); @@ -263,6 +277,16 @@ public class EntityTestSuite extends Ent * Tests foreign key integrity by trying to remove an entity which has foreign-key dependencies. Should cause an exception. */ public void testForeignKeyRemove() { + try { + String helperName = delegator.getEntityHelper("TestingNode").getHelperName(); + DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); + if (!datasourceInfo.useFks) { + Debug.logInfo("Datasource " + datasourceInfo.name + " use-foreign-keys set to false, skipping testForeignKeyRemove", module); + return; + } + } catch (GenericEntityException e) { + Debug.logError(e, module); + } GenericEntityException caught = null; try { EntityCondition isLevel1 = EntityCondition.makeCondition("description", EntityOperator.EQUALS, "node-level #1"); @@ -465,38 +489,97 @@ public class EntityTestSuite extends Ent } /* - * This will test setting a blob field to null by creating a TestBlob entity whose blob field is not set + * Tests field types. */ - public void testSetNullBlob() throws Exception { + public void testFieldTypes() throws Exception { + String id = "testFieldTypes"; + byte[] b = new byte[100000]; + for (int i = 0; i < b.length; i++) { + b[i] = (byte) i; + } + String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + StringBuilder sb = new StringBuilder(alpha.length() * 1000); + for (int i = 0; i < 1000; i++) { + sb.append(alpha); + } + String clobStr = sb.toString(); + long currentMillis = System.currentTimeMillis(); + Date currentDate = Date.valueOf(new Date(currentMillis).toString()); + Time currentTime = Time.valueOf(new Time(currentMillis).toString()); + // Different databases have different precision for Timestamps, so + // we will ignore fractional seconds. + Timestamp currentTimestamp = new Timestamp(currentDate.getTime()); + BigDecimal fixedPoint = new BigDecimal("999999999999.999999"); + // Different databases have different precision for floating + // point types, so we will use a simple decimal number. + Double floatingPoint = 1.0123456789; + Long numeric = Long.MAX_VALUE; try { - delegator.create("TestBlob", "testBlobId", "null-blob"); - } finally { - List<GenericValue> allTestBlobs = delegator.findList("TestBlob", null, null, null, null, false); - delegator.removeAll(allTestBlobs); - } - } - - /* - * Tests setting a byte value into a blob data type using the GenericValue .setBytes method - */ - public void testBlobCreate() throws Exception { - try { - byte[] b = new byte[100000]; + GenericValue testValue = delegator.makeValue("TestFieldType", "testFieldTypeId", id); + testValue.create(); + testValue.set("blobField", b); + testValue.set("byteArrayField", b); + testValue.set("objectField", currentTimestamp); + testValue.set("dateField", currentDate); + testValue.set("timeField", currentTime); + testValue.set("dateTimeField", currentTimestamp); + testValue.set("fixedPointField", fixedPoint); + testValue.set("floatingPointField", floatingPoint); + testValue.set("numericField", numeric); + testValue.set("clobField", clobStr); + testValue.store(); + testValue = delegator.findOne("TestFieldType", UtilMisc.toMap("testFieldTypeId", id), false); + assertEquals("testFieldTypeId", id, testValue.get("testFieldTypeId")); + byte[] c = null; + try { + Blob blob = (Blob) testValue.get("blobField"); + c = blob.getBytes(1, (int) blob.length()); + } catch (ClassCastException e) { + c = (byte[]) testValue.get("blobField"); + } + assertEquals("Byte array read from entity is the same length", b.length, c.length); for (int i = 0; i < b.length; i++) { - b[i] = (byte) i; + assertEquals("Byte array data[" + i + "]", b[i], c[i]); } - GenericValue testingBlob = delegator.makeValue("TestBlob", "testBlobId", "byte-blob"); - testingBlob.setBytes("testBlobField", b); - testingBlob.create(); - testingBlob = delegator.findOne("TestBlob", UtilMisc.toMap("testBlobId", "byte-blob"), false); - byte[] c = testingBlob.getBytes("testBlobField"); - assertEquals("Byte array read from Blob data is the same length", b.length, c.length); + c = (byte[]) testValue.get("byteArrayField"); + assertEquals("Byte array read from entity is the same length", b.length, c.length); for (int i = 0; i < b.length; i++) { - assertEquals("Blob data[" + i + "]", b[i], c[i]); + assertEquals("Byte array data[" + i + "]", b[i], c[i]); } + assertEquals("objectField", currentTimestamp, testValue.get("objectField")); + assertEquals("dateField", currentDate, testValue.get("dateField")); + assertEquals("timeField", currentTime, testValue.get("timeField")); + assertEquals("dateTimeField", currentTimestamp, testValue.get("dateTimeField")); + assertEquals("fixedPointField", fixedPoint, testValue.get("fixedPointField")); + assertEquals("floatingPointField", floatingPoint, testValue.get("floatingPointField")); + assertEquals("numericField", numeric, testValue.get("numericField")); + assertEquals("clobField", clobStr, testValue.get("clobField")); + testValue.set("blobField", null); + testValue.set("byteArrayField", null); + testValue.set("objectField", null); + testValue.set("dateField", null); + testValue.set("timeField", null); + testValue.set("dateTimeField", null); + testValue.set("fixedPointField", null); + testValue.set("floatingPointField", null); + testValue.set("numericField", null); + testValue.set("clobField", null); + testValue.store(); + testValue = delegator.findOne("TestFieldType", UtilMisc.toMap("testFieldTypeId", id), false); + assertEquals("testFieldTypeId", id, testValue.get("testFieldTypeId")); + assertNull("blobField null", testValue.get("blobField")); + assertNull("byteArrayField null", testValue.get("byteArrayField")); + assertNull("objectField null", testValue.get("objectField")); + assertNull("dateField null", testValue.get("dateField")); + assertNull("timeField null", testValue.get("timeField")); + assertNull("dateTimeField null", testValue.get("dateTimeField")); + assertNull("fixedPointField null", testValue.get("fixedPointField")); + assertNull("floatingPointField null", testValue.get("floatingPointField")); + assertNull("numericField null", testValue.get("numericField")); + assertNull("clobField null", testValue.get("clobField")); } finally { // Remove all our newly inserted values. - List<GenericValue> values = delegator.findList("TestBlob", null, null, null, null, false); + List<GenericValue> values = delegator.findList("TestFieldType", null, null, null, null, false); delegator.removeAll(values); } } Modified: ofbiz/branches/jquery/framework/example/webapp/birt/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/example/webapp/birt/WEB-INF/web.xml?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/example/webapp/birt/WEB-INF/web.xml (original) +++ ofbiz/branches/jquery/framework/example/webapp/birt/WEB-INF/web.xml Mon Jul 5 10:07:56 2010 @@ -191,7 +191,7 @@ under the License. <init-param><param-name>disableContextSecurity</param-name><param-value>N</param-value></init-param> <init-param> <param-name>allowedPaths</param-name> - <param-value>/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css:/frameset:/run:/preview:/download:/parameter:/document:/output:/extract:/webcontent:/CancelTask.jsp</param-value> + <param-value>/error:/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css:/frameset:/run:/preview:/download:/parameter:/document:/output:/extract:/webcontent:/CancelTask.jsp</param-value> </init-param> <init-param><param-name>errorCode</param-name><param-value>403</param-value></init-param> <init-param><param-name>redirectPath</param-name><param-value>/control/main</param-value></init-param> Modified: ofbiz/branches/jquery/framework/example/webapp/example/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/example/webapp/example/WEB-INF/web.xml?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/example/webapp/example/WEB-INF/web.xml (original) +++ ofbiz/branches/jquery/framework/example/webapp/example/WEB-INF/web.xml Mon Jul 5 10:07:56 2010 @@ -59,7 +59,7 @@ under the License. <init-param><param-name>disableContextSecurity</param-name><param-value>N</param-value></init-param> <init-param> <param-name>allowedPaths</param-name> - <param-value>/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> + <param-value>/error:/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> </init-param> <init-param><param-name>errorCode</param-name><param-value>403</param-value></init-param> <init-param><param-name>redirectPath</param-name><param-value>/control/main</param-value></init-param> Modified: ofbiz/branches/jquery/framework/exampleext/webapp/exampleext/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/exampleext/webapp/exampleext/WEB-INF/web.xml?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/exampleext/webapp/exampleext/WEB-INF/web.xml (original) +++ ofbiz/branches/jquery/framework/exampleext/webapp/exampleext/WEB-INF/web.xml Mon Jul 5 10:07:56 2010 @@ -49,7 +49,7 @@ under the License. <init-param><param-name>disableContextSecurity</param-name><param-value>N</param-value></init-param> <init-param> <param-name>allowedPaths</param-name> - <param-value>/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> + <param-value>/error:/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> </init-param> <init-param><param-name>errorCode</param-name><param-value>403</param-value></init-param> <init-param><param-name>redirectPath</param-name><param-value>/control/main</param-value></init-param> Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/calendar_date_select.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/calendar_date_select.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/calendar_date_select.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/calendar_date_select.js Mon Jul 5 10:07:56 2010 @@ -22,7 +22,7 @@ Element.buildAndAppend = function(type, nil = null; Date.one_day = 24*60*60*1000; -Date.weekdays = $w("S M T W T F S"); +Date.weekdays = $w("Sa M T W T F Su"); Date.first_day_of_week = 0; Date.months = $w("January February March April May June July August September October November December" ); Date.padded2 = function(hour) { var padded2 = parseInt(hour, 10); if (hour < 10) padded2 = "0" + padded2; return padded2; } @@ -43,7 +43,7 @@ Date.prototype.toFormattedString = funct var hour, str; str = this.getFullYear() + "-" + Date.padded2(this.getMonth() + 1) + "-" + Date.padded2(this.getDate()); - if (include_time) { hour=this.getHours(); str += " " + this.getHours() + ":" + this.getPaddedMinutes() + ":" + this.getSeconds() + "." + this.getMilliseconds() } + if (include_time) { hour=this.getHours(); str += " " + Date.padded2(this.getHours()) + ":" + this.getPaddedMinutes() + ":" + Date.padded2(this.getSeconds()) + "." + this.getMilliseconds() } return str; } /* mod end*/ Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/de.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/de.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/de.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/de.js Mon Jul 5 10:07:56 2010 @@ -1,3 +1,21 @@ +/* + * 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. + */ Date.weekdays = $w('Mo Di Mi Do Fr Sa So'); Date.months = $w('Januar Februar März April Mai Juni Juli August September Oktober November Dezember'); Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/es.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/es.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/es.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/es.js Mon Jul 5 10:07:56 2010 @@ -1,3 +1,21 @@ +/* + * 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. + */ Date.weekdays = $w("L M X J V S D"); Date.months = $w("Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre" ); @@ -8,4 +26,12 @@ _translations = { "Now": "Ahora", "Clear": "Limpiar", "Today": "Hoy" -} \ No newline at end of file +} + +//load the data format +var dataFormatJs = "format_euro_24hr.js" + +var e = document.createElement("script"); +e.src = "/images/calendarDateSelect/format/" + dataFormatJs; +e.type="text/javascript"; +document.getElementsByTagName("head")[0].appendChild(e); Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/fi.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/fi.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/fi.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/fi.js Mon Jul 5 10:07:56 2010 @@ -7,4 +7,12 @@ _translations = { "OK": "OK", "Now": "Nyt", "Today": "Tänään" -} \ No newline at end of file +} + +//load the data format +var dataFormatJs = "format_euro_24hr.js" + +var e = document.createElement("script"); +e.src = "/images/calendarDateSelect/format/" + dataFormatJs; +e.type="text/javascript"; +document.getElementsByTagName("head")[0].appendChild(e); Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/fr.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/fr.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/fr.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/fr.js Mon Jul 5 10:07:56 2010 @@ -1,3 +1,21 @@ +/* + * 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. + */ Date.weekdays = $w('L Ma Me J V S D'); Date.months = $w('Janvier Février Mars Avril Mai Juin Juillet Août Septembre Octobre Novembre Décembre'); Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/nl.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/nl.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/nl.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/nl.js Mon Jul 5 10:07:56 2010 @@ -1,3 +1,21 @@ +/* + * 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. + */ Date.weekdays = $w('Ma Di Wo Do Vr Za Zo'); Date.months = $w('Januari Februari Maart April Mei Juni Juli Augustus September Oktober November December'); @@ -8,4 +26,12 @@ _translations = { "Now": "Nu", "Today": "Vandaag", "Clear": "Wissen" -} \ No newline at end of file +} + +//load the data format +var dataFormatJs = "format_euro_24hr.js" + +var e = document.createElement("script"); +e.src = "/images/calendarDateSelect/format/" + dataFormatJs; +e.type="text/javascript"; +document.getElementsByTagName("head")[0].appendChild(e); Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/pl.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/pl.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/pl.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/pl.js Mon Jul 5 10:07:56 2010 @@ -7,4 +7,12 @@ _translations = { "OK": "OK", "Now": "Teraz", "Today": "DziÅ" -} \ No newline at end of file +} + +//load the data format +var dataFormatJs = "format_euro_24hr.js" + +var e = document.createElement("script"); +e.src = "/images/calendarDateSelect/format/" + dataFormatJs; +e.type="text/javascript"; +document.getElementsByTagName("head")[0].appendChild(e); Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/pt.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/pt.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/pt.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/pt.js Mon Jul 5 10:07:56 2010 @@ -1,3 +1,21 @@ +/* + * 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. + */ Date.weekdays = $w('D S T Q Q S S'); Date.months = $w('Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro'); @@ -9,3 +27,11 @@ _translations = { "Today": "Hoje", "Clear": "Limpar" } + +//load the data format +var dataFormatJs = "format_euro_24hr.js" + +var e = document.createElement("script"); +e.src = "/images/calendarDateSelect/format/" + dataFormatJs; +e.type="text/javascript"; +document.getElementsByTagName("head")[0].appendChild(e); Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/ru.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/ru.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/ru.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/ru.js Mon Jul 5 10:07:56 2010 @@ -1,3 +1,21 @@ +/* + * 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. + */ Date.weekdays = $w('Ðн ÐÑ Ð¡Ñ Ð§Ñ ÐÑ Ð¡Ð± ÐÑ?'); Date.months = $w('ЯнваÑÑ Ð¤ÐµÐ²ÑÐ°Ð»Ñ ÐаÑÑ Ð?пÑÐµÐ»Ñ Ðай ÐÑÐ½Ñ ÐÑÐ»Ñ Ð?вгÑÑ?Ñ Ð¡ÐµÐ½ÑÑ?бÑÑ ÐкÑÑ?бÑÑ Ð?оÑ?бÑÑ ÐекабÑÑ'); @@ -7,4 +25,12 @@ _translations = { "OK": "OK", "Now": "СейÑаÑ?", "Today": "СегоднÑ?" -} \ No newline at end of file +} + +//load the data format +var dataFormatJs = "format_euro_24hr.js" // Not sure + +var e = document.createElement("script"); +e.src = "/images/calendarDateSelect/format/" + dataFormatJs; +e.type="text/javascript"; +document.getElementsByTagName("head")[0].appendChild(e); Modified: ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/zh.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/zh.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/zh.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/calendarDateSelect/locale/zh.js Mon Jul 5 10:07:56 2010 @@ -1,3 +1,21 @@ +/* + * 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. + */ Date.weekdays = $w("? ? ? ? ? ? ?"); Date.months = $w("? ? ? ? ? ? ? ? ? ? ?? ??" ); @@ -7,4 +25,11 @@ _translations = { "OK": "??", "Now": "??", "Today": "??" -} \ No newline at end of file +} +//load the data format +var dataFormatJs = "format_iso_date.js" // Not sure + +var e = document.createElement("script"); +e.src = "/images/calendarDateSelect/format/" + dataFormatJs; +e.type="text/javascript"; +document.getElementsByTagName("head")[0].appendChild(e); Modified: ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js Mon Jul 5 10:07:56 2010 @@ -386,6 +386,39 @@ function modifySubmitButton (lookupDiv) var ocSub = oc.substring((oc.indexOf('=') + 1),(oc.length - 1)); navPagersSelect[navPager].setAttribute("onchange", "lookupPaginationAjaxRequest(" + ocSub + ", '" + lookupForm.id +"')"); } + + if (resultTable == null) { + return; + } + resultTable = resultTable.childElements()[0]; + var resultElements = resultTable.childElements(); + for (i in resultElements) { + var childElements = resultElements[i].childElements(); + if (childElements.size() == 1) { + continue; + } + + for (k = 1; k < childElements.size(); k++) { + var cell = childElements[k]; + var cellChild = null; + cellChild = cell.childElements(); + if (cellChild.size() > 0) { + + for (l in cellChild) { + var cellElement = cellChild[l]; + if (cellElement.tagName == 'A') { + var link = cellElement.href; + var liSub = link.substring(link.lastIndexOf('/')+1,(link.length)); + if (liSub.contains("javascript:set_")) { + cellElement.href = liSub; + } else { + cellElement.href = "javascript:lookupAjaxRequest('" + liSub + "')"; + } + } + } + } + } + } } catch (ex) { } Modified: ofbiz/branches/jquery/framework/images/webapp/images/selectall.js URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/selectall.js?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/selectall.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/selectall.js Mon Jul 5 10:07:56 2010 @@ -312,13 +312,17 @@ function submitFormInBackground(form, ar function ajaxSubmitFormUpdateAreas(form, areaCsvString) { submitFormDisableSubmits($(form)); waitSpinnerShow(); + hideErrorContainer = function() { + $('content-messages').removeClassName('errorMessage'); + new Effect.Fade('content-messages',{duration: 0.0}); + } updateFunction = function(transport) { var data = transport.responseText.evalJSON(true); if (data._ERROR_MESSAGE_LIST_ != undefined || data._ERROR_MESSAGE_ != undefined) { if(!$('content-messages')) { //add this div just after app-navigation if($('content-main-section')){ - $('content-main-section' ).insert({before: '<div id="content-messages"></div>'}); + $('content-main-section' ).insert({before: '<div id="content-messages" onclick="hideErrorContainer()"></div>'}); } } $('content-messages').addClassName('errorMessage'); @@ -331,6 +335,7 @@ function ajaxSubmitFormUpdateAreas(form, } ajaxUpdateAreas(areaCsvString); } + waitSpinnerHide(); } new Ajax.Request($(form).action, { parameters: $(form).serialize(true), Modified: ofbiz/branches/jquery/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java (original) +++ ofbiz/branches/jquery/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java Mon Jul 5 10:07:56 2010 @@ -22,10 +22,12 @@ import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.List; import java.util.Map; +import java.util.Locale; import javolution.util.FastMap; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.minilang.SimpleMethod; @@ -243,10 +245,14 @@ public class Calculate extends MethodOpe public BigDecimal calcValue(MethodContext methodContext, int scale, int roundingMode) { String valueStr = methodContext.expandString(this.valueStr); + Locale locale = (Locale) methodContext.getLocale(); + + if (locale == null) locale = Locale.getDefault(); + BigDecimal value; try { - value = new BigDecimal(valueStr); - value = value.setScale(scale, roundingMode); + BigDecimal parseVal = (BigDecimal) ObjectType.simpleTypeConvert(valueStr, "BigDecimal", null, null, locale, true); + value = parseVal.setScale(scale, roundingMode); } catch (Exception e) { Debug.logError(e, "Could not parse the number string: " + valueStr, module); throw new IllegalArgumentException("Could not parse the number string: " + valueStr); Modified: ofbiz/branches/jquery/framework/resources/templates/web.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/resources/templates/web.xml?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/resources/templates/web.xml (original) +++ ofbiz/branches/jquery/framework/resources/templates/web.xml Mon Jul 5 10:07:56 2010 @@ -39,7 +39,7 @@ <init-param><param-name>disableContextSecurity</param-name><param-value>N</param-value></init-param> <init-param> <param-name>allowedPaths</param-name> - <param-value>/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> + <param-value>/error:/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> </init-param> <init-param><param-name>errorCode</param-name><param-value>403</param-value></init-param> <init-param><param-name>redirectPath</param-name><param-value>/control/main</param-value></init-param> Modified: ofbiz/branches/jquery/framework/service/config/serviceengine.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/service/config/serviceengine.xml?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/service/config/serviceengine.xml (original) +++ ofbiz/branches/jquery/framework/service/config/serviceengine.xml Mon Jul 5 10:07:56 2010 @@ -58,7 +58,11 @@ under the License. <engine name="ofbiz-workflow" class="org.ofbiz.workflow.WorkflowEngine"/> <engine name="workflow" class="org.ofbiz.shark.service.SharkServiceEngine"/> <engine name="webslinger-server" class="org.ofbiz.webslinger.WebslingerServerEngine"/> - + <engine name="xml-rpc-local" class="org.ofbiz.service.engine.XMLRPCClientEngine"> + <parameter name="url" value="http://localhost:8080/webtools/control/xmlrpc"/> + <parameter name="login" value="admin"/> + <parameter name="password" value="ofbiz"/> + </engine> <service-location name="main-rmi" location="rmi://localhost:1099/RMIDispatcher"/> <service-location name="main-http" location="http://localhost:8080/webtools/control/httpService"/> Modified: ofbiz/branches/jquery/framework/service/dtd/service-config.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/service/dtd/service-config.xsd?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/service/dtd/service-config.xsd (original) +++ ofbiz/branches/jquery/framework/service/dtd/service-config.xsd Mon Jul 5 10:07:56 2010 @@ -92,9 +92,26 @@ under the License. </xs:attributeGroup> <xs:element name="engine"> <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="parameter"/> + </xs:sequence> <xs:attributeGroup ref="attlist.engine"/> </xs:complexType> </xs:element> + <xs:element name="parameter"> + <xs:annotation> + <xs:documentation> + Technical parameters use by engine + </xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:attributeGroup ref="attlist.parameter"/> + </xs:complexType> + </xs:element> + <xs:attributeGroup name="attlist.parameter"> + <xs:attribute type="xs:string" name="name" use="required"/> + <xs:attribute type="xs:string" name="value" use="required"/> + </xs:attributeGroup> <xs:attributeGroup name="attlist.engine"> <xs:attribute type="xs:string" name="name" use="required"/> <xs:attribute type="xs:string" name="class" use="required"/> Modified: ofbiz/branches/jquery/framework/service/servicedef/services_test_se.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/service/servicedef/services_test_se.xml?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/service/servicedef/services_test_se.xml (original) +++ ofbiz/branches/jquery/framework/service/servicedef/services_test_se.xml Mon Jul 5 10:07:56 2010 @@ -83,4 +83,19 @@ under the License. <service name="testServiceEcaGlobalEventExecOnRollback" engine="java" auth="false" location="org.ofbiz.service.test.ServiceEngineTestServices" invoke="testServiceEcaGlobalEventExecOnRollback"> </service> + + <!-- Call xml rpc from engine --> + <service name="testXmlRpcAdd" engine="java" auth="false" location="org.ofbiz.service.test.XmlRpcTests" invoke="testXmlRpcAdd" export="true"> + <attribute name="num1" mode="IN" type="Integer"/> + <attribute name="num2" mode="IN" type="Integer"/> + <attribute name="resulting" mode="OUT" type="Integer"/> + </service> + <service name="testXmlRpcLocalEngine" engine="xml-rpc-local" auth="false" invoke="testXmlRpcAdd"> + <attribute name="num1" mode="IN" type="Integer"/> + <attribute name="num2" mode="IN" type="Integer"/> + <attribute name="resulting" mode="OUT" type="Integer"/> + </service> + <service name="testXmlRpcClientAdd" engine="java" auth="false" location="org.ofbiz.service.test.XmlRpcTests" invoke="testXmlRpcClientAdd"> + <implements service="testServiceInterface"/> + </service> </services> Modified: ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/GenericDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/GenericDispatcher.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/GenericDispatcher.java (original) +++ ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/GenericDispatcher.java Mon Jul 5 10:07:56 2010 @@ -180,7 +180,7 @@ public class GenericDispatcher extends G } public Map<String, Object> runSync(String serviceName, int transactionTimeout, boolean requireNewTransaction, Object... context) throws ServiceAuthException, ServiceValidationException, GenericServiceException { - return runSync(serviceName, transactionTimeout, requireNewTransaction, ServiceUtil.makeContext(context)); + return runSync(serviceName, ServiceUtil.makeContext(context), transactionTimeout, requireNewTransaction); } /** Modified: ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java (original) +++ ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java Mon Jul 5 10:07:56 2010 @@ -31,6 +31,8 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; /** * Misc. utility method for dealing with the serviceengine.xml file @@ -144,6 +146,32 @@ public class ServiceConfigUtil implement return null; } + + public static String getEngineParameter(String engineName, String name) throws GenericConfigException { + Element root = ServiceConfigUtil.getXmlRootElement(); + Node node = root.getFirstChild(); + + if (node != null) { + do { + if (node.getNodeType() == Node.ELEMENT_NODE && "engine".equals(node.getLocalName())) { + Element engine = (Element) node; + if (engineName.equals(engine.getAttribute("name"))) { + NodeList params = engine.getElementsByTagName("parameter"); + if (params.getLength() > 0) { + for (int index = 0; index < params.getLength(); index++) { + Element param = (Element) params.item(index); + if (param != null && name.equals(param.getAttribute("name"))) { + return (String) param.getAttribute("value"); + } + } + } + } + } + } while ((node = node.getNextSibling()) != null); + } + return null; + } + public static class NotificationGroup implements Serializable { protected Notification notification; protected List<Notify> notify; Modified: ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java (original) +++ ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java Mon Jul 5 10:07:56 2010 @@ -29,6 +29,7 @@ import org.codehaus.groovy.runtime.Invok import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.GroovyUtil; import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.ModelService; import org.ofbiz.service.ServiceDispatcher; @@ -68,8 +69,10 @@ public final class GroovyEngine extends Map<String, Object> params = FastMap.newInstance(); params.putAll(context); context.put("parameters", params); - context.put("dctx", dispatcher.getLocalContext(localName)); - context.put("dispatcher", dispatcher); + + DispatchContext dctx = dispatcher.getLocalContext(localName); + context.put("dctx", dctx); + context.put("dispatcher", dctx.getDispatcher()); context.put("delegator", dispatcher.getDelegator()); try { Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), GroovyUtil.getBinding(context)); Modified: ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java (original) +++ ofbiz/branches/jquery/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java Mon Jul 5 10:07:56 2010 @@ -24,7 +24,6 @@ import java.util.Map; import javolution.util.FastList; import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; @@ -78,7 +77,7 @@ public class ServiceEngineTestServices { // wait at least long enough for the other method to have locked resource B Debug.logInfo("In testServiceDeadLockRetryThreadA just updated SVCLRT_A, beginning wait", module); - UtilMisc.staticWait(100); + Thread.sleep(100); Debug.logInfo("In testServiceDeadLockRetryThreadA done with wait, updating SVCLRT_B", module); GenericValue testingTypeB = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_B"); @@ -112,7 +111,7 @@ public class ServiceEngineTestServices { // wait at least long enough for the other method to have locked resource B Debug.logInfo("In testServiceDeadLockRetryThreadB just updated SVCLRT_B, beginning wait", module); - UtilMisc.staticWait(100); + Thread.sleep(100); Debug.logInfo("In testServiceDeadLockRetryThreadB done with wait, updating SVCLRT_A", module); GenericValue testingTypeA = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_A"); @@ -178,7 +177,7 @@ public class ServiceEngineTestServices { // wait at least long enough for the other method to have locked resource wait time out // (tx timeout 6s on this the Grabber and 2s on the Waiter): wait 4 seconds because timeout on this - UtilMisc.staticWait(4 * 1000); + Thread.sleep(4 * 1000); } catch (GenericEntityException e) { String errMsg = "Entity Engine Exception running lock wait timeout test Grabber thread: " + e.toString(); Debug.logError(e, errMsg, module); @@ -196,7 +195,7 @@ public class ServiceEngineTestServices { try { // wait for a small amount of time to make sure the grabber does it's thing first - UtilMisc.staticWait(100); + Thread.sleep(100); Debug.logInfo("In testServiceLockWaitTimeoutRetryWaiter about to update SVCLWTRT, wait starts here", module); Modified: ofbiz/branches/jquery/framework/service/testdef/servicetests.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/service/testdef/servicetests.xml?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/service/testdef/servicetests.xml (original) +++ ofbiz/branches/jquery/framework/service/testdef/servicetests.xml Mon Jul 5 10:07:56 2010 @@ -65,4 +65,11 @@ under the License. <test-case case-name="service-eca-global-event-exec-assert-data"> <entity-xml action="assert" entity-xml-url="component://service/testdef/data/ServiceEcaGlobalEventAssertData.xml"/> </test-case> + + <test-case case-name="service-xml-rpc"> + <junit-test-suite class-name="org.ofbiz.service.test.XmlRpcTests"/> + </test-case> + <test-case case-name="service-xml-rpc-local-engine"> + <service-test service-name="testXmlRpcClientAdd"/> + </test-case> </test-suite> Modified: ofbiz/branches/jquery/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java (original) +++ ofbiz/branches/jquery/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java Mon Jul 5 10:07:56 2010 @@ -26,6 +26,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.lang.management.ManagementFactory; import java.net.URL; import java.net.URLClassLoader; import java.util.List; @@ -33,6 +34,11 @@ import java.util.ArrayList; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; public final class InstrumenterWorker { @@ -68,61 +74,119 @@ public final class InstrumenterWorker { e.printStackTrace(); return srcPaths; } + ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()); try { File instrumenterFile = new File(instrumenterFileName); instrumenterFile.delete(); instrumenter.open(instrumenterFile, true); - List<File> result = new ArrayList<File>(); + List<Future<File>> futures = new ArrayList<Future<File>>(); for (File file: srcPaths) { String path = file.getPath(); if (path.matches(".*/ofbiz[^/]*\\.(jar|zip)")) { - System.err.println("instrumenting " + path); - String prefix = path.substring(0, path.length() - 4); - int slash = prefix.lastIndexOf("/"); - if (slash != -1) prefix = prefix.substring(slash + 1); - prefix += "-"; - File zipTmp = File.createTempFile("instrumented-" + prefix, path.substring(path.length() - 4)); - try { - zipTmp.deleteOnExit(); - ZipInputStream zin = new ZipInputStream(new FileInputStream(file)); - ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(zipTmp)); - ZipEntry entry; - while ((entry = zin.getNextEntry()) != null) { - InputStream in; - long size; - if (entry.getName().endsWith(".class")) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - copy(zin, baos); - byte[] bytes = instrumenter.instrumentClass(baos.toByteArray()); - size = bytes.length; - in = new ByteArrayInputStream(bytes); - } else { - in = zin; - size = entry.getSize(); - } - ZipEntry newEntry = new ZipEntry(entry); - newEntry.setSize(size); - newEntry.setCompressedSize(-1); - zout.putNextEntry(newEntry); - copy(in, zout); - if (entry.getName().endsWith(".class")) { - in.close(); - } - } - zout.close(); - file = zipTmp; - } catch (IOException e) { - zipTmp.delete(); - throw e; - } + futures.add(executor.submit(new FileInstrumenter(instrumenter, file))); + } else { + futures.add(new ConstantFutureFile(file)); } - result.add(file); + } + List<File> result = new ArrayList<File>(futures.size()); + for (Future<File> future: futures) { + result.add(future.get()); } instrumenter.close(); return result; + } catch (ExecutionException e) { + e.printStackTrace(); + return srcPaths; + } catch (InterruptedException e) { + e.printStackTrace(); + return srcPaths; } catch (IOException e) { e.printStackTrace(); return srcPaths; + } finally { + executor.shutdown(); + } + } + + private static final class ConstantFutureFile implements Future<File> { + private final File file; + + protected ConstantFutureFile(File file) { + this.file = file; + } + + public boolean cancel(boolean mayInterruptIfRunning) { + return false; + } + + public File get() { + return file; + } + + public File get(long timeout, TimeUnit unit) { + return file; + } + + public boolean isCancelled() { + return false; + } + + public boolean isDone() { + return true; + } + } + + private static final class FileInstrumenter implements Callable<File> { + private final Instrumenter instrumenter; + private final File file; + private final String path; + + protected FileInstrumenter(Instrumenter instrumenter, File file) { + this.instrumenter = instrumenter; + this.file = file; + this.path = file.getPath(); + } + + public File call() throws IOException { + System.err.println(Thread.currentThread() + ":instrumenting " + path); + String prefix = path.substring(0, path.length() - 4); + int slash = prefix.lastIndexOf("/"); + if (slash != -1) prefix = prefix.substring(slash + 1); + prefix += "-"; + File zipTmp = File.createTempFile("instrumented-" + prefix, path.substring(path.length() - 4)); + try { + zipTmp.deleteOnExit(); + ZipInputStream zin = new ZipInputStream(new FileInputStream(file)); + ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(zipTmp)); + ZipEntry entry; + while ((entry = zin.getNextEntry()) != null) { + InputStream in; + long size; + if (entry.getName().endsWith(".class")) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + copy(zin, baos); + byte[] bytes = instrumenter.instrumentClass(baos.toByteArray()); + size = bytes.length; + in = new ByteArrayInputStream(bytes); + } else { + in = zin; + size = entry.getSize(); + } + ZipEntry newEntry = new ZipEntry(entry); + newEntry.setSize(size); + newEntry.setCompressedSize(-1); + zout.putNextEntry(newEntry); + copy(in, zout); + if (entry.getName().endsWith(".class")) { + in.close(); + } + } + zout.close(); + return zipTmp; + } catch (IOException e) { + zipTmp.delete(); + throw e; + } } } } Modified: ofbiz/branches/jquery/framework/testtools/webapp/testtools/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/testtools/webapp/testtools/WEB-INF/web.xml?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/testtools/webapp/testtools/WEB-INF/web.xml (original) +++ ofbiz/branches/jquery/framework/testtools/webapp/testtools/WEB-INF/web.xml Mon Jul 5 10:07:56 2010 @@ -59,7 +59,7 @@ <init-param><param-name>disableContextSecurity</param-name><param-value>N</param-value></init-param> <init-param> <param-name>allowedPaths</param-name> - <param-value>/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> + <param-value>/error:/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> </init-param> <init-param><param-name>errorCode</param-name><param-value>403</param-value></init-param> <init-param><param-name>redirectPath</param-name><param-value>/control/main</param-value></init-param> Modified: ofbiz/branches/jquery/framework/webapp/config/url.properties URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/webapp/config/url.properties?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/webapp/config/url.properties (original) +++ ofbiz/branches/jquery/framework/webapp/config/url.properties Mon Jul 5 10:07:56 2010 @@ -38,7 +38,7 @@ content.url.prefix.standard= cookie.domain= # Exclude jsessionid for User-Agents (separated by comma's) -link.remove_lsessionid.user_agent_list = googlebot,yahoo,msnbot +link.remove_lsessionid.user_agent_list = googlebot,yahoo,msnbot,mediapartners-google # Should HTTP parameters sent to services require encryption? # This is generally advised for more secure webapps as it makes it more difficult to spoof requests (XSRF) that change data. Modified: ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=960512&r1=960511&r2=960512&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java (original) +++ ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Mon Jul 5 10:07:56 2010 @@ -289,7 +289,6 @@ public class ConfigXMLReader { try { URL urlLocation = FlexibleLocation.resolveLocation(includeLocation); includes.add(urlLocation); - ControllerConfig controllerConfig = getControllerConfig(urlLocation); } catch (MalformedURLException mue) { Debug.logError(mue, "Error processing include at [" + includeLocation + "]:" + mue.toString(), module); } @@ -318,7 +317,11 @@ public class ConfigXMLReader { Element firstvisitElement = UtilXml.firstChildElement(rootElement, "firstvisit"); if (firstvisitElement != null) { for (Element eventElement: UtilXml.childElementList(firstvisitElement, "event")) { - this.firstVisitEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.firstVisitEventList.put(eventName, new Event(eventElement)); } } @@ -326,7 +329,11 @@ public class ConfigXMLReader { Element preprocessorElement = UtilXml.firstChildElement(rootElement, "preprocessor"); if (preprocessorElement != null) { for (Element eventElement: UtilXml.childElementList(preprocessorElement, "event")) { - this.preprocessorEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.preprocessorEventList.put(eventName, new Event(eventElement)); } } @@ -334,7 +341,11 @@ public class ConfigXMLReader { Element postprocessorElement = UtilXml.firstChildElement(rootElement, "postprocessor"); if (postprocessorElement != null) { for (Element eventElement: UtilXml.childElementList(postprocessorElement, "event")) { - this.postprocessorEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.postprocessorEventList.put(eventName, new Event(eventElement)); } } @@ -342,7 +353,11 @@ public class ConfigXMLReader { Element afterLoginElement = UtilXml.firstChildElement(rootElement, "after-login"); if (afterLoginElement != null) { for (Element eventElement: UtilXml.childElementList(afterLoginElement, "event")) { - this.afterLoginEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.afterLoginEventList.put(eventName, new Event(eventElement)); } } @@ -350,7 +365,11 @@ public class ConfigXMLReader { Element beforeLogoutElement = UtilXml.firstChildElement(rootElement, "before-logout"); if (beforeLogoutElement != null) { for (Element eventElement: UtilXml.childElementList(beforeLogoutElement, "event")) { - this.beforeLogoutEventList.put(eventElement.getAttribute("name"), new Event(eventElement)); + String eventName = eventElement.getAttribute("name"); + if (UtilValidate.isEmpty(eventName)) { + eventName = eventElement.getAttribute("type") + "::" + eventElement.getAttribute("path") + "::" + eventElement.getAttribute("invoke"); + } + this.beforeLogoutEventList.put(eventName, new Event(eventElement)); } } } |
| Free forum by Nabble | Edit this page |
