Project

General

Profile

Bug #7370

TypeFactory.convertTypeFromType does not use xmlValue comparisons for Enum conversions

Added by Rob Nahf about 6 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
d1_common_java
Target version:
Start date:
2015-09-21
Due date:
% Done:

0%

Milestone:
None
Product Version:
*
Story Points:
Sprint:

Description

DataONE enumeration elements are defined by the schema, and are the "canonical" representations. But, due to Java Enum convention of all-capping constants and how our classes are built, the xmlValue is only accessible via the xmlValue() method, which is not a standard method for Enums. This requires the convertTypeFromType method to add class-specific logic for comparing using the xmlValue.

For V2, we can get away with a "equalsIgnoreCase", because the only Enum that would undergo conversion is the v1.Event class. However, that would not work for the v1.Permission class, where CHANGE_PERMISSION constant's xmlValue is "changePermission".

A couple solution options:
1. create an xmlEnum interface that defines the xmlValue method that all DataONE Enum classes extend, and convert can leverage
2. special-case handle all of the DataONE Enums in the conversion method
3. override the toString method of DataONE Enums to return the xmlValue.


Related issues

Related to Infrastructure - Bug #7363: CN.getLogRecords returns 0 result Closed 2015-09-17

History

#1 Updated by Rob Nahf about 6 years ago

  • Related to Bug #7363: CN.getLogRecords returns 0 result added

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)