Package org.yaac.shared.property

Examples of org.yaac.shared.property.TextPropertyInfo


      FileDownloadPath downloadPath = AutoBeanUtil.newFileDownloadPath(
          FileDownloadPath.Type.DATASTORE_TEXT, keyString, propertyName, index,
          fileName, t.getValue().length());
      String pathStr = AutoBeanUtil.encode(FileDownloadPath.class, downloadPath);
      String fullStr = ((Text) obj).getValue();
      result = new TextPropertyInfo(fullStr, pathStr);
    } else if (obj instanceof TextStringWrapper) {
      result = new TextPropertyInfo(((TextStringWrapper) obj).getRawString());
    } else if (obj instanceof TextFileRefWrapper) {
      FileDownloadPath path = ((TextFileRefWrapper) obj).getRef();
      String pathStr = AutoBeanUtil.encode(FileDownloadPath.class, path);
      result = new TextPropertyInfo("No preview available", path.getSize(), pathStr);
    } else if (obj instanceof List) {
      @SuppressWarnings("rawtypes")
      List list = (List) obj;
      ListPropertyInfo propertyInfo = new ListPropertyInfo();
     
View Full Code Here


    case SHORT_BLOB:
      return new ShortBlob(((ShortBlobPropertyInfo) info).getPayload().getBytes());
    case STRING:
      return ((StringPropertyInfo) info).getPayload();
    case TEXT:     
      TextPropertyInfo textInfo = (TextPropertyInfo) info;
     
      if (textInfo.getRawText() == null) {
        FileDownloadPath path = AutoBeanUtil.decode(FileDownloadPath.class, textInfo.getDownloadPath());

        switch (path.getType()) {
        case MEMCACHE:
          byte [] data = (byte[]) memcache.get(path.getKeyStr());
          // throw exception when rawData == null? cache get expired is possible
          return new Text(new String(data));
        case DATASTORE_TEXT:
          // simply return existing one
          Object val = e.getProperty(path.getFieldName());
          if (val instanceof Text) {
            return val;
          } else if (val instanceof List) {
            return ((List)val).get(path.getIndex());
          } else {
            // should not happen
            throw new IllegalArgumentException("Can't locate text via path " + path.getFieldName() + " " + path.getIndex());
          }
        default:
          // should not happen
          throw new IllegalArgumentException("Can't locate text via path " + path.getFieldName() + " " + path.getIndex());
        }
      } else {
        // edit text value directly
        return new Text(textInfo.getRawText());
      }
    case TIMESTAMP:
      return ((DatePropertyInfo) info).getPayload();
    case USER:
      UserPropertyInfo upi = (UserPropertyInfo) info;
View Full Code Here

TOP

Related Classes of org.yaac.shared.property.TextPropertyInfo

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.