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

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



    private ObjectData createData(final Class<?> type, final long id, final Version version) {

        final ObjectSpecification objSpec = IsisContext.getSpecificationLoader().loadSpecification(type);
        final ObjectSpecId objectSpecId = objSpec.getSpecId();
        final RootOidDefault oid = RootOidDefault.create(objectSpecId, ""+id);
        return new ObjectData(oid, version);
    }
View Full Code Here


        if (encodableFacet == null) {
            String reason = "ObjectSpec expected to have an EncodableFacet";
            throw new IllegalArgumentException(reason);
        }

        final ObjectSpecId specId = objectSpec.getSpecId();
        final JsonValueConverter jvc = converterBySpec.get(specId);
        if(jvc == null) {
            // best effort
            if (argValueRepr.isString()) {
                final String argStr = argValueRepr.asString();
View Full Code Here

        }

        public List<ObjectSpecId> getSpecIds() {
            return Lists.newArrayList(Iterables.transform(Arrays.asList(classes), new Function<Class<?>, ObjectSpecId>() {
                public ObjectSpecId apply(Class<?> cls) {
                    return new ObjectSpecId(cls.getName());
                }
            }));
        }
View Full Code Here

        ObjectSpecification removed = specByClassName.remove(typeName);
        if(removed != null) {
            if(removed.containsDoOpFacet(ObjectSpecIdFacet.class)) {
                // umm.  It turns out that anonymous inner classes (eg org.estatio.dom.WithTitleGetter$ToString$1)
                // don't have an ObjectSpecId; hence the guard.
                ObjectSpecId specId = removed.getSpecId();
                specById.remove(specId);
            }
        }
        return removed;
    }
View Full Code Here

     *
     * TODO: the responsibility for knowing if this pojo is a view model or not are split unhappily between this class and the {@link org.apache.isis.core.runtime.system.persistence.IdentifierGenerator} impl.
     */
    public final RootOid createTransientOrViewModelOid(final Object pojo) {
        final ObjectSpecification spec = getSpecificationLookup().loadSpecification(pojo.getClass());
        final ObjectSpecId objectSpecId = spec.getSpecId();
        final String transientIdentifier = identifierGenerator.createTransientIdentifierFor(objectSpecId, pojo);
        final State state = spec.containsDoOpFacet(ViewModelFacet.class)? State.VIEWMODEL:State.TRANSIENT;
        return new RootOidDefault(objectSpecId, transientIdentifier, state);
    }
View Full Code Here

     * <p>
     * This is used by {@link Aggregated} references (either referenced by properties or by
     * collections).
     */
    public AggregatedOid createAggregateOid(final Object pojo, final ObjectAdapter parentAdapter) {
        final ObjectSpecId objectSpecId = objectSpecIdFor(pojo);
        final String aggregateLocalId = identifierGenerator.createAggregateLocalId(objectSpecId, pojo, parentAdapter);
        return new AggregatedOid(objectSpecId, (TypedOid) parentAdapter.getOid(), aggregateLocalId);
    }
View Full Code Here

     * @param pojo - being persisted
     * @param transientRootOid - the oid for the pojo when transient.
     */
    public final RootOid createPersistentOrViewModelOid(Object pojo, RootOid transientRootOid) {

        final ObjectSpecId objectSpecId = objectSpecIdFor(pojo);
        final String persistentIdentifier = identifierGenerator.createPersistentIdentifierFor(objectSpecId, pojo, transientRootOid);
       
        final ObjectSpecification spec = getSpecificationLookup().lookupBySpecId(objectSpecId);
        final State state = spec != null && spec.containsFacet(ViewModelFacet.class)? State.VIEWMODEL:State.PERSISTENT;
        return new RootOidDefault(objectSpecId, persistentIdentifier, state);
View Full Code Here

        // manually recreate the adapter in order to be able to query state via the metamodel
        ObjectAdapter viewModelAdapter = adapterManager.getAdapterFor(viewModelPojo);
        if(viewModelAdapter == null) {
            final ObjectSpecification objectSpecification = specificationLoader.loadSpecification(viewModelPojo.getClass());
            final ObjectSpecId objectSpecId = objectSpecification.getSpecId();
            viewModelAdapter = adapterManager.mapRecreatedPojo(new RootOidDefault(objectSpecId, mementoStr, Oid.State.VIEWMODEL), viewModelPojo);
        }

        final ObjectSpecification spec = viewModelAdapter.getSpecification();
        final List<OneToOneAssociation> properties = spec.getProperties(Contributed.EXCLUDED);
View Full Code Here

        // then throw away that adapter (remove from the adapter map)
        boolean createdTemporaryAdapter = false;
        ObjectAdapter viewModelAdapter = adapterManager.getAdapterFor(viewModelPojo);
        if(viewModelAdapter == null) {
            final ObjectSpecification objectSpecification = specificationLoader.loadSpecification(viewModelPojo.getClass());
            final ObjectSpecId objectSpecId = objectSpecification.getSpecId();
            viewModelAdapter = adapterManager.mapRecreatedPojo(RootOidDefault.create(objectSpecId, UUID.randomUUID().toString()), viewModelPojo);

            createdTemporaryAdapter = true;
        }
View Full Code Here

    public Version getVersion() {
        return version;
    }

    public ObjectSpecification getSpecification(SpecificationLoader specificationLookup) {
        final ObjectSpecId objectSpecId = oid.getObjectSpecId();
        return specificationLookup.lookupBySpecId(objectSpecId);
    }
View Full Code Here

TOP

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

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.