OSDN Git Service

Add notebook specific sorting and alter some NeverNote labels to say NixNote.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / filters / FilterEditorTags.java
1 /*\r
2  * This file is part of NixNote \r
3  * Copyright 2009 Randy Baumgarte\r
4  * \r
5  * This file may be licensed under the terms of of the\r
6  * GNU General Public License Version 2 (the ``GPL'').\r
7  *\r
8  * Software distributed under the License is distributed\r
9  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either\r
10  * express or implied. See the GPL for the specific language\r
11  * governing rights and limitations.\r
12  *\r
13  * You should have received a copy of the GPL along with this\r
14  * program. If not, go to http://www.gnu.org/licenses/gpl.html\r
15  * or write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
17  *\r
18 */\r
19 \r
20 package cx.fbn.nevernote.filters;\r
21 \r
22 import java.util.List;\r
23 \r
24 import com.evernote.edam.type.Note;\r
25 import com.evernote.edam.type.Tag;\r
26 \r
27 import cx.fbn.nevernote.sql.DatabaseConnection;\r
28 import cx.fbn.nevernote.utilities.ApplicationLogger;\r
29 \r
30 public class FilterEditorTags {\r
31         DatabaseConnection conn;\r
32         ApplicationLogger logger;\r
33         public boolean permitNew;\r
34         \r
35         public FilterEditorTags(DatabaseConnection conn, ApplicationLogger logger) {\r
36                 this.logger = logger;\r
37                 this.conn = conn;\r
38         }\r
39         \r
40         \r
41         public List<Tag> getValidTags(Note note) {\r
42                 // Reset permit new flag\r
43                 permitNew = true;\r
44                 \r
45                 boolean linked = conn.getNotebookTable().isLinked(note.getNotebookGuid());\r
46                 \r
47                 // If the notebook is linked, then we really only need to return the one notebookd\r
48                 if (linked) {\r
49                         permitNew = false;\r
50                         return conn.getTagTable().getTagsForNotebook(note.getNotebookGuid());\r
51                 } else\r
52                         return conn.getTagTable().getTagsForNotebook("");\r
53         }\r
54 \r
55 }\r