package com.blstream.myhoard.biz.service;

import com.blstream.myhoard.biz.model.ItemDTO;
import com.blstream.myhoard.db.dao.ResourceDAO;
import com.blstream.myhoard.db.model.ItemDS;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;

@Service
public class ItemService implements ResourceService<ItemDTO> {

    private ResourceDAO<ItemDS> itemDAO;

    public void setItemDAO(ResourceDAO<ItemDS> itemDAO) {
        this.itemDAO = itemDAO;
    }

    @Override
    public List<ItemDTO> getList() {
        List<ItemDTO> result = new ArrayList<>();
        for (ItemDS i : itemDAO.getList())
            result.add(i.toDTO());
        return result;
    }

    @Override
    public List<ItemDTO> getList(Map<String, String> params) {
        return null;
    }

    @Override
    public ItemDTO get(int id) {
        return itemDAO.get(id).toDTO();
    }

    @Override
    public void create(ItemDTO obj) {
        ItemDS item = obj.toItemDS();
        itemDAO.create(item);
        item.toDTO(obj);
    }

    @Override
    public void update(ItemDTO obj) {
        ItemDS item = obj.toItemDS();
        itemDAO.update(item);
        item.toDTO(obj);
    }

    @Override
    public void remove(int id) {
        itemDAO.get(id);
        itemDAO.remove(id);
    }

    @Override
    public ItemDTO getByAccess_token(String access_token) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public ItemDTO getByRefresh_token(String refresh_token) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

}

@@ -781,25 +781,159 @@
 ng, 
-String%3E params) %7B
+Object%3E params) %7B%0A        List%3CItemDTO%3E result = new ArrayList%3C%3E();%0A        for (ItemDS i : itemDAO.getList(params))%0A            result.add(i.toDTO());
 %0A   
@@ -948,12 +948,14 @@
 urn 
-null
+result
 ;%0A  
@@ -1685,225 +1685,6 @@
  %7D%0A%0A
-    @Override%0A    public ItemDTO getByRefresh_token(String refresh_token) %7B%0A        throw new UnsupportedOperationException(%22Not supported yet.%22); //To change body of generated methods, choose Tools %7C Templates.%0A    %7D%0A%0A
 %7D%0A

Update ItemService.java