Skip to content

Instantly share code, notes, and snippets.

@snooplsm
Created October 22, 2010 19:24
Show Gist options
  • Select an option

  • Save snooplsm/641212 to your computer and use it in GitHub Desktop.

Select an option

Save snooplsm/641212 to your computer and use it in GitHub Desktop.
public List<SiteNode> findSites(Long surveyId) throws IOException, ApiException {
HttpPost p = post(FIND_SITES, params(SURVEY_ID, surveyId));
HttpResponse response = client.execute(p);
try {
checkSecurity(response);
List<SiteNode> nodes = mapper.readValue(response.getEntity().getContent(), TypeFactory.collectionType(List.class, SiteNode.class));
return nodes;
} catch (Exception e) {
throwIt(e);
}
return null;
}
package com.teachscape.dct;
import java.io.Serializable;
import org.codehaus.jackson.annotate.JsonProperty;
public class SiteNode implements Serializable {
private static final long serialVersionUID = 1L;
@JsonProperty("id")
private Long id;
@JsonProperty("n")
private String name;
@JsonProperty("pid")
private Long parentId;
public Long getId() {
return id;
}
public String getName() {
return name;
}
public Long getParentId() {
return parentId;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment