Package xjavadoc

Examples of xjavadoc.XDoc


     * @param element the element (class, method, etc.) to examine
     * @return an ArrayList of AnnotationInstances.
     */
    private static ArrayList getAnnotations( XProgramElement element )
    {
        XDoc doc = element.getDoc();
        ArrayList annotations = new ArrayList();
        List tags = doc != null ? doc.getTags() : null;
        ArrayList parentAnnotations = new ArrayList()// hierarchy of parent annotations, e.g., Action -> Forward -> ...
       
        if ( tags == null ) return annotations;
       
        for ( Iterator i = tags.iterator(); i.hasNext(); )
View Full Code Here


    }

    protected Collection getClassExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentClass().getDoc();

        if (doc.hasTag(SQL_TABLE_TAG)) {
            String sqlName = doc.getTagAttributeValue(SQL_TABLE_TAG, TABLE_NAME_ATTR);

            extensions.add(new VendorExtension(getVendorName(), "sql-name", sqlName));
        }
        return extensions;
    }
View Full Code Here

    }

    protected Collection getFieldExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentField().getDoc();

        if (doc.hasTag(SQL_RELATION_TAG)) {
            String style = doc.getTagAttributeValue(SQL_RELATION_TAG, STYLE_ATTR);

            if (STYLE_FOREIGN_KEY_VALUE.equals(style)) {
                if (doc.getTagAttributeValue("jdo.field", "collection-type") == null) {
                    Collection tags = doc.getTags(SQL_FIELD_TAG);
                    String sqlName = getSqlNames(tags.iterator());

                    extensions.add(new VendorExtension(getVendorName(), "sql-name", sqlName));
                }
                // else ignore
            }
            else if (STYLE_RELATION_TABLE_VALUE.equals(style)) {
                String tableName = doc.getTagAttributeValue(SQL_RELATION_TAG, TABLE_NAME_ATTR);

                extensions.add(new VendorExtension(getVendorName(), "sql-name", tableName));
            }
            else {
                LOG.warn(Translator.getString(XDocletModulesJdoMessages.class, XDocletModulesJdoMessages.NOT_SUPPORTED_TAG_ATTRIBUTE_VALUE,
                    new String[]{SQL_RELATION_TAG, STYLE_ATTR, style, getVendorDescription()}));
            }

        }
        else if (doc.hasTag(SQL_FIELD_TAG)) {
            // todo: check that the class is a primitive type or standard java-type
            //not sure I got the tag translations right...
            String tableName = doc.getTagAttributeValue(SQL_FIELD_TAG, TABLE_NAME_ATTR);
            String sqlName = doc.getTagAttributeValue(SQL_FIELD_TAG, COLUMN_NAME_ATTR);

            if (tableName != null &&
                !tableName.equals(doc.getTagAttributeValue(SQL_TABLE_TAG, TABLE_NAME_ATTR))) {
                LOG.warn(Translator.getString(XDocletModulesJdoMessages.class, XDocletModulesJdoMessages.NOT_SUPPORTED_MULTIPLE_TABLE_MAPPING,
                    new String[]{getVendorDescription()}));
            }
            extensions.add(new VendorExtension(getVendorName(), "sql-name", sqlName));
        }
View Full Code Here

    }

    protected Collection getCollectionExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentField().getDoc();

        if (doc.hasTag(SQL_RELATION_TAG)) {
            String style = doc.getTagAttributeValue(SQL_RELATION_TAG, STYLE_ATTR);

            if (STYLE_FOREIGN_KEY_VALUE.equals(style)) {
                String relatedField = doc.getTagAttributeValue(SQL_RELATION_TAG, RELATED_FIELD_ATTR);

                extensions.add(new VendorExtension(getVendorName(), "sql-reverse", "javaField:" + relatedField));
            }
            else if (STYLE_RELATION_TABLE_VALUE.equals(style)) {
                Collection tags = doc.getTags(SQL_FIELD_TAG);
                String sqlName = getSqlNames(tags.iterator());

                extensions.add(new VendorExtension(getVendorName(), "sql-owner-name", sqlName));

                String embeddedClassName = doc.getTagAttributeValue("jdo.field", "element-type");
                XClass embeddedClass = getXJavaDoc().getXClass(embeddedClassName);
                String relatedCollection = doc.getTagAttributeValue(SQL_RELATION_TAG, RELATED_FIELD_ATTR);
                XDoc relatedDoc = embeddedClass.getField(relatedCollection).getDoc();
                Collection targetTags = relatedDoc.getTags(SQL_FIELD_TAG);
                String targetSqlName = getSqlNames(targetTags.iterator());

                extensions.add(new VendorExtension(getVendorName(), "sql-value-name", targetSqlName));
            }
            else {
View Full Code Here

     * @todo                        column-length is likely to be standardizable
     */
    protected Collection getFieldExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentField().getDoc();

        if (doc.hasTag("tjdo.field")) {
            XTag tag = doc.getTag("tjdo.field");

            addSizeExtensions(extensions, tag, "column-", "");

            String collectionField = tag.getAttributeValue("collection-field");
            String mapField = tag.getAttributeValue("map-field");
View Full Code Here

    }

    protected Collection getCollectionExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentField().getDoc();

        if (doc.hasTag("tjdo.field")) {
            XTag tag = doc.getTag("tjdo.field");
            String ownerField = tag.getAttributeValue("owner-field");

            if (ownerField != null) {
                extensions.add(new VendorExtension(getVendorName(), "owner-field", ownerField));
            }
View Full Code Here

     * @exception XDocletException
     */
    protected Collection getMapExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentField().getDoc();

        if (doc.hasTag("tjdo.field")) {
            XTag tag = doc.getTag("tjdo.field");
            String ownerField = tag.getAttributeValue("owner-field");
            String keyField = tag.getAttributeValue("key-field");

            if (ownerField != null) {
                extensions.add(new VendorExtension(getVendorName(), "owner-field", ownerField));
View Full Code Here

     * @todo                        lock-column is likely to be standardizable
     */
    protected Collection getClassExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentClass().getDoc();

        if (doc.hasTag(SQL_TABLE_TAG)) {
            String sqlName = doc.getTagAttributeValue(SQL_TABLE_TAG, TABLE_NAME_ATTR);

            extensions.add(new VendorExtension(getVendorName(), "table", sqlName));
            if (doc.hasTag("kodo.table")) {
                XTag tag = doc.getTag("kodo.table");
                String pkColumn = tag.getAttributeValue("pk-column");
                String lockColumn = tag.getAttributeValue("lock-column");
                String classColumn = tag.getAttributeValue("class-column");

                if (pkColumn != null) {
                    extensions.add(new VendorExtension(getVendorName(), "pk-column", pkColumn));

                    String identity = doc.getTagAttributeValue("jdo.persistence-capable", "identity-type");

                    if (identity == null || "datastore".equals(identity)) {
                        LOG.warn(Translator.getString(XDocletModulesSolarmetricMessages.class,
                            XDocletModulesSolarmetricMessages.NOT_SUPPORTED_PK_COLUMN_AND_DATASTORE_IDENTITY));
                    }
View Full Code Here

     * @todo                        column-length is likely to be standardizable
     */
    protected Collection getFieldExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentField().getDoc();
        String collectionType = doc.getTagAttributeValue("jdo.field", "collection-type");

        if (doc.hasTag(SQL_RELATION_TAG)) {
            if (collectionType == null) {
                String style = doc.getTagAttributeValue(SQL_RELATION_TAG, STYLE_ATTR);

                if (STYLE_FOREIGN_KEY_VALUE.equals(style)) {
                    Collection tags = doc.getTags(SQL_FIELD_TAG);

                    for (Iterator i = tags.iterator(); i.hasNext(); ) {
                        XTag tag = (XTag)i.next();
                        String columnName = tag.getAttributeValue(COLUMN_NAME_ATTR);
                        String relatedField = tag.getAttributeValue(RELATED_FIELD_ATTR);

                        extensions.add(new VendorExtension(getVendorName(), relatedField + "-data-column", columnName));
                    }
                }
                else {
                    LOG.warn(Translator.getString(XDocletModulesJdoMessages.class,
                        XDocletModulesJdoMessages.NOT_SUPPORTED_TAG_ATTRIBUTE_VALUE,
                        new String[]{SQL_RELATION_TAG, STYLE_ATTR, style, getVendorDescription()}));
                }
            }
            else if ("collection".equals(collectionType) || "array".equals(collectionType)) {
                String style = doc.getTagAttributeValue(SQL_RELATION_TAG, STYLE_ATTR);

                if (STYLE_FOREIGN_KEY_VALUE.equals(style)) {
                    String relatedField = doc.getTagAttributeValue(SQL_RELATION_TAG, RELATED_FIELD_ATTR);

                    extensions.add(new VendorExtension(getVendorName(), "inverse", relatedField));
                }
                else if (STYLE_RELATION_TABLE_VALUE.equals(style)) {
                    String embeddedClassName = doc.getTagAttributeValue("jdo.field", "element-type");
                    XClass embeddedClass = getXJavaDoc().getXClass(embeddedClassName);
                    String relatedCollection = doc.getTagAttributeValue(SQL_RELATION_TAG, RELATED_FIELD_ATTR);
                    XDoc relatedDoc = embeddedClass.getField(relatedCollection).getDoc();

                    extensions.add(new VendorExtension(getVendorName(), "inverse", relatedCollection));

                    String relationTable = doc.getTagAttributeValue(SQL_RELATION_TAG, TABLE_NAME_ATTR);

                    extensions.add(new VendorExtension(getVendorName(), "table", relationTable));

                    Collection tags = doc.getTags(SQL_FIELD_TAG);

                    for (Iterator i = tags.iterator(); i.hasNext(); ) {
                        XTag tag = (XTag)i.next();
                        String columnName = tag.getAttributeValue(COLUMN_NAME_ATTR);
                        String relatedField = tag.getAttributeValue(RELATED_FIELD_ATTR);

                        extensions.add(new VendorExtension(getVendorName(), relatedField + "-ref-column", columnName));
                    }

                    Collection targetTags = relatedDoc.getTags(SQL_FIELD_TAG);

                    for (Iterator i = targetTags.iterator(); i.hasNext(); ) {
                        XTag tag = (XTag)i.next();
                        String columnName = tag.getAttributeValue(COLUMN_NAME_ATTR);
                        String relatedField = tag.getAttributeValue(RELATED_FIELD_ATTR);

                        extensions.add(new VendorExtension(getVendorName(), relatedField + "-data-column", columnName));
                    }
                }
                else {
                    LOG.warn(Translator.getString(XDocletModulesJdoMessages.class,
                        XDocletModulesJdoMessages.NOT_SUPPORTED_TAG_ATTRIBUTE_VALUE,
                        new String[]{SQL_RELATION_TAG, STYLE_ATTR, style, getVendorDescription()}));
                }
            }
            else {
                LOG.warn(Translator.getString(XDocletModulesJdoMessages.class,
                    XDocletModulesJdoMessages.NOT_SUPPORTED_TAG_ATTRIBUTE_VALUE,
                    new String[]{"jdo.field", "collection-type", collectionType, getVendorDescription()}));
            }

        }
        else if (doc.hasTag(SQL_FIELD_TAG)) {
            String tableName = doc.getTagAttributeValue(SQL_FIELD_TAG, TABLE_NAME_ATTR);
            String columnName = doc.getTagAttributeValue(SQL_FIELD_TAG, COLUMN_NAME_ATTR);

            if ("true".equals(doc.getTagAttributeValue("jdo.field", "primary-key"))) {
                XDoc classDoc = getCurrentClass().getDoc();
                String identity = classDoc.getTagAttributeValue("jdo.persistence-capable", "identity-type");

                if (identity == null || "datastore".equals(identity)) {
                    LOG.warn(Translator.getString(XDocletModulesSolarmetricMessages.class,
                        XDocletModulesSolarmetricMessages.NOT_SUPPORTED_PK_FIELD_AND_DATASTORE_IDENTITY));
                }
View Full Code Here

    }

    protected Collection getCollectionExtensions() throws XDocletException
    {
        Collection extensions = new ArrayList();
        XDoc doc = getCurrentField().getDoc();

        return extensions;
    }
View Full Code Here

TOP

Related Classes of xjavadoc.XDoc

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.