Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Using variables in JET
Using variables in JET [message #414700] Sat, 17 November 2007 02:19 Go to next message
Thiru is currently offline ThiruFriend
Messages: 1
Registered: July 2009
Junior Member
Hi All,

Can I use java/Jet variables in Jet templates.

Ex:

<c:setVariable select="somevalue" var="varaibaleName"/>

Here "somevalue" is not an XML XPATH expression. I want to assign
"somevalue" value to "varaibaleName" varibale name.

Just like java,

String varaibaleName = "somevalue";

How can I achieve in JET templates?

Thanks in advance.
Re: Using variables in JET [message #414703 is a reply to message #414700] Sat, 17 November 2007 12:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Thiru,

It's best to ask about JET on the M2T newsgroup. I've added it to the
"to" list of the reply, so you don't need to repost.


Thiru wrote:
> Hi All,
>
> Can I use java/Jet variables in Jet templates.
>
> Ex:
>
> <c:setVariable select="somevalue" var="varaibaleName"/>
>
> Here "somevalue" is not an XML XPATH expression. I want to assign
> "somevalue" value to "varaibaleName" varibale name.
>
> Just like java,
>
> String varaibaleName = "somevalue";
>
> How can I achieve in JET templates?
>
> Thanks in advance.
>
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using variables in JET [message #414720 is a reply to message #414703] Tue, 20 November 2007 02:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richphs.hotmail.com

Please help me.
The variable has been declared on the Jet templates and it has been
returned NodeSet Type in the java scriptlet.
I don't know how to process the nodeSet type variable which comes from the
Jet variable in Jet templates
How can I code on the java scriptlet?

<control:setVariable var="screenDefOfScreenList"
select=" $function//Event/ReferenceInformation/RelatedScreen/ScreenDe fOfScreenList "
/>
<%
if(context.hasVariable("screenDefOfScreenList"))
{
NodeSet screenList =
(NodeSet)context.getVariable("screenDefOfScreenList");

// I don't know how to do below.....

EObjectInspector eObjectInspector = new EObjectInspector();
for (Iterator i = screenList.iterator(); i.hasNext();) {
Object object = i.next();
//eObject = (EObject)object;
Object[] screenDefAttributes = eObjectInspector.getChildren(object);
for (int j = 0; j < screenDefAttributes.length; j++){
//screenDefElement =
(ScreenDef)eObjectInspector.getParent(screenDefAttributes[j] );
%>
<%= eObjectInspector.nameOf(screenDefAttributes[j]) %>
<%
}
}
}
%>
Re: Using variables in JET [message #414734 is a reply to message #414720] Tue, 20 November 2007 13:22 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Park:

The best thing to do would be to NOT try to process the NodeSet in Java
unless you really have to. Looking at your code fragment, you could do this
with JET tags:

<%-- iterate over screen lists --%>
<c:iterate
select=" $function//Event/ReferenceInformation/RelatedScreen/ScreenDe fOfScreenList "
var="listMember">
<%-- write some attribute of listMember to the output --%>
<c:get select="$listMember/@someAttribute name"/>

<%-- really tricky. See what attributes $listMember has --%>
<c:iterate select="$listMember/@*" var="listMemberAttr">
<c:get select="local-name($listMemberAttr")"/> = <c:get
select="$listMemberAttr"/>
</c:iterate>
</c:iterate>

Tell me more about what you want to do. I am happy to help.

Paul

"park" <richphs@hotmail.com> wrote in message
news:1e56344c38877de23b44ea3feffcc5eb$1@www.eclipse.org...
> Please help me.
> The variable has been declared on the Jet templates and it has been
> returned NodeSet Type in the java scriptlet.
> I don't know how to process the nodeSet type variable which comes from the
> Jet variable in Jet templates
> How can I code on the java scriptlet?
>
> <control:setVariable var="screenDefOfScreenList"
> select=" $function//Event/ReferenceInformation/RelatedScreen/ScreenDe fOfScreenList "
> />
> <%
> if(context.hasVariable("screenDefOfScreenList"))
> {
> NodeSet screenList =
> (NodeSet)context.getVariable("screenDefOfScreenList");
>
> // I don't know how to do below.....
>
> EObjectInspector eObjectInspector = new EObjectInspector();
> for (Iterator i = screenList.iterator(); i.hasNext();) {
> Object object = i.next();
> //eObject = (EObject)object;
> Object[] screenDefAttributes = eObjectInspector.getChildren(object);
> for (int j = 0; j < screenDefAttributes.length; j++){
> //screenDefElement =
> (ScreenDef)eObjectInspector.getParent(screenDefAttributes[j] );
> %>
> <%= eObjectInspector.nameOf(screenDefAttributes[j]) %>
> <%
> }
> }
> }
> %>
>
>
>
Previous Topic:EMF load resource behavior when the resource is a Database via Teneo
Next Topic:Zip/Jar archive schemes not acknowledged by UriConverter?
Goto Forum:
  


Current Time: Thu Apr 25 19:58:48 GMT 2024

Powered by FUDForum. Page generated in 0.02464 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top