Examples of JiraClient


Examples of com.streamreduce.util.JiraClient

             SOBADESGN (levine)
             SOBA (mark)
             UX (me)
         */

        final JiraClient jiraClient = new JiraClient(connection);
        final List<JSONObject> rawJiraProjects = jiraClient.getProjects(false);
        final List<JSONObject> rawPublicJiraProjects = jiraClient.getProjects(true);
        final Map<String, JSONObject> rawJiraProjectsMap = new HashMap<>();

        /* Create a simple set of project keys for all public projects */
        ImmutableSet<String> publicProjectKeys =
                ImmutableSet.copyOf(Iterables.transform(rawPublicJiraProjects,
                        new Function<Object, String>() {
                            /**
                             * {@inheritDoc}
                             */
                            @Override
                            public String apply(Object project) {
                                return ((JSONObject) project).getString("key");
                            }
                        }));

        /* Retrieve the list of projects from Jira and get their details */
        for (JSONObject project : rawJiraProjects) {
            String projectKey = project.getString("key");
            rawJiraProjectsMap.put(projectKey, jiraClient.getProjectDetails(projectKey));
        }

        final List<InventoryItem> cachedJiraProjects = inventoryService.getInventoryItems(connection);

        assertEquals(rawJiraProjects.size(), cachedJiraProjects.size());
View Full Code Here

Examples of com.streamreduce.util.JiraClient

            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");
View Full Code Here

Examples of com.streamreduce.util.JiraClient

        ObjectId connectionId = connection.getId();
        String key = json.getString("key");
        String name = json.getString("name");
        String description = json.getString("description");
        ExternalIntegrationClient rawClient = externalClientCache.getIfPresent(connectionId);
        JiraClient client;

        if (rawClient == null) {
            client = new JiraClient(connection);

            externalClientCache.put(connectionId, client);
        } else {
            client = (JiraClient)rawClient;
        }

        if (description.length() > 256) {
            description = description.substring(0, 255);
        }

        inventoryItem.setAlias(name != null ? name : key);
        inventoryItem.setDescription(description);
        inventoryItem.setExternalId(key);
        inventoryItem.setType(Constants.PROJECT_TYPE);

        // Override default visibility, we default to hidden if the project is not public
        if (!client.isProjectPublic(key)) {
            inventoryItem.setVisibility(SobaObject.Visibility.SELF);
        }

        inventoryItem.addHashtag(inventoryItem.getType());
View Full Code Here

Examples of com.streamreduce.util.JiraClient

        }
    }

    private void pullJiraActivity(Connection connection)
            throws ConnectionNotFoundException, InvalidCredentialsException, IOException {
        JiraClient client = (JiraClient)getClient(connection);
        Map<String, InventoryItem> inventoryItemMap = getInventoryItemMap(connection);
        Date lastActivityPoll = connection.getLastActivityPollDate();
        Date lastActivity = lastActivityPoll;

        try {
            List<Entry> feedEntries = client.getActivity(inventoryItemMap.keySet());
            if (feedEntries == null) {
                return;
            }

            for (Entry entry : feedEntries) {
                // To map project activity in Jira to a Nodeable ProjectHostingInventoryItem, we have
                // to do some magic.  Said magic is below.
                Element activityObject = entry.getFirstChild(new QName("http://activitystrea.ms/spec/1.0/", "object",
                                                                       "activity"));
                String projectKey = client.getProjectKeyOfEntry(activityObject, inventoryItemMap.keySet());

                if (projectKey == null) {
                    // If the projectKey is null here, this means we've gotten activity for a project we're monitoring
                    // but we were unable to map said activity to the project in question.  This is a known issue and
                    // typically only seen in non-hosted Jira environments where people link their Jira project to other
                    // Atlassian products but do not use the same key for the Jira project and the project in the other
                    // Atlassian application.  (SOBA-1193)  Let's go ahead and log it so we do not forget but this is a
                    // known issue and should not become a ZenDesk ticket.
                    logger.error("Project key for Jira activity was unable to be found, possibly related to " +
                                         "SOBA-1193: " + entry.toString().substring(0, 140));

                    // Move on to the next activity entry
                    continue;
                }

                InventoryItem inventoryItem = inventoryItemMap.get(projectKey);

                // This can happen if the activity is from a project, or Jira Studio product, not associated with a
                // project in our inventory system.  (A good example of this is wiki changes.  Each Jira Studio project
                // gets its own wiki but you can create new wiki spaces that are not associated with a Jira Studio
                // project and will end up without an inventory item in our system.)
                if (inventoryItem == null) {
                    logger.error("Project with key of " + projectKey + " did not correspond with an inventory item, " +
                                         "possibley related to SOBA-1193: " + entry.toString().substring(0, 140));

                    // Move on to the next activity entry
                    continue;
                }

                Date pubDate = entry.getPublished();

                // Only create messages newer than the last activity poll date
                if (pubDate.before(lastActivityPoll)) {
                    continue;
                }

                if (pubDate.after(lastActivity)) {
                    lastActivity = pubDate;
                }

                Map<String, Object> activityParts = client.getPartsForActivity(inventoryItem, entry);

                // This can happen for unknown events which we log
                if (activityParts == null) {
                    // We have ran into a Jira activity we do not know how to handle. Log the issue with as much
                    // detail as possible.
View Full Code Here

Examples of com.streamreduce.util.JiraClient

        return SUPPORTED_AUTH_TYPES;
    }

    @Override
    public ExternalIntegrationClient getClient(Connection connection) {
        return new JiraClient(connection);
    }
View Full Code Here

Examples of org.openengsb.connector.userprojects.jira.internal.jira.JiraClient

            public void run() {
                String oldContext = ContextHolder.get().getCurrentContextId();
                ContextHolder.get().setCurrentContextId("userprojects-jira");
                try {
                    LOG.info("Trying to authenticate to the JIRA server on {}", new Object[] { ServerConfig.uri });
                    JiraClient jiraClient = JiraClientFactory.create();
                    synchronizationService.syncFromJiraServerToOpenEngSB(jiraClient);
                } catch (Exception e) {
                    LOG.error("Could not sync from JIRA server to OpenEngSB", e);
                }
                ContextHolder.get().setCurrentContextId(oldContext);
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.