1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 
29 public class SdfEntity implements Cloneable{
30 	private String project      = new String("");
31 	private String source_file  = new String("");
32 	private String dummy1       = new String("");
33 	private String resource_type= new String("");
34 	private String gid          = new String("");
35 	private String lid          = new String("");
36 	private String helpid       = new String("");
37 	private String platform     = new String("");
38 	private String dummy2       = new String("");
39 	private String langid       = new String("");
40 	private String text         = new String("");
41 	private String helptext     = new String("");
42 	private String quickhelptext= new String("");
43 	private String title        = new String("");
44 	private String date         = new String("");
45 
46 	public static int PROJECT_POS 		= 0;
47 	public static int SOURCE_FILE_POS	= 1;
48 	public static int DUMMY1_POS		= 2;
49 	public static int RESOURCE_TYPE_POS	= 3;
50 	public static int GID_POS			= 4;
51 	public static int LID_POS			= 5;
52 	public static int HELPID_POS		= 6;
53 	public static int PLATFORM_POS		= 7;
54 	public static int DUMMY2_POS		= 8;
55 	public static int LANGID_POS		= 9;
56 	public static int TEXT_POS			= 10;
57 	public static int HELPTEXT_POS		= 11;
58 	public static int QUICKHELPTEXT_POS	= 12;
59 	public static int TITLE_POS			= 13;
60 	public static int DATE_POS			= 14;
61 
62 	public Object clone()
63     {
64         try
65         {
66             return super.clone();
67         }
68         catch( CloneNotSupportedException e )
69         {
70             System.out.println("ERROR: Can not clone, something is broken here ....");
71             System.exit( -1 );
72         }
73         return null; // dummy
74     }
75 
76     public SdfEntity( String line ){
77         // isValid?
78         setProperties( line ) ;
79     }
80 	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) {
81 		super();
82 		this.project 		= project;
83 		this.source_file 	= source_file;
84 		this.dummy1 		= dummy1;
85 		this.resource_type 	= resource_type;
86 		this.gid 			= gid;
87 		this.lid 			= lid;
88 		this.helpid 		= helpid;
89 		this.platform 		= platform;
90 		this.dummy2 		= dummy2;
91 		this.langid 		= langid;
92 		this.text 			= text;
93 		this.helptext 		= helptext;
94 		this.quickhelptext 	= quickhelptext;
95 		this.title 			= title;
96 		this.date 			= date;
97 	}
98 
99 	public void setProperties( String line ){
100         if( line != null )
101         {
102             String[] splitted		= line.split("\t",15);
103 		    setProject( 		splitted[ SdfEntity.PROJECT_POS ] 		);
104 		    setSource_file( 	splitted[ SdfEntity.SOURCE_FILE_POS ] 	);
105 		    setDummy1( 			splitted[ SdfEntity.DUMMY1_POS ] 		);
106 		    setResource_type(	splitted[ SdfEntity.RESOURCE_TYPE_POS ] );
107 		    setGid( 			splitted[ SdfEntity.GID_POS ] 			);
108 		    setLid( 			splitted[ SdfEntity.LID_POS ] 			);
109 		    setHelpid( 			splitted[ SdfEntity.HELPID_POS ] 		);
110 		    setPlatform( 		splitted[ SdfEntity.PLATFORM_POS ] 		);
111 		    setDummy2( 			splitted[ SdfEntity.DUMMY2_POS ] 		);
112 		    setLangid( 			splitted[ SdfEntity.LANGID_POS ] 		);
113 		    setText( 			splitted[ SdfEntity.TEXT_POS ] 			);
114 		    setHelptext( 		splitted[ SdfEntity.HELPTEXT_POS ] 		);
115 		    setQuickhelptext(	splitted[ SdfEntity.QUICKHELPTEXT_POS ] );
116 		    setTitle( 			splitted[ SdfEntity.TITLE_POS ] 		);
117 		    setDate(			splitted[ SdfEntity.DATE_POS ]			);
118         }
119 	}
120 
121 	public String getFileId(){
122 		return project+"\\"+source_file;
123 	}
124 	public String getResourcePath(){
125 		return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 );
126 	}
127 	public String toString(){
128 		return new StringBuffer( project ).append( "\t" ).append( source_file ).append( "\t" ).append( dummy1 ).append( "\t" ).append( resource_type ).append( "\t" ).append( gid ).append( "\t" )
129 		       .append( lid ).append( "\t" ).append( helpid ).append( "\t" ).append( platform ).append( "\t" ).append( dummy2 ).append( "\t" ).append( langid ).append( "\t" )
130 		       .append( text ).append( "\t" ).append( helptext ).append( "\t" ).append( quickhelptext ).append( "\t" ).append( title ).append( "\t" ).append( date ).toString();
131 	}
132 	public String getId(){
133 		return new StringBuffer( project ).append( gid ).append( lid ).append( source_file ).append( resource_type ).append( platform ).append( helpid ).append( langid ).toString();
134 	}
135 
136 	public String getDummy1() {
137 		return dummy1;
138 	}
139 
140 	public void setDummy1(String dummy1) {
141 		this.dummy1 = dummy1;
142 	}
143 
144 	public String getPlatform() {
145 		return platform;
146 	}
147 
148 	public void setPlatform(String platform) {
149 		this.platform = platform;
150 	}
151 
152 	public String getDummy2() {
153 		return dummy2;
154 	}
155 
156 	public void setDummy2(String dummy2) {
157 		this.dummy2 = dummy2;
158 	}
159 
160 	public String getGid() {
161 		return gid;
162 	}
163 
164 	public void setGid(String gid) {
165 		this.gid = gid;
166 	}
167 
168 	public String getHelpid() {
169 		return helpid;
170 	}
171 
172 	public void setHelpid(String helpid) {
173 		this.helpid = helpid;
174 	}
175 
176 	public String getHelptext() {
177 		return helptext;
178 	}
179 
180 	public void setHelptext(String helptext) {
181 		this.helptext = helptext;
182 	}
183 
184 	public String getLangid() {
185 		return langid;
186 	}
187 
188 	public void setLangid(String langid) {
189 		this.langid = langid;
190 	}
191 
192 	public String getLid() {
193 		return lid;
194 	}
195 
196 	public void setLid(String lid) {
197 		this.lid = lid;
198 	}
199 
200 	public String getProject() {
201 		return project;
202 	}
203 
204 	public void setProject(String project) {
205 		this.project = project;
206 	}
207 
208 	public String getQuickhelptext() {
209 		return quickhelptext;
210 	}
211 
212 	public void setQuickhelptext(String quickhelptext) {
213 		this.quickhelptext = quickhelptext;
214 	}
215 
216 	public String getResource_type() {
217 		return resource_type;
218 	}
219 
220 	public void setResource_type(String resource_type) {
221 		this.resource_type = resource_type;
222 	}
223 
224 	public String getSource_file() {
225 		return source_file;
226 	}
227 
228 	public void setSource_file(String source_file) {
229 		this.source_file = source_file;
230 	}
231 
232 	public String getText() {
233 		return text;
234 	}
235 
236 	public void setText(String text) {
237 		this.text = text;
238 	}
239 
240 	public String getTitle() {
241 		return title;
242 	}
243 
244 	public void setTitle(String title) {
245 		this.title = title;
246 	}
247 	public String getDate() {
248 		return date;
249 	}
250 	public void setDate(String date) {
251 		this.date = date;
252 	}
253 
254 
255 }
256