Examples of EjbValueObjectFieldTag


Examples of org.xdoclet.plugin.ejb.qtags.EjbValueObjectFieldTag

                        // Primary key field must ALLWAYS be included ! (or then they must be checked if ....)
                        isValueObjectField = isValueObjectField ||
                            EjbUtils.hasFlag(metaFlags, EjbUtils.METADATA_METHOD_PRIMARY_KEY_FIELD);

                        if (isValueObjectField) {
                            EjbValueObjectFieldTag vTag = findMatchedTag(valueTag.getMatch(), method);
                            BeanProperty prop = javaClass.getBeanProperty(method.getPropertyName(), true);

                            if (log.isDebugEnabled()) {
                                log.debug(method.getName() + " is a value-object-field: matches or is a pk-field.");
                            }

                            // XXX: Todo, if we have a relation found by the RelationManager, then we must have
                            // it's treatment as such, or should be ignored
                            // Maybe just check if is a EjbUtils.METADATA_METHOD_RELATION_FIELD
                            Relation relation = getRelationManager().getRelationFor(method, javaClass);

                            if ((relation != null) ||
                                    ((vTag != null) && ((vTag.getAggregate() != null) || (vTag.getCompose() != null)))) {
                                // This is a value-object relation
                                // vTag must be non-null, because we need values from it
                                if ((vTag != null) && ((vTag.getAggregate() != null) ^ (vTag.getCompose() != null))) {
                                    JavaClass relationEjb = null;
                                    Type collectionType = null;

                                    if (relation != null) {
                                        if (!method.equals(relation.getLeftMethod())) {
                                            log.debug(
                                                "Current method doesn't match relations' left method. Reversing relation");
                                            relation = relation.reverse();

                                            if (log.isDebugEnabled()) {
                                                log.debug("Reversed relation is relation=" + relation);
                                            }
                                        }

                                        if (log.isDebugEnabled()) {
                                            log.debug("Using relation information. relation=" + relation);
                                            log.debug("1# Left bean=" +
                                                ((relation.getLeftBean() != null)
                                                ? relation.getLeftBean().getFullyQualifiedName() : null));
                                            log.debug("1# Rigth bean=" +
                                                ((relation.getRightBean() != null)
                                                ? relation.getRightBean().getFullyQualifiedName() : null));
                                        }

                                        String relationEjbName = relation.getRightEJBName();
                                        relationEjb = getBeanResolver().findEjbByName(relationEjbName);
                                        collectionType = relation.getLeftMethod().getReturns();
                                    } else {
                                        log.debug("We don't have relation information for this method");
                                        Type returnType = method.getReturns();
                                        Type relationType = null;

                                        if (returnType.isA(COLLECTION_TYPE) || returnType.isA(SET_TYPE)) {
                                            String members = vTag.getMembers();

                                            if (log.isDebugEnabled()) {
                                                log.debug(returnType + ": Is a Set or Collection. Using members='" +
                                                    members + "'");
                                            }

                                            if (members == null) {
                                                if (log.isWarnEnabled()) {
                                                    log.warn(EjbUtils.getMessageWithTagLocation(vTag,
                                                            "members is null. Skipping."));
                                                }

                                                continue;
                                            }

                                            relationType = new Type(members);
                                            collectionType = returnType.isA(COLLECTION_TYPE) ? COLLECTION_TYPE : SET_TYPE;
                                        } else {
                                            if (log.isDebugEnabled()) {
                                                log.debug(returnType + ": Using it to find it's match!");
                                            }

                                            relationType = returnType;
                                        }

                                        relationEjb = findBeanByInterface(getOriginalMetadata(), relationType);
                                    }

                                    if (relationEjb == null) {
                                        log.warn("Couldn't find the related Ejb! Skipping.");
                                        continue;
                                    }

                                    ValueObjectRelationMetadata vObjRelation = new ValueObjectRelationMetadata(relationEjb,
                                            collectionType, (vTag.getAggregate() != null), vTag);

                                    if (log.isDebugEnabled()) {
                                        log.debug("Relation is " + vObjRelation);
                                    }
View Full Code Here

Examples of org.xdoclet.plugin.ejb.qtags.EjbValueObjectFieldTag

        // Remote duplicate @ejb.value-object-match tags by 'match'
        // It will help warning duplicates
        Map matchValues = new HashMap();

        for (int i = 0; i < tags.length; i++) {
            EjbValueObjectFieldTag valueMethodMatchTag = (EjbValueObjectFieldTag) tags[i];
            String methodMatch = valueMethodMatchTag.getMatch();

            if (matchValues.containsKey(methodMatch)) {
                EjbValueObjectFieldTag savedTag = (EjbValueObjectFieldTag) matchValues.get(methodMatch);

                if (log.isWarnEnabled()) {
                    log.warn(EjbUtils.tagToString(valueMethodMatchTag) +
                        " is being ignored because there is already another tag for same match " +
                        EjbUtils.tagToString(savedTag));
                }
            } else {
                matchValues.put(methodMatch, valueMethodMatchTag);
            }
        }

        // Get matched @ejb.value-object-field tag
        EjbValueObjectFieldTag savedTag = (EjbValueObjectFieldTag) matchValues.get(match);

        // If there wasn't a tag for that match, search for one that matches all value objects
        if (savedTag == null) {
            savedTag = (EjbValueObjectFieldTag) matchValues.get("*");
        }
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.