Examples of ObjectAssociation


Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

    private void createObjectView(final Context context, final ObjectAdapter object, final ViewPane pane, final String id) {

        final ObjectSpecification specification = object.getSpecification();
        final List<ObjectAssociation> visibleFields = specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), object, where));
        for (int i = 0; i < visibleFields.size(); i++) {
            final ObjectAssociation field = visibleFields.get(i);

            final ComponentFactory factory = context.getComponentFactory();
            final Block fieldBlock = factory.createBlock("field", field.getDescription());
            fieldBlock.add(factory.createInlineBlock("label", field.getName(), null));
            fieldBlock.add(factory.createInlineBlock("separator", ":  ", null));

            getPersistenceSession().resolveField(object, field);

            // ordering is important here;
            // look at parseable fields before objects
            final ObjectAdapter associatedObject = field.get(object);
            Component component = null;
            if (field.getSpecification().isParseable()) {
                component = factory.createParseableField(field, associatedObject, false);
            } else if (field.isOneToOneAssociation()) {
                if (associatedObject == null) {
                    component = factory.createInlineBlock("value", "", null);
                    fieldBlock.add(component);
                } else {
                    // previously there was a called to resolveImmediately here
                    // on the
                    // associated object, but it has been removed (presumably we
                    // don't
                    // want to force eager loading).
                    final String elementId = context.mapObject(associatedObject);
                    component = factory.createObjectIcon(field, associatedObject, elementId, "value");
                }
            } else if (field.isOneToManyAssociation()) {
                component = factory.createCollectionIcon(field, associatedObject, id);
            } else {
                throw new UnknownTypeException(field);
            }
            fieldBlock.add(component);
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

            final int aliasColumn = getAliasBinding().getColumn();
            if (colNum == aliasColumn) {
                return PropertyResult.ALIAS;
            }

            ObjectAssociation association = null;
            try {
                final String memberName = StringUtils.memberIdFor(heading);
                association = spec.getAssociation(memberName);
            } catch (final Exception ex) {
                return PropertyResult.NO_SUCH_PROPERTY;
            }

            if (!association.isOneToOneAssociation()) {
                return PropertyResult.NOT_A_PROPERTY;
            }

            otoa = (OneToOneAssociation) association;
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

        final String identifier = oid.getIdentifier();
        final PreAndPostValues papv = auditEntry.getValue();
        final String preValue = papv.getPreString();
        final String postValue = papv.getPostString();
       
        final ObjectAssociation property = aap.getProperty();
        final String memberId = property.getIdentifier().toClassAndNameIdentityString();
        final String propertyId = property.getId();

        final String targetClass = CommandUtil.targetClassNameFor(adapter);
        final Bookmark target = new Bookmark(objectType, identifier);

        auditingService3.audit(getTransactionId(), targetClass, target, memberId, propertyId, preValue, postValue, user, timestamp);
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

        ObjectAdapter adapter = MethodsUtils.findObject(context, objectId);

        // REVIEW this is common used code
        final String fieldName = request.getOptionalProperty(FIELD);
        if (fieldName != null) {
            final ObjectAssociation field = adapter.getSpecification().getAssociation(fieldName);
            if (field == null) {
                throw new ScimpiException("No field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier());
            }
           
            // REVIEW: should provide this rendering context, rather than hardcoding.
            // the net effect currently is that class members annotated with
            // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
            // be hidden/disabled, but will be visible/enabled (perhaps incorrectly)
            // for any other value for Where
            final Where where = Where.ANYWHERE;
           
            if (field.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
            }
            IsisContext.getPersistenceSession().resolveField(adapter, field);
            adapter = field.get(adapter);
            if (adapter != null) {
                objectId = context.mapObject(adapter, Scope.INTERACTION);
            }
        }
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

        final List<ObjectAssociation> fields = specification.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.ALL);

        int row = 1;
        for (int i = 0; i < fields.size(); i++) {
            final ObjectAssociation field = fields.get(i);
            /*
             * if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) { continue; }
             */
            String cls;
            if (row++ % 2 == 1) {
                cls = " class=\"field " + (oddRowClass == null ? ODD_ROW_CLASS : oddRowClass) + "\"";
            } else {
                cls = " class=\"field " + (evenRowClass == null ? EVEN_ROW_CLASS : evenRowClass) + "\"";
            }
            request.appendHtml("<div " + cls + "><span class=\"label\">");
            request.appendAsHtmlEncoded(field.getName());
            request.appendHtml(":</span>");
           
            final boolean isNotParseable =
                !fields.get(i).getSpecification().containsFacet(ParseableFacet.class);
            LinkedObject linkedObject = null;
            if (isNotParseable) {
     //           linkedObject = new LinkedObject(field.isOneToManyAssociation() ? collectionLink : objectLink);
                linkedObject = new LinkedObject(objectLink);
            }
            addField(request, object, field, linkedObject, showIcons);
           
            if (field.isOneToManyAssociation()) {
                Collection collection = (Collection) field.get(object).getObject();
                if (collection.size() == 0) {
                    request.appendHtml("[empty]");
                } else {
                    // request.appendHtml(collection.size() + " elements");
                  
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

        }
        return objectAction;
    }

    protected ObjectAssociation findProperty(final String attributeName, final ObjectAdapter object) {
        final ObjectAssociation objectField = object.getSpecification().getAssociation(attributeName);
        if (objectField == null) {
            throw new ScimpiException("No such property found in " + object.getSpecification().getIdentifier().getClassName() + ": " + attributeName);
        }
        return objectField;
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

class TestFieldVisible extends Test {
    @Override
    boolean test(final Request request, final String attributeName, final String targetId) {
        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
        final ObjectAssociation objectField = findProperty(attributeName, object);
        final Consent visible = objectField.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
        return visible.isAllowed();
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

class TestFieldEditable extends Test {
    @Override
    boolean test(final Request request, final String attributeName, final String targetId) {
        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
        final ObjectAssociation objectField = findProperty(attributeName, object);
        final Consent usable = objectField.isUsable(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE);
        return usable.isAllowed();
    }
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

class TestFieldSet extends Test {
    @Override
    boolean test(final Request request, final String attributeName, final String targetId) {
        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
        final ObjectAssociation objectField = findProperty(attributeName, object);
        IsisContext.getPersistenceSession().resolveField(object, objectField);
        final ObjectAdapter fld = objectField.get(object);
        if (fld != null) {
            final Object fieldValue = fld.getObject();
            if (fieldValue instanceof Boolean) {
                return ((Boolean) fieldValue).booleanValue();
            } else if (fld.getSpecification().containsFacet(CollectionFacet.class)) {
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation

        // TODO fail properly if none found
        String fieldName = attributeName.substring(0, pos);
        String fieldValue = attributeName.substring(pos + 2);
       
        final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
        final ObjectAssociation objectField = findProperty(fieldName, object);
        IsisContext.getPersistenceSession().resolveField(object, objectField);
        final ObjectAdapter fld = objectField.get(object);
       
        // TODO test for reference or value
        final ObjectAdapter object2 = MethodsUtils.findObject(request.getContext(), fieldValue);
       
        if (fld == object2) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.