exo-ecm-dms

Can't use new nodetype with image data: DisplayResourceCommand throws "Invalid node type..." excpetion

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Similar issues:
  • Description:
    Hide

    If I create nodetype, say exo:image, with child node to hold an image, and use DisplayResourceCommand for this inner resource to display it as the image, DisplayResourceCommand throws "Invalid node type, expected nt:file or exo:article, have exo:image at /test" exception.

    Massimo Gai proposed a solution:
    Index: DisplayResourceCommand.java
    ===================================================================
    — DisplayResourceCommand.java (revision 9321)
    +++ DisplayResourceCommand.java (working copy)
    @@ -42,13 +42,11 @@
    //file.refresh(false);
    ////

    • Node content;
    • if(file.isNodeType("nt:file")) { - content = file.getNode("jcr:content"); - } else if(file.isNodeType("exo:article")) { - content = file.getNode("exo:image"); - } else
    • throw new Exception("Invalid node type, expected nt:file or exo:article, have "+file.getPrimaryNodeType().getName
      ()+" at "+file.getPath());
      + String relativePath=(String)request.getParameter("relativePath");
      + Node content=file.getNode(relativePath);
      + if (content==null ) { + throw new Exception("Path not found: " + file.getPath() + "/" + file.getPrimaryNodeType().getName() + "/" + rela tivePath); + }

    Property data = content.getProperty("jcr:data");
    String mime = content.getProperty("jcr:mimeType").getString();


    Note, extending nt:file or nesting nt:file does not work either.

    Show
    If I create nodetype, say exo:image, with child node to hold an image, and use DisplayResourceCommand for this inner resource to display it as the image, DisplayResourceCommand throws "Invalid node type, expected nt:file or exo:article, have exo:image at /test" exception. Massimo Gai proposed a solution: Index: DisplayResourceCommand.java =================================================================== — DisplayResourceCommand.java (revision 9321) +++ DisplayResourceCommand.java (working copy) @@ -42,13 +42,11 @@ //file.refresh(false); ////
    • Node content;
    • if(file.isNodeType("nt:file")) { - content = file.getNode("jcr:content"); - } else if(file.isNodeType("exo:article")) { - content = file.getNode("exo:image"); - } else
    • throw new Exception("Invalid node type, expected nt:file or exo:article, have "+file.getPrimaryNodeType().getName ()+" at "+file.getPath()); + String relativePath=(String)request.getParameter("relativePath"); + Node content=file.getNode(relativePath); + if (content==null ) { + throw new Exception("Path not found: " + file.getPath() + "/" + file.getPrimaryNodeType().getName() + "/" + rela tivePath); + }
    Property data = content.getProperty("jcr:data"); String mime = content.getProperty("jcr:mimeType").getString(); — Note, extending nt:file or nesting nt:file does not work either.
  1. exo-image.nt.xml
    (1 kB)
    Andriy Zhdanov
    10/Oct/06 12:23 PM

Activity

Hide
Gennady Azarenkov added a comment - 10/Oct/06 12:18 PM

can you show the nodetype definition?

Show
Gennady Azarenkov added a comment - 10/Oct/06 12:18 PM can you show the nodetype definition?
Hide
Andriy Zhdanov added a comment - 10/Oct/06 12:23 PM

Please see attached exo-image.nt.xml

Show
Andriy Zhdanov added a comment - 10/Oct/06 12:23 PM Please see attached exo-image.nt.xml
Hide
Nguyen Quang Hung added a comment - 11/Oct/06 3:37 AM

I also think this implement of DisplayResourceCommand only display resource of nt:file or exo:article or nodetype extends from these nodetype

Show
Nguyen Quang Hung added a comment - 11/Oct/06 3:37 AM I also think this implement of DisplayResourceCommand only display resource of nt:file or exo:article or nodetype extends from these nodetype
Hide
Gennady Azarenkov added a comment - 11/Oct/06 7:08 AM

yes, this command servlet was intended for nt:file and exo:article nodes displaying (Hung, are you surprised ? ) so it wont work for
<supertype>nt:base</supertype>
<supertype>mix:referenceable</supertype>

now this command is refactored though so even this nodetype could be suitable if make inner image primary item
(see JCR-146)

Show
Gennady Azarenkov added a comment - 11/Oct/06 7:08 AM yes, this command servlet was intended for nt:file and exo:article nodes displaying (Hung, are you surprised ? ) so it wont work for <supertype>nt:base</supertype> <supertype>mix:referenceable</supertype> now this command is refactored though so even this nodetype could be suitable if make inner image primary item (see JCR-146)

People

Dates

  • Created:
    07/Oct/06 6:10 PM
    Updated:
    11/Oct/06 7:08 AM
    Resolved:
    11/Oct/06 7:08 AM
    Date of First Response:
    10/Oct/06 12:18 PM