Package org.auraframework.system

Examples of org.auraframework.system.AuraContext


*/
@Controller
public class AdminController {
    @AuraEnabled
    public static void clearAllRegistries() {
        AuraContext c = AuraImpl.getContextAdapter().getCurrentContext();
        MasterDefRegistryImpl mdr = (MasterDefRegistryImpl) c.getDefRegistry();
        DefRegistry<?>[] regs = mdr.getAllRegistries();
        for (DefRegistry<?> r : regs) {
            r.clear();
        }
    }
View Full Code Here


    return Aura.getContextService().getCurrentContext()
        .getCurrentComponent().getAttributes().getValue(name);
  }

  public ShowDependenciesModel(final String cmpname) {
    AuraContext context = Aura.getContextService().getCurrentContext();
    DefDescriptor<?> descriptor;
    SortedSet<DefDescriptor<?>> sorted;
    MasterDefRegistry mdr = context.getDefRegistry();
    String uid;

    this.error = true;
    this.items = Lists.newArrayList();
    try {
View Full Code Here

                params.put("aura.token", getTestServletConfig().getCsrfToken());

                if (contextValue != null) {
                    params.put("aura.context", contextValue);
                } else {
                    AuraContext context = Aura.getContextService().getCurrentContext();
                    if (context != null) {
                        StringBuilder sb = new StringBuilder();
                        context.setFrameworkUID(Aura.getConfigAdapter().getAuraFrameworkNonce());
                        Aura.getSerializationService().write(context, null, AuraContext.class, sb, "HTML");
                        params.put("aura.context", sb.toString());
                    } else {
                        params.put("aura.context", getSimpleContext(Format.JSON, false));
                    }
View Full Code Here

@Model
public class OutputDateTimeModel {

    @AuraEnabled
    public String getText() throws QuickFixException {
        AuraContext context = Aura.getContextService().getCurrentContext();
        BaseComponent<?, ?> component = context.getCurrentComponent();

        Calendar cal;
        try {
            Object valueObj = component.getAttributes().getValue("value");
            if (valueObj == null) {
View Full Code Here

@Model
public class OutputDateModel {

    @AuraEnabled
    public String getText() throws QuickFixException {
        AuraContext context = Aura.getContextService().getCurrentContext();
        BaseComponent<?, ?> component = context.getCurrentComponent();

        Date date;
        try {
            Object valueObj = component.getAttributes().getValue("value");
            if (valueObj == null) {
View Full Code Here

     * @param def TODO
     * @throws QuickFixException
     */
    private BaseComponentImpl(DefDescriptor<D> descriptor, BaseComponent<?, ?> attributeValueProvider,
            Map<String, Object> valueProviders, I extender, D def) throws QuickFixException {
        AuraContext context = Aura.getContextService().getCurrentContext();
        DefDescriptor<? extends RootDefinition> desc = null;

        InstanceStack instanceStack = context.getInstanceStack();
        Instance<?> parent = instanceStack.peek();

        this.descriptor = descriptor;
        this.originalDescriptor = descriptor;
        this.path = instanceStack.getPath();
View Full Code Here

            loggingService.stopTimer(LoggingService.TIMER_COMPONENT_CREATION);
        }
    }

    protected void finishInit() throws QuickFixException {
        AuraContext context = Aura.getContextService().getCurrentContext();

        injectComponent();
        createModel();

        context.getInstanceStack().setAttributeName("$");
        createSuper();
        context.getInstanceStack().clearAttributeName("$");

        validateAttributes();

        BaseComponentDef def = getComponentDef();

        def.retrieveLabels();

        DefDescriptor<RendererDef> rendererDesc = def.getRendererDescriptor();
        if ((rendererDesc != null && rendererDesc.getDef().isLocal())) {
            hasLocalDependencies = true;
        }
        context.registerComponent(this);
    }
View Full Code Here

    /**
     * this is only to serialize the general shape and ids, to ensure that we generate the same stuff in the client
     */
    @Override
    public void serialize(Json json) throws IOException {
        AuraContext context = Aura.getContextService().getCurrentContext();
        BaseComponent<?, ?> oldComponent = context.setCurrentComponent(this);

        try {
            BaseComponentDef def = getComponentDef();

            json.writeMapBegin();
            //
            // Be very careful here. descriptor != def.getDescriptor().
            // This is 'case normalizing', as the client is actually case
            // sensitive for descriptors (ugh!).
            //
            json.writeMapEntry("componentDef", def.getDescriptor());
            if (!descriptor.equals(originalDescriptor)) {
                json.writeMapEntry("original", originalDescriptor);
            }
            json.writeMapEntry("creationPath", getPath());

            if ((attributeSet.getValueProvider() == null || hasProvidedAttributes) && !attributeSet.isEmpty()) {
                json.writeMapEntry("attributes", attributeSet);
            }

            if (def.getRendererDescriptor() != null) {
                RendererDef rendererDef = def.getRendererDescriptor().getDef();
                if (rendererDef.isLocal()) {
                    StringWriter sw = new StringWriter();
                    rendererDef.render(this, sw);
                    // Not writing directly to json.appendable because then it wouldn't get escaped.
                    // ideally Json would have a FilterWriter that escapes that we could use here.
                    json.writeMapEntry("rendering", sw.toString());
                }
            }

            if (model != null && model.getDescriptor().getDef().hasMembers()) {
                json.writeMapEntry("model", model);
            }

            json.writeMapEnd();
        } catch (QuickFixException e) {
            throw new AuraRuntimeException(e);
        } finally {
            context.setCurrentComponent(oldComponent);
        }
    }
View Full Code Here

     * instantiates the model
     *
     * @throws QuickFixException
     */
    private void createModel() throws QuickFixException {
        AuraContext context = Aura.getContextService().getCurrentContext();
        context.pushCallingDescriptor(descriptor);
        BaseComponent<?, ?> oldComponent = context.setCurrentComponent(this);
        try {
            ModelDef modelDef = getComponentDef().getModelDef();
            if (modelDef != null) {
                Aura.getDefinitionService().getDefRegistry().assertAccess(descriptor, modelDef);

                model = modelDef.newInstance();
                if (modelDef.hasMembers()) {
                    hasLocalDependencies = true;
                    valueProviders.put(ValueProviderType.MODEL.getPrefix(), model);
                }
            }
        } finally {
            context.setCurrentComponent(oldComponent);
            context.popCallingDescriptor();
        }
    }
View Full Code Here

    /**
     * @return the next id to use, the ordering must match exactly what is generated client side
     */
    private static String getNextGlobalId() {
        AuraContext context = Aura.getContextService().getCurrentContext();
        String num = Aura.getContextService().getCurrentContext().getNum();
        Action action = context.getCurrentAction();
        int id;
        String suffix;
        if (action != null) {
            id = action.getInstanceStack().getNextId();
            suffix = action.getId();
        } else {
            id = context.getNextId();
            suffix = num;
        }

        String globalId = String.valueOf(id);
        if (suffix != null) {
View Full Code Here

TOP

Related Classes of org.auraframework.system.AuraContext

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.