Examples of DataSqueezer


Examples of org.apache.tapestry.services.DataSqueezer

    }

    public void testCustom() throws IOException
    {
        DataSqueezer ds = new DataSqueezerImpl(new DefaultClassResolver(), new ISqueezeAdaptor[]
        { new BHSqueezer() });

        attempt(new BooleanHolder(true), "BT", ds);
        attempt(new BooleanHolder(false), "BF", ds);
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

        String stringValue = Long.toHexString(System.currentTimeMillis());

        PropertyUtils.write(visit, "stringValue", stringValue);

        DataSqueezer squeezer = new DataSqueezerImpl(new DefaultClassResolver(visitClassLoader));

        String squeezed = squeezer.squeeze(visit);

        Object outVisit = squeezer.unsqueeze(squeezed);

        // System.out.println("outVisit classloader = " + outVisit.getClass().getClassLoader());

        assertNotNull(outVisit);
        assertTrue("Input and output objects not same.", visit != outVisit);
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

    {
      IBinding primaryKeysBinding = getBinding("primaryKeys");
      if (primaryKeysBinding == null)
        return;

      DataSqueezer squeezer = getDataSqueezer();
     
        int repsCount = stringReps.length;
        List primaryKeys = new ArrayList(repsCount);
      for (int i = 0; i < stringReps.length; i++) {
      String rep = stringReps[i];
      if (rep.length() == 0 || rep.charAt(0) != DESC_PRIMARY_KEY)
        continue;
      Object primaryKey = squeezer.unsqueeze(rep.substring(1));
      primaryKeys.add(primaryKey);
    }
     
      primaryKeysBinding.setObject(primaryKeys);
    }
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

     * @param value
     * @return
     */
    protected String getStringRepFromValue(Object value) {
      String rep;
      DataSqueezer squeezer = getDataSqueezer();
     
      // try to extract the primary key from the value
      Object pk = getPrimaryKeyFromValue(value);
      if (pk != null)
        // Primary key was extracted successfully.
        rep = DESC_PRIMARY_KEY + squeezer.squeeze(pk);
      else
        // primary key could not be extracted. squeeze value.
        rep = DESC_VALUE + squeezer.squeeze(value);
     
      return rep;
    }
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

     * @param rep the string representation for which a value should be returned
     * @return the value that corresponds to the provided string representation
     */
    protected Object getValueFromStringRep(String rep) {
      Object value = null;
      DataSqueezer squeezer = getDataSqueezer();
     
      // Check if the string rep is empty. If so, just return the default value.
      if (rep == null || rep.length() == 0)
        return getDefaultValue();
     
      // If required, find a value with an equivalent string representation and return it
      boolean match = getMatch();
    if (match) {
      value = findValueWithStringRep(rep, COMPLETE_REP_SOURCE);
      if (value != null)
        return value;
    }

    // Matching of the string representation was not successful or was disabled.
    // Use the standard approaches to obtain the value from the rep.
    char desc = rep.charAt(0);
    String squeezed = rep.substring(1);
      switch (desc) {
        case DESC_VALUE:
          // If the string rep is just the value itself, unsqueeze it
          value = squeezer.unsqueeze(squeezed);
          break;
         
        case DESC_PRIMARY_KEY:
          // Perform keyExpression match if not already attempted
          if (!match && getKeyExpression() != null)
            value = findValueWithStringRep(rep, KEY_EXPRESSION_REP_SOURCE);

          // If 'converter' is defined, try to perform conversion from primary key to value
          if (value == null) {
            IPrimaryKeyConverter converter = getConverter();
            if (converter != null) {
              Object pk = squeezer.unsqueeze(squeezed);
              value = converter.getValue(pk);
            }
          }
          break;
      }
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

    {
      IBinding primaryKeysBinding = getBinding("primaryKeys");
      if (primaryKeysBinding == null)
        return;

      DataSqueezer squeezer = getDataSqueezer();
     
        int repsCount = stringReps.length;
        List primaryKeys = new ArrayList(repsCount);
      for (int i = 0; i < stringReps.length; i++) {
      String rep = stringReps[i];
      if (rep.length() == 0 || rep.charAt(0) != DESC_PRIMARY_KEY)
        continue;
      Object primaryKey = squeezer.unsqueeze(rep.substring(1));
      primaryKeys.add(primaryKey);
    }
     
      primaryKeysBinding.setObject(primaryKeys);
    }
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

     * @param value
     * @return
     */
    protected String getStringRepFromValue(Object value) {
      String rep;
      DataSqueezer squeezer = getDataSqueezer();
     
      // try to extract the primary key from the value
      Object pk = getPrimaryKeyFromValue(value);
      if (pk != null)
        // Primary key was extracted successfully.
        rep = DESC_PRIMARY_KEY + squeezer.squeeze(pk);
      else
        // primary key could not be extracted. squeeze value.
        rep = DESC_VALUE + squeezer.squeeze(value);
     
      return rep;
    }
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

     * @return the value that corresponds to the provided string representation
     */
    protected Object getValueFromStringRep(Iterator sourceIterator, Iterator fullSourceIterator,
        Map repToValueMap, String rep) {
      Object value = null;
      DataSqueezer squeezer = getDataSqueezer();
     
      // Check if the string rep is empty. If so, just return the default value.
      if (rep == null || rep.length() == 0)
        return getDefaultValue();
     
      // If required, find a value with an equivalent string representation and return it
      boolean match = getMatch();
    if (match) {
      value = findValueWithStringRep(sourceIterator, fullSourceIterator, repToValueMap, rep, COMPLETE_REP_SOURCE);
      if (value != null)
        return value;
    }

    // Matching of the string representation was not successful or was disabled.
    // Use the standard approaches to obtain the value from the rep.
    char desc = rep.charAt(0);
    String squeezed = rep.substring(1);
      switch (desc) {
        case DESC_VALUE:
          // If the string rep is just the value itself, unsqueeze it
          value = squeezer.unsqueeze(squeezed);
          break;
         
        case DESC_PRIMARY_KEY:
          // Perform keyExpression match if not already attempted
          if (!match && getKeyExpression() != null)
            value = findValueWithStringRep(sourceIterator, fullSourceIterator, repToValueMap, rep, KEY_EXPRESSION_REP_SOURCE);

          // If 'converter' is defined, try to perform conversion from primary key to value
          if (value == null) {
            IPrimaryKeyConverter converter = getConverter();
            if (converter != null) {
              Object pk = squeezer.unsqueeze(squeezed);
              value = converter.getValue(pk);
            }
          }
          break;
      }
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

        String serviceName,
        String[] serviceContext,
        Object[] parameters,
        boolean stateful)
    {try { __CLOVER_72_0.M[428]++;
        __CLOVER_72_0.S[1800]++;DataSqueezer squeezer = cycle.getEngine().getDataSqueezer();
        __CLOVER_72_0.S[1801]++;String[] squeezed = null;

        __CLOVER_72_0.S[1802]++;try
        {
            __CLOVER_72_0.S[1803]++;squeezed = squeezer.squeeze(parameters);
        }
        catch (IOException ex)
        {
            __CLOVER_72_0.S[1804]++;throw new ApplicationRuntimeException(ex);
        }
View Full Code Here

Examples of org.apache.tapestry.services.DataSqueezer

        __CLOVER_72_0.S[1814]++;if ((((Tapestry.size(squeezed) == 0) && (++__CLOVER_72_0.CT[338] != 0)) || (++__CLOVER_72_0.CF[338] == 0))){
            __CLOVER_72_0.S[1815]++;return squeezed;}

        __CLOVER_72_0.S[1816]++;try
        {
            __CLOVER_72_0.S[1817]++;DataSqueezer squeezer = cycle.getEngine().getDataSqueezer();

            __CLOVER_72_0.S[1818]++;return squeezer.unsqueeze(squeezed);
        }
        catch (IOException ex)
        {
            __CLOVER_72_0.S[1819]++;throw new ApplicationRuntimeException(ex);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.