Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code template and doc for Substitutions #25

Closed
MichaelErichsen opened this issue Jun 13, 2018 · 14 comments
Closed

Code template and doc for Substitutions #25

MichaelErichsen opened this issue Jun 13, 2018 · 14 comments
Assignees
Milestone

Comments

@MichaelErichsen
Copy link
Collaborator

MichaelErichsen commented Jun 13, 2018

Robin:

here would a need to implement an agreed set of APIs to the Substitution area and they would used in the skeleton a crude placeholder module was included. That would be replaced by the full one once it had been reasonably test in its sandpit. The Substitutions area would rely on another agreed set of APIs, to built by Michael to prove the storage of the template elementes and the database retrieval of values that Laney's code wanted to use, but at the start that can be ghosted in a sandpit.

THE PROPOSED TASK FOR LANEY (Overview - more detail later if agreed)

In TMG there are namestyle templates and sentences templates where a markup means to substitute that mark with a user data derived text string. The same concept applies in HRE with a more complete set of operators and larger environment from which retrieved values may be sourced. In HRE, the use of this mechanism is extended to error and warning messages, filter definitions, sorting definitions, memos with embedded Citations, selection of columns for tabular output and later in other types of report generation.

In HRE jargon this is the Substitutions area. The definition of and the evaluation of substitution templates becomes the core that provides the flexibility for the user to configure HRE to match their workflow needs. The substitutions area directly involves about 14 database tables and some auxiliary tables for each use. case.

The task would involve the GUI to create/edit/store/evaluate the template an the code required to manage the associated database tables (via APTs defined with Michael). In the process Business Rules level would need to provide validity checks for definition editing and execution.

Much of the preloading of the lookup tables in the database and the ability to store user data for any manual or importing from TMG will rely their being agreed structures and methods from the substitution area.

INTERACTIONS with the team
MICHAEL
(1) to continue with the structure of skeleton including GUI and other BR modules as required

(2) with LANEY jointly to define APIs for evaluation of templates for each type of use of Substitutions

(3) with Laney jointly defined APIs for the storage and retrieval of data related to definition and use of Substitutions.

LANEY
(1) to build the GUI for defining/editing/managing/validating any use of Substitutions

(2) code to evaluate substitution templates and return the content to the requester

ROBIN
(1) to provide additional documentation on the internals of Substitutions and their use cases.

(2) This documentation is currently being drafted to augment what has been already placed on GitHub

(3) To liaise with MICHAEL and LANEY to ensure the intention of the data model is achieved. It is quite likely that minor changes in the field set of some tables may need adjustment.

INTEGRATION

When LANEY's code has be tested in isolation and seems robust enough, then it can be integrated into the HRE skeleton.

There are other important tasks,
(a). dates and time intervals (Java),
(b). field and record validation rules (Jython)
that can start in the same way if others wish to be come involved.

@MichaelErichsen
Copy link
Collaborator Author

The mock-up contains a functioning separation between data access,
business logic, communication logic, and user interface, which is
already implementing both running client/server and single-machine,
implementing the thoughts of Nils, and which have been tested by him. It
will of course need refinement along the way.

I will build a template for Laney and rewrite the documentation, so you
can write your part to be plugged into the skeleton. If I am lucky it
can be done in about a week's time.

@MichaelErichsen MichaelErichsen self-assigned this Jun 13, 2018
@MichaelErichsen MichaelErichsen added this to the V0.1 milestone Jun 13, 2018
@MichaelErichsen MichaelErichsen changed the title Build a template and logic for Code template and doc for Substitutions Jun 13, 2018
@RobinLamacraft
Copy link

RobinLamacraft commented Jun 13, 2018 via email

@MichaelErichsen
Copy link
Collaborator Author

MichaelErichsen commented Jun 13, 2018

Just a general comment on data formats, which in and around HRE could be XML, JSON, H2, CSV, unstructured, or Java/Eclipse preference files.

We have earlier discussed preferring JSON to XML as the trend has clearly gone this way.

For properties/preferences in the HRE application the internal representation is a properties/preferences file, which is maintained by the Eclipse platform. From the user side it is maintained in Preferences pages. So the operations and API is already provided by the platform:

http://www.myerichsen.net/HRE/Shot1.png
http://www.myerichsen.net/HRE/Shot2.png
http://www.myerichsen.net/HRE/Shot3.png

Definitions to be imported into HRE could be any format appropriate to other systems producing them.

That could be a installation configuration file, perhaps?

This what the HRE skeleton produces right now:

CSMODE=DIRECT
DBNAME=C:\Users\michael\Test1
H2TRACELEVEL=INFO
HELPSYSTEMPORT=8000
LOGLEVEL=INFO
SERVERADDRESS=127.0.0.1:8000
SERVERPORT=8001
TLS=true
UPDATESITE=http://www.myerichsen.net/HRE/update
USERID=sa
eclipse.preferences.version=1
project.0.lastupdated=2000-01-01 01:01:01
project.0.localserver=LOCAL
project.0.name=HRE
project.0.path=c:/client/temp/HRE
project.0.summary=This is the default project
project.1.lastupdated=2018-06-12 12:49:09
project.1.localserver=LOCAL
project.1.name=Test 1 Name
project.1.path=Test1.h2.db
project.1.summary=This project is the first test project, which might be useful - or perhaps not
projectcount=2

The preferences are persisted by Eclipse in

<HRE_home>\workspace.metadata.plugins\org.eclipse.core.runtime.settings\org.historyresearchenvironment.client.prefs

and are not expected to be read or written by the user.

Michael

@RobinLamacraft
Copy link

RobinLamacraft commented Jun 14, 2018 via email

@MichaelErichsen
Copy link
Collaborator Author

Hi Robin

I am not aware of such a size limitation in JSON. Is there anything which I have failed to see? The JSON support in the mock up is coded using org.json Java classes, and I don't find any limitations there.

Br. Michael

@RobinLamacraft
Copy link

RobinLamacraft commented Jun 14, 2018 via email

@MichaelErichsen
Copy link
Collaborator Author

Hi Robin

For this purpose I would choose .csv (comma separated values). First, it is directly importable in spreadsheets and other databases, and secondly, H2 includes native functionality to import and export csv. I have already implemented that in the table csv import and export functionality in the DBADMIN and now in the skeleton.

Code samples from https://github.com/History-Research-Environment/HRE--History-Research-Environment/blob/develop/HRE--History-Research-Environment/org.historyresearchenvironment/bundles/org.historyresearchenvironment.client/src/org/historyresearchenvironment/databaseadmin/parts/H2TableNavigator.java:

final Csv csvFile = new Csv();
csvFile.setFieldSeparatorWrite(",");
csvFile.write(fileName, rs, "UTF-8");

and

final H2TableProvider provider = new H2TableProvider(tableName);
rowCount = provider.importCsv(fileName);

Br Michael

@RobinLamacraft
Copy link

RobinLamacraft commented Jun 14, 2018 via email

@MichaelErichsen
Copy link
Collaborator Author

Hi Robin

I only suggested csv for database and table import and export, using H2 features.
For properties I would suggest java properties files.
As you can see above I am using two levels for project definitions. Such a naming scheme would also fit three levels.

Br , Michael

@MichaelErichsen
Copy link
Collaborator Author

Have started pulling the parts for a sample together.
Added a menu item to start the embedded HRE server.
Added a sample H2 VIEW definition in the NewDatabaseProvider class.

@MichaelErichsen
Copy link
Collaborator Author

Class SampleView in package org.historyresearchenvironment.dataaccess generated from H2 VIEW using JPA.

@MichaelErichsen
Copy link
Collaborator Author

Finished and uploaded to Github.

@MichaelErichsen
Copy link
Collaborator Author

Will be uploaded as build 0.1.0.201807152107

@MichaelErichsen
Copy link
Collaborator Author

Closed with build 0.1.0.201807160730.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants