Issue Details (XML | Word | Printable)

Key: ECM-157
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Gennady Azarenkov
Reporter: Andriy Zhdanov
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
exo-ecm-dms

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

Created: 07/Oct/06 06:10 PM   Updated: 11/Oct/06 07:08 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. XML File exo-image.nt.xml (1 kB)


Resolution Date: 11/Oct/06 07:08 AM
Date of First Response: 10/Oct/06 12:18 PM


 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.

 All   Comments   Work Log   Change History   Subversion Commits   FishEye      Sort Order: Ascending order - Click to sort in descending order
Gennady Azarenkov added a comment - 10/Oct/06 12:18 PM
can you show the nodetype definition?

Andriy Zhdanov added a comment - 10/Oct/06 12:23 PM
Please see attached exo-image.nt.xml

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

Gennady Azarenkov added a comment - 11/Oct/06 07: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)