Skip to content

Commit

Permalink
Merge pull request ProjetoDSL#13 from ProjetoDSL/dev-gen
Browse files Browse the repository at this point in the history
Project Update
  • Loading branch information
JonnathanRiquelmo authored Oct 14, 2021
2 parents e6f5551 + 6bb4a22 commit d3a9380
Show file tree
Hide file tree
Showing 97 changed files with 5,798 additions and 7,008 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ rule__Relation__Group__0__Impl
:
(
{ before(grammarAccess.getRelationAccess().getNameAssignment_0()); }
(rule__Relation__NameAssignment_0)?
(rule__Relation__NameAssignment_0)
{ after(grammarAccess.getRelationAccess().getNameAssignment_0()); }
)
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ rule__Relation__Group__0__Impl
:
(
{ before(grammarAccess.getRelationAccess().getNameAssignment_0()); }
(rule__Relation__NameAssignment_0)?
(rule__Relation__NameAssignment_0)
{ after(grammarAccess.getRelationAccess().getNameAssignment_0()); }
)
;
Expand Down

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,79 +24,142 @@ class ErDslFileTemplateProvider implements IFileTemplateProvider {
// val helloName = combo("Hello Name:", #["Xtext", "World", "Foo", "Bar"], "The name to say 'Hello' to")
@FileTemplate(label="ERDSL Template", icon="file_template.png", description="Create a template file for ERDSl.")
final class ERtextFile {
val modelName = combo("Template:", #["Employees", "2", "3"], "The logical example model")
val modelName = combo("Template:", #["Hospital_Veterinario", "Empresa_Generica"], "The logical example model")
override generateFiles(IFileGenerator generator) {
generator.generate('''«folder»/«name».erdsl''', '''
«IF modelName.toString.equalsIgnoreCase("Employees")»
Generate All;
«IF modelName.toString.equalsIgnoreCase("Hospital_Veterinario")»
/*
* This is an example model
*/
Domain The_Employees_Sample_Schema;
* This is an example model
*/
Generate All;
Domain Hospital_Veterinario;
Entities {
Person {
person_no int isIdentifier,
gender boolean
Pessoa {
idPessoa int isIdentifier,
telefoneS int,
nome string
}
Veterinario is total/disjoint Pessoa {
nrVet int,
dtAdmissao datetime,
salario money
}
Employee is total/overlapped Person {
emp_no int isIdentifier,
birth_dt datetime,
first_name string,
last_name string,
hire_dt datetime
Cliente is total/disjoint Pessoa {
cpf int,
email string
}
Dependent is total/overlapped Person {
dependent_no int isIdentifier,
first_name string,
last_name string
Animal {
idAnimal int isIdentifier,
idade int,
porte string,
nome string
}
Salary {
salary_no int isIdentifier,
salary money,
from_dt datetime,
to_dt datetime
Enfermidade {
idEnfermidade int isIdentifier,
nome string,
descricao string
}
Departament {
dept_no int isIdentifier,
name string,
goals_description string
Tratamento {
idTratamento int isIdentifier,
dtInicio datetime,
dtFim datetime
}
Title {
title_no int isIdentifier,
name string,
description string,
from_dt datetime,
to_dt datetime
Receita {
idReceita int isIdentifier,
remedio string
}
};
Relationships {
Dept_manager [Employee (1:N) relates (1:N) Departament] {from_dt datetime, to_dt datetime}
Dept_emp [Employee (1:N) relates (1:N) Departament] {from_dt datetime, to_dt datetime}
Payment [Salary (1:N) relates (1:1) Employee]
JobTitle [Title (1:N) relates (1:1) Employee]
Dependency [Employee (1:1) relates (1:N) Dependent]
Assistente [Veterinario (0:1) relates (0:N) Veterinario]
Dono [Cliente (1:1) relates (1:N) Animal]
Reponsavel [Veterinario (1:N) relates (0:N) Tratamento]
Possui [Tratamento (1:1) relates (1:1) Receita]
AnimalDoente [Animal (0:N) relates (1:N) Enfermidade]
TratAnimal [AnimalDoente (1:N) relates (1:1) Tratamento]
};
«ELSEIF modelName.toString.equalsIgnoreCase("2")»
Another Template
«ELSEIF modelName.toString.equalsIgnoreCase("Empresa_Generica")»
/*
* This is an example model
*/
«ELSEIF modelName.toString.equalsIgnoreCase("3")»
Generate All;
Domain Empresa_Generica;
Another Template
Entities {
Empregado {
idEmpregado int isIdentifier,
salario money
}
Contador is total/disjoint Empregado {
crc int
}
Motorista is total/disjoint Empregado {
cnh int,
veiculo string
}
Engenheiro is total/disjoint Empregado {
crea int,
areaAtuacao string
}
Departamento {
idDept int isIdentifier,
sigla string
}
Tipo {
idTipo int isIdentifier,
descricao string
}
Projeto {
idProjeto int isIdentifier,
descricao string
}
Materiais {
idMaterial int isIdentifier,
descricao string,
validade string
}
Fornecedor {
idFornecedor int isIdentifier,
cnpj int,
nomeFantasia string,
telefone int
}
};
Relationships {
Supervisiona [Empregado (0:1) relates (1:N) Empregado]
Desenvolve [Empregado (1:N) relates (0:N) Projeto]
Lotado [Empregado (1:N) relates (0:1) Departamento]
Tem [Departamento (1:1) relates (1:1) Tipo]
Controla [Departamento (1:N) relates (0:N) Projeto]
Fornecimento [Materiais (0:N) relates (1:N) Fornecedor]
ProjFornec [Projeto (1:N) relates (1:N) Fornecimento]
};
«ENDIF»
''')
Expand Down
2 changes: 1 addition & 1 deletion org.xtext.unipampa.erdsl.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<page
class="org.xtext.unipampa.erdsl.ui.ErDslExecutableExtensionFactory:org.eclipse.xtext.ui.editor.preferences.LanguageRootPreferencePage"
id="org.xtext.unipampa.erdsl.ErDsl"
name="ErDsl">
name="ERtext">
<keywordReference id="org.xtext.unipampa.erdsl.ui.keyword_ErDsl"/>
</page>
<page
Expand Down
Loading

0 comments on commit d3a9380

Please sign in to comment.