[daisy] Re: change documenttype via api
Karel Vervaeke
karel at outerthought.org
Tue Nov 13 09:08:28 CST 2007
You could try with document.setDocumentTypeChecksEnabled(true), but that
will probably still result in an invalid document in the end.
Did you double check that the FieldType "krantNaam" (ID: 86) is a field
of your new documentType? (Please don't be offended, I know it may sound
obvious)
regards,
Karel
On Tue, 2007-11-13 at 11:52 +0100, Bart Van den Abeele wrote:
> I tried to fill the field "krantNaam" of the new documenttype "Krant"
> and this field was not present on the previous documenttype "Geboorte".
>
> Error:
>
> 08-11-2007 15:59:22 ERROR: EventProcessor Exception
> be.schaubroeck.daisy.RepositoryAccessException: Error in
> doExecute(RepositoryExecutor)!
> at
> be.schaubroeck.daisy.RepositoryTemplate.execute(RepositoryTemplate.java:84)
> at
> be.schaubroeck.daisy.RepositoryTemplate.save(RepositoryTemplate.java:197)
> at
> be.schaubroeck.daisy.RepositoryTemplate.save(RepositoryTemplate.java:158)
> at
> be.schaubroeck.digidoc.dao.daisy.DaisyDigidocumentDAO.update(DaisyDigidocumentDAO.java:383)
> at
> be.schaubroeck.digidoc.StandaardDigidocumentService.update(StandaardDigidocumentService.java:177)
> at
> be.schaubroeck.digidoc.StandaardDigidocumentService.insertOrUpdate(StandaardDigidocumentService.java:190)
> at
> be.schaubroeck.digidoc.gui.form.AnnotationForm.tryCommit(AnnotationForm.java:442)
> at
> be.schaubroeck.digidoc.gui.form.AnnotationForm.commit(AnnotationForm.java:384)
> at
> org.springframework.richclient.form.AbstractForm$2.doExecuteCommand(AbstractForm.java:452)
> at
> org.springframework.richclient.command.ActionCommand.execute(ActionCommand.java:195)
> at
> org.springframework.richclient.command.ActionCommand$1.actionPerformed(ActionCommand.java:126)
> at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
> at
> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
> at
> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
> at
> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
> at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
> at java.awt.Component.processMouseEvent(Component.java:6038)
> at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
> at java.awt.Component.processEvent(Component.java:5803)
> at java.awt.Container.processEvent(Container.java:2058)
> at java.awt.Component.dispatchEventImpl(Component.java:4410)
> at java.awt.Container.dispatchEventImpl(Container.java:2116)
> at java.awt.Component.dispatchEvent(Component.java:4240)
> at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
> at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
> at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
> at java.awt.Container.dispatchEventImpl(Container.java:2102)
> at java.awt.Window.dispatchEventImpl(Window.java:2429)
> at java.awt.Component.dispatchEvent(Component.java:4240)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
> at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
> at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
> at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
> Caused by: org.outerj.daisy.repository.RepositoryException: Received
> exception from repository server.
> at
> org.outerj.daisy.repository.clientimpl.infrastructure.DaisyHttpClient.handleNotOkResponse(DaisyHttpClient.java:180)
> at
> org.outerj.daisy.repository.clientimpl.infrastructure.DaisyHttpClient.executeMethod(DaisyHttpClient.java:111)
> at
> org.outerj.daisy.repository.clientimpl.RemoteDocumentStrategy.store(RemoteDocumentStrategy.java:215)
> at
> org.outerj.daisy.repository.commonimpl.DocumentImpl.save(DocumentImpl.java:430)
> at
> be.schaubroeck.daisy.RepositoryTemplate$1.doExecute(RepositoryTemplate.java:220)
> at
> be.schaubroeck.daisy.RepositoryTemplate.execute(RepositoryTemplate.java:71)
> ... 36 more
> Caused by:
> org.outerj.daisy.repository.clientimpl.infrastructure.DaisyPropagatedException:
> [org.outerj.daisy.repository.DocumentTypeInconsistencyException] The
> FieldType "krantNaam" (ID: 86) is not allowed on this document.
> Karel Vervaeke schreef:
> > Quickly browsing through the (daisy 2.2-dev) code, I do not immediately
> > see a problem with what you are trying to do. Perhaps you can provide
> > the error message and/or the stacktrace?
> >
> > Regards,
> > Karel
> >
> > On Mon, 2007-11-12 at 12:33 +0100, Bart Van den Abeele wrote:
> >> Hi,
> >>
> >> I have a problem with switching the documenttype. Execute next code:
> >>
> >> document.setName(digidocument.getDocumentName());
> >> String oldDocumentType =
> >> schemaDAO.getDocumentType(document.getDocumentTypeId());
> >> String newDocumentType = digidocument.getDocumentType();
> >> if (!oldDocumentType.equals(newDocumentType))
> >> {
> >> Fields fields = document.getFields();
> >> for (Field field : fields.getArray())
> >> {
> >> document.deleteField(field.getTypeId());
> >> }
> >> document.changeDocumentType(newDocumentType);
> >> }
> >> modifyCommonSimpleProperties(digidocument, document);
> >> modifyUnknownFields(digidocument, document);
> >> modifyPictures(digidocument, document);
> >>
> >> First i delete al fields, then i change the documenttype and then i set
> >> the value of the new fields on the document. When i only adjust fields
> >> that were also on the previous documenttype i don't get a problem. But
> >> when i try to set the value of a field of the new documenttype, i get an
> >> error. This occurs in daisy 2.0.1 . Should i do something extra before
> >> setting the field that wasn't part of the old documenttype, or is this a
> >> bug?
> >>
> >> Grtz,
> >> Bart
> >>
> >> **** DISCLAIMER ****
> >> http://www.schaubroeck.be/maildisclaimer.htm
> >> _______________________________________________
> >> daisy community mailing list
> >> Professional Daisy support: http://outerthought.org/site/services/daisy/daisysupport.html
> >> mail to: daisy-81qHHgoATdGcMQoVcdA18UB+6BGkLq7r at public.gmane.org
> >> list information: http://lists.cocoondev.org/mailman/listinfo/daisy
> > _______________________________________________
> > daisy community mailing list
> > Professional Daisy support: http://outerthought.org/site/services/daisy/daisysupport.html
> > mail to: daisy-81qHHgoATdGcMQoVcdA18UB+6BGkLq7r at public.gmane.org
> > list information: http://lists.cocoondev.org/mailman/listinfo/daisy
> >
>
>
> **** DISCLAIMER ****
> http://www.schaubroeck.be/maildisclaimer.htm
> _______________________________________________
> daisy community mailing list
> Professional Daisy support: http://outerthought.org/site/services/daisy/daisysupport.html
> mail to: daisy at lists.cocoondev.org
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy
More information about the daisy
mailing list