Fornax-Platform
Forum

!changeable

View: New views
3 Messages — Rating Filter:   Alert me  

!changeable

by PaloT :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At first in Sculptor 1.6 when Entity attribute is set as !changeable
NO setter is generated. In documentation
http://fornax.itemis.de/confluence/display/fornax/3.+Advanced+Tutorial+%28CSC%29#3.AdvancedTutorial%28CSC%29-Changeable
is written that private setter is generated. Mistake in doc or in
implementation?

Second: Isn't more logical to generate setter method as protected
instead of private? Entity implementation can sometimes change this
value but from outside is still unchangeable. I guess it's not
violating encapsulation.

To maybe give more light to my problem. I want have 'status' field
which is changed by calling method makeTransition(...). And I don't
want to allow direct change of attribute. It's little bit of problem
because also hibernate is calling setStatus and I have to somehow
recognize who is calling it if I want fire exception in setStatus
function.

Regards

Pavel

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Fornax-developer mailing list
Fornax-developer@...
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Re: !changeable

by Patrik Nordwall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

PaloT wrote:
At first in Sculptor 1.6 when Entity attribute is set as !changeable
NO setter is generated. In documentation
http://fornax.itemis.de/confluence/display/fornax/3.+Advanced+Tutorial+%28CSC%29#3.AdvancedTutorial%28CSC%29-Changeable
is written that private setter is generated. Mistake in doc or in
implementation?
Documentation not updated. I have fixed that now.

PaloT wrote:
Second: Isn't more logical to generate setter method as protected
instead of private? Entity implementation can sometimes change this
value but from outside is still unchangeable. I guess it's not
violating encapsulation.

To maybe give more light to my problem. I want have 'status' field
which is changed by calling method makeTransition(...). And I don't
want to allow direct change of attribute. It's little bit of problem
because also hibernate is calling setStatus and I have to somehow
recognize who is calling it if I want fire exception in setStatus
function.

Regards

Pavel
It is possible to define visibility (eg. protected) for attributes and
references and that is used when generating getters and setters, but
now I see that there is a bug in transformation, visibiiity is not
handled.

I have fixed visibility: http://fornax.itemis.de/jira/browse/CSC-391

I suggest that you define the status attribute as protected
    protected String status

In manual subclass you add makeTransition and possibly public visibility on the getter:
    public void makeTransition() {
        // some logic...
        setStatus("B");
    }

    @Override
    public String getStatus() {
        return super.getStatus();
    }

/Patrik




Re: !changeable

by PaloT :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You hit a nail on head, thanks.

Pavel


On Sat, Aug 8, 2009 at 9:36 PM, Patrik
Nordwall<patrik.nordwall@...> wrote:

>
>
> PaloT wrote:
>>
>> At first in Sculptor 1.6 when Entity attribute is set as !changeable
>> NO setter is generated. In documentation
>> http://fornax.itemis.de/confluence/display/fornax/3.+Advanced+Tutorial+%28CSC%29#3.AdvancedTutorial%28CSC%29-Changeable
>> is written that private setter is generated. Mistake in doc or in
>> implementation?
>>
>>
>
> Documentation not updated. I have fixed that now.
>
>
> PaloT wrote:
>>
>> Second: Isn't more logical to generate setter method as protected
>> instead of private? Entity implementation can sometimes change this
>> value but from outside is still unchangeable. I guess it's not
>> violating encapsulation.
>>
>> To maybe give more light to my problem. I want have 'status' field
>> which is changed by calling method makeTransition(...). And I don't
>> want to allow direct change of attribute. It's little bit of problem
>> because also hibernate is calling setStatus and I have to somehow
>> recognize who is calling it if I want fire exception in setStatus
>> function.
>>
>> Regards
>>
>> Pavel
>>
>
> It is possible to define visibility (eg. protected) for attributes and
> references and that is used when generating getters and setters, but
> now I see that there is a bug in transformation, visibiiity is not
> handled.
>
> I have fixed visibility: http://fornax.itemis.de/jira/browse/CSC-391
>
> I suggest that you define the status attribute as protected
>    protected String status
>
> In manual subclass you add makeTransition and possibly public visibility on
> the getter:
>    public void makeTransition() {
>        // some logic...
>        setStatus("B");
>    }
>
>    @Override
>    public String getStatus() {
>        return super.getStatus();
>    }
>
> /Patrik
>
>
>
>
> --
> View this message in context: http://www.nabble.com/%21changeable-tp24738808s17564p24879937.html
> Sent from the Fornax-Platform mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Fornax-developer mailing list
> Fornax-developer@...
> https://lists.sourceforge.net/lists/listinfo/fornax-developer
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Fornax-developer mailing list
Fornax-developer@...
https://lists.sourceforge.net/lists/listinfo/fornax-developer