public GenXWorkResultModel()

in ti/phase2/jars/core/src/java/org/apache/ti/compiler/internal/genmodel/GenXWorkResultModel.java [38:131]


    public GenXWorkResultModel(GenXWorkModuleConfigModel parent, AnnotationInstance annotation, ClassDeclaration jclass,
                               String commentSuffix) {
        super(parent);

        setName(CompilerUtils.getString(annotation, NAME_ATTR, true));
        setRedirect(CompilerUtils.getBoolean(annotation, REDIRECT_ATTR, false).booleanValue());
        if (CompilerUtils.getBoolean(annotation, EXTERNAL_REDIRECT_ATTR, false).booleanValue()) {
            setExternalRedirect(true);
        }

        //
        // outputFormBean/outputFormBeanType
        //
        DeclaredType outputFormType = CompilerUtils.getDeclaredType(annotation, OUTPUT_FORM_BEAN_TYPE_ATTR, true);
        String outputFormMember = CompilerUtils.getString(annotation, OUTPUT_FORM_BEAN_ATTR, true);
        if (outputFormMember != null) {
            FieldDeclaration field = CompilerUtils.getClassField(jclass, outputFormMember, null);
            assert outputFormType == null;  // checker should catch this
            assert field != null;           // checker should catch this
            assert field.getType() instanceof DeclaredType : field.getType().getClass().getName(); // checker enforces
            outputFormType = (DeclaredType) field.getType();
        }
        setOutputFormBeanMember(outputFormMember);
        setOutputFormBeanType(outputFormType != null ? CompilerUtils.getLoadableName(outputFormType) : null);

        //
        // path, tilesDefinition, navigateTo, returnAction (mutually exclusive)
        //
        String returnAction = CompilerUtils.getString(annotation, RETURN_ACTION_ATTR, true);
        String navigateTo = CompilerUtils.getEnumFieldName(annotation, NAVIGATE_TO_ATTR, true);
        String tilesDefinition = CompilerUtils.getString(annotation, TILES_DEFINITION_ATTR, true);
        String path = CompilerUtils.getString(annotation, PATH_ATTR, true);
        String action = CompilerUtils.getString(annotation, ACTION_ATTR, true);

        if (action != null) {
            assert path == null;  // checker should enforce this
            path = action + ACTION_EXTENSION_DOT;
        }

        if (returnAction != null) {
            assert navigateTo == null;
            assert tilesDefinition == null;
            assert path == null;
            setReturnAction(returnAction);
        } else if (navigateTo != null) {
            assert tilesDefinition == null;
            assert path == null;

            if (navigateTo.equals(NAVIGATE_TO_CURRENT_PAGE_STR)) {
                setReturnToPage(0);
            } else if (navigateTo.equals(NAVIGATE_TO_PREVIOUS_PAGE_STR)) {
                setReturnToPage(1);
            } else if (navigateTo.equals(NAVIGATE_TO_PREVIOUS_ACTION_STR)) {
                setReturnToAction();
            } else {
                assert false : "unknown value for navigateTo: \"" + navigateTo + '"';
            }

            boolean restore = CompilerUtils.getBoolean(annotation, RESTORE_QUERY_STRING_ATTR, false).booleanValue();
            setRestoreQueryString(restore);
        } else if (tilesDefinition != null) {
            assert path == null;
            setPath(tilesDefinition);    // set the tilesDefinition as the path -- the runtime expects it there
        } else {
            assert path != null;      // checker should enforce this

            //
            // Translate our relative-path convention (normal) to the Struts convention, which adds a '/'
            // to any module-relative path.
            //
            if (! path.startsWith("/")) {
                //
                // If this annotation came from a base class, and if inheritLocalPaths is true on the Controller
                // annotation, then make the path relative to the base class module.
                //
                TypeDeclaration containingType = annotation.getContainingType();
                if (! CompilerUtils.typesAreEqual(jclass, containingType)
                        && parent.getFlowControllerInfo().getMergedControllerAnnotation().isInheritLocalPaths()) {
                    // TODO: when we no longer support Struts 1.1, we can simply use the 'module' property
                    // to make this forward relative to the base class module.
                    path = CompilerUtils.getPathRelativeToPackage(path, containingType.getPackage());
                    setInheritedPath(true);
                }
            }

            setPath(path);
        }

        addActionOutputs(annotation, jclass);

        if (commentSuffix != null) {
            setComment("forward \"" + getName() + '"' + commentSuffix);  // @TODO I18N the comment
        }
    }