List of usage examples for com.mongodb BasicDBObject containsField
public boolean containsField(final String field)
From source file:tango.parameter.SliderParameter.java
License:Open Source License
@Override public void dbGet(BasicDBObject DBO) { if (DBO.containsField(id) && DBO.get(id) != null) { int value = DBO.getInt(id); if (value < this.min) { slider.setValue(min);//from w w w .ja va 2 s. c om } else if (value > this.max) { slider.setValue(max); } else { slider.setValue(value); } } setColor(); }
From source file:tango.parameter.SpinnerParameter.java
License:Open Source License
@Override public void dbGet(BasicDBObject DBO) { if (DBO.containsField(id)) { model.setValue(new Integer(DBO.getInt(id))); }/* w ww .j a v a2 s. c o m*/ setColor(); }
From source file:tango.parameter.StructureParameter.java
License:Open Source License
@Override public void dbGet(BasicDBObject DBO) { if (DBO.containsField(id)) { int idx = DBO.getInt(id) + 1; if (choice.getItemCount() > idx) { choice.setSelectedIndex(idx); }//ww w .j a va2 s .com } setColor(); }
From source file:tango.parameter.TextParameter.java
License:Open Source License
@Override public void dbGet(BasicDBObject DBO) { if (DBO.containsField(id)) { text.setText(DBO.getString(id)); }// w w w . j a v a 2s . c o m setColor(); }
From source file:tango.plugin.filter.PostFilterSequence.java
License:Open Source License
public PostFilterSequence(BasicDBObject type, int nbCPUs, boolean verbose) { if (type == null || !type.containsField("postFilters")) return;//from w w w.j ava2 s . co m BasicDBList prefilters = (BasicDBList) type.get("postFilters"); filters = new ArrayList<PostFilter>(prefilters.size()); for (int i = 0; i < prefilters.size(); i++) { Object o = prefilters.get(i); if (o != null) { BasicDBObject data = (BasicDBObject) o; if (!data.getBoolean("isActivated", true)) { filters.add(new DummyPostFilter()); continue; } PostFilter f = PluginFactory.getPostFilter(data.getString("method")); if (f != null) { Parameter[] parameters = f.getParameters(); for (Parameter p : parameters) p.dbGet(data); filters.add(f); f.setMultithread(nbCPUs); f.setVerbose(verbose); } } } }
From source file:tango.plugin.filter.PreFilterSequence.java
License:Open Source License
public PreFilterSequence(BasicDBObject settings, int nbCPUs, boolean verbose) { if (settings == null || !settings.containsField("preFilters")) return;/*w w w . j a v a 2 s . c om*/ BasicDBList prefilters = (BasicDBList) settings.get("preFilters"); filters = new ArrayList<PreFilter>(prefilters.size()); for (int i = 0; i < prefilters.size(); i++) { //IJ.log(i+""); Object o = prefilters.get(i); if (o != null) { BasicDBObject data = (BasicDBObject) o; //IJ.log("preFilter:"+data); if (!data.getBoolean("isActivated", true)) { filters.add(new DummyPreFilter()); continue; } PreFilter f = PluginFactory.getPreFilter(data.getString("method")); if (f != null) { //IJ.log("preFilter loaded:"+f.getId()); Parameter[] parameters = f.getParameters(); for (Parameter p : parameters) p.dbGet(data); filters.add(f); f.setMultithread(nbCPUs); f.setVerbose(verbose); } } } }
From source file:tango.plugin.measurement.MeasurementSequence.java
License:Open Source License
private boolean setIgnoredKey(BasicDBObject o, KeyParameter key) { if (key.isSelected()) { if (o.containsField(key.getKey())) { key.setSelected(false);//from w ww .j a v a 2 s . co m return false; //IJ.log("measurement sequence set ignored keys objects: "+keys[i].getKey()+ " "+false); } else return true; } else return false; }
From source file:tango.plugin.measurement.MeasurementSequence.java
License:Open Source License
private boolean setIgnoredKey(Collection<BasicDBObject> os, KeyParameter key) { if (key.isSelected()) { boolean doMeas = false; String k = key.getKey();//from w w w . j a v a 2s. c o m for (BasicDBObject o : os) { if (!o.containsField(k)) { doMeas = true; break; } } key.setSelected(doMeas); return doMeas; } else return false; }
From source file:uk.ac.ebi.eva.test.utils.JobTestUtils.java
License:Apache License
public static void checkStringInsideList(BasicDBObject metadataMongo, String field) { assertTrue(metadataMongo.containsField(field)); Object objectList = metadataMongo.get(field); assertTrue(objectList instanceof BasicDBList); BasicDBList list = (BasicDBList) objectList; for (Object element : list) { assertTrue(element instanceof String); assertNotNull(element);/*from w w w. j a v a 2s . co m*/ assertFalse(element.toString().isEmpty()); } }
From source file:uk.ac.ebi.eva.test.utils.JobTestUtils.java
License:Apache License
public static void checkFieldsInsideList(BasicDBObject metadataMongo, String field, List<String> innerFields) { assertTrue(metadataMongo.containsField(field)); Object objectList = metadataMongo.get(field); assertTrue(objectList instanceof BasicDBList); BasicDBList list = (BasicDBList) objectList; for (Object element : list) { assertTrue(element instanceof BasicDBObject); for (String innerField : innerFields) { assertNotNull(((BasicDBObject) element).get(innerField)); assertFalse(((BasicDBObject) element).get(innerField).toString().isEmpty()); }//from w w w. ja v a 2 s .c om } }