Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Error in Combining acceleo project with jboss errai and gwt
Error in Combining acceleo project with jboss errai and gwt [message #1029422] Fri, 29 March 2013 17:13 Go to next message
Brijesh Gupta is currently offline Brijesh Gupta
Messages: 2
Registered: March 2013
Junior Member
Hi Everybody, I have to create a project in jboss errai but I want to generate must of my model code using acceleo using eclipse modeling framework .ecore model. I have done this things.
1. created maven project using command mvn archetype:generate -DarchetypeGroupId=org.jboss.errai.archetypes -DarchetypeArtifactId=cdi-quickstart -DarchetypeVersion=2.2.0.Final
2.Imported project to eclipse as existing maven project.
3.Goes to Acceleo->Convert Project to Acceleo Generator Project but getting nothing.
4.Then I goes to Acceleo->Convert to Acceleo MTL Projects and created a new acceleo project and generated model to my previous project using .ecore model but getting error in model class as I am getting EString at String and other also as E-datatype ,plz suggest solution.


my main.mtl template is


[comment encoding = UTF-8 /] [module main('http://www.eclipse.org/emf/2002/Ecore') ]
[template public generateElement(anEClass : EClass)]
[comment @main /]
[file (anEClass.name.concat('.java'), false, 'UTF-8')]
public class [anEClass.name.toUpperFirst()/]{ [ for (p:EAttribute|anEClass.eAttributes) separator('\n')] private [p.eAttributeType.name/] [p.name/]; [/for]
[ for (p:EAttribute|anEClass.eAttributes) separator('\n')] public [p.eAttributeType.name/] get[p.name.toUpperFirst()/]() { return this.[p.name/]; } [/for] [ for (p:EAttribute|anEClass.eAttributes) separator('\n')] public void set[p.name.toUpperFirst()/]([p.eAttributeType.name/] [p.name/]) { this.[p.name/]=[p.name/]; } [/for] [protected ('protected')] [/protected] } [/file] [/template]














Getting Class

public class Acceleo{
private EString strName;

private EString strSurName;

public EString getStrName()
{

return this.strName;


}

public EString getStrSurName()
{

return this.strSurName;


}

public void setStrName(EString strName)
{
this.strName=strName;
}

public void setStrSurName(EString strSurName)
{
this.strSurName=strSurName;
}


Start of user code protected

End of user code

}



and



public class UserRegistration{
private EString strFirstName;

private EString strSurName;

private EString strOccupation;

private EString strQualificaion;

private EString strFotherName;

private EString strMotherName;

private EEList chMaritalStatus;

private EDouble dblAnnualIncome;

private EDate dtDOB;

private EString strAbout;

private EJavaClass objAcceleo;

public EString getStrFirstName()
{

return this.strFirstName;


}

public EString getStrSurName()
{

return this.strSurName;


}

public EString getStrOccupation()
{

return this.strOccupation;


}

public EString getStrQualificaion()
{

return this.strQualificaion;


}

public EString getStrFotherName()
{

return this.strFotherName;


}

public EString getStrMotherName()
{

return this.strMotherName;


}

public EEList getChMaritalStatus()
{

return this.chMaritalStatus;


}

public EDouble getDblAnnualIncome()
{

return this.dblAnnualIncome;


}

public EDate getDtDOB()
{

return this.dtDOB;


}

public EString getStrAbout()
{

return this.strAbout;


}

public EJavaClass getObjAcceleo()
{

return this.objAcceleo;


}

public void setStrFirstName(EString strFirstName)
{
this.strFirstName=strFirstName;
}

public void setStrSurName(EString strSurName)
{
this.strSurName=strSurName;
}

public void setStrOccupation(EString strOccupation)
{
this.strOccupation=strOccupation;
}

public void setStrQualificaion(EString strQualificaion)
{
this.strQualificaion=strQualificaion;
}

public void setStrFotherName(EString strFotherName)
{
this.strFotherName=strFotherName;
}

public void setStrMotherName(EString strMotherName)
{
this.strMotherName=strMotherName;
}

public void setChMaritalStatus(EEList chMaritalStatus)
{
this.chMaritalStatus=chMaritalStatus;
}

public void setDblAnnualIncome(EDouble dblAnnualIncome)
{
this.dblAnnualIncome=dblAnnualIncome;
}

public void setDtDOB(EDate dtDOB)
{
this.dtDOB=dtDOB;
}

public void setStrAbout(EString strAbout)
{
this.strAbout=strAbout;
}

public void setObjAcceleo(EJavaClass objAcceleo)
{
this.objAcceleo=objAcceleo;
}


Start of user code protected

End of user code

}







Re: Error in Combining acceleo project with jboss errai and gwt [message #1030543 is a reply to message #1029422] Sun, 31 March 2013 10:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Brijesh,

Comments below.

On 31/03/2013 12:29 AM, Brijesh Gupta wrote:
> Hi Everybody, I have to create a project in jboss errai but I want to
> generate must of my model code using acceleo using eclipse modeling
> framework .ecore model. I have done this things. 1. created maven
> project using command mvn archetype:generate
> -DarchetypeGroupId=org.jboss.errai.archetypes
> -DarchetypeArtifactId=cdi-quickstart -DarchetypeVersion=2.2.0.Final
> 2.Imported project to eclipse as existing maven project. 3.Goes to
> Acceleo->Convert Project to Acceleo Generator Project but getting
> nothing.
Ask about Acceleo on the eclipse.modeling.m2t.
> 4.Then I goes to Acceleo->Convert to Acceleo MTL Projects and created
> a new acceleo project and generated model to my previous project using
> .ecore model but getting error in model class as I am getting EString
> at String and other also as E-datatype ,plz suggest solution.
If you're trying to generate Java code you should use the GenModel, or
at least have a look at how it generates Java code. Certainly for
EDataTypes you should use the instanceTypeName (the name of the Java
type the EDataTyype wraps) not the name (which doesn't correspond to
anything in Java).

You'd probably be better off looking at the Texo project which generates
POJOs from an Ecore model.
>
>
> my main.mtl template is
>
> [comment encoding = UTF-8 /] [module
> main('http://www.eclipse.org/emf/2002/Ecore') ] [template public
> generateElement(anEClass : EClass)] [comment @main /]
> [file (anEClass.name.concat('.java'), false, 'UTF-8')] public class
> [anEClass.name.toUpperFirst()/]{ [ for
> (p:EAttribute|anEClass.eAttributes) separator('\n')] private
> [p.eAttributeType.name/] [p.name/]; [/for] [ for
> (p:EAttribute|anEClass.eAttributes) separator('\n')] public
> [p.eAttributeType.name/] get[p.name.toUpperFirst()/]() { return
> this.[p.name/]; } [/for] [ for (p:EAttribute|anEClass.eAttributes)
> separator('\n')] public void
> set[p.name.toUpperFirst()/]([p.eAttributeType.name/] [p.name/]) {
> this.[p.name/]=[p.name/]; } [/for] [protected ('protected')]
> [/protected] } [/file] [/template]
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Getting Class
>
> public class Acceleo{
> private EString strName;
>
> private EString strSurName;
>
> public EString getStrName()
> {
>
> return this.strName;
>
>
> }
>
> public EString getStrSurName()
> {
>
> return this.strSurName;
>
>
> }
>
> public void setStrName(EString strName)
> {
> this.strName=strName;
> }
>
> public void setStrSurName(EString strSurName)
> {
> this.strSurName=strSurName;
> }
>
>
> Start of user code protected
>
> End of user code
>
> }
>
>
>
> and
>
>
>
> public class UserRegistration{
> private EString strFirstName;
>
> private EString strSurName;
>
> private EString strOccupation;
>
> private EString strQualificaion;
>
> private EString strFotherName;
>
> private EString strMotherName;
>
> private EEList chMaritalStatus;
>
> private EDouble dblAnnualIncome;
>
> private EDate dtDOB;
>
> private EString strAbout;
>
> private EJavaClass objAcceleo;
>
> public EString getStrFirstName()
> {
>
> return this.strFirstName;
>
>
> }
>
> public EString getStrSurName()
> {
>
> return this.strSurName;
>
>
> }
>
> public EString getStrOccupation()
> {
>
> return this.strOccupation;
>
>
> }
>
> public EString getStrQualificaion()
> {
>
> return this.strQualificaion;
>
>
> }
>
> public EString getStrFotherName()
> {
>
> return this.strFotherName;
>
>
> }
>
> public EString getStrMotherName()
> {
>
> return this.strMotherName;
>
>
> }
>
> public EEList getChMaritalStatus()
> {
>
> return this.chMaritalStatus;
>
>
> }
>
> public EDouble getDblAnnualIncome()
> {
>
> return this.dblAnnualIncome;
>
>
> }
>
> public EDate getDtDOB()
> {
>
> return this.dtDOB;
>
>
> }
>
> public EString getStrAbout()
> {
>
> return this.strAbout;
>
>
> }
>
> public EJavaClass getObjAcceleo()
> {
>
> return this.objAcceleo;
>
>
> }
>
> public void setStrFirstName(EString strFirstName)
> {
> this.strFirstName=strFirstName;
> }
>
> public void setStrSurName(EString strSurName)
> {
> this.strSurName=strSurName;
> }
>
> public void setStrOccupation(EString strOccupation)
> {
> this.strOccupation=strOccupation;
> }
>
> public void setStrQualificaion(EString strQualificaion)
> {
> this.strQualificaion=strQualificaion;
> }
>
> public void setStrFotherName(EString strFotherName)
> {
> this.strFotherName=strFotherName;
> }
>
> public void setStrMotherName(EString strMotherName)
> {
> this.strMotherName=strMotherName;
> }
>
> public void setChMaritalStatus(EEList chMaritalStatus)
> {
> this.chMaritalStatus=chMaritalStatus;
> }
>
> public void setDblAnnualIncome(EDouble dblAnnualIncome)
> {
> this.dblAnnualIncome=dblAnnualIncome;
> }
>
> public void setDtDOB(EDate dtDOB)
> {
> this.dtDOB=dtDOB;
> }
>
> public void setStrAbout(EString strAbout)
> {
> this.strAbout=strAbout;
> }
>
> public void setObjAcceleo(EJavaClass objAcceleo)
> {
> this.objAcceleo=objAcceleo;
> }
>
>
> Start of user code protected
>
> End of user code
>
> }
>
>
>
>
>
>
>
>
Re: Error in Combining acceleo project with jboss errai and gwt [message #1030596 is a reply to message #1030543] Sun, 31 March 2013 12:14 Go to previous messageGo to next message
Brijesh Gupta is currently offline Brijesh Gupta
Messages: 2
Registered: March 2013
Junior Member
Hi Merks,
Thanks for reply.Actually I am new to the emf and acceleo and my client want me to generate his jboss errai project code by acceleo I have suggested his to use GenModel but he does not agreed on that so I have to go with ecore ,acceleo and jboss errai.Can u plz suggest me forum or book to know EMF in best way.

Regards
Brijesh

[Updated on: Sun, 31 March 2013 12:15]

Report message to a moderator

Re: Error in Combining acceleo project with jboss errai and gwt [message #1030726 is a reply to message #1030596] Sun, 31 March 2013 16:56 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Brijesh,

Comments below.

On 31/03/2013 2:14 PM, Brijesh Gupta wrote:
> Hi Merks,
> Thanks for reply.Actually I am new to the emf and acceleo
Yes, I figured that...
> and my client want me to generate his jboss errai project code by
> acceleo I have suggested his to use GenModel but he does not agery
Not sure what agery is...
> on that so I have to go with ecore ,acceleo and jboss errai.Can u plz
> suggest me forum or book to know EMF in best way.
This forum is good for EMF (but you asked about Acceleo) and the EMF
book is good:

http://www.informit.com/store/emf-eclipse-modeling-framework-9780321331885
>
> Regards
> Brijesh
Previous Topic:[CDO] PostgreSQL port is not taken into account when start CDO Server
Next Topic:[CDO/Audtigin] CDORevisionDelta vs. CDORevisionKey
Goto Forum:
  


Current Time: Sat Sep 20 08:17:49 GMT 2014

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

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