Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332258

Summary: Need better way to specify @NoDuplicates for list properties
Product: z_Archived Reporter: Danny Ju <danny.ju>
Component: SapphireAssignee: Konstantin Komissarchik <konstantin>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: konstantin, ling.hao
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

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.