Search in sources :

Example 1 with RelatedContent

use of org.asqatasun.entity.audit.RelatedContent in project Asqatasun by Asqatasun.

the class JSHandlerImpl method initialize.

private void initialize() {
    if (initialized) {
        return;
    }
    XStream xStream = new XStream();
    XStream.setupDefaultSecurity(xStream);
    xStream.allowTypesByWildcard(new String[] { "org.asqatasun.**" });
    for (RelatedContent relatedContent : ssp.getRelatedContentSet()) {
        if (relatedContent instanceof JavascriptContent) {
            if (javaScriptSet == null) {
                javaScriptSet = new HashSet<>();
            }
            javaScriptSet.addAll((Set<JSResource>) xStream.fromXML(((JavascriptContent) relatedContent).getAdaptedContent()));
        }
    }
    initialized = true;
}
Also used : XStream(com.thoughtworks.xstream.XStream) JavascriptContent(org.asqatasun.entity.audit.JavascriptContent) JSResource(org.asqatasun.contentadapter.js.JSResource) RelatedContent(org.asqatasun.entity.audit.RelatedContent)

Example 2 with RelatedContent

use of org.asqatasun.entity.audit.RelatedContent in project Asqatasun by Asqatasun.

the class CrawlerServiceImpl method removeSummerRomance.

/**
     * During the crawl, Webresources and Contents are created. Contents can be
     * of 2 types : SSP or relatedContent. A SSP is linked to a webResource and
     * a relatedContent is linked to a SSP. The relation between a ssp and a
     * relatedContent is not known when fetching. So we need to link all the
     * relatedContent to any SSP to be able to link them to the current audit.
     * At the end of the crawl, after the creation of the relation between a
     * content and an audit, we can "clean" this fake relation.
     *
     * This method were supposed to be called removedFakeRelation but thanks to
     * the scottish guy, this method is now called removerSummerRomance.
     *
     * @param webResource
     * @param audit
     */
private void removeSummerRomance(Audit audit) {
    Set<RelatedContent> relatedContentSet = (Set<RelatedContent>) contentDataService.getRelatedContentFromAudit(audit);
    for (RelatedContent relatedContent : relatedContentSet) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(" deleteContentRelationShip between of " + ((Content) relatedContent).getURI());
            contentDataService.deleteContentRelationShip(((Content) relatedContent).getId());
        }
    }
}
Also used : Content(org.asqatasun.entity.audit.Content) RelatedContent(org.asqatasun.entity.audit.RelatedContent) RelatedContent(org.asqatasun.entity.audit.RelatedContent)

Aggregations

RelatedContent (org.asqatasun.entity.audit.RelatedContent)2 XStream (com.thoughtworks.xstream.XStream)1 JSResource (org.asqatasun.contentadapter.js.JSResource)1 Content (org.asqatasun.entity.audit.Content)1 JavascriptContent (org.asqatasun.entity.audit.JavascriptContent)1