How do I guarantee that an ALM fragment will appear as the leftmost tab?
To make this change two database tables must be queried and one database table must be updated.
To begin we must first look at the UP_FRAGMENTS table. This table contains the fragment name and fragment id. In particular we must look at the FRAGMENT_ID and NAME columns. Examining the PRNT_NODE_ID column is also useful, because the top level fragment will not have a parent node, so the value of this column is null for the fragment we really want to change. Any fragment that contains a PRNT_NODE_ID value is not really a top level fragment, so changing its priority will not help.
The next database table we need to look at is the UP_FRAGMENT_RESTRICTIONS table. This is also the table we will be modifying. This table contains a few important columns. FRAGMENT_ID is the column that matches up with the FRAGMENT_ID from the UP_FRAGMENTS table. RESTRICTION_TYPE is a column that contains the type of the restriction. For this case, we are only interested in the rows that contain a RESTRICTION_TYPE of '1', because that represents the "priority" restriction. Finally we need to look at the RESTRICTION_VALUE column. The RESTRICTION_VALUE column lists the current value for the priority restriction. Often this is a value like "0-1000" for new/unmodified installations.
By looking at the UP_FRAGMENTS and UP_FRAGMENT_RESTRICTIONS tables we can identify the fragment we're interested in and its current priority with respect to the priority of all the other tabs. The following is a simple SQL query that should work on most database systems (for uPortal 2.4.x).
SELECT up_fragments.fragment_id, up_fragment_restrictions.node_id, up_fragments.name, up_fragment_restrictions.restriction_value FROM up_fragments,up_fragment_restrictions WHERE up_fragments.prnt_node_id IS NULL AND up_fragment_restrictions.restriction_type=1 AND up_fragments.fragment_id=up_fragment_restrictions.fragment_id;
On a new Academus 2.0 system that query will produce results like
2002, 225, Content Manager, 0-1000 2002, 224, Content Manager, 0-1000 2002, 223, Content Manager, 0-1000 2002, 222, Content Manager, 0-1000 2002, 226, Content Manager, 0-1000 2001, 219, Manage Portal, 0-1000 2001, 221, Manage Portal, 0-1000 2001, 218, Manage Portal, 0-1000 2001, 217, Manage Portal, 0-1000 2001, 216, Manage Portal, 0-1000 2001, 265, Manage Portal, 0-1000 2002, 1, Content Manager, 0-1000 2001, 1, Manage Portal, 0-1000
The NODE_ID column is not needed, but is similar to the PRNT_NODE_ID column and helps us identify only the top level fragment to modify. There is no need to modify any node within the fragment other then NODE_ID 1.
The final step is to update the UP_FRAGMENT_RESTRICTIONS table. The RESTRICTION_VALUE field must be updated with a new value. The highest this value can be set is one less then the maximum positive int value in java. In Java this is represented by the expression "Integer.MAX_VALUE - 1". In algebraic terms this is the value "2^31 - 1 - 1". Numerically this is the value "2147483646". The uPortal 2.4.x framework code does allow any value higher then this. In uPortal 2.5.x, a value numerically 1 higher (essentially Integer.MAX_VALUE), may be used.
The following SQL statement will set the Priority of the "Content Manager" tab from above to the highest possible priority.
UPDATE up_fragment_restrictions SET restriction_value=2147483646 WHERE fragment_id=2002 AND restriction_type=1 AND node_id=1;
After running this update, logging out and back in to the portal should show the change in the tab priority.
