--- /dev/null
+/*\r
+ * This file is part of NeverNote \r
+ * Copyright 2009 Randy Baumgarte\r
+ * \r
+ * This file may be licensed under the terms of of the\r
+ * GNU General Public License Version 2 (the ``GPL'').\r
+ *\r
+ * Software distributed under the License is distributed\r
+ * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either\r
+ * express or implied. See the GPL for the specific language\r
+ * governing rights and limitations.\r
+ *\r
+ * You should have received a copy of the GPL along with this\r
+ * program. If not, go to http://www.gnu.org/licenses/gpl.html\r
+ * or write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+ *\r
+*/\r
+\r
+package cx.fbn.nevernote.filters;\r
+\r
+import java.util.List;\r
+\r
+import com.evernote.edam.type.Note;\r
+import com.evernote.edam.type.Tag;\r
+\r
+import cx.fbn.nevernote.sql.DatabaseConnection;\r
+import cx.fbn.nevernote.utilities.ApplicationLogger;\r
+\r
+public class FilterEditorTags {\r
+ DatabaseConnection conn;\r
+ ApplicationLogger logger;\r
+ public boolean permitNew;\r
+ \r
+ public FilterEditorTags(DatabaseConnection conn, ApplicationLogger logger) {\r
+ this.logger = logger;\r
+ this.conn = conn;\r
+ }\r
+ \r
+ \r
+ public List<Tag> getValidTags(Note note) {\r
+ // Reset permit new flag\r
+ permitNew = true;\r
+ \r
+ boolean linked = conn.getNotebookTable().isLinked(note.getNotebookGuid());\r
+ \r
+ // If the notebook is linked, then we really only need to return the one notebookd\r
+ if (linked) {\r
+ permitNew = false;\r
+ return conn.getTagTable().getTagsForNotebook(note.getNotebookGuid());\r
+ } else\r
+ return conn.getTagTable().getTagsForNotebook("");\r
+ }\r
+\r
+}\r