Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 176580 Details for
Bug 314744
support defaultmilestone from Product.get XMLRPC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
commited patch
patch314744V1.txt (text/plain), 15.01 KB, created by
Frank Becker
on 2010-08-13 15:33:45 EDT
(
hide
)
Description:
commited patch
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2010-08-13 15:33:45 EDT
Size:
15.01 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java,v >retrieving revision 1.251 >diff -u -r1.251 BugzillaClient.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 12 Aug 2010 19:03:19 -0000 1.251 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java 13 Aug 2010 19:26:01 -0000 >@@ -71,6 +71,7 @@ > import org.eclipse.mylyn.commons.net.HtmlStreamTokenizer.Token; > import org.eclipse.mylyn.commons.net.HtmlTag; > import org.eclipse.mylyn.commons.net.Policy; >+import org.eclipse.mylyn.commons.net.WebLocation; > import org.eclipse.mylyn.commons.net.WebUtil; > import org.eclipse.mylyn.internal.bugzilla.core.history.BugzillaTaskHistoryParser; > import org.eclipse.mylyn.internal.bugzilla.core.history.TaskHistory; >@@ -179,7 +180,7 @@ > > private final BugzillaRepositoryConnector connector; > >- private BugzillaXmlRpcClient xmlRpcClient; >+ private BugzillaXmlRpcClient xmlRpcClient = null; > > public BugzillaClient(AbstractWebLocation location, String characterEncoding, Map<String, String> configParameters, > BugzillaLanguageSettings languageSettings, BugzillaRepositoryConnector connector) >@@ -219,6 +220,14 @@ > WebUtil.releaseConnection(method, monitor); > } > } >+ CustomTransitionManager validTransitions = new CustomTransitionManager(); >+ >+ String transitionsFileName = configParameters.get(IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE); >+ if (!validTransitions.parse(transitionsFileName)) { >+ throw new CoreException(new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN, >+ "Invalide Transition File Content")); //$NON-NLS-1$ >+ } >+ > } > > protected boolean hasAuthenticationCredentials() { >@@ -689,18 +698,20 @@ > } > > if (repositoryConfiguration != null) { >- boolean useXml = Boolean.parseBoolean(configParameters.get(IBugzillaConstants.BUGZILLA_USE_XMLRPC)); >+ boolean useXMLRPC = Boolean.parseBoolean(configParameters.get(IBugzillaConstants.BUGZILLA_USE_XMLRPC)); >+ if (useXMLRPC && xmlRpcClient == null) { >+ WebLocation webLocation = new WebLocation(this.repositoryUrl + "/xmlrpc.cgi"); //$NON-NLS-1$ >+ xmlRpcClient = new BugzillaXmlRpcClient(webLocation); >+ >+ } > if (!repositoryConfiguration.getProducts().isEmpty()) { > repositoryConfiguration.setRepositoryUrl(repositoryUrl.toString()); >- >- repositoryConfiguration.setValidTransitions(monitor, >- configParameters.get(IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE), >- useXml); >+ } >+ xmlRpcClient.updateConfiguration(monitor, repositoryConfiguration, >+ configParameters.get(IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE)); >+ if (!repositoryConfiguration.getProducts().isEmpty()) { > return repositoryConfiguration; > } else { >- repositoryConfiguration.setValidTransitions(monitor, >- configParameters.get(IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE), >- useXml); > if (attempt == 0) { > // empty configuration, retry authenticate > loggedIn = false; >@@ -711,7 +722,6 @@ > "No products found in repository configuration. Ensure credentials are valid.")); //$NON-NLS-1$ > } > } >- > } > } > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java,v >retrieving revision 1.104 >diff -u -r1.104 BugzillaTaskDataHandler.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java 26 Jul 2010 15:21:45 -0000 1.104 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java 13 Aug 2010 19:26:01 -0000 >@@ -507,7 +507,14 @@ > for (String option : optionValues) { > attributeTargetMilestone.putOption(option, option); > } >- attributeTargetMilestone.setValue(optionValues.get(0)); >+ if (repositoryConfiguration != null && product != null && !product.equals("")) { //$NON-NLS-1$ >+ String defaultMilestone = repositoryConfiguration.getDefaultMilestones(product); >+ if (defaultMilestone != null) { >+ attributeTargetMilestone.setValue(defaultMilestone); >+ } >+ } else { >+ attributeTargetMilestone.setValue(optionValues.get(0)); >+ } > } > } > TaskAttribute attributePlatform = createAttribute(taskData, BugzillaAttribute.REP_PLATFORM); >Index: src/org/eclipse/mylyn/internal/bugzilla/core/CustomTransitionManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/CustomTransitionManager.java,v >retrieving revision 1.6 >diff -u -r1.6 CustomTransitionManager.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/CustomTransitionManager.java 12 Aug 2010 19:03:19 -0000 1.6 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/CustomTransitionManager.java 13 Aug 2010 19:26:01 -0000 >@@ -55,24 +55,18 @@ > > private boolean valid = false; > >- private boolean fromFile = false; >- > private String filePath; > > private String duplicateStatus; > > private String startStatus; > >- private boolean usedXml; >- > public CustomTransitionManager() { > operationMapByCurrentStatus = new HashMap<String, List<AbstractBugzillaOperation>>(); > operationMapByEndStatus = new HashMap<String, List<AbstractBugzillaOperation>>(); > closedStatuses = new ArrayList<String>(); > this.valid = false; > this.filePath = ""; //$NON-NLS-1$ >- this.fromFile = false; >- this.usedXml = false; > duplicateStatus = DEFAULT_DUPLICATE_STATUS; > startStatus = DEFAULT_START_STATUS; > } >@@ -93,7 +87,6 @@ > //Do nothing, already parsed this file > return false; > } >- fromFile = true; > this.filePath = filePath; > setValid(true); > >@@ -320,10 +313,6 @@ > } > > public void parse(IProgressMonitor monitor, BugzillaXmlRpcClient xmlClient) { >-// if (usedXml) { >-// //XMLRPC should not change, don't look it up again >-// return; >-// } > this.filePath = ""; //$NON-NLS-1$ > operationMapByCurrentStatus.clear(); > operationMapByEndStatus.clear(); >@@ -366,8 +355,6 @@ > } > > setValid(true); >- usedXml = true; >- fromFile = false; > } catch (XmlRpcException e) { > setValid(false); > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java,v >retrieving revision 1.60 >diff -u -r1.60 RepositoryConfiguration.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java 12 Aug 2010 19:03:18 -0000 1.60 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java 13 Aug 2010 19:26:01 -0000 >@@ -22,7 +22,6 @@ > import java.util.Map; > > import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.mylyn.commons.net.WebLocation; > import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_REPORT_STATUS; > import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >@@ -271,6 +270,8 @@ > > List<String> milestones = new ArrayList<String>(); > >+ String defaultMilestone = null; >+ > ProductEntry(String name) { > this.productName = name; > } >@@ -302,6 +303,14 @@ > void addTargetMilestone(String target) { > milestones.add(target); > } >+ >+ public String getDefaultMilestone() { >+ return defaultMilestone; >+ } >+ >+ public void setDefaultMilestone(String defaultMilestone) { >+ this.defaultMilestone = defaultMilestone; >+ } > } > > public List<String> getOpenStatusValues() { >@@ -346,7 +355,7 @@ > * > * @param fileName > */ >- public void setValidTransitions(IProgressMonitor monitor, String fileName, boolean useXmlRpc) { >+ public void setValidTransitions(IProgressMonitor monitor, String fileName, BugzillaXmlRpcClient xmlClient) { > //Custom transitions only possible for newer versions of Bugzilla > if (getInstallVersion() != null && getInstallVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_3_2) < 0) { > return; >@@ -354,12 +363,10 @@ > if (validTransitions == null) { > validTransitions = new CustomTransitionManager(); > } >- if (!validTransitions.parse(fileName) && useXmlRpc) { >+ if (!validTransitions.parse(fileName) && xmlClient != null) { > if (getRepositoryUrl().equals("<unknown>")) { //$NON-NLS-1$ > return; //This occurs during testing > } >- WebLocation webLocation = new WebLocation(getRepositoryUrl() + "/xmlrpc.cgi"); //$NON-NLS-1$ >- BugzillaXmlRpcClient xmlClient = new BugzillaXmlRpcClient(webLocation); > validTransitions.parse(monitor, xmlClient); > } > } >@@ -934,4 +941,23 @@ > public String getStartStatus() { > return (validTransitions == null) ? "NEW" : validTransitions.getStartStatus(); //$NON-NLS-1$ > } >+ >+ public String getDefaultMilestones(String product) { >+ ProductEntry entry = products.get(product); >+ if (entry != null) { >+ return entry.getDefaultMilestone(); >+ } else { >+ return null; >+ } >+ } >+ >+ public void setDefaultMilestone(String product, String defaultMilestone) { >+ ProductEntry entry = products.get(product); >+ if (entry == null) { >+ entry = new ProductEntry(product); >+ products.put(product, entry); >+ } >+ entry.setDefaultMilestone(defaultMilestone); >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/bugzilla/core/service/BugzillaXmlRpcClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/service/BugzillaXmlRpcClient.java,v >retrieving revision 1.4 >diff -u -r1.4 BugzillaXmlRpcClient.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/service/BugzillaXmlRpcClient.java 12 Aug 2010 19:03:19 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/service/BugzillaXmlRpcClient.java 13 Aug 2010 19:26:01 -0000 >@@ -16,10 +16,15 @@ > > import org.apache.commons.httpclient.HttpClient; > import org.apache.xmlrpc.XmlRpcException; >+import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.mylyn.commons.net.AbstractWebLocation; > import org.eclipse.mylyn.commons.net.AuthenticationCredentials; > import org.eclipse.mylyn.commons.net.AuthenticationType; >+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; >+import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; > import org.eclipse.mylyn.internal.commons.xmlrpc.CommonXmlRpcClient; > > @SuppressWarnings("restriction") >@@ -284,7 +289,7 @@ > }).execute(); > } > >- public Object[] getProducts(final IProgressMonitor monitor, final Integer[] ids) throws XmlRpcException { >+ public Object[] getProducts(final IProgressMonitor monitor, final Object[] ids) throws XmlRpcException { > return (new BugzillaXmlRpcOperation<Object[]>(this) { > @SuppressWarnings("serial") > @Override >@@ -358,4 +363,40 @@ > return result; > } > >+ public void updateConfiguration(IProgressMonitor monitor, RepositoryConfiguration repositoryConfiguration, >+ String fileName) throws CoreException { >+ repositoryConfiguration.setValidTransitions(monitor, fileName, this); >+ if (!repositoryConfiguration.getProducts().isEmpty()) { >+ updateProductInfo(monitor, repositoryConfiguration); >+ } >+ } >+ >+ public void updateProductInfo(IProgressMonitor monitor, RepositoryConfiguration repositoryConfiguration) >+ throws CoreException { >+ try { >+ Object[] productIDs = getAccessibleProducts(monitor); >+ Object[] products = getProducts(monitor, productIDs); >+ for (Object object : products) { >+ if (object instanceof HashMap<?, ?>) { >+ String defaultMilestone = null; >+ String product = (String) ((HashMap<?, ?>) object).get("name"); //$NON-NLS-1$ >+ HashMap<?, ?> values = (HashMap<?, ?>) ((HashMap<?, ?>) object).get("internals"); //$NON-NLS-1$ >+ if (values == null) { >+ continue; >+ } >+ if (values instanceof HashMap<?, ?>) { >+ defaultMilestone = (String) ((HashMap<?, ?>) values).get("defaultmilestone"); //$NON-NLS-1$ >+ } >+ if (product != null && !product.equals("") //$NON-NLS-1$ >+ && defaultMilestone != null && !defaultMilestone.equals("")) { //$NON-NLS-1$ >+ repositoryConfiguration.setDefaultMilestone(product, defaultMilestone); >+ } >+ } >+ } >+ } catch (XmlRpcException e) { >+ throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, >+ "Can not get the Default Milestons using XMLRPC")); //$NON-NLS-1$ >+ } >+ >+ } > } >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java,v >retrieving revision 1.107 >diff -u -r1.107 BugzillaRepositorySettingsPage.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java 12 Aug 2010 19:03:20 -0000 1.107 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java 13 Aug 2010 19:26:03 -0000 >@@ -454,28 +454,7 @@ > repository.setProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING, languageSettingCombo.getText()); > repository.setProperty(IBugzillaConstants.BUGZILLA_USE_XMLRPC, > Boolean.toString(useXMLRPCstatusTransitions.getSelection())); >- if (oldDescriptorFile == null || !descriptorFile.getText().equals(oldDescriptorFile)) { >- repository.setProperty(IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE, descriptorFile.getText()); >- } >- if (repositoryConfiguration != null) { >- try { >- final String descriptorFileName = descriptorFile.getText(); >- final boolean useXMLRPCstatusTransitionsSelection = useXMLRPCstatusTransitions.getSelection(); >- getWizard().getContainer().run(true, false, new IRunnableWithProgress() { >- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >- repositoryConfiguration.setValidTransitions(monitor, descriptorFileName, >- useXMLRPCstatusTransitionsSelection); >- } >- }); >- } catch (InvocationTargetException e1) { >- if (e1.getCause() != null) { >- setErrorMessage(e1.getCause().getMessage()); >- } >- } catch (InterruptedException e1) { >- // ignore >- } >- } >- >+ repository.setProperty(IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE, descriptorFile.getText()); > if (!autodetectPlatformOS.getSelection()) { > repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM, > String.valueOf(defaultPlatformCombo.getItem(defaultPlatformCombo.getSelectionIndex())));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 314744
: 176580 |
176581
|
176836
|
176837
|
179218
|
179219