use of org.killbill.billing.jaxrs.json.NodeCommandPropertyJson in project killbill by killbill.
the class NodesInfoResource method toNodeCommandMetadata.
private NodeCommandMetadata toNodeCommandMetadata(final NodeCommandJson input) {
if (input.getNodeCommandProperties() == null || input.getNodeCommandProperties().isEmpty()) {
return new NodeCommandMetadata() {
@Override
public List<NodeCommandProperty> getProperties() {
return ImmutableList.<NodeCommandProperty>of();
}
};
}
String pluginKey = null;
String pluginName = null;
String pluginVersion = null;
final Iterator<NodeCommandPropertyJson> it = input.getNodeCommandProperties().iterator();
while (it.hasNext()) {
final NodeCommandProperty cur = it.next();
if (PluginNodeCommandMetadata.PLUGIN_NAME.equals(cur.getKey())) {
pluginName = (String) cur.getValue();
} else if (PluginNodeCommandMetadata.PLUGIN_VERSION.equals(cur.getKey())) {
pluginVersion = (String) cur.getValue();
} else if (PluginNodeCommandMetadata.PLUGIN_KEY.equals(cur.getKey())) {
pluginKey = (String) cur.getValue();
}
if (pluginName != null && pluginVersion != null && pluginKey != null) {
break;
}
}
if (pluginName != null || pluginKey != null) {
removeFirstClassProperties(input.getNodeCommandProperties(), PluginNodeCommandMetadata.PLUGIN_NAME, PluginNodeCommandMetadata.PLUGIN_VERSION, PluginNodeCommandMetadata.PLUGIN_KEY);
return new PluginNodeCommandMetadata(pluginKey, pluginName, pluginVersion, toNodeCommandProperties(input.getNodeCommandProperties()));
} else {
return new NodeCommandMetadata() {
@Override
public List<NodeCommandProperty> getProperties() {
return toNodeCommandProperties(input.getNodeCommandProperties());
}
};
}
}
Aggregations