What is the Nikita base URL in demo mode?

Thomas Sødring thomas.sodring at hioa.no
Thu Nov 17 07:52:05 CET 2016



[Thomas Sødring]
> Hi,
>
> That hasn't been implented yet, but that is where you will get that
> information.
Ah, right.  Do you have any pointers about where in the code that should
be implemented?  Perhaps it is a good place for me to start.


Hi Petter,

The next week and a half I am snowed under with teaching and it will be
difficult to give a decent response time. In answering this question I
think I am opening a Pandoras box of questions :)

There are two things we need to consider. The first is which conformity
level the core will adhere to. This core will conform to sakarkiv.

The next thing is the technical stuff.  First we need a controller. I
added a controller that will start you off under (core-webapp):

   no.arkivlab.hioa.nikita.webapp.web.controller;


Now we need to decide how to store this information. I think we could
either store it in the database or in the application-*profile*.yml files.

1. Create domain model object called ApplicationProperties, create a
JPARepository interface, service interface and class. Then add the
relevant information to import.sql statements that can populate the
database with relevant information applicable to the profile.


1. Use properties file, application-*profile*.yml and pick up the values
from the properties file e.g

application:
  property:
    conformity: sakarkiv


In the ApplicationController class, add

@Autowired
private Environment environment;

In the ApplicationController in response to a request on "/"

You can retrieve values from the property file with this:

  environment.getProperty("application.property.conformity");

Now build up the hateoas object you wish to return.

-- end description

I am in teaching mode, so my answer here might be a little off. I find
it very difficult to go back and forth between teaching to developer modes.

To be honest, approach two is correct. Yesterday I thought approach 1
was the best approach, but it really would just be a lesson in how to
learn the spring approach to retrieving data from a database. Approach
two is easier to implement, but also easier if we wish to change the
details.

Now what are we missing in the core (from spring) for hateoas. I could
be wrong in my interpretation so don't shoot me. Hateoas seems to be in
2 projects under spring and that's what I was testing right before I
published the current version of the code. The first library is in
version 0.19.1 or something like that and it's been there for a few
years so I am weary about using it. There was another library that gave
a better approach, but it also seemed complex when dealing with this
style of hateoas and returning objects adhering to
application/vnd.noark5-v4+json format for all objects returned from the
core.

The issue I was working on was how to create a wrapper class so that any
object being returned will comply with this JSON-format and hateoas
style. Because this has to be solved for every request, it needs to be
coded in a nice way. Another issue is that e.g. datestamps need to be
converted to a textual representation, so I need a few format helpers in
the core. What I haven't decided on is whether to write my own wrapper
or figure out how to extend the spring libraries.

 - Tom




More information about the nikita-noark mailing list