Package org.glassfish.ejb.deployment.descriptor

Examples of org.glassfish.ejb.deployment.descriptor.RelationRoleDescriptor


      if (cmrIterator.hasNext()) {
    while (cmrIterator.hasNext()) {
        RelationshipDescriptor cmfDescriptor = (RelationshipDescriptor) cmrIterator.next();
            {
                // test if this bean is the source in this relationship
                RelationRoleDescriptor role = cmfDescriptor.getSource();
                if (role.getOwner().equals(descriptor) && role.getCMRField()!=null) {
                found = true;
                if (!runIndividualCmrTest(descriptor, role, c, result)) {
                    oneFailed = true;
                }
                }
            }
            // we need to test for both source and sink because of self references
            {
                // test if this bean is the sink in this relationship
                RelationRoleDescriptor role = cmfDescriptor.getSink();
                if (role.getOwner().equals(descriptor) && role.getCMRField()!=null) {
                found = true;
                if (!runIndividualCmrTest(descriptor, role, c, result)) {
                    oneFailed = true;
                }
                }
View Full Code Here


        //collect relationship
        Set rels = bundle.getRelationships();
        Iterator relIter = rels.iterator();
        while (relIter.hasNext()) {
            RelationshipDescriptor rel = (RelationshipDescriptor)relIter.next();
            RelationRoleDescriptor source = rel.getSource();
            RelationRoleDescriptor sink = rel.getSink();

            //collect source RelationshipDescriptor
            String sourceEjbName = source.getOwner().getName();
            ArrayList sourceRels = (ArrayList)ejbRelMap.get(sourceEjbName);
            if (sourceRels == null) {
                sourceRels = new ArrayList();
                ejbRelMap.put(sourceEjbName, sourceRels);
            }
            sourceRels.add(rel);

            //collect source cmr field
            String sourceCMRField = source.getCMRField();
            if (sourceCMRField != null) {
                addField(sourceEjbName, sourceCMRField);
            }

            //collect sink RelationshipDescriptor
            String sinkEjbName = sink.getOwner().getName();
            ArrayList sinkRels = (ArrayList)ejbRelMap.get(sinkEjbName);
            if (sinkRels == null) {
                sinkRels = new ArrayList();
                ejbRelMap.put(sinkEjbName, sinkRels);
            }
            sinkRels.add(rel);

            //collect sink cmr field
            String sinkCMRField = sink.getCMRField();
            if (sinkCMRField != null) {
                addField(sinkEjbName, sinkCMRField);
            }
        }
    }
View Full Code Here

    /**
     * getMultiplicity of the other role on the relationship
     * Please note that multiplicity is JDO style
     */
    public String getMultiplicity(String ejbName, String fieldName) {
        RelationRoleDescriptor oppRole = getRelationRoleDescriptor(ejbName,
                fieldName, false);
        return (oppRole.getIsMany()) ? MANY : ONE;
    }
View Full Code Here

                fieldName, false);
        return (oppRole.getIsMany()) ? MANY : ONE;
    }

    public String getRelationshipFieldContent(String ejbName, String fieldName) {
        RelationRoleDescriptor oppRole = getRelationRoleDescriptor(ejbName,
                fieldName, false);
        return oppRole.getOwner().getName();
    }
View Full Code Here

    /**
     * This method return the fieldName of relation role on the other end.
     */
    public String getInverseFieldName(String ejbName, String fieldName) {
        RelationRoleDescriptor oppRole = getRelationRoleDescriptor(ejbName,
                fieldName, false);
        String inverseName = oppRole.getCMRField();

        // if we are generating relationships, check for a generated inverse
        if ((generateFields) && (inverseName == null))
            inverseName = nameMapper.getGeneratedFieldForEjbField(
                ejbName, fieldName)[1];
View Full Code Here

    public String getGeneratedVersionFieldNamePrefix() {
        return nameMapper.GENERATED_VERSION_FIELD_PREFIX;
    }

    public boolean relatedObjectsAreDeleted(String beanName, String fieldName) {
        RelationRoleDescriptor oppRole = getRelationRoleDescriptor(beanName, fieldName, false);
        return oppRole.getCascadeDelete();
    }
View Full Code Here

    private RelationRoleDescriptor getRealRelationRoleDescriptor(
            String ejbName, String cmrFieldName, boolean self) {
        ArrayList rels = (ArrayList)ejbRelMap.get(ejbName);
        for (int i = 0; i < rels.size(); i++) {
            RelationshipDescriptor rel = (RelationshipDescriptor)rels.get(i);
            RelationRoleDescriptor source = rel.getSource();
            RelationRoleDescriptor sink = rel.getSink();
            if (ejbName.equals(source.getOwner().getName()) &&
                    cmrFieldName.equals(source.getCMRField())) {
                return (self) ? source : sink;
            } else if (ejbName.equals(sink.getOwner().getName()) &&
                    cmrFieldName.equals(sink.getCMRField())) {
                return (self) ? sink : source;
            }
        }
        throw new IllegalArgumentException();
    }
View Full Code Here

    // cache it in a map (same comment applies to getEjbNames and
    // getFieldsForEjb)
    while (iterator.hasNext()) {
      RelationshipDescriptor relD =
        (RelationshipDescriptor)iterator.next();
      RelationRoleDescriptor testRole = relD.getSource();
      String cmrField = null;

      if (ejbName.equals(testRole.getOwner().getName())) {
        cmrField = testRole.getCMRField();
        if (cmrField != null)
          returnList.add(cmrField);
      }

      testRole = relD.getSink();
      if (ejbName.equals(testRole.getOwner().getName())) {
        cmrField = testRole.getCMRField();
        if (cmrField != null)
          returnList.add(cmrField);
      }
    }
View Full Code Here

      iterator = generatedRels.iterator();
      while (iterator.hasNext())
      {
        RelationshipDescriptor relationship =
          (RelationshipDescriptor)iterator.next();
        RelationRoleDescriptor source = relationship.getSource();
        String sourceEjbName = source.getOwner().getName();
        String sourceCMRField = source.getCMRField();
        boolean sourceIsNull = (sourceCMRField == null);
        RelationRoleDescriptor sink = relationship.getSink();
        String sinkEjbName = sink.getOwner().getName();
        String ejbName = (sourceIsNull ? sourceEjbName : sinkEjbName);
        String otherEjbName =
          (sourceIsNull ? sinkEjbName : sourceEjbName);
        List ejbField = Arrays.asList(new String[]{otherEjbName,
          (sourceIsNull ? sink.getCMRField() : sourceCMRField)});
        PersistenceDescriptor pDescriptor = ((EjbCMPEntityDescriptor)
          bundleDescriptor.getEjbByName(ejbName)).
          getPersistenceDescriptor();
        List generatedField = null;
        String uniqueName = null;
View Full Code Here

        return super.handlesElement(element);
    }

    @Override
    public RelationRoleDescriptor getDescriptor() {
        if (descriptor==null) descriptor = new RelationRoleDescriptor();
        return descriptor;
    }
View Full Code Here

TOP

Related Classes of org.glassfish.ejb.deployment.descriptor.RelationRoleDescriptor

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.