Changeset 25353


Ignore:
Timestamp:
2012-04-12T14:02:25+12:00 (12 years ago)
Author:
sjm84
Message:

Added a function to help find parents of a given oid

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java

    r25347 r25353  
    9696    }
    9797
     98    public static boolean oidIsMatchOrParent(String first, String second)
     99    {
     100        if (first.equals(second))
     101        {
     102            return true;
     103        }
     104
     105        String[] firstParts = first.split(".");
     106        String[] secondParts = second.split(".");
     107
     108        if (firstParts.length >= secondParts.length)
     109        {
     110            return false;
     111        }
     112
     113        for (int i = 0; i < firstParts.length; i++)
     114        {
     115            if (!firstParts[i].equals(secondParts[i]))
     116            {
     117                return false;
     118            }
     119        }
     120
     121        return true;
     122    }
     123
    98124    /* some preprocessing functions */
    99125    public static String toLower(String orig)
     
    120146        }
    121147    }
    122    
     148
    123149    public static String replace(String orig, String match, String replacement)
    124150    {
     
    460486    public static boolean checkMetadataNotDuplicate(String name, String value)
    461487    {
    462         if(_foundTableValues.containsKey(name))
    463         {
    464             for(String mapValue : _foundTableValues.get(name))
    465             {
    466                 if(mapValue.equals(value))
     488        if (_foundTableValues.containsKey(name))
     489        {
     490            for (String mapValue : _foundTableValues.get(name))
     491            {
     492                if (mapValue.equals(value))
    467493                {
    468494                    return false;
     
    472498            return true;
    473499        }
    474        
     500
    475501        ArrayList<String> newList = new ArrayList<String>();
    476502        newList.add(value);
    477        
     503
    478504        _foundTableValues.put(name, newList);
    479        
     505
    480506        return true;
    481507    }
    482    
     508
    483509    public static String reCAPTCHAimage(String publicKey, String privateKey)
    484510    {
Note: See TracChangeset for help on using the changeset viewer.