Ejemplo n.º 1
0
  public List<ObjectAdapter> loadInstancesAndAdapt(final PersistenceQuery persistenceQuery) {
    ensureOpened();
    ensureInTransaction();

    final PersistenceQueryProcessor<? extends PersistenceQuery> processor =
        persistenceQueryProcessorByClass.get(persistenceQuery.getClass());
    if (processor == null) {
      throw new UnsupportedFindException(
          MessageFormat.format(
              "Unsupported criteria type: {0}", persistenceQuery.getClass().getName()));
    }
    return processPersistenceQuery(processor, persistenceQuery);
  }
Ejemplo n.º 2
0
  @Override
  public List<ObjectAdapter> loadInstancesAndAdapt(final PersistenceQuery persistenceQuery)
      throws ObjectPersistenceException, UnsupportedFindException {

    if (!(persistenceQuery instanceof PersistenceQueryBuiltIn)) {
      throw new IllegalArgumentException(
          MessageFormat.format(
              "Provided PersistenceQuery not supported; was {0}; "
                  + "the in-memory object store only supports {1}",
              persistenceQuery.getClass().getName(), PersistenceQueryBuiltIn.class.getName()));
    }
    final PersistenceQueryBuiltIn builtIn = (PersistenceQueryBuiltIn) persistenceQuery;

    final List<ObjectAdapter> instances = Lists.newArrayList();
    final ObjectSpecification spec = persistenceQuery.getSpecification();
    findInstances(spec, builtIn, instances);
    return resolved(instances);
  }