Package com.tll.server.rpc.entity

Examples of com.tll.server.rpc.entity.PersistContext


      @Inject
      IExceptionHandler exceptionHandler;

      @Override
      public PersistContext get() {
        return new PersistContext(refData, mailManager, schemaInfo, marshaler, marshalOptionsResolver,
            entityTypeResolver, entityAssembler, entityServiceFactory, exceptionHandler);
      }
    }).in(Scopes.SINGLETON);

    // PersistServiceDelegate
View Full Code Here


  public void test() throws Exception {
    final ServletContext context = getMockServletContext();
    final ServletContextEvent event = new ServletContextEvent(context);
    final Bootstrapper bootstraper = new Bootstrapper();
    bootstraper.contextInitialized(event);
    final PersistContext mec = (PersistContext) context.getAttribute(PersistContext.KEY);
    final SecurityContext sc = (SecurityContext) context.getAttribute(SecurityContext.KEY);
    final AppContext ac = (AppContext) context.getAttribute(AppContext.KEY);
    Assert.assertNotNull(ac);
    Assert.assertNotNull(mec);
    if(employSecurity) Assert.assertNotNull(sc);
View Full Code Here

        final ServletContext sc = session.getServletContext();
        final AppContext appContext = (AppContext) sc.getAttribute(AppContext.KEY);
        if(appContext == null) {
          throw new ServletException("Unable to obtain the app context");
        }
        final PersistContext pc = (PersistContext) sc.getAttribute(PersistContext.KEY);
        if(pc == null) {
          throw new ServletException("Unable to obtain the persist context");
        }
        final IUserService userService = pc.getEntityServiceFactory().instance(IUserService.class);
        final User user = (User) userService.loadUserByUsername(appContext.getDfltUserEmail());
        log.debug("Creating mock admin context from default user email specified in config..");
        final AdminContext ac = new AdminContext();
        ac.setUser(user);
        session.setAttribute(AdminContext.KEY, ac);
View Full Code Here

  private static final long serialVersionUID = 7908647379731614097L;

  @Override
  public AdminContextPayload getAdminContext() {
    final RequestContext rc = getRequestContext();
    final PersistContext mec = (PersistContext) rc.getServletContext().getAttribute(PersistContext.KEY);
    final AppContext ac = (AppContext) rc.getServletContext().getAttribute(AppContext.KEY);

    final Status status = new Status();

    final com.tll.server.AdminContext sac =
      (com.tll.server.AdminContext) rc.getSession().getAttribute(
          com.tll.server.AdminContext.KEY);
    if(sac == null) {
      // presume not logged in yet
      status.addMsg("Admin Context not found.", MsgLevel.INFO, MsgAttr.STATUS.flag);
      return new AdminContextPayload(status, ac.isDebug(), ac.getEnvironment(), null, null);
    }

    final Marshaler entityMarshaller = mec.getMarshaler();
    assert entityMarshaller != null : "No marshaler present";

    final Model user = entityMarshaller.marshalEntity(sac.getUser(), new MarshalOptions(true, 1, null));
    // NOTE: we want a distinct copy of the account here so we separately
    // marshall the account as opposed to grabbing the nested account from the
View Full Code Here

  @Override
  public AdminContextPayload changeCurrentAccount(ModelKey accountRef) {
    final RequestContext rc = getRequestContext();
    final PersistServiceDelegate delegate = (PersistServiceDelegate) rc.getServletContext().getAttribute(PersistServiceDelegate.KEY);
    final PersistContext mec = (PersistContext) rc.getServletContext().getAttribute(PersistContext.KEY);
    final com.tll.server.AdminContext sac =
      (com.tll.server.AdminContext) rc.getSession().getAttribute(com.tll.server.AdminContext.KEY);
    final Marshaler em = mec.getMarshaler();
    assert delegate != null && em != null && sac != null;

    final ModelPayload ep = delegate.load(new LoadRequest<PrimaryKeySearch>(new PrimaryKeySearch(accountRef)));
    final Status status = ep.getStatus();
View Full Code Here

TOP

Related Classes of com.tll.server.rpc.entity.PersistContext

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.