Package org.apache.isis.core.metamodel.spec

Examples of org.apache.isis.core.metamodel.spec.ObjectSpecification


    // destroyObject
    // ///////////////////////////////////////////////////////////////////////////

    @Override
    public void destroyObject(final ObjectAdapter adapter) {
        ObjectSpecification spec = adapter.getSpecification();
        if (spec.isParented()) {
            return;
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("destroyObject " + adapter);
        }
View Full Code Here


        debug.appendTitle("Services");
        for (final Object servicePojo : servicesInjector.getRegisteredServices()) {
            final String id = ServiceUtil.id(servicePojo);
            final Class<? extends Object> serviceClass = servicePojo.getClass();
            final ObjectSpecification serviceSpecification = getSpecificationLoader().loadSpecification(serviceClass);
            final String serviceClassName = serviceClass.getName();
            final Oid oidForService = getOidForService(serviceSpecification);
            final String serviceId = id + (id.equals(serviceClassName) ? "" : " (" + serviceClassName + ")");
            debug.appendln(oidForService != null ? oidForService.toString() : "[NULL]", serviceId);
        }
View Full Code Here

    // ////////////////////////////////////////////////////////////////////
    // Helpers
    // ////////////////////////////////////////////////////////////////////

    protected boolean isImmutable(final ObjectAdapter adapter) {
        final ObjectSpecification noSpec = adapter.getSpecification();
        return ImmutableFacetUtils.isAlwaysImmutable(noSpec) || (ImmutableFacetUtils.isImmutableOncePersisted(noSpec) && adapter.representsPersistent());
    }
View Full Code Here

        final ObjectAdapter instances = getPersistenceSession().findInstances(persistenceQuery);
        return convertToList(instances, cls);
    }

    public static List<Object> findByTitle(final Class<?> type, final String title) {
        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(type);
        return findByTitle(spec, type, title);
    }
View Full Code Here

        final PersistenceQuery criteria = new PersistenceQueryFindByTitle(spec, title);
        return findByPersistenceQuery(criteria, cls);
    }

    public static boolean hasInstances(final Class<?> type) {
        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(type);
        return hasInstances(spec);
    }
View Full Code Here

            return lazilyLoadedAdapter;
        }
       
       
        // need to create (and possibly map) the adapter.
        final ObjectSpecification objSpec = getSpecificationLoader().loadSpecification(pojo.getClass());
       
        // we create value facets as standalone (so not added to maps)
        if (objSpec.containsFacet(ValueFacet.class)) {
            ObjectAdapter valueAdapter = createStandaloneAdapterAndSetResolveState(pojo);
            return valueAdapter;
        }
       
        return null;
View Full Code Here

        final ObjectAdapter existingOrValueAdapter = existingOrValueAdapter(pojo);
        if(existingOrValueAdapter != null) {
            return existingOrValueAdapter;
        }
       
        final ObjectSpecification objSpec = getSpecificationLoader().loadSpecification(pojo.getClass());
       
        final ObjectAdapter newAdapter;
        if(isAggregated(objSpec)) {
            final AggregatedOid aggregatedOid = getOidGenerator().createAggregateOid(pojo, parentAdapter);
            newAdapter = createAggregatedAdapter(pojo, aggregatedOid);
View Full Code Here

            getServicesInjector().injectServicesInto(pojo);
            return adapter;
        }

        // add all aggregated collections
        final ObjectSpecification objSpec = adapter.getSpecification();
        if (!adapter.isParented() || adapter.isParented() && !objSpec.isImmutable()) {
            pojoAdapterMap.add(pojo, adapter);
        }

        // order is important - add to pojo map first, then identity map
        oidAdapterMap.add(adapter.getOid(), adapter);
View Full Code Here

    private ObjectSpecificationDefault getJavaSpecificationOfOwningClass(final Method method) {
        return getJavaSpecification(method.getDeclaringClass());
    }

    private ObjectSpecificationDefault getJavaSpecification(final Class<?> cls) {
        final ObjectSpecification objectSpec = getSpecification(cls);
        if (!(objectSpec instanceof ObjectSpecificationDefault)) {
            throw new UnsupportedOperationException(
                "Only Java is supported "
                + "(specification is '" + objectSpec.getClass().getCanonicalName() + "')");
        }
        return (ObjectSpecificationDefault) objectSpec;
    }
View Full Code Here

                    final Bookmark targetBookmark = aim.getTarget();
                    final Object targetObject = bookmarkService.lookup(targetBookmark);

                    final ObjectAdapter targetAdapter = adapterFor(targetObject);
                    final ObjectSpecification specification = targetAdapter.getSpecification();

                    final ObjectAction objectAction = findAction(specification, actionId);
                    if(objectAction == null) {
                        throw new Exception("Unknown action '" + actionId + "'");
                    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.spec.ObjectSpecification

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.