Welcome to the OPA Hub!

Archives

Guest Post : Object-Oriented Design Patterns and Oracle Policy Automation

Guest Post : Object-Oriented Design Patterns and Oracle Policy Automation

In a previous post by our guest writer Dr Jason Sender, he investigated improvements in Oracle Policy Automation rules by applying some of the principles of refactoring. Hopefully the short examples he gave revealed some of the increases in readability, maintenance and flexibility that you can build into your rules.Now, in the second article in this series, Dr Sender looks at Object-Oriented Design patterns and Oracle Policy Automation. This article draws on the work and publications of Martin Fowler, which we discussed in the previous post, and those of Joshua Kerievsky from his highly regarded book “Refactoring to Patterns”.

Design Patterns

Kerievsky makes two very important observations on design patterns. His first point is that, as he terms a section heading, “There are many ways to implement a pattern.” (Kerievsky, p. 26). This is key to what we shall see in this article, since with Oracle Policy Automation we should be aiming at implementing the core concept of a given design pattern, rather than strictly following the implementation example given in GoF (1995).

Design Patterns: Elements of Reusable Object-Oriented Software is a software engineering book describing software design patterns. It has been influential to the field of software engineering and is regarded as an important source for object-oriented design theory and practice…The authors are often referred to as the Gang of Four (GoF) (Wikipedia).

The second key point that Kerievsky (p. 32) makes is that: “In general, pattern implementations ought to help remove duplicate code, simplify logic, communicate intention, and increase flexibility. However…people’s familiarity with patterns plays a major role in how they perceive patterns-based refactoring.” So we see here both our aims in using design patterns, and a constraint (developer knowledge). Since OPA does not have objects and classes in the same sense as an object-oriented language, we should not expect a straightforward application to OPA.

In this article we will focus on one single pattern, known as the Adapter pattern.

Summary: “Convert the interface of a class into another interface clients expect.
Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.” (GoF, p. 139)

Let’s look at applying the Adapter pattern to Oracle Policy Automation rules.  At one level, translation is possible; Oracle Policy Automation can translate all its attributes into another language so that the rules can be used once and deployed in multiple languages just by translating the variables, statements, and similar features, while not rewriting the rules. This example from Oracle (2016) demonstrates this:

Guest Post : Object-Oriented Design Patterns and Oracle Policy Automation

As a second example, we can make a variable equal to another variable, or a Boolean true if another Boolean is true. For example:

Guest Post : Object-Oriented Design Patterns and Oracle Policy Automation 2Here we have adapted the ‘the sky is blue’ to ‘the sun is shining’ (but not vice versa) and adapted ‘the value of the car’ to ‘the value of the vehicle’ (but not vice versa). It might be thought that this is pretty simplistic and not all that useful. The following example highlights more complexity, and, instead of simply adapting the interface, as the above examples do, it goes beyond that to override some of the adaptee’s behaviour:

Guest Post : Object-Oriented Design Patterns and Oracle Policy Automation 3

Here we have adapted the interface from ‘the storey of the building’ to two different interfaces, ‘the lift floor’ and ‘the elevator floor’. British lifts start at 0 (or G) and US elevators start on the 1st floor and do not have a 13th floor. So not only have we changed the interface, we have adapted the behaviour. The new variables can be used elsewhere in the policy model in place of the original one.

Object-Oriented Design Patterns and Oracle Policy Automation : Adapter Pattern Summary

The Adapter pattern seems “made for OPA”. When discussing the Adapter pattern the GoF (p. 142) stress that:

“Adapters vary in the amount of work they do…There is a spectrum of possible work, from simple interface conversion – for example, changing the name of operations – to supporting an entirely different set of operations.”

The examples shown in this article illustrated three aspects:

  • The first adapted the language that users would see
  • The second was an example of changing the name of an operation
  • The third supported a different operation but was also an Oracle Policy Automation-specific variant of what the GoF (1995) term “two-way adapters”, since it adapted two variables from one underlying one.

Each of the three examples has different costs and benefits. The language translation tightly couples the adaptee and adapter, while the changing of the name allows for the other variable to change how it is derived without changing the adapter (i.e., a level of indirection).

It is important to note that the one-way variable name change or Boolean name change simply allow a new term to be used, but these might very well be used in more complicated ways in rule tables (for variables) or rules (for a Boolean) where the adaptee’s value equalled the adapter’s value only in certain circumstances. The two-way adapter allowed for a single variable to be used to provide multiple adapters, thus minimizing code duplication.

The Bigger Picture

It’s worth stepping back at this point to understand the broader context.  Computer science is often defined as dealing abstraction, and software engineering as managing complexity, and the connection is that only by considering different parts of programs and systems as abstract concepts are better able to manage complexity.  For example, Oracle Policy Automation is often integrated with other systems that the Oracle Policy Automation  developer does not need to understand, and can think of in the abstract, like the database that Oracle Policy Automation may interact, but which the Oracle Policy Automation developer may not need to know anything about beyond mapping attributes in Oracle Policy Automation.

So abstraction is about ignoring irrelevant details, and this is accomplished by what is often the theme running through many design patterns, which is to: “encapsulate the concept that varies” (GoF, p. 54).  We often obtain abstraction in Oracle Policy Automation by using indirection (interposing an intermediate attribute) to encapsulate the attribute that varies.  This allows us to “Program to an interface, not an implementation“, as the GoF (p. 18) term it, the rationale for which is that the implementation can be changed if other parts of the program only depend on the interface.

Once again, even from a very simple set of examples, it should be clear that Oracle Policy Automation rules will benefit from the targeted application of principles from programming – in this case Object-Oriented Patterns. The best approach is not a slavish application, rather a pragmatic use of those best-suited to the unique nature of the Oracle Policy Automation platform.

For more information about the ideas discussed in this article about Object-Oriented Design Patterns and Oracle Policy Automation, Dr Sender can be reached using his LinkedIn profile, below. Look out for more articles about Object-Oriented Design Patterns and Oracle Policy Automation coming soon!

Getting Started with Oracle Policy Automation 20018 Edition

Snap Poll : Training – 1 Question, 30 Seconds and a Chance to Win

Snap Poll : Training – 1 Question, 30 Seconds and a Chance to Win

As you all know, the OPA Hub Website tries to provide content and services that meet the needs of all of us who are working with Oracle Policy Automation, and probably Oracle Service Cloud or Oracle Siebel CRM on a day-to-day basis. One of the areas we have been looking at with our partners and content providers is the subject of training. We have a number of different training projects in the pipeline. But read on to find out about our Snap Poll : Training – 1 Question, 30 Seconds and a Chance to Win…

Some of the training we already provide has met with good feedback and seems to fill a gap left by the official training provider. However, we are always eager to find out more. That is why this post contains a snap poll : it is so easy to answer the question it will take you all of 30 seconds. You can register your vote using either an anonymous vote or if you use your OPA Hub Website login you will automatically be entered into a draw to receive a free copy of the Getting Started with Oracle Policy Automation 2018 Edition.

Snap Poll : Training - 1 Question, 30 Seconds and a Chance to Win

This book is so new it is not even in the shops yet, I have just received the first copy from the printers so it is fresh as fresh can be. The book can therefore be yours just for entering our Snap Poll : Training – 1 Question, 30 Seconds and a Chance to Win!

Thank you to everyone who takes part in the spirit of sharing your opinion. The data will be reviewed on the OPA Hub and will be completely anonymised. The name of the voters will only be used to ascertain the winner of the free copy of the book!

What kind of advanced OPA training would you be interested in attending?

Oracle Policy Automation / Siebel : Live Classes in Toronto in February

Oracle Policy Automation / Siebel : Live Classes in Toronto in February

I wanted to tell you about the following events that I am hoping to run as in-class sessions in Toronto. Our friends at DesTech Toronto are hosting the following training events in February. I’ll be delivering them both so I would be very happy to see my Canadian colleagues and friends for these training sessions. Here are the details of the Oracle Policy Automation / Siebel : Live Classes in Toronto in February 2018:

Both of these need just a few more enrolments to confirm they will happen. I figure that a live class with a live instructor will be more effective for OPA customers and colleagues, as opposed to a virtual class. I’m happy to chat about OPA, OSVC, Siebel or anything else (ERP, AI, Bots 🙂 )

If you would like to enrol anyone on these courses, please let Patrice Brown pbrown@destech.com know urgently. I’m counting on you to spread the word!

PS : Every student will get a free copy of my Getting Started with Oracle Policy Automation [2018 Edition] with my compliments. That’s a CAD 65 gift for each attendee.

Custom JavaScript Extension Places and Custom Options List

Custom JavaScript Extension Places and Custom Options List

This is the last in the series of posts about Google Maps and Oracle Policy Modelling for now. I’m conscious of the fact that there are lots of people out there who have more knowledge in JavaScript than I have, so I don’t pretend to provide anything more than “sketches” or “ideas” or “rough hacks”. But I hope you enjoy them anyway. This last post is all about a Custom JavaScript Extension Places and Custom Options List. We will use the basic principles of the previous examples and extend :

  • Display a Map
  • Geocode and Mark
  • Show an Infowindow
  • Find places in a certain radius
  • Display them in a Custom Options list

And this time we will use the Places API to get a list of information from Google, before displaying it in the Screen and using the information. Here is the scenario:

  1. You have a problem (fire, accident, police or flood or what have you)
  2. You are at a specific location (geolocalised)
  3. You need a list of people who can help (for example, a list of car repair workshops, or fire stations, or whatever).

This might fit into the scenario of an assistance company which wants to help you, by pointing you to the nearest garage or hospital or whatever. This uses the Google Places API. When you search it, you get a list of places – garages, hospitals or whatever. You set the starting location, define the radius in metres, and the type of search. The results come back as a list of places, which you can parse and add to your Oracle Policy Modelling screen as a Custom Options list.

So here is the lowdown.  The key to the Places search is in the request, as shown below:

var latlngnew = {
 lat: interview.getValue("cl_lat"),
 lng: interview.getValue("cl_long")
 };

var request = {
 location: latlngnew,
 radius: '50000',
 type: [interview.getValue("cli_search")]
 };
 var service = new google.maps.places.PlacesService(map);
 service.nearbySearch(request, callback);

In the example above you will note that there is an Oracle Policy Automation attribute value to define the type. For example, the “accident” option in the first screen:

OPA 12 - Custom JavaScript Extension Places and Custom Options List 1

Google Maps API Places Search uses type to distinguish what to look for. The mapping I made is just for fun, but bear in mind you might not find a single type that meets your needs, or you might not find any kind of match at all. The 50,000 is the number of metres for the search radius. You might get that from another attribute in Oracle Policy Automation, of course. Plus of course, there are the two attributes in which we have captured the latitude and longitude sent by the Browser.

In the callback function, we receive (hopefully) some results for our Custom JavaScript Extension Places and Custom Options List. The results are tidied up a bit, since the Oracle Policy Automation Custom Options Extension wants text and value properties (in case you want to have display values that are different from the actual values that will be stored in the receiving attribute). Finally the result is passed to the interview.

Custom JavaScript Extension Places and Custom Options List 2

Over in the Custom Option JavaScript file, we just need to grab the data from the Places API and display it as a searchable combo.

OPA 12 Custom JavaScript Extension Places and Custom Options List 4

So the end result of our Custom JavaScript Extension Places and Custom Options List exploration is that the list of providers displayed is based on the type of problem, and the location of the device. So hopefully the list of suppliers / fire stations / hospitals / police stations or whatever is pertinent.

As usual the very unpretty code, for entertainment purposes only, can be downloaded from the OPA Hub Shop. The next few blog articles are going to be on very different subjects than the JavaScript extensions, but I’m sure we will come back to these concepts often. Have a great day!

NB : Remember to test this using your favourite real Browser, not the embedded Browser : run the Debug with Ctrl+F5.

JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding

JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding Input

What is it about Google maps? This little example of a JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding was often requested by customers and students alike. Whether it be in the Siebel Hub or the OPA Hub Websites, Google Maps always seems to be a popular topic!  When I did a Google maps customlabel in Oracle Policy Modelling a few months ago, it was one of the most downloaded examples we have ever had.

JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding

And so, all I have decided to revisit the example.  This time however we will create a custom input control, and the user will click on the map to show where they are located.  These might be useful in an emergency situation, or something far more mundane such as simply be able to say what your address is, quickly.

To do this, we’re going to use the Google Maps JavaScript API once again.  We will use the same functionality as before, with new twists:

  • Marker on the map to display their browser-reported location (seen previously)
  • Information window to display text  (seen previously)
  • From the latitude and longitude obtain the Street Address
  • The possibility to drag the marker to another location if incorrect 
  • A button to confirm the selection of the address
  • The chosen the address will be passed to an attribute in the  Project

In this example therefore, we will need to use reverse geocoding.  Specifically, we need to convert the latitude and longitude into an address.  Using this Google service will normally provide us with a close match.  There may be multiple matches, or indeed no match at all.

For simplicity we will only handle the case where at least one match is found, and we will take the first match which is typically the closest.  We will not look at the other cases where there are multiple choices.  We are reserving that for another post in a little  bit!

In the example provided, which is as usual for education and amusement purposes only, the information from Google goes to our interview and is passed into an attribute.  Of course, what happens after that, it’s you that decides!

To keep things simple, the initial part of the script is the same.  We use your location to plant the marker on the map.  The exact icon used, depends entirely on what you chose in the interview : we used a simple example where the user declares an accident or a fire or some other emergency.  The marker is planted on the map. Then we introduce drag and dragend handlers, as well as a click handler.

The first page of the Interview is shown below.

JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding 1

Then we have a typical page displaying only a single Input Control for our demo.

OPA 12 - JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding 5

Our code will handle a few events. The marker click handler will display the address of the location in an infowindow. The drag and dragend handlers manage the user dragging the marker to a new location: maybe they didn’t get it right first time, so we let them do it again.

JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding 2

The two main functions in this code are the confirm_my_address function, which lets the user click a button in the marker and pass the address to Oracle Policy Automation to confirm that the marker is in the correct location, and the geocodeLatLng function, which does exactly what it says.

JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding 3It takes the latitude and longitude of the marker and queries Google to find the address of the marker before it is pushed to our attribute.

JavaScript Custom Extension Google Maps for Addresses and Reverse Geocoding 4

Because it doesn’t always work, we also have to manage the situations when had no address is returned. In this case we handle it with nothing more than an alert, which is fine for our little test. Regarding geocoding and so on you can find much more information of course on the Google Maps JavaScript API Documentation page.

Enjoy the video and if you are interested, you can download the code example for free, with no warranties and just for fun, from the OPA Hub Shop as usual. Remember to use Ctrl+F5 to run it in a real browser.

JavaScript Extension Custom Header as a Timer in Oracle Policy Modelling

JavaScript Extension Custom Header as a Timer in Oracle Policy Modelling

Sometimes I get distracted. I was supposed to be preparing for a workshop last night on an unrelated, Siebel-centric topic. I happened to be reading (again) through some material on our sister site, https://siebelhub.com, and I came across an example – which I have always been impressed by – from Duncan Ford, one of the Siebel Open UI and JavaScript gurus who contributes to the Siebel content on our blog. And it got me thinking about and Oracle Policy Automation JavaScript Extension Custom Header as a Timer.

The basic tenet of the script was building a set of statistics for timing performance : how long did such and such a page take to load and be ready, in a sense. In Siebel-world, this is a constant worry and ongoing process. So I got distracted by this and thought about Oracle Policy Automation and how we might use some of the ideas in our own script. I settled on the basic principle that I would want to know about how long it took people to finish a given Screen (ultimately you could extend it to the Stage concept as well). So not directly about performance, more about user time.

To do this, I figure we already have a bucket-load of exciting charts from the Hub :

JavaScript Extension Custom Header as a Timer

You know the sort of things I mean, available for each project : you can grab a set of information about a Project, change the type of chart, decide how to split the axes, decide which version to look at, filter on Service Cloud criteria and number of days and so forth.

These are great  tools. Of course, you also might have the mindbogglingly powerful In-Memory Policy Analysis with TimesTen and so on.

But you might not have any of that to hand, and you might want to work out how much time, each person spends on each Screen. Of course the navigation paradigm in Oracle Policy Automation is different to a Customer Relationship Management application like Siebel – you can go back and forth between the Screens quite a lot. All I really want to do in this case – because it was useful to me – was to identify the cumulative time spent on each Screen, and display it in the Browser at the end of the Interview:

JavaScript Extension Custom Header as a Timer

It sounds really easy but there are a couple of things that will be interesting to talk about along the way.

JavaScript Extension Custom Header as a Timer in Oracle Policy Modelling  – Data

I decided to choose the customHeader as my starting point. The documentation states that this renders the header for an interview. So by logical extension it probably has the things we might need :

  • Access to the Interview Object
  • Access to the Stages and Screens in the Stage
  • Adding code that does not implement any UI probably won’t cause a problem, since the UI does not have to display a Header (it’s an option in the Styles dialog)

For the second part of the requirement, the display of the results, I decided to use the customLabel approach with jsGrid, similar to the example back in December of last year.

So I knew I would need 2 files, one for the custom Header and one for the custom Label. Since the results would only display on the last page (“Interview Complete”), I wanted to be able to pass the results from the Header to the Label easily. So how did the JavaScript Extension Custom Header as a Timer in Oracle Policy Modelling work out? Well, as usual I was just experimenting so it is rough, ready and not very robust. But it is interesting enough to provide some talking points. Let’s look at the code for the Header first.

First the opening salvo of the customHeader:

JavaScript Extension Custom Header as a Timer

  1. We are going to store results in an array of JavaScript objects. This is similar to how the actual Screens are accessed in the Interview, and also it allows us to plug the data straight into the jsGrid component.
  2. So here is the Array
  3. I’m loading the set of Screens here. Be aware, that the Screens you load will only be those in the current Stage. So our myScreens array will be used to store (as you navigate) all the screens in all the stages, to have only one big array when you have finished.
  4. I’m checking in my Array of Objects to see if the Screen we are on has ever been visited : is it in my Screens array?
  5. If it is in my Array, this is not the first time you have been on the Screen in question. We update the information about the Screen in the Object, calculating the elapsed time using a very rough and ready technique.

JavaScript Extension Custom Header as a Timer

Here is the rest of the script, which I have split out into a second part for readability.

  1. If the Screen is not in myScreens, then it is a new Screen. We add it and set up the basic information.
  2. We hook our myScreens array to the Interview object.

JavaScript Extension Custom Header as a Timer in Oracle Policy Modelling – Label

Over in the Label code, the process is very familiar:

JavaScript Extension Custom Header as a Timer 5

  1. Create a custom DIV on the final Screen using the Custom Property “name” to make sure we only execute on the label we are interested in. Get a reference to our myScreens array.
  2. Spawn a jsGrid from the DIV (which implies of course that jQuery and jsGrid files are in the /resources folder of your Project).
  3. Build the field object, noting that you can format the fields, or add / remove fields as you see fit from your array of Objects.

So if all goes according to plan you might get something like this. Note that the whole thing only works if you navigate normally – that is to say you navigate using the navigation Buttons or stage Buttons. Using the Debugger tree on the left does not have the same effect at the array will be empty. The array will also be empty if you do not reset between each debugging session. Once deployed, there should be none of those issues of course, or you could Ctrl+F5 to debug in Chrome or your favorite browser.

OPA 12 - JavaScript Extension Custom Header as a Timer in Oracle Policy Modelling 6

This being a bit of an experiment, I didn’t go much beyond 5 screens in 4 different stages, nor did I add any events to time the Stages, or to time Controls  – such as “on Focus” and “on Blur” which I thought about doing to be able to get the times in and out of individual controls and which I might do at some point.

JavaScript Extension Custom Header as a Timer – Conclusion

Anyway I hope the ideas, if not the implementation, have given you some pause for thought – namely how to get the Screens and Stages and load them into your own Array, and pass them to other Controls. The experimental code is on the OPA Hub Shop, search for customHeader.

Have a nice day!

Signature Control Oracle Policy Automation JavaScript Extensions

Signature Control Oracle Policy Automation JavaScript Extensions

Here at the OPA Hub we have already gotten back into gear after the holidays and in fact next week we will be off to Finland for some exciting OPA-related things but in the meantime, here are some thoughts about the Signature Control. Actually it is not just about the Signature Control. Rather, in this post, we want to look at some ways of extending the unextendable. If you check out the documentation regarding the Oracle Policy Automation JavaScript Interview Extensions, the Signature Control is not in the list (except for the styling possibilities- there are no extension capabilities). So what if you need to change it’s behaviour? Can we invent Signature Control Oracle Policy Automation JavaScript Extensions?

Of course I can hear you say that the likelihood of wanting to use the Signature Control Oracle Policy Automation JavaScript Extensions is small : after all we should never be using the JavaScript extensions to do anything too crazy (remember the guidelines at the bottom of this page). What on earth would people want to change for the Signature Control – or indeed for any Control that is not currently listed as having that capability?

Well, here is a simple example :

Signature Control Oracle Policy Automation JavaScript Extensions

The Signature Control is not responsive. Of course I could tell my phone and tablet users to zoom in or out, or switch orientation. But I don’t want to. Look, I’m just trying to make a point. Customers will always come up with things that we might not expect, and the Signature Control will be no exception.

The width of the control is fixed, by the parameter entered at Design Time :

Signature Control Oracle Policy Automation JavaScript Extensions

Since we cannot extend the behaviour of the Signature, maybe we need another approach. Let’s look at some useful things we came across while researching this article.

  1. The most obvious way to extend the Signature Control is to add a blank Control to the Interview that can be extended, and leverage the keys (mount, unmount and so on) of that Control to work on the Signature. In the case shown below, a blank Container has been added to the Interview for that purpose. It has a custom property to help identify it in the JavaScript later, like most of the examples shown on this site and elsewhere.

Signature Control Oracle Policy Automation JavaScript Extensions

2. Secondly, We should be aware that the value set at Design Time for the Signature Control width (and a lot of other useful information about your Interview) can be referenced in JavaScript :

var currentWidth = interview._session.config.interviewProperties["signature-width"];

This might be useful for some sort of fallback or default value.

3. Thirdly we should be good citizens and not forget that the styling options in Oracle Policy Automation do give us a fairly broad range of options without resorting to JavaScript code. For example:

Signature Control Oracle Policy Automation JavaScript Extensions

In the above example, we use the styling capabilities of the Signature Control to change the ink colour, and we apply a CSS style to the Control as a whole. With that in mind, we can leverage media queries in the CSS to establish different sizes of display for different users:

In the example CSS below, the outline (the border) of the Signature can be changed depending on the size of the viewport / screen that the user is holding. Smaller viewports will use a one pixel border, larger ones will use 2 pixel. It’s a simple example.

4. The Signature Control might only need extending during the mount or unmount process – which makes a Container Control a good choice. For the update we will simply leave that blank since there is nothing on the Signature Control we want to work with.

The client didn’t like that funny dotted line you get when you need to sign the signature panel. Using our newly added Class, we can select the siblings of the Signature and remove the line:

var myDiv = $('.eca-signature');
var myLine = $("canvas.eca-signature").siblings();
myLine.hide();

Signature Control Oracle Policy Automation JavaScript Extensions

5.  We might also use jQuery to add a resize handler to the Interview window, and based on that we could resize the Signature to a certain degree. We can also trigger the resize handler when the window is first shown, to make sure our Signature Control is always presented in the right size. And that opens up a world of opportunities.

So what does all this give us? The following video shows some of the results. This is just a scratchpad idea – so as usual the example is given with no warranties. You can get the example code from the OPA Hub Shop by searching the code examples for Signature Control.

Signature Control Oracle Policy Automation JavaScript Extensions – Summary

It’s a work in progress, but piggybacking on top of an extendable Control like the Container (which is also pretty much invisible, which is a bonus) let’s us imagine all sorts of trickery on the Signature Control. Plus, as good citizens we have learned along the way of some interesting standard styling and customization.

In the example code there are, as usual, a number of console logs as well as some experimental code that probably does nothing : as I always say, this is for educational purposes!

Magia Consulting are hiring

Friends of the OPA Hub Website Magia Consulting are hiring!

Leona Chauban, Director at Magia Consulting  got in touch to let us know.

“Magia Consulting is an innovative solution provider and consultancy in the technology industry, and our people are amongst the industry best in our field of expertise, who are embracing our journey of global expansion. As a team, we pride ourselves in our technical expertise and delivering excellence in our products, services and training. We are interested in speaking with talented, intelligent individuals with an aptitude for technology, who take pride in delivering customer value and have a “can do” attitude.”

The different career options are outlined below. You can directly apply from the relevant page. Hurry because not only will there be lots of applicants but the closing dates are coming up soon:

Sales Executive – Enterprise Software & Services

Magia Consulting are recruiting a full time Sales Executive to join our expanding UK based team. The role is offered on a permanent basis, and presents an exciting opportunity for a highly ambitious sales manager or business development executive to be involved in growth of an innovative organisation in the EMEA market.

The position involves collaborating with a skilled team to identify leads, secure opportunities and generate sales in licenses, consulting and support contracts.

This is a key role for Magia and the Sales Executive will report directly to Company Directors. Magia are offering the unique opportunity for a commission structure that is uncapped, so that when a candidate excels, they will rewarded accordingly. Magia also offer equity options for employees.

The role is London/South East based with travel as required within UK/EMEA.

Read More and Apply…

Oracle Policy Automation (OPA) consultant

Magia Consulting are recruiting an Oracle Policy Automation (OPA) consultant to join our expanding UK team. The role is offered on a permanent basis, and presents an exciting opportunity for the best and brightest to join an established consultancy on the verge of further global growth.

Good working knowledge of Oracle Policy Automation is required as a starting point, with training and support provided to advance your skills to expert level.

The role is based in Midlands with potential travel to client sites in other parts of the UK and EMEA.

Magia Consulting offer employee equity options, training, and the rare opportunity for a potentially varied role that will engage the smartest mind.

Read More and Apply…

Custom Entity Container JavaScript Extension Example #3

Custom Entity Container JavaScript Extension Example #3

Custom Entity Container JavaScript Extension Example #3

By now most of you will have realised that as far as JavaScript goes, I am a bit of a generalist. As one wise person once put it “the kind of person who can code themselves into a mess but not out of one”. I learn by exploring and doing. I’ve been “doing” for a long time (I started with a ZX 81 and pretty much kept mucking about from there). My first ever big IT project was replacing IBM 5520 word processors with Windows 3, Word and a custom application written using Visual Basic.  I get kind of obsessive about understanding the “big picture” without necessarily wanting to have every detail. And so it is with Custom Entity Container JavaScript Extension Example #3.

All that to explain what I have mentioned before : everything in relation to JavaScript which I offer to you here is purely for entertainment or educational purposes : many times I have to sketch out a need or specification, and what you see on this blog relating to Oracle Policy Automation JavaScript extensions is just the results of some head-scratching or an idea that I have needed to show to someone more technical than myself to be “tidied up” (a.k.a professionalized).

The reason I mention it is because I often work in Siebel CRM (visit www.siebelhub.com the other site in this family) and JavaScript is a big part of moving forward with Siebel too. So I get to mix and match. Today I found myself looking at the two previous incarnations of the Custom Entity Container JavaScript Extension Example #3 (#1, #2) and thinking “this looks like a List Applet in Siebel”. So I decided to place the layout of the custom entity list in the hands of jQuery and jsGrid. Siebel CRM actually uses jqGrid but I needed something very lightweight for this example requirement, so jsGrid was a better choice. Of course I needed minified jQuery as well.

My goal is to make this a fairly simple routine to present instances of an inferred entity. So the code for the jsGrid looks very minimalist. It basically takes the for..each loop and extracts the two attributes from the array created in Custom Entity Container JavaScript Extension Example #2, and then passes that to jsGrid as a flattened dataset without the attribute child nodes. I also set up the grid to only have two columns, and no editing (since this is an inferred entity). I set the page size and the size of the actual space taken up by the entire list:

Custom Entity Container JavaScript Extension Example #3

  1. The loop creates a flattened data structure just right for jsGrid
  2. The data is passed to the jsGrid
  3. The column headers are sized appropriately

The end result is rather nice, smooth scrolling (not in the Debugger, only in Ctrl+F5 debugging in a modern browser).

Custom Entity Container JavaScript Extension Example #3

 

Now that’s what I call a list! Using the jsGrid library gives me (and the reader) the added bonus of scrolling or jumping using the paging links at the bottom of the list. Cool!

As ever this is available from the OPA Hub Shop, look out for Custom Entity Container JavaScript Extension Example #3 in the product list.

Custom Entity Container JavaScript Extension Example #2

Custom Entity Container JavaScript Extension Example #2

Note : this JavaScript is part of a series. Please start with part one,  continue reading here then visit the final example in part three. You can also watch a quick video of the final example on  our YouTube Channel.

Following on from the previous post, we now have a working example that let’s us access an array of data in our inferred entity from the JavaScript extension code we write to manage our Control extension(s). But what about when we want to use this code outside of Debug mode? And why does it only work in Debug mode? What are the additional caveats we are going to find? Let’s make Custom Entity Container JavaScript Extension Example #2!

Debug Mode

The Oracle PolicyAutomation object in your JavaScript  has EnableDebugMode tucked away deep in the interview.js static resource file. This produces the beloved Debug Console window you see when you are working the Debug in your browser or in the embedded browser, which pipes the console output into this dinky pink box:

Custom Entity Container JavaScript Extension Example #2

When working in Debug mode, you have also noticed (and this is not a surprise) that some interesting objects and functions are available that do not show up when the project is deployed. This is not a surprise really. But in our case, we would like to have access to our array of data for our (perhaps twisted and even unprecedented) purposes. So where do we go from here? The answer, as always, turns out to be relatively simple.

The interview object contains a reference to the same array in the form of  interview._session.config.data[1].instances. Note that the number one assumes that you have only two entities, Global and something else. You will have to inspect your code and find out which node you are interested in if you have more. It looks like this in my case.

Custom Entity Container JavaScript Extension Example #2

Once you have that reference, you can do two things easily.

  1. You can figure out the length of the array and use it in your for…each loop
  2. You can select one of the child array called attributes and dig up the information you need to display

So in this new, non-Debug version of the code, you would end up with the following changes compared to the previous post.

Custom Entity Container JavaScript Extension Example #2

  1. In the early part of the script, get a reference to the part of the interview object you need
  2. Use it in a similar way to previously to get the different attribute values you want to display

This code will run even if you are not using the debugger and you have deployed the project to an Interview URL.

Watch Out!

But there is another caveat. The exact index (location) of your entity in the array of entities will change as you compile and deploy your project. So we need a mechanism to make sure we have selected the correct entity and instances.  What today is index 3 might be index 2 tomorrow. Since the entity you are looking for has a unique public name, you might use that to find it. Something like this (based on code taken from stackoverflow.com).

Custom Entity Container JavaScript Extension Example #2

Working through the different nodes until you find the right one, based on the unique name.

Custom Entity Container JavaScript Extension Example #2 Summary

This approach allows us to take the same technique and improve our “Custom Entity Container JavaScript Extension Example #2” to function outside of the Debug window and give it a more robust mechanism for searching for our entity. I would not be surprised if at some point this reference was made easier to access but for now, this seems to do the trick. The documentation is, as ever, available online.

Code Example

As always the code is available for free download from the OPA Hub Shop. Look for Custom Entity Container JavaScript Extension Example #2  in the product list. But we are still not finished, for in part three of this series we will finish off in style by skinning our List of Instances with jsGrid.