Re: function "exists" ?
"Goldsack, Patrick" <[email protected]> Thu, 20 Jul 2006 14:29:05 +0100
| Newsgroups | gmane.comp.java.smartfrog.devel |
|---|---|
| Message-ID | <[email protected]> |
I will add such a predicate - should be pretty trivial.
However, the way we normally handle this is to add the optional
attribute as a simple null value into the base template, for example
swapsize;
then any link to it will succeed, but have a null value if not set by
override. Note that the ifThenElse will give exactly the same result as
such a link.
Patrick
________________________________
From: smartfrog-developer-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:smartfrog-developer-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of
Xavier Grehant
Sent: 19 July 2006 18:47
To: smartfrog-developer
Subject: Re: [Smartfrog-developer] function "exists" ?
Julio -
I think it checks if sfSchema is true, not if it exists because when it
does not exist the parser fails at link resolution...
sfSchema true;
//Prim with any schema
Prim extends NULL {
sfPrimSchema extends ifThenElse {
if sfSchema;
then extends PrimSchema;
else NULL;
}
Indeed It would be nice to use ifThenElse but with something like this:
LoopBackDomain extends Compound {
backend extends LoopbackStorageBackend {
//...
swapSize extends ifThenElse {
if DEF PARENT:PARENT:swapSize;
then PARENT:PARENT:swapSize;
else NULL;
}
}
//...
}
LoopbackDomainSchema extends Schema {
swapSize extends OptionalInteger;
}
sfConfig extends LoopbackDomain {
//swapSize not here because it's optional
}
So I was wondering if there was such a DEF function?
Thank you,
Xavier
On 7/19/06, Guijarro, Julio <[email protected]> wrote:
An example used in prim.sf
sfPrimSchema extends ifThenElse {
if sfSchema;
then extends PrimSchema;
else NULL;
}
This creates an attribute called sfPrimSchema if sfSchema is
exists if not, it makes it NULL.
Julio
________________________________
From: smartfrog-developer-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:smartfrog-developer-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org ] On Behalf Of
Xavier Grehant
Sent: 19 July 2006 15:38
To: smartfrog-developer
Subject: [Smartfrog-developer] function "exists" ?
Hi -
Is there a way to check if an attribute exists in a smartfrog
description?
The idea is to be able to have an optional attribute
attr2 PARENT:attr1
when attr1 is optional in the parent.
Thank you,
Xavier
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Smartfrog-developer mailing list
Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/smartfrog-developer