Java Code Examples for org.wso2.carbon.apimgt.impl.APIConstants#WSO2_ANONYMOUS_USER
The following examples show how to use
org.wso2.carbon.apimgt.impl.APIConstants#WSO2_ANONYMOUS_USER .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecommenderDetailsExtractor.java From carbon-apimgt with Apache License 2.0 | 6 votes |
@Override public void publishClickedApi(ApiTypeWrapper api, String userName) { if (userName != APIConstants.WSO2_ANONYMOUS_USER) { String userID = getUserId(userName); String apiName = api.getName(); JSONObject obj = new JSONObject(); obj.put("user", userID); obj.put("api_name", apiName); JSONObject payload = new JSONObject(); payload.put(APIConstants.ACTION_STRING, APIConstants.ADD_USER_CLICKED_API); payload.put(APIConstants.PAYLOAD_STRING, obj); publishEvent(payload.toString()); } }
Example 2
Source File: RecommenderDetailsExtractor.java From carbon-apimgt with Apache License 2.0 | 6 votes |
@Override public void publishSearchQueries(String query, String username) { if (userName != APIConstants.WSO2_ANONYMOUS_USER) { String userID = getUserId(userName); query = query.split("&", 2)[0]; JSONObject obj = new JSONObject(); obj.put("user", userID); obj.put("search_query", query); JSONObject payload = new JSONObject(); payload.put(APIConstants.ACTION_STRING, APIConstants.ADD_USER_SEARCHED_QUERY); payload.put(APIConstants.PAYLOAD_STRING, obj); publishEvent(payload.toString()); } }
Example 3
Source File: RecommenderDetailsExtractor.java From carbon-apimgt with Apache License 2.0 | 5 votes |
public void run() { if (tenantDomain == null) { tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } startTenantFlow(tenantDomain); tenantFlowStarted = true; try { if (APIUtil.isRecommendationEnabled(tenantDomain)) { if (APIConstants.ADD_API.equals(publishingDetailType)) { publishAPIDetails(api, tenantDomain); } else if (APIConstants.ADD_NEW_APPLICATION.equals(publishingDetailType)) { publishApplicationDetails(application, userName, applicationId); } else if (APIConstants.UPDATED_APPLICATION.equals(publishingDetailType)) { publishApplicationDetails(application, userName, applicationId); } else if (APIConstants.DELETE_APPLICATION.equals(publishingDetailType)) { publishDeletedApplication(applicationId); } else if (APIConstants.ADD_USER_CLICKED_API.equals(publishingDetailType)) { publishClickedApi(clickedApi, userName); } else if (APIConstants.ADD_USER_SEARCHED_QUERY.equals(publishingDetailType)) { publishSearchQueries(searchQuery, userName); } if (!APIConstants.ADD_API.equals(publishingDetailType) && userName != null && userName != APIConstants.WSO2_ANONYMOUS_USER && requestTenantDomain != null) { updateRecommendationsCache(userName, requestTenantDomain); } } } catch (IOException e) { log.error("When extracting data for the recommendation system !", e); } finally { if (tenantFlowStarted) { endTenantFlow(); } } }