Examples of ALNode


Examples of org.jasig.portal.layout.alm.ALNode

             else
               fragment.setPulledFragment();
             fragment.setFunctionalName(CommonUtils.nvl(funcName));
             fragment.setDescription(CommonUtils.nvl(fragmentDesc))
             String fragmentRootId = getFragmentRootId(fragmentId);
             ALNode fragmentRoot = fragment.getNode(fragmentRootId);
             fragmentRoot.getNodeDescription().setName(fragmentName);
             // Saving the changes in the database 
             alm.saveFragment(fragment);         
          }    
        } else if (action.equals("delete")) {
          if (CommonUtils.parseInt(fragmentId) > 0) {
View Full Code Here

Examples of org.jasig.portal.layout.alm.ALNode

     * @param propertyValue a <code>String</code> property value to be checked
     * @return a boolean value
     * @exception PortalException if an error occurs
     */
  public boolean checkRestriction(String nodeId, String restrictionName, String restrictionPath, String propertyValue) throws PortalException {
    ALNode node = layout.getLayoutNode(nodeId);
    return (node!=null)?checkRestriction(node,restrictionName,restrictionPath,propertyValue):true;
  }
View Full Code Here

Examples of org.jasig.portal.layout.alm.ALNode

  public boolean checkAddRestrictions( ILayoutNode node, String parentId, String nextSiblingId ) throws PortalException {
   
    if ( !(node instanceof ALNode) )
       throw new PortalException ("The node must be ALNode type!");
   
    ALNode newNode = (ALNode) node;
    String newNodeId = newNode.getId();
    ALNode parentNode = layout.getLayoutNode(parentId);

    if ( !(parentNode.getNodeType()==IUserLayoutNodeDescription.FOLDER ) )
      throw new PortalException ("The target parent node should be a folder!");

    //if ( checkRestriction(parentNode,RestrictionTypes.IMMUTABLE_RESTRICTION,"false") ) {
    if ( !parentNode.getNodeDescription().isImmutable() ) {

     // Checking children related restrictions
     Collection restrictions = parentNode.getRestrictionsByPath(IUserLayoutRestriction.CHILDREN_RESTRICTION_PATH);
     for ( Iterator i = restrictions.iterator(); i.hasNext(); ) {
         IUserLayoutRestriction restriction = (IUserLayoutRestriction) i.next();
         if (   !restriction.getName().equals(RestrictionTypes.DEPTH_RESTRICTION) &&
                !restriction.checkRestriction(newNode) )
            return false;
View Full Code Here

Examples of org.jasig.portal.layout.alm.ALNode

     * @return a boolean value
     * @exception PortalException if an error occurs
     */
  public boolean checkMoveRestrictions( String nodeId, String newParentId, String nextSiblingId ) throws PortalException {
   
    ALNode node = layout.getLayoutNode(nodeId);
    ALNode oldParentNode = layout.getLayoutNode(node.getParentNodeId());
    ALFolder newParentNode = layout.getLayoutFolder(newParentId);

    /*if ( checkRestriction(oldParentNode,RestrictionTypes.IMMUTABLE_RESTRICTION,"false") &&
         checkRestriction(newParentNode,RestrictionTypes.IMMUTABLE_RESTRICTION,"false") ) {*/
    if ( !oldParentNode.getNodeDescription().isImmutable() && !newParentNode.getNodeDescription().isImmutable() ) {

     if ( !oldParentNode.equals(newParentNode) ) {
      // Checking children related restrictions
      Collection restrictions = newParentNode.getRestrictionsByPath(IUserLayoutRestriction.CHILDREN_RESTRICTION_PATH);
      for ( Iterator i = restrictions.iterator(); i.hasNext(); ) {
         IUserLayoutRestriction restriction = (IUserLayoutRestriction) i.next();
         if (   !restriction.getName().equals(RestrictionTypes.DEPTH_RESTRICTION) &&
View Full Code Here

Examples of org.jasig.portal.layout.alm.ALNode

     * @param nodeId a <code>String</code> node ID of a node to be deleted
     * @return a boolean value
     * @exception PortalException if an error occurs
     */
  public boolean checkDeleteRestrictions( String nodeId ) throws PortalException {
    ALNode node = layout.getLayoutNode(nodeId);
    if ( nodeId == null || node == null ) return true;
    //if ( checkRestriction(node.getParentNodeId(),RestrictionTypes.IMMUTABLE_RESTRICTION,"false") ) {
    if ( !layout.getLayoutNode(node.getParentNodeId()).getNodeDescription().isImmutable() ) {
         // Checking the unremovable restriction on the node to be deleted
         //return checkRestriction(nodeId,RestrictionTypes.UNREMOVABLE_RESTRICTION,"false");
         return !node.getNodeDescription().isUnremovable();
    } else
         return false;
  }
View Full Code Here

Examples of org.jasig.portal.layout.alm.ALNode

     * @param depth a depth on which the node is going to be attached
     * @return a boolean value
     * @exception PortalException if an error occurs
     */
  public boolean checkDepthRestrictions( String nodeId, int depth ) throws PortalException {
    ALNode node = layout.getLayoutNode(nodeId);
    // Checking restrictions for the node
    if ( !checkRestriction(nodeId,RestrictionTypes.DEPTH_RESTRICTION,depth+"") )
            return false;
    if ( node.getNodeType() == IUserLayoutNodeDescription.FOLDER ) {
     for ( String nextId = ((ALFolder)node).getFirstChildNodeId(); nextId != null; nextId = node.getNextNodeId() ) {
      node = layout.getLayoutNode(nextId);
      if ( !checkDepthRestrictions(nextId,depth+1) )
            return false;
     }
    }
View Full Code Here

Examples of org.jasig.portal.layout.alm.ALNode

  public boolean checkUpdateRestrictions(IUserLayoutNodeDescription nodeDescription) throws PortalException {
        IALNodeDescription nodeDesc=(IALNodeDescription)nodeDescription;
        String nodeId = nodeDesc.getId();

        if ( nodeId == null ) return false;
        ALNode node = layout.getLayoutNode(nodeId);
        IALNodeDescription currentNodeDesc = (IALNodeDescription) node.getNodeDescription();
        // If the node Ids do no match to each other then return false
        if ( !nodeId.equals(currentNodeDesc.getId()) ) return false;

        // Checking the immutable node restriction
        //if ( checkRestriction(node,RestrictionTypes.IMMUTABLE_RESTRICTION,"true") )
        if ( currentNodeDesc.isImmutable() )
            return false;

        // Checking the immutable parent node related restriction
        if ( getRestriction(layout.getLayoutNode(node.getParentNodeId()),RestrictionTypes.IMMUTABLE_RESTRICTION,IUserLayoutRestriction.CHILDREN_RESTRICTION_PATH) != null &&
             checkRestriction(node.getParentNodeId(),RestrictionTypes.IMMUTABLE_RESTRICTION,IUserLayoutRestriction.CHILDREN_RESTRICTION_PATH,"true") )
            return false;

        // Checking the immutable children node related restrictions
        if ( node.getNodeType() == IUserLayoutNodeDescription.FOLDER ) {
            ALFolder folder = (ALFolder) node;
            //Loop for all children
            for ( String nextId = folder.getFirstChildNodeId(); nextId != null; nextId = layout.getLayoutNode(nextId).getNextNodeId() )
             if ( getRestriction(layout.getLayoutNode(nextId),RestrictionTypes.IMMUTABLE_RESTRICTION,IUserLayoutRestriction.PARENT_RESTRICTION_PATH) != null &&
                  checkRestriction(nextId,RestrictionTypes.IMMUTABLE_RESTRICTION,IUserLayoutRestriction.PARENT_RESTRICTION_PATH,"true") )
                  return false;
        }

       // if a new node description doesn't contain any restrictions the old restrictions will be used
        if ( nodeDesc.getRestrictions() == null )
          nodeDesc.setRestrictions(currentNodeDesc.getRestrictions());
        Hashtable rhash = nodeDesc.getRestrictions();
        // Setting the new node description to the node
        node.setNodeDescription(nodeDesc);

        // Checking restrictions for the node
        if ( rhash != null ) {
           for ( Enumeration enum1 = rhash.elements(); enum1.hasMoreElements(); )
             if ( !((IUserLayoutRestriction)enum1.nextElement()).checkRestriction(node) ) {
                  node.setNodeDescription(currentNodeDesc);
                  return false;
             }
        }


        // Checking parent related restrictions for the children
        Collection restrictions = layout.getLayoutNode(node.getParentNodeId()).getRestrictionsByPath(IUserLayoutRestriction.CHILDREN_RESTRICTION_PATH);
        for ( Iterator i = restrictions.iterator(); i.hasNext(); ) {
         IUserLayoutRestriction restriction = (IUserLayoutRestriction) i.next();
         if ( !restriction.checkRestriction(node) ) {
            node.setNodeDescription(currentNodeDesc);
            return false;
         }
        }


        // Checking child related restrictions for the parent
        if ( node.getNodeType() == IUserLayoutNodeDescription.FOLDER ) {
         for ( String nextId = ((ALFolder)node).getFirstChildNodeId(); nextId != null; ) {
          ALNode child = layout.getLayoutNode(nextId);
          restrictions = child.getRestrictionsByPath(IUserLayoutRestriction.PARENT_RESTRICTION_PATH);
          for ( Iterator i = restrictions.iterator(); i.hasNext(); ) {
           IUserLayoutRestriction restriction = (IUserLayoutRestriction) i.next();
           if ( !restriction.checkRestriction(node) ) {
            node.setNodeDescription(currentNodeDesc);
            return false;
           }
          }
            nextId = child.getNextNodeId();
         }
        }

        return true;
    }
View Full Code Here

Examples of org.jasig.portal.layout.alm.ALNode

   * @param nodeId a <code>String</code> node ID
   * @return a boolean value
   * @exception PortalException
   */
  public boolean checkRestriction ( IAggregatedLayout layout, String nodeId ) throws PortalException {
    ALNode node = layout.getLayoutNode(nodeId);
    if ( node == null )
      throw new PortalException ( "The aggregated layout does not contain the node specified by ID = "+nodeId)
    return checkRestriction(node);
  }
View Full Code Here

Examples of org.jasig.portal.layout.alm.ALNode

         */
         public boolean checkRestriction( ILayoutNode node ) throws PortalException {
        
          if ( !(node instanceof ALNode) )
            throw new PortalException ( "The node must be ALNode type!");
          ALNode alNode = (ALNode) node;

          // if we have a related priority restriction we should check the priority ranges
          if ( nodePath != null && !nodePath.equals(LOCAL_RESTRICTION_PATH) ) {
             PriorityRestriction restriction = (PriorityRestriction) alNode.getRestriction(getUniqueKey(RestrictionTypes.PRIORITY_RESTRICTION));
             if ( restriction != null ) {
              int[] range = restriction.getRange();
              if ( minPriority > range[1] || maxPriority < range[0] )
                return false;
             }
                return true;
          }

           int priority = alNode.getPriority();
           if ( priority <= maxPriority && priority >= minPriority )
             return true;
             return false;
         }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.