-
- private String inputCompositeNode;
- private QName rpc;
-
- public ExecuteRpc(String inputCompositeNode, QName rpc) {
- this.inputCompositeNode = inputCompositeNode;
- this.rpc = rpc;
- }
-
- public String getInputCompositeNode() {
- return inputCompositeNode;
- }
-
- public QName getRpc() {
- return rpc;
- }
+ private static final long serialVersionUID = 1128904894827335676L;
+
+ private final NormalizedNodeMessages.Node inputNormalizedNode;
+ private final QName rpc;
+
+ private ExecuteRpc(final NormalizedNodeMessages.Node inputNormalizedNode, final QName rpc) {
+ Preconditions.checkNotNull(rpc, "rpc Qname should not be null");
+
+ this.inputNormalizedNode = inputNormalizedNode;
+ this.rpc = rpc;
+ }
+
+ public NormalizedNodeMessages.Node getInputNormalizedNode() {
+ return inputNormalizedNode;
+ }
+
+ public QName getRpc() {
+ return rpc;
+ }
+
+ public static ExecuteRpc from(final DOMRpcIdentifier rpc, final NormalizedNode<?, ?> input) {
+ final Node serializedInput;
+ if(input != null) {
+ serializedInput = NormalizedNodeSerializer.serialize(input);
+ } else {
+ serializedInput = null;
+ }
+ return new ExecuteRpc(serializedInput, rpc.getType().getLastComponent());
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("rpc", rpc)
+ .add("normalizedNode", inputNormalizedNode)
+ .toString();
+ }