biocodellc / biocode-fims-commons

Biocode Field Information Management System
3 stars 0 forks source link

only display error messages once for an entity Attribute #33

Closed rodney757 closed 7 years ago

rodney757 commented 7 years ago

sometime multiple entities use the same Attribute. If there are warning/errors during validation for this attribute, the messages is displayed once for each time the attribute appears in the project configuration Mapping.

We should make sure the attributes are unique on a per worksheet basis when iterating/displaying errors.

rodney757 commented 7 years ago

This was fixed by using a HashSet in the mapping.getAllAttributes(worksheet) method.

I currently am only using the uri to determine if 2 Attributes are equal and to generate the hashCode for the Attribute class.

We should further discuss if this is what we really want to do. What if 2 Attributes with the same uri have a different attribute b/c not all Attributes in the project config we updated.

Maybe we should have a way to reference other Attributes in the config. Then there is only 1 place to update a attribute, thus eliminating duplication.

we can possible use a ref attribute on the Attribute to reference another uri.

This also bring up a question whether Attributes w/ the same uri are the same thing across worksheets, or if Attributes belong to the worksheet.

Leaving this open until we discuss the above.

jdeck88 commented 7 years ago

URIs are distinct internal references for columns themselves and therefore the only case they should be replicated is if they are defined as part of some different entity (in which case we shouldn't double validated them).

"Maybe we should have a way to reference other Attributes in the config. Then there is only 1 place to update a attribute, thus eliminating duplication."

Possibly... however, i don't think it is worth adding that complexity to the config. file.

"we can possible use a ref attribute on the Attribute to reference another uri. This also bring up a question whether Attributes w/ the same uri are the same thing across worksheets, or if Attributes belong to the worksheet."

I think attributes w/ the same URI but appearing on different worksheets should not be allowed.

This is not entirely settled but closing this issue for now since i don't think its urgent enough to address currently -- if we get a project that has more worksheets we may want to re-open the issue.