Пример #1
0
  public void setUp() throws Exception {
    os = ObjectStoreFactory.getObjectStore("os.unittest");

    item = new Item();
    item.setClassName("Department");
    item.setImplementations("Broke");
    item.setIdentifier("1");
    Attribute attr1 = new Attribute();
    attr1.setName("name");
    attr1.setValue("Department1");
    item.addAttribute(attr1);
    Attribute attr2 = new Attribute();
    attr2.setName("debt");
    attr2.setValue("10");
    item.addAttribute(attr2);
    Reference ref1 = new Reference();
    ref1.setName("address");
    ref1.setRefId("2");
    item.addReference(ref1);
    ReferenceList col1 = new ReferenceList();
    col1.setName("employees");
    col1.addRefId("3");
    col1.addRefId("4");
    item.addCollection(col1);

    dbItem = new org.intermine.model.fulldata.Item();
    dbItem.setClassName("Department");
    dbItem.setImplementations("Broke");
    dbItem.setIdentifier("1");
    dbItem.setId(1001);
    org.intermine.model.fulldata.Attribute dbAttr1 = new org.intermine.model.fulldata.Attribute();
    dbAttr1.setName("name");
    dbAttr1.setValue("Department1");
    dbAttr1.setItem(dbItem);
    dbItem.addAttributes(dbAttr1);
    org.intermine.model.fulldata.Attribute dbAttr2 = new org.intermine.model.fulldata.Attribute();
    dbAttr2.setName("debt");
    dbAttr2.setValue("10");
    dbAttr2.setItem(dbItem);
    dbItem.addAttributes(dbAttr2);
    org.intermine.model.fulldata.Reference dbRef1 = new org.intermine.model.fulldata.Reference();
    dbRef1.setName("address");
    dbRef1.setRefId("2");
    dbRef1.setItem(dbItem);
    dbItem.addReferences(dbRef1);
    org.intermine.model.fulldata.ReferenceList dbCol1 =
        new org.intermine.model.fulldata.ReferenceList();
    dbCol1.setName("employees");
    dbCol1.setRefIds("3 4");
    dbCol1.setItem(dbItem);
    dbItem.addCollections(dbCol1);

    referenceList = new ReferenceList();
    referenceList.setName("employees");
    referenceList.setRefIds(Arrays.asList("3", "4"));

    dbReferenceList = new org.intermine.model.fulldata.ReferenceList();
    dbReferenceList.setName("employees");
    dbReferenceList.setRefIds("3 4");
    departmentProxy = new ProxyReference(os, 1, Department.class);
    dbReferenceList.proxyItem(departmentProxy);
    // dbReferenceList.setId(2002);
  }
Пример #2
0
 /** {@inheritDoc} */
 public Integer store(Item item) {
   item.setId(idCounter++);
   storedItems.put(item.getIdentifier(), item);
   storedItemIds.put(item.getId(), item);
   return item.getId();
 }