Examples of Document


Examples of net.sourceforge.ganttproject.document.Document

    public void saveProject(IGanttProject project) {
        if (project.getDocument()==null) {
            saveProjectAs(project);
            return;
        }
        Document document = project.getDocument();
        if (!document.canWrite()) {
            myWorkbenchFacade.showErrorDialog(i18n.getText("msg10"));
            saveProjectAs(project);
            return;
        }
        if (!document.acquireLock()) {
            myWorkbenchFacade.showErrorDialog(i18n.getText("msg14"));
            saveProjectAs(project);
            return;
        }
        try {
View Full Code Here

Examples of net.stinfoservices.pacifiq.server.model.Document

        return dto;
    }

    @Override
    public DocumentDTO findDocument(Long id) throws Exception {
        Document document = documentDAO.find(id);
        DocumentDTO documentDTO = new DocumentDTO(document, DTOPath.DOCUMENT_DOC);
        return documentDTO;
    }
View Full Code Here

Examples of net.yacy.document.Document

                prop.put("viewMode_html", 1);
                prop.put("viewMode_html_url", url.toNormalform(false, true));
            }
        } else if (viewMode.equals("parsed") || viewMode.equals("sentences"|| viewMode.equals("words") || viewMode.equals("links")) {
            // parsing the resource content
            Document document = null;
            try {
                document = Document.mergeDocuments(response.url(), response.getMimeType(), response.parse());
                if (document == null) {
                    prop.put("error", "5");
                    prop.put("error_errorText", "Unknown error");
                    prop.put("viewMode", VIEW_MODE_NO_TEXT);
                    return prop;
                }
            } catch (final Parser.Failure e) {
                prop.put("error", "5");
                prop.putHTML("error_errorText", e.getMessage());
                prop.put("viewMode", VIEW_MODE_NO_TEXT);
                return prop;
            }

            if (viewMode.equals("parsed")) {
                final String content = UTF8.String(document.getTextBytes());
                // content = wikiCode.replaceHTML(content); // added by Marc Nause
                prop.put("viewMode", VIEW_MODE_AS_PARSED_TEXT);
                prop.put("viewMode_title", document.dc_title());
                prop.put("viewMode_creator", document.dc_creator());
                prop.put("viewMode_subject", document.dc_subject(','));
                prop.put("viewMode_description", document.dc_description());
                prop.put("viewMode_publisher", document.dc_publisher());
                prop.put("viewMode_format", document.dc_format());
                prop.put("viewMode_identifier", document.dc_identifier());
                prop.put("viewMode_source", url.toString());
                prop.put("viewMode_lat", document.lat());
                prop.put("viewMode_lon", document.lon());
                prop.put("viewMode_parsedText", markup(wordArray, content).replaceAll("\n", "<br />").replaceAll("\t", "&nbsp;&nbsp;&nbsp;&nbsp;"));

            } else if (viewMode.equals("sentences")) {
                prop.put("viewMode", VIEW_MODE_AS_PARSED_SENTENCES);
                final Collection<StringBuilder> sentences = document.getSentences(pre);

                boolean dark = true;
                int i = 0;
                String sentence;
                if (sentences != null) {

                    // Search word highlighting
                    for (final StringBuilder s: sentences) {
                        sentence = s.toString();
                        if (sentence.trim().length() > 0) {
                            prop.put("viewMode_sentences_" + i + "_nr", i + 1);
                            prop.put("viewMode_sentences_" + i + "_text", markup(wordArray, sentence));
                            prop.put("viewMode_sentences_" + i + "_dark", dark ? "1" : "0");
                            dark = !dark;
                            i++;
                        }
                    }
                }
                prop.put("viewMode_sentences", i);

            } else if (viewMode.equals("words")) {
                prop.put("viewMode", VIEW_MODE_AS_PARSED_WORDS);
                final Collection<StringBuilder> sentences = document.getSentences(pre);

                boolean dark = true;
                int i = 0;
                String sentence, token;
                if (sentences != null) {

                    // Search word highlighting
                    for (final StringBuilder s: sentences) {
                        sentence = s.toString();
                        Enumeration<String> tokens = null;
                        tokens = new WordTokenizer(new ByteArrayInputStream(UTF8.getBytes(sentence)), LibraryProvider.dymLib);
                        while (tokens.hasMoreElements()) {
                            token = tokens.nextElement();
                            if (token.length() > 0) {
                                prop.put("viewMode_words_" + i + "_nr", i + 1);
                                prop.put("viewMode_words_" + i + "_word", token);
                                prop.put("viewMode_words_" + i + "_dark", dark ? "1" : "0");
                                dark = !dark;
                                i++;
                            }
                        }
                    }
                }
                prop.put("viewMode_words", i);

            } else if (viewMode.equals("links")) {
                prop.put("viewMode", VIEW_MODE_AS_LINKLIST);
                boolean dark = true;
                int i = 0;
                i += putMediaInfo(prop, wordArray, i, document.getVideolinks(), "video", (i % 2 == 0));
                i += putMediaInfo(prop, wordArray, i, document.getAudiolinks(), "audio", (i % 2 == 0));
                dark = (i % 2 == 0);

                final Map<MultiProtocolURI, ImageEntry> ts = document.getImages();
                final Iterator<ImageEntry> tsi = ts.values().iterator();
                ImageEntry entry;
                while (tsi.hasNext()) {
                    entry = tsi.next();
                    prop.put("viewMode_links_" + i + "_nr", i);
                    prop.put("viewMode_links_" + i + "_dark", dark ? "1" : "0");
                    prop.put("viewMode_links_" + i + "_type", "image");
                    prop.put("viewMode_links_" + i + "_text", (entry.alt().isEmpty()) ? "&nbsp;" : markup(wordArray, entry.alt()));
                    prop.put("viewMode_links_" + i + "_url", entry.url().toNormalform(false, true));
                    prop.put("viewMode_links_" + i + "_link", markup(wordArray, entry.url().toNormalform(false, true)));
                    if (entry.width() > 0 && entry.height() > 0)
                        prop.put("viewMode_links_" + i + "_attr", entry.width() + "x" + entry.height() + " Pixel");
                    else
                        prop.put("viewMode_links_" + i + "_attr", "unknown");
                    dark = !dark;
                    i++;
                }
                i += putMediaInfo(prop, wordArray, i, document.getApplinks(), "app", (i % 2 == 0));
                i += putMediaInfo(prop, wordArray, i, document.getHyperlinks(), "link", (i % 2 == 0));
                prop.put("viewMode_links", i);

            }
            if (document != null) document.close();
        }
        prop.put("error", "0");
        prop.put("error_url", url.toNormalform(false, true));
        prop.put("error_hash", urlHash);
        prop.put("error_wordCount", wordCount);
View Full Code Here

Examples of nu.validator.saxtree.Document

        try {
            treeBuilder.setFragmentContext(null);
            tokenize(input);
        } finally {
            if (saxTreeBuilder != null) {
                Document document = saxTreeBuilder.getDocument();
                if (document != null) {
                    new TreeParser(contentHandler, lexicalHandler).parse(document);
                }
            }
        }
View Full Code Here

Examples of nu.xom.Document

     * <code>Element</code> and then creates the MusicXML file (as a
     * string) from the internal <code>Document</code>
     * @return the completed MusicXML file as a String
     */
    public String getMusicXMLString()
    {  Document xomDoc = getMusicXMLDoc();
      return xomDoc.toXML();
    }
View Full Code Here

Examples of org.adoptopenjdk.lambda.tutorial.exercise4.Document

     * @see Document#getTitle()
     *
     */
    @Test
    public void getListOfDocumentTitlesUsingReferenceOfInstanceMethodBelongingToAClass() {
        Document expenses = new Document("My Expenses",
                Arrays.asList(new Page("LJC Open Conference ticket: £25"), new Page("Beer stipend: £100")));
        Document toDoList = new Document("My ToDo List",
                Arrays.asList(new Page("Build a todo app"), new Page("Pick up dry cleaning")));
        Document certificates = new Document("My Certificates",
                Arrays.asList(new Page("Oracle Certified Professional"), new Page("Swimming 10m")));

        assertThat(Documents.titlesOf(expenses, toDoList, certificates),
                contains("My Expenses", "My ToDo List", "My Certificates"));
        assertThat(Documents.class, usesMethodReferences("getTitle"));
View Full Code Here

Examples of org.amdatu.search.Document

  private volatile LogService logService;
  private volatile ProductService productService;
 
  @Override
  public void indexProduct(Product product) {
    Document document = index.newDocument();
    document.setField("uri", product.get_id());
    document.setField("content", product.getName());
   
    try {
      index.update(document);
    } catch (SearchException e) {
      logService.log(LogService.LOG_ERROR, "Error indexing product with name '" + product.getName() + "'", e);
View Full Code Here

Examples of org.apache.abdera.model.Document

   * Returns the appropriate media type for the given Abdera base
   */
  public static <T extends Base>String getMimeType(T base) {
    String type = null;
    if (base instanceof Document) {
      Document doc = (Document)base;
      MimeType mt = doc.getContentType();
      type = (mt != null) ? mt.toString() : getMimeType(doc.getRoot());
    } else if (base instanceof Element) {
      Element el = (Element)base;
      if (el.getDocument() != null) {
        MimeType mt = el.getDocument().getContentType();
        type = (mt != null) ? mt.toString() : null;
View Full Code Here

Examples of org.apache.accumulo.examples.wikisearch.sample.Document

    for (String field : unevaluatedFieldList.split(","))
      this.unevaluatedFields.add(field);
  }
 
  public Document createDocument(Key key, Value value) {
    Document doc = new Document();

    eventFields.clear();
    ByteBuffer buf = ByteBuffer.wrap(value.get());
    eventFields.readObjectData(kryo, buf);
   
    // Set the id to the document id which is located in the colf
    String row = key.getRow().toString();
    String colf = key.getColumnFamily().toString();
    int idx = colf.indexOf(NULL_BYTE);
    String type = colf.substring(0, idx);
    String id = colf.substring(idx + 1);
    doc.setId(id);
    for (Entry<String,Collection<FieldValue>> entry : eventFields.asMap().entrySet()) {
      for (FieldValue fv : entry.getValue()) {
        Field val = new Field();
        val.setFieldName(entry.getKey());
        val.setFieldValue(new String(fv.getValue(), Charset.forName("UTF-8")));
        doc.getFields().add(val);
      }
    }
   
    // Add the pointer for the content.
    Field docPointer = new Field();
    docPointer.setFieldName("DOCUMENT");
    docPointer.setFieldValue("DOCUMENT:" + row + "/" + type + "/" + id);
    doc.getFields().add(docPointer);
   
    return doc;
  }
View Full Code Here

Examples of org.apache.camel.component.salesforce.dto.generated.Document

    public void doTestGetBlobField(String suffix) throws Exception {
        // get document with Name "Test Document"
        final HashMap<String, Object> headers = new HashMap<String, Object>();
        headers.put(SalesforceEndpointConfig.SOBJECT_NAME, "Document");
        headers.put(SalesforceEndpointConfig.SOBJECT_EXT_ID_NAME, "Name");
        Document document = template().requestBodyAndHeaders("direct:getSObjectWithId" + suffix, TEST_DOCUMENT_ID,
            headers, Document.class);
        assertNotNull(document);
        LOG.debug("GetWithId: {}", document);

        // get Body field for this document
        InputStream body = template().requestBody("direct:getBlobField" + suffix, document, InputStream.class);
        assertNotNull(body);
        LOG.debug("GetBlobField: {}", body);
        // write body to test file
        final FileChannel fileChannel = new FileOutputStream("target/getBlobField" + suffix + ".txt").getChannel();
        final ReadableByteChannel src = Channels.newChannel(body);
        fileChannel.transferFrom(src, 0, document.getBodyLength());
        fileChannel.close();
        src.close();
    }
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.