Package org.structr.core.converter

Examples of org.structr.core.converter.PropertyConverter


        Object value = entry.getValue();

        if (key != null) {

          PropertyKey propertyKey     = StructrApp.getConfiguration().getPropertyKeyForDatabaseName(entityType, key);
          PropertyConverter converter = propertyKey.databaseConverter(securityContext);

          if (converter != null) {

            try {
              Object propertyValue = converter.revert(value);
              resultMap.put(propertyKey, propertyValue);

            } catch(ClassCastException cce) {

              cce.printStackTrace();
View Full Code Here


        Object value = entry.getValue();

        if (key != null) {

          PropertyKey propertyKey     = StructrApp.getConfiguration().getPropertyKeyForJSONName(entity, key);
          PropertyConverter converter = propertyKey.inputConverter(securityContext);

          if (converter != null) {

            try {
              Object propertyValue = converter.convert(value);
              resultMap.put(propertyKey, propertyValue);

            } catch(ClassCastException cce) {

              cce.printStackTrace();
View Full Code Here

    Map<String, Object> inputTypedProperties = new LinkedHashMap<>();

    for(Entry<PropertyKey, Object> entry : properties.entrySet()) {

      PropertyKey propertyKey     = entry.getKey();
      PropertyConverter converter = propertyKey.inputConverter(securityContext);

      if (converter != null) {

        try {
          Object propertyValue = converter.revert(entry.getValue());
          inputTypedProperties.put(propertyKey.jsonName(), propertyValue);

        } catch(ClassCastException cce) {

          cce.printStackTrace();
View Full Code Here

  }

  @Override
  public T convertSearchValue(SecurityContext securityContext, String requestParameter) throws FrameworkException {

    PropertyConverter inputConverter = inputConverter(securityContext);
    Object convertedSearchValue      = requestParameter;

    if (inputConverter != null) {

      convertedSearchValue = inputConverter.convert(convertedSearchValue);
    }

    return (T)convertedSearchValue;
  }
View Full Code Here

        if (matcher.groupCount() == 2) {

          String rangeStart = matcher.group(1);
          String rangeEnd = matcher.group(2);

          PropertyConverter inputConverter = inputConverter(securityContext);
          Object rangeStartConverted = rangeStart;
          Object rangeEndConverted = rangeEnd;

          if (inputConverter != null) {

            rangeStartConverted = inputConverter.convert(rangeStartConverted);
            rangeEndConverted = inputConverter.convert(rangeEndConverted);
          }

          query.andRange(this, rangeStartConverted, rangeEndConverted);

          return;
View Full Code Here

    final ArrayList<Object> arguments = new ArrayList<>();

    for (Iterator<PropertyKey> it = keys.iterator(); it.hasNext();) {

      final PropertyKey key                  = it.next();
      final PropertyConverter inputConverter = key.inputConverter(securityContext);

      if (inputConverter != null) {

        try {
          final Object value = inputConverter.revert(key.getProperty(securityContext, obj, applyConverter, predicate));
          if (value != null) {

            arguments.add(value);
          }
View Full Code Here

    }

    for (int i=0; i<len; i++) {

      final PropertyKey key                  = keys.get(i);
      final PropertyConverter inputConverter = key.inputConverter(securityContext);

      if (inputConverter != null) {

        key.setProperty(securityContext, obj, inputConverter.convert(values[i]));

      } else {

        key.setProperty(securityContext, obj, values[i]);
      }
View Full Code Here

  }

  @Override
  public List<S> convertSearchValue(SecurityContext securityContext, String requestParameter) throws FrameworkException {

    final PropertyConverter inputConverter = inputConverter(securityContext);
    if (inputConverter != null) {

      final List<String> sources = new LinkedList<>();
      if (requestParameter != null) {

        for (String part : requestParameter.split("[,;]+")) {
          sources.add(part);
        }
      }

      return (List<S>)inputConverter.convert(sources);
    }

    return null;
  }
View Full Code Here

    // set properties
    for (PropertyKey key : propertyKeys.values()) {
     
      Object value = source.get(new GenericProperty(key.jsonName()));

      PropertyConverter converter = key.inputConverter(securityContext);
      if (converter != null) {
       
        try {
          Object convertedValue = converter.convert(value);
          destination.setProperty(key, convertedValue);
         
        } catch(FrameworkException fex) {
         
          logger.log(Level.WARNING, "Unable to convert grouped property {0} on type {1}: {2}", new Object[] {
View Full Code Here

    PropertyKey propertyKey = notion.getPrimaryPropertyKey();
    List<T> list            = new LinkedList<>();

    if (propertyKey != null) {

      PropertyConverter inputConverter = propertyKey.inputConverter(securityContext);
      if (inputConverter != null) {

        for (String part : requestParameter.split("[,;]+")) {

          list.add((T)inputConverter.convert(part));
        }

      } else {

        for (String part : requestParameter.split("[,;]+")) {
View Full Code Here

TOP

Related Classes of org.structr.core.converter.PropertyConverter

Copyright © 2018 www.massapicom. 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.