[Hippo-cms7-user] Import tool

marijan milicevic m.milicevic at onehippo.com
Sun Nov 29 22:19:47 CET 2009


Hi Niels,

nvankampenhout wrote:
> marijan milicevic-2 wrote:
>   
>> it should look like something like:
>>
>> @ImportField(name = "myns:categories",  repositoryType =
>> RepositoryTypes.REPO_TYPE_NODE, nodeType = true, nodeTypeName =
>> "myns:category"..)
>> List<Category> categories;
>>
>>
>>
>> and category class:
>>
>> @ImportDocument(documentType = "myns:category")
>> public class Category{
>>
>> @ImportField(name = "myns:id"..., xpath=...)
>> private String id;    
>>
>> ....
>> }
>>
>>     
>
> Thanks Marijan. I now have:
>
>     @ImportField(name = "myns:categories", 
>     		nodeTypeName = "myns:category",
>     		xpath = "/document/categories", 
>     		converter = CategoriesConverter.class, 
>     		repositoryType = RepositoryTypes.REPO_TYPE_NODE,
>     		nodeType = true)
> 	private List<Category> categories;
>
> in my "top level" document bean, and a Category bean:
>
> @ImportDocument(documentType = "myns:category")
> public class Category extends BaseImportBean {
> 	
> 	@ImportField(name = "myns:id", xpath = "id", converter =
> StringImportConverter.class)
> 	private String id;
> 	
> 	@ImportField(name = "myns:name", xpath = "name", converter =
> StringImportConverter.class)
> 	private String name;
>
> 	...
> }
>
>
> But when running the importer I get an exception:
>
> 29.11.2009 20:54:59 ERROR Error saving document
> javax.jcr.nodetype.ConstraintViolationException: no matching property
> definition found for {http://mycompany.com/hippo/1.5}categories
>
>
> Any ideas? I thought I had myns:categories marked as node
> (RepositoryTypes.REPO_TYPE_NODE) instead of property so I don't understand
> why the importer is trying to save a property.
>
>   



your code looks ok. Do you get any errors/warnings ?

for the time being/as a workaround, you can  override following method:

Node beforePersisted(Node node, DocumentCreator documentCreator);

within the bean that contains List<Category> field.


Now you can add your node(s) "manually" by using: node.addNode() method. 

hth,
-m 










-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onehippo.org/pipermail/hippo-cms7-user/attachments/20091129/0fa74728/attachment.htm>


More information about the Hippo-cms7-user mailing list