private void storeNonInterMineObject(FastPathObject nimo, Source source, Source skelSource, int type) throws IllegalAccessException, ObjectStoreException { long time1 = System.currentTimeMillis(); FastPathObject newObj = DynamicUtil.createObject(nimo.getClass()); long time2 = System.currentTimeMillis(); timeSpentCreate += time2 - time1; Map<String, FieldDescriptor> fields = getModel().getFieldDescriptorsForClass(nimo .getClass()); for (Map.Entry<String, FieldDescriptor> entry : fields.entrySet()) { FieldDescriptor field = entry.getValue(); copyField(nimo, newObj, source, skelSource, field, type); } time1 = System.currentTimeMillis(); timeSpentCopyFields += time1 - time2; store(newObj); time2 = System.currentTimeMillis(); timeSpentStore += time2 - time1; }
private void storeNonInterMineObject(FastPathObject nimo, Source source, Source skelSource, int type) throws IllegalAccessException, ObjectStoreException { long time1 = System.currentTimeMillis(); FastPathObject newObj = DynamicUtil.createObject(nimo.getClass()); long time2 = System.currentTimeMillis(); timeSpentCreate += time2 - time1; Map<String, FieldDescriptor> fields = getModel().getFieldDescriptorsForClass(nimo .getClass()); for (Map.Entry<String, FieldDescriptor> entry : fields.entrySet()) { FieldDescriptor field = entry.getValue(); copyField(nimo, newObj, source, skelSource, field, type); } time1 = System.currentTimeMillis(); timeSpentCopyFields += time1 - time2; store(newObj); time2 = System.currentTimeMillis(); timeSpentStore += time2 - time1; }
/** * Takes a Class, and generates a Map of all the collections that are in the Class or any of its * parents. The Class may be a dynamic class - ie not in the model, although at least one of its * parents are in the model. * * @param c a Class * @return a Map from String collection name to Class element type */ public Map<String, Class<?>> getCollectionsForClass(Class<?> c) { synchronized (classToCollectionsMap) { Map<String, Class<?>> retval = classToCollectionsMap.get(c); if (retval == null) { retval = new LinkedHashMap<String, Class<?>>(); for (FieldDescriptor fd : getFieldDescriptorsForClass(c).values()) { if (fd instanceof CollectionDescriptor) { CollectionDescriptor cd = (CollectionDescriptor) fd; retval.put(cd.getName(), cd.getReferencedClassDescriptor().getType()); } } classToCollectionsMap.put(c, retval); } return retval; } }
/** * Takes a Class, and generates a Map of all the collections that are in the Class or any of its * parents. The Class may be a dynamic class - ie not in the model, although at least one of its * parents are in the model. * * @param c a Class * @return a Map from String collection name to Class element type */ public Map<String, Class<?>> getCollectionsForClass(Class<?> c) { synchronized (classToCollectionsMap) { Map<String, Class<?>> retval = classToCollectionsMap.get(c); if (retval == null) { retval = new LinkedHashMap<String, Class<?>>(); for (FieldDescriptor fd : getFieldDescriptorsForClass(c).values()) { if (fd instanceof CollectionDescriptor) { CollectionDescriptor cd = (CollectionDescriptor) fd; retval.put(cd.getName(), cd.getReferencedClassDescriptor().getType()); } } classToCollectionsMap.put(c, retval); } return retval; } }
public void testFieldsInNonInterMineObject() throws Exception { Model model = Model.getInstanceByName("basicmodel"); ClassDescriptor cld = model.getClassDescriptorByName("SimpleObject"); assertEquals(3, cld.getAllFieldDescriptors().size()); assertEquals( new HashSet<String>(Arrays.asList("employee", "name")), model.getFieldDescriptorsForClass(SimpleObject.class).keySet()); }
Map<String, FieldDescriptor> fields = os.getModel().getFieldDescriptorsForClass(retval .getClass()); for (Map.Entry<String, FieldDescriptor> entry : fields.entrySet()) {
Map<String, FieldDescriptor> fields = os.getModel().getFieldDescriptorsForClass(retval .getClass()); for (Map.Entry<String, FieldDescriptor> entry : fields.entrySet()) {
Map<String, FieldDescriptor> fields = getModel().getFieldDescriptorsForClass(newObj .getClass()); Map<String, Source> trackingMap = new HashMap<String, Source>();
Map<String, FieldDescriptor> fields = getModel().getFieldDescriptorsForClass(newObj .getClass()); Map<String, Source> trackingMap = new HashMap<String, Source>();
FieldDescriptor field = model.getFieldDescriptorsForClass(clazz).get(fieldName); if (field == null) { throw new ObjectStoreException("Field " + clazz.getName() + "." + fieldName
FieldDescriptor field = model.getFieldDescriptorsForClass(clazz).get(fieldName); if (field == null) { throw new ObjectStoreException("Field " + clazz.getName() + "." + fieldName
if (ref instanceof QueryCollectionReference) { ReferenceDescriptor refDesc = (ReferenceDescriptor) schema.getModel() .getFieldDescriptorsForClass(ref.getQcType()).get(ref.getFieldName()); if (refDesc.relationType() == FieldDescriptor.M_N_RELATION) { tablenames.add(DatabaseUtil.getIndirectionTableName((CollectionDescriptor)
if (ref instanceof QueryCollectionReference) { ReferenceDescriptor refDesc = (ReferenceDescriptor) schema.getModel() .getFieldDescriptorsForClass(ref.getQcType()).get(ref.getFieldName()); if (refDesc.relationType() == FieldDescriptor.M_N_RELATION) { tablenames.add(DatabaseUtil.getIndirectionTableName((CollectionDescriptor)
.getFieldDescriptorsForClass(qc.getType()); Map<String, String> fieldToAlias = state.getFieldToAlias(qc); Iterator<FieldDescriptor> fieldIter = null;
.getFieldDescriptorsForClass(qc.getType()); Map<String, String> fieldToAlias = state.getFieldToAlias(qc); Iterator<FieldDescriptor> fieldIter = null;
Query q = new Query(); Class<? extends InterMineObject> cls = obj.getClass(); Map<String, FieldDescriptor> fields = model.getFieldDescriptorsForClass(cls); QueryClass qc = new QueryClass(cls); q.addFrom(qc);
Query q = new Query(); Class<? extends InterMineObject> cls = obj.getClass(); Map<String, FieldDescriptor> fields = model.getFieldDescriptorsForClass(cls); QueryClass qc = new QueryClass(cls); q.addFrom(qc);
} else { AttributeDescriptor desc = (AttributeDescriptor) schema .getModel().getFieldDescriptorsForClass(((QueryClass) qc) .getType()).get(((QueryField) newFirstOrderBy) .getFieldName());
} else { AttributeDescriptor desc = (AttributeDescriptor) schema .getModel().getFieldDescriptorsForClass(((QueryClass) qc) .getType()).get(((QueryField) newFirstOrderBy) .getFieldName());
.getFieldDescriptorsForClass(connectingClass); FieldDescriptor fd = descriptorMap.get(connectingClassFieldName);