Changeset 4558
- Timestamp:
- 2003-06-11T13:43:34+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/Argument.java
r4366 r4558 54 54 import java.util.Iterator; 55 55 import java.util.HashMap; 56 import org.greenstone.gatherer.msm.MSMUtils; 57 import org.greenstone.gatherer.util.Utility; 56 58 /** This class contains all the details about a single argument that can be passed to this plugin, including option lists if the parameters are restricted. 57 59 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 359 361 return "-" + name; 360 362 case METADATUM: 361 String text = "-" + name + " "; 363 StringBuffer text = new StringBuffer("-"); 364 text.append(name); 365 text.append(" "); 362 366 for(int i = 0; i < values.size(); i++) { 363 text = text + values.get(i).toString();367 text.append(values.get(i).toString()); 364 368 if(i < values.size() - 1) { 365 text = text + ",";369 text.append(","); 366 370 } 367 371 } 368 return text; 372 return text.toString(); 373 case STRING: 374 // we need to put quotes if they are not there 375 if (value.indexOf(' ') != -1 && value.indexOf('"')==-1) { 376 // if there is a space and we haven't got any quotes 377 return "-" + name + " \"" + value + "\""; 378 } // otherwise it will stuff up but I cant be bothered doing this properly 369 379 default: 370 380 return "-" + name + " " + value; 371 381 } 372 382 } 383 384 public String toStringConfig() { 385 switch(type) { 386 case METADATA: 387 if (value != null) { 388 String temp_value = value; 389 390 if (temp_value.startsWith(Utility.EXTRACTED_METADATA_NAMESPACE+MSMUtils.NS_SEP)) { 391 392 temp_value = temp_value.substring(temp_value.indexOf(MSMUtils.NS_SEP)+1); 393 } 394 return "-" + name + " " + temp_value; 395 } 396 return "-" + name; 397 case METADATUM: 398 StringBuffer text = new StringBuffer("-"); 399 text.append(name); 400 text.append(" "); 401 for(int i = 0; i < values.size(); i++) { 402 String temp_value = values.get(i).toString(); 403 if (temp_value.startsWith(Utility.EXTRACTED_METADATA_NAMESPACE+MSMUtils.NS_SEP)) { 404 405 temp_value = temp_value.substring(temp_value.indexOf(MSMUtils.NS_SEP)+1); 406 } 407 text.append(temp_value); 408 if(i < values.size() - 1) { 409 text.append(","); 410 } 411 } 412 return text.toString(); 413 default: 414 return toString(); 415 } 416 } 417 373 418 } 374 419
Note:
See TracChangeset
for help on using the changeset viewer.