Package org.apache.stanbol.entityhub.servicesapi.site

Examples of org.apache.stanbol.entityhub.servicesapi.site.ReferencedSite


    public Representation get(String id,Set<String> includeFields) {
        if(id == null || id.isEmpty()){
            return null;
        }
        Entity entity;
        ReferencedSite site = getSearchService();
        if(site == null){
            throw new IllegalStateException("ReferencedSite "+siteId+" is currently not available");
        }
        try {
            entity = site.getEntity(id);
        catch (ReferencedSiteException e) {
            throw new IllegalStateException("Exception while getting "+id+
                " from the ReferencedSite "+site.getId(),e);
        }
        return entity == null ? null : entity.getRepresentation();
    }
View Full Code Here


    public Collection<? extends Representation> lookup(String field,
                                           Set<String> includeFields,
                                           List<String> search,
                                           String... languages) throws IllegalStateException {
        //build the query and than return the result
        ReferencedSite site = getSearchService();
        if(site == null){
            throw new IllegalStateException("ReferencedSite "+siteId+" is currently not available");
        }
        FieldQuery query = EntitySearcherUtils.createFieldQuery(site.getQueryFactory(),
            field, includeFields, search, languages);
        QueryResultList<Representation> results;
        try {
            results = site.find(query);
        } catch (ReferencedSiteException e) {
            throw new IllegalStateException("Exception while searchign for "+
                search+'@'+Arrays.toString(languages)+"in the ReferencedSite "+
                site.getId(), e);
        }
        return results.results();
    }
View Full Code Here

        return results.results();
    }

    @Override
    public boolean supportsOfflineMode() {
        ReferencedSite site = getSearchService();
        //Do not throw an exception here if the site is not available. Just return false
        return site == null ? false : site.supportsLocalMode();
    }
View Full Code Here

     */
    protected Entity importEntity(Entity remoteEntity) throws YardException{
        if(remoteEntity == null){
            return null;
        }
        ReferencedSite site = siteManager.getReferencedSite(remoteEntity.getSite());
        if(site == null){
            log.warn("Unable to import Entity {} because the ReferencedSite {} is currently not active -> return null",
                remoteEntity.getId(),remoteEntity.getSite());
            return null;
        }
View Full Code Here

            if(_siteManager == null){
                throw new IllegalStateException("Unable to lookup ReferencedSite '"
                        +siteId+"' because ReferencedSiteManager service is unavailable!");
            }
        }
        ReferencedSite site = _siteManager.getReferencedSite(siteId);
        if (site == null) {
            String message = String.format("ReferencedSite '%s' not acitve!",siteId);
            log.error(message);
            throw new WebApplicationException(
                Response.status(Status.NOT_FOUND).entity(message).build());
View Full Code Here

        }
    }

    @Override
    public void computeEnhancements(ContentItem ci) throws EngineException {
        final ReferencedSite site;
        if(referencedSiteID != null) { //lookup the referenced site
            site = siteManager.getReferencedSite(referencedSiteID);
            //ensure that it is present
            if (site == null) {
                String msg = String.format(
                    "Unable to enhance %s because Referenced Site %s is currently not active!", ci.getUri().getUnicodeString(),
                    referencedSiteID);
                log.warn(msg);
                // TODO: throwing Exceptions is currently deactivated. We need a more clear
                // policy what do to in such situations
                // throw new EngineException(msg);
                return;
            }
            //and that it supports offline mode if required
            if (isOfflineMode() && !site.supportsLocalMode()) {
                log.warn("Unable to enhance ci {} because OfflineMode is not supported by ReferencedSite {}.",
                    ci.getUri().getUnicodeString(), site.getId());
                return;
            }
        } else { // null indicates to use the Entityhub to lookup Entities
            site = null;
        }
View Full Code Here

        placeType = null;
        nameField = null;
    }

    public void computeEnhancements(ContentItem ci) throws EngineException {
        final ReferencedSite site;
        if(referencedSiteID != null) { //lookup the referenced site
            site = siteManager.getReferencedSite(referencedSiteID);
            //ensure that it is present
            if (site == null) {
                String msg = String.format(
                    "Unable to enhance %s because Referenced Site %s is currently not active!",
                    ci.getUri().getUnicodeString(), referencedSiteID);
                log.warn(msg);
                // TODO: throwing Exceptions is currently deactivated. We need a more clear
                // policy what do to in such situations
                // throw new EngineException(msg);
                return;
            }
            //and that it supports offline mode if required
            if (isOfflineMode() && !site.supportsLocalMode()) {
                log.warn("Unable to enhance ci {} because OfflineMode is not supported by ReferencedSite {}.",
                    ci.getUri().getUnicodeString(), site.getId());
                return;
            }
        } else { // null indicates to use the Entityhub to lookup Entities
            site = null;
        }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.servicesapi.site.ReferencedSite

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.