Package org.apache.isis.core.metamodel.facets.typeof

Examples of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet


        this.id = id;
    }

    @Override
    public void write(final PrintWriter writer) {
        final TypeOfFacet facet = collection.getSpecification().getFacet(TypeOfFacet.class);
        final Class<?> elementType = facet.value();
        final ObjectSpecification elementSpecification =
            IsisContext.getSpecificationLoader().loadSpecification(elementType);

        writer.print("<div class=\"item\">");
        writer.print("<a href=\"");
View Full Code Here


        rootAdapter = mockery.mock(ObjectAdapter.class);
        // rootObject = new TestObject("Harry");
        // final ObjectAdapter nameAdapter = mockery.mock(ObjectAdapter.class, "name");
        oid = mockery.mock(Oid.class);

        final TypeOfFacet typeOfFacet = mockery.mock(TypeOfFacet.class, "element 1");

        final Iterator<?> mockIterator = mockery.mock(Iterator.class);

        // object encoding
        mockery.checking(new Expectations() {
View Full Code Here

public class CollectionMapping {
    private final Vector list = new Vector();
    private final ObjectSpecification elementSpecification;

    public CollectionMapping(final Context context, final ObjectAdapter collection) {
        final TypeOfFacet typeOfFacet = collection.getSpecification().getFacet(TypeOfFacet.class);
        elementSpecification = typeOfFacet.valueSpec();

        final CollectionFacet collectionFacet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
        final Enumeration elements = collectionFacet.elements(collection);
        while (elements.hasMoreElements()) {
            final ObjectAdapter element = (ObjectAdapter) elements.nextElement();
View Full Code Here

                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
            }
            isFieldEditable = objectField.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed();
            getPersistenceSession().resolveField(object, objectField);
            collection = objectField.get(object);
            final TypeOfFacet facet = objectField.getFacet(TypeOfFacet.class);
            elementSpec = facet.valueSpec();
            parentObjectId = objectId == null ? context.mapObject(object, Scope.REQUEST) : objectId;
        } else {
            final String id = request.getOptionalProperty(COLLECTION);
            collection = context.getMappedObjectOrResult(id);
            elementSpec = collection.getElementSpecification();
View Full Code Here

class TestCollectionType extends Test {
    @Override
    boolean test(final Request request, final String attributeName, final String targetId) {
        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
        final Class<?> cls = forClass(attributeName);
        final TypeOfFacet facet = object.getSpecification().getFacet(TypeOfFacet.class);
        final boolean hasType = object != null && (cls == null || cls.isAssignableFrom(facet.value()));
        return hasType;
    }
View Full Code Here

            }
            if (fileName.equals(GENERIC + "." + EXTENSION)) {
                final Facet facet = mappedObject.getSpecification().getFacet(CollectionFacet.class);
                if (facet != null) {
                    final ObjectSpecification specification = mappedObject.getSpecification();
                    final TypeOfFacet facet2 = specification.getFacet(TypeOfFacet.class);
                    file = findFileForSpecification(context, facet2.valueSpec(), "collection", EXTENSION);
                } else {
                    final ObjectAdapter mappedObject2 = mappedObject;
                    if (mappedObject2.isTransient()) {
                        file = findFileForSpecification(context, mappedObject.getSpecification(), "edit", EXTENSION);
                    } else {
View Full Code Here

        // we copy over the type onto the adapter itself
        // [not sure why this is really needed, surely we have enough info in
        // the adapter
        // to look this up on the fly?]
        final TypeOfFacet facet = otma.getFacet(TypeOfFacet.class);
        collectionAdapter.setElementSpecificationProvider(ElementSpecificationProviderFromTypeOfFacet.createFrom(facet));

        return collectionAdapter;
    }
View Full Code Here

    private final FacetHolder facetHolder = new FacetHolderImpl();
   
    private final Identifier identifier;

    private static ObjectSpecification typeOfSpec(final ObjectActionImpl objectAction, ObjectMemberContext objectMemberContext) {
        final TypeOfFacet actionTypeOfFacet = objectAction.getFacet(TypeOfFacet.class);
        return objectMemberContext.getSpecificationLookup().loadSpecification(actionTypeOfFacet.value());
    }
View Full Code Here

        FacetUtil.copyFacets(serviceAction.getFacetedMethod(), facetHolder);
       
        final RenderFacet renderFacet = new RenderFacetAbstract(Render.Type.EAGERLY, this) {};
        final NotPersistedFacet notPersistedFacet = new NotPersistedFacetAbstract(this) {};
        final DisabledFacet disabledFacet = disabledFacet();
        final TypeOfFacet typeOfFacet = new TypeOfFacetAbstract(getSpecification().getCorrespondingClass(), this, objectMemberContext.getSpecificationLookup()) {};
       
        FacetUtil.addFacet(renderFacet);
        FacetUtil.addFacet(notPersistedFacet);
        FacetUtil.addFacet(disabledFacet);
        FacetUtil.addFacet(typeOfFacet);
View Full Code Here

        Assert.assertNull(facet);
    }

    @Test
    public void testTypeOfFacet() throws Exception {
        final TypeOfFacet facet = specification.getFacet(TypeOfFacet.class);
        Assert.assertNull(facet);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet

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.