Search in sources :

Example 1 with JSResource

use of org.asqatasun.contentadapter.js.JSResource in project Asqatasun by Asqatasun.

the class JSHandlerImpl method selectInlineJS.

@Override
public JSHandler selectInlineJS() {
    Collection<JSResource> inlineJsList = new ArrayList<>();
    for (JSResource jsResource : javaScriptSet) {
        RsrcLocator location = jsResource.getRsrcLocator();
        if (location.getRsrcLocatorType() == RsrcLocator.INLINE) {
            inlineJsList.add(jsResource);
        }
    }
    selectedJSList = inlineJsList;
    return this;
}
Also used : RsrcLocator(org.asqatasun.contentadapter.RsrcLocator) JSResource(org.asqatasun.contentadapter.js.JSResource) ArrayList(java.util.ArrayList)

Example 2 with JSResource

use of org.asqatasun.contentadapter.js.JSResource 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 3 with JSResource

use of org.asqatasun.contentadapter.js.JSResource in project Asqatasun by Asqatasun.

the class JSHandlerImpl method selectExternalJS.

@Override
public JSHandler selectExternalJS() {
    Collection<JSResource> externalJsList = new ArrayList<>();
    for (JSResource jsResource : javaScriptSet) {
        RsrcLocator location = jsResource.getRsrcLocator();
        if (location.getRsrcLocatorType() == RsrcLocator.EXTERNAL) {
            externalJsList.add(jsResource);
        }
    }
    selectedJSList = externalJsList;
    return this;
}
Also used : RsrcLocator(org.asqatasun.contentadapter.RsrcLocator) JSResource(org.asqatasun.contentadapter.js.JSResource) ArrayList(java.util.ArrayList)

Example 4 with JSResource

use of org.asqatasun.contentadapter.js.JSResource in project Asqatasun by Asqatasun.

the class JSHandlerImpl method selectLocalJS.

@Override
public JSHandler selectLocalJS() {
    Collection<JSResource> localJsList = new ArrayList<>();
    for (JSResource jsResource : javaScriptSet) {
        RsrcLocator location = jsResource.getRsrcLocator();
        if (location.getRsrcLocatorType() == RsrcLocator.LOCAL) {
            localJsList.add(jsResource);
        }
    }
    selectedJSList = localJsList;
    return this;
}
Also used : RsrcLocator(org.asqatasun.contentadapter.RsrcLocator) JSResource(org.asqatasun.contentadapter.js.JSResource) ArrayList(java.util.ArrayList)

Aggregations

JSResource (org.asqatasun.contentadapter.js.JSResource)4 ArrayList (java.util.ArrayList)3 RsrcLocator (org.asqatasun.contentadapter.RsrcLocator)3 XStream (com.thoughtworks.xstream.XStream)1 JavascriptContent (org.asqatasun.entity.audit.JavascriptContent)1 RelatedContent (org.asqatasun.entity.audit.RelatedContent)1