Search in sources :

Example 1 with PersistenceServiceDTO

use of org.eclipse.smarthome.core.persistence.dto.PersistenceServiceDTO in project smarthome by eclipse.

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<PersistenceServiceDTO>();
    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 : PersistenceService(org.eclipse.smarthome.core.persistence.PersistenceService) QueryablePersistenceService(org.eclipse.smarthome.core.persistence.QueryablePersistenceService) ModifiablePersistenceService(org.eclipse.smarthome.core.persistence.ModifiablePersistenceService) QueryablePersistenceService(org.eclipse.smarthome.core.persistence.QueryablePersistenceService) PersistenceServiceDTO(org.eclipse.smarthome.core.persistence.dto.PersistenceServiceDTO) ModifiablePersistenceService(org.eclipse.smarthome.core.persistence.ModifiablePersistenceService) ArrayList(java.util.ArrayList)

Aggregations

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