use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIExternalStoreDTO in project carbon-apimgt by wso2.
the class ExternalStoreMappingUtil method fromAPIExternalStoreToDTO.
/**
* Converts APIStore object to APIExternalStoreDTO object.
*
* @param apiStore API Store
* @return APIExternalStoreDTO
*/
public static APIExternalStoreDTO fromAPIExternalStoreToDTO(APIStore apiStore) {
APIExternalStoreDTO apiExternalStoreDTO = new APIExternalStoreDTO();
apiExternalStoreDTO.setId(apiStore.getName());
if (apiStore.getLastUpdated() != null) {
Date lastUpdateDate = apiStore.getLastUpdated();
Timestamp timeStamp = new Timestamp(lastUpdateDate.getTime());
apiExternalStoreDTO.setLastUpdatedTime(String.valueOf(timeStamp));
}
return apiExternalStoreDTO;
}
use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIExternalStoreDTO in project carbon-apimgt by wso2.
the class ExternalStoreMappingUtil method fromAPIExternalStoreCollectionToDTO.
/**
* Converts list of APIStore object into APIExternalStoreListDTO object.
*
* @param externalStoreCollection a collection of APIStore objects
* @return APIExternalStoreListDTO object containing APIExternalStoreDTOs
*/
public static APIExternalStoreListDTO fromAPIExternalStoreCollectionToDTO(Collection<APIStore> externalStoreCollection) {
APIExternalStoreListDTO apiExternalStoreListDTO = new APIExternalStoreListDTO();
List<APIExternalStoreDTO> apiExternalStoreDTOS = apiExternalStoreListDTO.getList();
if (externalStoreCollection == null) {
externalStoreCollection = new HashSet<>();
}
for (APIStore externalStore : externalStoreCollection) {
apiExternalStoreDTOS.add(fromAPIExternalStoreToDTO(externalStore));
}
apiExternalStoreListDTO.setList(apiExternalStoreDTOS);
apiExternalStoreListDTO.setCount(apiExternalStoreDTOS.size());
return apiExternalStoreListDTO;
}
Aggregations