Package com.streamreduce.util

Examples of com.streamreduce.util.AbstractProjectHostingClient


        if (StringUtils.isBlank(id)) {
            return error(ErrorMessages.MISSING_REQUIRED_FIELD, Response.status(Response.Status.BAD_REQUEST));
        }
        ObjectId objectId = new ObjectId(id);

        AbstractProjectHostingClient projectHostingClient = null;

        try {
            Connection connection = connectionService.getConnection(objectId);

            if (!isOwnerOrAdmin(connection.getUser(), connection.getAccount())) {
                return error(ErrorMessages.APPLICATION_ACCESS_DENIED, Response.status(Response.Status.BAD_REQUEST));
            }

            if (connection.getProviderId().equals(ProviderIdConstants.JIRA_PROVIDER_ID)) {
                projectHostingClient = new JiraClient(connection);

                ProjectHostingIssue issue = new ProjectHostingIssue();

                issue.setType(getJSON(json, "type"));
                issue.setProject("project");
                issue.setSummary("summary");
                issue.setDescription("description");

                try {
                    return Response.ok(((JiraClient) projectHostingClient).createIssue(issue)).build();
                } catch (SOAPException e) {
                    return error("Error creating Jira issue using SOAP API for connection [" + connection.getId() +
                            "]: " + e.getMessage(),
                            Response.status(Response.Status.INTERNAL_SERVER_ERROR));
                }
            } else {
                return error("The connection type for the id specified does not support creating external issues.",
                        Response.status(Response.Status.BAD_REQUEST));
            }

        } catch (ConnectionNotFoundException e) {
            return error(e.getMessage(), Response.status(Response.Status.NOT_FOUND));
        } finally {
            if (projectHostingClient != null) {
                projectHostingClient.cleanUp();
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.streamreduce.util.AbstractProjectHostingClient

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.