Package com.ipc.oce.objects

Examples of com.ipc.oce.objects.OCDocumentRef


  private Object castToRef(OCObject object, int tCode) throws JIException{
    Object res = null;
    innerTypeCode = tCode;
    switch(tCode) {
      case OCType.OCT_REF_DOCUMENT: {
        res = new OCDocumentRef(object);
        break;
      }
      case OCType.OCT_REF_CATALOG: {
        res = new OCCatalogRef(object);
        break;
View Full Code Here


    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(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

 
  @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

    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

 
  @Ignore
  @Test
  public void deleteDoc() throws JIException, ParseException {
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    OCDocumentRef ref = manager.findByNumber("XXX-000-001", (new SimpleDateFormat("yyyy")).parse("2011"));
    System.out.println("FOR DELTE " + ref.getUUID());
    OCDocumentObject docObj = ref.getObject();
    docObj.delete();
    System.out.println("DELETED");
  }
View Full Code Here

  @Test
  public void getDocumentUUID() throws JIException {
    OCDocumentManager manager = app.getDocumentManager("СчетНаОплатуПокупателю");
    OCDocumentSelection selection = manager.select();
    selection.next();
    OCDocumentRef ref = selection.getRef();
    System.out.println(ref.getRefFullName() + " " + ref.getUUID().toString());
  }
View Full Code Here

    OCDocumentManager manager1 = app
        .getDocumentManager("СчетНаОплатуПокупателю");
    OCDocumentSelection selection1 = manager1.select();
    selection1.next();
    OCDocumentRef ref1 = selection1.getRef();
    OCDocumentObject obj1 = ref1.getObject();
    variant = new OCVariant(obj1);
    o = variant.value();

    assertTrue("Not " + OCDocumentObject.class.getName() + " it is "
        + o.getClass().getName(), o instanceof OCDocumentObject);
View Full Code Here

  @Path("doc")
  public Response findDocumentByNumberAndDate(@QueryParam("name")String docName, @QueryParam("num") String number, @QueryParam("date") String sDate, @QueryParam("dateformat") @DefaultValue("dd.MM.yyyy HH:mm:ss") String pattern) throws ParseException, JIException, IOException, ConfigurationException {
    Date date = (new SimpleDateFormat(pattern)).parse(sDate);
    OCApp app = getApplication();
    OCDocumentManager manager = app.getDocumentManager(docName);
    OCDocumentRef ref = manager.findByNumber(number, date);
    if (ref.isEmpty()) {
      return Response.status(Status.NOT_FOUND).build();
    } else {
      OCXDTOSerializer serializer = app.getXDTOSerializer();
     
      return Response.ok(serializer.writeXML(ref.getObject())
          ).build();
    }
  }
View Full Code Here

TOP

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

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.