Package com.ipc.oce.objects

Examples of com.ipc.oce.objects.OCDocumentManager


  public static void tearDownAfterClass() throws Exception {
    app.exit();
  }
 
  public OCDocumentObject getRandomDocument(String docName) throws JIException {
    OCDocumentManager manager = app.getDocumentManager(docName);
    OCDocumentSelection selection = manager.select();
    selection.next();
    return selection.getObject();
  }
View Full Code Here


    System.out.println("Total documents: " + docCount);
  }
 
  @Test
  public void getMetadataViaManager() throws JIException {
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    OCDocumentMetadataObject meta = manager.getMetadata();
    System.out.println("getFullName: " + meta.getFullName());
    System.out.println("getComment: " + meta.getComment());
    System.out.println("getNumberLength: " + meta.getNumberLength());
    System.out.println("getPresentation: " + meta.getPresentation());
    System.out.println("checkUnique: " + meta.checkUnique());
View Full Code Here

    System.out.println(meta.toString());
  }
 
  @Test
  public void findByNumber() throws JIException, ParseException {
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    System.out.println(manager.getManagerName());
    System.out.println(manager.getMetadata().getFullName());
    // ------------------------
    OCStructure struct = manager.createEmptyStruct();
   
    //-------------------------
    String number = "102-И09-8x";
    Date date = (new SimpleDateFormat("yyyy")).parse("2009");
    OCDocumentRef ref0 = manager.findByNumber(number);
    System.out.println(ref0.isEmpty() + " " + ref0.getUUID());
    assertTrue(ref0.isEmpty());
   
    OCDocumentRef ref1 = manager.findByNumber(number, date);
    System.out.println(ref1.getNumberAsString() + " " + ref1.isEmpty() + " " + ref1.getUUID());
    assertFalse(ref1.isEmpty());
    assertTrue(ref1.getNumberAsString().trim().equals(number));
  }
View Full Code Here

    assertTrue(ref1.getNumberAsString().trim().equals(number));
  }
 
  @Test
  public void findByNumber2() throws JIException, ParseException {
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    String number = "102-И09-8x";
    Date date = (new SimpleDateFormat("dd.MM.yyyy HH:mm:ss")).parse("14.12.2009 12:12:10");
   
    // without date
    OCDocumentRef[] refs = manager.findByNumber2(number);
    assertTrue(refs != null);
    assertTrue(refs.length == 1);
    assertTrue(refs[0].getNumberAsString().trim().equals(number));
   
    // with date
    OCDocumentRef ref = manager.findByNumber2(number, date);
    System.out.println(ref);
    assertFalse(ref.isEmpty());
    assertTrue(refs[0].getNumberAsString().trim().equals(number));
  }
View Full Code Here

    assertTrue(refs[0].getNumberAsString().trim().equals(number));
  }
 
  @Test
  public void emptyRef() throws JIException {
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    String fullName = manager.getMetadata().getFullName();
    OCDocumentRef ref = manager.emptyRef();
    assertTrue(ref.isEmpty());
    assertTrue(ref.getUUID().toString().equals("00000000-0000-0000-0000-000000000000"));
    assertTrue(ref.getMetadata().getFullName().equals(fullName));
  }
View Full Code Here

  }
 
  @Test
  public void select() throws JIException {
   
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    OCDocumentSelection selection = manager.select();
    int stopFactor = 5000;
    while (selection.next() && (stopFactor--) != 0) {
      selection.isDeletionMark();
      selection.isPosted();
      assertTrue(selection.getNumberAsString().equals(selection.getRef().getNumberAsString()));
View Full Code Here

   
  }
 
  @Test
  public void selectWithDate() throws JIException, ParseException {
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    Date date = (new SimpleDateFormat("yyyy")).parse("2009");
    Date date2 = (new SimpleDateFormat("yyyy")).parse("2010");
    OCDocumentSelection selection = manager.select(date, date2); // select all docs in 2009
    Calendar cal = Calendar.getInstance();
    while (selection.next()) {
      Date selDate = selection.getDate();
      //System.out.println(selDate);
      cal.setTime(selDate);
      int year = cal.get(Calendar.YEAR);
      assertTrue(year == 2009);
    }
   
    selection = manager.select(date);
    while (selection.next()) {
      Date selDate = selection.getDate();
      //System.out.println(selDate);
      cal.setTime(selDate);
      int year = cal.get(Calendar.YEAR);
View Full Code Here

    }
  }
 
  @Test
  public void createAndDelete() throws JIException {
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    OCDocumentObject doc = manager.createDocument();
    System.out.println("isNew1: " + doc.isNew() + " [before write]");
    doc.setNumber("XXX-000-002");
    doc.setDate(new Date());
    doc.write();
    System.out.println("isNew2: " + doc.isNew() + " [after write]");
    OCUUID uuid = doc.getRef().getUUID();
    System.out.println(doc.getNumberAsString() + " created with " + uuid);
   
    OCDocumentRef ref = manager.getRef(uuid);
   
    String u = ref.getUUID().toString();
    ref.getObject().delete();
    System.out.println("...and deleted [" + u + "]");
  }
View Full Code Here

  }
 
  @Test
  public void belongToSequences() throws JIException, ParseException {
    System.out.println(" === belong ===");
    OCDocumentManager manager = app.getDocumentManager("ПриемНаРаботуВОрганизацию");
    OCDocumentSelection selection = manager.select();
    selection.next();
   
    OCSequenceRecordSetCollection collection = selection.getObject().getBelongingToSequences();
    System.out.println(collection + " size " + collection.size());
    for (OCSequenceRecordSet set : collection) {
View Full Code Here

    }
  }
 
  @Test
  public void listAttrNames() throws JIException {
    OCDocumentManager manager = app.getDocumentManager("ПриемНаРаботуВОрганизацию");
    OCDocumentSelection selection = manager.select();
    selection.next();
    OCDocumentObject object = selection.getObject();
    System.out.println(object.getMetadata().getAttributesName());
    System.out.println(object.getMetadata().getTabularSectionsName());
  }
View Full Code Here

TOP

Related Classes of com.ipc.oce.objects.OCDocumentManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.