Search in sources :

Example 96 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class DocumentationMappingUtil method fromDocumentationListToDTO.

/**
 * Converts a List object of ArtifactResourceMetaData into a DTO
 *
 * @param documentInfoList List of ArtifactResourceMetaData
 * @param limit          maximum number of APIs returns
 * @param offset         starting index
 * @return DocumentListDTO object containing Document DTOs
 */
public static DocumentListDTO fromDocumentationListToDTO(List<DocumentInfo> documentInfoList, int offset, int limit) {
    DocumentListDTO documentListDTO = new DocumentListDTO();
    List<DocumentDTO> documentDTOs = documentListDTO.getList();
    if (documentDTOs == null) {
        documentDTOs = new ArrayList<>();
        documentListDTO.setList(documentDTOs);
    }
    // add the required range of objects to be returned
    int start = offset < documentInfoList.size() && offset >= 0 ? offset : Integer.MAX_VALUE;
    int end = offset + limit - 1 <= documentInfoList.size() - 1 ? offset + limit - 1 : documentInfoList.size() - 1;
    for (int i = start; i <= end; i++) {
        documentDTOs.add(fromDocumentationToDTO(documentInfoList.get(i)));
    }
    documentListDTO.setCount(documentDTOs.size());
    return documentListDTO;
}
Also used : DocumentDTO(org.wso2.carbon.apimgt.rest.api.store.dto.DocumentDTO) DocumentListDTO(org.wso2.carbon.apimgt.rest.api.store.dto.DocumentListDTO)

Example 97 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class ApiApiServiceImpl method apiSubscriberCountByApiGet.

/**
 * Get list of subscriptions for an API
 *
 * @param startTime Filter for start time stamp
 * @param endTime   Filter for end time stamp
 * @param apiId     Filter for apiId
 * @param request   MSF4J request
 * @return API subscriptions count
 * @throws NotFoundException When the particular resource does not exist in the system
 */
@Override
public Response apiSubscriberCountByApiGet(String startTime, String endTime, String apiId, Request request) throws NotFoundException {
    String username = RestApiUtil.getLoggedInUsername(request);
    try {
        log.debug("Retrieving APIs created over time. [From: {} To: {} API Id: {}]");
        Analyzer analyzer = RestApiUtil.getAnalyzer(username);
        List<APISubscriptionCount> apiSubscriptionCountList = analyzer.getAPISubscriptionCount(fromISO8601ToInstant(startTime), fromISO8601ToInstant(endTime), apiId);
        APISubscriptionCountListDTO apiSubscriptionListDTO = AnalyticsMappingUtil.fromAPISubscriptionCountListToDTO(apiSubscriptionCountList);
        return Response.ok().entity(apiSubscriptionListDTO).build();
    } catch (APIManagementException e) {
        String errorMessage = "Error while retrieving API subscription info";
        ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
        log.error(errorMessage, e);
        return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
    }
}
Also used : APISubscriptionCountListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APISubscriptionCountListDTO) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) APISubscriptionCount(org.wso2.carbon.apimgt.core.models.analytics.APISubscriptionCount) ErrorDTO(org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO) Analyzer(org.wso2.carbon.apimgt.core.api.Analyzer)

Example 98 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class ApiApiServiceImpl method apiListGet.

/**
 * Get list of API Info
 *
 * @param startTime Filter for start time stamp
 * @param endTime   Filter for end time stamp
 * @param createdBy Filter for created user
 * @param request   MSF4J request
 * @return API List
 * @throws NotFoundException When the particular resource does not exist in the system
 */
@Override
public Response apiListGet(String startTime, String endTime, String createdBy, Request request) throws NotFoundException {
    String username = RestApiUtil.getLoggedInUsername(request);
    try {
        log.debug("Retrieving API information. [From: {} To: {} Created By:{} ]", startTime, endTime, createdBy);
        Analyzer analyzer = RestApiUtil.getAnalyzer(username);
        ZoneId requestTimezone = RestApiUtil.getRequestTimeZone(startTime);
        List<APIInfo> apiInfoList = analyzer.getAPIInfo(fromISO8601ToInstant(startTime), fromISO8601ToInstant(endTime), createdBy);
        APIInfoListDTO apiInfoListDTO = AnalyticsMappingUtil.fromAPIInfoListToDTO(apiInfoList, requestTimezone);
        return Response.ok().entity(apiInfoListDTO).build();
    } catch (APIManagementException e) {
        String errorMessage = "Error while retrieving API information";
        ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
        log.error(errorMessage, e);
        return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
    }
}
Also used : ZoneId(java.time.ZoneId) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) ErrorDTO(org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO) APIInfo(org.wso2.carbon.apimgt.core.models.analytics.APIInfo) Analyzer(org.wso2.carbon.apimgt.core.api.Analyzer) APIInfoListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.APIInfoListDTO)

Example 99 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class ApplicationApiServiceImpl method applicationCountOverTimeGet.

/**
 * Get list of Application count information
 *
 * @param startTime Filter for start time stamp
 * @param endTime   Filter for end time stamp
 * @param createdBy Filter for application creator
 * @param request   MSF4J request
 * @return Application count over time
 * @throws NotFoundException When the particular resource does not exist in the system
 */
@Override
public Response applicationCountOverTimeGet(String startTime, String endTime, String createdBy, Request request) throws NotFoundException {
    String username = RestApiUtil.getLoggedInUsername(request);
    try {
        log.debug("Retrieving applications created over time. [From: {} to: {} Created By: {}]", startTime, endTime, createdBy);
        Analyzer analyzer = RestApiUtil.getAnalyzer(username);
        ZoneId requestTimezone = RestApiUtil.getRequestTimeZone(startTime);
        List<ApplicationCount> applicationCountList = analyzer.getApplicationCount(fromISO8601ToInstant(startTime), fromISO8601ToInstant(endTime), createdBy);
        ApplicationCountListDTO applicationCountListDTO = AnalyticsMappingUtil.fromApplicationCountToListDTO(applicationCountList, requestTimezone);
        return Response.ok().entity(applicationCountListDTO).build();
    } catch (APIManagementException e) {
        String errorMessage = "Error while retrieving application created over time info";
        ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
        log.error(errorMessage, e);
        return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
    }
}
Also used : ZoneId(java.time.ZoneId) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) ErrorDTO(org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO) Analyzer(org.wso2.carbon.apimgt.core.api.Analyzer) ApplicationCount(org.wso2.carbon.apimgt.core.models.analytics.ApplicationCount) ApplicationCountListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.ApplicationCountListDTO)

Example 100 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class SubscriptionApiServiceImpl method subscriptionCountOverTimeGet.

/**
 * Get list of subscriptions created over time
 *
 * @param startTime Filter for start time stamp
 * @param endTime   Filter for end time stamp
 * @param createdBy Filter for createdBy
 * @param request   MSF4J request
 * @return Subscriptions count over time
 * @throws NotFoundException When the particular resource does not exist in the system
 */
@Override
public Response subscriptionCountOverTimeGet(String startTime, String endTime, String createdBy, Request request) throws NotFoundException {
    String username = RestApiUtil.getLoggedInUsername(request);
    try {
        log.debug("Retrieving subscriptions created over time. [From: {} To: {} Created By: {}]", startTime, endTime, createdBy);
        Analyzer analyzer = RestApiUtil.getAnalyzer(username);
        ZoneId requestTimezone = RestApiUtil.getRequestTimeZone(startTime);
        List<SubscriptionCount> subscriptionCount = analyzer.getSubscriptionCount(fromISO8601ToInstant(startTime), fromISO8601ToInstant(endTime), createdBy);
        SubscriptionCountListDTO subscriptionListDTO = AnalyticsMappingUtil.fromSubscriptionCountListToDTO(subscriptionCount, requestTimezone);
        return Response.ok().entity(subscriptionListDTO).build();
    } catch (APIManagementException e) {
        String errorMessage = "Error while retrieving Subscription Count";
        ErrorDTO errorDTO = RestApiUtil.getErrorDTO(e.getErrorHandler());
        log.error(errorMessage, e);
        return Response.status(e.getErrorHandler().getHttpStatusCode()).entity(errorDTO).build();
    }
}
Also used : ZoneId(java.time.ZoneId) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) SubscriptionCountListDTO(org.wso2.carbon.apimgt.rest.api.analytics.dto.SubscriptionCountListDTO) ErrorDTO(org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO) Analyzer(org.wso2.carbon.apimgt.core.api.Analyzer) SubscriptionCount(org.wso2.carbon.apimgt.core.models.analytics.SubscriptionCount)

Aggregations

SVGCoordinates (org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates)57 ActivityInterface (org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface)47 Test (org.testng.annotations.Test)17 SiddhiAppRuntime (org.wso2.siddhi.core.SiddhiAppRuntime)17 SiddhiManager (org.wso2.siddhi.core.SiddhiManager)17 Event (org.wso2.siddhi.core.event.Event)17 InputHandler (org.wso2.siddhi.core.stream.input.InputHandler)13 SVGDimension (org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)11 StreamEventPool (org.wso2.siddhi.core.event.stream.StreamEventPool)11 ArrayList (java.util.ArrayList)10 OMElement (org.apache.axiom.om.OMElement)10 DiagnosticPos (org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos)10 Element (org.w3c.dom.Element)9 StreamCallback (org.wso2.siddhi.core.stream.output.StreamCallback)9 TopLevelNode (org.ballerinalang.model.tree.TopLevelNode)7 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)7 ZoneId (java.time.ZoneId)5 HashMap (java.util.HashMap)5 Analyzer (org.wso2.carbon.apimgt.core.api.Analyzer)5 ErrorDTO (org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO)5