Package org.chromattic.api

Examples of org.chromattic.api.ChromatticSession


      return a;
   }

   private <A> void removeMixin(Class<A> type)
   {
      ChromatticSession session = model.getSession();
      session.setEmbedded(this, type, null);
   }
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

            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

      this.mopManager = mopManager;
   }

   public ContentRegistry getContentRegistry()
   {
      ChromatticSession session = lifeCycle.getChromattic().openSession();
      ContentRegistry registry = session.findByPath(ContentRegistry.class, "app:applications");
      if (registry == null)
      {
         registry = session.insert(ContentRegistry.class, "app:applications");
      }
      return registry;
   }
View Full Code Here

   }

   public GadgetRegistry getRegistry()
   {
      Chromattic chromattic = chromatticLifeCycle.getChromattic();
      ChromatticSession session = chromattic.openSession();
      GadgetRegistry registry = session.findByPath(GadgetRegistry.class, "app:gadgets");
      if (registry == null)
      {
         registry = session.insert(GadgetRegistry.class, "app:gadgets");
      }
      return registry;
   }
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

        /** . */
        private SessionContext context;

        protected final GadgetTokenContainer getGadgetTokenContainer() {
            ChromatticSession session = context.getSession();
            GadgetTokenContainer container = session.findByPath(GadgetTokenContainer.class, "gadgettokens");
            if (container == null) {
                container = session.insert(GadgetTokenContainer.class, "gadgettokens");
            }
            return container;
        }
View Full Code Here

            //
            if (!sourceNav.isAdapted(RestrictAccess.class)) {
                // if RestrictAccess is not on the node yet, then it has a legacy Visible
                // so, we remove the Visible and replace with a RestrictAccess
                ChromatticSession chromatticSession = session.getManager().getLifeCycle().getContext().getSession();
                if (sourceNav.isAdapted(Visible.class)) {
                    chromatticSession.remove(sourceNav.adapt(Visible.class));
                }
                RestrictAccess restrictAccess = chromatticSession.create(RestrictAccess.class);
                chromatticSession.setEmbedded(sourceNav, RestrictAccess.class, restrictAccess);
            }

            //
            RestrictAccess restrictAccess = sourceNav.adapt(RestrictAccess.class);
            restrictAccess.setVisibility(state.getVisibility());
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.