|
|||||||||||||||||||
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
OpenReference.java | 100% | 100% | 100% | 100% |
|
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.constraint; |
|
11 |
|
|
12 |
import org.jbind.xml.base.IRef; |
|
13 |
import org.jbind.xml.core.data.IAnyTypeData; |
|
14 |
import org.jbind.xml.core.data.IDataReference; |
|
15 |
import org.jbind.xml.core.data.IDataStore; |
|
16 |
import org.jbind.xml.msg.IConstraintViolations; |
|
17 |
import org.jbind.xml.msg.XmlMessages; |
|
18 |
|
|
19 |
/** |
|
20 |
* References |
|
21 |
*/ |
|
22 |
public class OpenReference implements IDataReference { |
|
23 |
|
|
24 |
private String myReferenceId = null; |
|
25 |
private IAnyTypeData myReferencingData = null; |
|
26 |
private IRef myIndexRef = null; |
|
27 |
private Object myKey = null; |
|
28 |
|
|
29 | 70 |
public OpenReference(String aReferenceId, IAnyTypeData aReferencingData, IRef anIndexRef, Object aKey) { |
30 | 70 |
myReferenceId = aReferenceId; |
31 | 70 |
myReferencingData = aReferencingData; |
32 | 70 |
myIndexRef = anIndexRef; |
33 | 70 |
myKey = aKey; |
34 |
} |
|
35 |
|
|
36 | 70 |
public void resolve(IDataStore aDataStore, IConstraintViolations aViolations) { |
37 | 70 |
IAnyTypeData d = aDataStore.getIndexedData(myIndexRef, myKey); |
38 | 70 |
if (null != d) { |
39 | 61 |
myReferencingData.addReferencedData_(myReferenceId, d); |
40 |
} else { |
|
41 | 9 |
aViolations.add(XmlMessages.unresolvedReference(myIndexRef, myKey, myReferencingData.getImpl_())); |
42 |
} |
|
43 |
} |
|
44 |
|
|
45 |
} |
|
46 |
|
|