1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 public class SdfEntity implements Cloneable{
26 	private String project      = new String("");
27 	private String source_file  = new String("");
28 	private String dummy1       = new String("");
29 	private String resource_type= new String("");
30 	private String gid          = new String("");
31 	private String lid          = new String("");
32 	private String helpid       = new String("");
33 	private String platform     = new String("");
34 	private String dummy2       = new String("");
35 	private String langid       = new String("");
36 	private String text         = new String("");
37 	private String helptext     = new String("");
38 	private String quickhelptext= new String("");
39 	private String title        = new String("");
40 	private String date         = new String("");
41 
42 	public static int PROJECT_POS 		= 0;
43 	public static int SOURCE_FILE_POS	= 1;
44 	public static int DUMMY1_POS		= 2;
45 	public static int RESOURCE_TYPE_POS	= 3;
46 	public static int GID_POS			= 4;
47 	public static int LID_POS			= 5;
48 	public static int HELPID_POS		= 6;
49 	public static int PLATFORM_POS		= 7;
50 	public static int DUMMY2_POS		= 8;
51 	public static int LANGID_POS		= 9;
52 	public static int TEXT_POS			= 10;
53 	public static int HELPTEXT_POS		= 11;
54 	public static int QUICKHELPTEXT_POS	= 12;
55 	public static int TITLE_POS			= 13;
56 	public static int DATE_POS			= 14;
57 
clone()58 	public Object clone()
59     {
60         try
61         {
62             return super.clone();
63         }
64         catch( CloneNotSupportedException e )
65         {
66             System.out.println("ERROR: Can not clone, something is broken here ....");
67             System.exit( -1 );
68         }
69         return null; // dummy
70     }
71 
SdfEntity( String line )72     public SdfEntity( String line ){
73         // isValid?
74         setProperties( line ) ;
75     }
SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date)76 	public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) {
77 		super();
78 		this.project 		= project;
79 		this.source_file 	= source_file;
80 		this.dummy1 		= dummy1;
81 		this.resource_type 	= resource_type;
82 		this.gid 			= gid;
83 		this.lid 			= lid;
84 		this.helpid 		= helpid;
85 		this.platform 		= platform;
86 		this.dummy2 		= dummy2;
87 		this.langid 		= langid;
88 		this.text 			= text;
89 		this.helptext 		= helptext;
90 		this.quickhelptext 	= quickhelptext;
91 		this.title 			= title;
92 		this.date 			= date;
93 	}
94 
setProperties( String line )95 	public void setProperties( String line ){
96         if( line != null )
97         {
98             String[] splitted		= line.split("\t",15);
99 		    setProject( 		splitted[ SdfEntity.PROJECT_POS ] 		);
100 		    setSource_file( 	splitted[ SdfEntity.SOURCE_FILE_POS ] 	);
101 		    setDummy1( 			splitted[ SdfEntity.DUMMY1_POS ] 		);
102 		    setResource_type(	splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
103 		    setGid( 			splitted[ SdfEntity.GID_POS ] 			);
104 		    setLid( 			splitted[ SdfEntity.LID_POS ] 			);
105 		    setHelpid( 			splitted[ SdfEntity.HELPID_POS ] 		);
106 		    setPlatform( 		splitted[ SdfEntity.PLATFORM_POS ] 		);
107 		    setDummy2( 			splitted[ SdfEntity.DUMMY2_POS ] 		);
108 		    setLangid( 			splitted[ SdfEntity.LANGID_POS ] 		);
109 		    setText( 			splitted[ SdfEntity.TEXT_POS ] 			);
110 		    setHelptext( 		splitted[ SdfEntity.HELPTEXT_POS ] 		);
111 		    setQuickhelptext(	splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
112 		    setTitle( 			splitted[ SdfEntity.TITLE_POS ] 		);
113 		    setDate(			splitted[ SdfEntity.DATE_POS ]			);
114         }
115 	}
116 
getFileId()117 	public String getFileId(){
118 		return project+"\\"+source_file;
119 	}
getResourcePath()120 	public String getResourcePath(){
121 		return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
122 	}
toString()123 	public String toString(){
124 		return new StringBuffer( project ).append( "\t" ).append( source_file ).append( "\t" ).append( dummy1 ).append( "\t" ).append( resource_type ).append( "\t" ).append( gid ).append( "\t" )
125 		       .append( lid ).append( "\t" ).append( helpid ).append( "\t" ).append( platform ).append( "\t" ).append( dummy2 ).append( "\t" ).append( langid ).append( "\t" )
126 		       .append( text ).append( "\t" ).append( helptext ).append( "\t" ).append( quickhelptext ).append( "\t" ).append( title ).append( "\t" ).append( date ).toString();
127 	}
getId()128 	public String getId(){
129 		return new StringBuffer( project ).append( gid ).append( lid ).append( source_file ).append( resource_type ).append( platform ).append( helpid ).append( langid ).toString();
130 	}
131 
getDummy1()132 	public String getDummy1() {
133 		return dummy1;
134 	}
135 
setDummy1(String dummy1)136 	public void setDummy1(String dummy1) {
137 		this.dummy1 = dummy1;
138 	}
139 
getPlatform()140 	public String getPlatform() {
141 		return platform;
142 	}
143 
setPlatform(String platform)144 	public void setPlatform(String platform) {
145 		this.platform = platform;
146 	}
147 
getDummy2()148 	public String getDummy2() {
149 		return dummy2;
150 	}
151 
setDummy2(String dummy2)152 	public void setDummy2(String dummy2) {
153 		this.dummy2 = dummy2;
154 	}
155 
getGid()156 	public String getGid() {
157 		return gid;
158 	}
159 
setGid(String gid)160 	public void setGid(String gid) {
161 		this.gid = gid;
162 	}
163 
getHelpid()164 	public String getHelpid() {
165 		return helpid;
166 	}
167 
setHelpid(String helpid)168 	public void setHelpid(String helpid) {
169 		this.helpid = helpid;
170 	}
171 
getHelptext()172 	public String getHelptext() {
173 		return helptext;
174 	}
175 
setHelptext(String helptext)176 	public void setHelptext(String helptext) {
177 		this.helptext = helptext;
178 	}
179 
getLangid()180 	public String getLangid() {
181 		return langid;
182 	}
183 
setLangid(String langid)184 	public void setLangid(String langid) {
185 		this.langid = langid;
186 	}
187 
getLid()188 	public String getLid() {
189 		return lid;
190 	}
191 
setLid(String lid)192 	public void setLid(String lid) {
193 		this.lid = lid;
194 	}
195 
getProject()196 	public String getProject() {
197 		return project;
198 	}
199 
setProject(String project)200 	public void setProject(String project) {
201 		this.project = project;
202 	}
203 
getQuickhelptext()204 	public String getQuickhelptext() {
205 		return quickhelptext;
206 	}
207 
setQuickhelptext(String quickhelptext)208 	public void setQuickhelptext(String quickhelptext) {
209 		this.quickhelptext = quickhelptext;
210 	}
211 
getResource_type()212 	public String getResource_type() {
213 		return resource_type;
214 	}
215 
setResource_type(String resource_type)216 	public void setResource_type(String resource_type) {
217 		this.resource_type = resource_type;
218 	}
219 
getSource_file()220 	public String getSource_file() {
221 		return source_file;
222 	}
223 
setSource_file(String source_file)224 	public void setSource_file(String source_file) {
225 		this.source_file = source_file;
226 	}
227 
getText()228 	public String getText() {
229 		return text;
230 	}
231 
setText(String text)232 	public void setText(String text) {
233 		this.text = text;
234 	}
235 
getTitle()236 	public String getTitle() {
237 		return title;
238 	}
239 
setTitle(String title)240 	public void setTitle(String title) {
241 		this.title = title;
242 	}
getDate()243 	public String getDate() {
244 		return date;
245 	}
setDate(String date)246 	public void setDate(String date) {
247 		this.date = date;
248 	}
249 
250 
251 }
252