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

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


        final String path = request.getOptionalProperty("file");
        String id = request.getOptionalProperty(OBJECT);
        final String fieldName = request.getOptionalProperty(FIELD);
        ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
        if (fieldName != null) {
            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
            }
            object = field.get(object);
            id = request.getContext().mapObject(object, Scope.REQUEST);
        }

        if (object != null) {
            IsisContext.getPersistenceSession().resolveImmediately(object);
View Full Code Here


    // TODO duplicated in ActionForm#initializeFields
    private void initializeFields(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState, final boolean includeUnusableFields) {
        for (final InputField formField : formFields) {
            final String fieldId = formField.getName();
            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
            final AuthenticationSession session = IsisContext.getAuthenticationSession();
            final Consent usable = field.isUsable(session, object, where);
            final ObjectAdapter[] options = field.getChoices(object);
            FieldFactory.initializeField(context, object, field, options, field.isMandatory(), formField);

            final boolean isEditable = usable.isAllowed();
            if (!isEditable) {
                formField.setDescription(usable.getReason());
            }
            formField.setEditable(isEditable);
            final boolean hiddenField = field.isVisible(session, object, where).isVetoed();
            final boolean unusable = usable.isVetoed();
            final boolean hideAsUnusable = unusable && !includeUnusableFields;
            if (hiddenField || hideAsUnusable) {
                formField.setHidden(true);
            }
View Full Code Here

    }

    private void copyFieldContent(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final boolean showIcon) {
        for (final InputField inputField : formFields) {
            final String fieldName = inputField.getName();
            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
                IsisContext.getPersistenceSession().resolveField(object, field);
                final ObjectAdapter fieldValue = field.get(object);
                if (inputField.isEditable()) {
                    final String value = getValue(context, fieldValue);
                    if (!value.equals("") || inputField.getValue() == null) {
                        inputField.setValue(value);
                    }
                } else {
                    final String entry = getValue(context, fieldValue);
                    inputField.setHtml(entry);
                    inputField.setType(InputField.HTML);

                }

                if (field.getSpecification().getFacet(ParseableFacet.class) == null) {
                    if (fieldValue != null) {
                        final String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(field.getSpecification()) + "\" alt=\"" + field.getSpecification().getShortIdentifier() + "\"/>" : "";
                        final String entry = iconSegment + fieldValue.titleString();
                        inputField.setHtml(entry);
                    } else {
                        final String entry = "<em>none specified</em>";
                        inputField.setHtml(entry);
View Full Code Here

    }

    private void setDefaults(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState, final boolean showIcon) {
        for (final InputField formField : formFields) {
            final String fieldId = formField.getName();
            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
            final ObjectAdapter defaultValue = field.getDefault(object);
            if (defaultValue == null) {
                continue;
            }

            final String title = defaultValue.titleString();
            if (field.getSpecification().containsFacet(ParseableFacet.class)) {
                formField.setValue(title);
            } else if (field.isOneToOneAssociation()) {
                final ObjectSpecification objectSpecification = field.getSpecification();
                if (defaultValue != null) {
                    final String iconSegment = showIcon ? "<img class=\"small-icon\" src=\"" + context.imagePath(objectSpecification) + "\" alt=\"" + objectSpecification.getShortIdentifier() + "\"/>" : "";
                    final String html = iconSegment + title;
                    formField.setHtml(html);
                    final String value = defaultValue == null ? null : context.mapObject(defaultValue, Scope.INTERACTION);
View Full Code Here

    }

    private void copyEntryState(final RequestContext context, final ObjectAdapter object, final InputField[] formFields, final FormState entryState) {
        for (final InputField formField : formFields) {
            final String fieldId = formField.getName();
            final ObjectAssociation field = object.getSpecification().getAssociation(fieldId);
            if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() && formField.isEditable()) {
                final FieldEditState fieldState = entryState.getField(field.getId());
                final String entry = fieldState == null ? "" : fieldState.getEntry();
                formField.setValue(entry);
                final String error = fieldState == null ? "" : fieldState.getError();
                formField.setErrorText(error);
            }
View Full Code Here

        final String fieldName = request.getRequiredProperty(FIELD);
        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
        if (object == null) {
            throw new ScimpiException("No object to get field for: " + fieldName + " - " + id);
        }
        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
        if (field == null) {
            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
        }
        final AuthenticationSession session = IsisContext.getAuthenticationSession();
        if (field.isVisible(session, object, where).isVetoed()) {
            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
        }

        String pattern = request.getOptionalProperty("decimal-format");
        Format format = null;
View Full Code Here

    @Override
    public void process(final Request request) {
        final String id = request.getOptionalProperty(OBJECT);
        final String fieldName = request.getRequiredProperty(FIELD);
        final ObjectAdapter object = request.getContext().getMappedObjectOrResult(id);
        final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
        if (field == null) {
            throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
        }
        if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isVetoed()) {
            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
        }
        String delimiter = request.getOptionalProperty("delimiter");
        if (delimiter == null) {
            delimiter = ": ";
View Full Code Here

            final String objectId = request.getOptionalProperty(OBJECT);
            final ObjectAdapter object = context.getMappedObjectOrResult(objectId);
            if (object == null) {
                throw new ScimpiException("No object for result or " + objectId);
            }
            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
            if (!objectField.isOneToManyAssociation()) {
                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
            }
            isFieldEditable = objectField.isUsable(IsisContext.getAuthenticationSession(), object, where).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;
            tableId = request.getOptionalProperty(ID, field);
        } else {
            final String id = request.getOptionalProperty(COLLECTION);
View Full Code Here

        final String field = request.getOptionalProperty(FIELD);
        final RequestContext context = request.getContext();
        if (field != null) {
            final String id = request.getRequiredProperty(OBJECT);
            final ObjectAdapter object = context.getMappedObjectOrResult(id);
            final ObjectAssociation objectField = object.getSpecification().getAssociation(field);
            if (!objectField.isOneToManyAssociation()) {
                throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
            }
            collection = objectField.get(object);
        } else {
            final String id = request.getOptionalProperty(COLLECTION);
            collection = context.getMappedObjectOrResult(id);
        }
View Full Code Here

        final boolean isIconShowing = request.isRequested(SHOW_ICON, showIconByDefault());
        String className = request.getOptionalProperty(CLASS);
        className = className == null ? "title-icon" : className;
        ObjectAdapter object = MethodsUtils.findObject(request.getContext(), id);
        if (fieldName != null) {
            final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
            if (field.isVisible(IsisContext.getAuthenticationSession(), object, Where.ANYWHERE).isVetoed()) {
                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
            }
            object = field.get(object);
        }

        if (object != null) {
            request.appendHtml("<span class=\"object\">");
            IsisContext.getPersistenceSession().resolveImmediately(object);
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.spec.feature.ObjectAssociation$Filters

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.