static Element createOrMovePLFOwnedNode(
            Element compViewNode,
            Element compViewParent,
            boolean createIfNotFound,
            boolean createChildNodes,
            Document plf,
            Element plfParent,
            IPerson person)
            throws PortalException {
        Element child = (Element) compViewParent.getFirstChild();
        Element nextOwnedSibling = null;
        boolean insertionPointFound = false;

        while (child != null) {
            if (insertionPointFound
                    && nextOwnedSibling == null
                    && !child.getAttribute(Constants.ATT_ID)
                            .startsWith(Constants.FRAGMENT_ID_USER_PREFIX))
                nextOwnedSibling = child;

            if (child == compViewNode) insertionPointFound = true;
            child = (Element) child.getNextSibling();
        }

        if (insertionPointFound == false) return null;

        String nextSibID = null;
        Element nextPlfSib = null;

        if (nextOwnedSibling != null) {
            nextSibID = nextOwnedSibling.getAttribute(Constants.ATT_ID);
            nextPlfSib = plf.getElementById(nextSibID);
        }

        String plfNodeID = compViewNode.getAttribute(Constants.ATT_ID);
        Element plfNode = plf.getElementById(plfNodeID);

        if (plfNode == null) {
            if (createIfNotFound == true) {
                plfNode = (Element) plf.importNode(compViewNode, createChildNodes);
                plfNode.setIdAttribute(Constants.ATT_ID, true);
            } else return null;
        }

        if (nextPlfSib == null) plfParent.appendChild(plfNode);
        else plfParent.insertBefore(plfNode, nextPlfSib);

        PositionManager.updatePositionSet(compViewParent, plfParent, person);
        return (Element) plfNode;
    }
static Element createOrMovePLFOwnedNode ( Element compViewNode , Element compViewParent , boolean createIfNotFound , boolean createChildNodes , Document plf , Element plfParent , IPerson person ) throws PortalException { Element child = ( Element ) compViewParent . getFirstChild ( ) ; Element nextOwnedSibling = null ; boolean insertionPointFound = false ; while ( child != null ) { if ( insertionPointFound && nextOwnedSibling == null && ! child . getAttribute ( Constants . ATT_ID ) . startsWith ( Constants . FRAGMENT_ID_USER_PREFIX ) ) nextOwnedSibling = child ; if ( child == compViewNode ) insertionPointFound = true ; child = ( Element ) child . getNextSibling ( ) ; } if ( insertionPointFound == false ) return null ; String nextSibID = null ; Element nextPlfSib = null ; if ( nextOwnedSibling != null ) { nextSibID = nextOwnedSibling . getAttribute ( Constants . ATT_ID ) ; nextPlfSib = plf . getElementById ( nextSibID ) ; } String plfNodeID = compViewNode . getAttribute ( Constants . ATT_ID ) ; Element plfNode = plf . getElementById ( plfNodeID ) ; if ( plfNode == null ) { if ( createIfNotFound == true ) { plfNode = ( Element ) plf . importNode ( compViewNode , createChildNodes ) ; plfNode . setIdAttribute ( Constants . ATT_ID , true ) ; } else return null ; } if ( nextPlfSib == null ) plfParent . appendChild ( plfNode ) ; else plfParent . insertBefore ( plfNode , nextPlfSib ) ; PositionManager . updatePositionSet ( compViewParent , plfParent , person ) ; return ( Element ) plfNode ; }
Creates or moves the plf copy of a node in the composite view and inserting it before its
next highest sibling so that if dlm is not used then the model ends up exactly like the
original non-dlm persistance version. The position set is also updated and if no ilf copy
nodes are found in the sibling list the set is cleared if it exists.