use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.LifecycleHistoryItemDTO 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;
}
Aggregations