Examples of Document


Examples of org.geomajas.plugin.printing.document.Document

public class DocumentView extends AbstractView {

  @Override
  protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
      HttpServletResponse response) throws Exception {
    Document doc = (Document) model.get(PrintingController.DOCUMENT_KEY);
    String download = (String) model.get(PrintingController.DOWNLOAD_KEY);
    String fileName = (String) model.get(PrintingController.FILENAME_KEY);
    Format format = (Format) model.get(PrintingController.FORMAT_KEY);
       
    // Write content type and also length (determined via byte array).
    response.setContentType(format.getMimetype());
    response.setContentLength(doc.getContentLength());
   
    // check download method
    if (download.equals(PrintingController.DOWNLOAD_METHOD_SAVE)) {
      response.setHeader("Content-Disposition", " attachment; filename=\"" + fileName + "\"");
    } else if (download.equals(PrintingController.DOWNLOAD_METHOD_BROWSER)) {
      response.setHeader("Content-Disposition", " inline; filename=\"" + fileName + "\"");
    } else {
      throw new IllegalArgumentException("invalid download method " + download);
    }

    // Write the docmuent
    ServletOutputStream out = response.getOutputStream();
    doc.render(out, format);
    out.flush();
  }
View Full Code Here

Examples of org.hibernate.ogm.datastore.couchdb.dialect.backend.json.impl.Document

    }
  }

  @Test(expected = OptimisticLockException.class)
  public void testUpdatingADocumentWithWrongRevisionNumber() {
    Document createdDocument = dataStore.saveDocument( createEntity() );
    String firstVersion = createdDocument.getRevision();

    createdDocument = dataStore.saveDocument( createdDocument );
    createdDocument.setRevision( firstVersion );

    dataStore.saveDocument( createdDocument );
  }
View Full Code Here

Examples of org.hibernate.search.test.Document

  public void testMultipleEntitiesPerIndex() throws Exception {

    Session s = getSessions().openSession();
    s.getTransaction().begin();
    Document document =
        new Document( "Hibernate in Action", "Object/relational mapping with Hibernate", "blah blah blah" );
    s.persist( document );
    s.flush();
    s.persist(
        new AlternateDocument(
            document.getId(),
            "Hibernate in Action",
            "Object/relational mapping with Hibernate",
            "blah blah blah"
        )
    );
    s.getTransaction().commit();
    s.close();

    assertEquals( 0, getDocumentNbr() );

    s = getSessions().openSession();
    s.getTransaction().begin();
    s.delete( s.get( AlternateDocument.class, document.getId() ) );
    s.delete( s.createCriteria( Document.class ).uniqueResult() );
    s.getTransaction().commit();
    s.close();
  }
View Full Code Here

Examples of org.hibernate.test.instrument.domain.Document

      reportSkip( "domain classes not instrumented", "build-time instrumentation" );
    }
  }

  public static boolean isRunnable() {
    return FieldInterceptionHelper.isInstrumented( new Document() );
  }
View Full Code Here

Examples of org.icepdf.core.pobjects.Document

  public Image toImage(byte[] input, int pageNumber) throws PageException {
    return toImage(input, pageNumber, 100,false);
  }
 
  public Image toImage(byte[] input, int pageNumber, int scale, boolean transparent) throws PageException {
    Document document = toDocument(input);
        BufferedImage bi=toBufferedImage(document,pageNumber,scale/100f,transparent);
    document.dispose();
    return new Image(bi);
  }
View Full Code Here

Examples of org.infinispan.loaders.jpa.entity.Document

    user.setUsername("jdoe");
    user.setFirstName("John");
    user.setLastName("Doe");
    userCache.put(user.getUsername(), user);
   
    Document doc = new Document();
    doc.setName("hello");
    doc.setTitle("Hello World");
    doc.setArticle("hello there... this is a test");
    docCache.put(doc.getName(), doc);
   
    Vehicle v = new Vehicle();
    v.setId(new VehicleId("CA", "123456"));
    v.setColor("RED");
    vehicleCache.put(v.getId(), v);
View Full Code Here

Examples of org.infinispan.schematic.document.Document

    protected static void beforeAll( String configFileName ) throws Exception {
        String configFilePath = "config/" + configFileName;
        InputStream configStream = JcrQueryManagerTest.class.getClassLoader().getResourceAsStream(configFilePath);
        assertThat("Unable to find configuration file '" + configFilePath, configStream, is(notNullValue()));

        Document configDoc = Json.read(configStream);
        RepositoryConfiguration config = new RepositoryConfiguration(configDoc, configFileName);
        startRepository(config);

        try {
            // Use a session to load the contents ...
View Full Code Here

Examples of org.infoset.xml.Document

     
   }
   public void load(URI location)
      throws IOException,XMLException
   {
      Document doc = docLoader.load(location);
      Element top = doc.getDocumentElement();
      if (!top.getName().equals(COMPONENT)) {
         throw new XMLException("Expecting "+COMPONENT+" but found "+top.getName());
      }
      String value = top.getAttributeValue("autoconf-check");
      if (value!=null) {
View Full Code Here

Examples of org.internna.iwebmvc.model.Document

        user.setPassword("adminuser");
        user.setName("Admin");
        user.addRole((RoleImpl) securityDAO.findAuthority("admin"));
        securityDAO.createUser(user);
        assertNotNull(securityDAO.findUser("adminuser"));
        Document doc2 = new Document();
        doc2.setTemporal(true);
        doc2.setIdentifier("void image");
        doc2.setWidth(1);
        doc2.setHeight(1);
        doc2.setCreation(new Date());
        doc2.setMimeType("image/gif");
        doc2.setAuthor((UserImpl) securityDAO.findUser("adminuser"));
        doc2.setContents(FileCopyUtils.copyToByteArray(getClass().getResourceAsStream("/void.gif")));
        baseDao.create(doc2);
        generatedDocIDs.add(doc2.getId());
        byte[] contents = FileCopyUtils.copyToByteArray(getClass().getResourceAsStream("/void.gif"));
        MultiDocument md = new MultiDocument();
        Document doc = new Document();
        doc.setTemporal(false);
        doc.setIdentifier("void image");
        doc.setWidth(1);
        doc.setHeight(1);
        doc.setCreation(new Date());
        doc.setMimeType("image/gif");
        doc.setAuthor((UserImpl) securityDAO.findUser("adminuser"));
        doc.setContents(contents);
        Document doc3 = new Document();
        doc3.setTemporal(false);
        doc3.setIdentifier("blank image");
        doc3.setWidth(1);
        doc3.setHeight(1);
        doc3.setCreation(new Date());
        doc3.setMimeType("image/gif");
        doc3.setAuthor((UserImpl) securityDAO.findUser("adminuser"));
        doc3.setContents(contents);
        Document doc4 = new Document();
        doc4.setTemporal(false);
        doc4.setIdentifier("blank image");
        doc4.setWidth(1);
        doc4.setHeight(1);
        doc4.setCreation(new Date());
        doc4.setMimeType("image/gif");
        doc4.setAuthor((UserImpl) securityDAO.findUser("adminuser"));
        doc4.setContents(contents);
        Document doc5 = new Document();
        doc5.setTemporal(false);
        doc5.setIdentifier("blank image");
        doc5.setWidth(1);
        doc5.setHeight(1);
        doc5.setCreation(new Date());
        doc5.setMimeType("image/gif");
        doc5.setAuthor((UserImpl) securityDAO.findUser("adminuser"));
        doc5.setContents(contents);
        SimpleEntity entity = new SimpleEntity("john");
        entity.setPhotos(md.addDocument(doc).addDocument(doc3).addDocument(doc4).addDocument(doc5));
        baseDao.create(entity);
        assertNotNull(baseDao.first(SimpleEntity.class));
        assertNotNull(baseDao.first(MultiDocument.class));
View Full Code Here

Examples of org.internna.iwebmvc.model.core.Document

    public void setAsText() throws Exception {
        DES3CiphererDecipherer crypto = new DES3CiphererDecipherer();
        crypto.init();
        DocumentBinder binder = new DocumentBinder(crypto);
        binder.setAsText("mimeType=image/gif\nsizeInBytes=200\nuri=" + crypto.encrypt("/xx/yy.gif") + "\ncreated=2008-03-18\nidentifier=coverdata\n");
        Document doc = (Document) binder.getValue();
        assertEquals("coverdata", doc.getIdentifier());
        assertTrue(200 == doc.getSizeInBytes());
        Calendar c = Calendar.getInstance();
        assertTrue(doc.getCreated().compareTo(c.getTime()) < 0);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.