1 20 21 package org.apache.directory.ldapstudio.browser.core.model.schema; 22 23 24 import java.util.Arrays ; 25 import java.util.HashSet ; 26 import java.util.Iterator ; 27 import java.util.Set ; 28 29 30 public class MatchingRuleDescription extends SchemaPart2 31 { 32 33 private static final long serialVersionUID = -8497098446034593329L; 34 35 private String syntaxDescriptionNumericOID; 36 37 38 public MatchingRuleDescription() 39 { 40 super(); 41 this.syntaxDescriptionNumericOID = null; 42 } 43 44 45 public int compareTo( Object o ) 46 { 47 if ( o instanceof MatchingRuleDescription ) 48 { 49 return this.toString().compareTo( o.toString() ); 50 } 51 else 52 { 53 throw new ClassCastException ( "Object of type " + this.getClass().getName() + " required." ); 54 } 55 } 56 57 58 62 public String getSyntaxDescriptionNumericOID() 63 { 64 return syntaxDescriptionNumericOID; 65 } 66 67 68 public void setSyntaxDescriptionNumericOID( String syntaxDescriptionNumericOID ) 69 { 70 this.syntaxDescriptionNumericOID = syntaxDescriptionNumericOID; 71 } 72 73 74 79 public AttributeTypeDescription[] getUsedFromAttributeTypeDescriptions() 80 { 81 Set usedFromSet = new HashSet (); 82 for ( Iterator it = this.getSchema().getAtdMapByName().values().iterator(); it.hasNext(); ) 83 { 84 AttributeTypeDescription atd = ( AttributeTypeDescription ) it.next(); 85 if ( atd.getEqualityMatchingRuleDescriptionOIDTransitive() != null 86 && this.getLowerCaseIdentifierSet().contains( 87 atd.getEqualityMatchingRuleDescriptionOIDTransitive().toLowerCase() ) ) 88 { 89 usedFromSet.add( atd ); 90 } 91 if ( atd.getSubstringMatchingRuleDescriptionOIDTransitive() != null 92 && this.getLowerCaseIdentifierSet().contains( 93 atd.getSubstringMatchingRuleDescriptionOIDTransitive().toLowerCase() ) ) 94 { 95 usedFromSet.add( atd ); 96 } 97 if ( atd.getOrderingMatchingRuleDescriptionOIDTransitive() != null 98 && this.getLowerCaseIdentifierSet().contains( 99 atd.getOrderingMatchingRuleDescriptionOIDTransitive().toLowerCase() ) ) 100 { 101 usedFromSet.add( atd ); 102 } 103 } 104 AttributeTypeDescription[] atds = ( AttributeTypeDescription[] ) usedFromSet 105 .toArray( new AttributeTypeDescription[0] ); 106 Arrays.sort( atds ); 107 return atds; 108 } 109 110 } 111 | Popular Tags |