002 OS OSLC Getting Started Guide (1)
002 OS OSLC Getting Started Guide (1)
On January 1, 2020, this wiki will no longer be available. More details available on our FAQ.
TRIRIGA Wiki Home You are in: IBM TRIRIGA > IBM TRIRIGA Application Platform > OSLC > OSLC Getting Started Guide
Facilities Management …
OSLC Getting Started Guide
Facilities Maintenance 2 | Updated July 1, 2015 by Andrew Melnik | Tags: oslc, tririga
Energ…
Environmental & Energ…
Page Actions
Real Estate Management
Manage…
Capital Project Manage… Table of Contents
Integrator-Publish…
CAD Integrator-Publish…
Creating Prerequisites on TRIRIGA Server
Connector…
IBM TRIRIGA Connector…
OSLC
Creating Prerequisites on TRIRIGA Server
…
▪ OSLC Getting Start… 0. Intro/Prerequisites
Performance
This guide will show you how to create and use the OSLC (Open Services for Lifecycle Collaboration) components that integrate
Platform Logging with TRIRIGA. In order to complete successfully you must have:
Portal and Navigation
TRIRIGA Server
Reporting User with access to builder tools
Reserve REST Client. For this guide I used the Advanced Rest Client which is a free application that can be downloaded to Google
Chrome
(Sc…
Scheduler Engine (Sc…
Buisness Object, Form, Query, Navigation Item
Security
While I recommend following the guide from the start, feel free to skip to “OSLC on TRIRIGA” which begins with section 6,
SSO “Creating an OSLC Resource for the BO”. Only do this if you would like to use an existing BO, Form, Query, and Navigation Item.
Styling
1. Creating a Module
System Sizing
TDI
Login to TRIRIGA and navigate to the Data Modeler.
Media Library Name your module, in this case mine is called "amOSLCTutorial", and then click “Save Module”.
Best Practices
Upgrading
Troubleshooting
UX Framework
Index
Members
Trash
Tags
Find a Tag
analysis application
availability_section best_practices
cad change_management
changes compare
compare_revisions
customizations customize
2. Create a Business Object (BO)
database db2 exchange
find_available_times gantt_chart On our newly created module click “New” and then “New Business Object”.
gantt_scheduler group
memory_footprint modifications Name your Business Object, mine is called “amRecord”, and then click “SaveBO”.
modify object_label
object_revision
operating_system oracle
performance platform
problem_determination reports
reserve reserve_performance
revision revisioning
single_sign-on snapshot space
sql_server sso support system
system_performance
tags: track_customizations
Members
Next we will add a few fields to our BO by either adding them manually or finding them from an existing BO.
The fields on the BO I used are triControlNumber (Control Number), triNameTX (Text), triDescriptionTX (Text),
triRecordIdSY(System Read Only), triRecordNameSY (System Read Only), and triNumber (Number).
After this we will add a State Transition Family. Do this by going to Tools > BO State Transition. Here you can set up or import
the State Transition. For simplicity I imported the triPeople state transition for my BO. This can be done by clicking “Import”,
“Import From Business Object”, and then selecting “triPeople” for both Module and BO, and then click “Ok” to view the state
transitions. Last we will need to click “Save”.
The last step is creating the BO Mapping which is under Tools > BO Mapping
For the mapping I set it to show the ControlNumber and then a Hyphen hollowed by Name. Feel free to set it however you would
like to though. After that is complete click “Save Mapping” and then “Publish BO”.
3. Create a Form
Click "Add Tab". Set the name, mine is called “General”, and click "Apply".
On our newly created Tab click "Add Section", name it (again mine is “General”), and click "Apply".
Now we will add the fields needed for the form. On the Section that we created click "Add Field". In the Properties window select
a Data Field from our BO and click "Apply". If you are following this guide exactly I brought in the fields triControlNumber,
triNameTX, triDescriptionTX, and triNumber. After this your form should look something like this:
4. Create Query
Click "New".
Name the query and then on the "Business Object" tab click "Add Business Object". On the form select the Module, Business
Object, and Form that we created in the previous steps and click "OK".
Click over to the "Columns" tab. Add the fields from the form (ControlNumber, Description, Name, Number) to display in
the query. Then click "Save & Close".
Next we will create a navigation item so that we can access the form and create new records.
In the "Navigation Item Editor" window name the item set the "Target Type" to "Master/Detail Default Query". In the "Form"
section select the Module and Form that we created in previous sections. The last thing to do before we save this item is add a
few actions to be able to create/edit/delete records. To do this go to the "Actions" section. For this guide I created a System Add,
System Edit, and System Delete. Now click "Save & Close".
Now we need to add this Navigation Item to a menu. Click on the menu you would like to add to. In my case I am using the
TRIRIGA Global Menu.
Click open the Navigation Items Library and search for the Navigation Item that we just created. For simplicity sake I am
just adding the Navigation Item to the Menu Group - System Setup but feel free to add it to any place that you can access. As
always make sure to click "Save & Close" when done.
Before we move onto setting up the OSLC portion we can go to our Navigation Item and add a few records.
Navigate to: Home > Tools > System Setup > Master Details - amOSLCTutorial - Record
(or where the directory that you set the navigation item to)
OSLC on TRIRIGA
Now it is time to start setting up the OSLC portion. Let's start by creating an OSLC resource for our Business Object. The
resource is data that can be identified by a URI.
Home > Tools > System Setup > Integration > OSLC Resource Manager
Click "Add".
Set the ID, Resource Name, and Title. For Namespace we will just use the prefix "spi" which has the base of
"http://jazz.net/ns/ism/smarter_physical_infrastructure#". The Namespace is used to uniquely name the fields but does not
change any logic. You can use any Namespace you would like or create your own. On the Module drop down menu select the
Module we created early. After doing this the corresponding BO, Form, and Query that we created will be available to select. In
the "Properties" section click "Import All Fields" which will set up the fields for the resource based on the BO fields. With those
imported we can click "Create" to finish the resource.
A service provider contains the resources that allow use of the resource. This will include the creation factory and query
capability that we will set up.
From here click “Add”. On the Service Provider creation form simply enter a name (mine is “amOSLCTutorialSP”) and then click
“Create”.
8. Creating an OSLC Service
Open the Service Provider that we just created. Under the “Service” section click “Add”.In the new form name the service and set
the domain to match what we set in the resource"http://jazz.net/ns/ism/smarter_physical_infrastructure#" . Click “Create”.
The query capability allows us to create a base URI that we can then use to query our resources easily.
In the service form we have up there is a section called “Query Capabilities”. Click “Add to bring up the Query Capability form.
First click “Find” on the “Resource” section and select the resource we created earlier. Once it is selected click “OK”. In the
“General” section enter a name and title. The drop down menu for “Query” should only be selected if you want to override the
query that was selected in the resource. Since we already have the query set in the resource we can leave that blank.
10. Creating OSLC Creation Factory (CF)
Creating a creation factory in our service will give us a URI which can then be used to create new records for resources.
In the service form click “Add” on the “Creation Factories” section. This process is almost identical to creating the Query
Capability. On the “Resource” section click “Find” and once again click the Resource created earlier. In the “General” section add
a name and title and click “Create”.
For this guide I will be using the Advanced REST Client which is an App that can be downloaded from the Chrome web store.
Feel free to use any client you would like to for these steps. Before continuing on please make sure to create a few records on the
TRIRIGA server that we can view.
Important Note: The commands I am running are not the same ones you will be running. The command will always start with
the URL, port, and context of your TRIRIGA server.
For example:
If I want to run a command to view the system resource page I only need to append /oslc:
http://TRIRIGAServerURL:port/context/oslc
Just replace the TRIRIGAServerURL, port, and context with the correct values for your server.
Important Note: In order to receive responses that include URI's that you can use directly with the REST Client you must first
set the OSLC_BASE_URI property in the TRIRIGAWEB.properties file. This can be found in your TRIRIGA install directory in
the config folder. Set the OSLC_BASE_URL property to http://TRIRIGAServerURL:port/context/oslc save this file and then
restart your TRIRIGA server.
The first command we will be using involves “GET” using the Query Capability that we created.
First make sure you select the radio button labeled “GET”. Then we will put in our command. In my case it is
http://triqaapp13.tivlab.usnv.ibm.com:12001/sqa/oslc/spq/RecordQC but remember the naming convention.
Click “Send” and you should be prompted to enter credentials to sign on to the TRIRIGA server. Use the same user/password
you use to login normally.
After running the command you should see that the status is “200 OK” which means it ran without any errors. Scroll down to see
the result in the Response section. Here we can see the results of the query we ran. The three members are records that I had
created. Here we see them as a resource.
We can also expand our query by using oslc.select and oslc.where. Lets say we want to just see the names assigned to our
records. By using oslc.select we can see the field values as well in our query.
Using oslc.where we can query a specific field value to return any record that makes mention of it. Let's say we want to run a
query on all records with the word “TRIRIGA” anywhere in its description. We can do this by running GET on the following
URI:
http://TRIRIGAServerURL:port/context/oslc/spq/RecordQC?
oslc.select=*&oslc.where=spi:triDescriptionTX="%25TRIRIGA%25"
Having oslc.where=spi:triDescriptionTX="%25TRIRIGA%25" will display any records that have “TRIRIGA” anywhere in the
description.
The oslc.select portion was not needed but I kept it to display the fields in the response to show how it works.
For more information on this and other advanced techniques please visit the OSLC Community which I have linked at the end of
the guide.
To view one of the specific records that was created we can do a few different things. After running the query from the previous
section there is a list of all the records of this type with their unique URI indicated by rdf:about. If we run a GET command on
any of these URI it will list the details so feel free to simply copy one of these. On Advanced REST Client you can also simply click
on the URI to set it.
Clicking “Send” will give us a response with all the information gathered about our record.
Here we can see all the fields that were defined in our resource including triNumber and triNameTX. We can also use
oslc.properties to specify which fields we want to see in the results. For example if we want to just get the triNumber field we can
run GET on
http://TRIRIGAServerURL:port/context/oslc/so/amRecordRS/20029510?oslc.properties=spi:triNumber
In order to create a new record we will have to use a “POST” command using the creation factory we set up. Before we can send
the request we must first set up the header and request body (payload).
Our header here only needs two things. The Accept field which will be used to determine what file formats the browser is trying
to get. The Content-Type field helps determine how to use the data being received:
Content-Type: application/json;charset=utf-8
The request body allows us to specify the action (State Transition) we want to perform on the record and also set the field values.
Example: {"spi:action":"Create Draft","spi:triNameTX":"Tom Tommyson", "spi:triNumber": "42", "spi:triDescriptionTX":"This
record was made using the advanced rest client" }
This would create a draft for a record with the triNameTX field set to “Tom Tommyson”, the triNumber field to 42, and the
triDescriptionTX field to “This record was made using the advanced rest client”.
While we have the status showing “201 Created” we can check to see if this record has been made with what we have specified in
the request body. One way to do this is to run the query capability again. Make sure to set the command type back to “GET” if
you are running this query.
However simply running this will show all the records and we will not necessarily be able to tell which one is the new record. So
to get around this problem we can also use oslc.select to get the exact record.
http://TRIRIGAServerURL:port/context/oslc/spq/RecordQC?oslc.select=spi:triNameTX
The results in the response show the values that I had specified.
15. Update using PUT
There is also a command called PUT which we will be using to update an existing record.
Important Note: You may not be able to update certain records due to their BO state transitions. If your record is in a read
only state then it will not allow you to update it. To change this you will have to change the state the record is in to an editable
state.
First let us get a record that is in a state that will allow us to update it. The new record we made in the previous section was
created in the draft state and therefore is not read only. You can get the URL for this record by again running the query
capability. For this simple example we will update the triNumber on the record. Our header will remain the same from the POST
command. Since we just want to update the number field we can set the request body to:
{"spi:triNumber":"24" }
This will change the number in the record (42 if you created the same record I did) to the new value 24. Make sure the radio
button has selected “PUT” before clicking “SEND”.
To confirm that the value has been updated we can run a GET command on the same URL. Simply change the radio button to
“GET” and click “SEND”. The response will now show the updated number. This can also be seen on the TRIRIGA Server where
you create and view the records for this BO.
We can also delete a record using PUT. In order to to perform this we will need to run an action that will bring the record to the
null state. Usually this will be done with a delete action. For example, to delete one of our records we will need to run a PUT
command with the request body of:
{"spi:action":"Delete"}
While it is possible to delete a record using the PUT command we can also use the HTTP DELETE operation. In order to use
delete we will set the URI to the record we wish to remove. This URI is identical to the one that you would run a GET command
to view the record.
Important Note: You will not be able to delete a record unless it is in a state where a delete action is allowed. Make sure that
the state transitions will end in the null state is delete is called on your records.
http://TRIRIGAServerURL:port/context/oslc/so/ResrouceName/specIDforResource
Another useful thing we can do on the REST Client is login to the TRIRIGA Server. When we sent the first request upon opening
the REST Client you might recall that it prompted you for your user name and password. If you want to login or switch users you
can simply run a GET command on:
http://TRIRIGAServerURL:port/context/oslc/login?USERNAME=name&PASSWORD=pass
Just set the USERNAME and PASSWORD parameters to the user/password you would login to the TRIRIGA with. These login
parameters can be ran with any request.
Another useful command we run is to check to see who you are logged in as. There is already a query capability included on the
TRIRIGA Server. It is set up in the triFriendOfAFriendSV (which can be found in the triFriendOfAFriendSP) and is called
triCurrentUserQC.
http://TRIRIGAServerURL:port/context/oslc/spq/triCurrentUserQC?oslc.select=*
The “?oslc.select=*” part is not necessary but I included it to easily see the record details returned.
https://www-01.ibm.com/support/knowledgecenter/SSHEB3/welcome
OSLC Community:
http://open-services.net/resources/
Question: there is a note regarding skipping to step #6 if the objective is to have an OSLC API for managing an existing Business Object. In my case, I'd
like to open an OSLC API for managing Real Estate Lease object, with all of the possible child records, such as Options, Payment Schedules, etc. Thus,
the objective seems to fit the bill but there is no out of the box query (I don't believe) that uses every single field in tryRealEstateLease object. So does that
leave me with having to create a custom query (step 4) which includes all of the fields for triRealEstateLease, then a whole set of queries with all of the
fields for each "child" object, such as Options and so on and so forth?