org.eclipse.mylyn.bugzilla.core_3.7.1.v20120425-0100

16:46:17.118 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.bugzilla.core_3.7.1.v20120425-0100.jar
package org.eclipse.mylyn.internal.bugzilla.core;

public class BugzillaOperation
  extends AbstractBugzillaOperation
{
  private static final long serialVersionUID = 5940437048263423786L;
  public static final BugzillaOperation none = new BugzillaOperation(Messages.BugzillaOperation_Leave_as_X_X, "none");
  public static final BugzillaOperation reassign = new BugzillaOperation(Messages.BugzillaOperation_Reassign_to, 
    "reassignInput", "person", "reassign");
  public static final BugzillaOperation accept = new BugzillaOperation(Messages.BugzillaOperation_Accept_to_ASSIGNED, 
    "accept");
  public static final BugzillaOperation resolve = new BugzillaOperation(Messages.BugzillaOperation_Resolve_as, 
    "resolutionInput", "singleSelect", "resolve");
  public static final BugzillaOperation duplicate = new BugzillaOperation(Messages.BugzillaOperation_Duplicate_of, 
    "dup_id", "taskDepenedency", "duplicate");
  public static final BugzillaOperation reopen = new BugzillaOperation(Messages.BugzillaOperation_Reopen_bug, 
    "reopen");
  public static final BugzillaOperation verify = new BugzillaOperation(Messages.BugzillaOperation_Mark_as_VERIFIED, 
    "verify");
  public static final BugzillaOperation close = new BugzillaOperation(Messages.BugzillaOperation_Mark_as_CLOSED, 
    "close");
  public static final BugzillaOperation close_with_resolution = new BugzillaOperation(
    Messages.BugzillaOperation_Mark_as_CLOSED, "resolutionInput", "singleSelect", "close");
  public static final BugzillaOperation markNew = new BugzillaOperation(Messages.BugzillaOperation_Mark_as_NEW, 
    "markNew");
  public static final BugzillaOperation reassignbycomponent = new BugzillaOperation(
    Messages.BugzillaOperation_Reassign_to_default_assignee, "reassignbycomponent");
  public static final BugzillaOperation unconfirmed = new BugzillaOperation(Messages.BugzillaOperation_unconfirmed, 
    "unconfirmed");
  public static final BugzillaOperation confirmed = new BugzillaOperation(Messages.BugzillaOperation_confirmed, 
    "confirmed");
  public static final BugzillaOperation in_progress = new BugzillaOperation(Messages.BugzillaOperation_in_progress, 
    "in_progress");
  public static final BugzillaOperation verify_with_resolution = new BugzillaOperation(
    Messages.BugzillaOperation_verified, "resolutionInput", "singleSelect", "verify");
  public static final BugzillaOperation new_default = new BugzillaOperation(Messages.BugzillaOperation_default, 
    "{Start}");
  private final String value;
  
  BugzillaOperation(String label)
  {
    super(label);
    value = label.replaceAll("Set as ", "");
  }
  
  BugzillaOperation(String label, String inputId, String type, String value)
  {
    super(label, inputId, type);
    this.value = value;
  }
  
  public BugzillaOperation(String label, String value)
  {
    super(label);
    this.value = value;
  }
  
  public String toString()
  {
    return value;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.bugzilla.core.BugzillaOperation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.bugzilla.core;

public enum IBugzillaConstants$BUGZILLA_REPORT_STATUS_4_0
{
  START,  UNCONFIRMED,  CONFIRMED,  IN_PROGRESS,  RESOLVED,  VERIFIED;
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.bugzilla.core;

import java.util.Locale;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class SaxBugzillaQueryContentHandler
  extends DefaultHandler
{
  private StringBuffer characters;
  private final TaskDataCollector collector;
  private final String repositoryUrl;
  private int resultCount;
  private final TaskAttributeMapper mapper;
  private TaskData taskData;
  
  public SaxBugzillaQueryContentHandler(String repositoryUrl, TaskDataCollector collector, TaskAttributeMapper mapper)
  {
    this.repositoryUrl = repositoryUrl;
    this.collector = collector;
    this.mapper = mapper;
  }
  
  public void characters(char[] ch, int start, int length)
    throws SAXException
  {
    characters.append(ch, start, length);
  }
  
  public void startElement(String uri, String localName, String qName, Attributes attributes)
    throws SAXException
  {
    characters = new StringBuffer();
  }
  
  public void endElement(String uri, String localName, String qName)
    throws SAXException
  {
    String parsedText = characters.toString();
    BugzillaAttribute tag = BugzillaAttribute.UNKNOWN;
    try
    {
      String tagName = localName.trim().toUpperCase(Locale.ENGLISH);
      try
      {
        tag = BugzillaAttribute.valueOf(tagName);
      }
      catch (IllegalArgumentException e)
      {
        if (tagName.equals("ASSIGNED_TO_REALNAME")) {
          tag = BugzillaAttribute.ASSIGNED_TO_NAME;
        } else if (tagName.equals("REPORTER_REALNAME")) {
          tag = BugzillaAttribute.REPORTER_NAME;
        } else {
          throw e;
        }
      }
      switch (tag)
      {
      case WHO_NAME: 
        if (((collector instanceof BugzillaTaskDataCollector)) && 
          (parsedText != null) && (parsedText.length() > 0))
        {
          BugzillaTaskDataCollector bCollector = (BugzillaTaskDataCollector)collector;
          bCollector.setQueryTimestamp(parsedText);
        }
        break;
      case THETEXT: 
        taskData = new TaskData(mapper, getConnectorKind(), repositoryUrl, parsedText);
        taskData.setPartial(true);
        break;
      case TOKEN: 
        if (taskData != null) {
          BugzillaTaskDataHandler.createAttribute(taskData, BugzillaAttribute.SHORT_DESC).setValue(parsedText);
        }
        break;
      case TARGET_MILESTONE: 
        if (taskData != null) {
          collector.accept(taskData);
        }
        resultCount += 1;
        break;
      case TYPE: 
      case UNKNOWN: 
      case VERSION: 
      case VOTES: 
      case WHO: 
      default: 
        if (taskData != null) {
          BugzillaTaskDataHandler.createAttribute(taskData, tag).setValue(parsedText);
        }
        break;
      }
    }
    catch (RuntimeException e)
    {
      if ((e instanceof IllegalArgumentException)) {
        return;
      }
      throw e;
    }
  }
  
  protected String getConnectorKind()
  {
    return mapper.getTaskRepository().getConnectorKind();
  }
  
  public int getResultCount()
  {
    return resultCount;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.bugzilla.core.SaxBugzillaQueryContentHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.bugzilla.core;

import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
import org.eclipse.mylyn.tasks.core.data.TaskData;

public class BugzillaUtil
{
  private static boolean getParamValue(TaskRepository taskRepository, String propertyName, boolean trueIfUndefined)
  {
    String useParam = taskRepository.getProperty(propertyName);
    boolean result = (useParam == null) || ((useParam != null) && (useParam.equals("true")));
    
    return result;
  }
  
  public static void addAttributeIfUsed(BugzillaAttribute constant, String propertyName, TaskRepository taskRepository, TaskData existingReport, boolean createWhenNull)
  {
    if (getParamValue(taskRepository, propertyName, createWhenNull)) {
      BugzillaTaskDataHandler.createAttribute(existingReport, constant);
    }
  }
  
  public static void createAttributeWithKindDefaultIfUsed(String parsedText, BugzillaAttribute tag, TaskData repositoryTaskData, String propertyName, boolean defaultWhenNull)
  {
    TaskAttribute attribute = repositoryTaskData.getRoot().getMappedAttribute(tag.getKey());
    if (attribute == null)
    {
      attribute = BugzillaTaskDataHandler.createAttribute(repositoryTaskData, tag);
      attribute.setValue(parsedText);
    }
    else
    {
      attribute.addValue(parsedText);
    }
    if (BugzillaAttribute.QA_CONTACT.equals(tag)) {
      attribute.getMetaData().setKind(null);
    } else if (getParamValue(repositoryTaskData.getAttributeMapper().getTaskRepository(), propertyName, 
      defaultWhenNull)) {
      attribute.getMetaData().setKind("task.common.kind.default");
    } else {
      attribute.getMetaData().setKind(null);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.bugzilla.core.BugzillaUtil
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.bugzilla.core;

import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;

 enum BugzillaTaskDataHandler$TaskDataVersion$12
{
  BugzillaTaskDataHandler$TaskDataVersion$12(float $anonymous0)
  {
    super(paramString, paramInt, $anonymous0, null);
  }
  
  void migrate(TaskRepository repository, TaskData data, BugzillaRepositoryConnector connector)
  {
    TaskAttribute exporter = data.getRoot().getAttribute(BugzillaAttribute.EXPORTER_NAME.getKey());
    if (exporter == null)
    {
      String exporterName = repository.getUserName();
      if ((exporterName != null) && (!exporterName.equals("")))
      {
        exporter = data.getRoot().createAttribute(BugzillaAttribute.EXPORTER_NAME.getKey());
        exporter.setValue(exporterName);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler.TaskDataVersion.12
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.bugzilla.core;

import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

class RepositoryConfigurationFactory$SaxErrorHandler
  implements ErrorHandler
{
  RepositoryConfigurationFactory$SaxErrorHandler(RepositoryConfigurationFactory paramRepositoryConfigurationFactory) {}
  
  public void error(SAXParseException exception)
    throws SAXException
  {
    throw exception;
  }
  
  public void fatalError(SAXParseException exception)
    throws SAXException
  {
    throw exception;
  }
  
  public void warning(SAXParseException exception)
    throws SAXException
  {}
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfigurationFactory.SaxErrorHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.bugzilla.core;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
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.core.runtime.SubProgressMonitor;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
import org.eclipse.mylyn.tasks.core.data.TaskMapper;

public class BugzillaTaskDataHandler
  extends AbstractTaskDataHandler
{
  protected final BugzillaRepositoryConnector connector;
  
  private static abstract enum TaskDataVersion
  {
    VERSION_0(0.0F),  VERSION_1_0(1.0F),  VERSION_2_0(2.0F),  VERSION_3_0(3.0F),  VERSION_4_0(4.0F),  VERSION_4_1(4.1F),  VERSION_4_2(4.2F),  VERSION_4_3(4.3F),  VERSION_4_4(4.4F),  VERSION_4_5(4.5F),  VERSION_4_6(4.6F),  VERSION_4_7(4.7F),  VERSION_CURRENT(4.8F);
    
    private float versionNumber = 0.0F;
    
    private TaskDataVersion(float verNum)
    {
      versionNumber = verNum;
    }
    
    public float getVersionNum()
    {
      return versionNumber;
    }
    
    abstract void migrate(TaskRepository paramTaskRepository, TaskData paramTaskData, BugzillaRepositoryConnector paramBugzillaRepositoryConnector);
    
    public String toString()
    {
      return getVersionNum();
    }
    
    private static void updateAttribute(TaskData data, BugzillaAttribute bugAttribute)
    {
      TaskAttribute attribute = data.getRoot().getMappedAttribute(bugAttribute.getKey());
      if (attribute != null)
      {
        attribute.getMetaData().setType(bugAttribute.getType());
        attribute.getMetaData().setReadOnly(bugAttribute.isReadOnly());
        attribute.getMetaData().setKind(bugAttribute.getKind());
      }
    }
  }
  
  public BugzillaTaskDataHandler(BugzillaRepositoryConnector connector)
  {
    this.connector = connector;
  }
  
  public TaskData getTaskData(TaskRepository repository, String taskId, IProgressMonitor monitor)
    throws CoreException
  {
    Set<String> taskIds = new HashSet();
    taskIds.add(taskId);
    final TaskData[] retrievedData = new TaskData[1];
    TaskDataCollector collector = new TaskDataCollector()
    {
      public void accept(TaskData taskData)
      {
        retrievedData[0] = taskData;
      }
    };
    getMultiTaskData(repository, taskIds, collector, monitor);
    if (retrievedData[0] == null) {
      throw new CoreException(new Status(4, "org.eclipse.mylyn.bugzilla", 
        "Task data could not be retrieved. Please re-synchronize task"));
    }
    return retrievedData[0];
  }
  
  /* Error */
  public void getMultiTaskData(final TaskRepository repository, Set<String> taskIds, TaskDataCollector collector, IProgressMonitor monitor)
    throws CoreException
  {
    // Byte code:
    //   0: aload 4
    //   2: invokestatic 644	org/eclipse/mylyn/commons/net/Policy:monitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   5: astore 4
    //   7: aload 4
    //   9: getstatic 627	org/eclipse/mylyn/internal/bugzilla/core/Messages:BugzillaTaskDataHandler_Receiving_tasks	Ljava/lang/String;
    //   12: aload_2
    //   13: invokeinterface 739 1 0
    //   18: invokeinterface 742 3 0
    //   23: aload_0
    //   24: getfield 620	org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler:connector	Lorg/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector;
    //   27: invokevirtual 664	org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector:getClientManager	()Lorg/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager;
    //   30: aload_1
    //   31: aload 4
    //   33: invokevirtual 655	org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager:getClient	(Lorg/eclipse/mylyn/tasks/core/TaskRepository;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/mylyn/internal/bugzilla/core/BugzillaClient;
    //   36: astore 5
    //   38: iconst_1
    //   39: anewarray 311	org/eclipse/core/runtime/CoreException
    //   42: astore 6
    //   44: iconst_1
    //   45: anewarray 298	java/lang/Boolean
    //   48: astore 7
    //   50: new 329	org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler$1CollectorWrapper
    //   53: dup
    //   54: aload_0
    //   55: aload_3
    //   56: aload 4
    //   58: aload_1
    //   59: aload 7
    //   61: aload 6
    //   63: invokespecial 677	org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler$1CollectorWrapper:<init>	(Lorg/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler;Lorg/eclipse/mylyn/tasks/core/data/TaskDataCollector;Lorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/mylyn/tasks/core/TaskRepository;[Ljava/lang/Boolean;[Lorg/eclipse/core/runtime/CoreException;)V
    //   66: astore 8
    //   68: aload 5
    //   70: aload_2
    //   71: aload 8
    //   73: aload_0
    //   74: aload_1
    //   75: invokevirtual 670	org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler:getAttributeMapper	(Lorg/eclipse/mylyn/tasks/core/TaskRepository;)Lorg/eclipse/mylyn/tasks/core/data/TaskAttributeMapper;
    //   78: aload 4
    //   80: invokevirtual 654	org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient:getTaskData	(Ljava/util/Set;Lorg/eclipse/mylyn/tasks/core/data/TaskDataCollector;Lorg/eclipse/mylyn/tasks/core/data/TaskAttributeMapper;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   83: aload 6
    //   85: iconst_0
    //   86: aaload
    //   87: ifnull +8 -> 95
    //   90: aload 6
    //   92: iconst_0
    //   93: aaload
    //   94: athrow
    //   95: aload 7
    //   97: iconst_0
    //   98: aaload
    //   99: ifnull +71 -> 170
    //   102: new 315	org/eclipse/core/runtime/SubProgressMonitor
    //   105: dup
    //   106: aload 4
    //   108: iconst_1
    //   109: invokespecial 642	org/eclipse/core/runtime/SubProgressMonitor:<init>	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   112: astore 9
    //   114: aload 5
    //   116: aload 9
    //   118: aconst_null
    //   119: invokevirtual 652	org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient:getRepositoryConfiguration	(Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;)Lorg/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration;
    //   122: pop
    //   123: aload 9
    //   125: invokevirtual 641	org/eclipse/core/runtime/SubProgressMonitor:done	()V
    //   128: goto +42 -> 170
    //   131: astore 5
    //   133: new 311	org/eclipse/core/runtime/CoreException
    //   136: dup
    //   137: new 326	org/eclipse/mylyn/internal/bugzilla/core/BugzillaStatus
    //   140: dup
    //   141: iconst_4
    //   142: ldc 4
    //   144: iconst_5
    //   145: aload_1
    //   146: invokevirtual 700	org/eclipse/mylyn/tasks/core/TaskRepository:getRepositoryUrl	()Ljava/lang/String;
    //   149: aload 5
    //   151: invokespecial 668	org/eclipse/mylyn/internal/bugzilla/core/BugzillaStatus:<init>	(ILjava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   154: invokespecial 639	org/eclipse/core/runtime/CoreException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   157: athrow
    //   158: astore 10
    //   160: aload 4
    //   162: invokeinterface 741 1 0
    //   167: aload 10
    //   169: athrow
    //   170: aload 4
    //   172: invokeinterface 741 1 0
    //   177: return
    // Line number table:
    //   Java source line #322	-> byte code offset #0
    //   Java source line #325	-> byte code offset #7
    //   Java source line #326	-> byte code offset #23
    //   Java source line #327	-> byte code offset #38
    //   Java source line #328	-> byte code offset #44
    //   Java source line #365	-> byte code offset #50
    //   Java source line #367	-> byte code offset #68
    //   Java source line #369	-> byte code offset #83
    //   Java source line #370	-> byte code offset #90
    //   Java source line #372	-> byte code offset #95
    //   Java source line #373	-> byte code offset #102
    //   Java source line #374	-> byte code offset #114
    //   Java source line #375	-> byte code offset #123
    //   Java source line #377	-> byte code offset #131
    //   Java source line #378	-> byte code offset #133
    //   Java source line #379	-> byte code offset #144
    //   Java source line #378	-> byte code offset #154
    //   Java source line #380	-> byte code offset #158
    //   Java source line #381	-> byte code offset #160
    //   Java source line #382	-> byte code offset #167
    //   Java source line #381	-> byte code offset #170
    //   Java source line #383	-> byte code offset #177
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	178	0	this	BugzillaTaskDataHandler
    //   0	178	1	repository	TaskRepository
    //   0	178	2	taskIds	Set<String>
    //   0	178	3	collector	TaskDataCollector
    //   0	178	4	monitor	IProgressMonitor
    //   36	79	5	client	BugzillaClient
    //   131	19	5	e	IOException
    //   42	49	6	collectionException	CoreException[]
    //   48	48	7	updateConfig	Boolean[]
    //   66	6	8	collector2	TaskDataCollector
    //   112	12	9	subMonitor	SubProgressMonitor
    //   158	10	10	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   7	128	131	java/io/IOException
    //   7	158	158	finally
  }
  
  public void migrateTaskData(TaskRepository taskRepository, TaskData taskData)
  {
    float bugzillaTaskDataVersion = 0.0F;
    
    String taskDataVersion = taskData.getVersion();
    if (taskDataVersion != null) {
      try
      {
        bugzillaTaskDataVersion = Float.parseFloat(taskDataVersion);
      }
      catch (NumberFormatException localNumberFormatException)
      {
        bugzillaTaskDataVersion = 0.0F;
      }
    }
    TaskDataVersion[] arrayOfTaskDataVersion;
    int j = (arrayOfTaskDataVersion = TaskDataVersion.values()).length;
    for (int i = 0; i < j; i++)
    {
      TaskDataVersion version = arrayOfTaskDataVersion[i];
      if (bugzillaTaskDataVersion <= version.getVersionNum()) {
        version.migrate(taskRepository, taskData, connector);
      }
    }
  }
  
  /* Error */
  public org.eclipse.mylyn.tasks.core.RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> changedAttributes, IProgressMonitor monitor)
    throws CoreException
  {
    // Byte code:
    //   0: aload 4
    //   2: invokestatic 644	org/eclipse/mylyn/commons/net/Policy:monitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   5: astore 4
    //   7: aload 4
    //   9: getstatic 628	org/eclipse/mylyn/internal/bugzilla/core/Messages:BugzillaTaskDataHandler_Submitting_task	Ljava/lang/String;
    //   12: iconst_m1
    //   13: invokeinterface 742 3 0
    //   18: aload_0
    //   19: getfield 620	org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler:connector	Lorg/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector;
    //   22: invokevirtual 664	org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector:getClientManager	()Lorg/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager;
    //   25: aload_1
    //   26: aload 4
    //   28: invokevirtual 655	org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager:getClient	(Lorg/eclipse/mylyn/tasks/core/TaskRepository;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/mylyn/internal/bugzilla/core/BugzillaClient;
    //   31: astore 5
    //   33: aload 5
    //   35: aload_2
    //   36: aload 4
    //   38: invokevirtual 653	org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient:postTaskData	(Lorg/eclipse/mylyn/tasks/core/data/TaskData;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/mylyn/tasks/core/RepositoryResponse;
    //   41: astore 8
    //   43: aload 4
    //   45: invokeinterface 741 1 0
    //   50: aload 8
    //   52: areturn
    //   53: astore 6
    //   55: aload 6
    //   57: athrow
    //   58: astore 5
    //   60: new 311	org/eclipse/core/runtime/CoreException
    //   63: dup
    //   64: new 326	org/eclipse/mylyn/internal/bugzilla/core/BugzillaStatus
    //   67: dup
    //   68: iconst_4
    //   69: ldc 4
    //   71: iconst_5
    //   72: aload_1
    //   73: invokevirtual 700	org/eclipse/mylyn/tasks/core/TaskRepository:getRepositoryUrl	()Ljava/lang/String;
    //   76: aload 5
    //   78: invokespecial 668	org/eclipse/mylyn/internal/bugzilla/core/BugzillaStatus:<init>	(ILjava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   81: invokespecial 639	org/eclipse/core/runtime/CoreException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   84: athrow
    //   85: astore 7
    //   87: aload 4
    //   89: invokeinterface 741 1 0
    //   94: aload 7
    //   96: athrow
    // Line number table:
    //   Java source line #410	-> byte code offset #0
    //   Java source line #412	-> byte code offset #7
    //   Java source line #413	-> byte code offset #18
    //   Java source line #415	-> byte code offset #33
    //   Java source line #423	-> byte code offset #43
    //   Java source line #415	-> byte code offset #50
    //   Java source line #416	-> byte code offset #53
    //   Java source line #417	-> byte code offset #55
    //   Java source line #419	-> byte code offset #58
    //   Java source line #420	-> byte code offset #60
    //   Java source line #421	-> byte code offset #71
    //   Java source line #420	-> byte code offset #81
    //   Java source line #422	-> byte code offset #85
    //   Java source line #423	-> byte code offset #87
    //   Java source line #424	-> byte code offset #94
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	97	0	this	BugzillaTaskDataHandler
    //   0	97	1	repository	TaskRepository
    //   0	97	2	taskData	TaskData
    //   0	97	3	changedAttributes	Set<TaskAttribute>
    //   0	97	4	monitor	IProgressMonitor
    //   31	3	5	client	BugzillaClient
    //   58	19	5	e	IOException
    //   53	3	6	e	CoreException
    //   85	10	7	localObject	Object
    //   41	10	8	localRepositoryResponse	org.eclipse.mylyn.tasks.core.RepositoryResponse
    // Exception table:
    //   from	to	target	type
    //   33	43	53	org/eclipse/core/runtime/CoreException
    //   7	43	58	java/io/IOException
    //   53	58	58	java/io/IOException
    //   7	43	85	finally
    //   53	85	85	finally
  }
  
  public boolean initializeTaskData(TaskRepository repository, TaskData taskData, ITaskMapping initializationData, IProgressMonitor monitor)
    throws CoreException
  {
    taskData.setVersion(TaskDataVersion.VERSION_CURRENT.toString());
    try
    {
      monitor = Policy.monitorFor(monitor);
      
      monitor.beginTask("Initialize Task Data", -1);
      
      RepositoryConfiguration repositoryConfiguration = connector.getRepositoryConfiguration(repository, false, 
        monitor);
      if (repositoryConfiguration == null) {
        throw new CoreException(new BugzillaStatus(4, "org.eclipse.mylyn.bugzilla", 
          3, repository.getRepositoryUrl(), 
          "Retrieving repository configuration failed."));
      }
      if (taskData.isNew())
      {
        String product = null;
        component = null;
        if ((initializationData == null) || (initializationData.getProduct() == null))
        {
          if (repositoryConfiguration.getProducts().size() > 0) {
            product = (String)repositoryConfiguration.getProducts().get(0);
          }
        }
        else {
          product = initializationData.getProduct();
        }
        if (product == null) {}
        do
        {
          do
          {
            return false;
            if ((initializationData != null) && (initializationData.getComponent() != null) && 
              (initializationData.getComponent().length() > 0)) {
              component = initializationData.getComponent();
            }
            if ((component == null) && (repositoryConfiguration.getComponents(product).size() > 0)) {
              component = (String)repositoryConfiguration.getComponents(product).get(0);
            }
            if (component != null) {
              break;
            }
            if (repositoryConfiguration.getProducts().size() > 0) {
              product = (String)repositoryConfiguration.getProducts().get(0);
            }
          } while ((product == null) || 
          
            (repositoryConfiguration.getComponents(product).size() <= 0));
          component = (String)repositoryConfiguration.getComponents(product).get(0);
        } while (component == null);
        initializeNewTaskDataAttributes(repositoryConfiguration, taskData, product, component, monitor);
        if (connector != null) {
          connector.setPlatformDefaultsOrGuess(repository, taskData);
        }
        return true;
      }
      boolean shortLogin = Boolean.parseBoolean(repository.getProperty("bugzilla.shortLoginEnabled"));
      repositoryConfiguration.configureTaskData(taskData, shortLogin, connector);
      Iterator localIterator;
      label485:
      for (String component = taskData.getRoot().getAttributes().values().iterator(); component.hasNext(); localIterator.hasNext())
      {
        TaskAttribute taskAttribute = (TaskAttribute)component.next();
        Map<String, String> opt = taskAttribute.getOptions();
        if ((opt == null) || (opt.isEmpty())) {
          break label485;
        }
        List<String> values = taskAttribute.getValues();
        localIterator = values.iterator(); continue;String value = (String)localIterator.next();
        if (!opt.containsKey(value)) {
          taskAttribute.putOption(value, value);
        }
      }
    }
    finally
    {
      monitor.done();
    }
    monitor.done();
    
    return true;
  }
  
  private boolean initializeNewTaskDataAttributes(RepositoryConfiguration repositoryConfiguration, TaskData taskData, String product, String component, IProgressMonitor monitor)
  {
    TaskAttribute productAttribute = createAttribute(taskData, BugzillaAttribute.PRODUCT);
    productAttribute.setValue(product);
    
    List<String> optionValues = repositoryConfiguration.getProducts();
    Collections.sort(optionValues);
    for (String optionValue : optionValues) {
      productAttribute.putOption(optionValue, optionValue);
    }
    TaskAttribute attributeStatus = createAttribute(taskData, BugzillaAttribute.BUG_STATUS);
    optionValues = repositoryConfiguration.getStatusValues();
    for (String option : optionValues) {
      attributeStatus.putOption(option, option);
    }
    BugzillaVersion bugzillaVersion = repositoryConfiguration.getInstallVersion();
    if (bugzillaVersion == null) {
      bugzillaVersion = BugzillaVersion.MIN_VERSION;
    }
    if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0)
    {
      attributeStatus.setValue(repositoryConfiguration.getStartStatus());
    }
    else if ((repositoryConfiguration.getStatusValues().contains(IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0.IN_PROGRESS.toString())) || 
      (repositoryConfiguration.getStatusValues().contains(
      IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0.CONFIRMED.toString())))
    {
      attributeStatus.setValue(IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0.START.toString());
      repositoryConfiguration.addValidOperations(taskData);
    }
    else
    {
      attributeStatus.setValue(repositoryConfiguration.getStartStatus());
    }
    createAttribute(taskData, BugzillaAttribute.SHORT_DESC);
    
    TaskAttribute attributeVersion = createAttribute(taskData, BugzillaAttribute.VERSION);
    optionValues = repositoryConfiguration.getVersions(productAttribute.getValue());
    Collections.sort(optionValues);
    for (String option : optionValues) {
      attributeVersion.putOption(option, option);
    }
    if (optionValues.size() > 0) {
      attributeVersion.setValue((String)optionValues.get(optionValues.size() - 1));
    }
    TaskAttribute attributeComponent = createAttribute(taskData, BugzillaAttribute.COMPONENT);
    optionValues = repositoryConfiguration.getComponents(productAttribute.getValue());
    Collections.sort(optionValues);
    for (String option : optionValues) {
      attributeComponent.putOption(option, option);
    }
    if (optionValues.size() == 1) {
      attributeComponent.setValue((String)optionValues.get(0));
    }
    if ((component != null) && (optionValues.contains(component))) {
      attributeComponent.setValue(component);
    }
    TaskRepository taskRepository = taskData.getAttributeMapper().getTaskRepository();
    String useParam = taskRepository.getProperty("bugzilla.param.usetargetmilestone");
    if ((useParam != null) && (useParam.equals("true")))
    {
      optionValues = repositoryConfiguration.getTargetMilestones(productAttribute.getValue());
      if (optionValues.size() > 0)
      {
        TaskAttribute attributeTargetMilestone = createAttribute(taskData, BugzillaAttribute.TARGET_MILESTONE);
        for (String option : optionValues) {
          attributeTargetMilestone.putOption(option, option);
        }
        if ((product != null) && (!product.equals("")))
        {
          String defaultMilestone = repositoryConfiguration.getDefaultMilestones(product);
          if (defaultMilestone != null) {
            attributeTargetMilestone.setValue(defaultMilestone);
          } else {
            attributeTargetMilestone.setValue((String)optionValues.get(0));
          }
        }
        else
        {
          attributeTargetMilestone.setValue((String)optionValues.get(0));
        }
      }
    }
    TaskAttribute attributePlatform = createAttribute(taskData, BugzillaAttribute.REP_PLATFORM);
    optionValues = repositoryConfiguration.getPlatforms();
    for (String option : optionValues) {
      attributePlatform.putOption(option, option);
    }
    if (optionValues.size() > 0) {
      attributePlatform.setValue((String)optionValues.get(0));
    }
    TaskAttribute attributeOPSYS = createAttribute(taskData, BugzillaAttribute.OP_SYS);
    optionValues = repositoryConfiguration.getOSs();
    for (String option : optionValues) {
      attributeOPSYS.putOption(option, option);
    }
    if (optionValues.size() > 0) {
      attributeOPSYS.setValue((String)optionValues.get(0));
    }
    TaskAttribute attributePriority = createAttribute(taskData, BugzillaAttribute.PRIORITY);
    optionValues = repositoryConfiguration.getPriorities();
    for (String option : optionValues) {
      attributePriority.putOption(option, option);
    }
    if (optionValues.size() > 0) {
      attributePriority.setValue((String)optionValues.get(optionValues.size() / 2));
    }
    TaskAttribute attributeSeverity = createAttribute(taskData, BugzillaAttribute.BUG_SEVERITY);
    optionValues = repositoryConfiguration.getSeverities();
    for (String option : optionValues) {
      attributeSeverity.putOption(option, option);
    }
    if (optionValues.size() > 0) {
      attributeSeverity.setValue((String)optionValues.get(optionValues.size() / 2));
    }
    TaskAttribute attributeAssignedTo = createAttribute(taskData, BugzillaAttribute.ASSIGNED_TO);
    attributeAssignedTo.setValue("");
    
    useParam = taskRepository.getProperty("bugzilla.param.useqacontact");
    if ((useParam != null) && (useParam.equals("true")))
    {
      TaskAttribute attributeQAContact = createAttribute(taskData, BugzillaAttribute.QA_CONTACT);
      attributeQAContact.setValue("");
    }
    TaskAttribute attributeBugFileLoc = createAttribute(taskData, BugzillaAttribute.BUG_FILE_LOC);
    attributeBugFileLoc.setValue("http://");
    
    createAttribute(taskData, BugzillaAttribute.DEPENDSON);
    createAttribute(taskData, BugzillaAttribute.BLOCKED);
    createAttribute(taskData, BugzillaAttribute.NEWCC);
    createAttribute(taskData, BugzillaAttribute.LONG_DESC);
    
    List<String> keywords = repositoryConfiguration.getKeywords();
    if (keywords.size() > 0) {
      createAttribute(taskData, BugzillaAttribute.KEYWORDS);
    }
    TaskAttribute attrDescription = taskData.getRoot().getMappedAttribute("task.common.description");
    if (attrDescription != null) {
      attrDescription.getMetaData().setReadOnly(false);
    }
    TaskAttribute attrOwner = taskData.getRoot().getMappedAttribute("task.common.user.assigned");
    if (attrOwner != null) {
      attrOwner.getMetaData().setReadOnly(false);
    }
    TaskAttribute attrAddSelfToCc = taskData.getRoot().getMappedAttribute("task.common.addselfcc");
    if (attrAddSelfToCc != null) {
      attrAddSelfToCc.getMetaData().setKind(null);
    }
    List<BugzillaCustomField> customFields = new ArrayList();
    if (repositoryConfiguration != null) {
      customFields = repositoryConfiguration.getCustomFields();
    }
    for (BugzillaCustomField bugzillaCustomField : customFields) {
      if (bugzillaCustomField.isEnterBug())
      {
        List<String> options = bugzillaCustomField.getOptions();
        BugzillaCustomField.FieldType fieldType = bugzillaCustomField.getFieldType();
        if ((options.size() >= 1) || (
          (!fieldType.equals(BugzillaCustomField.FieldType.DropDown)) && (!fieldType.equals(BugzillaCustomField.FieldType.MultipleSelection))))
        {
          TaskAttribute attribute = taskData.getRoot().createAttribute(bugzillaCustomField.getName());
          if (attribute != null)
          {
            attribute.getMetaData().defaults().setLabel(bugzillaCustomField.getDescription());
            attribute.getMetaData().setKind("task.common.kind.default");
            switch (bugzillaCustomField.getFieldType())
            {
            case DropDown: 
              attribute.getMetaData().setType("shortText");
              break;
            case FreeText: 
              attribute.getMetaData().setType("singleSelect");
              break;
            case LargeText: 
              attribute.getMetaData().setType("multiSelect");
              break;
            case MultipleSelection: 
              attribute.getMetaData().setType("longText");
              break;
            case UNKNOWN: 
              attribute.getMetaData().setType("dateTime");
              break;
            default: 
              if (options.size() > 0) {
                attribute.getMetaData().setType("singleSelect");
              } else {
                attribute.getMetaData().setType("shortText");
              }
              break;
            }
            attribute.getMetaData().setReadOnly(false);
            for (String option : options) {
              attribute.putOption(option, option);
            }
            if ((bugzillaCustomField.getFieldType() == BugzillaCustomField.FieldType.DropDown) && 
              (options.size() > 0)) {
              attribute.setValue((String)options.get(0));
            }
          }
        }
      }
    }
    return true;
  }
  
  public boolean canGetMultiTaskData(TaskRepository taskRepository)
  {
    return true;
  }
  
  public boolean canInitializeSubTaskData(TaskRepository taskRepository, ITask task)
  {
    return true;
  }
  
  public boolean initializeSubTaskData(TaskRepository repository, TaskData subTaskData, TaskData parentTaskData, IProgressMonitor monitor)
    throws CoreException
  {
    TaskMapper mapper = new TaskMapper(parentTaskData);
    if (initializeTaskData(repository, subTaskData, mapper, monitor))
    {
      new TaskMapper(subTaskData).merge(mapper);
      subTaskData.getRoot().getMappedAttribute(BugzillaAttribute.DEPENDSON.getKey()).setValue("");
      subTaskData.getRoot().getMappedAttribute("task.common.description").setValue("");
      subTaskData.getRoot().getMappedAttribute("task.common.summary").setValue("");
      TaskAttribute keywords = subTaskData.getRoot().getMappedAttribute("task.common.keywords");
      if (keywords != null) {
        keywords.setValue("");
      }
      subTaskData.getRoot().getAttribute(BugzillaAttribute.BLOCKED.getKey()).setValue(parentTaskData.getTaskId());
      TaskAttribute parentAttributeAssigned = parentTaskData.getRoot().getMappedAttribute(
    
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd