本文整理匯總了Java中org.sunbird.common.request.ExecutionContext類的典型用法代碼示例。如果您正苦於以下問題:Java ExecutionContext類的具體用法?Java ExecutionContext怎麽用?Java ExecutionContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ExecutionContext類屬於org.sunbird.common.request包,在下文中一共展示了ExecutionContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendNotification
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
public Promise<Result> sendNotification() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log("Send notification api call" + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
RequestValidator.validateSendNotification(reqObj);
reqObj.setOperation(ActorOperations.SEND_NOTIFICATION.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
Map<String, Object> innerMap = reqObj.getRequest();
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例2: approveOrg
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to approve an organization
*
* @return Promise<Result>
*/
public Promise<Result> approveOrg() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log("Approve organisation request: " + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
RequestValidator.validateOrg(reqObj);
reqObj.setOperation(ActorOperations.APPROVE_ORG.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.ORGANISATION, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, null);
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, null));
}
}
示例3: updateOrgStatus
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to update the status of the organization
*
* @return Promise<Result>
*/
public Promise<Result> updateOrgStatus() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log("Update organisation request: " + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
RequestValidator.validateUpdateOrgStatus(reqObj);
reqObj.setOperation(ActorOperations.UPDATE_ORG_STATUS.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.ORGANISATION, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, null);
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, null));
}
}
示例4: getOrgDetails
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* This method will provide user profile details based on requested userId.
*
* @return Promise<Result>
*/
public Promise<Result> getOrgDetails() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log("Get Organisation details request: " + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
RequestValidator.validateOrg(reqObj);
reqObj.setOperation(ActorOperations.GET_ORG_DETAILS.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.ORGANISATION, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例5: addMemberToOrganisation
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to add an user to the organization
*
* @return Promise<Result>
*/
public Promise<Result> addMemberToOrganisation() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log(" add member to organisation = " + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
RequestValidator.validateAddMember(reqObj);
reqObj.setOperation(ActorOperations.ADD_MEMBER_ORGANISATION.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.USER_ORG, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例6: removeMemberFromOrganisation
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to remove an user to the organization
*
* @return Promise<Result>
*/
public Promise<Result> removeMemberFromOrganisation() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log(" remove member from organisation = " + requestData,
LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
RequestValidator.validateUserOrg(reqObj);
reqObj.setOperation(ActorOperations.REMOVE_MEMBER_ORGANISATION.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.USER_ORG, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例7: joinUserOrganisation
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to perform the user join organization operation .
*
* @return Promise<Result>
*/
public Promise<Result> joinUserOrganisation() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log(" join user organisation = " + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
RequestValidator.validateUserOrg(reqObj);
reqObj.setOperation(ActorOperations.JOIN_USER_ORGANISATION.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.USER_ORG, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例8: approveUserOrganisation
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to approve the user joined organization .
*
* @return Promise<Result>
*/
public Promise<Result> approveUserOrganisation() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log(" approve user organisation = " + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
RequestValidator.validateUserOrg(reqObj);
reqObj.setOperation(ActorOperations.APPROVE_USER_ORGANISATION.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.USER_ORG, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例9: rejectUserOrganisation
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to reject the user organization .
*
* @return Promise<Result>
*/
public Promise<Result> rejectUserOrganisation() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log(" approve user organisation = " + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
RequestValidator.validateUserOrg(reqObj);
reqObj.setOperation(ActorOperations.REJECT_USER_ORGANISATION.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.USER_ORG, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例10: downloadOrgs
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* This method will download organization details.
*
* @return Promise<Result>
*/
public Promise<Result> downloadOrgs() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log(" Downlaod org data request =" + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
reqObj.setOperation(ActorOperations.DOWNLOAD_ORGS.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例11: createOrgType
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* This method will create OrgType.
*
* @return Promise<Result>
*/
public Promise<Result> createOrgType() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log("Organisation CreateOrgType method call =" + requestData,
LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
RequestValidator.validateCreateOrgType(reqObj);
reqObj.setOperation(ActorOperations.CREATE_ORG_TYPE.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
reqObj.getRequest().put(JsonKey.CREATED_BY, ctx().flash().get(JsonKey.USER_ID));
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例12: updateOrgType
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* This method will update OrgType.
*
* @return Promise<Result>
*/
public Promise<Result> updateOrgType() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log("Organisation UpdateOrgType method call =" + requestData,
LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
RequestValidator.validateUpdateOrgType(reqObj);
reqObj.setOperation(ActorOperations.UPDATE_ORG_TYPE.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
reqObj.getRequest().put(JsonKey.UPDATED_BY, ctx().flash().get(JsonKey.USER_ID));
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例13: updateClientKey
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to update the client key for the given clientId in the header
* @return Response object on success else Error object
*/
public Promise<Result> updateClientKey() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log("Update client key: " + requestData, LoggerEnum.INFO.name());
String masterKey = request().getHeader(HeaderParam.X_Authenticated_Client_Token.getName());
String clientId = request().getHeader(HeaderParam.X_Authenticated_Client_Id.getName());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
RequestValidator.validateUpdateClientKey(clientId, masterKey);
reqObj.setOperation(ActorOperations.UPDATE_CLIENT_KEY.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = (HashMap<String, Object>) reqObj.getRequest();
innerMap.put(JsonKey.CLIENT_ID, clientId);
innerMap.put(JsonKey.MASTER_KEY, masterKey);
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
ProjectLogger.log("Error in controller", e);
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例14: getClientKey
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to get client data such as Master Key based on given clientId
* @param clientId
* @return Response object on success else Error object
*/
public Promise<Result> getClientKey(String clientId) {
try {
ProjectLogger.log("Get client key: " + clientId, LoggerEnum.INFO.name());
String type = request().getQueryString(JsonKey.TYPE);
RequestValidator.validateGetClientKey(clientId , type);
Request reqObj = new Request();
reqObj.setOperation(ActorOperations.GET_CLIENT_KEY.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.CLIENT_ID, clientId);
innerMap.put(JsonKey.TYPE,type);
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
} catch (Exception e) {
ProjectLogger.log("Error in controller", e);
return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
}
}
示例15: createNote
import org.sunbird.common.request.ExecutionContext; //導入依賴的package包/類
/**
* Method to create Note
* @return Promise<Result>
*/
public Promise<Result> createNote() {
try {
JsonNode requestData = request().body().asJson();
ProjectLogger.log("Create note request: " + requestData, LoggerEnum.INFO.name());
Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
if(null != ctx().flash().get(JsonKey.IS_AUTH_REQ) && Boolean.parseBoolean(ctx().flash().get(JsonKey.IS_AUTH_REQ))){
String userId = (String) reqObj.get(JsonKey.USER_ID);
if((!ProjectUtil.isStringNullOREmpty(userId)) && (!userId.equals(ctx().flash().get(JsonKey.USER_ID)))){
throw new ProjectCommonException(ResponseCode.unAuthorised.getErrorCode(), ResponseCode.unAuthorised.getErrorMessage(), ResponseCode.UNAUTHORIZED.getResponseCode());
}
}
RequestValidator.validateNote(reqObj);
reqObj.setOperation(ActorOperations.CREATE_NOTE.getValue());
reqObj.setRequestId(ExecutionContext.getRequestId());
reqObj.setEnv(getEnvironment());
HashMap<String, Object> innerMap = new HashMap<>();
innerMap.put(JsonKey.NOTE, reqObj.getRequest());
innerMap.put(JsonKey.REQUESTED_BY,ctx().flash().get(JsonKey.USER_ID));
reqObj.setRequest(innerMap);
return actorResponseHandler(getActorRef(), reqObj, timeout, null, null);
} catch (Exception e) {
ProjectLogger.log("Error in controller", e);
return Promise.<Result>pure(createCommonExceptionResponse(e, null));
}
}