Skip to main content
Jump to: navigation, search

Difference between revisions of "Mylyn/Refactoring"

(Related Bug Reports)
(Task Attributes)
Line 41: Line 41:
  
 
== Task Attributes ==
 
== Task Attributes ==
 +
 +
Attributes are stored in RepositoryTaskData objects which manages all offline data for a task. For simplicity attributes can have properties (key/value pairs) but not have child attributes. To easily store and retrieve a list of related attributes such as attachments or comment attributes have a type (e.g. "attachment", "comment", "custom").
 +
 +
RepositoryTaskData {
 +
  RepositoryTaskAttributeMapper mapper;
 +
  RepositoryTaskAttribute createAttribute(String id, String type);
 +
  RepositoryTaskAttribute getAttribute(String id);
 +
  RepositoryTaskAttribute[] getAttributes(String type);
 +
}
  
 
  RepositoryTaskAttribute {
 
  RepositoryTaskAttribute {
  set/getMetaData (already exists)
+
  String id; // unique ID
<font color=gray> boolean isModified()
+
  void setDateValue(Date date);
  boolean hasIncomingChanges()
+
  Date getDateValue();
  void write(IMemento)
+
  ... // support for String, int, float
  void read(IMemento)</font>
+
  // properties
 +
  setDateValue(String key, Date date);
 +
  getDateValue(String key);
 +
  ...
 +
}
 +
 
 +
To map from predefined attribute keys that are used by the editor to access information about changed attributes each task data object holds on to a mapper (former AbstractAttributeFactory):
 +
 
 +
RepositoryTaskAttributeMapper {
 +
  String mapToAttributeID(String mylarID);
 
  }
 
  }
*Eliminate options and hidden related methods
 
  
 
== Mylar Task Model ==
 
== Mylar Task Model ==

Revision as of 00:15, 21 May 2007

Related Bug Reports

  • 160389 [api] change how offline task data is cached to disk and refactor attribute factory

Requirements

  • Persistence
    • Provide a generic API for storing task attributes
  • Configuration extraction
  • Presenation api

API

Task Data

ITaskDataManager {
  TaskDataState getTaskDataState(String repositoryUrl, String id);
  void saveTaskDataState(TaskDataState taskState);
  void refactorRepositoryUrl(String oldUrl, String newUrl);
  void removeTaskDataState(String repositoryUrl, String id);
  void saveNewTaskDataState(TaskDataState newTaskDataState);  // (rfc) Sets unique new id
  Set<TaskDataState> getNewTaskDataState(String repositoryUrl); // (rfc)
}


  • TaskDataState created via ITaskDataHandler.buildTaskDataState(RepositoryTaskData newData, RepositoryTaskData oldData, Set<RepositoryTaskAttribute> edits);
  • TaskDataState is an unmodifiable object but not final.
TaskDataState {
   public TaskDataState(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData, Set<RepositoryTaskAttribute> edits);  // Constructor sets values but does not do computation
   public init();  // Perform constructor specific initialization (i.e. calc changed attributes etc)
   RepositoryTaskData newTaskData;
   RepositoryTaskData oldTaskData;
   Set<RepositoryTaskAttribute> edits;
   isStateModified();
   hasIncomingChanges();
   hasChanged(RepositoryTaskAttribute attribute);
   Set<RepositoryTaskAttribute> getChanged();
   void discardEdits(String repositoryUrl, String id);
}

Task Attributes

Attributes are stored in RepositoryTaskData objects which manages all offline data for a task. For simplicity attributes can have properties (key/value pairs) but not have child attributes. To easily store and retrieve a list of related attributes such as attachments or comment attributes have a type (e.g. "attachment", "comment", "custom").

RepositoryTaskData {
  RepositoryTaskAttributeMapper mapper;
  RepositoryTaskAttribute createAttribute(String id, String type);
  RepositoryTaskAttribute getAttribute(String id);
  RepositoryTaskAttribute[] getAttributes(String type);
}
RepositoryTaskAttribute {
  String id; // unique ID
  void setDateValue(Date date);
  Date getDateValue();
  ... // support for String, int, float
  // properties
  setDateValue(String key, Date date);
  getDateValue(String key);
  ...
}

To map from predefined attribute keys that are used by the editor to access information about changed attributes each task data object holds on to a mapper (former AbstractAttributeFactory):

RepositoryTaskAttributeMapper {
  String mapToAttributeID(String mylarID);
}

Mylar Task Model

Make this model explicit and define it in terms of Java classes. Accessor methods should mirror fields available on AbstractRepositoryTask. This could be separate from the offline storage so connectors without a TaskDataHandler could provide attachment support.

RepositoryTaskData {
   *get/set methods for mylar specific access  
   *Eliminate AttributeFactory
}
RepositoryTaskComment {
 RepositoryTaskAttribute connectorSpecificAtrtibute;
 getAttribute(); // returns connectorSpecificAttribute;
 get/set methods for mylar specific values
 String author
 Date created
 ...
}
RepositoryTaskCommnets should be retrieved from proxy (ITaskDataHandler)
Suggest we have setter methods for values used by abstract editor.
RepositoryAttachment {
 String filename
 String description
 ...
}
RepositoryAttachments should be retrieved from proxy (ITaskDataHandler)
RepositoryTaskOperation {
 ...
}
Retrieved from ITaskDataHandler (provided with RepositoryTaskData)

Editor/UI

Connectors provide a factory for UI representation of attributes:

AbstractConnectorUi {
 abstract ITaskUiFactory getTaskUiFactory()
}
ITaskUiFactory {
 String getLabel(RepositoryTaskAttribute attr)
 Control createEditor(RepositoryTaskAttribute attr, Composite parent)
 void addFieldEditors(Set<RepositoryTaskAttribute>, Composite parent); // reponsible for layout/order
 String getToolTip(RepositoryTaskAttribute attr)
}

Mylar provides default implementations to create an editor for an attribute:

MylarEditorFactory {
 Control createComboEditor(RepositoryTaskAttribute attr, Composite parent, String[] options);
}

Back to the top