Examples of StringValue


Examples of org.apache.flex.forks.batik.css.engine.value.StringValue

        ListValue result = new ListValue();
        for (;;) {
            switch (lu.getLexicalUnitType()) {
            case LexicalUnit.SAC_STRING_VALUE:
                result.append(new StringValue(CSSPrimitiveValue.CSS_STRING,
                                              lu.getStringValue()));
                lu = lu.getNextLexicalUnit();
                break;

            case LexicalUnit.SAC_URI:
                String uri = resolveURI(engine.getCSSBaseURI(),
                                        lu.getStringValue());
               
                result.append(new URIValue(lu.getStringValue(), uri));
                lu = lu.getNextLexicalUnit();
                if ((lu != null) &&
                    (lu.getLexicalUnitType() == LexicalUnit.SAC_FUNCTION)) {
                    if (!lu.getFunctionName().equalsIgnoreCase("format")) {
                        break;
                    }
                    // Format really does us no good so just ignore it.

                    // TODO: Should probably turn this into a ListValue
                    // and append the format function CSS Value.
                    lu = lu.getNextLexicalUnit();
                }
                break;
               
            case LexicalUnit.SAC_IDENT:
                StringBuffer sb = new StringBuffer(lu.getStringValue());
                lu = lu.getNextLexicalUnit();
                if (lu != null &&
                    lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
                    do {
                        sb.append(' ');
                        sb.append(lu.getStringValue());
                        lu = lu.getNextLexicalUnit();
                    } while (lu != null &&
                             lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT);
                    result.append(new StringValue(CSSPrimitiveValue.CSS_STRING,
                                                  sb.toString()));
                } else {
                    String id = sb.toString();
                    String s = id.toLowerCase().intern();
                    Value v = (Value)values.get(s);
                    result.append((v != null)
                                  ? v
                                  : new StringValue
                                        (CSSPrimitiveValue.CSS_STRING, id));
                }
                break;
            }
            if (lu == null) {
View Full Code Here

Examples of org.apache.flink.types.StringValue

  @Test
  public void testParseValidUnquotedStrings() {
   
    // check valid strings with out whitespaces and trailing delimiter
    byte[] recBytes = "abcdefgh|i|jklmno|".getBytes();
    StringValue s = new StringValue();
   
    int startPos = 0;
    startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
    assertTrue(startPos == 9);
    assertTrue(s.getValue().equals("abcdefgh"));
   
    startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
    assertTrue(startPos == 11);
    assertTrue(s.getValue().equals("i"));
   
    startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
    assertTrue(startPos == 18);
    assertTrue(s.getValue().equals("jklmno"));
   
   
    // check single field not terminated
    recBytes = "abcde".getBytes();
    startPos = 0;
    startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
    assertTrue(startPos == 5);
    assertTrue(s.getValue().equals("abcde"));
   
    // check last field not terminated
    recBytes = "abcde|fg".getBytes();
    startPos = 0;
    startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
    assertTrue(startPos == 6);
    assertTrue(s.getValue().equals("abcde"));
   
    startPos = parser.parseField(recBytes, startPos, recBytes.length, '|', s);
    assertTrue(startPos == 8);
    assertTrue(s.getValue().equals("fg"));
  }
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.document.util.StringValue

    @Override
    public <T extends Document> void invalidateCache(Collection<T> collection, String key) {
        if (collection == Collection.NODES) {
            Lock lock = getAndLock(key);
            try {
                nodesCache.invalidate(new StringValue(key));
            } finally {
                lock.unlock();
            }
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.memory.StringValue

        } else {
            try {
                final String uuid = getIdentifier(tree);
                String reference = weak ? PropertyType.TYPENAME_WEAKREFERENCE : PropertyType.TYPENAME_REFERENCE;
                String pName = propertyName == null ? "*" : propertyName;   // TODO: sanitize against injection attacks!?
                Map<String, ? extends CoreValue> bindings = Collections.singletonMap("uuid", new StringValue(uuid));

                Result result = queryEngine.executeQuery(
                        "SELECT * FROM [nt:base] WHERE PROPERTY([" + pName + "], '" + reference + "') = $uuid",
                        Query.JCR_SQL2, Long.MAX_VALUE, 0, bindings, root, new NamePathMapper.Default());

View Full Code Here

Examples of org.apache.jackrabbit.value.StringValue

    public void testSetSpecialPropertiesDirectly() throws NotExecutableException, RepositoryException {
        AuthorizableImpl user = (AuthorizableImpl) getTestUser(superuser);
        NodeImpl n = user.getNode();
        try {
            String pName = user.getPrincipalName();
            n.setProperty(UserConstants.P_PRINCIPAL_NAME, new StringValue("any-value"));

            // should have failed => change value back.
            n.setProperty(UserConstants.P_PRINCIPAL_NAME, new StringValue(pName));
            fail("Attempt to change protected property rep:principalName should fail.");
        } catch (ConstraintViolationException e) {
            // ok.
        }
       
        try {
            String imperson = "anyimpersonator";
            n.setProperty(
                    UserConstants.P_IMPERSONATORS,
                    new Value[] {new StringValue(imperson)},
                    PropertyType.STRING);
            fail("Attempt to change protected property rep:impersonators should fail.");
        } catch (ConstraintViolationException e) {
            // ok.
        }
View Full Code Here

Examples of org.apache.myfaces.tobago.internal.context.StringValue

    if (bundle != null && propertyKey != null) {
      ClientPropertiesKey clientKey = ClientPropertiesKey.get(facesContext);
      PropertyCacheKey cacheKey = new PropertyCacheKey(clientKey, bundle, propertyKey);
     
      StringValue result = propertyCache.get(cacheKey);
      if (result == null) {
        List properties = getPaths(clientKey, "", PROPERTY, bundle, "", false, true, false, propertyKey, true, false);
        if (properties != null) {
          result = new StringValue((String) properties.get(0));
        } else {
          result = StringValue.NULL;
        }
        propertyCache.put(cacheKey, result);
      }
      return result.getValue();
    }
    return null;
  }
View Full Code Here

Examples of org.apache.openjpa.lib.conf.StringValue

    public TestPluginValue(String test) {
        super(test);
    }

    public void testDefault() {
        defaultTest(new StringValue("testKey"));
        defaultTest(new PluginValue("testKey", true));
        defaultTest(new PluginListValue("testKey"));
        pluginDefaultTest(new PluginValue("testKey", true));
    }
View Full Code Here

Examples of org.apache.slide.projector.value.StringValue

        if ( template == null ) throw new ProcessException(new ErrorMessage("templateArrayRenderer/fragmentNotFound", new String[] { fragment }));
        StringBuffer buffer = new StringBuffer(template.getLength());
        for ( int i = 0; i < getMaxIndex(parameter); i++ ) {
            template.evaluate(buffer, parameter, i);
        }
        return new Result(OK, OUTPUT, new StringValue(buffer.toString(), template.getContentType(), false));
    }
View Full Code Here

Examples of org.apache.wicket.util.string.StringValue

  private static final String CONTENT_TYPE = "application/json";
  private static final ObjectMapper mapper = new ObjectMapper();

  protected ResourceResponse newResourceResponse(Attributes attributes)
  {
    final StringValue queriesParam = attributes.getRequest().getQueryParameters().getParameterValue("queries");
    int qs = queriesParam.toInt(1);
    if (qs < 1)
    {
      qs = 1;
    }
    else if (qs > 500)
    {
      qs = 500;
    }
    final int queries = qs;

    final ResourceResponse response = new ResourceResponse();
    response.setContentType(CONTENT_TYPE);

    response.setWriteCallback(new WriteCallback()
    {
      public void writeData(Attributes attributes)
      {
        try
        {
          final ThreadLocalRandom random = ThreadLocalRandom.current();
          DataSource dataSource = WicketApplication.get().getDataSource();
          World[] worlds = new World[queries];
          try (Connection connection = dataSource.getConnection())
          {
            try (PreparedStatement statement = connection.prepareStatement(
                       "SELECT * FROM World WHERE id = ?",
                       ResultSet.TYPE_FORWARD_ONLY,
                       ResultSet.CONCUR_READ_ONLY))
            {
              for (int i = 0; i < queries; i++)
              {
                  statement.setInt(1, random.nextInt(DB_ROWS) + 1);
                  try (ResultSet resultSet = statement.executeQuery())
                  {
                      resultSet.next();
                      worlds[i] = new World(
                              resultSet.getInt("id"),
                              resultSet.getInt("randomNumber"));
                  }
              }
            }
          }

          String data;
          if (queriesParam.isNull())
          {
              // request to /db should return JSON object
              data = HelloDbResponse.mapper.writeValueAsString(worlds[0]);
          }
          else
View Full Code Here

Examples of org.apache.wicket.util.string.StringValue

        @Override
        protected ResourceResponse newResourceResponse(Attributes attributes) {
            ServletWebRequest request = (ServletWebRequest) attributes.getRequest();
            IRequestParameters queryParameters = request.getQueryParameters();
            boolean delete = queryParameters.getParameterValue("delete").toBoolean(false);
            final StringValue fileName = queryParameters.getParameterValue(FILENAME);

            final ResourceResponse resourceResponse = new ResourceResponse();

            if (delete)
            {
                fileManager.delete(fileName.toString());
                resourceResponse.setWriteCallback(new WriteCallback() {
                    @Override
                    public void writeData(Attributes attributes) throws IOException {
                    }
                });
            }
            else
            {
                resourceResponse.setWriteCallback(new WriteCallback() {
                    @Override
                    public void writeData(Attributes attributes) throws IOException
                    {
                        byte[] bytes = fileManager.get(fileName.toString());
                        attributes.getResponse().write(bytes);
                    }
                });
            }
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.