| 1 |
|
// Copyright © 2010-2013 ENS de Lyon.
|
| 2 |
|
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
|
| 3 |
|
// Lyon 2, University of Franche-Comté, University of Nice
|
| 4 |
|
// Sophia Antipolis, University of Paris 3.
|
| 5 |
|
//
|
| 6 |
|
// The TXM platform is free software: you can redistribute it
|
| 7 |
|
// and/or modify it under the terms of the GNU General Public
|
| 8 |
|
// License as published by the Free Software Foundation,
|
| 9 |
|
// either version 2 of the License, or (at your option) any
|
| 10 |
|
// later version.
|
| 11 |
|
//
|
| 12 |
|
// The TXM platform is distributed in the hope that it will be
|
| 13 |
|
// useful, but WITHOUT ANY WARRANTY; without even the implied
|
| 14 |
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
| 15 |
|
// PURPOSE. See the GNU General Public License for more
|
| 16 |
|
// details.
|
| 17 |
|
//
|
| 18 |
|
// You should have received a copy of the GNU General
|
| 19 |
|
// Public License along with the TXM platform. If not, see
|
| 20 |
|
// http://www.gnu.org/licenses.
|
| 21 |
|
//
|
| 22 |
|
//
|
| 23 |
|
//
|
| 24 |
|
// $LastChangedDate: 2016-10-27 16:30:30 +0200 (Thu, 27 Oct 2016) $
|
| 25 |
|
// $LastChangedRevision: 3331 $
|
| 26 |
|
// $LastChangedBy: mdecorde $
|
| 27 |
|
//
|
| 28 |
|
package org.txm.objects;
|
| 29 |
|
|
| 30 |
|
import java.io.File;
|
| 31 |
|
import java.io.FileFilter;
|
| 32 |
|
import java.io.IOException;
|
| 33 |
|
import java.util.ArrayList;
|
| 34 |
|
import java.util.Arrays;
|
| 35 |
|
import java.util.Collection;
|
| 36 |
|
import java.util.HashMap;
|
| 37 |
|
import java.util.List;
|
| 38 |
|
|
| 39 |
|
import org.eclipse.core.runtime.IProgressMonitor;
|
| 40 |
|
import org.txm.Toolbox;
|
| 41 |
|
import org.txm.core.messages.TXMCoreMessages;
|
| 42 |
|
import org.txm.metadatas.DateMetadata;
|
| 43 |
|
import org.txm.metadatas.Metadata;
|
| 44 |
|
import org.txm.metadatas.MetadataGroup;
|
| 45 |
|
import org.txm.metadatas.MinMaxDateGroup;
|
| 46 |
|
import org.txm.utils.logger.Log;
|
| 47 |
|
import org.txm.utils.zip.Zip;
|
| 48 |
|
import org.w3c.dom.Document;
|
| 49 |
|
import org.w3c.dom.Element;
|
| 50 |
|
import org.w3c.dom.NodeList;
|
| 51 |
|
|
| 52 |
|
/**
|
| 53 |
|
* The abstract Corpus class.
|
| 54 |
|
*/
|
| 55 |
|
public abstract class Corpus extends TxmObject {
|
| 56 |
|
|
| 57 |
|
/** serialVersionUID */
|
| 58 |
|
private static final long serialVersionUID = 6906032980183899327L;
|
| 59 |
|
|
| 60 |
|
/** The base. */
|
| 61 |
|
private Project base;
|
| 62 |
|
|
| 63 |
|
/** The texts element. */
|
| 64 |
|
Element textsElement;
|
| 65 |
|
/** The corpora element. */
|
| 66 |
|
Element corporaElement;
|
| 67 |
|
/** The scripts element. */
|
| 68 |
|
Element scriptsElement;
|
| 69 |
|
/** The queries element. */
|
| 70 |
|
private Element queriesElement;
|
| 71 |
|
|
| 72 |
|
public static final String TEXT = "text";
|
| 73 |
|
public static final String TEXTS = "texts";
|
| 74 |
|
public static final String BIBLIO = "biblio";
|
| 75 |
|
public static final String PDF = "pdf";
|
| 76 |
|
public static final String SOURCE = "source";
|
| 77 |
|
public static final String TYPE = "type";
|
| 78 |
|
public static final String FILE = "file";
|
| 79 |
|
public static final String EDITIONS = "editions";
|
| 80 |
|
public static final String EDITION = "edition";
|
| 81 |
|
public static final String NAME = "name";
|
| 82 |
|
public static final String LANG = "lang";
|
| 83 |
|
public static final String WORDSPERPAGE = "wordsperpage";
|
| 84 |
|
public static final String DOEDITIONSTEP = "doeditionstep";
|
| 85 |
|
public static final String AVOIDXMLSTEPS = "avoidxmlsteps";
|
| 86 |
|
public static final String CLEANTEMPDIRS = "cleantempdirectories";
|
| 87 |
|
public static final String CORPUS = "corpus";
|
| 88 |
|
public static final String CORPORA = "corpora";
|
| 89 |
|
public static final String ID = "id";
|
| 90 |
|
public static final String DEFAULT = "default";
|
| 91 |
|
|
| 92 |
|
/** The texts. */
|
| 93 |
|
HashMap<String, Text> texts = new HashMap<String, Text>();
|
| 94 |
|
|
| 95 |
|
/** The textnames. */
|
| 96 |
|
ArrayList<String> textnames = new ArrayList<String>();
|
| 97 |
|
|
| 98 |
|
/** The queries. */
|
| 99 |
|
HashMap<String,SavedQuery> queries = new HashMap<String, SavedQuery>();
|
| 100 |
|
|
| 101 |
|
/** The project. */
|
| 102 |
|
Project project;
|
| 103 |
|
|
| 104 |
|
/** The importmetadatas. */
|
| 105 |
|
public ArrayList<Metadata> importmetadatas = new ArrayList<Metadata>();
|
| 106 |
|
public ArrayList<MetadataGroup> groupedMetadatas = new ArrayList<MetadataGroup>();
|
| 107 |
|
|
| 108 |
|
/** The p attribute info names. */
|
| 109 |
|
private static String[] attributeInfoNames = {ID, "shortname", "longname", TYPE, "renderer", "tooltip", "pattern", "import", "mandatory", "inputFormat", "outputFormat"};
|
| 110 |
|
private HashMap<String, HashMap<String, String>> pAttributesInfos = new HashMap<String, HashMap<String,String>>();
|
| 111 |
|
private HashMap<String, HashMap<String, String>> sAttributesInfos = new HashMap<String, HashMap<String,String>>();
|
| 112 |
|
|
| 113 |
|
/** The encoding. */
|
| 114 |
|
private String encoding;
|
| 115 |
|
|
| 116 |
|
/** The lang. */
|
| 117 |
|
private String lang;
|
| 118 |
|
|
| 119 |
|
/** The srcdir. */
|
| 120 |
|
private String srcdir;
|
| 121 |
|
|
| 122 |
|
/** The xslt. */
|
| 123 |
|
private String xslt;
|
| 124 |
|
|
| 125 |
|
/** The author. */
|
| 126 |
|
private String author;
|
| 127 |
|
|
| 128 |
|
/** The script. */
|
| 129 |
|
private String script;
|
| 130 |
|
|
| 131 |
|
private String font="Arial";
|
| 132 |
|
|
| 133 |
|
private ArrayList<String> refProperties = new ArrayList<String>();
|
| 134 |
|
private ArrayList<String> sortProperties = new ArrayList<String>();
|
| 135 |
|
private ArrayList<String> viewProperties = new ArrayList<String>();
|
| 136 |
|
|
| 137 |
|
private HashMap<String, Alignement> links = new HashMap<String, Alignement>();
|
| 138 |
|
|
| 139 |
|
private String defaultEditionName = null;
|
| 140 |
|
|
| 141 |
|
private ArrayList<String> editionNames = new ArrayList<String>();
|
| 142 |
|
|
| 143 |
|
private String desc;
|
| 144 |
|
|
| 145 |
|
// The default properties to use
|
| 146 |
|
private String defaultRefProperty;
|
| 147 |
|
private String defaultSortProperty;
|
| 148 |
|
private String defaultViewProperty;
|
| 149 |
|
|
| 150 |
|
private int pageSize;
|
| 151 |
|
private boolean doEditionStep;
|
| 152 |
|
private boolean avoidXMLSteps;
|
| 153 |
|
private boolean cleanTempDirs;
|
| 154 |
|
|
| 155 |
|
protected String cql_limit_query = "<text>[]"; // read only
|
| 156 |
|
protected int conc_left_context = 8; // read only
|
| 157 |
|
protected int conc_right_context = 12; // read only
|
| 158 |
|
|
| 159 |
|
|
| 160 |
|
|
| 161 |
|
/**
|
| 162 |
|
* Instantiates a new corpus.
|
| 163 |
|
*
|
| 164 |
|
* @param base the base
|
| 165 |
|
* @param c the c
|
| 166 |
|
*/
|
| 167 |
|
public Corpus(Project base, Element c, String uuid) {
|
| 168 |
|
super(uuid, base);
|
| 169 |
|
this.persistable = true;
|
| 170 |
|
this.userPersistable = false;
|
| 171 |
|
if(base != null && c != null) {
|
| 172 |
|
this.base = base;
|
| 173 |
|
this.setPath(base.getPath() + getName());
|
| 174 |
|
setSelfElement(c);
|
| 175 |
|
_load();
|
| 176 |
|
}
|
| 177 |
|
}
|
| 178 |
|
|
| 179 |
|
|
| 180 |
|
|
| 181 |
|
/**
|
| 182 |
|
* Gets the text.
|
| 183 |
|
*
|
| 184 |
|
* @param id the id
|
| 185 |
|
* @return the text
|
| 186 |
|
*/
|
| 187 |
|
public Text getText(String id) {
|
| 188 |
|
return texts.get(id);
|
| 189 |
|
}
|
| 190 |
|
|
| 191 |
|
public String getCQLLimitQuery() {
|
| 192 |
|
return cql_limit_query;
|
| 193 |
|
}
|
| 194 |
|
|
| 195 |
|
public int getDefaultConcordanceLeftContextSize() {
|
| 196 |
|
return conc_left_context;
|
| 197 |
|
}
|
| 198 |
|
|
| 199 |
|
public int getDefaultConcordanceRightContextSize() {
|
| 200 |
|
return conc_right_context;
|
| 201 |
|
}
|
| 202 |
|
|
| 203 |
|
/**
|
| 204 |
|
* Gets the texts.
|
| 205 |
|
*
|
| 206 |
|
* @return the texts
|
| 207 |
|
*/
|
| 208 |
|
public Collection<Text> getTexts() {
|
| 209 |
|
return texts.values();
|
| 210 |
|
}
|
| 211 |
|
|
| 212 |
|
/**
|
| 213 |
|
* Gets the queries log.
|
| 214 |
|
*
|
| 215 |
|
* @return the queries log
|
| 216 |
|
*/
|
| 217 |
|
public Collection<SavedQuery> getQueriesLog() {
|
| 218 |
|
return queries.values();
|
| 219 |
|
}
|
| 220 |
|
|
| 221 |
|
/**
|
| 222 |
|
* Gets the texts id.
|
| 223 |
|
*
|
| 224 |
|
* @return the texts id
|
| 225 |
|
*/
|
| 226 |
|
public List<String> getTextsID() {
|
| 227 |
|
return textnames;
|
| 228 |
|
}
|
| 229 |
|
|
| 230 |
|
/**
|
| 231 |
|
* Adds the directory.
|
| 232 |
|
*
|
| 233 |
|
* @param directory the directory
|
| 234 |
|
* @return true, if successful
|
| 235 |
|
*/
|
| 236 |
|
public boolean addDirectory(File directory) {
|
| 237 |
|
FileFilter filter = new FileFilter() {
|
| 238 |
|
@Override
|
| 239 |
|
public boolean accept(File pathname) {
|
| 240 |
|
return !pathname.isHidden();
|
| 241 |
|
}
|
| 242 |
|
};
|
| 243 |
|
if (directory.isDirectory() && directory.exists()) {
|
| 244 |
|
File[] files = directory.listFiles(filter);
|
| 245 |
|
Arrays.sort(files);
|
| 246 |
|
for (File f : files) {
|
| 247 |
|
addText(f);
|
| 248 |
|
}
|
| 249 |
|
} else {
|
| 250 |
|
System.out.println(directory + " is not a directory.");
|
| 251 |
|
return false;
|
| 252 |
|
}
|
| 253 |
|
return true;
|
| 254 |
|
}
|
| 255 |
|
|
| 256 |
|
/**
|
| 257 |
|
* Adds the text.
|
| 258 |
|
*
|
| 259 |
|
* @param file the file
|
| 260 |
|
* @return the text
|
| 261 |
|
*/
|
| 262 |
|
public Text addText(File file) {
|
| 263 |
|
if (texts.containsKey(file.getName()))
|
| 264 |
|
return texts.get(file.getName());
|
| 265 |
|
|
| 266 |
|
String filename = file.getName();
|
| 267 |
|
int idx = filename.lastIndexOf(".");
|
| 268 |
|
String txtname = filename;
|
| 269 |
|
if(idx > 0)
|
| 270 |
|
txtname = filename.substring(0, idx);
|
| 271 |
|
|
| 272 |
|
Document doc = getSelfElement().getOwnerDocument();
|
| 273 |
|
Element textRoot = (Element) getSelfElement().getElementsByTagName(TEXTS).item(0); //$NON-NLS-1$
|
| 274 |
|
Element textElem = doc.createElement(TEXT);
|
| 275 |
|
textElem.setAttribute(NAME, txtname);
|
| 276 |
|
textElem.setAttribute(BIBLIO, ""); //$NON-NLS-1$
|
| 277 |
|
textElem.setAttribute(PDF, ""); //$NON-NLS-1$
|
| 278 |
|
Element src = doc.createElement(SOURCE);
|
| 279 |
|
src.setAttribute(TYPE, filename.substring(idx+1));
|
| 280 |
|
src.setAttribute(FILE, file.getAbsolutePath());
|
| 281 |
|
|
| 282 |
|
textElem.appendChild(src);
|
| 283 |
|
Element editions = doc.createElement(EDITIONS);
|
| 284 |
|
textElem.appendChild(editions);
|
| 285 |
|
textRoot.appendChild(textElem);
|
| 286 |
|
|
| 287 |
|
Text t = new Text(this, textElem);
|
| 288 |
|
if (texts.keySet().contains(txtname)) {
|
| 289 |
|
System.out.println("Warning corpus configuration file contains texts with the same ID: "+txtname+" (next ones are ignored).");
|
| 290 |
|
return null;
|
| 291 |
|
}
|
| 292 |
|
texts.put(txtname, t);
|
| 293 |
|
textnames.add(t.getName());
|
| 294 |
|
return t;
|
| 295 |
|
}
|
| 296 |
|
|
| 297 |
|
/**
|
| 298 |
|
* Removes the text.
|
| 299 |
|
*
|
| 300 |
|
* @param name the name
|
| 301 |
|
* @return the text
|
| 302 |
|
*/
|
| 303 |
|
public Text removeText(String name) {
|
| 304 |
|
Text text = texts.get(name);
|
| 305 |
|
|
| 306 |
|
if (text != null) {
|
| 307 |
|
Element textRoot = (Element) getSelfElement().getElementsByTagName(
|
| 308 |
|
TEXTS).item(0); //$NON-NLS-1$
|
| 309 |
|
textRoot.removeChild(text.getSelfElement());
|
| 310 |
|
texts.remove(name);
|
| 311 |
|
textnames.remove(name);
|
| 312 |
|
}
|
| 313 |
|
return text;
|
| 314 |
|
}
|
| 315 |
|
|
| 316 |
|
/* (non-Javadoc)
|
| 317 |
|
* @see org.txm.objects.TxmObject#load()
|
| 318 |
|
*/
|
| 319 |
|
@Override
|
| 320 |
|
protected boolean _load() {
|
| 321 |
|
|
| 322 |
|
this.name = getSelfElement().getAttribute(NAME);
|
| 323 |
|
this.lang = getSelfElement().getAttribute(LANG);
|
| 324 |
|
// System.out.println("LOAD BASE "+this.name);
|
| 325 |
|
loadMetadata();
|
| 326 |
|
|
| 327 |
|
// get texts
|
| 328 |
|
NodeList textsNodes = getSelfElement().getElementsByTagName(TEXTS);
|
| 329 |
|
if (textsNodes.getLength() > 0) {
|
| 330 |
|
textsElement = (Element) textsNodes.item(0);
|
| 331 |
|
NodeList textsList = textsElement.getElementsByTagName(TEXT);
|
| 332 |
|
for (int i = 0; i < textsList.getLength(); i++) {
|
| 333 |
|
Element text = (Element) textsList.item(i);
|
| 334 |
|
Text t = new Text(this, text);
|
| 335 |
|
if (texts.keySet().contains(t.getName())) {
|
| 336 |
|
System.out.println("Warning "+this.name+" corpus configuration file contains duplicates with ID="+t.getName()+" (next ones are ignored).");
|
| 337 |
|
} else {
|
| 338 |
|
texts.put(t.getName(), t);
|
| 339 |
|
textnames.add(t.getName());
|
| 340 |
|
}
|
| 341 |
|
}
|
| 342 |
|
}
|
| 343 |
|
|
| 344 |
|
// get saved queries
|
| 345 |
|
if (getSelfElement().getElementsByTagName("queries").getLength() > 0) { //$NON-NLS-1$
|
| 346 |
|
queriesElement = (Element) getSelfElement().getElementsByTagName("queries").item(0); //$NON-NLS-1$
|
| 347 |
|
NodeList queryList = queriesElement.getElementsByTagName("query"); //$NON-NLS-1$
|
| 348 |
|
for (int i = 0; i < queryList.getLength(); i++) {
|
| 349 |
|
Element qelem = (Element) queryList.item(i);
|
| 350 |
|
SavedQuery q = new SavedQuery(this, qelem);
|
| 351 |
|
this.queries.put(q.getName(), q);
|
| 352 |
|
}
|
| 353 |
|
}
|
| 354 |
|
|
| 355 |
|
loadImportInfos(getSelfElement());
|
| 356 |
|
|
| 357 |
|
|
| 358 |
|
try {
|
| 359 |
|
_compute();
|
| 360 |
|
} catch (Exception e) {
|
| 361 |
|
// TODO Auto-generated catch block
|
| 362 |
|
e.printStackTrace();
|
| 363 |
|
}
|
| 364 |
|
return true;
|
| 365 |
|
}
|
| 366 |
|
|
| 367 |
|
/**
|
| 368 |
|
* Adds the query log.
|
| 369 |
|
*
|
| 370 |
|
* @param query the query
|
| 371 |
|
* @param examples the examples
|
| 372 |
|
* @return the query log
|
| 373 |
|
*/
|
| 374 |
|
public SavedQuery addQueryLog(String query, List<String> examples) {
|
| 375 |
|
if (queries.containsKey(query))
|
| 376 |
|
return queries.get(query);
|
| 377 |
|
if (getSelfElement() == null) return null;
|
| 378 |
|
|
| 379 |
|
SavedQuery q = new SavedQuery(this, query, examples);
|
| 380 |
|
|
| 381 |
|
// q.selfElement = ;
|
| 382 |
|
Document doc = getSelfElement().getOwnerDocument();
|
| 383 |
|
Element queriesRoot;
|
| 384 |
|
if (getSelfElement().getElementsByTagName("queries").getLength() == 0) //$NON-NLS-1$
|
| 385 |
|
{
|
| 386 |
|
queriesRoot = doc.createElement("queries"); //$NON-NLS-1$
|
| 387 |
|
getSelfElement().appendChild(queriesRoot);
|
| 388 |
|
} else
|
| 389 |
|
queriesRoot = (Element) getSelfElement()
|
| 390 |
|
.getElementsByTagName("queries").item(0); //$NON-NLS-1$
|
| 391 |
|
|
| 392 |
|
Element queryElem = doc.createElement("query"); //$NON-NLS-1$
|
| 393 |
|
queryElem.setAttribute(NAME, q.getName());
|
| 394 |
|
queryElem.setAttribute("query", q.getQuery()); //$NON-NLS-1$
|
| 395 |
|
Element examplesElem = doc.createElement("examples"); //$NON-NLS-1$
|
| 396 |
|
queryElem.appendChild(examplesElem);
|
| 397 |
|
for (String ex : q.getExamples()) {
|
| 398 |
|
Element exampleElem = doc.createElement("example"); //$NON-NLS-1$
|
| 399 |
|
exampleElem.setTextContent(ex);
|
| 400 |
|
examplesElem.appendChild(exampleElem);
|
| 401 |
|
}
|
| 402 |
|
|
| 403 |
|
queriesRoot.appendChild(queryElem);
|
| 404 |
|
queries.put(q.getName(), q);
|
| 405 |
|
return q;
|
| 406 |
|
}
|
| 407 |
|
|
| 408 |
|
/**
|
| 409 |
|
* Removes the query.
|
| 410 |
|
*
|
| 411 |
|
* @param name the name
|
| 412 |
|
* @return the query log
|
| 413 |
|
*/
|
| 414 |
|
public SavedQuery removeQuery(String name) {
|
| 415 |
|
SavedQuery query = queries.get(name);
|
| 416 |
|
|
| 417 |
|
if (query != null) {
|
| 418 |
|
Element queriesRoot = (Element) getSelfElement().getElementsByTagName(
|
| 419 |
|
"queries").item(0); //$NON-NLS-1$
|
| 420 |
|
queriesRoot.removeChild(query.getSelfElement());
|
| 421 |
|
queries.remove(name);
|
| 422 |
|
}
|
| 423 |
|
return query;
|
| 424 |
|
}
|
| 425 |
|
|
| 426 |
|
/* (non-Javadoc)
|
| 427 |
|
* @see org.txm.objects.TxmObject#removeChildren(org.txm.objects.TxmObject)
|
| 428 |
|
*/
|
| 429 |
|
public TxmObject removeChildren(TxmObject o) {
|
| 430 |
|
if (o == null)
|
| 431 |
|
return null;
|
| 432 |
|
if (o instanceof Text) {
|
| 433 |
|
textsElement.removeChild(o.getSelfElement());
|
| 434 |
|
textnames.remove(((Text) o).getName());
|
| 435 |
|
return texts.remove(((Text) o).getName());
|
| 436 |
|
} else if (o instanceof SavedQuery) {
|
| 437 |
|
queriesElement.removeChild(o.getSelfElement());
|
| 438 |
|
return queries.remove(((SavedQuery) o).getName());
|
| 439 |
|
}
|
| 440 |
|
return null;
|
| 441 |
|
}
|
| 442 |
|
|
| 443 |
|
/* (non-Javadoc)
|
| 444 |
|
* @see org.txm.objects.TxmObject#hasChildren(org.txm.objects.TxmObject)
|
| 445 |
|
*/
|
| 446 |
|
public boolean hasChildren(TxmObject o) {
|
| 447 |
|
if (o == null)
|
| 448 |
|
return false;
|
| 449 |
|
if (o instanceof Text)
|
| 450 |
|
return texts.containsKey(((Text) o).getName());
|
| 451 |
|
return false;
|
| 452 |
|
}
|
| 453 |
|
|
| 454 |
|
/**
|
| 455 |
|
* Gets the next text.
|
| 456 |
|
*
|
| 457 |
|
* @param t the t
|
| 458 |
|
* @return the next text
|
| 459 |
|
*/
|
| 460 |
|
public Text getNextText(Text t) {
|
| 461 |
|
for (int i = 0; i < textnames.size(); i++) {
|
| 462 |
|
if (textnames.get(i).equals(t.getName())) {
|
| 463 |
|
if (i + 1 < textnames.size())
|
| 464 |
|
return getText(textnames.get(i + 1));
|
| 465 |
|
else
|
| 466 |
|
return null;
|
| 467 |
|
}
|
| 468 |
|
}
|
| 469 |
|
return null;
|
| 470 |
|
}
|
| 471 |
|
|
| 472 |
|
/**
|
| 473 |
|
* Gets the previous text.
|
| 474 |
|
*
|
| 475 |
|
* @param t the t
|
| 476 |
|
* @return the previous text
|
| 477 |
|
*/
|
| 478 |
|
public Text getPreviousText(Text t) {
|
| 479 |
|
for (int i = 0; i < textnames.size(); i++) {
|
| 480 |
|
if (textnames.get(i).equals(t.getName())) {
|
| 481 |
|
if (i - 1 >= 0)
|
| 482 |
|
return getText(textnames.get(i - 1));
|
| 483 |
|
else
|
| 484 |
|
return null;
|
| 485 |
|
}
|
| 486 |
|
}
|
| 487 |
|
return null;
|
| 488 |
|
}
|
| 489 |
|
|
| 490 |
|
/**
|
| 491 |
|
* Gets the last text.
|
| 492 |
|
*
|
| 493 |
|
* @return the last text
|
| 494 |
|
*/
|
| 495 |
|
public Text getLastText() {
|
| 496 |
|
if (textnames.size() > 0)
|
| 497 |
|
return getText(textnames.get(textnames.size() - 1));
|
| 498 |
|
else
|
| 499 |
|
return null;
|
| 500 |
|
}
|
| 501 |
|
|
| 502 |
|
/**
|
| 503 |
|
* Gets the first text.
|
| 504 |
|
*
|
| 505 |
|
* @return the first text
|
| 506 |
|
*/
|
| 507 |
|
public Text getFirstText() {
|
| 508 |
|
if (textnames.size() > 0)
|
| 509 |
|
return getText(textnames.get(0));
|
| 510 |
|
else
|
| 511 |
|
return null;
|
| 512 |
|
}
|
| 513 |
|
|
| 514 |
|
/* (non-Javadoc)
|
| 515 |
|
* @see org.txm.objects.TxmObject#getParent()
|
| 516 |
|
*/
|
| 517 |
|
@Override
|
| 518 |
|
public TxmObject getParent() {
|
| 519 |
|
return getProject();
|
| 520 |
|
}
|
| 521 |
|
|
| 522 |
|
/**
|
| 523 |
|
* Register maincorpus.
|
| 524 |
|
*
|
| 525 |
|
* @param corpusName the corpus name
|
| 526 |
|
*/
|
| 527 |
|
public Element registerMaincorpus(String corpusName) {
|
| 528 |
|
Document doc = getSelfElement().getOwnerDocument();
|
| 529 |
|
Element maincorpus = doc.createElement(CORPUS);
|
| 530 |
|
maincorpus.setAttribute(NAME, corpusName);
|
| 531 |
|
if (getSelfElement().getElementsByTagName(CORPORA).getLength() == 0) {
|
| 532 |
|
Log.severe(TXMCoreMessages.Base_22);
|
| 533 |
|
return null;
|
| 534 |
|
}
|
| 535 |
|
Element corporaElem = (Element) getSelfElement().getElementsByTagName(CORPORA).item(0);
|
| 536 |
|
corporaElem.appendChild(maincorpus); // append maincorpus
|
| 537 |
|
return maincorpus;
|
| 538 |
|
}
|
| 539 |
|
|
| 540 |
|
/* (non-Javadoc)
|
| 541 |
|
* @see org.txm.objects.TxmObject#propagateAttribute(java.lang.String)
|
| 542 |
|
*/
|
| 543 |
|
@Override
|
| 544 |
|
public void propagateAttribute(String key) {
|
| 545 |
|
super.propagateAttribute(key);
|
| 546 |
|
}
|
| 547 |
|
|
| 548 |
|
public boolean export(File exportzip) {
|
| 549 |
|
return export(exportzip, null);
|
| 550 |
|
}
|
| 551 |
|
/**
|
| 552 |
|
* Export.
|
| 553 |
|
*
|
| 554 |
|
* @param exportzip the exportzip
|
| 555 |
|
* @return true, if successful
|
| 556 |
|
*/
|
| 557 |
|
public boolean export(File exportzip, IProgressMonitor monitor) {
|
| 558 |
|
File binarydir = this.getProjectDirectory();
|
| 559 |
|
if (binarydir.exists() && exportzip.getParentFile().exists()) {
|
| 560 |
|
try {
|
| 561 |
|
Zip.compress(binarydir, exportzip, monitor);
|
| 562 |
|
} catch (IOException e) {
|
| 563 |
|
org.txm.utils.logger.Log.printStackTrace(e);
|
| 564 |
|
return false;
|
| 565 |
|
}
|
| 566 |
|
return true;
|
| 567 |
|
} else {
|
| 568 |
|
System.out.println(TXMCoreMessages.Base_0+binarydir+TXMCoreMessages.Base_3);
|
| 569 |
|
System.out.println(TXMCoreMessages.Base_4+exportzip.getParentFile()+TXMCoreMessages.Base_5);
|
| 570 |
|
|
| 571 |
|
}
|
| 572 |
|
return false;
|
| 573 |
|
}
|
| 574 |
|
|
| 575 |
|
/**
|
| 576 |
|
* Gets the base directory.
|
| 577 |
|
*
|
| 578 |
|
* @return the base directory
|
| 579 |
|
*/
|
| 580 |
|
public File getProjectDirectory()
|
| 581 |
|
{
|
| 582 |
|
String txmhome = Toolbox.getTxmHomePath();
|
| 583 |
|
Project base = this.getProject();
|
| 584 |
|
if (base != null)
|
| 585 |
|
return base.params.paramFile.getParentFile();
|
| 586 |
|
//return new File(new File(txmhome,"corpora"), getName());
|
| 587 |
|
return null;
|
| 588 |
|
}
|
| 589 |
|
|
| 590 |
|
/**
|
| 591 |
|
* Gets the import metadata.
|
| 592 |
|
*
|
| 593 |
|
* @return the import metadata
|
| 594 |
|
*/
|
| 595 |
|
public ArrayList<Metadata> getImportMetadata()
|
| 596 |
|
{
|
| 597 |
|
return importmetadatas;
|
| 598 |
|
}
|
| 599 |
|
|
| 600 |
|
/**
|
| 601 |
|
* Gets the import metadata.
|
| 602 |
|
*
|
| 603 |
|
* @return the import metadata
|
| 604 |
|
*/
|
| 605 |
|
public ArrayList<MetadataGroup> getMetadataGroups()
|
| 606 |
|
{
|
| 607 |
|
return groupedMetadatas;
|
| 608 |
|
}
|
| 609 |
|
|
| 610 |
|
/**
|
| 611 |
|
* Load import infos.
|
| 612 |
|
*
|
| 613 |
|
* @param root the root
|
| 614 |
|
* @return true, if successful
|
| 615 |
|
*/
|
| 616 |
|
private boolean loadImportInfos(Element root) {
|
| 617 |
|
// import general infos
|
| 618 |
|
//System.out.println("load import infos: "+root);
|
| 619 |
|
this.encoding = root.getAttribute("encoding");
|
| 620 |
|
this.lang = root.getAttribute(LANG);
|
| 621 |
|
String str = root.getAttribute(WORDSPERPAGE);
|
| 622 |
|
if (str == null || str.length() == 0) str = "500";
|
| 623 |
|
this.pageSize = Integer.parseInt(str);
|
| 624 |
|
str = root.getAttribute(DOEDITIONSTEP);
|
| 625 |
|
if (str == null || str.length() == 0) str = "true";
|
| 626 |
|
this.doEditionStep = "true".equals(str);
|
| 627 |
|
str = root.getAttribute(AVOIDXMLSTEPS);
|
| 628 |
|
if (str == null || str.length() == 0) str = "false";
|
| 629 |
|
this.avoidXMLSteps = "true".equals(str);
|
| 630 |
|
str = root.getAttribute(CLEANTEMPDIRS);
|
| 631 |
|
if (str == null || str.length() == 0) str = "false";
|
| 632 |
|
this.cleanTempDirs = "true".equals(str);
|
| 633 |
|
//this.srcdir = root.getAttribute("rootdir");
|
| 634 |
|
//this.script = root.getAttribute("script");
|
| 635 |
|
//this.xslt = root.getAttribute("xslt");
|
| 636 |
|
this.desc = root.getAttribute("desc");
|
| 637 |
|
this.setFont(root.getAttribute("font"));
|
| 638 |
|
|
| 639 |
|
//tokenizer infos
|
| 640 |
|
/*
|
| 641 |
|
NodeList tokenizerNodes = root.getElementsByTagName("tokenizer");
|
| 642 |
|
if (tokenizerNodes.getLength() > 0)
|
| 643 |
|
{
|
| 644 |
|
Element tokenizerNode = (Element) tokenizerNodes.item(0);
|
| 645 |
|
NodeList tokenizerparamNodes = tokenizerNode.getElementsByTagName("param");
|
| 646 |
|
}
|
| 647 |
|
*/
|
| 648 |
|
|
| 649 |
|
//Pattributes definitions
|
| 650 |
|
NodeList pAttributesNodes = root.getElementsByTagName("pattributes");
|
| 651 |
|
pAttributesInfos.clear();
|
| 652 |
|
if (pAttributesNodes.getLength() > 0) // only one
|
| 653 |
|
{
|
| 654 |
|
Element pattributesNode = (Element) pAttributesNodes.item(0);
|
| 655 |
|
NodeList pattributeNodes = pattributesNode.getElementsByTagName("pattribute");
|
| 656 |
|
for(int i = 0 ; i < pattributeNodes.getLength() ; i++)
|
| 657 |
|
{
|
| 658 |
|
Element pattribute = (Element)pattributeNodes.item(i);
|
| 659 |
|
HashMap<String, String> values = new HashMap<String, String>();
|
| 660 |
|
pAttributesInfos.put(pattribute.getAttribute(ID), values);
|
| 661 |
|
|
| 662 |
|
for(String name : attributeInfoNames) {
|
| 663 |
|
if(pattribute.getAttribute(name) != null)
|
| 664 |
|
values.put(name, pattribute.getAttribute(name));
|
| 665 |
|
else
|
| 666 |
|
values.put(name, "");
|
| 667 |
|
}
|
| 668 |
|
}
|
| 669 |
|
}
|
| 670 |
|
|
| 671 |
|
//Sattributes definitions
|
| 672 |
|
NodeList sAttributesNodes = root.getElementsByTagName("sattributes");
|
| 673 |
|
sAttributesInfos.clear();
|
| 674 |
|
if (sAttributesNodes.getLength() > 0) {
|
| 675 |
|
Element sattributesNode = (Element) sAttributesNodes.item(0);
|
| 676 |
|
NodeList sattributeNodes = sattributesNode.getElementsByTagName("sattribute");
|
| 677 |
|
for (int i = 0 ; i < sattributeNodes.getLength() ; i++) {
|
| 678 |
|
Element sattribute = (Element)sattributeNodes.item(i);
|
| 679 |
|
HashMap<String, String> values = new HashMap<String, String>();
|
| 680 |
|
sAttributesInfos.put(sattribute.getAttribute(ID), values);
|
| 681 |
|
|
| 682 |
|
for (String name : attributeInfoNames) {
|
| 683 |
|
if (sattribute.getAttribute(name) != null)
|
| 684 |
|
values.put(name, sattribute.getAttribute(name));
|
| 685 |
|
else
|
| 686 |
|
values.put(name, "");
|
| 687 |
|
}
|
| 688 |
|
}
|
| 689 |
|
}
|
| 690 |
|
//System.out.println("sAttributes Infos : "+sAttributesInfos);
|
| 691 |
|
|
| 692 |
|
//Metadata definitions
|
| 693 |
|
importmetadatas.clear();
|
| 694 |
|
groupedMetadatas.clear();
|
| 695 |
|
|
| 696 |
|
//UI: sort, view and ref properties to show
|
| 697 |
|
NodeList uisNodes = root.getElementsByTagName("uis");
|
| 698 |
|
if (uisNodes.getLength() > 0) { // only one
|
| 699 |
|
Element uisElem = (Element) uisNodes.item(0);
|
| 700 |
|
NodeList uiNodes = uisElem.getElementsByTagName("ui");
|
| 701 |
|
for (int c = 0 ; c < uiNodes.getLength() ; c++) {
|
| 702 |
|
Element uiElem = (Element) uiNodes.item(c);
|
| 703 |
|
if ("concordance".equals(uiElem.getAttribute("command").toLowerCase())) {
|
| 704 |
|
NodeList viewsNodes = uiElem.getElementsByTagName("view");
|
| 705 |
|
viewProperties.clear();
|
| 706 |
|
if (viewsNodes.getLength() > 0) // only one
|
| 707 |
|
{
|
| 708 |
|
Element viewNode = (Element) viewsNodes.item(0);
|
| 709 |
|
this.defaultViewProperty = viewNode.getAttribute(DEFAULT);
|
| 710 |
|
for (int i = 0 ; i < viewNode.getChildNodes().getLength() ; i++) {
|
| 711 |
|
try {
|
| 712 |
|
Element element = (Element)viewNode.getChildNodes().item(i);
|
| 713 |
|
viewProperties.add(element.getAttribute(ID));
|
| 714 |
|
} catch(Exception e){} // quick and dirty
|
| 715 |
|
}
|
| 716 |
|
}
|
| 717 |
|
|
| 718 |
|
NodeList sortsNodes = uiElem.getElementsByTagName("sort");
|
| 719 |
|
sortProperties.clear();
|
| 720 |
|
if (sortsNodes.getLength() > 0) // only one
|
| 721 |
|
{
|
| 722 |
|
Element sortNode = (Element) sortsNodes.item(0);
|
| 723 |
|
this.defaultSortProperty = sortNode.getAttribute(DEFAULT);
|
| 724 |
|
for (int i = 0 ; i < sortNode.getChildNodes().getLength() ; i++) {
|
| 725 |
|
try {
|
| 726 |
|
Element element = (Element)sortNode.getChildNodes().item(i);
|
| 727 |
|
sortProperties.add(element.getAttribute(ID));
|
| 728 |
|
} catch(Exception e){} // quick and dirty
|
| 729 |
|
}
|
| 730 |
|
}
|
| 731 |
|
|
| 732 |
|
NodeList refsNodes = uiElem.getElementsByTagName("ref");
|
| 733 |
|
refProperties.clear();
|
| 734 |
|
if (refsNodes.getLength() > 0) { // only one
|
| 735 |
|
Element refNode = (Element) refsNodes.item(0);
|
| 736 |
|
this.defaultRefProperty = refNode.getAttribute(DEFAULT);
|
| 737 |
|
for (int i = 0 ; i < refNode.getChildNodes().getLength() ; i++) {
|
| 738 |
|
try {
|
| 739 |
|
Element element = (Element)refNode.getChildNodes().item(i);
|
| 740 |
|
refProperties.add(element.getAttribute(ID));
|
| 741 |
|
}catch (Exception e){} // quick and dirty
|
| 742 |
|
}
|
| 743 |
|
}
|
| 744 |
|
|
| 745 |
|
NodeList cqlLimitNodes = uiElem.getElementsByTagName("context_limits");
|
| 746 |
|
//cql_limit_query = null;
|
| 747 |
|
if (cqlLimitNodes.getLength() > 0) { // only one node
|
| 748 |
|
Element context_limitsNode = (Element) cqlLimitNodes.item(0);
|
| 749 |
|
cql_limit_query = context_limitsNode.getTextContent();
|
| 750 |
|
if ("list".equals(context_limitsNode.getAttribute("type"))) {
|
| 751 |
|
String query = "";
|
| 752 |
|
String[] split = cql_limit_query.split(",");
|
| 753 |
|
if (split.length > 0) {
|
| 754 |
|
for (String s : split) {
|
| 755 |
|
query += "|<"+s.trim()+">[]";
|
| 756 |
|
}
|
| 757 |
|
cql_limit_query = query.substring(1);
|
| 758 |
|
}
|
| 759 |
|
}
|
| 760 |
|
}
|
| 761 |
|
|
| 762 |
|
NodeList cqlCtxSizeNodes = uiElem.getElementsByTagName("context_sizes");
|
| 763 |
|
//cql_limit_query = null;
|
| 764 |
|
if (cqlCtxSizeNodes.getLength() > 0) { // only one node
|
| 765 |
|
Element context_limitsNode = (Element) cqlCtxSizeNodes.item(0);
|
| 766 |
|
try {
|
| 767 |
|
conc_left_context = Integer.parseInt(context_limitsNode.getAttribute("left"));
|
| 768 |
|
conc_right_context = Integer.parseInt(context_limitsNode.getAttribute("right"));
|
| 769 |
|
} catch(Exception e) {
|
| 770 |
|
System.out.println("In uis/ui@command=concordance/context_sizes: context sizes number malformed: "+e);
|
| 771 |
|
}
|
| 772 |
|
}
|
| 773 |
|
} else if ("selection".equals(uiElem.getAttribute("command").toLowerCase())) {
|
| 774 |
|
NodeList sattributeNodes = uiElem.getElementsByTagName("sattribute");
|
| 775 |
|
for (int i = 0 ; i < sattributeNodes.getLength() ; i++) {
|
| 776 |
|
Element sattributeElem = (Element)sattributeNodes.item(i);
|
| 777 |
|
String ref = sattributeElem.getAttribute("ref");
|
| 778 |
|
//String id = ref.substring(5);
|
| 779 |
|
HashMap<String, String> infos = sAttributesInfos.get(ref);
|
| 780 |
|
if (infos == null) {
|
| 781 |
|
Log.warning("Malformed sattribute tag in "+this.getProject().getProjectParameters().paramFile+" at uis/command/selection: could not find s-attribute informations for @ref="+ref);
|
| 782 |
|
}
|
| 783 |
|
//System.out.println("REF: "+ref+" infos: "+infos);
|
| 784 |
|
if (infos != null)
|
| 785 |
|
if (ref.startsWith("text_")) {
|
| 786 |
|
//System.out.println("TEST: "+infos.get("type")+" =? 'Date'");
|
| 787 |
|
if (infos.get(TYPE).equals("Date")) {
|
| 788 |
|
importmetadatas.add(new DateMetadata(infos, sattributeElem));
|
| 789 |
|
} else
|
| 790 |
|
importmetadatas.add(new Metadata(infos, sattributeElem));
|
| 791 |
|
}
|
| 792 |
|
}
|
| 793 |
|
//System.out.println("Load groups: "+importmetadatas);
|
| 794 |
|
NodeList groupNodes = uiElem.getElementsByTagName("group");
|
| 795 |
|
for (int i = 0 ; i < groupNodes.getLength() ; i++) {
|
| 796 |
|
Element groupElem = (Element)groupNodes.item(i);
|
| 797 |
|
if (groupElem.getAttribute(TYPE).equals("MinMaxDate"))
|
| 798 |
|
groupedMetadatas.add(new MinMaxDateGroup(this, groupElem));
|
| 799 |
|
}
|
| 800 |
|
}
|
| 801 |
|
}
|
| 802 |
|
}
|
| 803 |
|
|
| 804 |
|
// get available editions
|
| 805 |
|
NodeList editionsNodes = root.getElementsByTagName(EDITIONS);
|
| 806 |
|
if (editionsNodes.getLength() > 0) // only one
|
| 807 |
|
{
|
| 808 |
|
Element editionNode = (Element) editionsNodes.item(0);
|
| 809 |
|
this.defaultEditionName = editionNode.getAttribute(DEFAULT);
|
| 810 |
|
NodeList editionNodes = editionNode.getElementsByTagName(EDITION);
|
| 811 |
|
for(int i = 0 ; i < editionNodes.getLength() ; i++)
|
| 812 |
|
{
|
| 813 |
|
Element edition = (Element)editionNodes.item(i);
|
| 814 |
|
String name = edition.getAttribute(NAME);
|
| 815 |
|
String built = edition.getAttribute("build_edition");
|
| 816 |
|
//System.out.println("declare edition: "+name);
|
| 817 |
|
//String corpus = edition.getAttribute("corpus");
|
| 818 |
|
// String mode = edition.getAttribute("mode");
|
| 819 |
|
// String script = edition.getAttribute("script");
|
| 820 |
|
if(!this.editionNames.contains(name) && !"false".equals(built))
|
| 821 |
|
this.editionNames.add(name);
|
| 822 |
|
}
|
| 823 |
|
if(!editionNames.contains(this.defaultEditionName) && editionNames.size() > 0)
|
| 824 |
|
this.defaultEditionName = editionNames.get(0);
|
| 825 |
|
}
|
| 826 |
|
|
| 827 |
|
// Text biblio
|
| 828 |
|
NodeList bibliosNodes = root.getElementsByTagName("biblios");
|
| 829 |
|
if (bibliosNodes.getLength() > 0) // only one
|
| 830 |
|
{
|
| 831 |
|
Element biblioNode = (Element) bibliosNodes.item(0);
|
| 832 |
|
NodeList metadataNodes = biblioNode.getElementsByTagName(BIBLIO);
|
| 833 |
|
for (int i = 0 ; i < metadataNodes.getLength() ; i++) {
|
| 834 |
|
Element biblio = (Element)metadataNodes.item(i);
|
| 835 |
|
String id = biblio.getAttribute(ID);
|
| 836 |
|
String url = biblio.getTextContent();
|
| 837 |
|
Text text = this.getText(id);
|
| 838 |
|
if (text != null)
|
| 839 |
|
text.setBiblio(url);
|
| 840 |
|
}
|
| 841 |
|
}
|
| 842 |
|
|
| 843 |
|
return true;
|
| 844 |
|
}
|
| 845 |
|
|
| 846 |
|
public HashMap<String, Alignement> getLinks()
|
| 847 |
|
{
|
| 848 |
|
return links;
|
| 849 |
|
}
|
| 850 |
|
|
| 851 |
|
public ArrayList<Alignement> getLinksFrom(String from)
|
| 852 |
|
{
|
| 853 |
|
ArrayList<Alignement> rez = new ArrayList<Alignement>();
|
| 854 |
|
for(String key : links.keySet())
|
| 855 |
|
if(key.startsWith("#"+from+" "))
|
| 856 |
|
rez.add(links.get(key));
|
| 857 |
|
return rez;
|
| 858 |
|
}
|
| 859 |
|
|
| 860 |
|
public ArrayList<Alignement> getLinksTo(String to)
|
| 861 |
|
{
|
| 862 |
|
ArrayList<Alignement> rez = new ArrayList<Alignement>();
|
| 863 |
|
for(String key : links.keySet())
|
| 864 |
|
if(key.endsWith(" #"+to))
|
| 865 |
|
rez.add(links.get(key));
|
| 866 |
|
return rez;
|
| 867 |
|
}
|
| 868 |
|
|
| 869 |
|
public Alignement getLink(String from, String to)
|
| 870 |
|
{
|
| 871 |
|
return links.get("#"+from+" #"+to );
|
| 872 |
|
}
|
| 873 |
|
|
| 874 |
|
public boolean hasEditions()
|
| 875 |
|
{
|
| 876 |
|
return defaultEditionName != null;
|
| 877 |
|
}
|
| 878 |
|
|
| 879 |
|
public String getDefaultEdition()
|
| 880 |
|
{
|
| 881 |
|
return defaultEditionName;
|
| 882 |
|
}
|
| 883 |
|
|
| 884 |
|
public ArrayList<String> getEditionNames()
|
| 885 |
|
{
|
| 886 |
|
return editionNames;
|
| 887 |
|
}
|
| 888 |
|
|
| 889 |
|
/**
|
| 890 |
|
* Gets the p attributes info names.
|
| 891 |
|
*
|
| 892 |
|
* @return the p attributes info names
|
| 893 |
|
*/
|
| 894 |
|
public String[] getPAttributesInfoNames()
|
| 895 |
|
{
|
| 896 |
|
return attributeInfoNames;
|
| 897 |
|
}
|
| 898 |
|
|
| 899 |
|
/**
|
| 900 |
|
* Gets the p attributes infos.
|
| 901 |
|
*
|
| 902 |
|
* @return the p attributes infos
|
| 903 |
|
*/
|
| 904 |
|
public HashMap<String, HashMap<String, String>> getPAttributesInfos()
|
| 905 |
|
{
|
| 906 |
|
return pAttributesInfos;
|
| 907 |
|
}
|
| 908 |
|
|
| 909 |
|
/**
|
| 910 |
|
* Gets the s attributes infos.
|
| 911 |
|
*
|
| 912 |
|
* @return the s attributes infos
|
| 913 |
|
*/
|
| 914 |
|
public HashMap<String, HashMap<String, String>> getSAttributesInfos()
|
| 915 |
|
{
|
| 916 |
|
return sAttributesInfos;
|
| 917 |
|
}
|
| 918 |
|
|
| 919 |
|
/**
|
| 920 |
|
* Gets the encoding.
|
| 921 |
|
*
|
| 922 |
|
* @return the encoding
|
| 923 |
|
*/
|
| 924 |
|
public String getEncoding() {
|
| 925 |
|
return encoding;
|
| 926 |
|
}
|
| 927 |
|
|
| 928 |
|
/**
|
| 929 |
|
* Gets the lang.
|
| 930 |
|
*
|
| 931 |
|
* @return the lang
|
| 932 |
|
*/
|
| 933 |
|
public String getLang() {
|
| 934 |
|
return lang;
|
| 935 |
|
}
|
| 936 |
|
|
| 937 |
|
/**
|
| 938 |
|
* Gets the srcdir.
|
| 939 |
|
*
|
| 940 |
|
* @return the srcdir
|
| 941 |
|
*/
|
| 942 |
|
public String getSrcdir() {
|
| 943 |
|
return srcdir;
|
| 944 |
|
}
|
| 945 |
|
|
| 946 |
|
/**
|
| 947 |
|
* Gets the xslt.
|
| 948 |
|
*
|
| 949 |
|
* @return the xslt
|
| 950 |
|
*/
|
| 951 |
|
public String getXslt() {
|
| 952 |
|
return xslt;
|
| 953 |
|
}
|
| 954 |
|
|
| 955 |
|
/**
|
| 956 |
|
* Gets the author.
|
| 957 |
|
*
|
| 958 |
|
* @return the author
|
| 959 |
|
*/
|
| 960 |
|
public String getAuthor() {
|
| 961 |
|
return author;
|
| 962 |
|
}
|
| 963 |
|
|
| 964 |
|
/**
|
| 965 |
|
* Gets the description.
|
| 966 |
|
*
|
| 967 |
|
* @return the description
|
| 968 |
|
*/
|
| 969 |
|
public String getDescription() {
|
| 970 |
|
return this.desc;
|
| 971 |
|
}
|
| 972 |
|
|
| 973 |
|
/**
|
| 974 |
|
* Gets the description.
|
| 975 |
|
*
|
| 976 |
|
* @return the description
|
| 977 |
|
*/
|
| 978 |
|
public void setDescription(String desc) {
|
| 979 |
|
this.desc = desc;
|
| 980 |
|
getSelfElement().setAttribute("desc", desc); // and update element
|
| 981 |
|
}
|
| 982 |
|
|
| 983 |
|
|
| 984 |
|
/**
|
| 985 |
|
* Gets the script.
|
| 986 |
|
*
|
| 987 |
|
* @return the script
|
| 988 |
|
*/
|
| 989 |
|
public String getScript() {
|
| 990 |
|
return script;
|
| 991 |
|
}
|
| 992 |
|
|
| 993 |
|
/**
|
| 994 |
|
* @return the font
|
| 995 |
|
*/
|
| 996 |
|
public String getFont() {
|
| 997 |
|
return font;
|
| 998 |
|
}
|
| 999 |
|
|
| 1000 |
|
/**
|
| 1001 |
|
* @param font the font to set
|
| 1002 |
|
*/
|
| 1003 |
|
public void setFont(String font) {
|
| 1004 |
|
this.font = font;
|
| 1005 |
|
}
|
| 1006 |
|
|
| 1007 |
|
public ArrayList<String> getRefProperties() {
|
| 1008 |
|
return refProperties;
|
| 1009 |
|
}
|
| 1010 |
|
|
| 1011 |
|
public void setRefProperties(ArrayList<String> refProperties) {
|
| 1012 |
|
this.refProperties = refProperties;
|
| 1013 |
|
}
|
| 1014 |
|
|
| 1015 |
|
public ArrayList<String> getSortProperties() {
|
| 1016 |
|
return sortProperties;
|
| 1017 |
|
}
|
| 1018 |
|
|
| 1019 |
|
public void setSortProperties(ArrayList<String> sortProperties) {
|
| 1020 |
|
this.sortProperties = sortProperties;
|
| 1021 |
|
}
|
| 1022 |
|
|
| 1023 |
|
public ArrayList<String> getViewProperties() {
|
| 1024 |
|
return viewProperties;
|
| 1025 |
|
}
|
| 1026 |
|
|
| 1027 |
|
public void setViewProperties(ArrayList<String> viewProperties) {
|
| 1028 |
|
this.viewProperties = viewProperties;
|
| 1029 |
|
}
|
| 1030 |
|
|
| 1031 |
|
|
| 1032 |
|
/**
|
| 1033 |
|
* Gets the project.
|
| 1034 |
|
*
|
| 1035 |
|
* @return the project
|
| 1036 |
|
*/
|
| 1037 |
|
public Project getProject() {
|
| 1038 |
|
return base;
|
| 1039 |
|
}
|
| 1040 |
|
|
| 1041 |
|
/* (non-Javadoc)
|
| 1042 |
|
* @see org.txm.objects.TxmObject#save()
|
| 1043 |
|
*/
|
| 1044 |
|
@Override
|
| 1045 |
|
protected boolean _save() {
|
| 1046 |
|
// TODO Auto-generated method stub
|
| 1047 |
|
return false;
|
| 1048 |
|
}
|
| 1049 |
|
|
| 1050 |
|
/**
|
| 1051 |
|
* @return the defaultEditionName
|
| 1052 |
|
*/
|
| 1053 |
|
public String getDefaultEditionName() {
|
| 1054 |
|
return defaultEditionName;
|
| 1055 |
|
}
|
| 1056 |
|
|
| 1057 |
|
/**
|
| 1058 |
|
* @param defaultEditionName the defaultEditionName to set
|
| 1059 |
|
*/
|
| 1060 |
|
public void setDefaultEditionName(String defaultEditionName) {
|
| 1061 |
|
this.defaultEditionName = defaultEditionName;
|
| 1062 |
|
}
|
| 1063 |
|
|
| 1064 |
|
/**
|
| 1065 |
|
* @return the defaultRefProperty
|
| 1066 |
|
*/
|
| 1067 |
|
public String getDefaultRefProperty() {
|
| 1068 |
|
return defaultRefProperty;
|
| 1069 |
|
}
|
| 1070 |
|
|
| 1071 |
|
/**
|
| 1072 |
|
* @param defaultRefProperty the defaultRefProperty to set
|
| 1073 |
|
*/
|
| 1074 |
|
public void setDefaultRefProperty(String defaultRefProperty) {
|
| 1075 |
|
this.defaultRefProperty = defaultRefProperty;
|
| 1076 |
|
}
|
| 1077 |
|
|
| 1078 |
|
/**
|
| 1079 |
|
* @return the defaultSortProperty
|
| 1080 |
|
*/
|
| 1081 |
|
public String getDefaultSortProperty() {
|
| 1082 |
|
return defaultSortProperty;
|
| 1083 |
|
}
|
| 1084 |
|
|
| 1085 |
|
/**
|
| 1086 |
|
* @param defaultSortProperty the defaultSortProperty to set
|
| 1087 |
|
*/
|
| 1088 |
|
public void setDefaultSortProperty(String defaultSortProperty) {
|
| 1089 |
|
this.defaultSortProperty = defaultSortProperty;
|
| 1090 |
|
}
|
| 1091 |
|
|
| 1092 |
|
/**
|
| 1093 |
|
* @return the defaultSortProperty
|
| 1094 |
|
*/
|
| 1095 |
|
public String getDefaultViewProperty() {
|
| 1096 |
|
return defaultViewProperty;
|
| 1097 |
|
}
|
| 1098 |
|
|
| 1099 |
|
/**
|
| 1100 |
|
* @param defaultSortProperty the defaultSortProperty to set
|
| 1101 |
|
*/
|
| 1102 |
|
public void setDefaultViewProperty(String defaultViewProperty) {
|
| 1103 |
|
this.defaultViewProperty = defaultViewProperty;
|
| 1104 |
|
}
|
| 1105 |
|
|
| 1106 |
|
|
| 1107 |
|
|
| 1108 |
|
|
| 1109 |
|
}
|