Skip to content

Commit

Permalink
Merge pull request #772 from dickschoeller/591-576-notes
Browse files Browse the repository at this point in the history
Note record support
  • Loading branch information
dickschoeller authored Aug 7, 2018
2 parents 8935923 + 5a1ff60 commit cbb9064
Show file tree
Hide file tree
Showing 112 changed files with 1,258 additions and 368 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public final class GedObjectBuilder implements PersonBuilderFacade,
TAGMAP.put("multimedia", "OBJE");
TAGMAP.put("name", "NAME");
TAGMAP.put("note", "NOTE");
TAGMAP.put("notelink", "NOTE");
TAGMAP.put("person", "INDI");
TAGMAP.put("place", "PLAC");
TAGMAP.put("root", "ROOT");
Expand Down Expand Up @@ -97,6 +98,7 @@ private enum Construction {
CONSTRUCTION_MAP.put("multimedia", Construction.value);
CONSTRUCTION_MAP.put("name", Construction.value);
CONSTRUCTION_MAP.put("note", Construction.note);
CONSTRUCTION_MAP.put("notelink", Construction.reference);
CONSTRUCTION_MAP.put("person", Construction.hasid);
CONSTRUCTION_MAP.put("place", Construction.value);
CONSTRUCTION_MAP.put("root", Construction.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class NoteLinkDocumentMongo extends GedDocumentMongo<NoteLink>
*/
@Override
public final String getType() {
return "noteLink";
return "notelink";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void testCreateNoteDocument() {
@Test
public void testCreateNoteLinkDocument() {
final GedObject ged = new NoteLink();
final String typeString = "noteLink";
final String typeString = "notelink";
final GedDocument<?> gmd = toDocConverter.createGedDocument(ged);
final Class<NoteLinkDocumentMongo> expectedClass =
NoteLinkDocumentMongo.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void init() {
root.insert(note);
note.insert(name);

noteLink = new NoteLink(head, "SUBM", new ObjectId("N1"));
noteLink = new NoteLink(head, "NOTE", new ObjectId("N1"));
anonymousContext = RenderingContext.anonymous(appInfo);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void testUnsetNoteLink() {
@Test
public void testNoteLinkCobweb() {
final NoteLinkRenderer renderer = new NoteLinkRenderer(
new NoteLink(null, "noteLink", new ObjectId("N1")),
new NoteLink(null, "notelink", new ObjectId("N1")),
new GedRendererFactory(), anonymousContext);
assertEquals("Index name mismatch", "N1", renderer.getIndexName());
}
Expand Down
3 changes: 2 additions & 1 deletion gedbrowserng-frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ export class AppComponent implements OnInit, OnChanges {

private init() {
this.items = [
{ label: 'Head', icon: 'fa-cog', routerLink: ['/' + this.dataset + '/head'] },
{ label: 'Home', icon: 'fa-home', routerLink: ['/' + this.dataset + '/head'] },
{ label: 'Persons', icon: 'fa-users', routerLink: ['/' + this.dataset + '/persons'] },
{ label: 'Sources', icon: 'fa-book', routerLink: ['/' + this.dataset + '/sources'] },
{ label: 'Submitters', icon: 'fa-user', routerLink: ['/' + this.dataset + '/submitters'] },
{ label: 'Notes', icon: 'fw fa-comment', routerLink: ['/' + this.dataset + '/notes'] },
{ label: 'Save', icon: 'fa-save', command: (event: Event) => { this.saveFile(); } },
{ label: 'Pick dataset', items: [
{ 'label': 'schoeller', 'command': (event) => { this.pickDataset('schoeller'); },
Expand Down
10 changes: 9 additions & 1 deletion gedbrowserng-frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { AppComponent } from './app.component';

import {
HeadModule,
NoteModule,
NoteListModule,
PersonListModule,
PersonModule,
SourceListModule,
Expand All @@ -35,9 +37,11 @@ import {
HeadService,
ServiceBase,
FamilyService,
NewNoteLinkService,
NewPersonLinkService,
NewSourceLinkService,
NewSubmitterLinkService,
NewSubmitterLinkService,
NoteService,
PersonService,
SourceService,
SubmitterService,
Expand Down Expand Up @@ -71,6 +75,8 @@ const rootRouting: ModuleWithProviders = RouterModule.forRoot([], { useHash: tru
TooltipModule,

HeadModule,
NoteModule,
NoteListModule,
PersonListModule,
PersonModule,
SourceListModule,
Expand All @@ -85,9 +91,11 @@ const rootRouting: ModuleWithProviders = RouterModule.forRoot([], { useHash: tru
],
providers: [
HeadService,
NewNoteLinkService,
NewPersonLinkService,
NewSourceLinkService,
NewSubmitterLinkService,
NoteService,
FamilyService,
PersonService,
SourceService,
Expand Down
1 change: 1 addition & 0 deletions gedbrowserng-frontend/src/app/bases/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './person-creator';
export * from './initable-person-creator';
export * from './note-creator';
export * from './source-creator';
export * from './submitter-creator';
export * from './base-dialog';
24 changes: 24 additions & 0 deletions gedbrowserng-frontend/src/app/bases/note-creator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RefreshNote } from '../interfaces/refresh-note';
import { ApiNote, NewNoteDialogData } from '../models';
import { UrlBuilder, NewNoteHelper } from '../utils';
import { NewNoteLinkService } from '../services';

export abstract class NoteCreator implements RefreshNote {
constructor(public newNoteLinkService: NewNoteLinkService) {}

createNote(data: NewNoteDialogData): void {
if (data != null && data !== undefined) {
const newNote: ApiNote = NewNoteHelper.buildNote(data);
this.newNoteLinkService.post(this.noteUB(), this.noteAnchor(), newNote)
.subscribe((note: ApiNote) => this.refreshNote(note));
}
}

abstract closeNoteDialog(): void;

abstract noteUB(): UrlBuilder;

abstract noteAnchor(): string;

abstract refreshNote(note: ApiNote): void;
}
8 changes: 2 additions & 6 deletions gedbrowserng-frontend/src/app/bases/person-creator.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { OnChanges, OnInit } from '@angular/core';

import { RefreshPerson } from '../interfaces';
import { ApiPerson, NewPersonDialogData, LinkPersonDialogData } from '../models';
import { NewPersonHelper, UrlBuilder } from '../utils';
import { PostRelatedPerson, NewPersonLinkService } from '../services';
import { NewPersonLinkService } from '../services';

export abstract class PersonCreator implements RefreshPerson {
nph = new NewPersonHelper();

constructor(public newPersonLinkService: NewPersonLinkService) {}

createPerson(data: NewPersonDialogData): void {
if (data != null) {
const newPerson: ApiPerson = this.nph.buildPerson(data);
const newPerson: ApiPerson = NewPersonHelper.buildPerson(data);
this.newPersonLinkService.post(this.personUB(), this.personAnchor(), newPerson)
.subscribe((d: ApiPerson) => this.refreshPerson());
}
Expand Down
17 changes: 7 additions & 10 deletions gedbrowserng-frontend/src/app/bases/source-creator.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import {OnChanges, OnInit} from '@angular/core';

import {ApiSource, NewSourceDialogData} from '../models';
import {NewSourceHelper, UrlBuilder} from '../utils';
import {PostRelatedSource, NewSourceLinkService} from '../services';

export abstract class SourceCreator {
nsh = new NewSourceHelper();
import { RefreshSource } from '../interfaces';
import { ApiSource, NewSourceDialogData } from '../models';
import { NewSourceHelper, UrlBuilder } from '../utils';
import { NewSourceLinkService } from '../services';

export abstract class SourceCreator implements RefreshSource {
constructor(public newSourceLinkService: NewSourceLinkService) {}

createSource(data: NewSourceDialogData): void {
if (data != null && data !== undefined) {
const newSource: ApiSource = this.nsh.buildSource(data);
this.newSourceLinkService.p(this.sourceUB(), this.sourceAnchor(), newSource)
const newSource: ApiSource = NewSourceHelper.buildSource(data);
this.newSourceLinkService.post(this.sourceUB(), this.sourceAnchor(), newSource)
.subscribe((source: ApiSource) => this.refreshSource(source));
}
}
Expand Down
15 changes: 5 additions & 10 deletions gedbrowserng-frontend/src/app/bases/submitter-creator.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import { OnChanges, OnInit } from '@angular/core';

import { RefreshSubmitter } from '../interfaces';
import { ApiSubmitter, NewSubmitterDialogData } from '../models';
import { UrlBuilder } from '../utils';
import { NewSubmitterHelper } from '../utils/new-submitter-helper';
import { NewSubmitterHelper, UrlBuilder } from '../utils';
import { NewSubmitterLinkService } from '../services';

export abstract class SubmitterCreator {
nsh = new NewSubmitterHelper();


export abstract class SubmitterCreator implements RefreshSubmitter {
constructor(public newSubmitterLinkService: NewSubmitterLinkService) {}

createSubmitter(data: NewSubmitterDialogData): void {
if (data != null && data !== undefined) {
const newSubmitter: ApiSubmitter = this.nsh.buildSubmitter(data);
this.newSubmitterLinkService.p(this.submitterUB(), this.submitterAnchor(), newSubmitter)
const newSubmitter: ApiSubmitter = NewSubmitterHelper.buildSubmitter(data);
this.newSubmitterLinkService.post(this.submitterUB(), this.submitterAnchor(), newSubmitter)
.subscribe((submitter: ApiSubmitter) => this.refreshSubmitter(submitter));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export * from './attribute-dialog-data';
export * from './attribute-dialog-helper';
export * from './new-attribute-dialog.component';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {SelectItem} from 'primeng/api';

import {BaseDialog} from '../../bases';

import {AttributeDialogData} from './attribute-dialog-data';
import {AttributeDialogData} from '../../models/attribute-dialog-data';

@Component({
selector: 'app-new-attribute-dialog',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, Input } from '@angular/core';

import { ApiAttribute } from '../../models';
import { AttributeUtil, ImageUtil } from '../../utils';
import { AttributeAnalyzer, ImageUtil } from '../../utils';

@Component({
selector: 'app-attribute-list-item-detail-list-item',
Expand All @@ -13,7 +13,7 @@ export class AttributeListItemDetailListItemComponent {
@Input() index: number;
@Input() length: number;
@Input() dataset: string;
attributeUtil = new AttributeUtil(this);
attributeUtil = new AttributeAnalyzer(this);

constructor() { }

Expand Down Expand Up @@ -46,7 +46,9 @@ export class AttributeListItemDetailListItemComponent {
}

linkString(): boolean {
return (this.attribute.type === 'sourcelink' || this.attribute.type === 'submitterlink');
return (this.attribute.type === 'sourcelink'
|| this.attribute.type === 'submitterlink'
|| this.attribute.type === 'notelink');
}

stringOnly(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Component, Input } from '@angular/core';
import { MenuItem, SelectItem } from 'primeng/api';

import { HasAttributeList } from '../../interfaces';
import { ApiAttribute } from '../../models';
import { AttributeUtil, NameUtil, StringUtil, UrlBuilder } from '../../utils';
import { ApiAttribute, AttributeDialogData } from '../../models';
import { AttributeDialogHelper, AttributeAnalyzer, NameUtil, UrlBuilder } from '../../utils';

import { AttributeDialogData, AttributeDialogHelper, NewAttributeDialogComponent } from '../attribute-dialog';
import { NewAttributeDialogComponent } from '../attribute-dialog';

@Component({
selector: 'app-attribute-list-item',
Expand All @@ -20,7 +20,7 @@ export class AttributeListItemComponent implements HasAttributeList {
@Input() dataset: string;

displayAttributeDialog = false;
attributeUtil = new AttributeUtil(this);
attributeUtil = new AttributeAnalyzer(this);
attributeDialogHelper: AttributeDialogHelper = new AttributeDialogHelper(this);
_data: AttributeDialogData;
get attributes(): Array<ApiAttribute> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<p-panel [toggleable]="toggleable" [styleClass]="styleClass" header="Attributes">
<p-header>
<span class="bump-out">
<p-button [styleClass]="'ui-button-success'" (click)="create()"
<p-button *ngIf="showAdd" [styleClass]="'ui-button-success'" (click)="create()"
icon="fa fa-fw fa-plus-circle" pTooltip="Create attribute"></p-button>
<app-sources [parent]="this" [dataset]="dataset"></app-sources>
<app-submitters [parent]="this" [dataset]="dataset"></app-submitters>
<app-notes *ngIf="showNotes" [parent]="this" [dataset]="dataset"></app-notes>
<app-sources *ngIf="showSources" [parent]="this" [dataset]="dataset"></app-sources>
<app-submitters *ngIf="showSubmitters" [parent]="this" [dataset]="dataset"></app-submitters>
</span>
</p-header>
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { Component, OnInit, Input, OnChanges } from '@angular/core';
import { SelectItem } from 'primeng/api';

import { ApiAttribute } from '../../models';
import { AttributeUtil } from '../../utils';
import { ApiAttribute, AttributeDialogData } from '../../models';
import { AttributeDialogHelper, AttributeAnalyzer } from '../../utils';
import { HasAttributeList } from '../../interfaces';

import {
AttributeDialogData,
AttributeDialogHelper,
NewAttributeDialogComponent
} from '../attribute-dialog';
import { NewAttributeDialogComponent } from '../attribute-dialog';

@Component({
selector: 'app-attribute-list',
Expand All @@ -22,11 +18,15 @@ export class AttributeListComponent implements OnInit, OnChanges, HasAttributeLi
@Input() toggleable = false;
@Input() styleClass: string;
@Input() dataset: string;
@Input() showAdd = true;
@Input() showNotes = true;
@Input() showSources = true;
@Input() showSubmitters = true;

display = false;
index;
attributeDialogHelper = new AttributeDialogHelper(this);
attributeUtil = new AttributeUtil(this);
attributeUtil = new AttributeAnalyzer(this);

constructor() { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ import {
import { LinkDialogComponent } from './link-dialog';
import { LinkPersonDialogComponent } from './link-person-dialog';
import { NewAttributeDialogComponent } from './attribute-dialog';
import { NewNoteDialogComponent } from './new-note-dialog';
import { NewPersonDialogComponent } from './new-person-dialog';
import { NewSourceDialogComponent } from './new-source-dialog';
import { NewSubmitterDialogComponent } from './new-submitter-dialog';
import { NotesComponent } from './notes';
import { SourcesComponent } from './sources';
import { SubmittersComponent } from './submitters/submitters.component';
import { SubmittersComponent } from './submitters';

@NgModule({
imports: [
Expand Down Expand Up @@ -61,9 +63,11 @@ import { SubmittersComponent } from './submitters/submitters.component';
LinkDialogComponent,
LinkPersonDialogComponent,
NewAttributeDialogComponent,
NewNoteDialogComponent,
NewPersonDialogComponent,
NewSourceDialogComponent,
NewSubmitterDialogComponent,
NotesComponent,
SourcesComponent,
SubmittersComponent,
],
Expand All @@ -75,9 +79,11 @@ import { SubmittersComponent } from './submitters/submitters.component';
LinkDialogComponent,
LinkPersonDialogComponent,
NewAttributeDialogComponent,
NewNoteDialogComponent,
NewPersonDialogComponent,
NewSourceDialogComponent,
NewSubmitterDialogComponent,
NotesComponent,
SourcesComponent,
SubmittersComponent,
]
Expand Down
3 changes: 3 additions & 0 deletions gedbrowserng-frontend/src/app/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ export * from './attribute-dialog';
export * from './attribute-list';
export * from './link-dialog';
export * from './link-person-dialog';
export * from './new-note-dialog';
export * from './new-person-dialog';
export * from './new-source-dialog';
export * from './new-submitter-dialog';
export * from './notes';
export * from './sources';
export * from './submitters';
export * from './components.module';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './new-note-dialog.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit cbb9064

Please sign in to comment.