Package org.apache.stanbol.enhancer.servicesapi

Examples of org.apache.stanbol.enhancer.servicesapi.ContentItem


    @Path("/page/{uri:.+}")
    @Produces(TEXT_HTML)
    public ContentItemResource getContentItemView(@PathParam(value = "uri") String uri) throws IOException,
                                                                                       StoreException {
        ContentItem ci = solrStore.get(uri, indexName);
        if (ci == null) {
            throw new WebApplicationException(404);
        }
        return new ContentItemResource(uri, ci, uriInfo, "/contenthub/" + indexName + "/store/download",
                serializer, servletContext, null);
View Full Code Here


        MGraph additionalMetadata = getAdditionalMetadataFromNode(contentContext);
        if (additionalMetadata.isEmpty()) {
            log.debug("There is no additional metadata for the node having id: {}", id);
        }

        ContentItem ci = null;
        try {
            ci = solrStore.create(contentContext.getContent(), contentItemId, contentContext.getNodeName(),
                contentContext.getContentType());
            ci.addPart(ADDITIONAL_METADATA_URI, additionalMetadata);
            solrStore.enhanceAndPut(ci, indexName, null);
        } catch (StoreException e) {
            log.error(e.getMessage(), e);
        }
        log.info("Document submitted to Contenthub.");
        log.info("Id: {}", ci.getUri().getUnicodeString());
        log.info("Mime type: {}", ci.getMimeType());
    }
View Full Code Here

    //finally log the toString
    log.info("toString: {}",ci);
  }
  @Test(expected=IllegalArgumentException.class)
  public void addPartWithoutUri() throws IOException{
        ContentItem ci = createContentItem(contentSource);
      ci.addPart(null, new Date());
  }
View Full Code Here

        ContentItem ci = createContentItem(contentSource);
      ci.addPart(null, new Date());
  }
    @Test(expected=IllegalArgumentException.class)
    public void addPartWithoutPartContent() throws IOException{
        ContentItem ci = createContentItem(contentSource);
        ci.addPart(new UriRef("http://foo/"), null);
    }
View Full Code Here

     * The ContentItem MUST NOT allow to replace the main content part (the
     * Blob stored at index 0)
     */
    @Test(expected=IllegalArgumentException.class)
    public void replaceMainPart() throws IOException{
        ContentItem ci = createContentItem(contentSource);
        UriRef mainPart = ci.getPartUri(0);
        ci.addPart(mainPart, new Date());
    }
View Full Code Here

        UriRef mainPart = ci.getPartUri(0);
        ci.addPart(mainPart, new Date());
    }
    @Test(expected=IllegalArgumentException.class)
    public void removeNullPart()  throws IOException{
        ContentItem ci = createContentItem(contentSource);
        ci.removePart(null);
    }
View Full Code Here

        ContentItem ci = createContentItem(contentSource);
        ci.removePart(null);
    }
    @Test(expected=IllegalArgumentException.class)
    public void removeNegaitveIndexPart() throws IOException {
        ContentItem ci = createContentItem(contentSource);
        ci.removePart(-1);
    }
View Full Code Here

        ContentItem ci = createContentItem(contentSource);
        ci.removePart(-1);
    }
    @Test(expected=IllegalStateException.class)
    public void removeMainContentPartByUri() throws IOException {
        ContentItem ci = createContentItem(contentSource);
        ci.removePart(ci.getPartUri(0));
    }
View Full Code Here

        ContentItem ci = createContentItem(contentSource);
        ci.removePart(ci.getPartUri(0));
    }
    @Test(expected=IllegalStateException.class)
    public void removeMainContentPartByIndex() throws IOException {
        ContentItem ci = createContentItem(contentSource);
        ci.removePart(0);
    }
View Full Code Here

        ContentItem ci = createContentItem(contentSource);
        ci.removePart(0);
    }
    @Test(expected=NoSuchPartException.class)
    public void removeNonExistentPartByUri() throws IOException {
        ContentItem ci = createContentItem(contentSource);
        ci.removePart(new UriRef("urn:does.not.exist:and.can.not.be.removed"));
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.enhancer.servicesapi.ContentItem

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.