Override and Overtake

Override and overtake are the two ways you can change the code in the layer you are working in. With an override you can add code Pre and Post the call to the underlying layer. With override you can't change the code in the middle of the method. You can also override views.

Overtake is the way to use when you must change the code in the middle of the method or if you can't run the previous layers code. If you carry out an overtake then you also assume ownership for this piece of code. Overtaken methods don't call the other layers code. Overtakes should only be used when no other option exists. You can also overtake views.

See also override and overtake syntax in Developer Studio.

Contents

Override of methods/records

Override is the preferable way of making enhancements to code. This means that you add code Pre or Post previous layers code. Override methods must always contain a 'super call'. Also you must always annotate the override with the annotation @Override. You can also override type records, in order to add attributes to the record.

Super Call

The super call is an IFS extension to the PL/SQL language. The super call, calls a method with the same name as the overridden method, in the layer below with the signature replicating what is in the super call.

Below is an example of an override with a super call, and an example of an override of type record:

Adding additional parameters

It is also possible to expand a methods parameter list, by adding DEFAULT parameters. When adding additional parameters to a method they must be placed last and also have a DEFAULT clause that sets appropriate values in case the method is called with the original set of parameters. In this case, period_status_ is added. NOTE: But adding additional parameters is possible only in API layer in PLSQL files. As per the current design, in PLSVC layer projections' Actions/functions cannot be overridden/overtaken by adding additional default parameters as OData layer doesn't support that. PLSVC overrides and overtakes should adhere to OData provider specification and there is no default parameter concept.

Overtake of methods

An Overtake is not the IFS preferred way of making enhancements to the code, but does need to be used when you cannot carry out an override. When you overtake a method you can rewrite the method so it behaves in exactly the way you want. You must always annotate the overtake with the annotation @Overtake [layer], where layer is the layer that you have overtaken the method from.

Example of an overtake of Base:

Original code:

Override of views

Override is the IFS preferred way of making enhancements to views. You must always annotate the override of the view with the annotation @Override

As of now you only can override a view when:

Below are two examples of overrides of a view:

Overtake of views

Overtake is not the IFS preferred way of making enhancements to the view, but needs to be used when you can't do an override. When you overtake a view you must overtake the full definition of the view, so the simplest way of achieving this is to copy the previous layers definition of the view, and then carry out the changes that you want to add or change. You must always annotate the overtake with the annotation @Overtake [layer], where layer is the layer you have overtaken the view from.

Example of overtake of a view:

Override and Overtake of columns

If you are declaring new views in the view file, with column names that have already been used, you automatically get the same properties on each column as the base, core or extension column have.

If you want to change only parts of the properties, but keep the rest, you can re-declare, or override, the column. In this context the result will be the same for a re-declare and an override, the redefined properties will be merged with the existing properties.

If you want to clear properties, and not inherit any properties you can choose to overtake the column and redefine the properties.

Please note that re-declare, override or overtake does not change the column definitions for the views declared in previous layer. To change the column properties on views in previous layers you have to override or overtake the view and re-declare the property.

You can also of course add SELECT statement and/or WHERE statement after this if needed.