/** * {@inheritDoc} */ public Model getModel() { return osw.getModel(); }
/** * {@inheritDoc} */ public Model getModel() { return osw.getModel(); }
/** * Constructs a new instance of IntegrationWriterDataTrackingImpl. * * @param osw an instance of an ObjectStoreWriter, which we can use to access the database * @param dataTracker an instance of DataTracker, which we can use to store data tracking * information */ public IntegrationWriterDataTrackingImpl(ObjectStoreWriter osw, DataTracker dataTracker) { super(osw); this.dataTracker = dataTracker; this.trackerMissingClasses = Collections.emptySet(); priorityConfig = new PriorityConfig(osw.getModel()); }
/** * Constructs a new instance of IntegrationWriterDataTrackingImpl. * * @param osw an instance of an ObjectStoreWriter, which we can use to access the database * @param dataTracker an instance of DataTracker, which we can use to store data tracking * information */ public IntegrationWriterDataTrackingImpl(ObjectStoreWriter osw, DataTracker dataTracker) { super(osw); this.dataTracker = dataTracker; this.trackerMissingClasses = Collections.emptySet(); priorityConfig = new PriorityConfig(osw.getModel()); }
/** * Constructs a new instance of IntegrationWriterDataTrackingImpl. * * @param osw an instance of an ObjectStoreWriter, which we can use to access the database * @param dataTracker an instance of DataTracker, which we can use to store data tracking * information * @param trackerMissingClasses a Set of classes for which DataTracker data is useless */ public IntegrationWriterDataTrackingImpl(ObjectStoreWriter osw, DataTracker dataTracker, Set<Class<?>> trackerMissingClasses) { super(osw); this.dataTracker = dataTracker; this.trackerMissingClasses = trackerMissingClasses; priorityConfig = new PriorityConfig(osw.getModel()); }
/** * Constructs a new instance of IntegrationWriterDataTrackingImpl. * * @param osw an instance of an ObjectStoreWriter, which we can use to access the database * @param dataTracker an instance of DataTracker, which we can use to store data tracking * information * @param trackerMissingClasses a Set of classes for which DataTracker data is useless */ public IntegrationWriterDataTrackingImpl(ObjectStoreWriter osw, DataTracker dataTracker, Set<Class<?>> trackerMissingClasses) { super(osw); this.dataTracker = dataTracker; this.trackerMissingClasses = trackerMissingClasses; priorityConfig = new PriorityConfig(osw.getModel()); }
/** * Create a new InterMineBagHandler object. * * @param uosw UserProfile ObjectStoreWriter * @param osw ObjectStoreWriter used to resolve object ids and write to the objectstore bag * @param bags Map from bag name to InterMineIdBag - results are added to this Map * @param invalidBags Accumulator for the bags of this user that are no longer valid. * @param userId the id of the user * @param bagsValues a Map from bag name to sets of bag values. */ public InterMineBagHandler(ObjectStoreWriter uosw, ObjectStoreWriter osw, Map<String, InterMineBag> bags, Map<String, InvalidBag> invalidBags, Map<String, Set<BagValue>> bagsValues, Integer userId) { this.uosw = uosw; this.osw = osw; this.bags = bags; this.invalidBags = invalidBags; this.bagContents = bagsValues; this.userId = userId; this.model = osw.getModel(); Properties classKeyProps = new Properties(); try { InputStream inputStream = this.getClass().getClassLoader() .getResourceAsStream("class_keys.properties"); classKeyProps.load(inputStream); } catch (IOException ioe) { throw new BuildException("class_keys.properties not found", ioe); } classKeys = ClassKeyHelper.readKeys(model, classKeyProps); }
/** * Create a new InterMineBagHandler object. * * @param uosw UserProfile ObjectStoreWriter * @param osw ObjectStoreWriter used to resolve object ids and write to the objectstore bag * @param bags Map from bag name to InterMineIdBag - results are added to this Map * @param invalidBags Accumulator for the bags of this user that are no longer valid. * @param userId the id of the user * @param bagsValues a Map from bag name to sets of bag values. */ public InterMineBagHandler(ObjectStoreWriter uosw, ObjectStoreWriter osw, Map<String, InterMineBag> bags, Map<String, InvalidBag> invalidBags, Map<String, Set<BagValue>> bagsValues, Integer userId) { this.uosw = uosw; this.osw = osw; this.bags = bags; this.invalidBags = invalidBags; this.bagContents = bagsValues; this.userId = userId; this.model = osw.getModel(); Properties classKeyProps = new Properties(); try { InputStream inputStream = this.getClass().getClassLoader() .getResourceAsStream("class_keys.properties"); classKeyProps.load(inputStream); } catch (IOException ioe) { throw new BuildException("class_keys.properties not found", ioe); } classKeys = ClassKeyHelper.readKeys(model, classKeyProps); }
public void setUp() throws Exception { writer = ObjectStoreWriterFactory.getObjectStoreWriter("osw.unittest"); iw = IntegrationWriterFactory.getIntegrationWriter("integration.unittestmulti"); loader = new XmlDataLoader(iw); binding = new XmlBinding(writer.getModel()); toDelete = new ArrayList(); }
private int runQuery(ConstraintOp op, Collection<String> types) throws ObjectStoreException { PathQuery pq = new PathQuery(osw.getModel()); pq.addView("Employable.name"); pq.addConstraint(new PathConstraintMultitype("Employable", op, types)); Query q = MainHelper.makeQuery( pq, new HashMap(), new HashMap(), null, new HashMap()); Results res = osw.execute(q, 50000, true, false, true); return res.size(); }
protected Results runQuery(String path, ConstraintOp op, Collection<String> ranges) throws ObjectStoreException { PathQuery pq = new PathQuery(osw.getModel()); pq.addViews("Employee.name"); pq.addConstraint(Constraints.eq("Employee.name", "temp*")); pq.addConstraint(new PathConstraintRange(path, op, ranges)); Query q = MainHelper.makeQuery(pq, new HashMap(), new HashMap(), null, new HashMap()); Results res = osw.execute(q, 50000, true, false, true); return res; }
@Test public void isntOnRef() throws ObjectStoreException { Collection<String> types = Arrays.asList("CEO", "Contractor"); PathQuery pq = new PathQuery(osw.getModel()); pq.addView("Department.employees.name"); pq.addConstraint(Constraints.eq("Department.name", tempDepartment.getName())); PathQuery all = pq.clone(); pq.addConstraint(new PathConstraintMultitype("Department.employees", ConstraintOp.ISNT, Arrays.asList("Manager", "CEO"))); Query q = MainHelper.makeQuery( pq, new HashMap(), new HashMap(), null, new HashMap()); Query qall = MainHelper.makeQuery( all, new HashMap(), new HashMap(), null, new HashMap()); Results res = osw.execute(q, 50000, true, false, true); Results resall = osw.execute(qall, 50000, true, false, true); assertEquals(res.size(), resall.size() - (types.size() * SET_SIZE)); } }
@Test public void testSanity() throws ObjectStoreException { PathQuery pq = new PathQuery(osw.getModel()); pq.addViews("Employee.id", "Employee.employmentPeriod.id"); pq.addConstraint(Constraints.eq("Employee.name", "temp*")); Query q = MainHelper.makeQuery( pq, new HashMap(), new HashMap(), null, new HashMap()); Results res = osw.execute(q, 50000, true, false, true); assertEquals(res.size(), EMP_COUNT); for (Object row: res) { showRow(row); } }
@Test public void nonNullPathQueryCollections() { PathQuery pq = new PathQuery(osw.getModel()); pq.addView("Department.name"); pq.addConstraint(Constraints.eq("Department.name", "temp-*")); pq.addConstraint(Constraints.isNotNull("Department.employees")); Query q = makeQuery(pq); System.out.println(q.toString()); doNonNullCollectionTests(q); }
@Test public void testPQSanity() { PathQuery pq = new PathQuery(osw.getModel()); pq.addView("Department.name"); pq.addConstraint(Constraints.eq("Department.name", "temp-*")); Query q = makeQuery(pq); doSanityTest(q); }
@Test public void nullPathQueryCollections() { PathQuery pq = new PathQuery(osw.getModel()); pq.addView("Department.name"); pq.addConstraint(Constraints.eq("Department.name", "temp-*")); pq.addConstraint(Constraints.isNull("Department.employees")); Query q = makeQuery(pq); System.out.println(q.toString()); doNullCollectionTests(q); }
@Test public void nullPathQueryCollectionsSynonyms() { PathQuery pq = new PathQuery(osw.getModel()); pq.addView("Department.name"); pq.addConstraint(Constraints.eq("Department.name", "temp-*")); pq.addConstraint(new PathConstraintNull("Department.employees", ConstraintOp.IS_EMPTY)); Query q = makeQuery(pq); System.out.println(q.toString()); doNullCollectionTests(q); }
@Test public void pathQueryNullRefs() { PathQuery pq = new PathQuery(osw.getModel()); pq.addView("Department.name"); pq.addConstraint(Constraints.eq("Department.name", "temp-*")); pq.addConstraint(Constraints.isNull("Department.company")); Query q = makeQuery(pq); doNullRefTests(q); }
@Test public void pathQueryNonNullRefs() { PathQuery pq = new PathQuery(osw.getModel()); pq.addView("Department.name"); pq.addConstraint(Constraints.eq("Department.name", "temp-*")); pq.addConstraint(Constraints.isNotNull("Department.company")); Query q = makeQuery(pq); doNonNullRefTests(q); }
@Test public void allOuterJoinedReferences() throws ObjectStoreException { PathQuery pq = new PathQuery(osw.getModel()); pq.addViews( "Employee.name",