1 package org.onap.appc.flow.controller.node;
3 import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_REQUEST_ACTION;
4 import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_REQUEST_ACTION_TYPE;
6 import java.util.Properties;
7 import org.apache.commons.lang3.StringUtils;
8 import org.onap.appc.flow.controller.data.Transaction;
9 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
12 * Helper class for RestServiceNode
14 class TransactionHandler {
16 Transaction buildTransaction(SvcLogicContext ctx, Properties prop, String resourceUri)
19 String inputRequestAction = ctx.getAttribute(INPUT_REQUEST_ACTION);
20 String inputRequestActionType = ctx.getAttribute(INPUT_REQUEST_ACTION_TYPE);
22 if (StringUtils.isBlank(inputRequestActionType)) {
23 throw new Exception("Don't know REST operation for Action " + inputRequestActionType);
25 if (StringUtils.isBlank(inputRequestAction)) {
26 throw new Exception("Don't know request-action " + INPUT_REQUEST_ACTION);
29 Transaction transaction = new Transaction();
30 transaction.setExecutionEndPoint(resourceUri);
31 transaction.setExecutionRPC(inputRequestActionType);
32 transaction.setAction(INPUT_REQUEST_ACTION);
34 //This code need to get changed to get the UserID and pass from a common place.
35 transaction.setuId(prop.getProperty(inputRequestAction.concat(".default-rest-user")));
36 transaction.setPswd(prop.getProperty(inputRequestAction.concat(".default-rest-pass")));