Package org.chromattic.api

Examples of org.chromattic.api.ChromatticSession


      {
         return true;
      }
      try
      {
         ChromatticSession session = getSession();
         Session jcrSession = session.getJCRSession();
         modified = jcrSession.hasPendingChanges();
      }
      catch (RepositoryException e)
      {
         throw new UndeclaredRepositoryException(e);
View Full Code Here


            statement = "jcr:path LIKE ''";
         }
      }

      // Temporary work around, to fix in MOP and then remove
      ChromatticSession session = context.getSession();
      Class<O> mappedClass = (Class<O>)mapping.get(type);
      return session.createQueryBuilder(mappedClass).where(statement).get().objects((long)offset, (long)limit);
   }
View Full Code Here

   public <A> A adapt(ModelData modelData, Class<A> type, boolean create)
   {
      try
      {
         POMSession pomSession = pomMgr.getSession();
         ChromatticSession chromSession = pomSession.getSession();
        
         //TODO: Deal with the case where modelData is not persisted before invocation to adapt
         // Get the workspace object
         Object o = pomSession.findObjectById(modelData.getStorageId());
        
         A a = chromSession.getEmbedded(o, type);
         if(a == null && create)
         {
            a = chromSession.create(type);
            chromSession.setEmbedded(o, type, a);
         }
        
         return a;
      }
      catch (Exception ex)
View Full Code Here

        /* clean the legacy tokens */
        new TokenTask<Void>() {
            @Override
            protected Void execute(SessionContext context) {
                SessionContext ctx = chromatticLifeCycle.getContext();
                ChromatticSession session = ctx.getSession();
                TokenContainer container = session.findByPath(TokenContainer.class, lifecycleName);
                if (container != null) {
                    /* if the container does not exist, it makes no sense to clean the legacy tokens */
                    container.cleanLegacyTokens();
                }
                return null;
View Full Code Here

     */
    private abstract class TokenTask<V> extends ContextualTask<V> {

        protected final TokenContainer getTokenContainer() {
            SessionContext ctx = chromatticLifeCycle.getContext();
            ChromatticSession session = ctx.getSession();
            TokenContainer container = session.findByPath(TokenContainer.class, lifecycleName);
            if (container == null) {
                container = session.insert(TokenContainer.class, lifecycleName);
            }
            return container;
        }
View Full Code Here

            return container;
        }

        protected final <A> A getMixin(Object o, Class<A> type) {
            SessionContext ctx = chromatticLifeCycle.getContext();
            ChromatticSession session = ctx.getSession();
            return session.getEmbedded(o, type);
        }
View Full Code Here

            return session.getEmbedded(o, type);
        }

        protected final QueryResult<TokenEntry> findTokensOfUser(String user) {
            SessionContext ctx = chromatticLifeCycle.getContext();
            ChromatticSession session = ctx.getSession();
            TokenContainer tokenContainer = getTokenContainer();

            String statement = new StringBuilder(128).append("jcr:path LIKE '").append(session.getPath(tokenContainer))
                    .append("/%'").append(" AND username='").append(Utils.queryEscape(user)).append("'").toString();
            return session.createQueryBuilder(TokenEntry.class).where(statement).get().objects();
        }
View Full Code Here

    public void start() {
        /* clean the legacy tokens */
        new TokenTask<Void>() {
            @Override
            protected Void execute(SessionContext context) {
                ChromatticSession session = context.getSession();
                TokenContainer container = session.findByPath(TokenContainer.class, lifecycleName);
                if (container != null) {
                    /* if the container does not exist, it makes no sense to clean the legacy tokens */
                    container.cleanLegacyTokens();
                } else {
                    session.insert(TokenContainer.class, lifecycleName);
                }
                return null;
            }

        }.executeWith(chromatticLifeCycle);
View Full Code Here

     */
    private abstract class TokenTask<V> extends ContextualTask<V> {

        protected final TokenContainer getTokenContainer() {
            SessionContext ctx = chromatticLifeCycle.getContext();
            ChromatticSession session = ctx.getSession();
            return session.findByPath(TokenContainer.class, lifecycleName);
        }
View Full Code Here

            return session.findByPath(TokenContainer.class, lifecycleName);
        }

        protected final <A> A getMixin(Object o, Class<A> type) {
            SessionContext ctx = chromatticLifeCycle.getContext();
            ChromatticSession session = ctx.getSession();
            return session.getEmbedded(o, type);
        }
View Full Code Here

TOP

Related Classes of org.chromattic.api.ChromatticSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.