please validate the validationFailures message : ligne 84 in the patch
=> validationFailures.add("conflict for etermining a strategy for
retreaval of title for class %s that contains a method '%s' and an
annotation '@%s'", objectSpec.getIdentifier().getClassName(),
TITLE_METHOD_NAME, Title.class.getName());
where objectSpec.getIdentifier().getClassName() is the class,
TITLE_METHOD_NAME = "title" and Title.class.getName() =
"org.apache.isis.applib.annotation.Title"
Othmen.
2013/9/24 Othmen Tiliouine <[email protected]>
> changing the order of addFactory(TitleAnnotationFacetFactory.class); and
> addFactory(TitleMethodFacetFactory.class); in ProgrammingModelFacetsJava5
> is not the solution to correct the ordre because it's the good ordre, but
> isis use TitleAnnotationFacetFactory instead of TitleMethodFacetFactory
> because TitleMethodFacetFactory contain this code
>
> // may have a facet by virtue of @Title, say.
> final TitleFacet existingTitleFacet =
> facetHolder.getFacet(TitleFacet.class);
> if(existingTitleFacet != null && !existingTitleFacet.isNoop()) {
> return;
> }
>
>
> to correct the ordre i moved this code after the test if (method != null)
> { ... }
> the ordre of priority is good now (title() > @Title > toString())
>
> for the metamodel validation i added implements MetaModelValidatorRefiner
> to the class TitleAnnotationFacetFactory and its implementation
> refineMetaModelValidator
>
> the exception is thrown if the subClass contain an @Title annotated method
> and the subclass or the super class contains a title() method
>
>
> 2013/9/22 Dan Haywood <[email protected]>
>
>> Yeah, that's right.
>>
>> To have an exception thrown, you will need to write and register a
>> MetaModelValidator. I think this is done by having the FacetFactory
>> implement MetaModelValidatorRefiner or something similar.
>>
>> Cheers
>> Dan
>>
>>
>>
>> On 22 September 2013 16:14, Othmen Tiliouine <[email protected]
>> >wrote:
>>
>> > Hi Dan,
>> >
>> > I did not try to resolve the ticket because there was no clear
>> description
>> > of the ticket and I do not know the expected behavior 'cause isis
>> > documentation does not give this details.
>> > But now it is more clear, so if I understand correctly, both having a
>> > @Title
>> > and title() should cause
>> > - an exception if there is a @Title annotations in the classe that
>> > contain title()
>> > - use title() instead of @Title if all @Title are in a superclasses
>> >
>> > Othmen.
>> >
>> >
>> > 2013/9/22 Dan Haywood <[email protected]>
>> >
>> > > Hi Othmen,
>> > > fyi, any attachments (including pictures) are stripped from the Apache
>> > > mailing lists. To show screenshots etc, you'll need to upload the
>> > > screenshots somewhere and then reference them.
>> > >
>> > > To your question about this ticket, though, what you've observed
>> > definitely
>> > > isn't the expected behaviour. As I'm sure you know, in Isis, every
>> > domain
>> > > object should provide a title - a string representation of itself
>> that is
>> > > sufficiently unique to identify it to the end-user. There are two
>> main
>> > > ways of doing this, either declaratively - using @Title annotations -
>> or
>> > > imperatively - with the title() method. (If neither are present, then
>> > > toString() is used).
>> > >
>> > > This ticket was so that the declarative behaviour is the default, but
>> if
>> > a
>> > > class provides a title() method, then this should be used instead.
>> The
>> > > ticket also suggested that perhaps having both @Title and title()
>> might
>> > be
>> > > considered an error, in which case we could use the MetaModelValidator
>> > > interface to prevent Isis from booting. However, I think this doesn't
>> > make
>> > > sense, because it might be that the properties annotated with @Title
>> > might
>> > > be inherited from a superclass, whereas the subclass might want to
>> > override
>> > > this with its own title(). So having both shouldn't be considered an
>> > > error.
>> > >
>> > > I suspect that the fix is very easy ... just reversing the order of
>> the
>> > > registration of TitleAnnotationFacetFactory and
>> > > TitleMethodFacetFactory in ProgrammingModelFacetsJava5. But why don't
>> > you
>> > > have a play around and see. If it works, why not submit a patch?
>> > >
>> > > Cheers
>> > > Dan
>> > >
>> > >
>> > >
>> > > On 21 September 2013 02:16, Othmen Tiliouine <
>> [email protected]
>> > > >wrote:
>> > >
>> > > > Hello,
>> > > >
>> > > > I did not understand this task.
>> > > > I try adding the @Title annotation to the methods getDescription()
>> and
>> > > > getCategory() in ToDOItem class that contains a title() method, the
>> > > > result is that the @Title annotations are used as the title and not
>> the
>> > > > title() method but the method title() is used in this case as an
>> action
>> > > >
>> > > > [image: Images intégrées 2]
>> > > > [image: Images intégrées 3]
>> > > >
>> > > > it's not this the expected behavior?
>> > > >
>> > > >
>> > > > 2013/9/20 Dan Haywood (JIRA) <[email protected]>
>> > > >
>> > > > Dan Haywood created ISIS-543:
>> > > >> --------------------------------
>> > > >>
>> > > >> Summary: title() should take precedence over @Title,
>> or
>> > > >> perhaps should fail eagerly?
>> > > >> Key: ISIS-543
>> > > >> URL:
>> https://issues.apache.org/jira/browse/ISIS-543
>> > > >> Project: Isis
>> > > >> Issue Type: Improvement
>> > > >> Components: Core
>> > > >> Affects Versions: core-1.2.0
>> > > >> Reporter: Dan Haywood
>> > > >> Assignee: Dan Haywood
>> > > >> Priority: Minor
>> > > >> Fix For: core-1.4.0
>> > > >>
>> > > >>
>> > > >>
>> > > >>
>> > > >> --
>> > > >> This message is automatically generated by JIRA.
>> > > >> If you think it was sent incorrectly, please contact your JIRA
>> > > >> administrators
>> > > >> For more information on JIRA, see:
>> > > http://www.atlassian.com/software/jira
>> > > >>
>> > > >
>> > > >
>> > >
>> >
>>
>
>