Author: sascharodekamp
Date: Tue Apr 24 13:50:33 2012 New Revision: 1329718 URL: http://svn.apache.org/viewvc?rev=1329718&view=rev Log: Move the repository mapping files in a sub package. To differ between file and data mappings. Each node contains now a field which identifies the party who created the content and the party which modified it last. Added: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/data/ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/file/ Removed: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/JackrabbitArticle.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/JackrabbitFile.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/JackrabbitFolder.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/JackrabbitHierarchyNode.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/JackrabbitLocalizedContent.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/JackrabbitNews.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/JackrabbitResource.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/jackrabbit/JackrabbitUnstructured.java Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/access/jackrabbit/JackrabbitRepositoryAccessor.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrDataHelper.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitArticleHelper.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/loader/jackrabbit/JCRFactoryImpl.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java ofbiz/trunk/specialpurpose/example/src/org/ofbiz/example/JackrabbitEvents.java Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/access/jackrabbit/JackrabbitRepositoryAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/access/jackrabbit/JackrabbitRepositoryAccessor.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/access/jackrabbit/JackrabbitRepositoryAccessor.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/access/jackrabbit/JackrabbitRepositoryAccessor.java Tue Apr 24 13:50:33 2012 @@ -28,6 +28,7 @@ public class JackrabbitRepositoryAccesso private final Session session; private final ObjectContentManagerImpl ocm; + private final GenericValue userLogin; /** * Create a repository Access object based on the userLogin. @@ -35,27 +36,18 @@ public class JackrabbitRepositoryAccesso * @param userLogin */ public JackrabbitRepositoryAccessor(GenericValue userLogin) { + this.userLogin = userLogin; // TODO pass the userLogin to the getSession() method and perform some - this(JCRFactoryUtil.getSession()); - } - - /** - * Create a repository Access object based on a JCR Session. - * - * @param userLogin - */ - public JackrabbitRepositoryAccessor(Session session) { - this.session = session; + this.session = JCRFactoryUtil.getSession(); this.ocm = new ObjectContentManagerImpl(session, JCRFactoryImpl.getMapper()); - - return; } - /** - * Returns the Jackrabbit session object. + /* + * (non-Javadoc) * - * @return + * @see org.ofbiz.jcr.access.JcrRepositoryAccessor#getSession() */ + @Override public Session getSession() { return this.session; } @@ -63,7 +55,7 @@ public class JackrabbitRepositoryAccesso /* * (non-Javadoc) * - * @see org.ofbiz.jcr.orm.RepositoryAccess#closeAccess() + * @see org.ofbiz.jcr.access.JcrRepositoryAccessor#closeAccess() */ @Override public void closeAccess() { @@ -76,7 +68,8 @@ public class JackrabbitRepositoryAccesso * (non-Javadoc) * * @see - * org.ofbiz.jcr.orm.RepositoryAccess#getContentObject(java.lang.String) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#getContentObject(java.lang + * .String) */ @Override public OfbizRepositoryMapping getContentObject(String nodePath) throws PathNotFoundException { @@ -88,8 +81,8 @@ public class JackrabbitRepositoryAccesso * (non-Javadoc) * * @see - * org.ofbiz.jcr.access.RepositoryAccess#getContentObject(java.lang.String, - * java.lang.String) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#getContentObject(java.lang + * .String, java.lang.String) */ @Override public OfbizRepositoryMapping getContentObject(String nodePath, String version) throws PathNotFoundException { @@ -101,11 +94,13 @@ public class JackrabbitRepositoryAccesso * (non-Javadoc) * * @see - * org.ofbiz.jcr.orm.RepositoryAccess#storeContentObject(org.ofbiz.jcr.orm - * .OfbizRepositoryMapping) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#storeContentObject(org.ofbiz + * .jcr.orm.OfbizRepositoryMapping) */ @Override public void storeContentObject(OfbizRepositoryMapping orm) throws ObjectContentManagerException, ItemExistsException { + orm.setPartyThatCreatedTheContent(this.getPartyId()); + ContentWriter contentWriter = new ContentWriterJackrabbit(this.ocm); contentWriter.storeContentObject(orm); } @@ -114,37 +109,36 @@ public class JackrabbitRepositoryAccesso * (non-Javadoc) * * @see - * org.ofbiz.jcr.orm.RepositoryAccess#updateContentObject(org.ofbiz.jcr. - * orm.OfbizRepositoryMapping) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#updateContentObject(org.ofbiz + * .jcr.orm.OfbizRepositoryMapping) */ @Override public void updateContentObject(OfbizRepositoryMapping orm) throws ObjectContentManagerException { + orm.setLastUpdatedParty(this.getPartyId()); + ContentWriter contentWriter = new ContentWriterJackrabbit(this.ocm); contentWriter.updateContentObject(orm); - - return; } /* * (non-Javadoc) * * @see - * org.ofbiz.jcr.orm.RepositoryAccess#removeContentObject(java.lang.String) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#removeContentObject(java.lang + * .String) */ @Override public void removeContentObject(String nodePath) throws ObjectContentManagerException { ContentWriter contentWriter = new ContentWriterJackrabbit(this.ocm); contentWriter.removeContentObject(nodePath); - - return; } /* * (non-Javadoc) * * @see - * org.ofbiz.jcr.orm.RepositoryAccess#removeContentObject(org.ofbiz.jcr. - * orm.OfbizRepositoryMapping) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#removeContentObject(org.ofbiz + * .jcr.orm.OfbizRepositoryMapping) */ @Override public void removeContentObject(OfbizRepositoryMapping orm) throws ObjectContentManagerException { @@ -155,7 +149,8 @@ public class JackrabbitRepositoryAccesso * (non-Javadoc) * * @see - * org.ofbiz.jcr.access.RepositoryAccess#getVersionList(java.lang.String) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#getVersionList(java.lang.String + * ) */ @Override public List<String> getVersionList(String nodePath) { @@ -167,7 +162,8 @@ public class JackrabbitRepositoryAccesso * (non-Javadoc) * * @see - * org.ofbiz.jcr.access.RepositoryAccess#getBaseVersion(java.lang.String) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#getBaseVersion(java.lang.String + * ) */ @Override public String getBaseVersion(String nodePath) { @@ -179,7 +175,8 @@ public class JackrabbitRepositoryAccesso * (non-Javadoc) * * @see - * org.ofbiz.jcr.access.RepositoryAccess#getRootVersion(java.lang.String) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#getRootVersion(java.lang.String + * ) */ @Override public String getRootVersion(String nodePath) { @@ -190,7 +187,7 @@ public class JackrabbitRepositoryAccesso /* * (non-Javadoc) * - * @see org.ofbiz.jcr.orm.RepositoryAccess#getJsonFileTree() + * @see org.ofbiz.jcr.access.JcrRepositoryAccessor#getJsonDataTree() */ @Override public JSONArray getJsonDataTree() throws RepositoryException { @@ -201,7 +198,7 @@ public class JackrabbitRepositoryAccesso /* * (non-Javadoc) * - * @see org.ofbiz.jcr.access.RepositoryAccess#getJsonFileTree() + * @see org.ofbiz.jcr.access.JcrRepositoryAccessor#getJsonFileTree() */ @Override public JSONArray getJsonFileTree() throws RepositoryException { @@ -213,8 +210,8 @@ public class JackrabbitRepositoryAccesso * (non-Javadoc) * * @see - * org.ofbiz.jcr.access.RepositoryAccess#queryForRepositoryData(java.lang - * .String) + * org.ofbiz.jcr.access.JcrRepositoryAccessor#queryForRepositoryData(java + * .lang.String) */ @Override public QueryResult queryForRepositoryData(String query) throws RepositoryException { @@ -238,4 +235,13 @@ public class JackrabbitRepositoryAccesso return false; } } + + /** + * Returns the party ID which created the accessor. + * + * @return + */ + private String getPartyId() { + return this.userLogin.getString("partyId"); + } } Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrDataHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrDataHelper.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrDataHelper.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrDataHelper.java Tue Apr 24 13:50:33 2012 @@ -8,7 +8,7 @@ import javax.jcr.PathNotFoundException; import javax.jcr.RepositoryException; import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitArticle; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitArticle; public interface JcrDataHelper extends JcrHelper{ @@ -70,6 +70,7 @@ public interface JcrDataHelper extends J * Update an existing content article object in the repository. * * @param updatedArticle + * @param partyThatChangedThisContent * @throws RepositoryException * @throws ObjectContentManagerException */ Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/JcrFileHelper.java Tue Apr 24 13:50:33 2012 @@ -6,7 +6,7 @@ import javax.jcr.PathNotFoundException; import javax.jcr.RepositoryException; import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitHierarchyNode; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitHierarchyNode; public interface JcrFileHelper extends JcrHelper{ Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitArticleHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitArticleHelper.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitArticleHelper.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitArticleHelper.java Tue Apr 24 13:50:33 2012 @@ -21,7 +21,7 @@ import org.ofbiz.jcr.access.jackrabbit.C import org.ofbiz.jcr.access.jackrabbit.JackrabbitRepositoryAccessor; import org.ofbiz.jcr.api.JcrDataHelper; import org.ofbiz.jcr.orm.OfbizRepositoryMapping; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitArticle; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitArticle; import org.ofbiz.jcr.util.jackrabbit.JackrabbitUtils; /** Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/api/jackrabbit/JackrabbitFileHelper.java Tue Apr 24 13:50:33 2012 @@ -18,10 +18,10 @@ import org.ofbiz.jcr.access.jackrabbit.C import org.ofbiz.jcr.access.jackrabbit.JackrabbitRepositoryAccessor; import org.ofbiz.jcr.api.JcrFileHelper; import org.ofbiz.jcr.orm.OfbizRepositoryMapping; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitFile; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitFolder; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitHierarchyNode; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitResource; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitFile; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitFolder; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitHierarchyNode; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitResource; import org.ofbiz.jcr.util.jackrabbit.JackrabbitUtils; /** Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/loader/jackrabbit/JCRFactoryImpl.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/loader/jackrabbit/JCRFactoryImpl.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/loader/jackrabbit/JCRFactoryImpl.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/loader/jackrabbit/JCRFactoryImpl.java Tue Apr 24 13:50:33 2012 @@ -48,14 +48,14 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.jcr.loader.JCRFactory; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitArticle; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitFile; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitFolder; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitHierarchyNode; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitLocalizedContent; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitNews; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitResource; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitUnstructured; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitArticle; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitFile; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitFolder; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitHierarchyNode; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitLocalizedContent; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitNews; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitResource; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitUnstructured; import org.w3c.dom.Element; public class JCRFactoryImpl implements JCRFactory { Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/orm/OfbizRepositoryMapping.java Tue Apr 24 13:50:33 2012 @@ -1,28 +1,59 @@ package org.ofbiz.jcr.orm; - public interface OfbizRepositoryMapping { /** * Return the Node Path. + * * @return */ String getPath(); /** * Set the Node Path. + * * @param path */ void setPath(String path); /** * Return the current Version of the content object. + * * @return */ public String getVersion(); /** * Set the node version. + * * @param version */ public void setVersion(String version); + + /** + * Set the party ID of the user which created the content + * + * @param partyId + */ + public void setPartyThatCreatedTheContent(String partyId); + + /** + * Returns the party ID of the user which created the content + * + * @return + */ + public String getPartyThatCreatedTheContent(); + + /** + * Set the party ID of the user which modifies the content last + * + * @param partyId + */ + public void setLastUpdatedParty(String partyId); + + /** + * Returns the party ID of the user which modifies the content last + * + * @return + */ + public String getLastUpdatedParty(); } \ No newline at end of file Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java Tue Apr 24 13:50:33 2012 @@ -13,7 +13,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.entity.GenericValue; import org.ofbiz.jcr.access.jackrabbit.JackrabbitRepositoryAccessor; import org.ofbiz.jcr.loader.JCRFactoryUtil; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitNews; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitNews; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.ServiceUtil; Modified: ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java (original) +++ ofbiz/trunk/framework/jcr/src/org/ofbiz/jcr/test/JackrabbitTests.java Tue Apr 24 13:50:33 2012 @@ -45,7 +45,7 @@ import org.ofbiz.jcr.api.jackrabbit.Jack import org.ofbiz.jcr.loader.JCRFactory; import org.ofbiz.jcr.loader.JCRFactoryUtil; import org.ofbiz.jcr.loader.jackrabbit.JCRFactoryImpl; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitArticle; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitArticle; import org.ofbiz.jcr.util.jackrabbit.JackrabbitUtils; import org.ofbiz.service.ServiceUtil; import org.ofbiz.service.testtools.OFBizTestCase; Modified: ofbiz/trunk/specialpurpose/example/src/org/ofbiz/example/JackrabbitEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/example/src/org/ofbiz/example/JackrabbitEvents.java?rev=1329718&r1=1329717&r2=1329718&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/example/src/org/ofbiz/example/JackrabbitEvents.java (original) +++ ofbiz/trunk/specialpurpose/example/src/org/ofbiz/example/JackrabbitEvents.java Tue Apr 24 13:50:33 2012 @@ -43,10 +43,10 @@ import org.ofbiz.jcr.api.JcrFileHelper; import org.ofbiz.jcr.api.jackrabbit.JackrabbitArticleHelper; import org.ofbiz.jcr.api.jackrabbit.JackrabbitFileHelper; import org.ofbiz.jcr.orm.OfbizRepositoryMapping; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitArticle; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitFile; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitFolder; -import org.ofbiz.jcr.orm.jackrabbit.JackrabbitHierarchyNode; +import org.ofbiz.jcr.orm.jackrabbit.data.JackrabbitArticle; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitFile; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitFolder; +import org.ofbiz.jcr.orm.jackrabbit.file.JackrabbitHierarchyNode; import org.ofbiz.jcr.util.jackrabbit.JackrabbitUtils; public class JackrabbitEvents { |
Free forum by Nabble | Edit this page |