* Fields initialization class.
*/
public static class Properties extends Persistent.Properties {
- // ------------------------------------------------------------
private DocumentType type = null;
private String did = null; // Only for searching from a given reference
private ProjectElement owner = null; // Only for constructing a document
}
}
}
+
+ /**
+ * Get the format.
+ *
+ * @return the format
+ */
+ public String getFormat() {
+ return format;
+ }
}
/**
/**
* Initialization constructor.
+ *
* @param dprop
* @throws MissedPropertyException
* @throws InvalidPropertyException
public Document(final Properties dprop) throws MissedPropertyException,
InvalidPropertyException, MultiplyDefinedException {
super(dprop); // Throws one of the above exception if not valid
- myfile = new File(null, dprop.format, dprop.date); // The path is initialized below
+ myfile = new File(dprop.getLocalPath(), dprop.format, dprop.date); // The path is initialized below
type = dprop.type;
step = dprop.step.getNumber();
name = dprop.name;
// Public member functions
// ==============================================================================================================================
+ /**
+ * Get the attached file of the given format.
+ *
+ * @param format
+ * the file format
+ * @return the attached file or null if not found
+ */
public File getAttachedFile(final String format) {
List<Relation> exports = getRelations(ConvertsRelation.class);
-
- for (Iterator<Relation> i = exports.iterator(); i.hasNext();) {
- File export = (File) i.next().getTo();
+ File res = null;
+ for (Relation rel : exports) {
+ File export = (File) rel.getTo();
if (export.getFormat().equals(format)) {
- return export;
+ res = export;
+ break;
}
}
- return null;
+ return res;
}
public User getAuthor() {