2013-03-30 3 views
0

jboss errai에서 GWT로 프로젝트를 생성해야하지만 eclipse 모델링 프레임 워크 .ecore 모델을 사용하여 acceleo를 사용하여 내 모델 코드를 생성해야합니다. 나는이 일을했다.jboss errai 및 gwt와 통합 acceleo

  1. 생성 받는다는 프로젝트 사용 명령

MVN 아키 : 생성 -DarchetypeGroupId = org.jboss.errai.archetypes -DarchetypeArtifactId = CDI-빠른 -DarchetypeVersion = 2.2.0.Final

  1. 기존의 Maven 프로젝트와 마찬가지로 Eclipse로 가져온 프로젝트.

  2. Acceleo-> Acceleo Generator 프로젝트로 변환하지만 아무것도 얻지 못합니다.

  3. 은 그 때 나는 .ecore 모델을 사용하지만 문자열 및 기타에 EString을 얻고으로 모델 클래스에 오류가 내 이전 프로젝트에 생성 된 모델> Acceleo- Acceleo MTL 프로젝트로 변환하고 새로운 acceleo 프로젝트를 만들어 간다 또한 E-datatype으로 plz가 내 jboss errai maven 프로젝트에 acceleo 기능을 어떻게 사용할 수 있는지 제안합니다.

내 템플릿 파일은 다음과 같습니다

[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] 

내가 문자열과 원시적 인 기타의 장소에서 EString을 얻고 여기에

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 
} 

로 .ecore 모델에서 생성 된 모델의 하나입니다 데이터 유형은 E-Data 유형입니다.

Plz은 내가 같은

답변

0

을위한 자바 데이터 및 다른 프로세서를 얻을 사실 난 그냥 내 MTL 파일에 수정 제 질문의 핵심 대답을 얻었다 어떻게 해결책을 제안

[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')] 
package com.garvityWeb.main.migrated.models; 
@Portable 
public class [anEClass.name.toUpperFirst()/] 
{ 
[ for (p:EAttribute|anEClass.eAttributes) separator('\n')] 
@Inject 
@DataField 
private [p.eAttributeType.instanceClassName/] [p.name/]; 
[/for] 

[ for (p:EAttribute|anEClass.eAttributes) separator('\n')] 
public [p.eAttributeType.instanceClassName/] get[p.name.toUpperFirst()/]() 
{ 
    return this.[p.name/]; 
} 
[/for] 
[ for (p:EAttribute|anEClass.eAttributes) separator('\n')] 
public void set[p.name.toUpperFirst()/]([p.eAttributeType.instanceClassName/] [p.name/]) 
{ 
this.[p.name/]=[p.name/]; 
} 
[/for] 
} 
[/file] 
[/template]