1
|
|
/*
|
2
|
|
* JBind
|
3
|
|
*
|
4
|
|
* Copyright (c) by Stefan Wachter. All rights reserved.
|
5
|
|
*
|
6
|
|
* Usage, modification, and redistribution is subject to license terms that are
|
7
|
|
* available at 'http://www.jbind.org'. The JBind license is like the
|
8
|
|
* 'Apache Software License V 1.1'.
|
9
|
|
*/
|
10
|
|
package org.jbind.xml.schema.element;
|
11
|
|
|
12
|
|
import org.jbind.xml.base.IAttribute;
|
13
|
|
import org.jbind.xml.base.IRef;
|
14
|
|
import org.jbind.xml.base.ISymbolspace;
|
15
|
|
import org.jbind.xml.base.ISymbolspaces;
|
16
|
|
import org.jbind.xml.core.cmp.IComponent;
|
17
|
|
import org.jbind.xml.core.cmp.IComponentStore;
|
18
|
|
import org.jbind.xml.core.content.IAttrGroupDecl;
|
19
|
|
import org.jbind.xml.msg.IConstraintViolations;
|
20
|
|
import org.jbind.xml.msg.XmlException;
|
21
|
|
import org.jbind.xml.msg.XmlMessages;
|
22
|
|
import org.jbind.xml.schema.cmp.AttrGroupRef;
|
23
|
|
import org.jbind.xml.schema.instantiation.IElemValHelper;
|
24
|
|
import org.jbind.xml.schema.instantiation.IElementHelper;
|
25
|
|
import org.jbind.xml.schema.instantiation.IHasTopLevelJobs;
|
26
|
|
import org.jbind.xml.schema.instantiation.IJobRefs;
|
27
|
|
|
28
|
|
public class AttributeGroupRef extends Annotated implements IAttributeGroupRef {
|
29
|
|
|
30
|
|
private IRef myRef = null;
|
31
|
|
|
32
|
|
|
33
|
59
|
public AttributeGroupRef(CreationParams aCreationParams) {
|
34
|
59
|
super(aCreationParams);
|
35
|
|
}
|
36
|
|
|
37
|
60
|
protected IAttribute doCreateAttribute(ACParams anACParams) throws XmlException {
|
38
|
60
|
IAttribute res = null;
|
39
|
60
|
String an = NameUtil.getSchemaAttributeName(anACParams);
|
40
|
60
|
if ("ref".equals(an)) {
|
41
|
59
|
res = new RefAttribute(anACParams, ISymbolspaces.ATTRIBUTE_GROUP);
|
42
|
59
|
myRef = res.getRef();
|
43
|
|
} else {
|
44
|
1
|
res = super.doCreateAttribute(anACParams);
|
45
|
|
}
|
46
|
60
|
return res;
|
47
|
|
}
|
48
|
|
|
49
|
|
|
50
|
102
|
public IRef getRef() {
|
51
|
102
|
return myRef;
|
52
|
|
}
|
53
|
|
|
54
|
5
|
public void setRef(IRef aRef) {
|
55
|
5
|
myRef = aRef;
|
56
|
|
}
|
57
|
|
|
58
|
59
|
public void validateElement(IElemValHelper aHelper, IConstraintViolations aViolations) {
|
59
|
59
|
super.validateElement(aHelper, aViolations);
|
60
|
59
|
if (null == myRef) {
|
61
|
0
|
aViolations.add(XmlMessages.missingAttribute("ref", this));
|
62
|
|
}
|
63
|
|
}
|
64
|
|
|
65
|
43
|
public void addSchemaData(IComponentStore aComponentStore, IComponent aComponent, IConstraintViolations aViolations) {}
|
66
|
|
|
67
|
|
|
68
|
49
|
public void collectRefsForCreation(IJobRefs aJobRefs) {
|
69
|
49
|
aJobRefs.add(myRef, true, this);
|
70
|
|
}
|
71
|
98
|
public void collectRefsForCompletion(IElementHelper anElementHelper, IJobRefs aJobRefs) {}
|
72
|
0
|
public void collectRefsForValidation(IElementHelper anElementHelper, IJobRefs aJobRefs) {}
|
73
|
|
|
74
|
49
|
public void completeComponent(IElementHelper anElementHelper, IComponent aComponent, IConstraintViolations aViolations) {}
|
75
|
0
|
public void createAndAddJob(IHasTopLevelJobs aHasTopLevelJobs) {}
|
76
|
|
|
77
|
49
|
public IComponent createComponent(IElementHelper anElementHelper, IConstraintViolations aViolations) {
|
78
|
49
|
IAttrGroupDecl attrGroupDecl = (IAttrGroupDecl)anElementHelper.getComponent(myRef, true);
|
79
|
49
|
return new AttrGroupRef(this, attrGroupDecl);
|
80
|
|
}
|
81
|
|
|
82
|
0
|
public String getName() {
|
83
|
0
|
return null;
|
84
|
|
}
|
85
|
|
|
86
|
0
|
public ISymbolspace getSymbolSpace() {
|
87
|
0
|
return ISymbolspaces.ATTRIBUTE_GROUP;
|
88
|
|
}
|
89
|
|
|
90
|
|
}
|
91
|
|
|