Commit d496a1e9 authored by Matija Obreza's avatar Matija Obreza
Browse files

Accession may have multiple values per metadata+method combination

parent 6fd9dedc
update methods set options=null where trim(options)='';
update methods set `range`=null where trim(`range`)='';
...@@ -33,7 +33,7 @@ public interface TraitValueRepository { ...@@ -33,7 +33,7 @@ public interface TraitValueRepository {
Map<Long, List<ExperimentTrait>> getValues(List<AccessionTrait> accessionTraits); Map<Long, List<ExperimentTrait>> getValues(List<AccessionTrait> accessionTraits);
Map<Long, Map<Long, Object>> getValues(Metadata metadata, List<Method> methods, List<Accession> accessions); Map<Long, Map<Long, List<Object>>> getValues(Metadata metadata, List<Method> methods, List<Accession> accessions);
void insert(Metadata metadata, Accession accession, Method method, List<Object> accessionValues); void insert(Metadata metadata, Accession accession, Method method, List<Object> accessionValues);
......
...@@ -118,12 +118,12 @@ public class TraitValueRepositoryImpl implements TraitValueRepository { ...@@ -118,12 +118,12 @@ public class TraitValueRepositoryImpl implements TraitValueRepository {
} }
@Override @Override
public Map<Long, Map<Long, Object>> getValues(Metadata metadata, List<Method> methods, List<Accession> accessions) { public Map<Long, Map<Long, List<Object>>> getValues(Metadata metadata, List<Method> methods, List<Accession> accessions) {
Map<Long, Map<Long, Object>> accessionMetadataValues = new HashMap<Long, Map<Long, Object>>(); Map<Long, Map<Long, List<Object>>> accessionMetadataValues = new HashMap<Long, Map<Long, List<Object>>>();
for (Accession accession : accessions) { for (Accession accession : accessions) {
// create lists // create lists
accessionMetadataValues.put(accession.getId(), new HashMap<Long, Object>()); accessionMetadataValues.put(accession.getId(), new HashMap<Long, List<Object>>());
} }
for (Method method : methods) { for (Method method : methods) {
...@@ -145,9 +145,13 @@ public class TraitValueRepositoryImpl implements TraitValueRepository { ...@@ -145,9 +145,13 @@ public class TraitValueRepositoryImpl implements TraitValueRepository {
// TODO null values should not exist // TODO null values should not exist
if (value != null) { if (value != null) {
Map<Long, Object> accessionValues = accessionMetadataValues.get(accessionId); Map<Long, List<Object>> accessionValues = accessionMetadataValues.get(accessionId);
if (accessionValues != null) if (accessionValues != null) {
accessionValues.put(method.getId(), value); List<Object> x = accessionValues.get(method.getId());
if (x == null)
accessionValues.put(method.getId(), x = new ArrayList<Object>(3));
x.add(value);
}
} }
} }
} }
......
...@@ -80,7 +80,7 @@ public interface GenesysService { ...@@ -80,7 +80,7 @@ public interface GenesysService {
Map<Long, List<ExperimentTrait>> getAccessionTraitValues(Accession accession); Map<Long, List<ExperimentTrait>> getAccessionTraitValues(Accession accession);
Map<Long, Map<Long, Object>> getMetadataTraitValues(Metadata metadata, List<Accession> content); Map<Long, Map<Long, List<Object>>> getMetadataTraitValues(Metadata metadata, List<Accession> content);
Page<Accession> listAccessions(Collection<Long> accessionIds, Pageable pageable); Page<Accession> listAccessions(Collection<Long> accessionIds, Pageable pageable);
......
...@@ -258,7 +258,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -258,7 +258,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
} }
@Override @Override
public Map<Long, Map<Long, Object>> getMetadataTraitValues(Metadata metadata, List<Accession> accessions) { public Map<Long, Map<Long, List<Object>>> getMetadataTraitValues(Metadata metadata, List<Accession> accessions) {
List<Method> methods = metadataMethodRepository.listMetadataMethods(metadata); List<Method> methods = metadataMethodRepository.listMetadataMethods(metadata);
return traitValueRepository.getValues(metadata, methods, accessions); return traitValueRepository.getValues(metadata, methods, accessions);
} }
......
...@@ -100,7 +100,9 @@ ...@@ -100,7 +100,9 @@
<c:set value="${accessionMethods[accession.id]}" var="methodValues" /> <c:set value="${accessionMethods[accession.id]}" var="methodValues" />
<c:forEach items="${methods}" var="method"> <c:forEach items="${methods}" var="method">
<td><c:out value="${method.decode(methodValues[method.id])}" /></td> <td><c:forEach items="${methodValues[method.id]}" var="methodValue">
<c:out value="${method.coded ? method.decode(methodValue) : methodValue}" />
</c:forEach></td>
</c:forEach> </c:forEach>
</tr> </tr>
</c:forEach> </c:forEach>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment