Package org.boco.seamwebappgen.exception

Examples of org.boco.seamwebappgen.exception.ShowAttributeWrongOrderException


        {
          if (tmp.size() <= order(fields[j]))
            tmp.setSize(order(fields[j]) + 1);

          if (tmp.get(order(fields[j])) != null)
            throw new ShowAttributeWrongOrderException(fields[j].getName(), beanName);

          tmp.set(order(fields[j]), showAttr);
        }
        else
          tmp.add(showAttr);
      }
    }

    // Inserisce i campi di tipo @Transient
    // escludendo getSerialVersionUID

    Method methods[] = cBean.getDeclaredMethods();

    /** Ordinamento degli attributi per nome **/

    java.util.Arrays.sort(methods, new JavaMethodComparator());

    for (int i = 0; i < methods.length; i++)
    {
      if (methods[i].getName().startsWith("get") && !methods[i].getName().equals("getSerialVersionUID") && methods[i].getAnnotation(javax.persistence.Transient.class) != null && methods[i].getAnnotation(ShowTransientAttributeInList.class) != null)
      {
        Attribute attr = new Attribute();

        //attr.setName(methods[i].getName());

        attr.setName(Utils.makeMethod2Field(methods[i].getName()));

        attr.setType(methods[i].getReturnType().getName());
        attr.setKey(false);
        attr.setTrans(true);

        ShowAttribute showAttr = new ShowAttribute(null, attr);

        ShowTransientAttributeInList annotation = methods[i].getAnnotation(ShowTransientAttributeInList.class);

        showAttr.setTransientParameters(annotation.parameters());
        showAttr.setWidth(annotation.width());

        if (annotation.order() != 1000)
        {
          if (tmp.size() <= annotation.order())
            tmp.setSize(annotation.order() + 1);

          //          if (tmp.get(order(methods[i])) != null)
          //            throw new ShowAttributeWrongOrderException(methods[i].getName(), beanName);

          tmp.set(annotation.order(), showAttr);
        }
        else
          tmp.add(showAttr);

        //        if (order(methods[i]) != 1000)
        //        {
        //          if (tmp.size() <= order(methods[i]))
        //            tmp.setSize(order(methods[i]) + 1);
        //
        //          if (tmp.get(order(methods[i])) != null)
        //            throw new ShowAttributeWrongOrderException(methods[i].getName(), beanName);
        //
        //          tmp.set(order(methods[i]), showAttr);
        //        }
        //        else
        //          tmp.add(showAttr);
      }
    }

    // Attributi delle relazioni collegate al bean

    for (int j = 0; j < methods.length; j++)
    {
      Annotation annotations[] = methods[j].getAnnotations();

      // System.out.println("Metodo "+methods[j].getName());

      for (int k = 0; k < annotations.length; k++)
      {
        Annotation annotation = annotations[k];

        if (annotation.annotationType().equals(ShowRelationshipAttributesInList.class))
        {
          String attributesName[] = ((ShowRelationshipAttributesInList) annotation).names();
          int    attributesOrder[] = ((ShowRelationshipAttributesInList) annotation).orders();
          String widths[] = ((ShowRelationshipAttributesInList) annotation).widths();
         
          String relationshipName = methods[j].getName();
          Relationship relationship = null;

          for (int i = 0; i < relationships.size(); i++)
          {
            if (relationships.get(i).getName().equals(relationshipName))
              relationship = relationships.get(i);
          }

          for (int i = 0; i < attributesName.length; i++)
          {
            /**
             * Verifica se l'attributo e' nella forma
             *
             * [relationship.]*Attribute
             *
             */
            ShowAttribute showAttr = null;

            if (attributesName[i].contains("."))
            {
              Vector<String> relations = Utils.splitRelationships(attributesName[i]);

              showAttr = new ShowAttribute(relations.get(relations.size() - 1));

              for (int m = 0; m < relations.size() - 1; m++)
              {
                Relationship rel = getRelationship(relations.get(m));
                showAttr.addRelationship(rel);
              }
              showAttr.setRelationship(relationship);
            }
            else
            {
              showAttr = new ShowAttribute(attributesName[i]);
              showAttr.setRelationship(relationship);
            }

            // Viene individuato il tipo dell'attributo

            Relationship lastRelationship = showAttr.getRelationships().get(showAttr.getRelationships().size() - 1);
            if (lastRelationship != null)
              showAttr.setType(getBeanAttribute(lastRelationship.getToBeanName(), showAttr.getName()).getType());

            if (tmp.size() <= attributesOrder[i])
              tmp.setSize(attributesOrder[i] + 1);

            if (tmp.get(attributesOrder[i]) != null)
              throw new ShowAttributeWrongOrderException(attributesName[i], beanName, relationshipName, tmp.get(attributesOrder[i]).getQualifiedName());

            /** QUI **/

            Relationship lastRel = showAttr.getRelationship();

View Full Code Here


            if (tmp.size() <= attributesOrder[i])
              tmp.setSize(attributesOrder[i] + 1);

            if (tmp.get(attributesOrder[i]) != null)
              throw new ShowAttributeWrongOrderException(attributesName[i], beanName, relationshipName, tmp.get(attributesOrder[i]).getQualifiedName());

            showAttr.setOnCreateIf(((ShowRelationshipAttributesInForm) annotation).showOnCreateIf());
            showAttr.setOnDeleteIf(((ShowRelationshipAttributesInForm) annotation).showOnDeleteIf());
            showAttr.setOnDisplayIf(((ShowRelationshipAttributesInForm) annotation).showOnDisplayIf());
            showAttr.setOnEditIf(((ShowRelationshipAttributesInForm) annotation).showOnEditIf());
View Full Code Here

TOP

Related Classes of org.boco.seamwebappgen.exception.ShowAttributeWrongOrderException

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.