You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by James Agada <Ja...@CWG-PLC.COM> on 2015/06/06 15:11:53 UTC

Property validation

What is the correct way to put validation for property. The one from the site is obviously not correct as the validateXxx does not have a return type. I m continually having this error
2: todoapp.dom.module.game.GameEntity#validateClosingDate: has prefix validate, is probably a supporting method for a property, collection or action.  If the method is intended to be an action, then rename and use @ActionLayout(named="...") or ignore completely using @Programmatic


public class Exam {
    public int getMark() { ... }
    public void setMark(int mark) { ... }
    public validateMark(int mark) {
        return !withinRange(mark)? "Mark must be in range 0 to 30":null;
    }
    private boolean withinRange(int mark) { return mark >= 0 && mark <= 30; }
}

James Agada
Chief Technology Officer

[cid:03079D33-D6EF-43C4-BC68-409961ED49D7][cid:0A85BA30-39DD-4C9D-AF4D-6ECD6761CB96]

This email and any attachment thereto are confidential and priviledged. if you have received it in error, please delete immediately and notify the sender. Do not disclose, copy, circulate or in any way use it. The information contained therein is for the address only, if you reply on it, its at your own risk. Emails are not guaranteed to be secure or error free, the message and any attachment could be intercepted, corrupted, lost, delayed, incomplete or ammended. Computer warehouse group and its divisions do not accept liability for damage caused by this email or any attachment. The message you tried to print is protected with Information Rights Management. You don't have the necessary user rights to print the message.

Re: Property validation

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
I'm steadily working through the site and converting to use asciidoc... so
this typo should be fixed soon.

thx


On 6 June 2015 at 19:22, James Agada <Ja...@cwg-plc.com> wrote:

> In the howto. I've fixed this.
>
> Sent from my iPhone
>
> > On Jun 6, 2015, at 5:45 PM, Martin Grigorov <mg...@apache.org>
> wrote:
> >
> > Right.
> > It should return String with the error description. Or TranslatableString
> > if you need to support several languages.
> > At which page did you see this example? We should fix it.
> >> On Jun 6, 2015 5:54 PM, "Kevin Meyer" <ke...@kmz.co.za> wrote:
> >>
> >> At first glance, your validate method must have return type String.
> >> Cheers,
> >> Kevin
> >>
> >>
> >>> On 6 June 2015 15:11:53 CEST, James Agada <Ja...@CWG-PLC.COM>
> wrote:
> >>> What is the correct way to put validation for property. The one from
> >>> the site is obviously not correct as the validateXxx does not have a
> >>> return type. I m continually having this error
> >>> 2: todoapp.dom.module.game.GameEntity#validateClosingDate: has prefix
> >>> validate, is probably a supporting method for a property, collection or
> >>> action.  If the method is intended to be an action, then rename and use
> >>> @ActionLayout(named="...") or ignore completely using @Programmatic
> >>>
> >>>
> >>> public class Exam {
> >>>   public int getMark() { ... }
> >>>   public void setMark(int mark) { ... }
> >>>   public validateMark(int mark) {
> >>>      return !withinRange(mark)? "Mark must be in range 0 to 30":null;
> >>>   }
> >>> private boolean withinRange(int mark) { return mark >= 0 && mark <= 30;
> >>> }
> >>> }
> >>>
> >>> James Agada
> >>> Chief Technology Officer
> >>
> >>>
> [cid:03079D33-D6EF-43C4-BC68-409961ED49D7][cid:0A85BA30-39DD-4C9D-AF4D-6ECD6761CB96]
> >>>
> >>> This email and any attachment thereto are confidential and priviledged.
> >>> if you have received it in error, please delete immediately and notify
> >>> the sender. Do not disclose, copy, circulate or in any way use it. The
> >>> information contained therein is for the address only, if you reply on
> >>> it, its at your own risk. Emails are not guaranteed to be secure or
> >>> error free, the message and any attachment could be intercepted,
> >>> corrupted, lost, delayed, incomplete or ammended. Computer warehouse
> >>> group and its divisions do not accept liability for damage caused by
> >>> this email or any attachment. The message you tried to print is
> >>> protected with Information Rights Management. You don't have the
> >>> necessary user rights to print the message.
> >>
> >> --
> >> Sent from my phone with K-9 Mail.
> >> Please excuse my brevity.
> > This email and any attachment thereto are confidential and priviledged.
> if you have received it in error, please delete immediately and notify the
> sender. Do not disclose, copy, circulate or in any way use it. The
> information contained therein is for the address only, if you reply on it,
> its at your own risk. Emails are not guaranteed to be secure or error free,
> the message and any attachment could be intercepted, corrupted, lost,
> delayed, incomplete or ammended. Computer warehouse group and its divisions
> do not accept liability for damage caused by this email or any attachment.
> The message you tried to print is protected with Information Rights
> Management. You don't have the necessary user rights to print the message.
> This email and any attachment thereto are confidential and priviledged. if
> you have received it in error, please delete immediately and notify the
> sender. Do not disclose, copy, circulate or in any way use it. The
> information contained therein is for the address only, if you reply on it,
> its at your own risk. Emails are not guaranteed to be secure or error free,
> the message and any attachment could be intercepted, corrupted, lost,
> delayed, incomplete or ammended. Computer warehouse group and its divisions
> do not accept liability for damage caused by this email or any attachment.
> The message you tried to print is protected with Information Rights
> Management. You don't have the necessary user rights to print the message.
>

Re: Property validation

Posted by James Agada <Ja...@CWG-PLC.COM>.
In the howto. I've fixed this.

Sent from my iPhone

> On Jun 6, 2015, at 5:45 PM, Martin Grigorov <mg...@apache.org> wrote:
>
> Right.
> It should return String with the error description. Or TranslatableString
> if you need to support several languages.
> At which page did you see this example? We should fix it.
>> On Jun 6, 2015 5:54 PM, "Kevin Meyer" <ke...@kmz.co.za> wrote:
>>
>> At first glance, your validate method must have return type String.
>> Cheers,
>> Kevin
>>
>>
>>> On 6 June 2015 15:11:53 CEST, James Agada <Ja...@CWG-PLC.COM> wrote:
>>> What is the correct way to put validation for property. The one from
>>> the site is obviously not correct as the validateXxx does not have a
>>> return type. I m continually having this error
>>> 2: todoapp.dom.module.game.GameEntity#validateClosingDate: has prefix
>>> validate, is probably a supporting method for a property, collection or
>>> action.  If the method is intended to be an action, then rename and use
>>> @ActionLayout(named="...") or ignore completely using @Programmatic
>>>
>>>
>>> public class Exam {
>>>   public int getMark() { ... }
>>>   public void setMark(int mark) { ... }
>>>   public validateMark(int mark) {
>>>      return !withinRange(mark)? "Mark must be in range 0 to 30":null;
>>>   }
>>> private boolean withinRange(int mark) { return mark >= 0 && mark <= 30;
>>> }
>>> }
>>>
>>> James Agada
>>> Chief Technology Officer
>>
>>> [cid:03079D33-D6EF-43C4-BC68-409961ED49D7][cid:0A85BA30-39DD-4C9D-AF4D-6ECD6761CB96]
>>>
>>> This email and any attachment thereto are confidential and priviledged.
>>> if you have received it in error, please delete immediately and notify
>>> the sender. Do not disclose, copy, circulate or in any way use it. The
>>> information contained therein is for the address only, if you reply on
>>> it, its at your own risk. Emails are not guaranteed to be secure or
>>> error free, the message and any attachment could be intercepted,
>>> corrupted, lost, delayed, incomplete or ammended. Computer warehouse
>>> group and its divisions do not accept liability for damage caused by
>>> this email or any attachment. The message you tried to print is
>>> protected with Information Rights Management. You don't have the
>>> necessary user rights to print the message.
>>
>> --
>> Sent from my phone with K-9 Mail.
>> Please excuse my brevity.
> This email and any attachment thereto are confidential and priviledged. if you have received it in error, please delete immediately and notify the sender. Do not disclose, copy, circulate or in any way use it. The information contained therein is for the address only, if you reply on it, its at your own risk. Emails are not guaranteed to be secure or error free, the message and any attachment could be intercepted, corrupted, lost, delayed, incomplete or ammended. Computer warehouse group and its divisions do not accept liability for damage caused by this email or any attachment. The message you tried to print is protected with Information Rights Management. You don't have the necessary user rights to print the message.
This email and any attachment thereto are confidential and priviledged. if you have received it in error, please delete immediately and notify the sender. Do not disclose, copy, circulate or in any way use it. The information contained therein is for the address only, if you reply on it, its at your own risk. Emails are not guaranteed to be secure or error free, the message and any attachment could be intercepted, corrupted, lost, delayed, incomplete or ammended. Computer warehouse group and its divisions do not accept liability for damage caused by this email or any attachment. The message you tried to print is protected with Information Rights Management. You don't have the necessary user rights to print the message.

Re: Property validation

Posted by Martin Grigorov <mg...@apache.org>.
Right.
It should return String with the error description. Or TranslatableString
if you need to support several languages.
At which page did you see this example? We should fix it.
On Jun 6, 2015 5:54 PM, "Kevin Meyer" <ke...@kmz.co.za> wrote:

> At first glance, your validate method must have return type String.
> Cheers,
> Kevin
>
>
> On 6 June 2015 15:11:53 CEST, James Agada <Ja...@CWG-PLC.COM> wrote:
> >What is the correct way to put validation for property. The one from
> >the site is obviously not correct as the validateXxx does not have a
> >return type. I m continually having this error
> >2: todoapp.dom.module.game.GameEntity#validateClosingDate: has prefix
> >validate, is probably a supporting method for a property, collection or
> >action.  If the method is intended to be an action, then rename and use
> >@ActionLayout(named="...") or ignore completely using @Programmatic
> >
> >
> >public class Exam {
> >    public int getMark() { ... }
> >    public void setMark(int mark) { ... }
> >    public validateMark(int mark) {
> >       return !withinRange(mark)? "Mark must be in range 0 to 30":null;
> >    }
> >private boolean withinRange(int mark) { return mark >= 0 && mark <= 30;
> >}
> >}
> >
> >James Agada
> >Chief Technology Officer
> >
>
> >[cid:03079D33-D6EF-43C4-BC68-409961ED49D7][cid:0A85BA30-39DD-4C9D-AF4D-6ECD6761CB96]
> >
> >This email and any attachment thereto are confidential and priviledged.
> >if you have received it in error, please delete immediately and notify
> >the sender. Do not disclose, copy, circulate or in any way use it. The
> >information contained therein is for the address only, if you reply on
> >it, its at your own risk. Emails are not guaranteed to be secure or
> >error free, the message and any attachment could be intercepted,
> >corrupted, lost, delayed, incomplete or ammended. Computer warehouse
> >group and its divisions do not accept liability for damage caused by
> >this email or any attachment. The message you tried to print is
> >protected with Information Rights Management. You don't have the
> >necessary user rights to print the message.
>
> --
> Sent from my phone with K-9 Mail.
> Please excuse my brevity.

Re: Property validation

Posted by Kevin Meyer <ke...@kmz.co.za>.
At first glance, your validate method must have return type String. 
Cheers, 
Kevin


On 6 June 2015 15:11:53 CEST, James Agada <Ja...@CWG-PLC.COM> wrote:
>What is the correct way to put validation for property. The one from
>the site is obviously not correct as the validateXxx does not have a
>return type. I m continually having this error
>2: todoapp.dom.module.game.GameEntity#validateClosingDate: has prefix
>validate, is probably a supporting method for a property, collection or
>action.  If the method is intended to be an action, then rename and use
>@ActionLayout(named="...") or ignore completely using @Programmatic
>
>
>public class Exam {
>    public int getMark() { ... }
>    public void setMark(int mark) { ... }
>    public validateMark(int mark) {
>       return !withinRange(mark)? "Mark must be in range 0 to 30":null;
>    }
>private boolean withinRange(int mark) { return mark >= 0 && mark <= 30;
>}
>}
>
>James Agada
>Chief Technology Officer
>
>[cid:03079D33-D6EF-43C4-BC68-409961ED49D7][cid:0A85BA30-39DD-4C9D-AF4D-6ECD6761CB96]
>
>This email and any attachment thereto are confidential and priviledged.
>if you have received it in error, please delete immediately and notify
>the sender. Do not disclose, copy, circulate or in any way use it. The
>information contained therein is for the address only, if you reply on
>it, its at your own risk. Emails are not guaranteed to be secure or
>error free, the message and any attachment could be intercepted,
>corrupted, lost, delayed, incomplete or ammended. Computer warehouse
>group and its divisions do not accept liability for damage caused by
>this email or any attachment. The message you tried to print is
>protected with Information Rights Management. You don't have the
>necessary user rights to print the message.

-- 
Sent from my phone with K-9 Mail.
Please excuse my brevity.