/** * Constructor. * @param storeMgr DB4OStoreManager * @param ec execution context * @param cls candidate class * @param subclasses Whether to include subclasses * @param cmd MetaData for the candidate class */ public DB4OExtent(DB4OStoreManager storeMgr, ExecutionContext ec, Class cls, boolean subclasses, AbstractClassMetaData cmd) { super(ec, cls, subclasses, cmd); this.db4oStoreMgr = storeMgr; this.fetchPlan = ec.getFetchPlan().getCopy(); }
ExpressionBuilderHelper helper = new ExpressionBuilderHelper(this, fieldNumbers.length * 20 + 100, table, acmd, false, null, ec.getFetchPlan(), fetchDepth, null); helper.sb.append("select id"); List<ColumnImpl> columns = new ArrayList<ColumnImpl>();
ExpressionBuilderHelper helper = new ExpressionBuilderHelper(this, fieldNumbers.length * 20 + 100, table, acmd, false, null, ec.getFetchPlan(), fetchDepth, null); helper.sb.append("select id"); List<ColumnImpl> columns = new ArrayList<ColumnImpl>();
/** * Convenience method to return a managed (POJO) object for the provided Entity for the EntityManager. * @param entity The entity * @param em The EntityManager * @param cls The POJO class being represented here * @return The POJO */ public Object getJPAFromEntity(Entity entity, EntityManager em, Class cls) { ExecutionContext ec = ((JPAEntityManager)em).getExecutionContext(); ClassLoaderResolver clr = ec.getClassLoaderResolver(); AbstractClassMetaData cmd = ec.getMetaDataManager().getMetaDataForClass(cls, clr); return EntityUtils.entityToPojo(entity, cmd, clr, ec, false, ec.getFetchPlan()); } }
/** * Convenience method to return a managed (POJO) object for the provided Entity for the PersistenceManager. * @param entity The entity * @param pm The PersistenceManager * @param cls The POJO class being represented here * @return The POJO */ public Object getJDOFromEntity(Entity entity, PersistenceManager pm, Class cls) { ExecutionContext ec = ((JDOPersistenceManager)pm).getExecutionContext(); ClassLoaderResolver clr = ec.getClassLoaderResolver(); AbstractClassMetaData cmd = ec.getMetaDataManager().getMetaDataForClass(cls, clr); return EntityUtils.entityToPojo(entity, cmd, clr, ec, false, ec.getFetchPlan()); } }
FetchPlan fetchPlan = ec.getFetchPlan(); Set<Integer> joinFieldsToLoad = getFieldsToLoad(helper.acmd, fetchPlan); String relName = col.getForceApiRelationshipName();
FetchPlan fetchPlan = ec.getFetchPlan(); Set<Integer> joinFieldsToLoad = getFieldsToLoad(helper.acmd, fetchPlan); String relName = col.getForceApiRelationshipName();
/** * Method to run a query with the supplied filter and sort predicates, to get the child objects for the * specified parent. * @param parentKey Key of the parent * @param filterPredicates Filtering required * @param sortPredicates Ordering required * @param ec ExecutionContext * @return The child objects list */ List<?> getChildrenUsingParentQuery(Key parentKey, Iterable<FilterPredicate> filterPredicates, Iterable<SortPredicate> sortPredicates, ExecutionContext ec) { List<Object> result = new ArrayList<Object>(); int numChildren = 0; String kindName = elementTable.getIdentifier().getIdentifierName(); for (Entity e : prepareChildrenQuery(parentKey, filterPredicates, sortPredicates, false, kindName).asIterable()) { // We only want direct children if (parentKey.equals(e.getKey().getParent())) { numChildren++; result.add(EntityUtils.entityToPojo(e, elementCmd, clr, ec, false, ec.getFetchPlan())); if (NucleusLogger.PERSISTENCE.isDebugEnabled()) { NucleusLogger.PERSISTENCE.debug("Retrieved entity with key " + e.getKey()); } } } NucleusLogger.PERSISTENCE.debug(String.format("Query had %d result%s.", numChildren, numChildren == 1 ? "" : "s")); return result; }
DatastoreService ds = DatastoreServiceFactoryInternal.getDatastoreService(config); try { return EntityUtils.entityToPojo(ds.get(indexKey), elementCmd, clr, ec, false, ec.getFetchPlan()); } catch (EntityNotFoundException enfe) { throw new NucleusDataStoreException("Could not determine entity for index=" + index + " with key=" + indexKey, enfe);
continue; key = EntityUtils.entityToPojo(entity, keyCmd, clr, ec, false, ec.getFetchPlan()); } else { continue; val = EntityUtils.entityToPojo(entity, valCmd, clr, ec, false, ec.getFetchPlan()); } else {
Object pojo = EntityUtils.entityToPojo(entity, elementCmd, clr, ec, false, ec.getFetchPlan()); children.add(pojo); i++;
Object pojo = EntityUtils.entityToPojo(entity, elemCmd, clr, ec, false, ec.getFetchPlan()); Array.set(value, i, pojo); i++;
Object pojo = EntityUtils.entityToPojo(entity, elemCmd, clr, ec, false, ec.getFetchPlan()); coll.add(pojo);
DatastoreService datastoreService = DatastoreServiceFactoryInternal.getDatastoreService(config); try { return EntityUtils.entityToPojo(datastoreService.get((Key)value), childCmd, clr, ec, false, ec.getFetchPlan()); } catch (EntityNotFoundException enfe) { return EntityUtils.entityToPojo(e, childCmd, clr, ec, false, ec.getFetchPlan());