Examples of ResultHandler


Examples of org.apache.ibatis.session.ResultHandler

  public void analyse(Project project, SensorContext context) {
    // Adding one second is a hack for resolving conflicts with concurrent user
    // changes during issue persistence
    final Date now = DateUtils.addSeconds(DateUtils.truncate(new Date(), Calendar.MILLISECOND), 1);

    issueDao.selectNonClosedIssuesByModule(project.getId(), new ResultHandler() {
      @Override
      public void handleResult(ResultContext rc) {
        IssueDto dto = (IssueDto) rc.getResultObject();
        dto.setSelectedAt(now);
        initialOpenIssuesStack.addIssue(dto);
      }
    });

    issueChangeDao.selectChangelogOnNonClosedIssuesByModuleAndType(project.getId(), new ResultHandler() {
      @Override
      public void handleResult(ResultContext rc) {
        IssueChangeDto dto = (IssueChangeDto) rc.getResultObject();
        initialOpenIssuesStack.addChangelog(dto);
      }
View Full Code Here

Examples of org.apache.ibatis.session.ResultHandler

    final List<ResourceSnapshotDto> snapshots = Lists.newArrayList();

    SqlSession session = getMyBatis().openSession();
    try {
      session.getMapper(ResourceSnapshotMapper.class).selectAll(new ResultHandler() {
        public void handleResult(ResultContext context) {
          snapshots.add((ResourceSnapshotDto) context.getResultObject());
        }
      });
    } finally {
View Full Code Here

Examples of org.apache.ibatis.session.ResultHandler

    timer.schedule(progressTask, MassUpdate.ProgressTask.PERIOD_MS, MassUpdate.ProgressTask.PERIOD_MS);

    final DbSession readSession = db.openSession(false);
    final DbSession writeSession = db.openSession(true);
    try {
      readSession.select("org.sonar.core.persistence.migration.v50.Migration50Mapper.selectRootProjects", new ResultHandler() {
        @Override
        public void handleResult(ResultContext context) {
          Component project = (Component) context.getResultObject();
          Map<Long, String> uuidByComponentId = newHashMap();
          migrateEnabledComponents(readSession, writeSession, project, uuidByComponentId);
View Full Code Here

Examples of org.drools.runtime.pipeline.ResultHandler

        implements
        ResultHandlerFactory {
        List list = new ArrayList();

        public ResultHandler newResultHandler() {
            ResultHandler handler = new ResultHandlerImpl();
            list.add( handler );
            return handler;
        }
View Full Code Here

Examples of org.drools.runtime.pipeline.ResultHandler

        implements
        ResultHandlerFactory {
        List list = new ArrayList();

        public ResultHandler newResultHandler() {
            ResultHandler handler = new ResultHandlerImpl();
            list.add( handler );
            return handler;
        }
View Full Code Here

Examples of org.drools.runtime.pipeline.ResultHandler

        implements
        ResultHandlerFactory {
        List list = new ArrayList();

        public ResultHandler newResultHandler() {
            ResultHandler handler = new ResultHandlerImpl();
            list.add( handler );
            return handler;
        }
View Full Code Here

Examples of org.drools.runtime.pipeline.ResultHandler

        implements
        ResultHandlerFactory {
        List list = new ArrayList();

        public ResultHandler newResultHandler() {
            ResultHandler handler = new ResultHandlerImpl();
            list.add( handler );
            return handler;
        }
View Full Code Here

Examples of org.drools.runtime.pipeline.ResultHandler

        implements
        ResultHandlerFactory {
        List list = new ArrayList();

        public ResultHandler newResultHandler() {
            ResultHandler handler = new ResultHandlerImpl();
            list.add( handler );
            return handler;
        }
View Full Code Here

Examples of org.jboss.aesh.cl.result.ResultHandler

        @Override
        @SuppressWarnings("unchecked")
        public int execute(ConsoleOperation output) throws InterruptedException {
            if (output != null && output.getBuffer().trim().length() > 0) {
                ResultHandler resultHandler = null;
                try (CommandContainer commandContainer = getCommand(
                    Parser.findFirstWord(output.getBuffer()),
                    output.getBuffer())) {

                    CommandLine commandLine = commandContainer.getParser()
                        .parse(output.getBuffer());

                    resultHandler = commandContainer.getParser().getCommand().getResultHandler();

                    commandContainer
                        .getParser()
                        .getCommandPopulator()
                        .populateObject(commandContainer.getCommand(),
                            commandLine, invocationProviders, getAeshContext(), true);
                    // validate the command before execute, only call if no
                    // options with overrideRequired is not set
                    if (commandContainer.getParser().getCommand() .getValidator() != null
                        && !commandLine.hasOptionWithOverrideRequired())
                        commandContainer.getParser().getCommand().getValidator()
                            .validate(commandContainer.getCommand());

                    result = commandContainer.getCommand().execute(
                            commandInvocationServices.getCommandInvocationProvider(
                                    commandInvocationProvider).enhanceCommandInvocation(
                                    new AeshCommandInvocation(console,
                                        output.getControlOperator(),
                                         output.getPid(), this)));

                    if(result == CommandResult.SUCCESS && resultHandler != null)
                        resultHandler.onSuccess();
                    else if(resultHandler != null)
                        resultHandler.onFailure(result);
                }
                catch (CommandLineParserException | CommandValidatorException | OptionValidatorException e) {
                    getShell().out().println(e.getMessage());
                    result = CommandResult.FAILURE;
                    if(resultHandler != null)
                        resultHandler.onValidationFailure(result, e);
                }
                catch (CommandNotFoundException cnfe) {
                    getShell().out().println(cnfe.getMessage());
                    result = CommandResult.FAILURE;
                    if(commandNotFoundHandler != null)
                        commandNotFoundHandler.handleCommandNotFound(output.getBuffer(), getShell());
                }
                catch (Exception e) {
                    if(e instanceof InterruptedException)
                        throw (InterruptedException) e;
                    else {
                        LOGGER.log(Level.SEVERE, "Exception when parsing/running: "
                                + output.getBuffer(), e);
                        getShell().out().println(
                                "Exception when parsing/running: "
                                        + output.getBuffer() + ", "
                                        + e.getMessage()
                        );
                        result = CommandResult.FAILURE;
                        if (resultHandler != null)
                            resultHandler.onValidationFailure(result, e);
                    }
                }
            }
            // empty line
            else if (output != null) {
View Full Code Here

Examples of org.jboss.aesh.cl.result.ResultHandler

        @Override
        @SuppressWarnings("unchecked")
        public int execute(ConsoleOperation output) throws InterruptedException {
            if (output != null && output.getBuffer().trim().length() > 0) {
                ResultHandler resultHandler = null;
                AeshLine aeshLine = Parser.findAllWords(output.getBuffer());
                try (CommandContainer commandContainer = getCommand( aeshLine, output.getBuffer())) {
                    CommandContainerResult ccResult =
                            commandContainer.executeCommand(aeshLine, invocationProviders, getAeshContext(),
                            commandInvocationServices.getCommandInvocationProvider(
                                    commandInvocationProvider).enhanceCommandInvocation(
                                    new AeshCommandInvocation(console,
                                        output.getControlOperator(),
                                         output.getPid(), this)));

                    result = ccResult.getCommandResult();
                    resultHandler = ccResult.getResultHandler();

                    if(result == CommandResult.SUCCESS && resultHandler != null)
                        resultHandler.onSuccess();
                    else if(resultHandler != null)
                        resultHandler.onFailure(result);
                }
                catch (CommandLineParserException | CommandValidatorException | OptionValidatorException e) {
                    getShell().out().println(e.getMessage());
                    result = CommandResult.FAILURE;
                    if(resultHandler != null)
                        resultHandler.onValidationFailure(result, e);
                }
                catch (CommandNotFoundException cnfe) {
                    getShell().out().println(cnfe.getMessage());
                    result = CommandResult.FAILURE;
                    if(commandNotFoundHandler != null)
                        commandNotFoundHandler.handleCommandNotFound(output.getBuffer(), getShell());
                }
                catch (Exception e) {
                    if(e instanceof InterruptedException)
                        throw (InterruptedException) e;
                    else {
                        LOGGER.log(Level.SEVERE, "Exception when parsing/running: "
                                + output.getBuffer(), e);
                        getShell().out().println(
                                "Exception when parsing/running: "
                                        + output.getBuffer() + ", "
                                        + e.getMessage()
                        );
                        result = CommandResult.FAILURE;
                        if (resultHandler != null)
                            resultHandler.onValidationFailure(result, e);
                    }
                }
            }
            // empty line
            else if (output != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.