org.jlot.client.remote.ProjectListRestCommand Maven / Gradle / Ivy
package org.jlot.client.remote;
import java.util.ArrayList;
import java.util.List;
import org.jlot.api.JlotApiUrls;
import org.jlot.client.remote.rest.AbstractLoginRestCommand;
import org.jlot.core.dto.ProjectDTO;
import org.jlot.core.form.ProjectSearchForm;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@Component
public class ProjectListRestCommand extends AbstractLoginRestCommand>
{
@Override
protected List executeInternal ( ProjectSearchForm projectSearchForm )
{
// we return just a list of projects of the current user
RestTemplate restTemplate = getRestTemplate();
ProjectDTOList list = restTemplate.getForObject(getUrl(), ProjectDTOList.class);
return new ArrayList(list);
}
@Override
protected String getPath ( )
{
return JlotApiUrls.PROJECTS;
}
}
/**
* http://stackoverflow.com/a/6179440/351758
*/
class ProjectDTOList extends ArrayList
{
private static final long serialVersionUID = 1L;
}