Skip to content

Commit

Permalink
Merge pull request #58 from AMOSTeam1/template
Browse files Browse the repository at this point in the history
Template
  • Loading branch information
maielgendy authored Jun 20, 2018
2 parents 3d84c05 + 59abc84 commit ae6b310
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public NfaCatalogBlueprint convertToEntityAttribute(String dbData) {
public static class NfaCatalogBlueprint {
private BpPropertyTemplateNoConditionDe de;
private BpPropertyTemplateNoConditionEn en;

/**
* @return the de
*/
Expand Down
14 changes: 6 additions & 8 deletions nfabackend/src/test/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" version="2.1">

<persistence-unit name="nfa-test" transaction-type="RESOURCE_LOCAL">
<persistence-unit name="msg-nfa" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.msg.nfabackend.entities.Metric</class>
<class>com.msg.nfabackend.entities.Nfa</class>
<class>com.msg.nfabackend.entities.nfaCatalog</class>
<class>com.msg.nfabackend.entities.NfaCriteria</class>
<class>com.msg.nfabackend.entities.NfaFactor</class>
<class>com.msg.nfabackend.entities.Project</class>
<class>com.msg.nfabackend.entities.Project</class>
<class>com.msg.nfabackend.entities.Stakeholder</class>
<class>com.msg.nfabackend.entities.Type</class>
<class>com.msg.nfabackend.entities.nfaCatalog</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform"/>
<property name="javax.persistence.schema-generation.scripts.action" value="none"/>
<property name="javax.persistence.jdbc.user" value="postgres"/>
<property name="javax.persistence.jdbc.password" value="123456"/>
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/nfatest"/>
<property name="javax.persistence.jdbc.password" value="nfapasswd"/>
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/NFADB"/>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
</properties>
</persistence-unit>

</persistence>
</persistence>
2 changes: 1 addition & 1 deletion nfafrontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { NfaItemComponent } from './current-project/assign-nfa/nfa-list/nfa-item
import { ChooseNfaComponent } from './current-project/assign-nfa/choose-nfa/choose-nfa.component';
import { NfaDetailComponent } from './current-project/assign-nfa/nfa-detail/nfa-detail.component';
import { DataexchangeService } from './shared/dataexchange.service';
import {Inst} from './shared/inst.model';
import {Inst} from './shared/blueprints/inst.model';
import { DenfaformComponent } from './newnfa/nfatemplate/denfaform/denfaform.component';
import { EnnfaformComponent } from './newnfa/nfatemplate/ennfaform/ennfaform.component';
import { AngularWebStorageModule } from 'angular-web-storage';
Expand Down
3 changes: 2 additions & 1 deletion nfafrontend/src/app/newnfa/newnfa.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form [formGroup]="nfaform" (ngSubmit) = "onSubmit()">
<body><form [formGroup]="nfaform" (ngSubmit) = "onSubmit()">

<p class="sm">{{ 'nfa.factor' | translate }}</p>
<select formControlName ="factor" name="factor" required [(ngModel)]='selectedFactor'>
Expand Down Expand Up @@ -29,4 +29,5 @@
<br/><br/>
<input type="submit" class="button" value="Send">
</form>
</body>

3 changes: 2 additions & 1 deletion nfafrontend/src/app/newnfa/newnfa.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {NfaCatalogBlueprintModel} from '../shared/nfaCatalogBlueprint.model';
import {BpPropertyTemplateNoConditionDe} from '../shared/blueprints/bpPropertyTemplateNoConditionDe.model';
import {BpPropertyTemplateNoConditionEn} from '../shared/blueprints/bpPropertyTemplateNoConditionEn.model';
import {NfaCatalogModel} from '../shared/nfaCatalog.model';
import {QualifiyingExpression} from '../shared/blueprints/QualifiyingExpression.model';


@Component({
Expand Down Expand Up @@ -85,7 +86,7 @@ export class NewnfaComponent implements OnInit, AfterViewInit {
null,
null,
this.selectedType,
null,
this.nfatemplate.blueprintDeForm.get('chbox').value,
null,
this.nfatemplate.blueprintDeForm.get('valueInput').value,
new NfaCatalogBlueprintModel(de, en),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<form [formGroup]="deForm" (ngSubmit)="onSubmit()" class="form-horizontal">
<div class="form-group">
<label for="verbindlichkeit" class="control-label col-xs-6" style="font-size: 17px">Verbindlichkeit</label>
<label for="verbindlichkeit" class="control-label col-xs-6">Verbindlichkeit</label>
<div class="col-xs-6">
<input type="checkbox" id="verbindlichkeit" name="verbindlichkeit" formControlName="chbox" (change)="isChecked($event)">
</div>
Expand Down Expand Up @@ -35,7 +35,9 @@
<div class="form-group" >
<label for="qualifyingExInput" class="control-label col-xs-6">Vergleichsoperator</label>
<div class="col-xs-6">
<input type="text" class="form-control" id="qualifyingExInput" name="qualifyingExInput" formControlName="qualifyingEx">
<select class="form-control" id="qualifyingExInput" name="qualifyingExInput" formControlName="qualifyingEx" (change)="changeQualExpr()">
<option [value] = elem.de *ngFor="let elem of qualExpr">{{elem.de + ' / ' + elem.abundant.de}}</option>
</select>
</div>
</div>
<div class="form-group" >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
import {FormArray, FormControl, FormGroup, Validators} from '@angular/forms';
import {DataexchangeService} from '../../../shared/dataexchange.service';
import {Inst} from '../../../shared/inst.model';
import {Inst} from '../../../shared/blueprints/inst.model';
import {ifTrue} from 'codelyzer/util/function';
import {QualifiyingExpression} from '../../../shared/blueprints/QualifiyingExpression.model';

@Component({
selector: 'app-denfaform',
Expand All @@ -14,6 +15,7 @@ export class DenfaformComponent implements OnInit, OnChanges {
@Input() send = false;
@Output() submitEvent = new EventEmitter<FormGroup>();
modalVerbDe: Array<string> = ['muss', 'muessen', 'soll', 'sollen', 'kann', 'koennen'];
qualExpr: Array<QualifiyingExpression> = QualifiyingExpression.listContent();
constructor(private data: DataexchangeService) { }

ngOnChanges(changes: SimpleChanges) {
Expand Down Expand Up @@ -50,11 +52,14 @@ export class DenfaformComponent implements OnInit, OnChanges {
}

newMessage(event: any) {
if(this.deForm.get('chbox')){
if (this.deForm.get('chbox')) {
this.data.changeMessage(new Inst(
this.deForm.get('valueInput').value,
this.deForm.get('modalVerb').value
))};
)); }

}
changeQualExpr() {
console.log(QualifiyingExpression.resolve(this.deForm.get('qualifyingEx').value));
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<form [formGroup]="enForm" (ngSubmit)="onSubmit()" class="form-horizontal">
<div class="col-md-12">
<br>
</div>
<br>
<br>
<div class="form-group">
<label for="nameNFA" class="control-label col-xs-6">Name</label>
<div class="col-xs-6">
Expand Down
10 changes: 10 additions & 0 deletions nfafrontend/src/app/newnfa/nfatemplate/nfatemplate.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ th, td {
}
table#t1 {
background: aliceblue;
table-layout: auto;
width: 100%;
justify-content: center;
}

.bptdiv{
border-radius: 8px;
padding: 1px;
box-shadow: 4px 4px 3px #356777;
background: #56a3bc;

}
span{
font-family: 'Roboto', sans-serif;
font-size: 1.4em;
}

.bpt {
border-radius: 8px;
padding: 1px;
Expand All @@ -22,3 +31,4 @@ table#t1 {

}


16 changes: 12 additions & 4 deletions nfafrontend/src/app/newnfa/nfatemplate/nfatemplate.component.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:300" rel="stylesheet">
</head>
<body>
<div class="container">
<form (submit)="onSubmit()">
<div class="row">
<!--------Deutsch Form----->
<div class="col-md-6">
<app-denfaform (submitEvent)="receiveDataDe($event)"></app-denfaform>
<app-denfaform (submitEvent)="receiveDataDe($event)"></app-denfaform>
</div>
<!---------Englisch Form-------->

<div class="col-md-6">
<app-ennfaform (submitEvent)="receiveDataEn($event)"></app-ennfaform>
</div>
<div class="col-md-6">
<app-ennfaform (submitEvent)="receiveDataEn($event)"></app-ennfaform>
</div>
</div>

<!---Blueprint Deutsch--->
Expand Down Expand Up @@ -78,6 +82,9 @@
<div class="bptdiv col-xs-2"><span class="bpt">can</span></div>
<div class="col-xs-5"></div>
</div>



<table>
<tr>
<td>
Expand All @@ -92,4 +99,5 @@
</table>
</form>
</div>
</body>

10 changes: 8 additions & 2 deletions nfafrontend/src/app/newnfa/nfatemplate/nfatemplate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, ViewChild
import {FormGroup, FormControl, NgForm, Validators, FormArray, FormBuilder} from '@angular/forms';
import {DenfaformComponent} from './denfaform/denfaform.component';
import {EnnfaformComponent} from './ennfaform/ennfaform.component';
import {QualifiyingExpression} from '../../shared/blueprints/QualifiyingExpression.model';

@Component({
selector: 'app-nfatemplate',
Expand Down Expand Up @@ -76,11 +77,16 @@ export class NfatemplateComponent implements OnInit, AfterViewInit {

}

receiveDataEn(event: any) {
receiveDataEn(event: any) {
this.blueprintEnForm.patchValue(event);
if (this.blueprintEnForm.get('valueInput').value === null) {
this.blueprintEnForm.get('valueInput').reset('<Value>');
}
}

if (this.blueprintDeForm.get('qualifyingEx').value != null) {
this.blueprintEnForm.get('qualifyingEx').reset(QualifiyingExpression.resolve(
this.blueprintDeForm.get('qualifyingEx').value).en);
}
}

Reset() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {forEach} from '@angular/router/src/utils/collection';

export class QualifiyingExpression {
private constructor(
public de: string,
public en: string,
public abundant: QualifiyingExpression) { }

public static listContent(): Array<QualifiyingExpression> {
return [
new QualifiyingExpression('von', 'from', new QualifiyingExpression('bis', 'to', null)),
new QualifiyingExpression('zwischen', 'between', new QualifiyingExpression('und', 'and', null))
];
}

public static resolve(de: string): QualifiyingExpression {
return this.listContent().find(value => value.de === de);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class Inst {
constructor(
public wert: number,
public verb: string) { }
}
export class Inst {
constructor(
public wert: number,
public verb: string) { }
}

2 changes: 1 addition & 1 deletion nfafrontend/src/app/shared/dataexchange.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import {AsyncSubject} from 'rxjs/AsyncSubject';
import {FormControl, Validators} from '@angular/forms';
import {FormGroup} from '@angular/forms';
import {Inst} from './inst.model';
import {Inst} from './blueprints/inst.model';


@Injectable()
Expand Down

0 comments on commit ae6b310

Please sign in to comment.