Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A new Quality Rule Model is created with the two default sets, Scope and Violations:

Step 1 - Define Java Set and content

We want to test whether the Java Methods access Stored Procedures, therefore we first need to define the Scope set: this set will contain the Java Methods. To achieve this, we will add an additional set (called Java Methods) and then define a "block" in the Java Methods set that matches all Java Methods. Finally, we need to ensure that the Scope set re-uses the Java Method set.

Expand

Right click blank space in the Layers and Sets window and choose New Set:

Give the new set a name:

Drag the set into the Main window:

Click to enlarge

Define the content for the set: in this example we will re-use the Java Set in the default Scope set, therefore we just need to define a block that matches all Java Methods. The easiest way to do this is to drag the object type from the Types and Properties window:

Click to enlarge

Finally, we need to ensure that the Scope set re-uses the Java Method set. The easiest way to do this is to drag the Java Method set from the Layers and Sets window and drop it in the "All objects matching" block that will already be present in the Scope set:

...and then choose the "member-of" block when prompted:

...to give you this configuration:

Click to enlarge

Step 2 - Define the Data Set

We want to test whether the Java Methods access Stored Procedures, therefore we now need to define the Violations set: this set will contain the criteria that define the objects that will be returned as violations. To achieve this, we will add an additional set (called Data) and then define an additional "block" in the Data set that matches all Stored Procedures. Finally, we need to ensure that the Violations set defines the Data Set via a caller-of block:

Expand

Right click blank space in the Layers and Sets window and choose New Set:

Give the new set a name:

Drag the set into the Main window:

Click to enlarge

Define the content for the set: in this example we will re-use the Data Set in the default Violations set, therefore we just need to define a block that matches all Stored Procedures. The easiest way to do this is to drag the object type from the Types and Properties window:

Click to enlarge

Finally, we need to ensure that the Violations set re-uses the Data set through a "caller-of" block The easiest way to do this is to drag the Data set from the Layers and Sets window and drop it in the "All objects matching" block that will already be present in the Violations set:

...and then choose the "caller-of" block when prompted, since the check we want to perform is Java Methods accessing Stored Procedures:

...choose the type of caller you require - in this example we are choosing a simple "Call" type link between Java Methods and Stored Procedures. We have left the Depth Level at the default value "1":

...to give you this configuration:

Click to enlarge


Info

Note that the Violations set now uses an AND conjunction to define the objects that can be returned as violation:

All objects matching:

  • Member of set Scope (i.e. all Java Methods)
  • AND
  • Caller of objects matching this condition using Call links (i.e. Stored Procedures)

In other words, only Java Methods that call a Stored Procedure via a Call link.


Step 3 - Connect, check content and view results

Once the model has been created, you can use the "live" connection to the CAST AIP schemas to check the results, or "violations":

...