| java.lang.Object info.jtrac.domain.Metadata
Metadata | public class Metadata implements Serializable(Code) | | XML metadata is one of the interesting design decisions of JTrac.
Metadata is defined for each space and so Items that belong to a
space are customized by the space metadata. This class can marshall
and unmarshall itself to XML and this XML is stored in the database
in a single column. Because of this approach, Metadata can be made more
and more complicated in the future without impact to the database schema.
Things that the Metadata configures for a Space:
1) custom Fields for an Item (within a Space)
- Label
- whether mandatory or not [ DEPRECATED ]
- the option values (drop down list options)
- the option "key" values are stored in the database (WITHOUT any relationships)
- the values corresponding to "key"s are resolved in memory from the Metadata
and not through a database join.
2) the Roles available within a space
- for each (from) State the (to) State transitions allowed for this role
- and within each (from) State the fields that this Role can view / edit
3) the State labels corresponding to each state
- internally States are integers, but for display we need a label
- labels can be customized
- special State values: 0 = New, 1 = Open, 99 = Closed
4) the order in which the fields are displayed
on the data entry screens and the query result screens etc.
There is one downside to this approach and that is there is a limit
to the nunmbers of custom fields available. The existing limits are
- Drop Down: 10
- Free Text: 5
- Numeric: 3
- Date/Time: 3
Metadata can be inherited, and this allows for "reuse" TODO
|
Method Summary | |
public void | add(Field field) | public void | addRole(String roleName) | public void | addState(String stateName) | public Map<String, String> | getAvailableFieldTypes() | public String | getCustomValue(Field.Name fieldName, Integer key) | public String | getCustomValue(Field.Name fieldName, String key) | public String | getDescription() | public List<Field> | getEditableFields(String roleKey, int status) | public List<Field> | getEditableFields(Collection<String> roleKeys, int status) | public List<Field> | getEditableFields() | public Field | getField(String fieldName) | public int | getFieldCount() | public List<Field> | getFieldList() | public List<Field.Name> | getFieldOrder() | public Map<Field.Name, Field> | getFields() | public long | getId() | public String | getName() | public Field | getNextAvailableField(int fieldType) | public Metadata | getParent() | public Map<Integer, String> | getPermittedTransitions(List<String> roleKeys, int status) | public String | getPrettyXml() | public int | getRoleCount() | public Collection<Role> | getRoleList() | public Map<String, Role> | getRoles() | public Map<String, Boolean> | getRolesAbleToTransition(int fromStatus, int toStatus) | public Set<String> | getRolesAbleToTransitionFrom(int state) | public int | getStateCount() | public Map<Integer, String> | getStates() | public String | getStatusValue(Integer key) | public Integer | getType() | public Set<Field.Name> | getUnusedFieldNames() | public int | getVersion() | public String | getXmlString() | public void | initRoles() | public void | removeField(String fieldName) | public void | removeRole(String roleName) | public void | removeState(int stateId) | public void | renameRole(String oldRole, String newRole) | public void | setDescription(String description) | public void | setId(long id) | public void | setName(String name) | public void | setParent(Metadata parent) | public void | setType(Integer type) | public void | setVersion(int version) | public void | setXmlString(String xmlString) | public void | switchMask(int stateKey, String roleKey, String fieldName) | public String | toString() | public void | toggleTransition(String roleKey, int fromState, int toState) |
Metadata | public Metadata()(Code) | | |
getFieldCount | public int getFieldCount()(Code) | | |
getId | public long getId()(Code) | | |
getNextAvailableField | public Field getNextAvailableField(int fieldType)(Code) | | |
getPermittedTransitions | public Map<Integer, String> getPermittedTransitions(List<String> roleKeys, int status)(Code) | | logic for resolving the next possible transitions for a given role and state
- lookup Role by roleKey
- for this Role, lookup state by key (integer)
- for the State, iterate over transitions, get the label for each and add to map
The map returned is used to render the drop down list on screen, [ key = value ]
|
getRoleCount | public int getRoleCount()(Code) | | |
getRolesAbleToTransition | public Map<String, Boolean> getRolesAbleToTransition(int fromStatus, int toStatus)(Code) | | |
getRolesAbleToTransitionFrom | public Set<String> getRolesAbleToTransitionFrom(int state)(Code) | | |
getStateCount | public int getStateCount()(Code) | | |
getVersion | public int getVersion()(Code) | | |
initRoles | public void initRoles()(Code) | | |
removeState | public void removeState(int stateId)(Code) | | |
setDescription | public void setDescription(String description)(Code) | | |
setId | public void setId(long id)(Code) | | |
setVersion | public void setVersion(int version)(Code) | | |
setXmlString | public void setXmlString(String xmlString)(Code) | | |
toggleTransition | public void toggleTransition(String roleKey, int fromState, int toState)(Code) | | |
|
|