当前位置: 首页>>代码示例>>Java>>正文


Java IsisContext类代码示例

本文整理汇总了Java中org.apache.isis.core.runtime.system.context.IsisContext的典型用法代码示例。如果您正苦于以下问题:Java IsisContext类的具体用法?Java IsisContext怎么用?Java IsisContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IsisContext类属于org.apache.isis.core.runtime.system.context包,在下文中一共展示了IsisContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: objectActions

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
/**
 * Returns the object actions
 */
@GET
@Path("/object/{object}/{id}/actions")
@Produces("application/xml")
public Response objectActions(@PathParam("object") String object, @PathParam("id") String id) {
    Component component = null;
    AuthenticationSession session = new AnonymousSession();
    IsisContext.openSession(session);


    try {
        final ObjectAdapter instance = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(RootOidDefault.deString(id, IsisContext.getOidMarshaller()));

        component = factory.createComponent(Component.MENU);
        component = component.acceptInstance(instance);
    } catch (Exception e) {
        log.error("viewObjectInstance exception", e);
    } finally {
        IsisContext.closeSession();
    }


    return Response.status(200).entity(component).build();


}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:29,代码来源:ViewerObject.java

示例2: acceptObject

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
public Component acceptObject(ObjectAdapter object, ObjectAdapter result)  {
    final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(result);

    boolean header = false;
    for (final ObjectAdapter rowAdapter : facet.iterable(result)) {
        if(rowAdapter != null) {
            IsisContext.getPersistenceSession().resolveImmediately(rowAdapter);
            // Must fix this
            String label = rowAdapter.titleString() != null ? rowAdapter.titleString() : "";
            String id = rowAdapter.getOid().toString();
            this.addOption( id , label );
            header = true;
        }
    }


    return this;
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:19,代码来源:FormSelect.java

示例3: inject

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
public static void inject(final Object obj) {
    final boolean needsSession = !IsisContext.inSession();
    if (needsSession) {
        openSession();
    }
    IsisContext.getPersistenceSession().getServicesInjector().injectServicesInto(obj);
    if (needsSession) {
        closeSession();
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:11,代码来源:IsisInjector.java

示例4: findService

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
public static ObjectAdapter findService(String object) throws InvalidObjectException {
    final List<ObjectAdapter> serviceAdapters = IsisContext.getPersistenceSession().getServices();
    for (final ObjectAdapter serviceAdapter : serviceAdapters) {
        final Object service = serviceAdapter.getObject();
        if (ServiceUtil.id(service).equals(object.trim())) {
            final ObjectAdapter adapter = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(service);
            return adapter;
        }
    }
    throw new InvalidObjectException("Failed to find object " + object);
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:12,代码来源:Utils.java

示例5: findObject

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
public static ObjectAdapter findObject(String object) throws InvalidObjectException {
    final List<ObjectAdapter> serviceAdapters = IsisContext.getPersistenceSession().getServices();
    for (final ObjectAdapter serviceAdapter : serviceAdapters) {
        if (serviceAdapter.getSpecification().getSpecId().asString().equals(object))  {
            //final ObjectAdapter adapter = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor( serviceAdapter );
            //return adapter;
            return serviceAdapter ;
        }
    }
    throw new InvalidObjectException("Failed to find object " + object);
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:12,代码来源:Utils.java

示例6: serviceActionInvoke

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
/**
    * Action invocation
    * @param service
    * @param method
    * @return
    */
   @GET
@Path("/{service}/actions/{action}/invoke")
   @Produces("application/xml")
public Response serviceActionInvoke(@PathParam("service") String service,
                                       @PathParam("action") String method,
                                       @Context UriInfo info) {

       Component component = null;
       AuthenticationSession session = new AnonymousSession();
       IsisContext.openSession(session);

       try {
           final ObjectAdapter object = Utils.findService(service);
           final ObjectAction action = Utils.findAction(object, method);

           final int parameterCount = action.getParameterCount();
           final ObjectAdapter[] parameters = new ObjectAdapter[parameterCount];

           final ObjectAdapter result = action.execute(object, parameters);

           String dhx = info.getQueryParameters().getFirst("dhx");
           dhx = (dhx != null ? dhx : Component.GRID );
           component = factory.createComponent( dhx );

           String columns = info.getQueryParameters().getFirst("columns");
           if( columns != null ) {
               component.setParameter("columns",columns);
           }
           component.acceptObject(object,action, result);

       } catch (Exception e) {
           e.printStackTrace();
       } finally {
             IsisContext.closeSession();
       }


	return Response.status(200).entity(component).build();
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:46,代码来源:ViewerServiceDesktop.java

示例7: viewObjectInstance

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
/**
 * Obtain a view for object ID
 *
 * @param object
 * @param id
 * @return
 */
@GET
@Path("/object/{object}/{id}")
@Produces("application/xml")
public Response viewObjectInstance(@PathParam("object") String object,
                                   @PathParam("id") String id,
                                   @Context HttpServletRequest request) {
    Component component = null;

    AuthenticationSession session = new AnonymousSession();
    IsisContext.openSession(session);

    try {
        ObjectAdapter instance = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(RootOidDefault.deString(id, IsisContext.getOidMarshaller()));

        String code = loadDSL(object, "view", request);
        if (code.length() > 0) {
            ParserHelper parser = new ParserHelper();
            component = (Component) parser.parseForObjectInstance(code, instance);
        } else {

        }
    } catch (Exception e) {
        log.error("viewObjectInstance exception", e);
    } finally {
        IsisContext.closeSession();
    }


    return Response.status(200).entity(component).build();
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:38,代码来源:ViewerObject.java

示例8: viewObjectCollection

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
/**
 * Obtain a view for object ID
 *
 * @param object
 * @param id
 * @return
 */
@GET
@Path("/object/{object}/{id}/collections/{collection}")
@Produces("application/xml")
public Response viewObjectCollection(@PathParam("object") String object, @PathParam("id") String id, @PathParam("collection") String collection, @Context UriInfo info) {
    Component component = null;

    AuthenticationSession session = new AnonymousSession();
    IsisContext.openSession(session);

    try {
        String dhx = info.getQueryParameters().getFirst("dhx");
        dhx = (dhx == null ? Component.GRID : dhx);

        ObjectAdapter instance = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(RootOidDefault.deString(id, IsisContext.getOidMarshaller()));
        component = factory.createComponent(dhx);

        String columns = info.getQueryParameters().getFirst("columns");
        if (columns != null) {
            component.setParameter("columns", columns);
        }

        component = component.acceptInstance(instance, collection);
    } catch (Exception e) {
        log.error("viewObjectInstance exception", e);
    } finally {
        IsisContext.closeSession();
    }


    return Response.status(200).entity(component).build();
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:39,代码来源:ViewerObject.java

示例9: acceptInstance

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
@Override
public Component acceptInstance(ObjectAdapter instance) throws ComponentRenderException {
    String oid = Utils.computeOid( instance.getOid().enString(IsisContext.getOidMarshaller()) );
    this.id = "dhx/objects/object/" + instance.getSpecification().getFullIdentifier() + "/" + oid;
    this.text = instance.titleString();

    return this;
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:9,代码来源:ViewReference.java

示例10: acceptInstance

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
@Override
public Component acceptInstance(ObjectAdapter instance) throws ComponentRenderException {
    final List<ObjectAction> actions = instance.getSpecification().getObjectActions(Arrays.asList(ActionType.USER), ObjectActionContainer.Contributed.EXCLUDED);

    for(ObjectAction action : actions) {
        String oid = Utils.computeOid(instance.getOid().enString(IsisContext.getOidMarshaller()));
        String boundedObject = instance.getSpecification().getFullIdentifier();

        String menuId = "dhx/objects/object/" +  boundedObject  + ":" + action.getId();
        if( action.getParameterCount() == 0 ) {
            this.addItem(menuId, action.getName());
        }
    }
    return this;
}
 
开发者ID:madytyoo,项目名称:dhtmlx-isis-viewer,代码行数:16,代码来源:ContextMenu.java

示例11: getIsisSessionFactory

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
IsisSessionFactory getIsisSessionFactory() {
    return IsisContext.getSessionFactory();
}
 
开发者ID:incodehq,项目名称:ecpcrm,代码行数:4,代码来源:EcpCrmUserSettingsThemeProvider.java

示例12: closeSession

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
public static void closeSession() {
    if (IsisContext.inSession()) {
        IsisContext.getTransactionManager().endTransaction();
        IsisContext.closeSession();
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:7,代码来源:IsisInjector.java

示例13: discardWebApp

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
public void discardWebApp() {
    getWebServer().stop();
    WEBSERVER.set(null);
    IsisContext.testReset();
}
 
开发者ID:isisaddons,项目名称:isis-app-kitchensink,代码行数:6,代码来源:IsisWebServerRule.java

示例14: getSessionFactory

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
protected IsisSessionFactory getSessionFactory() {
    return IsisContext.getSessionFactory();
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:4,代码来源:IsisModuleSecurityRealm.java

示例15: getSpecificationLoader

import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
protected SpecificationLoader getSpecificationLoader() {
    return IsisContext.getSpecificationLoader();
}
 
开发者ID:IUSISProyecto,项目名称:IUSIS,代码行数:4,代码来源:CollectionOfEntitiesAsLocatablesFactory.java


注:本文中的org.apache.isis.core.runtime.system.context.IsisContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。