modifiche per permettere al client di fare i confronti sui nomi dei file anzichè sugli hash

This commit is contained in:
2015-07-09 00:10:38 +02:00
parent d6cc71d959
commit 1ee629691d
2 changed files with 16 additions and 6 deletions

View File

@@ -12,19 +12,19 @@ import java.util.List;
*/ */
@XmlRootElement @XmlRootElement
public class HashList extends ArrayList<String> public class StringList extends ArrayList<String>
{ {
// ====================================== // ======================================
// = Constructors = // = Constructors =
// ====================================== // ======================================
public HashList() public StringList()
{ {
super(); super();
} }
public HashList(Collection<? extends String> c) public StringList(Collection<? extends String> c)
{ {
super(c); super(c);
} }
@@ -33,7 +33,7 @@ public class HashList extends ArrayList<String>
// = Getters & Setters = // = Getters & Setters =
// ====================================== // ======================================
@XmlElement(name = "hash") @XmlElement(name = "string")
public List<String> getPackages() public List<String> getPackages()
{ {
return this; return this;

View File

@@ -3,7 +3,7 @@ package org.jpacrepo.service;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.jpacrepo.context.ApplicationContext; import org.jpacrepo.context.ApplicationContext;
import org.jpacrepo.context.DefaultConfiguration; import org.jpacrepo.context.DefaultConfiguration;
import org.jpacrepo.model.HashList; import org.jpacrepo.model.StringList;
import org.jpacrepo.model.PkgData; import org.jpacrepo.model.PkgData;
import org.jpacrepo.model.PkgList; import org.jpacrepo.model.PkgList;
import org.jpacrepo.model.PkgName; import org.jpacrepo.model.PkgName;
@@ -86,7 +86,17 @@ public class PacmanWebService
{ {
Query query = em.createQuery("SELECT p.md5sum FROM PkgData p"); Query query = em.createQuery("SELECT p.md5sum FROM PkgData p");
List<String> hashes = query.getResultList(); List<String> hashes = query.getResultList();
HashList hl = new HashList(hashes); StringList hl = new StringList(hashes);
return Response.ok(hl).build();
}
@GET
@Path("files")
public Response getFiles()
{
Query query = em.createQuery("SELECT p.fileName FROM PkgData p");
List<String> hashes = query.getResultList();
StringList hl = new StringList(hashes);
return Response.ok(hl).build(); return Response.ok(hl).build();
} }