YS

Hello


I created a model matrix. 
Created in it column headers and row headers from ObjDef objects (functions and roles) taken from the outFolder folder. 
I placed the functions on rows, and placed the roles in columns. 
Next, I'm trying to create connections between some functions and roles. Before creating the connection function, I check the contents of the row header and column header with MsgBox. But when calling the

"matrix.createCxn (aHeaderCol [0], aHeaderRow [0], Constants.CT_EXEC_2);"

method, a window with the

"Wrapped java.lang.NullPointerException"

error appears. 


Tell me please what I'm doing wrong.


Here is the code:

function main() {
     var db = ArisData.getActiveDatabase();
     var group = ArisData.getSelectedGroups()[0];
     var outFolder = db.Group(["Main_group", "Work folders", "Test", "Matrix", "output_1"], 1049);
     var aFuncs = group.ObjDefListFilter ( 22 );   // Functions ObjDefs
     var aRoles = group.ObjDefListFilter ( 78 );   // Roles ObjDefs
     var oModel = outFolder.CreateModel(220,"Matrix_model",1049);
     var matrix = oModel.getMatrixModel();
     var Row_matrixHeader = matrix.getHeader(true);
     var Column_matrixHeader = matrix.getHeader(false);
     var Row_Header_Title = Row_matrixHeader.setTitle("Functions",1049);   
     var Column_Header_Title = Column_matrixHeader.setTitle("Roles",1049);
     
     // Creating header row cells
     for(var i=0; i < aFuncs.length; i++) {  
         matrix.createHeaderCell(null, aFuncs[i], Constants.ST_FUNC, -1, true);
         matrix.setVisibleObjectSymbolTypes([Constants.ST_FUNC], true);
     }
    
    // Creating header column cells
    for(var i=0; i < aRoles.length; i++) {  
         matrix.createHeaderCell(null, aRoles[i], Constants.ST_EMPL_TYPE, -1, false);
         matrix.setVisibleObjectSymbolTypes([Constants.ST_EMPL_TYPE], false);
    }
    
    var aHeaderCol = Column_matrixHeader.getCells();
    var aHeaderRow = Row_matrixHeader.getCells();
    
    Dialogs.MsgBox("aHeaderCol[0]: " + aHeaderCol[0].getDefinition().Attribute(Constants.AT_NAME, 1049).getValue());  //OK
    Dialogs.MsgBox("aHeaderRow[0]: " + aHeaderRow[0].getDefinition().Attribute(Constants.AT_NAME, 1049).getValue());  //OK

    matrix.createCxn( aHeaderCol[0], aHeaderRow[0], Constants.CT_EXEC_2 );   //  <- Error
}

main();
 

by Kay Fischbach
Posted on Tue, 11/10/2020 - 17:01

Hi,

I was able to replicate this problem and as far as I can tell this is a bug in ARIS (the "wrapped" in the error message seemingly indicates that the nullpointer exception is happening in some deeper method, that we didn't write).

While it does throw the exception, as far as I can tell it still does what you want it to do - create the connection.

The connection isn't shown in your model, because you're missing two lines of code

var connectionDataObj = matrix.createNewMatrixConnectionDataObject(Constants.ST_EMPL_TYPE, Constants.ST_FUNC, Constants.CT_EXEC_2, null, true, false);
matrix.setCxnData([connectionDataObj]);

You can execute those at any point after getting matrix from your freshly created model.

What those lines of code do is tell your model that you actually want connections of the type CT_EXEC_2 from ST_EMPL_TYPE to ST_FUNC in your matrix model to be indicated with a checkmark.

 

As for what to do with the matrix.createCxn(...) method that thows the exception...

A short term solution would be simply wrapping it with a try block which is followed by an empty catch block - this allows your program to continue the execution without horribly crashing and annoying the user with a cryptic message that doesn't even help you - the developer.

Long term solution would be contacting Software AG/ARIS support, explaining to them that the Matrix.createCxn(...) method consistently throws an exeption and hoping that they'll fix it in a future ARIS version/release a patch for the current ARIS version.

 

Sorry, this is probably a really unsatisfying answer for your problem, but I can't think of a better solution. I'm just a normal user and can't look any deeper into this.

Maybe someone else can find a better solution.

0
by Yuriy Stolyarov Author
Posted on Wed, 11/11/2020 - 17:09

In reply to by Kay Fischbach

Hello Kay

I'm sorry, but I don't understand why there is a connection in the cell where column 1 and row 1 intersect, although I set the connection only in the cell where column 0 and row 0 intersect?

Connection [0][0] planned, connection [1][1] not planned 

0
by Kay Fischbach
Posted on Thu, 11/12/2020 - 11:03

In reply to by Felix101

Hmm, Matrix models show you what the database already knows about those objects.

You should think of the displayed data in the cells where rows and columns intersect as a "view" for connection definitions - most other model types need occurrences of connection definitions in order to show you something, but for matrix models the mere connection definition is enough for it to display a checkmark.

With this way of thinking established, there are a couple of possible reasons for checked cells:

- the object definitions already have occurrences in another model and are connected with a connection in that model. When that connection was created, it of course created a connection occurrence in order to display something in that other model, but it also created a connection definition (which is represented by the checkmark in the matrix model)

- you simply check them in the matrix model - this only leads to a created connection definition, without a connection occurrence

- you have remnant connection definitions in your database. Those can appear for a number of reasons, e.g. weird/strange ways were used to delete connections, ... . Usually (while the connection definition isn't held in place with a matrix model) reorganizing the database will allow you to get rid of those remnants

If you want to find out, whether or not this connection actually has an occurrence somewhere, you can either take a look at the connected objects through the object properties from the Explorer tab, or you can take the ARIS Script approach

    var definitionA = aHeaderCol[1].getDefinition();
    var definitionB = aHeaderRow[1].getDefinition();
    
    var cxnDefsOfA = definitionA.CxnList(Constants.CT_EXEC_2);
    
    var foundCxnDef = null;
    
    for each(var cxnDefOfA in cxnDefsOfA) {
        if(cxnDefOfA.SourceObjDef().IsEqual(definitionB) || cxnDefOfA.TargetObjDef().IsEqual(definitionB)) {
            foundCxnDef = cxnDefOfA;
            break;
        }
    }
    
    if(foundCxnDef != null) {
        var occsOfCxn = foundCxnDef.OccList();
        
        occsOfCxn.length
        
        for each(var occOfCxn in occsOfCxn) {            
            occOfCxn.Model.Name(Context.getSelectedLanguage());
        }
    }

 

Evaluate the occsOfCxn.length and occOfCxn.Model.Name(Context.getSelectedLanguage()) in the debug console by setting breakpoint in those lines.

0
by Yuriy Stolyarov Author
Posted on Thu, 11/12/2020 - 16:52

In reply to by Kay Fischbach

Hello Kay
Thank you for your answer!
Yes, Matrix models are different from other models. Those. in other models, you can use the same objects, but connect them with different links in a different order. But this does not work in models of the matrix type: for example, if you create one model of the matrix type (for example, let's call it "Matrix_1"), place a function object ("Funk_1") on it in the row, and an object of the role type ("Role_1" ), then:
1. If there are other models (not necessarily of the matrix type), on which these two objects are connected by a relationship defined in this model matrix ("Matrix_1"), then this relationship in the matrix we created ("Matrix_1") will appear automatically;
2. If even in other models these objects were once connected, but they were all removed from these models, but these connections still remained in the database (the database was not reorganized), then this relationship in the matrix created by us ("Matrix_1") will appear automatically.

I faced the same error ("Wrapped java.lang.NullPointerException") again, but in a different method: getRole(1049):

    var test_content = matrix.getContentCell(aHeaderRow[0], aHeaderCol[0]);
    if ((test_content != null) && (test_content != undefined)) {
         var cxns = test_content.getCxns();
         if ((cxns != null) && (cxns != undefined) && (cxns.length != 0)) {
             var cxnRole = null;
             try{cxnRole = cxns[0].getRole(1049)}catch(e){}  // Error
             Dialogs.MsgBox("Role of conn:" + cxnRole);   // "Role of conn: null"
         }else Dialogs.MsgBox("cxns is null or undefined or zero length");
    } else Dialogs.MsgBox("test_content is null or undefined.");

In fact, I wanted to make a matrix of roles: there is a model, roles are located on it (even if they are the same for all systems), there are several systems (objects of the Information system type), there are several users (objects of the Employee type). Each user can have multiple roles in one system or another. 
Therefore, each user should have the detalization matrix model in which information systems are located in rows, and roles used in the information systems are located in columns. 
And at the intersections of systems and roles use a relationship of the "serves" type. 
But since Objects of the "information system" type and objects of the "Roles" type are the same for all, then in all matrices created personally for each user, there will be links everywhere. 
Therefore, the matrix-type model, unfortunately, does not suit me for solving this problem.

Thank you for your help very much!

0
by Yuriy Stolyarov Author
Posted on Wed, 11/11/2020 - 07:09

Hello Kay

Thank you very much!
Connections are created, and I enclosed the "createCxn" method in a block try{}catch(e){}
You really helped me!

0
by Robert Goldenbaum
Badge for 'Question Solver' achievement
Posted on Thu, 11/12/2020 - 17:33

Well, in other words - the Matrix models exists on the definition level. So it shows the connections on definition level and NOT on occurrence level.

The only thing you can do is to restrict the connection types shown and to make a reorganization...

Robert

0
by Yuriy Stolyarov Author
Posted on Fri, 11/13/2020 - 14:56

In reply to by rgoldenbaum

Hello Robert
Unfortunately, in my case with matrix models, there are more disadvantages than advantages. I used a different type of model for this task.
Thanks for your comment.

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock