Lines 46-51
Link Here
|
46 |
import org.eclipse.mylyn.internal.jira.core.model.JiraWorkLog; |
46 |
import org.eclipse.mylyn.internal.jira.core.model.JiraWorkLog; |
47 |
import org.eclipse.mylyn.internal.jira.core.model.Priority; |
47 |
import org.eclipse.mylyn.internal.jira.core.model.Priority; |
48 |
import org.eclipse.mylyn.internal.jira.core.model.Project; |
48 |
import org.eclipse.mylyn.internal.jira.core.model.Project; |
|
|
49 |
import org.eclipse.mylyn.internal.jira.core.model.ProjectRole; |
49 |
import org.eclipse.mylyn.internal.jira.core.model.Resolution; |
50 |
import org.eclipse.mylyn.internal.jira.core.model.Resolution; |
50 |
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel; |
51 |
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel; |
51 |
import org.eclipse.mylyn.internal.jira.core.model.Subtask; |
52 |
import org.eclipse.mylyn.internal.jira.core.model.Subtask; |
Lines 270-275
Link Here
|
270 |
} |
271 |
} |
271 |
|
272 |
|
272 |
data.getRoot().createAttribute(WorkLogConverter.ATTRIBUTE_WORKLOG_NEW); |
273 |
data.getRoot().createAttribute(WorkLogConverter.ATTRIBUTE_WORKLOG_NEW); |
|
|
274 |
|
275 |
TaskAttribute projectRoles = createAttribute(data, JiraAttribute.PROJECT_ROLES); |
276 |
projectRoles.putOption(IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL, IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL); |
277 |
for (ProjectRole projectRole : client.getCache().getProjectRoles()) { |
278 |
projectRoles.putOption(projectRole.getName(), projectRole.getName()); |
279 |
} |
280 |
|
273 |
} |
281 |
} |
274 |
|
282 |
|
275 |
public TaskAttribute createAttribute(TaskData data, JiraAttribute key) { |
283 |
public TaskAttribute createAttribute(TaskData data, JiraAttribute key) { |
Lines 439-444
Link Here
|
439 |
removeAttribute(data, JiraAttribute.ENVIRONMENT); |
447 |
removeAttribute(data, JiraAttribute.ENVIRONMENT); |
440 |
} |
448 |
} |
441 |
|
449 |
|
|
|
450 |
addAttributeValue(data, JiraAttribute.PROJECT_ROLES, IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL); |
451 |
|
442 |
addComments(data, jiraIssue, client); |
452 |
addComments(data, jiraIssue, client); |
443 |
addAttachments(data, jiraIssue, client); |
453 |
addAttachments(data, jiraIssue, client); |
444 |
addCustomFields(data, jiraIssue); |
454 |
addCustomFields(data, jiraIssue); |
Lines 584-590
Link Here
|
584 |
|
594 |
|
585 |
if (TaskAttribute.COMMENT_NEW.equals(attribute.getId()) |
595 |
if (TaskAttribute.COMMENT_NEW.equals(attribute.getId()) |
586 |
|| TaskAttribute.RESOLUTION.equals(attribute.getId()) |
596 |
|| TaskAttribute.RESOLUTION.equals(attribute.getId()) |
587 |
|| TaskAttribute.USER_ASSIGNED.equals(attribute.getId())) { |
597 |
|| TaskAttribute.USER_ASSIGNED.equals(attribute.getId()) |
|
|
598 |
|| IJiraConstants.ATTRIBUTE_PROJECT_ROLES.equals(attribute.getId())) { |
588 |
properties.setReadOnly(false); |
599 |
properties.setReadOnly(false); |
589 |
} else { |
600 |
} else { |
590 |
// make attributes read-only if can't find editing options |
601 |
// make attributes read-only if can't find editing options |
Lines 937-948
Link Here
|
937 |
} else { |
948 |
} else { |
938 |
String operationId = getOperationId(taskData); |
949 |
String operationId = getOperationId(taskData); |
939 |
String newComment = getNewComment(taskData); |
950 |
String newComment = getNewComment(taskData); |
|
|
951 |
String commentVisibility = taskData.getRoot().getMappedAttribute( |
952 |
IJiraConstants.ATTRIBUTE_PROJECT_ROLES).getValue(); |
953 |
|
954 |
Comment comment = new Comment(); |
955 |
comment.setComment(newComment); |
956 |
if (commentVisibility != IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL) { |
957 |
comment.setRoleLevel(commentVisibility); |
958 |
} |
959 |
|
940 |
// do normal workflow all the time |
960 |
// do normal workflow all the time |
941 |
if (!JiraRepositoryConnector.isClosed(issue) |
961 |
if (!JiraRepositoryConnector.isClosed(issue) |
942 |
&& taskData.getRoot().getMappedAttribute(IJiraConstants.ATTRIBUTE_READ_ONLY) == null) { |
962 |
&& taskData.getRoot().getMappedAttribute(IJiraConstants.ATTRIBUTE_READ_ONLY) == null) { |
943 |
client.updateIssue(issue, newComment, monitor); |
963 |
// make only one call if the comment has standard visibility option |
|
|
964 |
if (newComment.length() == 0 |
965 |
|| commentVisibility.equals(IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL)) { |
966 |
client.updateIssue(issue, newComment, monitor); |
967 |
} else { |
968 |
client.updateIssue(issue, null, monitor); |
969 |
client.addComentToIssueWithViewable(issue.getKey(), comment, monitor); |
970 |
} |
944 |
} else if (newComment.length() > 0) { |
971 |
} else if (newComment.length() > 0) { |
945 |
client.addCommentToIssue(issue, newComment, monitor); |
972 |
// client.addCommentToIssue(issue, newComment, monitor); |
|
|
973 |
client.addComentToIssueWithViewable(issue.getKey(), comment, monitor); |
946 |
} |
974 |
} |
947 |
|
975 |
|
948 |
postWorkLog(repository, client, taskData, issue, monitor); |
976 |
postWorkLog(repository, client, taskData, issue, monitor); |
Lines 1022-1030
Link Here
|
1022 |
return false; |
1050 |
return false; |
1023 |
} |
1051 |
} |
1024 |
initializeTaskData(data, client, project); |
1052 |
initializeTaskData(data, client, project); |
|
|
1053 |
|
1054 |
// IssueType issueType = getIssueType(initializationData.getTaskKind(), client, project); |
1055 |
// |
1056 |
// if (issueType != null) { |
1057 |
// setIssueType(data, issueType); |
1058 |
// } |
1059 |
|
1025 |
return true; |
1060 |
return true; |
1026 |
} |
1061 |
} |
1027 |
|
1062 |
|
|
|
1063 |
// private IssueType getIssueType(String issueTypeName, JiraClient client, Project project) { |
1064 |
// if (issueTypeName == null) { |
1065 |
// return null; |
1066 |
// } |
1067 |
// |
1068 |
// IssueType[] issueTypes = project.getIssueTypes(); |
1069 |
// |
1070 |
// if (issueTypes == null) { |
1071 |
// issueTypes = client.getCache().getIssueTypes(); |
1072 |
// } |
1073 |
// |
1074 |
// if (issueTypes != null) { |
1075 |
// for (IssueType issueType : project.getIssueTypes()) { |
1076 |
// if (issueTypeName.equals(issueType.getName())) { |
1077 |
// return issueType; |
1078 |
// } |
1079 |
// } |
1080 |
// } |
1081 |
// |
1082 |
// return null; |
1083 |
// } |
1084 |
|
1028 |
private Project getProject(JiraClient client, String product) { |
1085 |
private Project getProject(JiraClient client, String product) { |
1029 |
Project[] projects = client.getCache().getProjects(); |
1086 |
Project[] projects = client.getCache().getProjects(); |
1030 |
for (Project project : projects) { |
1087 |
for (Project project : projects) { |