Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 322867 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaUtil.java (-22 / +15 lines)
Lines 16-33 Link Here
16
import org.eclipse.mylyn.tasks.core.data.TaskData;
16
import org.eclipse.mylyn.tasks.core.data.TaskData;
17
17
18
public class BugzillaUtil {
18
public class BugzillaUtil {
19
	public static void addAttributeIfUsed(BugzillaAttribute constant, String propertyName,
19
20
			TaskRepository taskRepository, TaskData existingReport, boolean createWhenNull) {
20
	private static boolean getParamValue(TaskRepository taskRepository, String propertyName, boolean trueIfUndefined) {
21
		boolean result;
21
		String useParam = taskRepository.getProperty(propertyName);
22
		String useParam = taskRepository.getProperty(propertyName);
22
		if (createWhenNull) {
23
		result = trueIfUndefined ? (useParam == null || (useParam != null && useParam.equals("true"))) //$NON-NLS-1$
23
			if (useParam == null || (useParam != null && useParam.equals("true"))) { //$NON-NLS-1$
24
				: (useParam != null && useParam.equals("true")); //$NON-NLS-1$
24
				BugzillaTaskDataHandler.createAttribute(existingReport, constant);
25
		return result;
25
			}
26
	}
26
		} else {
27
			if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
28
				BugzillaTaskDataHandler.createAttribute(existingReport, constant);
29
			}
30
27
28
	public static void addAttributeIfUsed(BugzillaAttribute constant, String propertyName,
29
			TaskRepository taskRepository, TaskData existingReport, boolean createWhenNull) {
30
		if (getParamValue(taskRepository, propertyName, createWhenNull)) {
31
			BugzillaTaskDataHandler.createAttribute(existingReport, constant);
31
		}
32
		}
32
	}
33
	}
33
34
Lines 44-62 Link Here
44
		if (BugzillaAttribute.QA_CONTACT.equals(tag)) {
45
		if (BugzillaAttribute.QA_CONTACT.equals(tag)) {
45
			attribute.getMetaData().setKind(null);
46
			attribute.getMetaData().setKind(null);
46
		} else {
47
		} else {
47
			String useParam = repositoryTaskData.getAttributeMapper().getTaskRepository().getProperty(propertyName);
48
			if (getParamValue(repositoryTaskData.getAttributeMapper().getTaskRepository(), propertyName,
48
			if (defaultWhenNull) {
49
					defaultWhenNull)) {
49
				if (useParam == null || (useParam != null && useParam.equals("true"))) { //$NON-NLS-1$
50
				attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
50
					attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
51
				} else {
52
					attribute.getMetaData().setKind(null);
53
				}
54
			} else {
51
			} else {
55
				if (useParam != null && useParam.equals("true")) { //$NON-NLS-1$
52
				attribute.getMetaData().setKind(null);
56
					attribute.getMetaData().setKind(TaskAttribute.KIND_DEFAULT);
57
				} else {
58
					attribute.getMetaData().setKind(null);
59
				}
60
			}
53
			}
61
		}
54
		}
62
	}
55
	}

Return to bug 322867