use of org.onap.appc.client.lcm.model.CommonHeader in project so by onap.
the class ApplicationControllerClient method createRequest.
public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId, String requestorId) {
Object requestObject = appCSupport.getInput(action.name());
try {
CommonHeader commonHeader = buildCommonHeader(requestId, requestorId);
requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, commonHeader);
requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class).invoke(requestObject, identifier);
if (payload != null) {
logger.info("payload in RunCommand: " + payload.getValue());
requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload);
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
logger.error("Error building Appc request", e);
}
return requestObject;
}
use of org.onap.appc.client.lcm.model.CommonHeader in project so by onap.
the class ApplicationControllerClient method buildCommonHeader.
protected CommonHeader buildCommonHeader(String requestId, String requestorId) {
CommonHeader commonHeader = new CommonHeader();
commonHeader.setApiVer(API_VER);
commonHeader.setOriginatorId(ORIGINATOR_ID);
commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId);
commonHeader.setSubRequestId(UUID.randomUUID().toString());
Flags flags = new Flags();
String flagsMode = "NORMAL";
Mode mode = Mode.valueOf(flagsMode);
flags.setMode(mode);
String flagsForce = "FALSE";
Force force = Force.valueOf(flagsForce);
flags.setForce(force);
flags.setTtl(FLAGS_TTL);
commonHeader.setFlags(flags);
Instant timestamp = Instant.now();
ZULU zulu = new ZULU(timestamp.toString());
commonHeader.setTimestamp(zulu);
return commonHeader;
}
use of org.onap.appc.client.lcm.model.CommonHeader in project so by onap.
the class ApplicationControllerClient method createRequest.
public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) {
Object requestObject = appCSupport.getInput(action.name());
try {
CommonHeader commonHeader = buildCommonHeader(requestId);
requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, commonHeader);
requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class).invoke(requestObject, identifier);
if (payload != null) {
requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload);
}
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
logger.error("Error building Appc request", e);
}
return requestObject;
}
use of org.onap.appc.client.lcm.model.CommonHeader in project so by onap.
the class ApplicationControllerClient method buildCommonHeader.
private CommonHeader buildCommonHeader(String requestId) {
CommonHeader commonHeader = new CommonHeader();
commonHeader.setApiVer(API_VER);
commonHeader.setOriginatorId(ORIGINATOR_ID);
commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId);
commonHeader.setSubRequestId(UUID.randomUUID().toString());
Flags flags = new Flags();
String flagsMode = "NORMAL";
Mode mode = Mode.valueOf(flagsMode);
flags.setMode(mode);
String flagsForce = "FALSE";
Force force = Force.valueOf(flagsForce);
flags.setForce(force);
flags.setTtl(FLAGS_TTL);
commonHeader.setFlags(flags);
ZULU zulu = new ZULU(generateCurrentTimestamp(this.controllerType));
commonHeader.setTimestamp(zulu);
return commonHeader;
}
Aggregations