import java.util.Iterator;
import java.util.List;
-import org.hibernate.Hibernate;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.splat.dal.bo.kernel.Relation;
import org.splat.dal.dao.som.FileDAO;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.MissedPropertyException;
-import org.splat.kernel.MultiplyDefinedException;
import org.splat.kernel.NotApplicableException;
import org.splat.manox.Reader;
import org.splat.manox.Toolbox;
String path = owner.getReference();
ProjectSettingsService.Step step = ProjectSettingsServiceImpl
.getStep(aDoc.getStep());
- aDoc.setDid(new StringBuffer(path).append(".%").append(
- Document.suformat).toString()); // Document reference
+ aDoc.setDid(new StringBuffer(path).append(".%")
+ .append(Document.suformat).toString()); // Document reference
path = new StringBuffer(year).append("/").append(path).append("/")
.append(step.getPath())
// File path relative to the repository vault
int number = getStudyService().generateLocalIndex(scope);
if (scheme == FileNaming.encoded) {
- encoding.append(scope.getReference()).append(".").append(
- tostring.format(number));
+ encoding.append(scope.getReference()).append(".")
+ .append(tostring.format(number));
} else { // title and (temporarily) asis
- encoding.append(aDoc.getTitle()).append(".").append(
- tostring.format(number));
+ encoding.append(aDoc.getTitle()).append(".")
+ .append(tostring.format(number));
}
return encoding.toString();
}
// }
aDoc.setTitle(dprop.getName());
aDoc.getFile().changePath(
- aDoc.getFile().getRelativePath().replace("%n",
- getEncodedRootName(aDoc, (Study) dprop.getOwner())));
+ aDoc.getFile()
+ .getRelativePath()
+ .replace(
+ "%n",
+ getEncodedRootName(aDoc,
+ (Study) dprop.getOwner())));
if (aDoc.getHistory() == -1)
aDoc.setHistory(0);
if (dprop.getDate() == null) {
return (aType.isResultOf(lastep));
}
+ /**
+ * Get document by its path.
+ * @param path the document path
+ * @return the document if found or null
+ */
+ @Transactional(readOnly=true)
+ public Document getDocumentByPath(String path) {
+ String[] parse = path.split("'");
+
+ path = parse[0];
+ for (int i = 1; i < parse.length; i++) {
+ path = path + "''" + parse[i];
+ }
+ Criterion aCondition = Restrictions.eq("path", path);
+ return getDocumentDAO().findByCriteria(aCondition);
+ }
+
/**
* Get the studyService.
*