KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > module > workflow > beancoder > OwfeJcrBeanCoder


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13
14 package info.magnolia.module.workflow.beancoder;
15
16 import openwfe.org.jcr.Node;
17 import openwfe.org.jcr.beancoder.JcrBeanCoder;
18 import openwfe.org.engine.workitem.StringAttribute;
19
20
21 /**
22  * An extension of JcrBeanCoder that takes care of choosing nice
23  * node names for StringAttributes...
24  *
25  * <p><font size=2>CVS Info :
26  * <br>$Author$
27  * <br>$Id$ </font>
28  *
29  * @author Nicolas Modrzyk
30  * @author john.mettraux@openwfe.org
31  */

32 public class OwfeJcrBeanCoder extends JcrBeanCoder
33 {
34     public OwfeJcrBeanCoder
35             (final String JavaDoc ns, final Node startNode)
36     {
37         super(ns, startNode);
38     }
39
40     public OwfeJcrBeanCoder
41             (final String JavaDoc ns, final Node startNode, final String JavaDoc beanNodeName)
42     {
43         super(ns, startNode, beanNodeName);
44     }
45
46     protected Object JavaDoc[] asPropertyMapEntry(Object JavaDoc key, Object JavaDoc value) {
47         if ((key instanceof StringAttribute) && isSafeForAnItemName(key.toString()))
48             if(value instanceof StringAttribute)return new Object JavaDoc[] { key.toString(), value.toString()};
49         return super.asPropertyMapEntry(key, value);
50     }
51 }
52
Popular Tags