Beispiel #1
0
 public void filter(Collection list) throws Exception {
   resetStorage();
   initializeStorage(new Vector());
   Iterator i, j;
   Metadata data;
   MetadataBase newData;
   String criteria;
   i = list.iterator();
   while (i.hasNext()) {
     data = (Metadata) i.next();
     criteria = defineCriteria(data);
     if (null != criteria) {
       agent.setCriteria(criteria);
       agent.search();
       if (0 == agent.getResults().size()) store(data);
       else {
         j = agent.getResults().iterator();
         while (j.hasNext()) {
           newData = new MetadataBase();
           newData.setOrigin(data.getOrigin());
           newData.setName(data.getName());
           newData.merge(agent.getName(), (Metadata) j.next());
           newData.merge(data);
           store(newData);
         }
       }
     }
   }
 }
Beispiel #2
0
 /**
  * Materialize metadata.
  *
  * @param atts the atts
  * @param o the o
  * @return the metadata
  */
 public static Metadata materializeMetadata(Origin o, Map atts) {
   MetadataBase m = new MetadataBase();
   m.setOrigin(o);
   Iterator i = atts.keySet().iterator();
   String key, value;
   while (i.hasNext()) {
     key = (String) i.next();
     value = (String) atts.get(key);
     m.set(key, value);
   }
   return m;
 }
Beispiel #3
0
  // Option 1
  public void createBOMTest(
      String hostname,
      String port,
      String username,
      String password,
      String itemId,
      String revision,
      String type,
      String name,
      String desc,
      String uom,
      String itemId2,
      String rev2,
      String itemId3,
      String rev3) {

    {
    } // System.out.println("");
    {
    } // System.out.println("---------------Create BOM Test----------------");

    TC10RepositoryBase tc10 = new TC10RepositoryBase();
    tc10.setDomainName("zws");
    tc10.setServerName("node-0");
    tc10.setRepositoryName("TC-QA-server");
    tc10.setHostName(hostname);
    tc10.setPort(port);
    tc10.setServicesPath("tc/services/PLMGatewayService");

    try {

      // Create a new item/item revision
      TC10ItemRevOrigin o = (TC10ItemRevOrigin) materializeTC10ItemRevOrigin(itemId, revision);
      MetadataBase data = new MetadataBase();
      data.set(TC10Constants.ITEM_ID, itemId);
      data.set(TC10Constants.REVISION, revision);
      data.set(TC10Constants.TYPE, type);
      data.set(TC10Constants.NAME, name);
      data.set(TC10Constants.DESCRIPTION, desc);
      data.set(TC10Constants.UNIT_OF_MEASURE, uom);
      data.setOrigin(o);

      TC10ItemRevOrigin o2 = (TC10ItemRevOrigin) materializeTC10ItemRevOrigin(itemId2, rev2);
      MetadataBase data2 = new MetadataBase();
      data2.set(TC10Constants.ITEM_ID, itemId2);
      data2.set(TC10Constants.REVISION, rev2);
      data2.set(TC10Constants.TYPE, type);
      data2.set(TC10Constants.NAME, name);
      data2.set(TC10Constants.DESCRIPTION, desc);
      data2.set(TC10Constants.UNIT_OF_MEASURE, uom);
      data2.setOrigin(o2);

      TC10ItemRevOrigin o3 = (TC10ItemRevOrigin) materializeTC10ItemRevOrigin(itemId3, rev3);
      MetadataBase data3 = new MetadataBase();
      data3.setOrigin(o3);
      data3.set(TC10Constants.ITEM_ID, itemId3);
      data3.set(TC10Constants.REVISION, rev3);
      data3.set(TC10Constants.TYPE, type);
      data3.set(TC10Constants.NAME, name);
      data3.set(TC10Constants.DESCRIPTION, desc);
      data3.set(TC10Constants.UNIT_OF_MEASURE, uom);

      MetadataSubComponentBase sub1 = new MetadataSubComponentBase(data2);
      MetadataSubComponentBase sub2 = new MetadataSubComponentBase(data3);

      sub2.setQuantity(3);
      data2.addSubComponent(sub2);

      sub1.setQuantity(2);
      data.addSubComponent(sub1);
      sub2.setQuantity(1);
      data.addSubComponent(sub2);

      RepositoryStructureTarget target = tc10.materializeStructureTarget();
      QxContext ctx = new QxContext();
      Authentication id = new Authentication(username, password);

      tc10.login(id);

      BillOfMaterials bill = new BillOfMaterials(data);
      target.structureBill(ctx, bill, id);

      tc10.logout(id);

    } catch (Exception e) {
      {
      } // System.out.println(e.getMessage());
      e.printStackTrace();
    }
    {
    } // System.out.println("");
    {
    } // System.out.println("---------------Create BOM Test End--------------");
  }
Beispiel #4
0
  // Option 1
  public void createTest(
      String hostname,
      String port,
      String username,
      String password,
      String itemId,
      String revision,
      String type,
      String name,
      String desc,
      String uom) {

    {
    } // System.out.println("");
    {
    } // System.out.println("---------------Create Test----------------");

    TC10RepositoryBase tc10 = new TC10RepositoryBase();
    tc10.setDomainName("zws");
    tc10.setServerName("node-0");
    tc10.setRepositoryName("TC-QA-server");
    tc10.setHostName(hostname);
    tc10.setPort(port);
    tc10.setServicesPath("tc/services/PLMGatewayService");

    try {

      RepositoryMetadataTarget target = tc10.materializeMetadataTarget();
      QxContext ctx = new QxContext();
      Authentication id = new Authentication(username, password);

      tc10.login(id);

      // Create a new item/item revision
      TC10ItemRevOrigin o = (TC10ItemRevOrigin) materializeTC10ItemRevOrigin(itemId, revision);
      MetadataBase data = new MetadataBase();
      /*
            {} //System.out.println("+itemId: "+itemId);
            {} //System.out.println("+revId: "+revision);
            {} //System.out.println("+type: "+type);
            {} //System.out.println("+name: "+name);
            {} //System.out.println("+desc: "+desc);
            {} //System.out.println("+uom: "+uom);
      */
      data.setOrigin(o);
      data.set(TC10Constants.ITEM_ID, itemId);
      data.set(TC10Constants.REVISION, revision);
      data.set(TC10Constants.TYPE, type);
      data.set(TC10Constants.NAME, name);
      data.set(TC10Constants.DESCRIPTION, desc);
      data.set(TC10Constants.UNIT_OF_MEASURE, uom);

      Origin tcOrig = target.create(ctx, data, null, id);
      PrintUtil.print(tcOrig);

      tc10.logout(id);
    } catch (Exception e) {
      {
      } // System.out.println(e.getMessage());
      e.printStackTrace();
    }
    {
    } // System.out.println("");
    {
    } // System.out.println("---------------Create Test End--------------");
  }