alpha 0.0.2
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / search / SearchIndices.java
1 package de.dhbwloe.campusapp.search;
2
3 import java.util.ArrayList;
4 import java.util.Date;
5
6 import de.dhbwloe.campusapp.CampusAppContext;
7
8 /**
9  * Created by pk910 on 19.01.2016.
10  */
11 public class SearchIndices {
12     private String keyname = null;
13     private StringBuilder keywordsBuffer = new StringBuilder();
14     protected boolean isStatic = false;
15     protected String target = new String();
16     protected String keywords = null;
17     protected String title = null;
18     protected String description = null;
19     protected long updateTime = 0;
20
21     public SearchIndices(String keyname) {
22         this.keyname = keyname;
23         this.updateTime = (new Date()).getTime()/1000;
24     }
25
26     public SearchIndices(String keyname, boolean isStatic) {
27         this.keyname = keyname;
28         this.isStatic = isStatic;
29     }
30
31     public void addKeyWord(String words) {
32         if(keywordsBuffer.length() > 0)
33             keywordsBuffer.append('\n');
34         keywordsBuffer.append(words);
35     }
36
37     public void addKeyWord(int words) {
38         addKeyWord(CampusAppContext.getInstance().getResString(words));
39     }
40
41     public void setTarget(String target) {
42         this.target = target;
43     }
44
45     public void setDescription(String description) {
46         this.description = description;
47     }
48
49     public void setTitle(String title) {
50         this.title = title;
51     }
52
53     public void setDescription(int description) {
54         this.description = CampusAppContext.getInstance().getResString(description);
55     }
56
57     public void setTitle(int title) {
58         this.title = CampusAppContext.getInstance().getResString(title);
59     }
60
61     public void setUpdateTime(long updateTime) {
62         this.updateTime = updateTime;
63     }
64
65     public String getKeyName() {
66         return this.keyname;
67     }
68
69     public String getKeyWords() {
70         return (this.keywords != null ? this.keywords : "") + this.keywordsBuffer.toString();
71     }
72
73     public boolean getIsStatic() {
74         return this.isStatic;
75     }
76
77     public String getTarget() {
78         return this.target;
79     }
80
81     public String getDescription() {
82         return this.description;
83     }
84
85     public String getTitle() {
86         return this.title;
87     }
88
89     public long getUpdateTime() {
90         return this.updateTime;
91     }
92 }
93