1 17 package org.apache.ws.jaxme.xs.impl; 18 19 import org.apache.ws.jaxme.xs.XSAnnotation; 20 import org.apache.ws.jaxme.xs.XSIdentityConstraint; 21 import org.apache.ws.jaxme.xs.XSElement; 22 import org.apache.ws.jaxme.xs.XSElementOrAttrRef; 23 import org.apache.ws.jaxme.xs.XPathMatcher; 24 import org.apache.ws.jaxme.xs.xml.XsEKey; 25 import org.apache.ws.jaxme.xs.xml.XsTKeybase; 26 import org.apache.ws.jaxme.xs.xml.XsEUnique; 27 import org.xml.sax.SAXException ; 28 29 34 public class XSIdentityConstraintImpl extends XSOpenAttrsImpl 35 implements XSIdentityConstraint 36 { 37 private XSAnnotation[] annotations; 38 private String name; 39 private boolean isUnique; 40 private XsTKeybase keyBase; 41 private XSElementOrAttrRef[][] matchCriteria; 42 43 protected XSIdentityConstraintImpl( XSElement pParent, XsEKey key ) 44 throws SAXException 45 { 46 super( pParent, key ); 47 48 initSelf( pParent, key, false ); 49 } 50 51 protected XSIdentityConstraintImpl( XSElement pParent, XsEUnique unique ) 52 throws SAXException 53 { 54 super( pParent, unique ); 55 56 initSelf( pParent, unique, true ); 57 } 58 59 public XSAnnotation[] getAnnotations() { 60 return annotations; 61 } 62 63 66 public String getName() { 67 return name; 68 } 69 70 73 public boolean isUnique() { 74 return isUnique; 75 } 76 77 80 public XSElementOrAttrRef[][] getMatchCriteria() { 81 return matchCriteria; 82 } 83 84 public void validate() throws SAXException { 85 matchCriteria = XPathMatcher.match( 86 keyBase, 87 (XSElement) getParentObject() 88 ); 89 90 validateAllIn( annotations ); 91 } 92 93 private void initSelf( 94 XSElement pParent, 95 XsTKeybase keyBase, 96 boolean isUnique 97 ) throws SAXException { 98 this.isUnique = isUnique; 99 this.name = keyBase.getName().getValue(); 100 this.keyBase = keyBase; 101 102 this.annotations = getXSSchema().getXSObjectFactory().newXSAnnotations( 103 this, 104 keyBase.getAnnotation() 105 ); 106 } 107 } 108 | Popular Tags |