Package com.googlecode.mylyn.core.client

Examples of com.googlecode.mylyn.core.client.IGoogleCodeClient


    }

    private RepositoryResponse insertIssue(TaskRepository repository, TaskData taskData,
            IProgressMonitor monitor) throws CoreException {

        IGoogleCodeClient client = getClient(repository);

        IssuesEntry entry = new IssuesEntry();
        entry.addLabel(new Label(getPriority(taskData)));
        String summary = getStringValue(taskData, GoogleCodeAttribute.SUMMARY);

        String description = getStringValue(taskData, GoogleCodeAttribute.DESCRIPTION_NEW);
        entry.getAuthors().add(client.getCurrentUser());

        String ownerName = getStringValue(taskData, GoogleCodeAttribute.USER_ASSIGNED);
        if (!StringUtils.isEmpty(ownerName)) {
            Owner owner = new Owner();
            owner.setUsername(new Username(ownerName));
            entry.setOwner(owner);
        }

        entry.setContent(new HtmlTextConstruct(description));
        entry.setTitle(new PlainTextConstruct(summary));
        entry.setStatus(new Status("New"));
        entry.setSendEmail(new SendEmail("False"));

        IssuesEntry created = client.createIssue(entry, monitor);
        String issueId = getIssueId(created);

        return new RepositoryResponse(ResponseKind.TASK_CREATED, issueId);
    }
View Full Code Here


    }

    private RepositoryResponse updateIssue(TaskRepository repository, TaskData taskData,
            Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException {

        IGoogleCodeClient client = getClient(repository);
        IssueCommentsEntry entry = new IssueCommentsEntry();
        Updates updates = new Updates();

        String summary = getStringValue(taskData, GoogleCodeAttribute.SUMMARY);
        updates.setSummary(new Summary(summary));

        String issueId = getIssueId(taskData);

        String comment = getNewComment(taskData);

        String currentPriority = getPriority(taskData);
        String oldPriority = getOldPriority(oldAttributes);
        if (!currentPriority.equals(oldPriority)) {
            if (oldPriority != null) {
                updates.addLabel(new Label('-' + oldPriority));
            }
            updates.addLabel(new Label(currentPriority));
        }

        String ownerName = getStringValue(taskData, GoogleCodeAttribute.USER_ASSIGNED);
        String oldOwner = getOldOwner(oldAttributes);
        if (!(ObjectUtils.equals(ownerName, oldOwner) || (StringUtils.isEmpty(ownerName) && StringUtils
                .isEmpty(oldOwner)))) {
            OwnerUpdate ownerUpdate;
            if (!StringUtils.isEmpty(ownerName)) {
                ownerUpdate = new OwnerUpdate(ownerName);
            } else {
                // remove the owner
                // FIXME broken, doesn't work, null doesn't work as well
                ownerUpdate = new OwnerUpdate(StringUtils.EMPTY);
            }
            updates.setOwnerUpdate(ownerUpdate);
        }

        updates.setStatus(new Status(getStringValue(taskData, GoogleCodeAttribute.STATUS)));

        computeBlockedOnDifference(taskData, oldAttributes, updates);

        entry.getAuthors().add(client.getCurrentUser());
        if (!StringUtils.isEmpty(comment)) {
            entry.setContent(new HtmlTextConstruct(comment));
        }
        entry.setSendEmail(new SendEmail("False"));
        entry.setUpdates(updates);
        client.updateIssue(issueId, entry, monitor);
        return new RepositoryResponse(ResponseKind.TASK_UPDATED, issueId);
    }
View Full Code Here

        if (!data.isNew()) {
            TaskAttribute url = getAttribute(data, GoogleCodeAttribute.URL);
            url.setValue(this.connector.getTaskUrl(repository.getUrl(), issueId));
        }

        IGoogleCodeClient client = getClient(repository);
        IssueCommentsFeed comments = client.getAllComments(issueId, monitor);
        if (!data.isNew()) {
            addComments(issueId, data, comments, monitor);
        }

        // Set the completion date, this allows Mylyn mark the issue as
View Full Code Here

    @Override
    public IStatus performQuery(TaskRepository repository, IRepositoryQuery mylynQuery,
            TaskDataCollector collector, ISynchronizationSession session, IProgressMonitor monitor) {

        try {
            IGoogleCodeClient client = getClient(repository);
            IssuesFeed issues;
            if (mylynQuery.getAttributes().isEmpty()) {
                issues = client.getAllIssues(monitor);
            } else {
                IssuesQuery googleQuery = client.createNewIssuesQuery();
                QueryUtils.copyAttributes(mylynQuery, googleQuery);
                googleQuery.setMaxResults(Integer.MAX_VALUE);
                issues = client.getQueryIssues(googleQuery, monitor);
            }
            for (IssuesEntry issue : issues.getEntries()) {
                TaskData data = this.taskDataHandler.updateTaskData(repository, issue, monitor);
                collector.accept(data);
            }
View Full Code Here

TOP

Related Classes of com.googlecode.mylyn.core.client.IGoogleCodeClient

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.