import java.io.File;
import java.io.FileNotFoundException;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
Step step = _mystudy.getSelectedStep();
_documentTypes = getStepService().getValidDocumentTypes(step);
// Set the document type by default
- _deftype = getApplicationSettings().getDefaultDocumentType(step, filext);
+ _deftype = getApplicationSettings()
+ .getDefaultDocumentType(step, filext);
if (_deftype != null) {
setDefaultDocumentType(_deftype.getIndex());
}
_state = ProgressState.EXTERN; // TODO: Should external extensions be configurable ?
}
} else {
- String fileref = tool.extractProperty("reference");
- String filever = tool.extractProperty("version"); // Property kept even if the file is not referenced
- String filetype = tool.extractProperty("type"); // Property kept even if the file is not referenced
- for (Iterator<DocumentType> i = _documentTypes.iterator(); i
- .hasNext();) {
- DocumentType type = i.next();
- if (type.getName().equals(filetype)) {
- _deftype = type;
- _documentType = type.getIndex(); // Disables the document type field
- break;
- }
- }
- if (fileref != null) {
- isOk = findTypeByDocRef(fileref);
- }
- if (isOk) {
- if (filever != null) {
- try {
- Revision.Format get = new Revision.Format(
- getProjectSettings().getRevisionPattern());
- Revision version = get.parse(filever);
- if (version.isNull()) {
- throw new ParseException(filever,
- filever.length() - 1);
- }
- if (!version.isMinor()) {
- _state = ProgressState.inCHECK;
- }
- setVersion(version.toString());
- } catch (ParseException e) {
- setErrorCode("message.error.format.version");
- isOk = false;
- }
- }
- if (isOk) {
- _docname = tool.extractProperty("title"); // Property kept even if the file is not referenced
- isOk = extractDate(tool);
- }
- }
+ // String fileref = tool.extractProperty("reference");
+ // String filever = tool.extractProperty("version"); // Property kept even if the file is not referenced
+ // String filetype = tool.extractProperty("type"); // Property kept even if the file is not referenced
+ // for (Iterator<DocumentType> i = _documentTypes.iterator(); i
+ // .hasNext();) {
+ // DocumentType type = i.next();
+ // if (type.getName().equals(filetype)) {
+ // _deftype = type;
+ // _documentType = type.getIndex(); // Disables the document type field
+ // break;
+ // }
+ // }
+ // if (fileref != null) {
+ // isOk = findTypeByDocRef(fileref);
+ // }
+ // if (isOk) {
+ // if (filever != null) {
+ // try {
+ // Revision.Format get = new Revision.Format(
+ // getProjectSettings().getRevisionPattern());
+ // Revision version = get.parse(filever);
+ // if (version.isNull()) {
+ // throw new ParseException(filever,
+ // filever.length() - 1);
+ // }
+ // if (!version.isMinor()) {
+ // _state = ProgressState.inCHECK;
+ // }
+ // setVersion(version.toString());
+ // } catch (ParseException e) {
+ // setErrorCode("message.error.format.version");
+ // isOk = false;
+ // }
+ // }
+ // if (isOk) {
+ // _docname = tool.extractProperty("title"); // Property kept even if the file is not referenced
+ // isOk = extractDate(tool);
+ // }
+ // }
}
return isOk;
}
}
Publication addoc = getPublicationService().createDoc(
_mystudy.getIndex(), step, _documentType,
- user.getIndex(), _fileName, _docname, _state, _reference,
- getVersion(), aDate, uses);
+ user.getIndex(), _fileName, _docname, _state,
+ _reference, getVersion(), aDate, uses);
if (_reference.length() > 0) { // Importation of a not foreign document
_mystudy.updateSimulationContexts(); // In case of simulation contexts extracted from the imported document