Commit dbc3e6c8 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

mirna view structure removed

parent 5084a51e
......@@ -3,10 +3,12 @@ package lcsb.mapviewer.annotation.data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
import lcsb.mapviewer.common.comparator.StringComparator;
import lcsb.mapviewer.model.map.MiriamData;
/**
......@@ -108,4 +110,23 @@ public class MiRNA implements Serializable, TargettingStructure {
return new ArrayList<>();
}
/**
* Comparator of the objects by their name.
*
* @author Piotr Gawron
*
*/
public static class NameComparator implements Comparator<MiRNA> {
/**
* Default string comparator.
*/
private StringComparator stringComparator = new StringComparator();
@Override
public int compare(MiRNA arg0, MiRNA arg1) {
return stringComparator.compare(arg0.getName(), arg1.getName());
}
}
}
package lcsb.mapviewer.api.projects.mirnas;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
......@@ -13,25 +12,18 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import lcsb.mapviewer.annotation.data.MiRNA;
import lcsb.mapviewer.annotation.data.Target;
import lcsb.mapviewer.annotation.services.TaxonomyBackend;
import lcsb.mapviewer.api.BaseRestImpl;
import lcsb.mapviewer.api.QueryException;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.services.SecurityException;
import lcsb.mapviewer.services.search.ElementMatcher;
import lcsb.mapviewer.services.search.data.ElementIdentifier.ElementIdentifierType;
import lcsb.mapviewer.services.search.db.DbSearchCriteria;
import lcsb.mapviewer.services.search.db.GeneRow;
import lcsb.mapviewer.services.search.db.TargetView;
import lcsb.mapviewer.services.search.db.mirna.IMiRNAService;
import lcsb.mapviewer.services.search.db.mirna.MiRNAView;
import lcsb.mapviewer.services.view.AuthenticationToken;
@Transactional(value = "txManager")
......
......@@ -167,7 +167,7 @@ public class MiRNAService implements IMiRNAService {
removeUnknownOrganisms(drug, searchCriteria.getOrganisms());
}
Collections.sort(mirnaList, new MiRNAView.NameComparator());
Collections.sort(mirnaList, new MiRNA.NameComparator());
return mirnaList;
}
......
package lcsb.mapviewer.services.search.db.mirna;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import org.apache.log4j.Logger;
import lcsb.mapviewer.annotation.data.MiRNA;
import lcsb.mapviewer.common.comparator.StringComparator;
import lcsb.mapviewer.services.search.ISearchResultView;
import lcsb.mapviewer.services.search.db.TargetView;
import lcsb.mapviewer.services.view.AbstractView;
/**
* Data of the MiRNA from external database to be visualized in the client side.
*
* @author Ayan Rota
*
*/
public class MiRNAView extends AbstractView<MiRNA> implements Serializable, ISearchResultView {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Default class logger.
*/
@SuppressWarnings("unused")
private static Logger logger = Logger.getLogger(MiRNAView.class);
/**
* Name of the miRNA.
*/
private String name;
/**
* Is the MiRNA selected by the client or not.
*/
private boolean selected = false;
/**
* List of targets for the MiRNA.
*/
private List<TargetView> targetRows = new ArrayList<>();
/***
* Constructor that initialize the data with information from the
* parameter*object.
**
* @param miRna
* original MiRNA from which the data will be initialized
*/
protected MiRNAView(MiRNA miRna) {
// MiRNA is not db entity so don't pass it to super constructor
super(null);
}
/**
* Default constructor. Should be used only for deserialization.
*/
protected MiRNAView() {
}
/**
* Default constructor that creates a copy.
*
* @param original
* origianl object that should be copied
*/
public MiRNAView(MiRNAView original) {
super(null);
name = original.getName();
selected = original.isSelected();
targetRows.addAll(original.getTargetRows());
}
/**
* Comparator of the objects by their name.
*
* @author Piotr Gawron
*
*/
public static class NameComparator implements Comparator<MiRNA> {
/**
* Default string comparator.
*/
private StringComparator stringComparator = new StringComparator();
@Override
public int compare(MiRNA arg0, MiRNA arg1) {
return stringComparator.compare(arg0.getName(), arg1.getName());
}
}
/**
* @return the selected
*/
public boolean isSelected() {
return selected;
}
/**
* @param selected
* the selected to set
*/
public void setSelected(boolean selected) {
this.selected = selected;
}
/**
* @return the targetRows
*/
public List<TargetView> getTargetRows() {
return targetRows;
}
/**
* @param targetRows
* the targetRows to set
*/
public void setTargetRows(List<TargetView> targetRows) {
this.targetRows = targetRows;
}
/**
* @return the mirBase id
*/
public String getName() {
return name;
}
/**
* @param name
* mirBase id
*/
public void setName(String name) {
this.name = name;
}
@Override
public String getUniqueId() {
return name;
}
@Override
public void setUniqueId(String uniqueId) {
this.name = uniqueId;
}
}
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