// Attach the file via ConvertsRelation, create a new document or
// create a new version of the document
dprop.setAuthor(aUser).setDate(aDate).setFormat(fileFormat);
+ String authorName = I18nUtils.getMessageLocaleDefault(aUser
+ .getDisplayName());
+ String summary = I18nUtils.getMessageLocaleDefault(
+ MessageKeyEnum.DCT_000005.toString(), authorName);
+ dprop.setDescription(summary);
if (doc.getId() > 0) {
checkinExistingDoc(step, doc, dprop, fileFormat, upfile,
}
docname += "_" + i; // The generated new document title
- dprop.setDescription("Checked in").setName(docname);
+ dprop.setName(docname);
Publication newPub = getStepService().createDocument(step,
dprop);
} else {
// If an attachment with this extension already exists then
// replace it by the new one
- moveFile(upfile,attach.asFile());
+ moveFile(upfile, attach.asFile());
// Update attached file modification date
attach.setDate(new Date());
}
import org.splat.dal.bo.som.ValidationCycle;
import org.splat.dal.bo.som.ValidationCycleRelation;
import org.splat.dal.bo.som.ValidationStep;
+import org.splat.dal.bo.som.VersionsRelation;
import org.splat.dal.bo.som.Document.Properties;
import org.splat.dal.dao.kernel.UserDAO;
import org.splat.dal.dao.som.Database;
createDocDTOForModule(stepToCheckin, "SMESH", "med", userId, step,
stepsToCheckin);
}
+ // /////////////////////////////////////////////////////////////////
// Do test checkin
_scenarioService.checkin(scenarioId, userId, stepsToCheckin);
&& "geometry".equals(prevDoc.getType()
.getName())) {
Assert.assertEquals(newPub.value().getFormat(),
- "brep");
+ newFormat);
Assert.assertEquals(newPub.getSourceFile()
- .getFormat(), "brep");
+ .getFormat(), newFormat);
Assert.assertEquals(newPub.getSourceFile()
.getRelativePath().substring(
newPub.getSourceFile()
.getRelativePath()
.lastIndexOf('.') + 1),
- "brep");
+ newFormat);
}
// Check that uses relations are copied correctly
+ ") must become outdated.");
}
}
+
+ // Check that a correct comment is generated for VersionsRelation
+ VersionsRelation versRel = (VersionsRelation) newPub
+ .value().getFirstRelation(
+ VersionsRelation.class);
+ Assert.assertNotNull(versRel,
+ "VersionsRelation must be created.");
+ Assert
+ .assertNotNull(versRel.getDescription(),
+ "VersionsRelation description was not generated.");
+ int descrLen = versRel.getDescription().length();
+ Assert.assertTrue(descrLen > 0,
+ "VersionsRelation description is empty.");
+ LOG.debug("Version description: "
+ + versRel.getDescription());
} else {
// Otherwise the new file format must differ from the previous one
// and the new file must be attached to the same document
|| (file.getPath().endsWith("py") && (format
.equals("brep") || format.equals("med")))) {
// Create a file in the download directory
- docToCheckin.addFile(createDownloadedFile(userId,
- doc.getTitle() + "_result", format));
+ if ("GEOM".equals(module)) {
+ // New version case
+ docToCheckin.addFile(createDownloadedFile(
+ userId, doc.getTitle() + "_newvers",
+ "py"));
+ } else {
+ // Attached generated result case
+ docToCheckin.addFile(createDownloadedFile(
+ userId, doc.getTitle() + "_result",
+ format));
+ }
}
}
}