本文整理汇总了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();
}
示例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;
}
示例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();
}
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例11: getIsisSessionFactory
import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
IsisSessionFactory getIsisSessionFactory() {
return IsisContext.getSessionFactory();
}
示例12: closeSession
import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
public static void closeSession() {
if (IsisContext.inSession()) {
IsisContext.getTransactionManager().endTransaction();
IsisContext.closeSession();
}
}
示例13: discardWebApp
import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
public void discardWebApp() {
getWebServer().stop();
WEBSERVER.set(null);
IsisContext.testReset();
}
示例14: getSessionFactory
import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
protected IsisSessionFactory getSessionFactory() {
return IsisContext.getSessionFactory();
}
示例15: getSpecificationLoader
import org.apache.isis.core.runtime.system.context.IsisContext; //导入依赖的package包/类
protected SpecificationLoader getSpecificationLoader() {
return IsisContext.getSpecificationLoader();
}