use of com.yahoo.elide.core.exceptions.InvalidCollectionException in project elide by yahoo.
the class StartState method entityRecord.
private PersistentResource<?> entityRecord(StateContext state, EntityContext entity) {
String id = entity.id().getText();
String entityName = entity.term().getText();
EntityDictionary dictionary = state.getRequestScope().getDictionary();
Type<?> entityClass = dictionary.getEntityClass(entityName, state.getRequestScope().getApiVersion());
if (entityClass == null || !dictionary.isRoot(entityClass)) {
throw new InvalidCollectionException(entityName);
}
return PersistentResource.loadRecord(state.getRequestScope().getEntityProjection(), id, state.getRequestScope());
}
use of com.yahoo.elide.core.exceptions.InvalidCollectionException in project elide by yahoo.
the class MultiplexTransaction method getTransaction.
protected DataStoreTransaction getTransaction(Type<?> cls) {
DataStore lookupDataStore = this.multiplexManager.getSubManager(cls);
DataStoreTransaction transaction = transactions.get(lookupDataStore);
if (transaction == null) {
for (DataStore dataStore : multiplexManager.dataStores) {
if (dataStore.equals(lookupDataStore)) {
transaction = beginTransaction(dataStore);
transactions.put(dataStore, transaction);
break;
}
}
if (transaction == null) {
throw new InvalidCollectionException(cls.getName());
}
}
return transaction;
}
Aggregations