1
|
|
|
/* |
2
|
|
|
* Copyright 2014, Armenak Grigoryan, and individual contributors as indicated |
3
|
|
|
* by the @authors tag. See the copyright.txt in the distribution for a |
4
|
|
|
* full listing of individual contributors. |
5
|
|
|
* |
6
|
|
|
* This is free software; you can redistribute it and/or modify it |
7
|
|
|
* under the terms of the GNU Lesser General Public License as |
8
|
|
|
* published by the Free Software Foundation; either version 2.1 of |
9
|
|
|
* the License, or (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This software is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14
|
|
|
* Lesser General Public License for more details. |
15
|
|
|
*/ |
16
|
|
|
package com.strider.datadefender.requirement.plan; |
17
|
|
|
|
18
|
|
|
import com.strider.datadefender.requirement.Column; |
19
|
|
|
import java.lang.reflect.InvocationTargetException; |
20
|
|
|
|
21
|
|
|
import javax.xml.bind.Unmarshaller; |
22
|
|
|
import javax.xml.bind.annotation.XmlAccessType; |
23
|
|
|
import javax.xml.bind.annotation.XmlAccessorType; |
24
|
|
|
import javax.xml.bind.annotation.XmlAttribute; |
25
|
|
|
import javax.xml.bind.annotation.XmlIDREF; |
26
|
|
|
|
27
|
|
|
import lombok.extern.log4j.Log4j2; |
28
|
|
|
import lombok.Data; |
29
|
|
|
import lombok.NoArgsConstructor; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* |
33
|
|
|
* @author Zaahid Bateson |
34
|
|
|
*/ |
35
|
|
|
@Log4j2 |
36
|
|
|
@Data |
37
|
|
|
@NoArgsConstructor |
38
|
|
|
@XmlAccessorType(XmlAccessType.NONE) |
39
|
|
|
public class PlanRef { |
40
|
|
|
|
41
|
|
|
@XmlIDREF |
42
|
|
|
@XmlAttribute(name = "ref-id") |
43
|
|
|
private GlobalPlan ref; |
44
|
|
|
|
45
|
|
|
public PlanRef(GlobalPlan ref) { |
46
|
|
|
this.ref = ref; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Uses functionName and parameters to find the method to associate with |
51
|
|
|
* 'Function'. |
52
|
|
|
* |
53
|
|
|
* @param unmarshaller |
54
|
|
|
* @param parent |
55
|
|
|
* @throws ClassNotFoundException |
56
|
|
|
* @throws InstantiationException |
57
|
|
|
* @throws IllegalAccessException |
58
|
|
|
* @throws InvocationTargetException |
59
|
|
|
*/ |
60
|
|
|
public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) |
61
|
|
|
throws ClassNotFoundException, |
62
|
|
|
InstantiationException, |
63
|
|
|
IllegalAccessException, |
64
|
|
|
InvocationTargetException { |
65
|
|
|
|
66
|
|
|
log.debug("Unmarshalling plan-ref"); |
67
|
|
|
log.debug("ref-id: {}", () -> ref.getId()); |
68
|
|
|
|
69
|
|
|
if (!(parent instanceof Column)) { |
70
|
|
|
return; |
71
|
|
|
} |
72
|
|
|
final Class<?> columnType = ((Column) parent).getType(); |
73
|
|
|
ref.initialize(columnType); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|