Search in sources :

Example 1 with PersistenceServiceDTO

use of org.openhab.core.persistence.dto.PersistenceServiceDTO in project openhab-core by openhab.

the class PersistenceResource method getPersistenceServiceList.

/**
 * Gets a list of persistence services currently configured in the system
 *
 * @return list of persistence services as {@link ServiceBean}
 */
private List<PersistenceServiceDTO> getPersistenceServiceList(Locale locale) {
    List<PersistenceServiceDTO> dtoList = new ArrayList<>();
    for (PersistenceService service : persistenceServiceRegistry.getAll()) {
        PersistenceServiceDTO serviceDTO = new PersistenceServiceDTO();
        serviceDTO.id = service.getId();
        serviceDTO.label = service.getLabel(locale);
        if (service instanceof ModifiablePersistenceService) {
            serviceDTO.type = MODIFYABLE;
        } else if (service instanceof QueryablePersistenceService) {
            serviceDTO.type = QUERYABLE;
        } else {
            serviceDTO.type = STANDARD;
        }
        dtoList.add(serviceDTO);
    }
    return dtoList;
}
Also used : ModifiablePersistenceService(org.openhab.core.persistence.ModifiablePersistenceService) PersistenceService(org.openhab.core.persistence.PersistenceService) QueryablePersistenceService(org.openhab.core.persistence.QueryablePersistenceService) QueryablePersistenceService(org.openhab.core.persistence.QueryablePersistenceService) PersistenceServiceDTO(org.openhab.core.persistence.dto.PersistenceServiceDTO) ModifiablePersistenceService(org.openhab.core.persistence.ModifiablePersistenceService) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 ModifiablePersistenceService (org.openhab.core.persistence.ModifiablePersistenceService)1 PersistenceService (org.openhab.core.persistence.PersistenceService)1 QueryablePersistenceService (org.openhab.core.persistence.QueryablePersistenceService)1 PersistenceServiceDTO (org.openhab.core.persistence.dto.PersistenceServiceDTO)1