Experienced Java Developers (Eclipse, EGit and Maven) could simply execute the Short Installation Guide Extension-002 to run the sample web application described in this blog.

This blog describes how you get the Extension-002 code sample “Preload Data Sample Web Application” running on your development Environment.

1.    Check Prerequisites in below section 1

2.    Get a short overview of the Extension-002 Preload Data Sample in below section 2

2B.  Find changed Files of any Extension sample compared to original PersonsList Application

3.     Download Extension-002 code sample, import projects and run application in below section 3


1. Prerequisites

  1. You have read before SAP HANA Cloud Code Samples – Extensions of PersonsList Web Application
  2. You have executed the HANA Cloud Platform (HCP) Getting Started tutorial Building your first end-to-end SAP HANA Cloud “PersonsList” Web Application Scenario before, so that you can run your developed PersonsList Web Application on your HCP Development Environment.

        Make sure you have

    • Downloaded the newest available version of this tutorial (currently this is v-1.4.2)

2. PersonsList Extension-002 – Preload OData CRUD Sample Web Application

The PersonsList Extension-002 sample demonstrates how the PersonList Web Application could be extended to have preloaded Data.

1. PersonsList Extension-002 – Application UI

The PersonsList UI has not been changed but if you run the Extension-002 application and launch it in a Web Browser you will see right from the beginning two displayed person entries: John Smith and List Gordan as shown in the the following screenshot

/wp-content/uploads/2014/01/6_371399.png

2. PersonsList Extension-002 – Changed Code and Implementation flow

If you want to know exactly which files were changed in Extension-002 compared to the original PersonsList then execute below section 2B before continue.


In short: preload data implementation flow

a) Added StartupServlet.java and changed web.xml in personslist-web project

StartupServlet.java is registered in web.xml to be called on startup. When the servlet is called it calls the loadData() of the also added DataLoad.java and passes the EntityManagerFactory.

b) Added DataLoader.java, XmlParser.java and persons.xml in personslist-model-jpa project

DataLoader.java creates via the passed EntityManagerFactory emf persons entities by calling loadPersons() method. The persons to be created are specified in persons.xml which is read out in the loadPersons() by means of the XmlParser.java method readPersons().


2B. Find changed Files of any Extension sample compared to original PersonsList Application

If you want to know which files and which contents were changed by any Extension sample application (or any other Extension) compared to the original PersonsList web application from the basic tutorial, then you can execute the below steps.

The steps describe how the Eclipse History view is used to compare changed sources of a Git repository (here cloud-personslist-scenario)

In the screenshots we assume that you have executed PersonsList tutorial and checked out Extension-002 branch and imported the corresponding personslist-repo projects.

1. In the Eclipse main menu

a) Choose Window > Show View > Other…

b) In the opened Show View dialog choose Team > History

c) Then choose OK to open the History View

/wp-content/uploads/2014/01/1_371154.png

The opened Eclipse History view is initially empty

/wp-content/uploads/2014/01/2_371155.png

2. Connect History view with cloud-personslist-scenario Git Repository to display related History contents.

a) Enable in the History view toolbar the Link Editor and Selection icon (1.)

b) Then select in Git Repository view the cloud-personslist-scenario node (2.)

As a result the related commits history of the personslist Git repository is displayed in the History view  (3.)

/wp-content/uploads/2014/01/3_371251.png

The Local Git branches in Git Repositories view corresponds to the green boxes in the commits (i.e. in Git terminology source changes) history as indicated by the green lines in the above screenshot. The green box in the commit history (aka. commit “chain”) which name is marked bold corresponds to the checked out Local branch. In our case this should be the Extension-002-v1-4-0 branch.

3. In History view

a) Select the green box with name Extension-002-v1-4-0 to display the corresponding changed files in the lower right area of the History view as shown in the following screenshot

/wp-content/uploads/2014/01/4_371308.png

Now you can see a list of all files which have been changes in the Extension-002 sample application compare the original PersonsList application from the basic tutorial (which sources are part of the master branch – see green box):

From this list of changed files you can see that in the Extension-002 sample there have have been 3 files changed in the personslist-model-jpa project: DataLoader.java, XmlParser.java and persons.xml (these files were added as you can see from the icon in front of the file name)

And in the personslist-web project there were 5 changed files: StartupServlet.java (added) and web.xml, personslist.controller.js, PersonsListIT.java and PersonsListPage.java (all changed, i.e. they were already part of the original PersonsList master branch)

Displaying the changed content

b) For comparing source changes ensure, that you have imported the related personslist projects into Project Explorer (1.)

c) Then select in history view the changed file (e.g. web.xml as in the next screenshot) (2.)

d) On the selected file open context menu and choose Compare with Version in Ancestor (3.)

    (the ancestor in the commit chain of branch Extension-002 is branch master, so you compare source changes of Extension-002 compared to master)

e) The compare editor opens (4.) and you can quickly see what changed in Extension-002 (which is on the left side of the editor) compared to before version (which is displayed on the right side of the editor)

/wp-content/uploads/2014/01/5_371364.png

With this you have the means to look at all source changes you want to know about when using any Extension sample of PersonList web application.

3. Download Extension-002 Code Sample, Import Projects, Run Application…

If you don’t know already how to do this, then you should execute the described steps of section 3 of SCN blog PersonsList Extension 001 – UI5 OData CRUD Sample Web Application (and replace always Extension-001 with Extension-002).

4. Feedback

I really appreciate your feedback regarding this code sample.

Please add your comments below.

Thanks,

Jens

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Norbert Noupa

    Hallo Jens,

    Ihr Tutorial bin ich in Ihrem Totorium vorgefunden,und ich habe eine Frage: Ist es möglich die Daten,was man in Odata speichert,durch Views(analytic,…) zu sehen ??

    Grüß

    Norbert

    (0) 

Leave a Reply