svn commit: r1128613 - in /ofbiz/branches/jackrabbit20100709: applications/content/src/org/ofbiz/content/jcr/ applications/content/src/org/ofbiz/content/jcr/helper/ applications/content/src/org/ofbiz/content/jcr/orm/ framework/example/widget/example/ f...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1128613 - in /ofbiz/branches/jackrabbit20100709: applications/content/src/org/ofbiz/content/jcr/ applications/content/src/org/ofbiz/content/jcr/helper/ applications/content/src/org/ofbiz/content/jcr/orm/ framework/example/widget/example/ f...

sascharodekamp
Author: sascharodekamp
Date: Sat May 28 11:46:32 2011
New Revision: 1128613

URL: http://svn.apache.org/viewvc?rev=1128613&view=rev
Log:
Update - Better language handling for files. Add additional properties to file node which defines title, language and description of a file content. (Did some reformatting of the java code)

Modified:
    ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitEvents.java
    ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java
    ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/helper/JcrFileHelperJackrabbit.java
    ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java
    ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml
    ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml
    ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java
    ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java
    ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java

Modified: ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitEvents.java?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitEvents.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitEvents.java Sat May 28 11:46:32 2011
@@ -291,7 +291,8 @@ public class JackrabbitEvents {
      * @return
      */
     public static String uploadFileData(HttpServletRequest request, HttpServletResponse response) {
-
+        String language = request.getParameter("fileLocale");
+        String description = request.getParameter("description");
         ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
         List<FileItem> list = null;
         Map<String, String> passedParams = FastMap.newInstance();
@@ -321,7 +322,7 @@ public class JackrabbitEvents {
 
         if (file != null && file.length >= 1) {
             try {
-                jackrabbit.uploadFileData(file, passedParams.get("completeFileName"));
+                jackrabbit.uploadFileData(file, passedParams.get("completeFileName"), language, description);
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
                 request.setAttribute("_ERROR_MESSAGE_", e.toString());

Modified: ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/JackrabbitWorker.java Sat May 28 11:46:32 2011
@@ -36,11 +36,9 @@ public class JackrabbitWorker {
         try {
             session = JackrabbitContainer.getUserSession(userLogin);
             returnList = getRepositoryNodes(session, startNodePath);
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             throw new RepositoryException(e);
-        }
-        finally {
+        } finally {
             session.logout();
         }
 
@@ -86,20 +84,16 @@ public class JackrabbitWorker {
                 }
 
             }
-        }
-        catch (RepositoryException e) {
+        } catch (RepositoryException e) {
             Debug.logError(e, module);
             throw new RepositoryException(e);
-        }
-        catch (GenericEntityException e) {
+        } catch (GenericEntityException e) {
             Debug.logError(e, module);
             throw new GenericEntityException(e);
-        }
-        finally {
+        } finally {
             try {
                 session.save();
-            }
-            catch (RepositoryException e) {
+            } catch (RepositoryException e) {
                 Debug.logError(e, module);
                 throw new RepositoryException(e);
             }

Modified: ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/helper/JcrFileHelperJackrabbit.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/helper/JcrFileHelperJackrabbit.java?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/helper/JcrFileHelperJackrabbit.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/helper/JcrFileHelperJackrabbit.java Sat May 28 11:46:32 2011
@@ -21,214 +21,243 @@ import org.ofbiz.jcr.helper.JcrFileHelpe
 
 public class JcrFileHelperJackrabbit extends JcrFileHelperAbstract implements JcrFileHelper {
 
- private static String fileRootNode = "/fileHome";
+    private static String fileRootNode = "/fileHome";
 
- /**
- * The JcrHelper constructor loads the node and linked content data from the
- * DB. You can pass a contentId *OR* a node path. Primary the constructor
- * will take a contentId, get the content information from the database and
- * read the linked repository node from the database. If you pass a
- * repository node path, the method will look in the database for a linked
- * content entry. If none is found the constructor creates a *new* content
- * node in the repository. All nodes creates by the JcrFileHelper
- * constructor will be stored under a file home node. This file home node
- * represents the root folder for each file.
- *
- * @param userLogin
- * @param delegator
- * @param contentId
- * @param repositoryNode
- */
- public JcrFileHelperJackrabbit(GenericValue userLogin, Delegator delegator, String contentId, String repositoryNode) {
- super.userLogin = userLogin;
- if (userLogin == null || delegator == null) {
- Debug.logError("You pass null for the UserLogin or Delegator, Object can't be created.", module);
- return;
- }
-
- Session session = null;
- try {
- session = JackrabbitContainer.getUserSession(userLogin);
- } catch (RepositoryException re) {
- Debug.logError(re, module);
- return;
- }
-
- // if neither a contentId nor a repositoryNode is set or the repository node is set to the root node
- // we have to point the repository node to our file root node
- if (UtilValidate.isEmpty(contentId) && (UtilValidate.isEmpty(repositoryNode) || "/".equals(repositoryNode))) {
- repositoryNode = fileRootNode;
- }
-
- // add the file home node to the repository node if necessary
- repositoryNode = addRepositoryFileHomeNode(repositoryNode);
-
- try {
- super.orm = new OfbizRepositoryMappingJackrabbit(delegator, session, contentId, repositoryNode, OfbizRepositoryMappingJackrabbit.NODE_TYPE.FILE);
- } catch (GenericEntityException e) {
- Debug.logError(e, module);
- return;
- } catch (RepositoryException e) {
- Debug.logError(e, module);
- return;
- }
- }
-
- /**
- * The JcrHelper constructor loads the node and linked content data from the
- * DB. You can pass a contentId *OR* a node path. Primary the constructor
- * will take a contentId, get the content information from the database and
- * read the related repository node from the database. If you pass a
- * repository node path, the method will look in the database for a linked
- * content entry. If none is found the constructor creates a *new* content
- * node in the repository. The request object should contain the parameters:
- * userLogin (GenericValue), contentId (String) *or* repositoryNode
- * (String). All nodes creates by the JcrFileHelper constructor will be
- * stored under a file home node. This file home node represents the root
- * folder for each file.
- *
- * @param request
- */
- public JcrFileHelperJackrabbit(HttpServletRequest request) {
- GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
- super.userLogin = userLogin;
-
- Session session = null;
- try {
- session = JackrabbitContainer.getUserSession(userLogin);
- } catch (RepositoryException re) {
- Debug.logError(re, module);
- return;
- }
-
- String contentId = request.getParameter("contentId");
- String repositoryNode = request.getParameter("repositoryNode");
-
- // if neither a contentId nor a repositoryNode is set or the repository node is set to the root node
- // we have to point the repository node to our file root node
- if (UtilValidate.isEmpty(contentId) && (UtilValidate.isEmpty(repositoryNode) || "/".equals(repositoryNode))) {
- repositoryNode = fileRootNode;
- }
-
- // add the file home node to the repository node if necessary
- repositoryNode = addRepositoryFileHomeNode(repositoryNode);
-
- Delegator delegator = (Delegator) request.getAttribute("delegator");
- try {
- super.orm = new OfbizRepositoryMappingJackrabbit(delegator, session, contentId, repositoryNode, OfbizRepositoryMappingJackrabbit.NODE_TYPE.FILE);
- } catch (GenericEntityException e) {
- Debug.logError(e, module);
- return;
- } catch (RepositoryException e) {
- Debug.logError(e, module);
- return;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ofbiz.jcr.helper.JcrFileHelper#uploadFileData(byte[],
- * java.lang.String)
- */
- @Override
- public GenericValue uploadFileData(byte[] file, String fileName) throws RepositoryException, GenericEntityException {
- InputStream is = new ByteArrayInputStream(file);
-
- orm.uploadFileData(is, fileName);
- return orm.getContentObject();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.ofbiz.jcr.helper.JcrFileHelper#uploadFileData(java.io.InputStream,
- * java.lang.String)
- */
- @Override
- public GenericValue uploadFileData(InputStream file, String fileName) throws RepositoryException, GenericEntityException {
- orm.uploadFileData(file, fileName);
- return orm.getContentObject();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ofbiz.jcr.helper.JcrFileHelper#getFileContent(java.lang.String)
- */
- @Override
- public InputStream getFileContent(String fileName) throws RepositoryException {
- return orm.getFileContent(fileName);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ofbiz.jcr.helper.JcrFileHelper#getFileContent()
- */
- @Override
- public InputStream getFileContent() throws RepositoryException {
- return orm.getFileContent();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ofbiz.jcr.helper.JcrFileHelper#addNewNode(java.lang.String)
- */
- @Override
- public JcrFileHelper addNewNode(String newNode) throws RepositoryException, GenericEntityException {
- if (!newNode.startsWith("/")) {
- newNode = "/" + newNode;
- }
-
- String newAbsoluteNodePath = orm.getNodePath() + newNode;
-
- return new JcrFileHelperJackrabbit(userLogin, orm.getDelegator(), null, newAbsoluteNodePath);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ofbiz.jcr.helper.JcrFileHelper#getJsonFileTree()
- */
- @Override
- public JSONArray getJsonFileTree() throws RepositoryException {
- return orm.getJsonFileTree();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ofbiz.jcr.helper.JcrFileHelper#getFileMimeType()
- */
- @Override
- public String getFileMimeType() throws RepositoryException{
- return orm.getFileMimeType();
- }
-
- /**
- * Adds the file home node to the repository node, if not already exists.
- *
- * @param repositoryNode
- * @return
- */
- private String addRepositoryFileHomeNode(String repositoryNode) {
- if (UtilValidate.isEmpty(repositoryNode)) {
- return repositoryNode;
- }
-
- // check if the node already starts with the home node
- if (repositoryNode.startsWith(fileRootNode)) {
- return repositoryNode;
- }
-
- if (repositoryNode.startsWith("/")) {
- return repositoryNode = fileRootNode + repositoryNode;
- }
+    /**
+     * The JcrHelper constructor loads the node and linked content data from the
+     * DB. You can pass a contentId *OR* a node path. Primary the constructor
+     * will take a contentId, get the content information from the database and
+     * read the linked repository node from the database. If you pass a
+     * repository node path, the method will look in the database for a linked
+     * content entry. If none is found the constructor creates a *new* content
+     * node in the repository. All nodes creates by the JcrFileHelper
+     * constructor will be stored under a file home node. This file home node
+     * represents the root folder for each file.
+     *
+     * @param userLogin
+     * @param delegator
+     * @param contentId
+     * @param repositoryNode
+     */
+    public JcrFileHelperJackrabbit(GenericValue userLogin, Delegator delegator, String contentId, String repositoryNode) {
+        super.userLogin = userLogin;
+        if (userLogin == null || delegator == null) {
+            Debug.logError("You pass null for the UserLogin or Delegator, Object can't be created.", module);
+            return;
+        }
+
+        Session session = null;
+        try {
+            session = JackrabbitContainer.getUserSession(userLogin);
+        } catch (RepositoryException re) {
+            Debug.logError(re, module);
+            return;
+        }
+
+        // if neither a contentId nor a repositoryNode is set or the repository
+        // node is set to the root node
+        // we have to point the repository node to our file root node
+        if (UtilValidate.isEmpty(contentId) && (UtilValidate.isEmpty(repositoryNode) || "/".equals(repositoryNode))) {
+            repositoryNode = fileRootNode;
+        }
+
+        // add the file home node to the repository node if necessary
+        repositoryNode = addRepositoryFileHomeNode(repositoryNode);
+
+        try {
+            super.orm = new OfbizRepositoryMappingJackrabbit(delegator, session, contentId, repositoryNode, OfbizRepositoryMappingJackrabbit.NODE_TYPE.FILE);
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+            return;
+        } catch (RepositoryException e) {
+            Debug.logError(e, module);
+            return;
+        }
+    }
+
+    /**
+     * The JcrHelper constructor loads the node and linked content data from the
+     * DB. You can pass a contentId *OR* a node path. Primary the constructor
+     * will take a contentId, get the content information from the database and
+     * read the related repository node from the database. If you pass a
+     * repository node path, the method will look in the database for a linked
+     * content entry. If none is found the constructor creates a *new* content
+     * node in the repository. The request object should contain the parameters:
+     * userLogin (GenericValue), contentId (String) *or* repositoryNode
+     * (String). All nodes creates by the JcrFileHelper constructor will be
+     * stored under a file home node. This file home node represents the root
+     * folder for each file.
+     *
+     * @param request
+     */
+    public JcrFileHelperJackrabbit(HttpServletRequest request) {
+        GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
+        super.userLogin = userLogin;
+
+        Session session = null;
+        try {
+            session = JackrabbitContainer.getUserSession(userLogin);
+        } catch (RepositoryException re) {
+            Debug.logError(re, module);
+            return;
+        }
+
+        String contentId = request.getParameter("contentId");
+        String repositoryNode = request.getParameter("repositoryNode");
+
+        // if neither a contentId nor a repositoryNode is set or the repository
+        // node is set to the root node
+        // we have to point the repository node to our file root node
+        if (UtilValidate.isEmpty(contentId) && (UtilValidate.isEmpty(repositoryNode) || "/".equals(repositoryNode))) {
+            repositoryNode = fileRootNode;
+        }
+
+        // add the file home node to the repository node if necessary
+        repositoryNode = addRepositoryFileHomeNode(repositoryNode);
+
+        Delegator delegator = (Delegator) request.getAttribute("delegator");
+        try {
+            super.orm = new OfbizRepositoryMappingJackrabbit(delegator, session, contentId, repositoryNode, OfbizRepositoryMappingJackrabbit.NODE_TYPE.FILE);
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+            return;
+        } catch (RepositoryException e) {
+            Debug.logError(e, module);
+            return;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.ofbiz.jcr.helper.JcrFileHelper#uploadFileData(byte[],
+     * java.lang.String)
+     */
+    @Override
+    public GenericValue uploadFileData(byte[] file, String fileName) throws RepositoryException, GenericEntityException {
+        InputStream is = new ByteArrayInputStream(file);
+
+        orm.uploadFileData(is, fileName);
+        return orm.getContentObject();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.ofbiz.jcr.helper.JcrFileHelper#uploadFileData(byte[],
+     * java.lang.String, java.lang.String, java.lang.String)
+     */
+    @Override
+    public GenericValue uploadFileData(byte[] file, String fileName, String language, String description) throws RepositoryException, GenericEntityException {
+        InputStream is = new ByteArrayInputStream(file);
+
+        orm.uploadFileData(is, fileName, language, description);
+        return orm.getContentObject();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.ofbiz.jcr.helper.JcrFileHelper#uploadFileData(java.io.InputStream,
+     * java.lang.String)
+     */
+    @Override
+    public GenericValue uploadFileData(InputStream file, String fileName) throws RepositoryException, GenericEntityException {
+        orm.uploadFileData(file, fileName);
+        return orm.getContentObject();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.ofbiz.jcr.helper.JcrFileHelper#uploadFileData(java.io.InputStream,
+     * java.lang.String, java.lang.String, java.lang.String)
+     */
+    @Override
+    public GenericValue uploadFileData(InputStream file, String fileName, String language, String description) throws RepositoryException, GenericEntityException {
+        orm.uploadFileData(file, fileName, language, description);
+        return orm.getContentObject();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.ofbiz.jcr.helper.JcrFileHelper#getFileContent(java.lang.String)
+     */
+    @Override
+    public InputStream getFileContent(String fileName) throws RepositoryException {
+        return orm.getFileContent(fileName);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.ofbiz.jcr.helper.JcrFileHelper#getFileContent()
+     */
+    @Override
+    public InputStream getFileContent() throws RepositoryException {
+        return orm.getFileContent();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.ofbiz.jcr.helper.JcrFileHelper#addNewNode(java.lang.String)
+     */
+    @Override
+    public JcrFileHelper addNewNode(String newNode) throws RepositoryException, GenericEntityException {
+        if (!newNode.startsWith("/")) {
+            newNode = "/" + newNode;
+        }
+
+        String newAbsoluteNodePath = orm.getNodePath() + newNode;
+
+        return new JcrFileHelperJackrabbit(userLogin, orm.getDelegator(), null, newAbsoluteNodePath);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.ofbiz.jcr.helper.JcrFileHelper#getJsonFileTree()
+     */
+    @Override
+    public JSONArray getJsonFileTree() throws RepositoryException {
+        return orm.getJsonFileTree();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.ofbiz.jcr.helper.JcrFileHelper#getFileMimeType()
+     */
+    @Override
+    public String getFileMimeType() throws RepositoryException {
+        return orm.getFileMimeType();
+    }
+
+    /**
+     * Adds the file home node to the repository node, if not already exists.
+     *
+     * @param repositoryNode
+     * @return
+     */
+    private String addRepositoryFileHomeNode(String repositoryNode) {
+        if (UtilValidate.isEmpty(repositoryNode)) {
+            return repositoryNode;
+        }
+
+        // check if the node already starts with the home node
+        if (repositoryNode.startsWith(fileRootNode)) {
+            return repositoryNode;
+        }
+
+        if (repositoryNode.startsWith("/")) {
+            return repositoryNode = fileRootNode + repositoryNode;
+        }
 
- return fileRootNode + "/" + repositoryNode;
- }
+        return fileRootNode + "/" + repositoryNode;
+    }
 
 }

Modified: ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/content/src/org/ofbiz/content/jcr/orm/OfbizRepositoryMappingJackrabbit.java Sat May 28 11:46:32 2011
@@ -44,8 +44,8 @@ public class OfbizRepositoryMappingJackr
     private static String module = OfbizRepositoryMappingJackrabbit.class.getName();
 
     private enum PROPERTY_FIELDS {
-        MESSAGE("jcr:message"), FILE(NodeType.NT_FILE), FOLDER(NodeType.NT_FOLDER), RESOURCE(NodeType.NT_RESOURCE), DATA("jcr:data"), UNSTRUCTURED(NodeType.NT_UNSTRUCTURED), MIMETYPE("jcr:mimetype"), REPROOT("rep:root"), LANGUAGE("mix:language"), VERSIONING(
-                "mix:versionable");
+        MESSAGE("jcr:message"), FILE(NodeType.NT_FILE), FOLDER(NodeType.NT_FOLDER), RESOURCE(NodeType.NT_RESOURCE), DATA("jcr:data"), UNSTRUCTURED(NodeType.NT_UNSTRUCTURED), MIMETYPE("jcr:mimeType"), REPROOT("rep:root"), mixInLANGUAGE("mix:language"), mixInVERSIONING(
+                "mix:versionable"), mixInTITLE("mix:title"), LANGUAGE("jcr:language"), TITLE("jcr:title"), DESCRIPTION("jcr:description");
 
         String type = null;
 
@@ -70,8 +70,6 @@ public class OfbizRepositoryMappingJackr
     private Node node = null;
     private volatile VersionManager versionManager = null;
     private volatile String selectedLanguage = UtilProperties.getPropertyValue("general", "locale.properties.fallback");
-    // a list for all checked out nodes during one transaction TODO THREAD SAFE
-    // ??
     private List<Node> checkedOutNodeStore = Collections.synchronizedList(new ArrayList<Node>());
 
     /**
@@ -280,19 +278,19 @@ public class OfbizRepositoryMappingJackr
         // language property
         // TODO Refactor code fragment
         Node languageNode = node;
-        if (!this.node.hasProperty(PROPERTY_FIELDS.LANGUAGE.getType())) {
+        if (!this.node.hasProperty(PROPERTY_FIELDS.mixInLANGUAGE.getType())) {
             if (session.nodeExists(this.node.getPath()) && session.nodeExists(this.node.getPath() + "/" + language)) {
                 languageNode = this.node.getNode(language);
                 checkOutNode(languageNode);
             } else {
                 languageNode = (Node) this.createNewRepositoryNode(this.node.getPath() + "/" + language).get("node");
-                languageNode.setProperty(PROPERTY_FIELDS.LANGUAGE.getType(), language);
+                languageNode.setProperty(PROPERTY_FIELDS.mixInLANGUAGE.getType(), language);
             }
         } else {
             checkOutNode(languageNode);
         }
         languageNode.setProperty(PROPERTY_FIELDS.MESSAGE.getType(), message);
-        languageNode.addMixin(PROPERTY_FIELDS.VERSIONING.getType());
+        languageNode.addMixin(PROPERTY_FIELDS.mixInVERSIONING.getType());
 
         saveSessionAndCheckinNode();
 
@@ -408,7 +406,7 @@ public class OfbizRepositoryMappingJackr
         }
 
         Node langNode = null;
-        if (this.node.hasProperty(PROPERTY_FIELDS.LANGUAGE.getType())) {
+        if (this.node.hasProperty(PROPERTY_FIELDS.mixInLANGUAGE.getType())) {
             langNode = this.node;
         } else if (this.node.hasNode(language)) {
             // if a language is set check if the content exists in this
@@ -418,9 +416,11 @@ public class OfbizRepositoryMappingJackr
             }
         } else if (!this.node.hasNode(language) && useDefaultLanguage) {
             // NOTE: This will only executed if we want to load the content by
-            // the (system) default language and if for this default language no node exist.
+            // the (system) default language and if for this default language no
+            // node exist.
 
-            // When the method is called with a specific language and this language is
+            // When the method is called with a specific language and this
+            // language is
             // not present the user should get a hint that he is looking for a
             // not existing language. In the other case the user looks for any
             // language first we try the default language and if the default not
@@ -429,7 +429,7 @@ public class OfbizRepositoryMappingJackr
                 NodeIterator ni = this.node.getNodes();
                 while (ni.hasNext()) {
                     Node n = ni.nextNode();
-                    if (n.hasProperty(PROPERTY_FIELDS.LANGUAGE.getType())) {
+                    if (n.hasProperty(PROPERTY_FIELDS.mixInLANGUAGE.getType())) {
                         langNode = n;
                         break;
                     }
@@ -452,7 +452,7 @@ public class OfbizRepositoryMappingJackr
         }
 
         // set the current language selection
-        selectedLanguage = langNode.getProperty(PROPERTY_FIELDS.LANGUAGE.getType()).getString();
+        selectedLanguage = langNode.getProperty(PROPERTY_FIELDS.mixInLANGUAGE.getType()).getString();
 
         Property property = null;
         if (langNode.hasProperty(PROPERTY_FIELDS.MESSAGE.getType())) {
@@ -479,8 +479,8 @@ public class OfbizRepositoryMappingJackr
 
         while (ni.hasNext()) {
             Node subNode = (Node) ni.next();
-            if (subNode.hasProperty(PROPERTY_FIELDS.LANGUAGE.getType())) {
-                availableLanguages.add(subNode.getProperty(PROPERTY_FIELDS.LANGUAGE.getType()).getString());
+            if (subNode.hasProperty(PROPERTY_FIELDS.mixInLANGUAGE.getType())) {
+                availableLanguages.add(subNode.getProperty(PROPERTY_FIELDS.mixInLANGUAGE.getType()).getString());
             }
         }
 
@@ -494,19 +494,43 @@ public class OfbizRepositoryMappingJackr
      */
     @Override
     public void uploadFileData(InputStream file, String fileName) throws PathNotFoundException, RepositoryException, GenericEntityException {
+        uploadFileData(file, fileName, null, null);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.ofbiz.jcr.orm.OfbizContentMapping#uploadFileData()
+     */
+    @Override
+    public void uploadFileData(InputStream file, String fileName, String language, String description) throws PathNotFoundException, RepositoryException, GenericEntityException {
+        // if no language is passed store the content under the ofbiz default
+        // language
+        if (UtilValidate.isEmpty(language)) {
+            language = UtilProperties.getPropertyValue("general", "locale.properties.fallback");
+        }
+
         Node folder = (Node) createNewRepositoryNode(this.node.getPath() + "/" + fileName, PROPERTY_FIELDS.FILE.getType()).get("node");
 
+        // set additional file informations
+        folder.addMixin(PROPERTY_FIELDS.mixInLANGUAGE.getType());
+        folder.addMixin(PROPERTY_FIELDS.mixInTITLE.getType());
+        folder.setProperty(PROPERTY_FIELDS.LANGUAGE.getType(), language);
+        folder.setProperty(PROPERTY_FIELDS.TITLE.getType(), fileName);
+        if (UtilValidate.isNotEmpty(description)) {
+            folder.setProperty(PROPERTY_FIELDS.DESCRIPTION.getType(), description);
+        }
+
         Node resource = (Node) createNewRepositoryNode(folder.getPath() + "/jcr:content", PROPERTY_FIELDS.RESOURCE.getType()).get("node");
-        // checkOutNode(resource);
         Binary binary = this.session.getValueFactory().createBinary(file);
 
         String mimeType = getMimeTypeFromInputStream(file);
 
-        resource.setProperty("jcr:mimeType", mimeType);
+        resource.setProperty(PROPERTY_FIELDS.MIMETYPE.getType(), mimeType);
         // resource.setProperty("jcr:encoding", "");
 
         resource.setProperty(PROPERTY_FIELDS.DATA.getType(), binary);
-        resource.addMixin(PROPERTY_FIELDS.VERSIONING.getType());
+        resource.addMixin(PROPERTY_FIELDS.mixInVERSIONING.getType());
         saveSessionAndCheckinNode();
 
         return;
@@ -716,7 +740,7 @@ public class OfbizRepositoryMappingJackr
             Node node = nodeIterator.nextNode();
 
             //
-            if (node.getPrimaryNodeType().isNodeType(PROPERTY_FIELDS.UNSTRUCTURED.getType()) && !node.hasProperty(PROPERTY_FIELDS.LANGUAGE.getType())) {
+            if (node.getPrimaryNodeType().isNodeType(PROPERTY_FIELDS.UNSTRUCTURED.getType()) && !node.hasProperty(PROPERTY_FIELDS.mixInLANGUAGE.getType())) {
                 attr.element("title", node.getName());
                 folder.element("data", attr);
 
@@ -859,7 +883,7 @@ public class OfbizRepositoryMappingJackr
             returnMap.put("content", newContent);
             assocContentId = newContent.getString("contentId");
 
-            newNodeParent.addMixin(PROPERTY_FIELDS.VERSIONING.getType());
+            newNodeParent.addMixin(PROPERTY_FIELDS.mixInVERSIONING.getType());
             // the new node should be add to the nodeStore List to check it in
             // when the session is stored.
             checkedOutNodeStore.add(newNodeParent);

Modified: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitForms.xml Sat May 28 11:46:32 2011
@@ -66,6 +66,10 @@ under the License.
         <field name="fileData" title="${uiLabelMap.ExampleRepositoryFile}">
             <file size="28"></file>
         </field>
+        <field name="fileLocale" title="${uiLabelMap.CommonChooseLanguage}" >
+            <drop-down allow-empty="true" ><list-options key-name="localeId" list-name="parameters.localeList" description="${localeId}"/></drop-down>
+        </field>
+        <field name="description"><textarea cols="30"/></field>
         <field name="submit">
             <submit />
         </field>

Modified: ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/example/widget/example/ExampleJackrabbitScreens.xml Sat May 28 11:46:32 2011
@@ -87,6 +87,7 @@ under the License.
             <actions>
                 <set field="titleProperty" value="PageTitleExampleJackrabbit" />
                 <set field="tabButtonItem" value="ExampleJackrabbitUploadFileData" />
+                <script location="component://example/webapp/example/WEB-INF/actions/includes/PrepareLocalesForDropDown.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonExampleJackrabbitDecorator" location="${parameters.mainDecoratorLocation}">

Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelper.java Sat May 28 11:46:32 2011
@@ -28,6 +28,19 @@ public interface JcrFileHelper {
      *
      * @param file
      * @param fileName
+     * @param language
+     * @param description
+     * @return
+     * @throws RepositoryException
+     * @throws GenericEntityException
+     */
+    public GenericValue uploadFileData(byte[] file, String fileName, String language, String description) throws RepositoryException, GenericEntityException;
+
+    /**
+     * Upload a file to the repository file tree.
+     *
+     * @param file
+     * @param fileName
      * @return
      * @throws RepositoryException
      * @throws GenericEntityException
@@ -35,6 +48,19 @@ public interface JcrFileHelper {
     public GenericValue uploadFileData(InputStream file, String fileName) throws RepositoryException, GenericEntityException;
 
     /**
+     * Upload a file to the repository file tree.
+     *
+     * @param file
+     * @param fileName
+     * @param language
+     * @param description
+     * @return
+     * @throws RepositoryException
+     * @throws GenericEntityException
+     */
+    public GenericValue uploadFileData(InputStream file, String fileName, String language, String description) throws RepositoryException, GenericEntityException;
+
+    /**
      * Return the file passed file from the current folder node.
      *
      * @return

Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/helper/JcrFileHelperAbstract.java Sat May 28 11:46:32 2011
@@ -13,8 +13,12 @@ public abstract class JcrFileHelperAbstr
 
     public abstract GenericValue uploadFileData(byte[] file, String fileName) throws RepositoryException, GenericEntityException;
 
+    public abstract GenericValue uploadFileData(byte[] file, String fileName, String language, String description) throws RepositoryException, GenericEntityException;
+
     public abstract GenericValue uploadFileData(InputStream file, String fileName) throws RepositoryException, GenericEntityException;
 
+    public abstract GenericValue uploadFileData(InputStream file, String fileName, String language, String description) throws RepositoryException, GenericEntityException;
+
     public abstract InputStream getFileContent(String fileName) throws RepositoryException;
 
     public abstract InputStream getFileContent() throws RepositoryException;

Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java?rev=1128613&r1=1128612&r2=1128613&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java Sat May 28 11:46:32 2011
@@ -137,6 +137,19 @@ public interface OfbizRepositoryMapping
     public void uploadFileData(InputStream file, String fileName) throws PathNotFoundException, RepositoryException, GenericEntityException;
 
     /**
+     * Upload and store a file in the repository und a givven language.
+     *
+     * @param file
+     * @param fileName
+     * @param language
+     * @param description
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     * @throws GenericEntityException
+     */
+    void uploadFileData(InputStream file, String fileName, String language, String description) throws PathNotFoundException, RepositoryException, GenericEntityException;
+
+    /**
      * Return the file stream from the current node object.
      *
      * @param fileName