@Override public QueryResultList<String> findReferences(FieldQuery query) throws ManagedSiteException { try { return getYard().findReferences(query); } catch (YardException e) { throw new ManagedSiteException(e.getMessage(), e); } }
@Override public QueryResultList<Representation> find(FieldQuery query) throws ManagedSiteException { try { return getYard().find(query); } catch (YardException e) { throw new ManagedSiteException(e.getMessage(), e); } }
@Override public void delete(String id) throws ManagedSiteException { try { getYard().remove(id); } catch (YardException e) { throw new ManagedSiteException(e.getMessage(), e); } }
@Override public void deleteAll() throws ManagedSiteException { try { getYard().removeAll(); } catch (YardException e) { throw new ManagedSiteException(e.getMessage(), e); } }
/** * Stores the parsed representation to the Yard and also applies the * configured {@link #getFieldMapper() FieldMappings}. * @param The representation to store */ @Override public void store(Representation representation) throws ManagedSiteException { try { Yard yard = getYard(); fieldMapper.applyMappings(representation, representation, yard.getValueFactory()); yard.store(representation); } catch (YardException e) { throw new ManagedSiteException(e.getMessage(), e); } } /**
@Override public Entity getEntity(String id) throws ManagedSiteException { Representation rep; try { rep = getYard().getRepresentation(id); } catch (YardException e) { throw new ManagedSiteException(e.getMessage(), e); } if(rep != null){ Entity entity = new EntityImpl(config.getId(), rep, null); SiteUtils.initEntityMetadata(entity, siteMetadata, null); return entity; } else { return null; } }
throw new ManagedSiteException(e.getMessage(), e);
@Override public QueryResultList<Entity> findEntities(FieldQuery query) throws ManagedSiteException { QueryResultList<Representation> results; try { results = getYard().findRepresentation(query); } catch (YardException e) { throw new ManagedSiteException(e.getMessage(), e); } return new QueryResultListImpl<Entity>(results.getQuery(), new AdaptingIterator<Representation,Entity>( results.iterator(), new AdaptingIterator.Adapter<Representation,Entity>() { private final String siteId = config.getId(); @Override public Entity adapt(Representation value, Class<Entity> type) { Entity entity = new EntityImpl(siteId,value,null); SiteUtils.initEntityMetadata(entity, siteMetadata, null); return entity; } }, Entity.class),Entity.class); }