Search in sources :

Example 1 with LifecycleHistoryDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.LifecycleHistoryDTO in project carbon-apimgt by wso2.

the class APIMappingUtil method fromLifecycleHistoryModelToDTO.

/**
 * Return the REST API DTO representation of API Lifecycle history information.
 *
 * @param lifeCycleEvents API lifecycle history information
 * @return REST API DTO representation of API Lifecycle history information
 */
public static LifecycleHistoryDTO fromLifecycleHistoryModelToDTO(List<LifeCycleEvent> lifeCycleEvents) {
    LifecycleHistoryDTO historyDTO = new LifecycleHistoryDTO();
    historyDTO.setCount(lifeCycleEvents.size());
    for (LifeCycleEvent event : lifeCycleEvents) {
        LifecycleHistoryItemDTO historyItemDTO = new LifecycleHistoryItemDTO();
        historyItemDTO.setPostState(event.getNewStatus());
        historyItemDTO.setPreviousState(event.getOldStatus());
        historyItemDTO.setUser(event.getUserId());
        String updatedTime = RestApiCommonUtil.getRFC3339Date(event.getDate());
        historyItemDTO.setUpdatedTime(updatedTime);
        historyDTO.getList().add(historyItemDTO);
    }
    return historyDTO;
}
Also used : LifecycleHistoryDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.LifecycleHistoryDTO) LifecycleHistoryItemDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.LifecycleHistoryItemDTO) LifeCycleEvent(org.wso2.carbon.apimgt.api.model.LifeCycleEvent)

Aggregations

LifeCycleEvent (org.wso2.carbon.apimgt.api.model.LifeCycleEvent)1 LifecycleHistoryDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.LifecycleHistoryDTO)1 LifecycleHistoryItemDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.LifecycleHistoryItemDTO)1