Skip to main content
Jump to: navigation, search

Difference between revisions of "Mylyn/Refactoring"

(Task Attributes)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
== Offline Data ==
 +
* <font color=green>[https://bugs.eclipse.org/bugs/show_bug.cgi?id=160389 160389] [api] Externalization of offline data as xml [Rob] (2.0)</font>
 +
* <font color=green>bug#176513 - multi bug retrieval. complete, api may need to be improved post [Rob] (2.0)</font>
 +
* <font color=green> bug#161734 - remove hits from api. complete [Rob] (2.0)</font>
 +
 +
* [https://bugs.eclipse.org/bugs/show_bug.cgi?id=160389 160389] [api] change how offline task data is cached to disk and refactor attribute factory
 +
 +
* RepositoryTaskAttribute and AttributeFactory
 +
** RepositoryTaskAttribute no longer holds options
 +
** Remove name and hidden property from RepositoryTaskAttribute
 +
** Remove all methods from AbstractAttributeFactory except for createAttribute() and getDateForAttributeType() [default implementation should return attribute.getDate()?]
 +
*** Attributes need to be created by connectors
 +
 +
* bug#179254 - reafactoring, and AbstractRepositoryTaskEditor ui factory implementation [Steffen]
 +
* bug#143011 - specifically: add IProgressMonitor parameter to IO methods [Steffen]
 +
** <font color=green> added IProgressMonitor to api methods [Steffen]</font>
 +
 
= Requirements =
 
= Requirements =
  
Line 8: Line 25:
 
= API =
 
= API =
  
 +
Changes to current implementation:
 +
* RepositoryTaskData becomes a generic storage API
 +
* Excpected attributes and data types are specified through Java interfaces
  
 
== Task Data ==
 
== Task Data ==
Line 39: Line 59:
 
== Task Attributes ==
 
== Task Attributes ==
  
  RepositoryTaskAttribute {
+
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").
  setMeta
+
 
<font color=gray> boolean isModified()
+
  RepositoryTaskData {
  boolean hasIncomingChanges()
+
  RepositoryTaskAttributeMapper mapper;
  void write(IMemento)
+
  RepositoryTaskAttribute createAttribute(String id, String type);
  void read(IMemento)</font>
+
  RepositoryTaskAttribute getAttribute(String id);
 +
  RepositoryTaskAttribute[] getAttributes(String type);
 +
}
 +
 
 +
RepositoryTaskAttribute { // IMemento style
 +
  String id; // unique ID
 +
  void setDateValue(Date date);
 +
  Date getDateValue();
 +
  ... // support for String, int, float, boolean
 +
}
 +
 
 +
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 ==
  
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.
+
Make this model explicit and define it in terms of Java interfaces. Only these interfaces are used by the editor to set/get values. Default implementation of proxy classes are provided for mapping to underlying task data objects.  
  
  RepositoryTaskData {
+
''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.)
    *get/set methods for mylar specific access  
+
 
    *Eliminate AttributeFactory
+
  public interface IRepositoryTask {
 +
  String getDescription();
 +
  void setDescription(String description);
 +
  ...
 +
  }
 +
 
 +
public class RepositoryTaskProxy {
 +
  RepositoryTaskProxy(RepositoryTaskData taskData);
 +
  String getDescription() {
 +
    taskData.getAttribute(RepositoryTaskData.DESCRIPTION).getStringValue();
 +
  }
 +
  void setDescription(String description) {
 +
    taskData.getAttribute(RepositoryTaskData.DESCRIPTION).setStringValue(description);
 +
  }
 +
  void createAttributes() {
 +
    taskData.createAttribute(RepositoryTaskData.DESCRIPTION);
 +
  }
 +
  ...
 
  }
 
  }
  
  RepositoryTaskComment {
+
  IRepositoryTaskComment {
   RepositoryTaskAttribute connectorSpecificAtrtibute;
+
   String getId(); // allows to map to underlying attribute?
  getAttribute(); // returns connectorSpecificAttribute;
+
   String getAuthor();
  get/set methods for mylar specific values
+
   Date getCreated();
   String author
+
   Date created
+
 
   ...
 
   ...
 
  }
 
  }
RepositoryTaskCommnets should be retrieved from proxy (ITaskDataHandler)
 
Suggest we have setter methods for values used by abstract editor.
 
  
  RepositoryAttachment {
+
  IRepositoryTaskAttachment {
   String filename
+
   String getFilename()
   String description
+
   String getDescription()
 
   ...
 
   ...
 
  }
 
  }
RepositoryAttachments should be retrieved from proxy (ITaskDataHandler)
 
  
  RepositoryTaskOperation {
+
  IRepositoryTaskOperation {
 
   ...
 
   ...
 
  }
 
  }
  Retrieved from ITaskDataHandler (provided with RepositoryTaskData)
+
 
 +
Instances of the interfaces are provided by ITaskDataHandler:
 +
 
 +
  ITaskDataHandler {
 +
  IRepositoryTask getTask(RepositoryTaskData);
 +
  IRepositoryTaskAttachment[] getAttachments(RepositoryTaskData);
 +
  IRepositoryTaskComment[] getComments(RepositoryTaskData);
 +
}
  
 
== Editor/UI ==
 
== Editor/UI ==
  
Connectors provide a factory for UI representation of attributes:
+
The editor should only hold on to a RepositoryTaskData object. Connectors provide a factory for UI representation of attributes:
  
 
  AbstractConnectorUi {
 
  AbstractConnectorUi {

Latest revision as of 14:58, 21 December 2007

Offline Data

  • 160389 [api] Externalization of offline data as xml [Rob] (2.0)
  • bug#176513 - multi bug retrieval. complete, api may need to be improved post [Rob] (2.0)
  • bug#161734 - remove hits from api. complete [Rob] (2.0)
  • 160389 [api] change how offline task data is cached to disk and refactor attribute factory
  • RepositoryTaskAttribute and AttributeFactory
    • RepositoryTaskAttribute no longer holds options
    • Remove name and hidden property from RepositoryTaskAttribute
    • Remove all methods from AbstractAttributeFactory except for createAttribute() and getDateForAttributeType() [default implementation should return attribute.getDate()?]
      • Attributes need to be created by connectors
  • bug#179254 - reafactoring, and AbstractRepositoryTaskEditor ui factory implementation [Steffen]
  • bug#143011 - specifically: add IProgressMonitor parameter to IO methods [Steffen]
    • added IProgressMonitor to api methods [Steffen]

Requirements

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

API

Changes to current implementation:

  • RepositoryTaskData becomes a generic storage API
  • Excpected attributes and data types are specified through Java interfaces

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 { // IMemento style
  String id; // unique ID
  void setDateValue(Date date);
  Date getDateValue();
  ... // support for String, int, float, boolean
}

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 interfaces. Only these interfaces are used by the editor to set/get values. Default implementation of proxy classes are provided for mapping to underlying task data objects.

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.)

public interface IRepositoryTask {
  String getDescription();
  void setDescription(String description);
  ...
}
public class RepositoryTaskProxy {
  RepositoryTaskProxy(RepositoryTaskData taskData);
  String getDescription() {
    taskData.getAttribute(RepositoryTaskData.DESCRIPTION).getStringValue();
  }
  void setDescription(String description) {
    taskData.getAttribute(RepositoryTaskData.DESCRIPTION).setStringValue(description);
  }
  void createAttributes() {
    taskData.createAttribute(RepositoryTaskData.DESCRIPTION);
  }
  ...
}
IRepositoryTaskComment {
 String getId(); // allows to map to underlying attribute?
 String getAuthor();
 Date getCreated();
 ...
}
IRepositoryTaskAttachment {
 String getFilename()
 String getDescription()
 ...
}
IRepositoryTaskOperation {
 ...
}

Instances of the interfaces are provided by ITaskDataHandler:

ITaskDataHandler {
  IRepositoryTask getTask(RepositoryTaskData);
  IRepositoryTaskAttachment[] getAttachments(RepositoryTaskData);
  IRepositoryTaskComment[] getComments(RepositoryTaskData);
}

Editor/UI

The editor should only hold on to a RepositoryTaskData object. 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