Package org.apache.slide.projector

Examples of org.apache.slide.projector.Result


        String username = parameter.get(USERNAME).toString();
        String password = parameter.get(PASSWORD).toString();
        Credentials credentials = Projector.getRepository().login(username, password);
        if ( credentials == null ) {
            context.addInformation(new Information(Information.ERROR, new ErrorMessage("login/invalidLogin"), new String[] { USERNAME, PASSWORD }));
            return new Result(LOGIN_FAILED);
        }
        context.setCredentials(credentials);
        return new Result(LOGIN_OK);
    }
View Full Code Here


   
    public Result process(Map parameter, Context context) throws Exception {
        Value input = (Value)parameter.get(INPUT);
        if ( input instanceof NullValue ) {
            return new Result(FALSE);
        }
        return new Result(TRUE);
    }
View Full Code Here

        });

    public Result process(Map parameter, Context context) throws Exception {
        URI user = (URI)parameter.get(USER);
        ArrayValue roles = Projector.getRepository().listRoles(user, context.getCredentials());
        return new Result(StateDescriptor.OK, ROLES, roles);
    }
View Full Code Here

        Store store = context.getStore(StoreHelper.getStoreByName(name));
        if ( store == null ) {
            throw new ProcessException(new ErrorMessage("storeNotAvailable", new String[] {name}));
        }
        store.dispose(key);
        return new Result( StateDescriptor.OK );
    }
View Full Code Here

    public Result process(Map parameter, Context context) throws Exception {
        Locale locale = (((LocaleValue)parameter.get(LOCALE)).getLocale());
        ObjectValue exception = (ObjectValue)parameter.get(EXCEPTION);
        Throwable throwable = (Throwable)exception.getObject();
        Result result = new Result(OK);
        String title = null, text = null, summary = null;
        StringBuffer details = new StringBuffer();
        if ( throwable instanceof ProcessException ) {
            try {
                title = ((ProcessException)throwable).getErrorMessage().getTitle(locale);
                text = ((ProcessException)throwable).getErrorMessage().getText(locale);
                summary = ((ProcessException)throwable).getErrorMessage().getSummary(locale);
            } catch ( MessageNotFoundException e ) {
                title = ((ProcessException)throwable).getErrorMessage().getId();
                text = ((ProcessException)throwable).getErrorMessage().getId();
                summary = ((ProcessException)throwable).getErrorMessage().getId();
            }
            appendNestedDetails(details, throwable, locale);
        } else {
            title = throwable.getLocalizedMessage();
            text = throwable.getLocalizedMessage();
            summary = throwable.getLocalizedMessage();
            appendNestedDetails(details, throwable, locale);
        }
        if ( title == null ) title = "";
        if ( text == null ) text = "";
        if ( summary == null ) summary = "";
        result.addResultEntry(TITLE, new StringValue(title));
        result.addResultEntry(TEXT, new StringValue(text));
        result.addResultEntry(SUMMARY, new StringValue(summary));
        result.addResultEntry(DETAILS, new StringValue(details.toString()));
        result.addResultEntry(CLASS, new StringValue(throwable.getClass().getName()));
        StackTraceElement []trace = throwable.getStackTrace();
        StringBuffer buffer = new StringBuffer(256);
        for ( int i = 0; i < trace.length; i++ ) {
            buffer.append(trace[i].toString());
            buffer.append(" ");
        }
        result.addResultEntry(STACK_TRACE, new StringValue(buffer.toString()));
        return result;
    }
View Full Code Here

    public abstract ResultEntryDescriptor getResultEntryDescriptor();

    public Result process(Map parameter, Context context) throws Exception {
        Value input = (Value)parameter.get(INPUT);
        Value output = process(input, context);
        return new Result(StateDescriptor.OK, OUTPUT, output);
    }
View Full Code Here

    public ErrorNumber() {
        setRequiredFragments(new String[] { FRAGMENT });
    }

    public Result process(Map parameter, Context context) throws Exception {
        return new Result(OK, OUTPUT, renderFragment(FRAGMENT, parameter));
    }
View Full Code Here

        } else if ( state.equals(REQUIRED_VALID_CONTROL) ) {
            fragment = validRequiredFragment;
        } else if ( state.equals(REQUIRED_INVALID_CONTROL) ) {
            fragment = invalidRequiredFragment;
        }
        return new Result(state, OUTPUT, renderFragment(fragment, parameter));
    }
View Full Code Here

          buffer.append(SEPARATOR).append(involvedParameters[i]);
        }
      }
    String instruction = buffer.toString();
    parameter.put(INSTRUCTION, new StringValue(instruction));
        return new Result(OK, OUTPUT, renderFragment(getName(), parameter));
    }
View Full Code Here

        parameter.put(TRIGGER_DESCRIPTIONS, new ArrayValue(new Value[] { triggerDescriptor }));
        parameter.put(ERRORS_PROCESSOR, DEFAULT_ERROR_RENDERER);
       
        parameter.put(HANDLER, ProcessorManager.getInstance().process(ProcessorManager.URL, Constants.DEFAULT_FORM_HANDLER, context));
        parameter.put(METHOD, new StringValue(POST));
        Result controlComposerResult = super.process(parameter, context);
        StringBuffer controlBuffer = new StringBuffer();
        Value []generatedControls = ((ArrayValue)controlComposerResult.getResultEntries().get(ControlComposer.GENERATED_CONTROLS)).getArray();
        for ( int i = 0; i < generatedControls.length; i++ ) {
          Iterator j = ((MapValue)generatedControls[i]).getMap().values().iterator();
          StringValue renderedControl = (StringValue)j.next();
          buffer.append(renderedControl.toString());
        }
        StringValue composedControls = new StringValue(buffer.toString());
        parameter.put(CONTROLS, composedControls);
        StringBuffer triggerBuffer = new StringBuffer();
        Value []generatedTriggers = ((ArrayValue)controlComposerResult.getResultEntries().get(ControlComposer.GENERATED_TRIGGERS)).getArray();
        for ( int i = 0; i < generatedTriggers.length; i++ ) {
          Iterator j = ((MapValue)generatedTriggers[i]).getMap().values().iterator();
          StringValue renderedTrigger = (StringValue)j.next();
          triggerBuffer.append(renderedTrigger.toString());
        }
        StringValue composedTriggers= new StringValue(triggerBuffer.toString());
        parameter.put(TRIGGERS, composedTriggers);
        ProcessorDescriptor processorDescriptor = ProcessorManager.getInstance().getProcessorDescriptor(actionUri);
        parameter.put(PROCESSOR_NAME, processorDescriptor.getName());
        parameter.put(PROCESSOR_TITLE, ((DefaultMessage)processorDescriptor.getDescription()).getTitle(locale, processorDescriptor.getName()));
        parameter.put(PROCESSOR_TEXT, ((DefaultMessage)processorDescriptor.getDescription()).getText(locale, ""));
        parameter.put(PROCESSOR_LARGE_ICON, ProcessorManager.getInstance().process(ProcessorManager.BINARY, processorDescriptor.getLargeIcon(), "url", context));
        parameter.put(PROCESSOR_SMALL_ICON, ProcessorManager.getInstance().process(ProcessorManager.BINARY, processorDescriptor.getSmallIcon(), "url", context));
        parameter.put(TITLE, processorDescriptor.getName());
        parameter.put(STYLE, ((HttpContext)context).getContextPath() + ORANGE_STYLE);
        parameter.put(ERRORS, controlComposerResult.getResultEntries().get(ControlComposer.RENDERED_ERRORS));
        parameter.put(ERRORS_TITLE, "Fehler:");
        Template template = defaultTemplate;
        String state = controlComposerResult.getState();
        if ( state == VALID_STATE && validTemplate != null ) {
            template = validTemplate;
        } else if ( state == INVALID_STATE && invalidTemplate != null ) {
            template = invalidTemplate;
        }
        return new Result(state, OUTPUT, renderFragment(template, parameter));
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.projector.Result

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.