protected SpecificationLoaderSpi getSpecificationLoader() { return IsisContext.getSpecificationLoader(); }
protected SpecificationLoaderSpi getSpecificationLoader() { return IsisContext.getSpecificationLoader(); }
protected SpecificationLoader getSpecificationLookup() { return IsisContext.getSpecificationLoader(); }
protected SpecificationLoaderSpi getSpecificationLoader() { return IsisContext.getSpecificationLoader(); }
private static ObjectAdapter getObjectAdapter(RendererContext resourceContext, String oidStrUnencoded) { RootOidDefault rootOid = RootOidDefault.deString(oidStrUnencoded, getOidMarshaller()); final ObjectSpecId specId = rootOid.getObjectSpecId(); final ObjectSpecification spec = IsisContext.getSpecificationLoader().lookupBySpecId(specId); if(spec == null) { // eg "NONEXISTENT:123" return null; } // TODO: the logic to figure out which PersistenceSession API to call should be pushed down into PersistenceSession itself. if(spec.containsFacet(ViewModelFacet.class)) { if(!rootOid.getIdentifier().startsWith(OidMarshaller.VIEWMODEL_INDICATOR)) { // TODO: this bodge to ensure that the "*" (view model indicator) is probably not required; but leaving it in until have better test coverage rootOid = RootOidDefault.create(rootOid.getObjectSpecId(), OidMarshaller.VIEWMODEL_INDICATOR + rootOid.getIdentifier()); } try { return resourceContext.getPersistenceSession().getAdapterManager().adapterFor(rootOid); } catch(final ObjectNotFoundException ex) { return null; } catch(final PojoRecreationException ex) { return null; } } else { try { ObjectAdapter objectAdapter = resourceContext.getPersistenceSession().loadObject(rootOid); return objectAdapter.isTransient() ? null : objectAdapter; } catch(final ObjectNotFoundException ex) { return null; } } }