[Castore-commits] Fonds.java 1.4.2.4 1.4.2.5
Stéphane Bouchet
sbouchet at adullact1.hosting.cri74.org
Lun 6 Mar 12:08:07 CET 2006
Update of /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/metier
In directory adullact1:/tmp/cvs-serv11328/src/java/fr/emn/castor/documents/metier
Modified Files:
Tag: v1_1_branch
Fonds.java
Log Message:
correction bug creation nouvelle version
Index: Fonds.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/metier/Fonds.java,v
retrieving revision 1.4.2.4
retrieving revision 1.4.2.5
diff -C2 -d -r1.4.2.4 -r1.4.2.5
*** Fonds.java 13 Jan 2006 17:12:40 -0000 1.4.2.4
--- Fonds.java 6 Mar 2006 11:08:05 -0000 1.4.2.5
***************
*** 53,56 ****
--- 53,57 ----
import java.io.InputStream;
import java.io.PrintWriter;
+ import java.io.RandomAccessFile;
import java.text.DateFormat;
import java.util.ArrayList;
***************
*** 596,600 ****
* @return la collection d'objets correspondant aux criteres de recherche
*/
! public Document rechercheDocument(final String id, final boolean detach) {
String filtre = "id=='" + DocumentsConstants.PREFIX_ID + id + "'";
return (Document) this.jdoQuery.query(
--- 597,602 ----
* @return la collection d'objets correspondant aux criteres de recherche
*/
! public synchronized Document rechercheDocument(
! final String id, final boolean detach) {
String filtre = "id=='" + DocumentsConstants.PREFIX_ID + id + "'";
return (Document) this.jdoQuery.query(
***************
*** 672,681 ****
* @throws IOException erreur d'E/S
*/
! public void creerUneNouvelleVersionSource(
! final InputStream content, final String idDoc,
! final String extension) throws IOException {
String pathDirectory = getPathForId(idDoc);
! this.manageVersionning(pathDirectory, "source", extension);
! creerSourceFile(content, idDoc, extension);
}
--- 674,682 ----
* @throws IOException erreur d'E/S
*/
! public boolean creerUneNouvelleVersionSource(
! final String idDoc, final String extension) throws IOException {
String pathDirectory = getPathForId(idDoc);
! return this.manageVersionning(pathDirectory, "source", extension);
!
}
***************
*** 686,693 ****
* @throws IOException si une erreur survient.
*/
! public void creerUneNouvelleVersionDocument(final String idDoc)
throws IOException {
String pathDirectory = getPathForId(idDoc);
! this.manageVersionning(pathDirectory, "document", ".xml");
}
--- 687,694 ----
* @throws IOException si une erreur survient.
*/
! public boolean creerUneNouvelleVersionDocument(final String idDoc)
throws IOException {
String pathDirectory = getPathForId(idDoc);
! return this.manageVersionning(pathDirectory, "document", ".xml");
}
***************
*** 700,704 ****
* @throws IOException si une exception survient.
*/
! private void manageVersionning(
final String pathDirectory, final String docName,
final String extension) throws IOException {
--- 701,705 ----
* @throws IOException si une exception survient.
*/
! private boolean manageVersionning(
final String pathDirectory, final String docName,
final String extension) throws IOException {
***************
*** 715,728 ****
File newFile = new File(versionPathDir);
if (!newFile.exists()) {
! copie = newFile;
foundTheNewDirectory = true;
}
version++;
}
! // copie du fichier precedent
! Utils.copyFile(sourceFile, copie);
! // suppression document source
! sourceFile.delete();
}
}
--- 716,728 ----
File newFile = new File(versionPathDir);
if (!newFile.exists()) {
! copie = new File(newFile.getPath());
foundTheNewDirectory = true;
}
version++;
}
! // on renomme le fichier source
! return sourceFile.renameTo(copie);
}
+ return false;
}
***************
*** 773,777 ****
* Vu que la source conserve son extension,
* on va lister les fichiers dans le repertoire.
! * Celui qui contient 'source' est la bonne.
*/
File dir = new File(getPathForId(id));
--- 773,778 ----
* Vu que la source conserve son extension,
* on va lister les fichiers dans le repertoire.
! * Celui qui contient 'source.' est la bonne.
! * voir le filtre.
*/
File dir = new File(getPathForId(id));
***************
*** 998,1002 ****
// cle pas dans la notice
if (log.isErrorEnabled()) {
! log.error("La clé n'existe pa dans la notice", pne);
}
}
--- 999,1003 ----
// cle pas dans la notice
if (log.isErrorEnabled()) {
! log.error("La clé n'existe pas dans la notice", pne);
}
}
***************
*** 1211,1215 ****
ArrayList base = new ArrayList();
base.add("MD_Base1.xml");
- base.add("MD_Base2.xml");
ParserMetaDatas md = new ParserMetaDatas(base);
return md.getMetadatasForSearch();
--- 1212,1215 ----
***************
*** 1308,1311 ****
--- 1308,1312 ----
PersistenceManager pm = JDOFactory.getPersistenceManager();
this.jdoQuery.setPersistenceManager(pm);
+
Document doc = rechercheDocument(idDoc, false);
Transaction tx = pm.currentTransaction();
***************
*** 1382,1390 ****
while (iterGroupesDoc.hasNext()) {
String groupesDocId = (String) iterGroupesDoc.next();
- int grpIndex = groupesDocId
- .indexOf(GroupesConstants.PREFIX_ID);
String grpId;
! if (grpIndex != -1) {
! grpId = groupesDocId.substring(grpIndex);
} else {
grpId = groupesDocId;
--- 1383,1390 ----
while (iterGroupesDoc.hasNext()) {
String groupesDocId = (String) iterGroupesDoc.next();
String grpId;
! if (groupesDocId.startsWith(GroupesConstants.PREFIX_ID)) {
! grpId = groupesDocId
! .substring(GroupesConstants.PREFIX_ID.length());
} else {
grpId = groupesDocId;
Plus d'informations sur la liste de diffusion Castore-commits