本文整理汇总了Java中org.eclipse.mylyn.tasks.core.data.TaskAttribute.getMappedAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java TaskAttribute.getMappedAttribute方法的具体用法?Java TaskAttribute.getMappedAttribute怎么用?Java TaskAttribute.getMappedAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.mylyn.tasks.core.data.TaskAttribute
的用法示例。
在下文中一共展示了TaskAttribute.getMappedAttribute方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canReassign
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
boolean canReassign() {
NbTaskDataModel m = getModel();
if (m == null) {
return false;
}
BugzillaConfiguration rc = getRepository().getConfiguration();
final BugzillaVersion installedVersion = rc != null ? rc.getInstalledVersion() : null;
boolean oldRepository = installedVersion != null ? installedVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_3_2) < 0 : false;
if (oldRepository) {
TaskAttribute rta = m.getLocalTaskData().getRoot();
TaskAttribute ta = rta.getMappedAttribute(BugzillaOperation.reassign.getInputId());
return (ta != null);
} else {
return true;
}
}
示例2: updateTaskData
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void updateTaskData(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository) throws CoreException {
data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
TaskAttribute attrModification1 = data.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);
TaskAttribute rta = data.getRoot();
TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.USER_ASSIGNED);
ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
String val = ta.getValue();
ta.setValue(val + " updated");
Set<TaskAttribute> attrs = new HashSet<TaskAttribute>();
attrs.add(ta);
RepositoryResponse rr = brc.getTaskDataHandler().postTaskData(repository, data, attrs, new NullProgressMonitor());
assertEquals(rr.getReposonseKind(), RepositoryResponse.ResponseKind.TASK_UPDATED);
data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
rta = data.getRoot();
ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
assertEquals(val + " updated", ta.getValue());
TaskAttribute attrModification2 = data.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION);
assertNotSame(attrModification1, attrModification2);
}
示例3: closeIssue
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void closeIssue(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository) throws Exception {
//RepositoryConfiguration rc = brc.getClientManager().getClient(repository, nullProgressMonitor).getRepositoryConfiguration();
// refresh
data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
Set<TaskAttribute> attrs = new HashSet<TaskAttribute>();
TaskAttribute rta = data.getRoot();
TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.OPERATION);
ta.setValue("resolve");
attrs.add(ta);
ta = rta.getMappedAttribute(TaskAttribute.STATUS);
ta.setValue("FIXED");
attrs.add(ta);
RepositoryResponse rr = brc.getTaskDataHandler().postTaskData(repository, data, attrs, nullProgressMonitor);
assertEquals(rr.getReposonseKind(), RepositoryResponse.ResponseKind.TASK_UPDATED);
data = brc.getTaskData(repository, rr.getTaskId(), nullProgressMonitor);
rta = data.getRoot();
ta = rta.getMappedAttribute(TaskAttribute.STATUS);
assertEquals("RESOLVED", ta.getValue());
}
示例4: duplicate
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
void duplicate(String id) {
NbTaskDataModel m = getModel();
setOperation(BugzillaOperation.duplicate);
TaskAttribute rta = m.getLocalTaskData().getRoot();
TaskAttribute ta = rta.getMappedAttribute(BugzillaOperation.duplicate.getInputId());
setValue(m, ta, id);
wasDuplicated = true;
}
示例5: reassign
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
void reassign(String user) {
NbTaskDataModel m = getModel();
setOperation(BugzillaOperation.reassign);
TaskAttribute rta = m.getLocalTaskData().getRoot();
TaskAttribute ta = rta.getMappedAttribute(BugzillaOperation.reassign.getInputId());
if(ta != null) {
setValue(m, ta, user);
}
ta = rta.getMappedAttribute(BugzillaAttribute.ASSIGNED_TO.getKey());
if(ta != null) {
setValue(m, ta, user);
}
}
示例6: setOperation
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void setOperation (TaskOperation operation) {
NbTaskDataModel m = getModel();
TaskAttribute rta = m.getLocalTaskData().getRoot();
TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.OPERATION);
m.getLocalTaskData().getAttributeMapper().setTaskOperation(ta, operation);
m.attributeChanged(ta);
}
示例7: getMappedValue
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private String getMappedValue(TaskAttribute a, String key) {
TaskAttribute ma = a.getMappedAttribute(key);
if(ma != null) {
return ma.getValue();
}
return null;
}
示例8: Comment
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
public Comment(TaskAttribute a) {
Date d = null;
String s = "";
try {
s = getMappedValue(a, TaskAttribute.COMMENT_DATE);
if(s != null && !s.trim().equals("")) { // NOI18N
d = CC_DATE_FORMAT.parse(s);
}
} catch (ParseException ex) {
Bugzilla.LOG.log(Level.SEVERE, s, ex);
}
when = d;
TaskAttribute authorAttr = a.getMappedAttribute(TaskAttribute.COMMENT_AUTHOR);
if (authorAttr != null) {
author = authorAttr.getValue();
TaskAttribute nameAttr = authorAttr.getMappedAttribute(TaskAttribute.PERSON_NAME);
authorName = nameAttr != null ? nameAttr.getValue() : null;
} else {
author = authorName = null;
}
String n = getMappedValue(a, TaskAttribute.COMMENT_NUMBER);
number = n != null ? Long.parseLong(n) : null;
text = getMappedValue(a, TaskAttribute.COMMENT_TEXT);
String workedString = getMappedValue(a, BugzillaAttribute.WORK_TIME.getKey());
double dbWorked = 0;
if(workedString == null || workedString.isEmpty()) {
dbWorked = 0.0;
} else {
try {
dbWorked = Double.parseDouble(workedString);
} catch (NumberFormatException e) {
Bugzilla.LOG.log(Level.WARNING, "WORK_TIME time for comment " + number + " is " + workedString , e);
dbWorked = 0;
}
}
worked = dbWorked;
}
示例9: createNewTask
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private NbTask createNewTask (String summary) throws CoreException {
MylynSupport supp = MylynSupport.getInstance();
ITaskMapping mapping = new TaskMapping() {
@Override
public String getProduct () {
return PRODUCT;
}
@Override
public String getComponent () {
return COMPONENT;
}
};
NbTask task = supp.createTask(btr, mapping);
NbTaskDataModel model = task.getTaskDataModel();
// model.getTaskData returns our local data
TaskAttribute rta = model.getLocalTaskData().getRoot();
assertFalse(model.isDirty());
// now edit summary, product and component
String newSummary = summary;
TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
ta.setValue(newSummary);
model.attributeChanged(ta);
// save
model.save(new NullProgressMonitor());
if (task.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
task.setSummary(newSummary);
}
return submitTask(task, model);
}
示例10: createTaskData
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
public static TaskData createTaskData(BugzillaRepositoryConnector brc, TaskRepository repository, String summary, String desc, String typeName) throws MalformedURLException, CoreException {
TaskAttributeMapper attributeMapper = brc.getTaskDataHandler().getAttributeMapper(repository);
TaskData data = new TaskData(attributeMapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
TaskAttribute rta = data.getRoot();
TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.USER_ASSIGNED);
ta = rta.createMappedAttribute(TaskAttribute.SUMMARY);
ta.setValue(summary);
ta = rta.createMappedAttribute(TaskAttribute.DESCRIPTION);
ta.setValue(desc);
BugzillaClient client = brc.getClientManager().getClient(repository, NULL_PROGRESS_MONITOR);
RepositoryConfiguration rc = brc.getRepositoryConfiguration(repository, false, new NullProgressMonitor());
String os = client.getRepositoryConfiguration().getOSs().get(0);
ta = rta.createMappedAttribute(BugzillaAttribute.OP_SYS.getKey());
ta.setValue(os);
ta = rta.createMappedAttribute(BugzillaAttribute.PRODUCT.getKey());
ta.setValue(TEST_PROJECT);
String platform = client.getRepositoryConfiguration().getPlatforms().get(0);
ta = rta.createMappedAttribute(BugzillaAttribute.REP_PLATFORM.getKey());
ta.setValue(platform);
String version = client.getRepositoryConfiguration().getVersions(TEST_PROJECT).get(0);
ta = rta.createMappedAttribute(BugzillaAttribute.VERSION.getKey());
ta.setValue(version);
String component = client.getRepositoryConfiguration().getComponents(TEST_PROJECT).get(0);
ta = rta.createMappedAttribute(BugzillaAttribute.COMPONENT.getKey());
ta.setValue(component);
return data;
}
示例11: markComment
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
/**
* Adds a marker for the given comment, assuming it has a location attached.
*/
private void markComment(
TaskRepository taskRepository, TaskAttribute commentAttr, String taskId) {
IProject project = AppraisePluginUtils.getProjectForRepository(taskRepository);
String filePath = getFilePath(commentAttr);
IResource resource = project;
if (filePath != null) {
resource = project.getFile(filePath);
if (resource == null || !resource.exists()) {
return;
}
}
try {
IMarker marker = resource.createMarker(AppraiseUiPlugin.REVIEW_TASK_MARKER_ID);
marker.setAttribute(IMarker.MESSAGE, getMessage(commentAttr));
marker.setAttribute(IMarker.TRANSIENT, true);
if (filePath != null) {
marker.setAttribute(IMarker.LINE_NUMBER, getLineNumber(commentAttr));
}
marker.setAttribute(IMarker.USER_EDITABLE, false);
TaskAttribute authorAttribute = commentAttr.getMappedAttribute(TaskAttribute.COMMENT_AUTHOR);
if (authorAttribute != null) {
marker.setAttribute(
ReviewMarkerAttributes.REVIEW_AUTHOR_MARKER_ATTRIBUTE, authorAttribute.getValue());
}
marker.setAttribute(
ReviewMarkerAttributes.REVIEW_DATETIME_MARKER_ATTRIBUTE,
commentAttr.getMappedAttribute(TaskAttribute.COMMENT_DATE).getValue());
marker.setAttribute(
ReviewMarkerAttributes.REVIEW_ID_MARKER_ATTRIBUTE, getCommentId(commentAttr));
marker.setAttribute(
ReviewMarkerAttributes.REVIEW_RESOLVED_MARKER_ATTRIBUTE,
getResolvedDisplayText(commentAttr));
marker.setAttribute("TaskId", taskId);
} catch (CoreException e) {
AppraiseUiPlugin.logError("Failed to create marker at " + filePath, e);
}
}
示例12: testSubmitTemporaryTask
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
public void testSubmitTemporaryTask () throws Exception {
MylynSupport supp = MylynSupport.getInstance();
NbTask task = supp.getUnsubmittedTasksContainer(btr).getTasks().iterator().next();
// edit the task
NbTaskDataModel model = task.getTaskDataModel();
// model.getTaskData returns our local data
String defaultSummary = task.getSummary();
TaskAttribute rta = model.getLocalTaskData().getRoot();
assertFalse(model.isDirty());
// now edit summary, product and component
String newSummary = "Task summary testSubmitTemporaryTask";
TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.SUMMARY);
ta.setValue(newSummary);
model.attributeChanged(ta);
// now we have unsaved changes, the task is dirty
assertTrue(model.isDirty());
// not yet saved
assertEquals(defaultSummary, task.getSummary());
// save
model.save(new NullProgressMonitor());
// all saved?
assertFalse(model.isDirty());
// well, not exactly, for new unsubmitted task we need to manually refresh task's attributes
assertEquals(defaultSummary, task.getSummary());
if (task.getSynchronizationState() == SynchronizationState.OUTGOING_NEW) {
task.setSummary(newSummary);
}
assertEquals(newSummary, task.getSummary());
// let's submit finally
NbTask submittedTask = submitTask(task, model);
assertNotSame(task, submittedTask); // they difer, the new task is a persistent, not local one
assertEquals(0, supp.getUnsubmittedTasksContainer(btr).getTasks().size());
assertSame(submittedTask, supp.getTask(btr.getUrl(), submittedTask.getTaskId()));
assertEquals(newSummary, task.getSummary());
model = submittedTask.getTaskDataModel();
assertSame(btr, model.getTaskRepository());
assertSame(submittedTask, model.getTask());
assertFalse(model.isDirty());
assertTrue(model.hasBeenRead());
assertTrue(model.getChangedAttributes().isEmpty());
assertTrue(model.getChangedOldAttributes().isEmpty());
assertEquals(SynchronizationState.SYNCHRONIZED, submittedTask.getSynchronizationState());
}
示例13: changeProduct
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; //导入方法依赖的package包/类
private void changeProduct(TaskData data, BugzillaRepositoryConnector brc, TaskRepository repository) throws CoreException, IOException {
data = brc.getTaskData(repository, data.getTaskId(), nullProgressMonitor);
TaskAttribute rta = data.getRoot();
TaskAttribute ta = rta.getMappedAttribute(TaskAttribute.PRODUCT);
BugzillaClient client = brc.getClientManager().getClient(repository, NULL_PROGRESS_MONITOR);
List<String> products = client.getRepositoryConfiguration().getProducts();
String newProject = TEST_PROJECT2;
assertNotNull(newProject);
ta.setValue(newProject);
String version = client.getRepositoryConfiguration(NULL_PROGRESS_MONITOR).getVersions(newProject).get(0);
ta = rta.getMappedAttribute(BugzillaAttribute.VERSION.getKey());
ta.setValue(version);
String component = client.getRepositoryConfiguration(NULL_PROGRESS_MONITOR).getComponents(newProject).get(0);
ta = rta.getMappedAttribute(BugzillaAttribute.COMPONENT.getKey());
ta.setValue(component);
String milestone = client.getRepositoryConfiguration(NULL_PROGRESS_MONITOR).getTargetMilestones(newProject).get(0);
ta = rta.getMappedAttribute(BugzillaAttribute.TARGET_MILESTONE.getKey());
ta.setValue(milestone);
ta = rta.getMappedAttribute(BugzillaAttribute.SET_DEFAULT_ASSIGNEE.getKey());
if (ta != null) {
ta.setValue("1");
}
ta = rta.getMappedAttribute(BugzillaAttribute.CONFIRM_PRODUCT_CHANGE.getKey());
if (ta == null) {
ta = BugzillaTaskDataHandler.createAttribute(rta, BugzillaAttribute.CONFIRM_PRODUCT_CHANGE);
}
if (ta != null) {
ta.setValue("1");
}
RepositoryResponse rr = brc.getTaskDataHandler().postTaskData(repository, data, null, new NullProgressMonitor());
assertEquals(rr.getReposonseKind(), RepositoryResponse.ResponseKind.TASK_UPDATED);
}