private void updateNodeAttribute ( Element ilfNode , String nodeId , String attName , String newVal , String oldVal , List < ILayoutProcessingAction > pendingActions ) throws PortalException { if ( newVal == null && oldVal != null || newVal != null && oldVal == null || ( newVal != null && oldVal != null && ! newVal . equals ( oldVal ) ) ) { boolean isIncorporated = nodeId . startsWith ( Constants . FRAGMENT_ID_USER_PREFIX ) ; if ( isIncorporated ) { /* * Is a change to this attribute allowed? */ FragmentNodeInfo fragNodeInf = this . distributedLayoutStore . getFragmentNodeInfo ( nodeId ) ; if ( fragNodeInf == null ) { /* * null should only happen if a node was deleted in the * fragment and a user happened to already be logged in and * edited an attribute on that node. */ pendingActions . add ( new LPAChangeAttribute ( nodeId , attName , newVal , owner , ilfNode ) ) ; } else if ( ! fragNodeInf . canOverrideAttributes ( ) ) { /* * It isn't overrideable. */ throw new PortalException ( "Layout element '" + fragNodeInf . getAttributeValue ( attName ) + "' does not allow overriding attribute '" + attName + "'." ) ; } else if ( ! fragNodeInf . getAttributeValue ( attName ) . equals ( newVal ) ) { /* * If we get here we can override and the value is * different than that in the fragment so make the change. */ pendingActions . add ( new LPAChangeAttribute ( nodeId , attName , newVal , owner , ilfNode ) ) ; } else { /* * The new value matches that in the fragment. */ pendingActions . add ( new LPAResetAttribute ( nodeId , attName , fragNodeInf . getAttributeValue ( attName ) , owner , ilfNode ) ) ; } } else { /* * Node owned by user so no checking needed. Just change it. */ pendingActions . add ( new LPAChangeAttribute ( nodeId , attName , newVal , owner , ilfNode ) ) ; } } }
Handles checking for updates to a named attribute verifying such change is allowed and generates an action object to make that change .