/** * Adds the provided node as the second argument of an OR clause to this node. * * @param node Node to 'OR' with. * @return New top OR node, new root. * @throws Exception */ public ConditionsTreeNode or(ConditionsTreeNode node) throws Exception { mLeafSet.addAll(node.getLeafSet()); if (mConditions == null) { mConditions = node; return node; } mConditions = mConditions.or(node); return mConditions; }
/** TODO THIS HAS TO GO!!!! very dirty fix for remotesearch support atm */ public String getRemoteSearchArguments() { Set<ConditionsTreeNode> leafSet = getLeafSet(); if (leafSet == null) { return null; } for (ConditionsTreeNode node : leafSet) { if (node.getCondition().field == Searchfield.SUBJECT || node.getCondition().field == Searchfield.SENDER) { return node.getCondition().value; } } return null; }
public LocalSearch(Parcel in) { mName = in.readString(); mPredefined = (in.readByte() == 1); mManualSearch = (in.readByte() == 1); mAccountUuids.addAll(in.createStringArrayList()); mConditions = in.readParcelable(LocalSearch.class.getClassLoader()); mLeafSet = (mConditions == null) ? null : mConditions.getLeafSet(); }
@Override public LocalSearch clone() { ConditionsTreeNode conditions = (mConditions == null) ? null : mConditions.cloneTree(); LocalSearch copy = new LocalSearch(mName, conditions, null, mPredefined); copy.mManualSearch = mManualSearch; copy.mAccountUuids = new HashSet<String>(mAccountUuids); return copy; }
/** * Use this constructor when you know what you'r doing. Normally it's only used when restoring * these search objects from the database. * * @param name Name of the search * @param searchConditions SearchConditions, may contains flags and folders * @param accounts Relative Account's uuid's * @param predefined Is this a predefined search or a user created one? */ protected LocalSearch( String name, ConditionsTreeNode searchConditions, String accounts, boolean predefined) { this(name); mConditions = searchConditions; mPredefined = predefined; mLeafSet = new HashSet<ConditionsTreeNode>(); if (mConditions != null) { mLeafSet.addAll(mConditions.getLeafSet()); } // initialize accounts if (accounts != null) { for (String account : accounts.split(",")) { mAccountUuids.add(account); } } else { // impossible but still not unrecoverable } }