Package org.yaac.shared

Examples of org.yaac.shared.YaacException


      int index = bd.intValue() - 1;
     
      try {
        return new EvaluationResult(new BlobFileRefWrapper(record.lookupFileReference(index)))
      } catch (IndexOutOfBoundsException e) {
        throw new YaacException(ErrorCode.E303, null);
      }
    } else {
      return r.withWarning(ErrorCode.W137);
    }
  }
View Full Code Here


  /**
   * @param caught
   */
  public void handle(Throwable caught) {
    if (caught instanceof YaacException) {
      YaacException e = (YaacException) caught;
     
      if (isNullOrEmpty(e.getErrorCode())) {
        Window.alert(e.getErrorMsg());
      } else {
        String msg = errorMsg.getString(e.getErrorCode());
        Window.alert(msg);
      }
    } else // unexpected exception
      caught.printStackTrace();
      Window.alert("Unexpected exception : " + caught.getMessage());
View Full Code Here

    } else if (obj instanceof BlobStringWrapper) {
      return new Blob(((BlobStringWrapper) obj).getRawString().getBytes());
    } else if (obj instanceof TextStringWrapper) {
      return new Text(((TextStringWrapper) obj).getRawString());
    } else if (obj instanceof BlobFileRefWrapper || obj instanceof TextFileRefWrapper) {
      throw new YaacException(null, "File reference can not be used here");
    } else {
      return obj;
    }
  }
View Full Code Here

          " kind = " + kind +
          " filter = " + filter +
          " start = " + start +
          " length = " + length, e);
     
      throw new YaacException(null, e.getMissingIndexDefinitionXml());
    }
  }
View Full Code Here

      }
     
      return hierarchy; 
    } catch (IllegalArgumentException e) {
      // invalid key string
      throw new YaacException(null, "Invalid key string");
    }
  }
View Full Code Here

    try {
      // property can also be used during evaluation
      Evaluator e = EGQLUtil.parser(exp).bool_exp().e;
      if (!e.aggregationChildren().isEmpty()) { 
        // aggregation function is not allowed here
        throw new YaacException(ErrorCode.E301, null);
      }
     
      // load targeting entity
      DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
      final Entity entity = datastore.get(KeyFactory.stringToKey(keyString));
     
      // file context
      final List<FileDownloadPath> files = filePaths == null ? new ArrayList<FileDownloadPath>() :
        transform(filePaths, new Function<String, FileDownloadPath>(){
        @Override
        public FileDownloadPath apply(String pathStr) {
          return AutoBeanUtil.decode(FileDownloadPath.class, pathStr);
        }
      });
     
      EvaluationResult r = e.evaluate(new ProcessDataRecord() {
        @Override
        public FileDownloadPath lookupFileReference(Integer index) {
          return files.get(index);
        }
       
        @Override
        public EvaluationResult lookup(String name) {
          if (isNullOrEmpty(name)) {
            return null;
          } else // normal case, include key selection and property selection
            Object payload = Datastore.KEY_RESERVED_NAME.equals(name) ? entity.getKey() : entity.getProperty(name);
            return new EvaluationResult(entity.getKey(), name, null, payload)
          }
        }
       
        @Override
        public Iterable<EvaluationResult> asIterable() {
          // should not be called
          throw new IllegalArgumentException();
        }
      });
     
      PropertyInfo info = DatastoreUtil.convert(keyString, null, null, r.getPayload(), r.getWarnings());
      return info;
    } catch (RecognitionException e) {
      // can't parse input
      logger.log(Level.SEVERE, e.getMessage(), e);
      throw new YaacException(null, e.getMessage());
    } catch (EntityNotFoundException e) {
      logger.log(Level.SEVERE, e.getMessage(), e);
      throw new YaacException(ErrorCode.E302, null);
    }
  }
View Full Code Here

      to.setPropertiesFrom(from)// copy all properties
      datastore.put(to);
     
      return KeyFactory.keyToString(to.getKey());
    } catch (EntityNotFoundException e) {
      throw new YaacException(null, "Requested entity doesn't exist, please refresh your browser");
    }
  }
View Full Code Here

    logger.info("parsed query = " + strQuery);
   
    // step 2 : validate query
    for (FilterPredicate filter : query.getFilterPredicates()) {
      if (! Blobstore.BLOB_INFO_ALL_PROPERTIES.contains(filter.getPropertyName())) {
        throw new YaacException(ErrorCode.E201, null);
      }
    }
   
    for (SortPredicate sort : query.getSortPredicates()) {
      if (! Blobstore.BLOB_INFO_ALL_PROPERTIES.contains(sort.getPropertyName())) {
        throw new YaacException(ErrorCode.E201, null);
      }
    }
   
    // step3 : execute query
    AsyncDatastoreService datastore = DatastoreServiceFactory.getAsyncDatastoreService();
View Full Code Here

TOP

Related Classes of org.yaac.shared.YaacException

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.