Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332258 - Need better way to specify @NoDuplicates for list properties
Summary: Need better way to specify @NoDuplicates for list properties
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2010-12-09 17:24 EST by Danny Ju CLA
Modified: 2021-11-19 09:21 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Danny Ju CLA 2010-12-09 17:24:23 EST
Build Identifier:  M20100909-0800

From  
http://www.eclipse.org/forums/index.php?t=rview&goto=644199#msg_644199

I have a property list which has following spec:

public interface IModulePublishingTarget extends IModelElement,IRemovable {
ModelElementType TYPE = new ModelElementType( IModulePublishingTarget.class );
// *** Name ***
@Label( standard = "Target Name" )
@NoDuplicates
...
}

Although 
@NoDuplicates
is specified, in the rendered table UI, adding duplicated 
entry does not prompt error. 


*******************************
The @NoDuplicates annotation doesn't quite work in the way you are thinking. It is applied to the list property (not the contained value) and acts as a hint to rendering rather than a validation provider. 

The behavior you are looking for is accomplished as follows:

@DependsOn( "*/Name" )
@Validator( impl = UniqueValueValidator.class )

The UniqueValueValidator class is part of Sapphire. See IContact.Connections in the samples for an example of this.

This looks like something that can be improved. I think your expectation of behavior is actually more intuitive than the current approach. Please open an enhancement request to improve the usability of the @NoDuplicates/UniqueValueValidator scenario.


Reproducible: Always
Comment 1 Konstantin Komissarchik CLA 2010-12-09 17:37:20 EST
Enhancement implemented. Migration details in documentation.
Comment 2 Ling Hao CLA 2011-01-05 17:47:18 EST
Verified with contact's name property.
Comment 3 EPP Error Reports CLA 2014-12-16 00:48:13 EST
To date this log entry was reported 10 times.

Your friendly error reports bot.
Comment 4 EPP Error Reports CLA 2014-12-16 13:03:19 EST
To date this log entry was reported 25 times.

Your friendly error reports bot.
Comment 5 EPP Error Reports CLA 2014-12-18 10:52:14 EST
To date this log entry was reported 50 times.

Your friendly error reports bot.