[
http://jira.nuxeo.org/browse/NXP-1911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31905#action_31905
]
Anne-Lise Mesnil commented on NXP-1911:
---------------------------------------
Nous utilisons la dernière version livrée de Nuxeo (5.1.3).
Code de la création :
public ITCSResource createDocument(ITCSResource parent,
ITCSResource newDocument, boolean save)
throws DocumentManagerException {
DocumentModel document = null;
DocumentModel parentDocument;
try {
if (coreSession != null) {
if (parent != null) {
parentDocument =
coreSession.getDocument(new IdRef(parent
.getReference()));
document = new
DocumentModelImpl(parentDocument,
generateDocumentName(newDocument.getName()),
newDocument.getType());
}
document = coreSession.createDocument(document);
for (DocumentProperty property : newDocument
.getDocumentProperties()) {
document.setProperty(property.getSchema(), property
.getData(),
property.getValue());
}
document = coreSession.saveDocument(document);
if (save) {
coreSession.save();
}
return new ITCSResource(document);
}
} catch (ClientException e) {
throw new DocumentManagerException(e);
} catch (Exception e) {
e.printStackTrace();
throw new DocumentManagerException(e);
}
return null;
}
Code de la Modification :
public ITCSResource modifyDocument(String reference, ITCSResource
document,
boolean save, boolean version) throws
DocumentManagerException {
try {
if (coreSession != null) {
// Modify the document property
DocumentModel documentModel = coreSession
.getDocument(new
IdRef(reference));
documentModel = updateProperties(documentModel,
document);
// TODO : BUG Nuxeo, fix for version sept 2007
String[] schemas =
documentModel.getDeclaredSchemas();
for (String schema : schemas) {
if (schema.equals("files")) {
//$NON-NLS-1$
if
(document.getProperty("files", "files") == null) { //$NON-NLS-1$ //$NON-NLS-2$
document.addProperty("files", "files", //$NON-NLS-1$ //$NON-NLS-2$
new
ArrayList());
break;
}
}
}
documentModel = updateProperties(documentModel,
document);
if (version) {
// Create a version for the document
documentModel = coreSession
.saveDocumentAsNewVersion(documentModel);
} else {
documentModel =
coreSession.saveDocument(documentModel);
}
if (save) {
coreSession.save();
return new ITCSResource(documentModel);
}
}
} catch (ClientException e) {
throw new DocumentManagerException(e);
}
return null;
}
Nous versionnons nos documents et espérons supprimer la dernière version.
J'espère que ces éléments vont vous aider.
> Jackrabbit ReferentialIntegrityException on remove
> --------------------------------------------------
>
> Key: NXP-1911
> URL: http://jira.nuxeo.org/browse/NXP-1911
> Project: Nuxeo Enterprise Platform 5
> Issue Type: Bug
> Components: JCRConnector
> Reporter: Anne-Lise Mesnil
> Assignee: Florent Guillaume
> Priority: Blocker
>
> Bonjour,
> Parfois, lors d'une suppression d'une ressource nous avons l'exception
> suivante :
> org.nuxeo.ecm.core.api.ClientException: Failed to get children for
> 8180da63-a6bc-48f5-a03d-87b4ea976523
> Le code que nous utilisons est le suivant :
> public void removeDocument(ITCSResource document)
> throws DocumentManagerException {
> try {
> if (coreSession != null) {
> DocumentRef documentRef = new
> IdRef(document.getReference());
> coreSession.removeDocument(documentRef);
> coreSession.save();
> }
> } catch (ClientException e) {
> throw new DocumentManagerException(e);
> }
> }
> Cette exception ne nous permet pas de supprimer l'exigence ce qui est tres
> boquant pour nous. Merci de nous faire un retour sur la/les raison/s du bug
> (mauvaise utilisation de notre part, ...)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets