org.eclipse.mylar.internal.tasks.ui
Class TaskDataManager

java.lang.Object
  extended by org.eclipse.mylar.internal.tasks.ui.TaskDataManager

public class TaskDataManager
extends java.lang.Object

Manager for persisting RepositoryTaskData

Author:
Rob Elves

Field Summary
private  OfflineDataStore dataStore
           
private  java.io.File file
           
private  java.util.Map<java.lang.String,RepositoryTaskData> newTaskDataMap
          Newest version of the task data
private  java.util.Map<java.lang.String,RepositoryTaskData> oldTaskDataMap
          Older version of Task Data
private  java.util.Map<java.lang.String,RepositoryTaskData> unsubmittedTaskData
          Unsubmitted tasks data
 
Constructor Summary
TaskDataManager(java.io.File file, boolean read)
           
 
Method Summary
 void clear()
          Public for testing
 void clearUnsubmitted()
           
private  java.util.Map<java.lang.String,RepositoryTaskData> getNewDataMap()
           
 java.lang.String getNewRepositoryTaskId()
           
private  java.util.Map<java.lang.String,RepositoryTaskData> getOldDataMap()
           
 RepositoryTaskData getOldTaskData(java.lang.String handle)
          Returns the old copy if exists, null otherwise.
 RepositoryTaskData getOldTaskData(java.lang.String repositoryUrl, java.lang.String taskId)
          Returns the old copy if exists, null otherwise.
 RepositoryTaskData getTaskData(java.lang.String handle)
          Returns the most recent copy of the task data.
 RepositoryTaskData getTaskData(java.lang.String repositoryUrl, java.lang.String taskId)
          Returns the most recent copy of the task data.
 java.util.Map<java.lang.String,RepositoryTaskData> getUnsubmitted()
           
private  java.util.Map<java.lang.String,RepositoryTaskData> getUnsubmittedTaskData()
           
 void put(RepositoryTaskData newEntry)
          Add a RepositoryTaskData to the offline reports file.
 void putUnsubmitted(RepositoryTaskData newEntry)
          Add an unsubmitted RepositoryTaskData to the offline reports file.
 void readOfflineData()
          Public for testing
private  void readOldOfflineFile()
          Migrate from old offline task data format (pre 1.0)
 void remove(java.util.List<RepositoryTaskData> dataToRemove)
          Remove some bugs from the offline reports list
 void remove(RepositoryTaskData taskData)
           
 void removeUnsubmitted(java.lang.String handle)
           
 void save()
          save task data to offline file
private  void updateAttributeFactory(RepositoryTaskData taskData)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

private java.io.File file

dataStore

private OfflineDataStore dataStore

oldTaskDataMap

private java.util.Map<java.lang.String,RepositoryTaskData> oldTaskDataMap
Older version of Task Data


newTaskDataMap

private java.util.Map<java.lang.String,RepositoryTaskData> newTaskDataMap
Newest version of the task data


unsubmittedTaskData

private java.util.Map<java.lang.String,RepositoryTaskData> unsubmittedTaskData
Unsubmitted tasks data

Constructor Detail

TaskDataManager

public TaskDataManager(java.io.File file,
                       boolean read)
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
Method Detail

getOldDataMap

private java.util.Map<java.lang.String,RepositoryTaskData> getOldDataMap()

getNewDataMap

private java.util.Map<java.lang.String,RepositoryTaskData> getNewDataMap()

getUnsubmittedTaskData

private java.util.Map<java.lang.String,RepositoryTaskData> getUnsubmittedTaskData()

put

public void put(RepositoryTaskData newEntry)
Add a RepositoryTaskData to the offline reports file. Previously stored taskData is held and can be retrieved via getOldTaskData()


putUnsubmitted

public void putUnsubmitted(RepositoryTaskData newEntry)
Add an unsubmitted RepositoryTaskData to the offline reports file.


getUnsubmitted

public java.util.Map<java.lang.String,RepositoryTaskData> getUnsubmitted()

removeUnsubmitted

public void removeUnsubmitted(java.lang.String handle)

clearUnsubmitted

public void clearUnsubmitted()

getNewRepositoryTaskId

public java.lang.String getNewRepositoryTaskId()
Returns:
Get the next available temporary id. This id is given to new unsubmitted repository tasks. Incremented each time this method is called.

getTaskData

public RepositoryTaskData getTaskData(java.lang.String handle)
Returns the most recent copy of the task data.


getTaskData

public RepositoryTaskData getTaskData(java.lang.String repositoryUrl,
                                      java.lang.String taskId)
Returns the most recent copy of the task data.


getOldTaskData

public RepositoryTaskData getOldTaskData(java.lang.String handle)
Returns the old copy if exists, null otherwise.


getOldTaskData

public RepositoryTaskData getOldTaskData(java.lang.String repositoryUrl,
                                         java.lang.String taskId)
Returns the old copy if exists, null otherwise.


remove

public void remove(java.util.List<RepositoryTaskData> dataToRemove)
Remove some bugs from the offline reports list

Parameters:
indicesToRemove - An array of the indicies of the bugs to be removed

remove

public void remove(RepositoryTaskData taskData)

clear

public void clear()
Public for testing


readOfflineData

public void readOfflineData()
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Public for testing

Throws:
java.io.IOException
java.lang.ClassNotFoundException

readOldOfflineFile

private void readOldOfflineFile()
                         throws java.io.IOException
Migrate from old offline task data format (pre 1.0)

Throws:
java.io.IOException

save

public void save()
save task data to offline file


updateAttributeFactory

private void updateAttributeFactory(RepositoryTaskData taskData)