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

onTimeStamp	(Ljava/lang/String;)V
    //   63: goto +14 -> 77
    //   66: astore 4
    //   68: aload_2
    //   69: invokeinterface 822 1 0
    //   74: aload 4
    //   76: athrow
    //   77: aload_2
    //   78: invokeinterface 822 1 0
    //   83: return
    // Line number table:
    //   Java source line #524	-> byte code offset #0
    //   Java source line #525	-> byte code offset #9
    //   Java source line #526	-> byte code offset #27
    //   Java source line #527	-> byte code offset #33
    //   Java source line #528	-> byte code offset #37
    //   Java source line #531	-> byte code offset #66
    //   Java source line #532	-> byte code offset #68
    //   Java source line #533	-> byte code offset #74
    //   Java source line #532	-> byte code offset #77
    //   Java source line #534	-> byte code offset #83
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	84	0	this	TracRepositoryConnector
    //   0	84	1	event	ISynchronizationSession
    //   0	84	2	monitor	IProgressMonitor
    //   32	16	3	date	Date
    //   66	9	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	66	66	finally
  }
  
  private Date getSynchronizationTimestamp(ISynchronizationSession event)
  {
    Date mostRecent = new Date(0L);
    Date mostRecentTimeStamp = TracUtil.parseDate(event.getTaskRepository().getSynchronizationTimeStamp());
    for (ITask task : event.getChangedTasks())
    {
      Date taskModifiedDate = task.getModificationDate();
      if ((taskModifiedDate != null) && (taskModifiedDate.after(mostRecent)))
      {
        mostRecent = taskModifiedDate;
        mostRecentTimeStamp = task.getModificationDate();
      }
    }
    return mostRecentTimeStamp;
  }
  
  public void preSynchronization(ISynchronizationSession session, IProgressMonitor monitor)
    throws CoreException
  {
    monitor = Policy.monitorFor(monitor);
    try
    {
      monitor.beginTask(Messages.TracRepositoryConnector_Getting_changed_tasks, -1);
      if (!session.isFullSynchronization()) {}
      while (session.getTasks().isEmpty()) {
        return;
      }
      TaskRepository repository = session.getTaskRepository();
      if (!hasChangedSince(repository)) {
        return;
      }
      if ((repository.getSynchronizationTimeStamp() == null) || 
        (repository.getSynchronizationTimeStamp().length() == 0))
      {
        for (ITask task : session.getTasks()) {
          session.markStale(task);
        }
        return;
      }
      Date since = new Date(0L);
      try
      {
        since = TracUtil.parseDate(Integer.parseInt(repository.getSynchronizationTimeStamp()));
      }
      catch (NumberFormatException localNumberFormatException) {}
      try
      {
        ITracClient client = getClientManager().getTracClient(repository);
        Set<Integer> ids = client.getChangedTickets(since, monitor);
        if (ids.isEmpty())
        {
          session.setNeedsPerformQueries(false); return;
        }
        Date lastChanged;
        if (ids.size() == 1)
        {
          Integer id = (Integer)ids.iterator().next();
          lastChanged = client.getTicketLastChanged(id, monitor);
          if (since.equals(lastChanged))
          {
            session.setNeedsPerformQueries(false);
            return;
          }
        }
        for (ITask task : session.getTasks())
        {
          Integer id = Integer.valueOf(getTicketId(task.getTaskId()));
          if (ids.contains(id)) {
            session.markStale(task);
          }
        }
      }
      catch (OperationCanceledException e)
      {
        throw e;
      }
      catch (Exception e)
      {
        throw new CoreException(TracCorePlugin.toStatus(e, repository));
      }
    }
    finally
    {
      monitor.done();
    }
  }
  
  public synchronized void setTaskRepositoryLocationFactory(TaskRepositoryLocationFactory taskRepositoryLocationFactory)
  {
    this.taskRepositoryLocationFactory = taskRepositoryLocationFactory;
    if (clientManager != null) {
      clientManager.setTaskRepositoryLocationFactory(taskRepositoryLocationFactory);
    }
  }
  
  public void stop()
  {
    if (clientManager != null) {
      clientManager.writeCache();
    }
  }
  
  public void updateRepositoryConfiguration(TaskRepository repository, IProgressMonitor monitor)
    throws CoreException
  {
    try
    {
      ITracClient client = getClientManager().getTracClient(repository);
      client.updateAttributes(monitor, true);
    }
    catch (Exception localException)
    {
      throw new CoreException(RepositoryStatus.createStatus(repository.getRepositoryUrl(), 2, 
        "org.eclipse.mylyn.trac.core", "Could not update attributes"));
    }
  }
  
  public void updateTaskFromTaskData(TaskRepository taskRepository, ITask task, TaskData taskData)
  {
    TaskMapper mapper = getTaskMapping(taskData);
    mapper.applyTo(task);
    String status = mapper.getStatus();
    if (status != null) {
      if (isCompleted(mapper.getStatus()))
      {
        Date modificationDate = mapper.getModificationDate();
        if (modificationDate == null) {
          modificationDate = DEFAULT_COMPLETION_DATE;
        }
        task.setCompletionDate(modificationDate);
      }
      else
      {
        task.setCompletionDate(null);
      }
    }
    task.setUrl(taskRepository.getRepositoryUrl() + "/ticket/" + taskData.getTaskId());
    if (!taskData.isPartial())
    {
      task.setAttribute("SupportsSubtasks", Boolean.toString(taskDataHandler.supportsSubtasks(taskData)));
      Date date = task.getModificationDate();
      task.setAttribute("UpdateDate", date != null ? TracUtil.toTracTime(date) : null);
    }
  }
  
  public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData)
  {
    TaskMapper mapper = getTaskMapping(taskData);
    if (taskData.isPartial()) {
      return mapper.hasChanges(task);
    }
    Date repositoryDate = mapper.getModificationDate();
    Date localDate = TracUtil.parseDate(task.getAttribute("UpdateDate"));
    if ((repositoryDate != null) && (repositoryDate.equals(localDate))) {
      return false;
    }
    return true;
  }
  
  public Collection<TaskRelation> getTaskRelations(TaskData taskData)
  {
    TaskAttribute attribute = taskData.getRoot().getAttribute("blockedby");
    if (attribute != null)
    {
      List<TaskRelation> result = new ArrayList();
      StringTokenizer t = new StringTokenizer(attribute.getValue(), ", ");
      while (t.hasMoreTokens()) {
        result.add(TaskRelation.subtask(t.nextToken()));
      }
      return result;
    }
    return Collections.emptySet();
  }
  
  public TracTaskMapper getTaskMapping(TaskData taskData)
  {
    TaskRepository taskRepository = taskData.getAttributeMapper().getTaskRepository();
    ITracClient client = taskRepository != null ? getClientManager().getTracClient(taskRepository) : null;
    return new TracTaskMapper(taskData, client);
  }
  
  public boolean canGetTaskHistory(TaskRepository repository, ITask task)
  {
    return ITracClient.Version.XML_RPC.name().equals(repository.getVersion());
  }
  
  public TaskHistory getTaskHistory(TaskRepository repository, ITask task, IProgressMonitor monitor)
    throws CoreException
  {
    try
    {
      ITracClient client = getClientManager().getTracClient(repository);
      List<TracComment> comments = client.getComments(getTicketId(task.getTaskId()), monitor);
      TaskHistory history = new TaskHistory(repository, task);
      TaskRevision revision = null;
      for (TracComment comment : comments)
      {
        String id = comment.getCreated().getTime();
        if ((revision == null) || (!id.equals(revision.getId())))
        {
          revision = new TaskRevision(id, comment.getCreated(), repository.createPerson(comment.getAuthor()));
          history.add(revision);
        }
        TracAttribute attribute = TracAttribute.getByTracKey(comment.getField());
        if (attribute != null)
        {
          String fieldName = attribute.toString();
          if (fieldName.endsWith(":")) {
            fieldName = fieldName.substring(0, fieldName.length() - 1);
          }
          TaskRevision.Change change = new TaskRevision.Change(attribute.getTracKey(), fieldName, 
            comment.getOldValue(), comment.getNewValue());
          revision.add(change);
        }
      }
      return history;
    }
    catch (OperationCanceledException e)
    {
      throw e;
    }
    catch (Throwable e)
    {
      throw new CoreException(TracCorePlugin.toStatus(e, repository));
    }
  }
}

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

import java.util.Date;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
import org.eclipse.mylyn.internal.trac.core.util.TracUtil;
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;

public class TracAttributeMapper
  extends TaskAttributeMapper
{
  public static final String NEW_CC = "task.common.newcc";
  public static final String REMOVE_CC = "task.common.removecc";
  
  public static enum Flag
  {
    READ_ONLY,  ATTRIBUTE,  PEOPLE;
  }
  
  public static final EnumSet<Flag> NO_FLAGS = EnumSet.noneOf(Flag.class);
  private final ITracClient client;
  
  public static boolean isInternalAttribute(TaskAttribute attribute)
  {
    String type = attribute.getMetaData().getType();
    if (("attachment".equals(type)) || ("operation".equals(type)) || 
      ("comment".equals(type))) {
      return true;
    }
    String id = attribute.getId();
    
    return ("task.common.comment.new".equals(id)) || ("task.common.addselfcc".equals(id)) || ("task.common.removecc".equals(id)) || ("task.common.newcc".equals(id));
  }
  
  public TracAttributeMapper(TaskRepository taskRepository, ITracClient client)
  {
    super(taskRepository);
    Assert.isNotNull(client);
    this.client = client;
  }
  
  public Date getDateValue(TaskAttribute attribute)
  {
    return TracUtil.parseDate(attribute.getValue());
  }
  
  public String mapToRepositoryKey(TaskAttribute parent, String key)
  {
    TracAttribute attribute = TracAttribute.getByTaskKey(key);
    return attribute != null ? attribute.getTracKey() : key;
  }
  
  public void setDateValue(TaskAttribute attribute, Date date)
  {
    if (date == null) {
      attribute.clearValues();
    } else {
      attribute.setValue(TracUtil.toTracTime(date));
    }
  }
  
  public Map<String, String> getOptions(TaskAttribute attribute)
  {
    Map<String, String> options = getRepositoryOptions(client, attribute.getId());
    return options != null ? options : super.getOptions(attribute);
  }
  
  public static Map<String, String> getRepositoryOptions(ITracClient client, String trackKey)
  {
    if (client.hasAttributes())
    {
      if (TracAttribute.STATUS.getTracKey().equals(trackKey)) {
        return getOptions(client.getTicketStatus(), false);
      }
      if (TracAttribute.RESOLUTION.getTracKey().equals(trackKey)) {
        return getOptions(client.getTicketResolutions(), false);
      }
      if (TracAttribute.COMPONENT.getTracKey().equals(trackKey)) {
        return getOptions(client.getComponents(), false);
      }
      if (TracAttribute.VERSION.getTracKey().equals(trackKey)) {
        return getOptions(client.getVersions(), true);
      }
      if (TracAttribute.PRIORITY.getTracKey().equals(trackKey)) {
        return getOptions(client.getPriorities(), false);
      }
      if (TracAttribute.SEVERITY.getTracKey().equals(trackKey)) {
        return getOptions(client.getSeverities(), false);
      }
      if (TracAttribute.MILESTONE.getTracKey().equals(trackKey)) {
        return getOptions(client.getMilestones(), true);
      }
      if (TracAttribute.TYPE.getTracKey().equals(trackKey)) {
        return getOptions(client.getTicketTypes(), false);
      }
    }
    return null;
  }
  
  private static Map<String, String> getOptions(Object[] values, boolean allowEmpty)
  {
    if ((values != null) && (values.length > 0))
    {
      Map<String, String> options = new LinkedHashMap();
      if (allowEmpty) {
        options.put("", "");
      }
      Object[] arrayOfObject = values;int j = values.length;
      for (int i = 0; i < j; i++)
      {
        Object value = arrayOfObject[i];
        options.put(value.toString(), value.toString());
      }
      return options;
    }
    return null;
  }
}

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

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.trac.core.messages";
  public static String TracAttachmentHandler_Uploading_attachment;
  public static String TracAttribute_Assigned_to;
  public static String TracAttribute_CC;
  public static String TracAttribute_Component;
  public static String TracAttribute_Created;
  public static String TracAttribute_Description;
  public static String TracAttribute_ID;
  public static String TracAttribute_Keywords;
  public static String TracAttribute_Last_Modification;
  public static String TracAttribute_Milestone;
  public static String TracAttribute_Priority;
  public static String TracAttribute_Reporter;
  public static String TracAttribute_Resolution;
  public static String TracAttribute_Severity;
  public static String TracAttribute_Status;
  public static String TracAttribute_Summary;
  public static String TracAttribute_Type;
  public static String TracAttribute_Version;
  public static String TracCorePlugin_I_O_error_has_occured;
  public static String TracCorePlugin_Repository_URL_is_invalid;
  public static String TracCorePlugin_the_SERVER_RETURNED_an_UNEXPECTED_RESOPNSE;
  public static String TracCorePlugin_Unexpected_error;
  public static String TracCorePlugin_Unexpected_server_response_;
  public static String TracRepositoryConnector_Getting_changed_tasks;
  public static String TracRepositoryConnector_Querying_repository;
  public static String TracRepositoryConnector_Trac_Client_Label;
  public static String TracTaskDataHandler_Accept;
  public static String TracTaskDataHandler_Leave;
  public static String TracTaskDataHandler_Leave_as_Status;
  public static String TracTaskDataHandler_Leave_as_Status_Resolution;
  public static String TracTaskDataHandler_Reopen;
  public static String TracTaskDataHandler_Resolve_as;
  public static String TracWikiHandler_Download_Wiki_Page;
  public static String TracWikiHandler_Download_Wiki_Page_Names;
  public static String TracWikiHandler_Retrieve_Wiki_Page_History;
  public static String TracWikiHandler_Upload_Wiki_Page;
  
  static {}
  
  public static void reloadMessages()
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.trac.core.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.trac.core.Messages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1 2 3 4 5 6 7 8 9 10

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