Package org.auraframework.service

Examples of org.auraframework.service.DefinitionService


import com.google.common.collect.Maps;

@Model
public class ReferenceTreeModel {
    public static boolean hasAccess(Definition def) throws QuickFixException {
        DefinitionService definitionService = Aura.getDefinitionService();
        MasterDefRegistry registry = definitionService.getDefRegistry();
        return registry.hasAccess(getReferencingDescriptor(), def) == null;
    }
View Full Code Here


        MasterDefRegistry registry = definitionService.getDefRegistry();
        return registry.hasAccess(getReferencingDescriptor(), def) == null;
    }

    public static void assertAccess(Definition def) throws QuickFixException {
        DefinitionService definitionService = Aura.getDefinitionService();
        MasterDefRegistry registry = definitionService.getDefRegistry();
        registry.assertAccess(getReferencingDescriptor(), def);
    }
View Full Code Here

    }

    private static final <E extends Definition> List<TreeNode> makeTreeNodes(String prefix, Class<E> type)
            throws QuickFixException {
        String sep = prefix.equals("markup") ? ":" : ".";
        DefinitionService definitionService = Aura.getDefinitionService();
        List<TreeNode> ret = Lists.newArrayList();

        Map<String, TreeNode> namespaceTreeNodes = Maps.newHashMap();
        DefDescriptor<E> matcher = definitionService.getDefDescriptor(String.format("%s://*%s*", prefix, sep), type);
        Set<DefDescriptor<E>> descriptors = definitionService.find(matcher);
        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        for (DefDescriptor<E> desc : descriptors) {
            if (desc == null) {
                // Getting null here after commit 2037c31ddc81eae3edaf6ddd5bcfd0009fefe1bd. This causes a NPE and
                // breaks the left nav of the reference tab.
View Full Code Here

        String defaultNamespace = Aura.getConfigAdapter().getDefaultNamespace();
        if (defaultNamespace == null) {
            defaultNamespace = "aura";
        }

        DefinitionService definitionService = Aura.getDefinitionService();
        return definitionService.getDefDescriptor(String.format("%s:application", defaultNamespace),
                ApplicationDef.class);
    }
View Full Code Here

        bf.close();
    }

    public static void loadMetadataForComponents(Map<String, Map<String, Map<String, Map<String, String>>>> components)
            throws QuickFixException {
        DefinitionService definitionService = Aura.getDefinitionService();

        DefDescriptor<ComponentDef> matcher = definitionService.getDefDescriptor("markup://*:*", ComponentDef.class);
        Set<DefDescriptor<ComponentDef>> descriptors = definitionService.find(matcher);
        Map<String, Map<String, Map<String, String>>> component;
        Map<String, Map<String, String>> componentDetails;

        for (DefDescriptor<ComponentDef> descriptor : descriptors) {
            component = new TreeMap<String, Map<String, Map<String, String>>>();
View Full Code Here

        BaseComponent<?, ?> component = context.getCurrentComponent();

        String desc = (String) component.getAttributes().getValue("descriptor");

        DefType defType = DefType.valueOf(((String) component.getAttributes().getValue("defType")).toUpperCase());
        DefinitionService definitionService = Aura.getDefinitionService();
    DefDescriptor<?> descriptor = definitionService.getDefDescriptor(desc, defType.getPrimaryInterface());

        Definition def = descriptor.getDef();
    ReferenceTreeModel.assertAccess(def);
   
        Map<DefType, List<DefModel>> depsMap = Maps.newEnumMap(DefType.class);
View Full Code Here

        BaseComponent<?, ?> component = context.getCurrentComponent();

        String desc = (String) component.getAttributes().getValue("descriptor");

        DefType defType = DefType.valueOf(((String) component.getAttributes().getValue("defType")).toUpperCase());
        DefinitionService definitionService = Aura.getDefinitionService();
        descriptor = definitionService.getDefDescriptor(desc, defType.getPrimaryInterface());
        definition = descriptor.getDef();

        ReferenceTreeModel.assertAccess(definition);

        String type = null;
View Full Code Here

    }

    private <E extends Definition> List<Node> makeNodes(String prefix, Class<E> type) throws QuickFixException {
        // if (!Config.isProduction()) {
        String sep = prefix.equals("markup") ? ":" : ".";
        DefinitionService definitionService = Aura.getDefinitionService();

        List<Node> ret = Lists.newArrayList();

        Map<String, Node> namespaceNodes = Maps.newHashMap();
        DefDescriptor<E> matcher = definitionService.getDefDescriptor(String.format("%s://*%s*", prefix, sep), type);
        Set<DefDescriptor<E>> descriptors = definitionService.find(matcher);
        for (DefDescriptor<E> desc : descriptors) {
            String namespace = desc.getNamespace();
            Node namespaceNode = namespaceNodes.get(desc.getNamespace());
            if (namespaceNode == null) {
                namespaceNode = new Node(namespace);
View Full Code Here

public class ExamplesModel {
    List<Map<String, String>> examples = new ArrayList<Map<String, String>>();
    String message;

    public ExamplesModel() throws Exception {
        DefinitionService definitionService = Aura.getDefinitionService();

        String name = (String)Aura.getContextService().getCurrentContext().getCurrentComponent().getAttributes()
                .getValue("name");

        if (name != null && !name.isEmpty()) {
            Set<DefDescriptor<?>> descriptors = definitionService.find(new DescriptorFilter("markup://" + name, DefType.DOCUMENTATION.name()));
            if (descriptors.size() > 0) {
                for (DefDescriptor<?> descriptor : descriptors) {

                    DefType type = descriptor.getDefType();
                    switch (type) {
View Full Code Here

    @UnAdaptableTest
    public static class NamespaceTestSuite extends TestSuite {
        public NamespaceTestSuite(String namespace) throws Exception {
            super(namespace);
            ContextService contextService = Aura.getContextService();
            DefinitionService definitionService = Aura.getDefinitionService();

            boolean contextStarted = false;
            if (!contextService.isEstablished()) {
                contextStarted = true;
                contextService.startContext(Mode.JSTEST, Format.JSON, Authentication.AUTHENTICATED);
            }

            Map<String, TestSuite> subSuites = new HashMap<>();
            try {
                DescriptorFilter filter = new DescriptorFilter("js://"+namespace, DefType.TESTSUITE.toString());
                Set<DefDescriptor<?>> descriptors = definitionService.find(filter);

                for (DefDescriptor<?> qd  : descriptors) {
                    @SuppressWarnings("unchecked")
                    DefDescriptor<TestSuiteDef> descriptor = (DefDescriptor<TestSuiteDef>)qd;
                    Test test;
View Full Code Here

TOP

Related Classes of org.auraframework.service.DefinitionService

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.