Class MCRLayoutUtilities

java.lang.Object
org.mycore.frontend.MCRLayoutUtilities

public class MCRLayoutUtilities extends Object
Xalan extention for navigation.xsl
  • Field Details

  • Constructor Details

    • MCRLayoutUtilities

      public MCRLayoutUtilities()
  • Method Details

    • readAccess

      public static boolean readAccess(String webpageID, String blockerWebpageID)
      Verifies a given $webpage-ID (//item/@href) from navigation.xml on read permission, based on ACL-System. To be used by XSL with Xalan-Java-Extension-Call. $blockerWebpageID can be used as already verified item with read access. So, only items of the ancestor axis till and exclusive $blockerWebpageID are verified. Use this, if you want to speed up the check
      Parameters:
      webpageID - any item/@href from navigation.xml
      blockerWebpageID - any ancestor item of webpageID from navigation.xml
      Returns:
      true if access granted, false if not
    • readAccess

      public static boolean readAccess(String webpageID)
      Verifies a given $webpage-ID (//item/@href) from navigation.xml on read permission, based on ACL-System. To be used by XSL with Xalan-Java-Extension-Call.
      Parameters:
      webpageID - any item/@href from navigation.xml
      Returns:
      true if access granted, false if not
    • getAncestorLabels

      public static String getAncestorLabels(Element item)
      Returns all labels of the ancestor axis for the given item within navigation.xml
      Parameters:
      item - a navigation item
      Returns:
      Label as String, like "labelRoot > labelChild > labelChildOfChild"
    • getAccess

      public static boolean getAccess(String webpageID, String permission, int strategy)
      Verifies, if an item of navigation.xml has a given $permission.
      Parameters:
      webpageID - item/@href
      permission - permission to look for
      strategy - ALLTRUE => all ancestor items of webpageID must have the permission, ONETRUE_ALLTRUE => only 1 ancestor item must have the permission
      Returns:
      true, if access, false if no access
    • getAccess

      public static boolean getAccess(String webpageID, String permission, int strategy, String blockerWebpageID)
      Verifies, if an item of navigation.xml has a given $permission with a stop item ($blockerWebpageID)
      Parameters:
      webpageID - item/@href
      permission - permission to look for
      strategy - ALL2BLOCKER_TRUE => all ancestor items of webpageID till and exlusiv $blockerWebpageID must have the permission
      blockerWebpageID - any ancestor item of webpageID from navigation.xml
      Returns:
      true, if access, false if no access
    • itemAccess

      public static boolean itemAccess(String permission, Element item, boolean access)
      Verifies a single item on access according to $permission Falls back to version without query if no rule for exact query string exists.
      Parameters:
      permission - an ACL permission
      item - element to check
      access - initial value
    • webpageAccess

      public static boolean webpageAccess(String permission, String webpageId, boolean access)
      Verifies a single webpage on access according to $permission. Falls back to version without query if no rule for exact query string exists.
      Parameters:
      permission - an ACL permission
      webpageId - webpage to check
      access - initial value
    • getWebpageACLID

      public static String getWebpageACLID(String webpageID)
    • getNavi

      public static Document getNavi()
      Returns the navigation.xml as org.jdom2.document, using a cache the enhance loading time.
      Returns:
      navigation.xml as org.jdom2.document
    • getNavigationFile

      public static File getNavigationFile()
      Returns the navigation.xml as File. This file may not exist yet as navigation.xml may be served as a web resource. Use getNavigationURL() to get access to the actual web resource.
    • getNavigationURL

      public static URL getNavigationURL()
      Returns the navigation.xml as URL. Use this method if you need to parse it on your own.
    • getPersonalNavigation

      public static Document getPersonalNavigation() throws JDOMException, XPathExpressionException
      Throws:
      JDOMException
      XPathExpressionException
    • getDuration

      public static long getDuration(long startTime)
    • getWebpageObjIDPrefix

      public static String getWebpageObjIDPrefix()
    • hasRule

      public static boolean hasRule(String permission, String webpageID)
    • getRuleID

      public static String getRuleID(String permission, String webpageID)
    • getRuleDescr

      public static String getRuleDescr(String permission, String webpageID)
    • getPermission2ReadWebpage

      public static String getPermission2ReadWebpage()