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 java.util.Collections;
|
13
|
|
|
14
|
|
import org.jbind.xml.base.IRef;
|
15
|
|
import org.jbind.xml.base.ISymbolspace;
|
16
|
|
import org.jbind.xml.base.ISymbolspaces;
|
17
|
|
import org.jbind.xml.core.cmp.IComponent;
|
18
|
|
import org.jbind.xml.msg.IConstraintViolations;
|
19
|
|
import org.jbind.xml.msg.XmlException;
|
20
|
|
import org.jbind.xml.schema.instantiation.IElementHelper;
|
21
|
|
import org.jbind.xml.schema.instantiation.IHasTopLevelJobs;
|
22
|
|
|
23
|
|
public class SimpleRestrictionDerivation extends SimpleRestriction implements ISimpleRestrictionDerivation {
|
24
|
|
|
25
|
|
private IAttributeInfos myAttributeInfos = null;
|
26
|
|
private String myRole = null;
|
27
|
|
|
28
|
12
|
public SimpleRestrictionDerivation(CreationParams aCreationParams, String aRole) {
|
29
|
12
|
super(aCreationParams);
|
30
|
12
|
myAttributeInfos = new AttributeInfos(this);
|
31
|
12
|
myRole = aRole;
|
32
|
|
}
|
33
|
|
|
34
|
56
|
protected IElement doCreateChild(CreationParams aCreationParams) throws XmlException {
|
35
|
56
|
IElement res = null;
|
36
|
56
|
String componentName = NameUtil.getSchemaComponentName(aCreationParams);
|
37
|
56
|
if ("attribute".equals(componentName)) {
|
38
|
8
|
res = new AttributeDeclaration(aCreationParams, true);
|
39
|
48
|
} else if ("attributeGroup".equals(componentName)) {
|
40
|
0
|
res = new AttributeGroupRef(aCreationParams);
|
41
|
48
|
} else if ("anyAttribute".equals(componentName)) {
|
42
|
0
|
res = new AnyAttribute(aCreationParams);
|
43
|
|
} else {
|
44
|
48
|
res = super.doCreateChild(aCreationParams);
|
45
|
|
}
|
46
|
56
|
return res;
|
47
|
|
}
|
48
|
|
|
49
|
13
|
public IRef getInlinedBaseAttribute() {
|
50
|
13
|
return (null != getSimpleTypeDef()) ? getSimpleTypeDef().getBaseRef() : null;
|
51
|
|
}
|
52
|
|
|
53
|
11
|
public IRef getEffectiveBaseAttribute() {
|
54
|
11
|
IRef res = null;
|
55
|
11
|
if (null != getSimpleTypeDef()) {
|
56
|
0
|
res = getSimpleTypeDef().getBaseRef();
|
57
|
|
} else {
|
58
|
11
|
res = getBaseAttribute();
|
59
|
|
}
|
60
|
11
|
return res;
|
61
|
|
}
|
62
|
|
|
63
|
12
|
public boolean getIsExtension() {
|
64
|
12
|
return false;
|
65
|
|
}
|
66
|
|
|
67
|
12
|
public IModelGroup getModelGroup() {
|
68
|
12
|
return null;
|
69
|
|
}
|
70
|
|
|
71
|
12
|
public IModelGroupRef getModelGroupRef() {
|
72
|
12
|
return null;
|
73
|
|
}
|
74
|
|
|
75
|
12
|
public IAttributeInfos getAttributeInfos() {
|
76
|
12
|
return myAttributeInfos;
|
77
|
|
}
|
78
|
|
|
79
|
0
|
protected boolean referencedBaseTypeMustNotBeComplex() {
|
80
|
0
|
return false;
|
81
|
|
}
|
82
|
|
|
83
|
|
//
|
84
|
|
// ComponentJobHelper
|
85
|
|
//
|
86
|
|
|
87
|
|
/**
|
88
|
|
* Creates the simple content type.
|
89
|
|
*/
|
90
|
0
|
public IComponent createComponent(IElementHelper aHelper, IConstraintViolations aViolations) {
|
91
|
0
|
return createComponent(aHelper, this, null, null, myRole, Collections.EMPTY_SET, aViolations);
|
92
|
|
}
|
93
|
|
|
94
|
0
|
public void completeComponent(IElementHelper aHelper, IComponent aComponent, IConstraintViolations aViolations) {}
|
95
|
|
|
96
|
0
|
public String getName() {
|
97
|
0
|
return null;
|
98
|
|
}
|
99
|
|
|
100
|
0
|
public ISymbolspace getSymbolSpace() {
|
101
|
0
|
return ISymbolspaces.TYPE;
|
102
|
|
}
|
103
|
|
|
104
|
0
|
public boolean isTopLevelComponent() {
|
105
|
0
|
return false;
|
106
|
|
}
|
107
|
|
|
108
|
0
|
public void createAndAddJob(IHasTopLevelJobs aSchemaJob) {
|
109
|
0
|
aSchemaJob.addComponentJob(this);
|
110
|
|
}
|
111
|
|
|
112
|
|
|
113
|
|
}
|
114
|
|
|