Package org.boco.seamwebappgen.info

Examples of org.boco.seamwebappgen.info.ShowAttribute


      // Scrive i titoli

      for (int i = 0; i < rel.getRelatedAttributes().size(); i++)
      {
        ShowAttribute attr = rel.getRelatedAttributes().get(i);

        rows += "\t\t\t<p:cell grayFill=\".7\" verticalAlignment=\"middle\"><p:paragraph>";

        rows += "<p:text value=\"#{msgs.form_" + beanName + "_" + rel.getName();

        for (int k = 0; k < attr.getRelationships().size(); k++)
        {
          rows += "_";
          rows += attr.getRelationships().get(k).getName();
        }

        rows += "_" + attr.getName();

        rows += "}\" /></p:paragraph></p:cell>\r\n";
      }

      // Scrive le righe

      if (rel.isToMany())
        rows += "\t\t\t<ui:repeat value=\"#{" + Utils.makeFirstLetterLowerCase(beanName) + "." + Utils.makeMethod2Field(rel.getName()) + "}\" var=\"" + Utils.makeMethod2SingularField(rel.getName()) + "\">\r\n";
      else
        rows += "\t\t\t<ui:repeat value=\"#{" + Utils.makeFirstLetterLowerCase(beanName) + "." + Utils.makeMethod2Field(rel.getName()) + "}\" var=\"" + Utils.makeMethod2Field(rel.getName()) + "\">\r\n";

      for (int i = 0; i < rel.getRelatedAttributes().size(); i++)
      {
        ShowAttribute attr = rel.getRelatedAttributes().get(i);

        if (attr.getRelationships().size() == 0)
        {
          if (rel.isToMany())
            rows += "\t\t\t\t<p:cell verticalAlignment=\"middle\"><p:paragraph><p:text value=\"#{" + Utils.makeMethod2SingularField(rel.getName()) + "." + attr.getName() + "}\" >";
          else
            rows += "\t\t\t\t<p:cell verticalAlignment=\"middle\"><p:paragraph><p:text value=\"#{" + Utils.makeMethod2Field(rel.getName()) + "." + attr.getName() + "}\" >";

          if (attr.getImplementationType() == AttributeImplementationType.FORMATTEDTEXTAREA)
          {
            rows += "\t\t<f:converter converterId=\"Html2PdfConverter\" />\r\n";
          }

          if (attr.getType().equals("java.util.Date"))
          {
            rows += "\r\n\t\t\t\t\t<f:convertDateTime pattern=\"#{msgs.Application_DateFormat}\" />\r\n";
          }
          if (attr.getType().equals("java.lang.Double") && !attr.isListFormatOff())
          {
            rows += "\r\n\t\t\t\t\t<f:converter converterId=\"DoubleConverter\" />\r\n\t\t\t\t";
          }
          if (attr.getType().equals("java.lang.Long") && !attr.isListFormatOff())
          {
            rows += "\r\n\t\t\t\t\t<f:converter converterId=\"LongConverter\" />\r\n\t\t\t\t";
          }
          if (attr.getType().equals("java.lang.Integer") && !attr.isListFormatOff())
          {
            rows += "\r\n\t\t\t\t\t<f:converter converterId=\"IntegerConverter\" />\r\n\t\t\t\t";
          }

          rows += "</p:text>";
          rows += "</p:paragraph></p:cell>\r\n";
        }
        else
        {
          rows += "\t\t\t\t<p:cell verticalAlignment=\"middle\" ";

          if (!rel.getShowOnDisplayIf().equals(""))
          {
            rows += "rendered=\"#{" + rel.getShowOnDisplayIf() + "}\"";
          }

          rows += ">";

          if (rel.isToMany())
            rows += "<p:paragraph><p:text value=\"#{" + Utils.makeMethod2SingularField(rel.getName()) + ".";
          else
            rows += "<p:paragraph><p:text value=\"#{" + Utils.makeMethod2Field(rel.getName()) + ".";

          for (int k = 0; k < attr.getRelationships().size(); k++)
          {
            if (k > 0)
              rows += ".";
            rows += Utils.makeMethod2Field(attr.getRelationships().get(k).getName());
          }

          rows += "." + attr.getName() + "}\" >";

          // System.out.println(attr.getName()+" --- "+attr.getType());

          if (attr.getType().equals("java.util.Date") && !attr.isListFormatOff())
          {
            rows += "\r\n\t\t\t\t\t<f:convertDateTime pattern=\"#{msgs.Application_DateFormat}\" />\r\n\t\t\t\t";
          }
          if (attr.getType().equals("java.lang.Double") && !attr.isListFormatOff())
          {
            rows += "\r\n\t\t\t\t\t<f:converter converterId=\"DoubleConverter\" />\r\n\t\t\t\t";
          }
          if (attr.getType().equals("java.lang.Long") && !attr.isListFormatOff())
          {
            rows += "\r\n\t\t\t\t\t<f:converter converterId=\"LongConverter\" />\r\n\t\t\t\t";
          }
          if (attr.getType().equals("java.lang.Integer") && !attr.isListFormatOff())
          {
            rows += "\r\n\t\t\t\t\t<f:converter converterId=\"IntegerConverter\" />\r\n\t\t\t\t";
          }

          rows += "</p:text>";
View Full Code Here


          chunk.addHtmlCode("label=\"");

          for (int k = 0; k < attr.getRelationship().getRelatedAttributes().size(); k++)
          {
            ShowAttribute relatedAttribute = attr.getRelationship().getRelatedAttributes().get(k);

            if (relatedAttribute.getRelationships().size() == 0)
            {
              if (k > 0)
                chunk.addHtmlCode(" - ");

              chunk.addHtmlCode("#{" + Utils.makeFirstLetterLowerCase(attr.getRelationship().getToBeanName()) + "." + relatedAttribute.getName() + "}");
            }
            else
            {
              /** Debbono essere gestiti gli attributi provenienti da relazioni **/
            }
 
View Full Code Here

                  codeChunk.addHtmlCode("\t<trh:cellFormat columnSpan=\"2\">\r\n");
                  codeChunk.addHtmlCode("\t\t<rich:dataTable id=\"tab_" + Utils.makeFirstLetterLowerCase(bean.getName()) + "_" + firstRelationship.getName() + "\" var=\"" + Utils.makeFirstLetterLowerCase(firstRelationship.getToBeanName()) + "\" value=\"#{" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeMethod2Field(firstRelationship.getName()) + "}\" width=\"100%\" rowBandingInterval=\"1\" verticalGridVisible=\"true\" horizontalGridVisible=\"false\" >\r\n");

                  for (int m = 0; m < firstRelationship.getRelatedAttributes().size(); m++)
                  {
                    ShowAttribute attr = firstRelationship.getRelatedAttributes().get(m);

                    codeChunk.addHtmlCode("\t\t\t<rich:column");

                    if (attr.getType().contains("Double") || attr.getType().contains("Integer") || attr.getType().contains("Long"))
                    {
                      codeChunk.addHtmlCode(" align=\"right\" ");
                    }

                    if (attr.getType().contains("String"))
                    {
                      codeChunk.addHtmlCode(" align=\"left\" ");
                    }

                    if (attr.getType().contains("Date") || attr.getType().contains("Boolean"))
                    {
                      codeChunk.addHtmlCode(" align=\"center\" ");
                    }

                    codeChunk.addHtmlCode(">\r\n");

                    codeChunk.addHtmlCode("\t\t\t\t<f:facet name=\"header\">\r\n");

                    codeChunk.addHtmlCode("\t\t\t\t\t<h:outputText value=\"#{msgs.form_" + bean.getName());

                    for (int k = 0; k < attr.getRelationships().size(); k++)
                    {
                      codeChunk.addHtmlCode("_");
                      codeChunk.addHtmlCode(attr.getRelationships().get(k).getName());
                    }

                    codeChunk.addHtmlCode("_" + attr.getName() + "");

                    codeChunk.addHtmlCode("}\" />\r\n");

                    codeChunk.addHtmlCode("\t\t\t\t</f:facet>\r\n");

                    if (attr.getRelationships().size() == 0)
                    {
                      codeChunk.addHtmlCode("\t\t\t\t<tr:outputText value=\"#{" + Utils.makeFirstLetterLowerCase(firstRelationship.getToBeanName()) + "." + attr.getName() + "}\" />\r\n");
                    }
                    else
                    {
                      codeChunk.addHtmlCode("\t\t\t\t<tr:outputText value=\"#{" + Utils.makeFirstLetterLowerCase(firstRelationship.getToBeanName()) + ".");

                      for (int k = 1; k < attr.getRelationships().size(); k++)
                      {
                        if (k > 1)
                          codeChunk.addHtmlCode(".");
                        codeChunk.addHtmlCode(Utils.makeMethod2Field(attr.getRelationships().get(k).getName()));
                      }

                      codeChunk.addHtmlCode("." + attr.getName());

                      codeChunk.addHtmlCode("}\" />\r\n");
                    }

                    codeChunk.addHtmlCode("\t\t\t</rich:column>\r\n");
View Full Code Here

    }

    // Attributi delle relazioni da visualizzare nel form del bean
    for (int i = 0; i < bean.getShowInFormAttributes().size(); i++)
    {
      ShowAttribute attribute = bean.getShowInFormAttributes().get(i);

      key = "form_" + bean.getName() + "_" + attribute.getQualifiedName().replace(".", "_");

      if (!prop.containsKey(key))
      {
        prop.put(key, key);
      }
    }

    // Attributi del bean nella lista
    for (int i = 0; i < bean.getShowAttributes().size(); i++)
    {
      ShowAttribute attr = bean.getShowAttributes().get(i);

      if (!attr.belongsToRelationship())
      {
        key = "list_" + bean.getName() + "_" + attr.getName();
        if (!prop.containsKey(key))
        {
          prop.put(key, Utils.makeFirstLetterUpperCase(attr.getName()));
        }
      }
      else
      {
        // key = "list_" + bean.getName() + "_" + attr.getRelationship().getName() + "_" + attr.getName();

        key = "list_" + bean.getName();

        for (int k = 0; k < attr.getRelationships().size(); k++)
          key += "_" + attr.getRelationships().get(k).getName();

        key += "_" + attr.getName();

        if (!prop.containsKey(key))
        {
          prop.put(key, key);
        }
      }
    }

    // Pulsante di riferimento al master nella lista detail

    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship rel = bean.getRelationships().get(i);

      if (rel.isMasterDetail())
      {
        if (!rel.isFromMany() && !rel.isToMany() && !rel.isFromMaster())
        {
          // Relazione 1:1 Master-Detail in cui il bean e' il Detail

          key = "list_" + rel.getFromBeanName() + "_" + rel.getName() + "_OnlyOne" + rel.getFromBeanName() + "Allowed";

          if (!prop.containsKey(key))
          {
            prop.put(key, "Only one " + rel.getFromBeanName()+" allowed");
          }
        }

        // Inserisce il bottone di selezione del master o del detail a seconda del verso della relazione

        if (!rel.isFromMaster())
        {
          // Questo bean e' il Detail
          key = "list_" + rel.getFromBeanName() + "_" + rel.getToBeanName();

          if (!prop.containsKey(key))
          {
            prop.put(key, rel.getToBeanName());
          }
        }
        else
        {
          // Questo bean e' il master

          Vector<ShowList> lists = infoReader.getLists(rel.getToBeanName());

          for (ShowList list : lists)
          {
            key = "list_" + rel.getFromBeanName() + "_" + list.getName();

            if (!prop.containsKey(key))
            {
              prop.put(key, list.getName());
            }
          }
        }
      }
    }

    /** Etichette per i campi della ricerca locale **/
    for (int i = 0; i < bean.getLocalSearchAttributes().size(); i++)
    {
      ShowAttribute attr = bean.getLocalSearchAttributes().get(i);

      if (attr.getRelationship() == null)
      {
        key = "localSearch_" + bean.getName() + "_" + attr.getName();
        if (!prop.containsKey(key))
        {
          prop.put(key, Utils.makeFirstLetterUpperCase(attr.getName()));
        }
      }
      else
      {
        key = "localSearch_" + bean.getName() + "_" + attr.getRelationship().getName() + "_" + attr.getName();
        if (!prop.containsKey(key))
        {
          prop.put(key, attr.getRelationship().getName() + "_" + Utils.makeFirstLetterUpperCase(attr.getName()));
        }
      }

    }

View Full Code Here

    int orderIndex = 1;
    String defaultOrdering = "";
    for (int i = 0; i < attrs.size(); i++)
    {
      ShowAttribute attr = attrs.get(i);

      if (!attr.isKey())
      {
        if (!attr.belongsToRelationship())
        {
          if (!attr.isTrans())
          {
            search += "\t\t\tcase " + orderIndex + ":\r\n";
            search += "\t\t\t\tqb.addOrderBy(\"o." + attr.getName() + " desc\");\r\n";
            search += "\t\t\t\tbreak;\r\n";
            orderIndex++;

            search += "\t\t\tcase " + orderIndex + ":\r\n";
            search += "\t\t\t\tqb.addOrderBy(\"o." + attr.getName() + " asc\");\r\n";
            search += "\t\t\t\tbreak;\r\n\r\n";
            orderIndex++;

            if (attr.getDefaultOrderingAttribute().equals("Asc"))
              defaultOrdering += "qb.addOrderBy(\"o." + attr.getName() + " asc\")";

            if (attr.getDefaultOrderingAttribute().equals("Desc"))
              defaultOrdering += "qb.addOrderBy(\"o." + attr.getName() + " desc\")";
          }
          else
          {
            orderIndex += 2;
          }
        }
        else
        {
          if (!attr.getRelationship().isToMany())
          {
            //            search += "\t\t\tcase " + orderIndex + ":\r\n";
            //            search += "\t\t\t\tqb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getName() + " desc\");\r\n";
            //            search += "\t\t\t\tbreak;\r\n";
            //            orderIndex++;
            //
            //            search += "\t\t\tcase " + orderIndex + ":\r\n";
            //            search += "\t\t\t\tqb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getName() + " asc\");\r\n";
            //            search += "\t\t\t\tbreak;\r\n\r\n";
            //            orderIndex++;
            //
            //            if (attr.getDefaultOrderingAttribute().equals("Asc"))
            //              defaultOrdering += "qb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getName() + " asc\")";
            //
            //            if (attr.getDefaultOrderingAttribute().equals("Desc"))
            //              defaultOrdering += "qb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getName() + " desc\")";

            search += "\t\t\tcase " + orderIndex + ":\r\n";
            search += "\t\t\t\tqb.addOrderBy(\"o.";

            for (int j = 0; j < attr.getRelationships().size(); j++)
            {
              search += Utils.makeMethod2Field(attr.getRelationships().get(j).getName()) + ".";
            }

            search += attr.getNameForOrdering() + " desc\");\r\n";
            search += "\t\t\t\tbreak;\r\n";
            orderIndex++;

            search += "\t\t\tcase " + orderIndex + ":\r\n";
            search += "\t\t\t\tqb.addOrderBy(\"o.";

            for (int j = 0; j < attr.getRelationships().size(); j++)
            {
              search += Utils.makeMethod2Field(attr.getRelationships().get(j).getName()) + ".";
            }

            search += attr.getNameForOrdering() + " asc\");\r\n";

            search += "\t\t\t\tbreak;\r\n\r\n";
            orderIndex++;

            if (attr.getDefaultOrderingAttribute().equals("Asc"))
              defaultOrdering += "qb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getNameForOrdering() + " asc\")";

            if (attr.getDefaultOrderingAttribute().equals("Desc"))
              defaultOrdering += "qb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getNameForOrdering() + " desc\")";
          }
        }
      }
    }

    search += "\t\t\tdefault:\r\n";
    if (defaultOrdering.equals(""))
      search += "\t\t\t\tqb.addOrderBy(\"o.id desc\");\r\n";
    else
      search += "\t\t\t\t" + defaultOrdering + ";\r\n";

    search += "\t\t}\r\n\r\n";

    /** Condizioni della ricerca **/
   
    for (int i = 0; i < bean.getSearchAttributes().size(); i++)
    {
      SearchAttribute attr = bean.getSearchAttributes().get(i);

      if (!attr.belongsToRelationship())
      {
        /** Non appartiene ad una relazione **/
        if (attr.getImplementationType().equals(AttributeImplementationType.TEXT))
        {
          if (attr.getType().equals("java.lang.String"))
          {
            search += "\t\tqb.addTextWhere(\"upper(o." + attr.getName() + ") like upper('%\"+" + Utils.makeFirstLetterLowerCase(bean.getName()) + "Search." + Utils.makeGet(attr.getName()) + "()+\"%')\", " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Search." + Utils.makeGet(attr.getName()) + "());\r\n";
          }
          else
          {
            search += "\t\tqb.addTextWhere(\"o." + attr.getName() + " = ?"+i+"\", " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Search." + Utils.makeGet(attr.getName()) + "());\r\n";           
          }
        }
      }
      else
      {
        /** Non appartiene ad una relazione **/
      }

    }

    search += "\r\n";
    search += "// YOUR CODE GOES HERE\r\n";
    search += "@YourCode";
    search += "// END OF YOUR CODE\r\n\r\n";

   
    /** Parametri Condizioni della ricerca **/
   
    for (int i = 0; i < bean.getSearchAttributes().size(); i++)
    {
      SearchAttribute attr = bean.getSearchAttributes().get(i);

      if (!attr.belongsToRelationship())
      {
        /** Non appartiene ad una relazione **/
        if (attr.getImplementationType().equals(AttributeImplementationType.TEXT))
        {
          if (attr.getType().equals("java.lang.String"))
          {
          }
          else
          {
            search += "\t\tqb.setParameter(\""+i+"\", " + Utils.makeFirstLetterLowerCase(bean.getName()) + "Search." + Utils.makeGet(attr.getName()) + "());\r\n";
          }
        }
      }
      else
      {
        /** Non appartiene ad una relazione **/
      }

    }
   
    search += "\r\n";
    search += "// YOUR CODE GOES HERE\r\n";
    search += "@YourCode";
    search += "// END OF YOUR CODE\r\n\r\n";
   
    search += "\t\tentityManager.clear();\r\n";
    search += "\r\n";
    search += "\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "SearchList = qb.getEjbQuery().getResultList();\r\n";
    search += "\r\n";

    /** Gestione dell'ordinamento dei campi transient **/

    search += "\t\tswitch (order)\r\n";
    search += "\t\t{\r\n";

    orderIndex = 1;

    for (int i = 0; i < attrs.size(); i++)
    {
      ShowAttribute attr = attrs.get(i);

      if (!attr.isKey())
      {
        if (!attr.belongsToRelationship())
        {
          // Attributo del bean

          if (attr.isTrans())
          {
            search += "\t\t\tcase " + orderIndex + ":\r\n";
            search += "\t\t\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "SearchList = SeamUtility.orderBy(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "SearchList, \"" + attr.getNameForOrdering() + "\", GenericFieldComparator.OrderType.DESC);\r\n";
            search += "\t\t\t\tbreak;\r\n";
            orderIndex++;

            search += "\t\t\tcase " + orderIndex + ":\r\n";
            search += "\t\t\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "SearchList = SeamUtility.orderBy(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "SearchList, \"" + attr.getNameForOrdering() + "\", GenericFieldComparator.OrderType.ASC);\r\n";
            search += "\t\t\t\tbreak;\r\n\r\n";
            orderIndex++;
          }
          else
          {
            orderIndex += 2;
          }
        }
        else
        {
          // Attributo di una relazione
          orderIndex += 2;
        }
      }
    }
    search += "\t\t}\r\n\r\n";

    if (bean.getSearchActions().size() > 0 || bean.getSearchImmediateActions().size() > 0)
    {
      search += "\t\tselections.clear();\r\n";
      search += "\t\tfor(" + bean.getName() + " item : " + Utils.makeFirstLetterLowerCase(bean.getName()) + "SearchList)\r\n";
      search += "\t\t{\r\n";
      search += "\t\t\tselections.put(item, true);\r\n";
      search += "\t\t}\r\n";
    }

    search += "\t}\r\n";

    orderingFunctions = "";
    orderIndex = 1;
    for (int i = 0; i < attrs.size(); i++)
    {
      ShowAttribute attr = attrs.get(i);

      if (!attr.isKey())
      {
        if (!attr.belongsToRelationship())
        {
          orderingFunctions += "\tpublic void orderBy" + (i + 1) + "A()\r\n";
          orderingFunctions += "\t{\r\n";
          orderingFunctions += "\t\torder = " + orderIndex + ";\r\n";
          orderingFunctions += "\t\tfindAll();\r\n";
          orderingFunctions += "\t}\r\n";
          orderIndex++;

          orderingFunctions += "\tpublic void orderBy" + (i + 1) + "D()\r\n";
          orderingFunctions += "\t{\r\n";
          orderingFunctions += "\t\torder = " + orderIndex + ";\r\n";
          orderingFunctions += "\t\tfindAll();\r\n";
          orderingFunctions += "\t}\r\n";
          orderIndex++;
        }
        else
        {
          if (!attr.getRelationship().isToMany())
          {
            orderingFunctions += "\tpublic void orderBy" + (i + 1) + "A()\r\n";
            orderingFunctions += "\t{\r\n";
            orderingFunctions += "\t\torder = " + orderIndex + ";\r\n";
            orderingFunctions += "\t\tfindAll();\r\n";
            orderingFunctions += "\t}\r\n";
            orderIndex++;

            orderingFunctions += "\tpublic void orderBy" + (i + 1) + "D()\r\n";
            orderingFunctions += "\t{\r\n";
            orderingFunctions += "\t\torder = " + orderIndex + ";\r\n";
            orderingFunctions += "\t\tfindAll();\r\n";
            orderingFunctions += "\t}\r\n";
            orderIndex++;
          }
        }
      }
    }

    /** Metodi per la alimentazione dei listbox * */
    /**
     * Sono interessate le relazioni :1 ed :n verso questo bean, implementate
     * come list box *
     */

    // listMethods = generateBeanManager_ListBoxFunctions(infoReader, bean, relationships2ThisBean);
    listMethods = new CodeChunk(0);

    /** Riferimenti ai bean che utilizzano questo bean come popup * */
    Vector<Relationship> relationshipToThisBean = infoReader.getAllRelationship2ThisBean(bean.getName());
    for (Relationship rel : relationshipToThisBean)
    {
      if (rel.isUsed() && !rel.isListBox())
      {
        String callingBean = "";

        if (rel.isFromMany())
        {
          callingBean += "\r\n\t@In(required = false, scope=ScopeType.CONVERSATION)\r\n";
          callingBean += "\tprivate " + rel.getFromBeanName() + "\t\t\t\t\t\t\t\t\t\t\t" + Utils.makeFirstLetterLowerCase(rel.getFromBeanName()) + " = null;\r\n";

          if (!callingBeans.contains(callingBean))
            callingBeans += callingBean;

          callingBean = "\r\n\t@In(required=false,create=true,value=\"" + Utils.makeFirstLetterLowerCase(rel.getFromBeanName()) + "Search\")\r\n";
          callingBean += "\tprivate " + rel.getFromBeanName() + "\t\t\t\t\t\t\t\t\t\t\t" + Utils.makeFirstLetterLowerCase(rel.getFromBeanName()) + "Search;\r\n";

          if (!callingBeans.contains(callingBean))
            callingBeans += callingBean;

          // Debbono essere aggiunti anche tutti i bean derivati
          Vector<String> derivedBeans = infoReader.getDerivedBeans(rel.getFromBeanName());

          ;
          for (String derivedBean : derivedBeans)
          {
            callingBean = "\r\n\t@In(required = false)\r\n";
            callingBean += "\tprivate " + derivedBean + "\t\t\t\t\t\t\t\t\t\t\t" + Utils.makeFirstLetterLowerCase(derivedBean) + "        = null;\r\n";

            if (!callingBeans.contains(callingBean))
              callingBeans += callingBean;
          }
        }
        else
        {
          callingBean += "\r\n\t@In(required = false, scope=ScopeType.CONVERSATION)\r\n";
          callingBean += "\tprivate " + rel.getFromBeanName() + "\t\t\t\t\t\t\t\t\t\t\t" + Utils.makeFirstLetterLowerCase(rel.getFromBeanName()) + "        = null;\r\n";

          if (!callingBeans.contains(callingBean))
            callingBeans += callingBean;

          callingBean = "\r\n\t@In(required=false,create=true,value=\"" + Utils.makeFirstLetterLowerCase(rel.getFromBeanName()) + "Search\")\r\n";
          callingBean += "\tprivate " + rel.getFromBeanName() + "\t\t\t\t\t\t\t\t\t\t\t" + Utils.makeFirstLetterLowerCase(rel.getFromBeanName()) + "Search;\r\n";

          if (!callingBeans.contains(callingBean))
            callingBeans += callingBean;
        }
      }
    }

    categorizedRelationshipToMaster = "";

    /** Gestione delle relazioni di cui questo bean non e' owner * */
    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship relationship = bean.getRelationships().get(i);
      Relationship inverseRelationship = infoReader.getInverseRelationship(bean, relationship);

      /** Gestione delle relazioni in cui questo bean e' owner e la relazione inversa e' implementata come POPUP
       */
      //      if ( (relationship.getMappedBy()==null || relationship.getMappedBy().equals("")) && inverseRelationship!=null && inverseRelationship.isUsed() && !inverseRelationship.isMasterDetail() && !inverseRelationship.isListBox() && !inverseRelationship.getName().contains("Upload"))
      //      {       
      //        ownedRelationshipCreate += Utils.makeFirstLetterLowerCase(bean.getName())+"."+Utils.switchGet2Set(relationship.getName())+"("+Utils.makeFirstLetterLowerCase(relationship.getToBeanName())+");\r\n";
      //      }
      /** Inizializzazione delle relazioni :1 implementate come listbox **/
      //      if ( !relationship.isToMany() && relationship.isListBox() )
      //      {
      //        // Inizializzazione delle relazioni lazy per la modifica !!!
      //        initilizeLazyRelationshipEdit += "\t\tHibernate.initialize(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "());\r\n";
      //      }
      /**
       * Inizializzazione della relazione al Master nella create e se il
       * Detail è categorizzato *
       */
      if (relationship.isMasterDetail() && !relationship.isFromMaster() && inverseRelationship.isCategorized())
      {
        categorizedRelationshipToMaster = "\tif (SeamUtility.getParameter(facesContext,\"" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "Id\")!=null)\r\n";
        categorizedRelationshipToMaster += "\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.switchGet2Set(relationship.getName()) + "(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "Manager.find(new Long(SeamUtility.getParameter(facesContext,\"" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "Id\"))));\r\n";
      }

      if (relationship.isFromMany() || relationship.isToMany())
      {
        /**
         * Gestione relazioni N:M - 1:N - N:1
         *
         */

        if (!relationship.isFromMany())
        {
          // Cancellazione
          notOwnedRelationshipDelete += "\r\n\r\n";
          notOwnedRelationshipDelete += "\t\tList<" + relationship.getToBeanName() + "> " + Utils.makeMethod2Field(relationship.getName()) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
          notOwnedRelationshipDelete += "\r\n";
          notOwnedRelationshipDelete += "\t\tfor (" + relationship.getToBeanName() + " local" + relationship.getToBeanName() + " : " + Utils.makeMethod2Field(relationship.getName()) + ")\r\n";
          notOwnedRelationshipDelete += "\t\t{\r\n";
          notOwnedRelationshipDelete += "\t\t\tlocal" + relationship.getToBeanName() + "." + Utils.makeSet(relationship.getMappedBy()) + "(null);\r\n";
          notOwnedRelationshipDelete += "\t\t\tentityManager.merge(local" + relationship.getToBeanName() + ");\r\n";
          notOwnedRelationshipDelete += "\t\t}";
        }
        else
        {
          if (relationship.getMappedBy() != null && !relationship.getMappedBy().equals(""))
          {
            notOwnedRelationshipDelete += "\r\n\r\n";
            notOwnedRelationshipDelete += "\t\tList<" + relationship.getToBeanName() + "> " + Utils.makeMethod2Field(relationship.getName()) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
            notOwnedRelationshipDelete += "\r\n";
            notOwnedRelationshipDelete += "\t\tfor (" + relationship.getToBeanName() + " local" + relationship.getToBeanName() + " : " + Utils.makeMethod2Field(relationship.getName()) + ")\r\n";
            notOwnedRelationshipDelete += "\t\t{\r\n";
            notOwnedRelationshipDelete += "\t\t\tlocal" + relationship.getToBeanName() + "." + Utils.makeRemove(relationship.getMappedBy()) + "(" + Utils.makeFirstLetterLowerCase(bean.getName()) + ");\r\n";
            notOwnedRelationshipDelete += "\t\t\tentityManager.merge(local" + relationship.getToBeanName() + ");\r\n";
            notOwnedRelationshipDelete += "\t\t}";
          }
        }

        if (relationship.isUsed() && relationship.isToMany())
        {
          if (!relationship.isFromMany())
          {
            /** Relazioni :N **/

            // Creazione
            notOwnedRelationshipCreate += "\r\n";
            notOwnedRelationshipCreate += "\t\tList<" + relationship.getToBeanName() + "> " + Utils.makeMethod2Field(relationship.getName()) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
            notOwnedRelationshipCreate += "\r\n";
            notOwnedRelationshipCreate += "\t\tif (" + Utils.makeMethod2Field(relationship.getName()) + " != null)\r\n";
            notOwnedRelationshipCreate += "\t\t{\r\n";
            notOwnedRelationshipCreate += "\t\t\tfor (" + relationship.getToBeanName() + " " + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + " : " + Utils.makeMethod2Field(relationship.getName()) + ")\r\n";
            notOwnedRelationshipCreate += "\t\t\t{\r\n";

            notOwnedRelationshipCreate += "\t\t\t\t" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "." + Utils.switchGet2Set(inverseRelationship.getName()) + "(" + Utils.makeFirstLetterLowerCase(bean.getName()) + ");\r\n";
            notOwnedRelationshipCreate += "\t\t\t\tentityManager.merge(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + ");\r\n";
            notOwnedRelationshipCreate += "\t\t\t}\r\n";
            notOwnedRelationshipCreate += "\t\t}\r\n";

            // Modifica
            notOwnedRelEditRemoveExistingItems += "\r\n";
           
            if (notOwnedRelEditRemoveExistingItems.contains("\t\tList<" + relationship.getToBeanName() + "> old" + relationship.getToBeanName() + "s"))
              notOwnedRelEditRemoveExistingItems += "\t\told" + relationship.getToBeanName() + "s";
            else
              notOwnedRelEditRemoveExistingItems += "\t\tList<" + relationship.getToBeanName() + "> old" + relationship.getToBeanName() + "s";
            //notOwnedRelEditRemoveExistingItems += " = entityManager.find(" + bean.getName() + ".class," + Utils.makeFirstLetterLowerCase(bean.getName()) + ".getId())." + relationship.getName() + "();\r\n";
            notOwnedRelEditRemoveExistingItems += " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
            notOwnedRelEditRemoveExistingItems += "\r\n";
            notOwnedRelEditRemoveExistingItems += "\t\tfor (" + relationship.getToBeanName() + " " + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + " : old" + relationship.getToBeanName() + "s)\r\n";
            notOwnedRelEditRemoveExistingItems += "\t\t{\r\n";
            notOwnedRelEditRemoveExistingItems += "\t\t\t" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "." + Utils.makeSet(relationship.getMappedBy()) + "(null);\r\n";
            notOwnedRelEditRemoveExistingItems += "\t\t\tentityManager.merge(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + ");\r\n";
            notOwnedRelEditRemoveExistingItems += "\t\t}\r\n";

            notOwnedRelationshipEdit += "\r\n";
            notOwnedRelationshipEdit += "\t\tList<" + relationship.getToBeanName() + "> " + Utils.makeMethod2Field(relationship.getName()) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
            notOwnedRelationshipEdit += "\r\n";
            notOwnedRelationshipEdit += "\t\tfor (" + relationship.getToBeanName() + " " + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + " : " + Utils.makeMethod2Field(relationship.getName()) + ")\r\n";
            notOwnedRelationshipEdit += "\t\t{\r\n";
            notOwnedRelationshipEdit += "\t\t\t" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "." + Utils.makeSet(relationship.getMappedBy()) + "(" + Utils.makeFirstLetterLowerCase(bean.getName()) + ");\r\n";
            notOwnedRelationshipEdit += "\t\t\tentityManager.merge(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + ");\r\n";
            notOwnedRelationshipEdit += "\t\t}\r\n\r\n";
           
            notOwnedRelationshipEdit += "\t\tList<" + relationship.getToBeanName() + "> list" + relationship.getName() + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "."+relationship.getName()+"();\r\n";
            notOwnedRelationshipEdit += "\t\t"+Utils.makeFirstLetterLowerCase(bean.getName())+"."+Utils.switchGet2Set(relationship.getName())+"(new ArrayList<" + relationship.getToBeanName() + ">(list" + relationship.getName() + "));\r\n";
           
           
            // // Inizializzazione delle relazioni lazy per la modifica
            // !!!
            // initilizeLazyRelationshipEdit +=
            // "\t\tHibernate.initialize(" +
            // Utils.makeFirstLetterLowerCase(bean.getName()) + "." +
            // relationship.getName() + "());\r\n";
          }
          else
          {
            /** Relazioni N:M **/

            if (!relationship.getMappedBy().equals(""))
            {
              notOwnedRelationshipCreate += "\r\n";
              notOwnedRelationshipCreate += "\t\tList<" + relationship.getToBeanName() + "> " + Utils.makeMethod2Field(relationship.getName()) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
              notOwnedRelationshipCreate += "\r\n";
              notOwnedRelationshipCreate += "\t\tif (" + Utils.makeMethod2Field(relationship.getName()) + " != null)\r\n";
              notOwnedRelationshipCreate += "\t\t{\r\n";
              notOwnedRelationshipCreate += "\t\tfor (" + relationship.getToBeanName() + " " + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + " : " + Utils.makeMethod2Field(relationship.getName()) + ")\r\n";
              notOwnedRelationshipCreate += "\t\t{\r\n";
              notOwnedRelationshipCreate += "\t\t\t" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "." + Utils.makeAdd(Utils.makeMethod2Field(inverseRelationship.getName())) + "(" + Utils.makeFirstLetterLowerCase(bean.getName()) + ");\r\n";
              notOwnedRelationshipCreate += "\t\t\tentityManager.merge(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + ");\r\n";
              notOwnedRelationshipCreate += "\t\t}\r\n";
              notOwnedRelationshipCreate += "\t\t}\r\n";

              notOwnedRelEditRemoveExistingItems += "\r\n";
              if (notOwnedRelEditRemoveExistingItems.contains("\t\tList<" + relationship.getToBeanName() + "> old" + relationship.getToBeanName() + "s"))
                notOwnedRelEditRemoveExistingItems += "\t\told" + relationship.getToBeanName() + "s";
              else
                notOwnedRelEditRemoveExistingItems += "\t\tList<" + relationship.getToBeanName() + "> old" + relationship.getToBeanName() + "s";
              //notOwnedRelEditRemoveExistingItems += " = entityManager.find(" + bean.getName() + ".class," + Utils.makeFirstLetterLowerCase(bean.getName()) + ".getId())." + relationship.getName() + "();\r\n";
              notOwnedRelEditRemoveExistingItems += " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
              notOwnedRelEditRemoveExistingItems += "\r\n";
              notOwnedRelEditRemoveExistingItems += "\t\tfor (" + relationship.getToBeanName() + " " + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + " : old" + relationship.getToBeanName() + "s)\r\n";
              notOwnedRelEditRemoveExistingItems += "\t\t{\r\n";
              notOwnedRelEditRemoveExistingItems += "\t\t\t" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "." + Utils.makeRemove(relationship.getMappedBy()) + "(" + Utils.makeFirstLetterLowerCase(bean.getName()) + ");\r\n";
              notOwnedRelEditRemoveExistingItems += "\t\t\tentityManager.merge(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + ");\r\n";
              notOwnedRelEditRemoveExistingItems += "\t\t}\r\n";

              notOwnedRelationshipEdit += "\r\n";
              notOwnedRelationshipEdit += "\t\tList<" + relationship.getToBeanName() + "> " + Utils.makeMethod2Field(relationship.getName()) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
              notOwnedRelationshipEdit += "\r\n";
              notOwnedRelationshipEdit += "\t\tfor (" + relationship.getToBeanName() + " " + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + " : " + Utils.makeMethod2Field(relationship.getName()) + ")\r\n";
              notOwnedRelationshipEdit += "\t\t{\r\n";

              notOwnedRelationshipEdit += "\t\t\t" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "." + Utils.makeRemoveAll(relationship.getMappedBy()) + "();\r\n";
              notOwnedRelationshipEdit += "\t\t\t" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + "." + Utils.makeAdd(relationship.getMappedBy()) + "(" + Utils.makeFirstLetterLowerCase(bean.getName()) + ");\r\n";
              notOwnedRelationshipEdit += "\t\t\tentityManager.merge(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + ");\r\n";
              notOwnedRelationshipEdit += "\t\t}\r\n";
            }
          }

          // Inizializzazione delle relazioni lazy per la modifica !!!
          initilizeLazyRelationshipEdit += "\t\tHibernate.initialize(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "());\r\n";
        }
      }
      else
      {
        /**
         * Gestione delle relazioni 1:1
         *
         */
        if (relationship.isMasterDetail() && !relationship.isFromMaster())
        {
          // Questo e' il detail di una MASTER-DETAIL e viene inserito il
          // check per verificare l'esistenza di un solo detail

          masterDetail1To1Check += "\t\tif (" + Utils.makeFirstLetterLowerCase(bean.getName()) + "List.size()>0)\r\n";
          masterDetail1To1Check += "\t\t{\r\n";
          masterDetail1To1Check += "\t\t\tFacesMessages.instance().clear();\r\n\r\n";
          masterDetail1To1Check += "\t\t\tString msg = MessagesLoader.getMessageResourceString(facesContext.getApplication().getMessageBundle(),\"list_" + relationship.getFromBeanName() + "_" + relationship.getName() + "_OnlyOne" + relationship.getFromBeanName() + "Allowed\", null, facesContext.getViewRoot().getLocale());\r\n\r\n";
          masterDetail1To1Check += "\t\t\tFacesMessage message = new FacesMessage();\r\n";
          masterDetail1To1Check += "\t\t\tmessage.setDetail(msg);\r\n";
          masterDetail1To1Check += "\t\t\tmessage.setSummary(msg);\r\n";
          masterDetail1To1Check += "\t\t\tmessage.setSeverity(FacesMessage.SEVERITY_INFO);\r\n";
          masterDetail1To1Check += "\t\t\tFacesMessages.instance().add(message);\r\n";
          masterDetail1To1Check += "\t\t\treturn returningPage;\r\n";
          masterDetail1To1Check += "\t\t}\r\n";
        }

        if (relationship.getMappedBy().equals(""))
        {
          // Questa bean e' l'owner della relazione
        }
        else
        {
          // Questo bean non e' l'owner della relazione

          // Creazione
          notOwnedRelationshipCreate += "\r\n";
          notOwnedRelationshipCreate += "\t\t" + relationship.getToBeanName() + " local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
          notOwnedRelationshipCreate += "\r\n";
          notOwnedRelationshipCreate += "\t\tif (local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + " != null)\r\n";
          notOwnedRelationshipCreate += "\t\t{\r\n";
          notOwnedRelationshipCreate += "\t\t\tlocal" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + "." + Utils.switchGet2Set(inverseRelationship.getName()) + "(" + Utils.makeFirstLetterLowerCase(bean.getName()) + ");\r\n";
          notOwnedRelationshipCreate += "\t\t\tentityManager.merge(local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + ");\r\n";
          notOwnedRelationshipCreate += "\t\t}\r\n";

          // Modifica
          notOwnedRelEditRemoveExistingItems += "\r\n";
          if (notOwnedRelEditRemoveExistingItems.contains("\t\t" + relationship.getToBeanName() + " old" + relationship.getToBeanName()))
            notOwnedRelEditRemoveExistingItems += "\t\told" + relationship.getToBeanName();
          else
            notOwnedRelEditRemoveExistingItems += "\t\t" + relationship.getToBeanName() + " old" + relationship.getToBeanName();
          //notOwnedRelEditRemoveExistingItems += " = entityManager.find(" + bean.getName() + ".class," + Utils.makeFirstLetterLowerCase(bean.getName()) + ".getId())." + relationship.getName() + "();\r\n";
          notOwnedRelEditRemoveExistingItems += " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
          notOwnedRelEditRemoveExistingItems += "\r\n";
          notOwnedRelEditRemoveExistingItems += "\t\tif (old" + relationship.getToBeanName() + " != null)\r\n";
          notOwnedRelEditRemoveExistingItems += "\t\t{\r\n";
          notOwnedRelEditRemoveExistingItems += "\t\t\told" + relationship.getToBeanName() + "." + Utils.makeSet(relationship.getMappedBy()) + "(null);\r\n";
          notOwnedRelEditRemoveExistingItems += "\t\t\tentityManager.merge(old" + relationship.getToBeanName() + ");\r\n";
          notOwnedRelEditRemoveExistingItems += "\t\t}\r\n";

          notOwnedRelationshipEdit += "\r\n";
          notOwnedRelationshipEdit += "\t\t" + relationship.getToBeanName() + " local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
          notOwnedRelationshipEdit += "\r\n";
          notOwnedRelationshipEdit += "\t\tif (local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + " != null)\r\n";
          notOwnedRelationshipEdit += "\t\t{\r\n";
          notOwnedRelationshipEdit += "\t\t\tlocal" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + "." + Utils.makeSet(relationship.getMappedBy()) + "(" + Utils.makeFirstLetterLowerCase(bean.getName()) + ");\r\n";
          notOwnedRelationshipEdit += "\t\t\tentityManager.merge(local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + ");\r\n";
          notOwnedRelationshipEdit += "\t\t}\r\n";

          // Cancellazione
          notOwnedRelationshipDelete += "\r\n\r\n";
          notOwnedRelationshipDelete += "\t\t" + relationship.getToBeanName() + " local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + " = " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + relationship.getName() + "();\r\n";
          notOwnedRelationshipDelete += "\r\n";
          notOwnedRelationshipDelete += "\t\tif (local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + " != null)\r\n";
          notOwnedRelationshipDelete += "\t\t{\r\n";
          notOwnedRelationshipDelete += "\t\t\tlocal" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + "." + Utils.makeSet(relationship.getMappedBy()) + "(null);\r\n";
          notOwnedRelationshipDelete += "\t\t\tentityManager.merge(local" + Utils.makeFirstLetterUpperCase(Utils.makeMethod2Field(relationship.getName())) + ");\r\n";
          notOwnedRelationshipDelete += "\t\t}\r\n";
        }
      }
    }

    /**
     * Inserimento funzione getPath se il bean e' master o detail in almeno una
     * relazione *
     */
    getPath = false;
    getPathFunction = "";
    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship relationship = bean.getRelationships().get(i);
      if (relationship.isUsed() && relationship.isMasterDetail())
        getPath = true;
    }
    if (getPath)
    {
      getPathFunction += "\r\n";
      getPathFunction += "\tpublic String getPath()\r\n";
      getPathFunction += "\t{\r\n";

      getPathFunction += "\t\tif (masterReference)\r\n";
      getPathFunction += "\t\t\treturn SeamUtility.path2String();\r\n";

      getPathFunction += "\t\treturn \"\";\r\n";
      getPathFunction += "\t}\r\n";
    }

    /** Gestione delle relazioni MASTER_DETAIL di cui questo bean e' DETAIL **/
    /** Individuazione dei bean DETAIL di questo **/
    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship relationship = bean.getRelationships().get(i);

      if (relationship.isUsed() && relationship.isMasterDetail() && !relationship.isFromMaster())
      {
        if (!referenceToMaster.contains("PathItem pathInfo"))
          referenceToMaster += "PathItem pathInfo = SeamUtility.getReferenceToMaster();\r\n\r\n";

        referenceToMaster += "\t\tif (pathInfo.getId() != null && pathInfo.getBeanName().equals(\"" + relationship.getToBeanName() + "\"))\r\n";
        if (!relationship.isToMany())
          referenceToMaster += "\t\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeSet(Utils.makeMethod2Field(relationship.getName())) + "(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + ");\r\n\r\n";
        else
          referenceToMaster += "\t\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeAdd(Utils.makeMethod2Field(relationship.getName())) + "(" + Utils.makeFirstLetterLowerCase(relationship.getToBeanName()) + ");\r\n\r\n";
      }

      if (relationship.isMasterDetail() && relationship.isFromMaster())
      {
        /** Costruzione dei metodi di chiamata ai dettagli **/
        Vector<ShowList> lists = infoReader.getLists(relationship.getToBeanName());
        for (ShowList list : lists)
        {
          goToDetails += "\r\n";
          goToDetails += "\tpublic String goTo" + list.getName() + "()\r\n";
          goToDetails += "\t{\r\n";
          goToDetails += "\t\tString label=\"\";\r\n\r\n";

          // Gli attributi di riferimento al master sono sulla relazione
          // che va dal detail al master
          // Qui si sta generando il master per cui e' necessario ricercare
          // la relazione che dal detail
          // va al master

          Relationship relk = infoReader.getRelationshipToMaster(relationship.getToBeanName(), bean.getName());

          for (int k = 0; k < relk.getMasterAttributes().size(); k++)
          {
            if (k > 0)
              goToDetails += "\t\tlabel += \" - \";\r\n";

            if (relk.getMasterAttributes().get(k).getType().equals("java.util.Date"))
              // goToDetails += "\t\tlabel += " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeGet(relk.getMasterAttributes().get(k).getName()) + "()DATA;\r\n";
              goToDetails += "\t\tlabel += SeamUtility.convertDate(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeGet(relk.getMasterAttributes().get(k).getName()) + "(),SeamUtility.getMessage(facesContext,\"Application_DateFormat\"));;\r\n";
            else
              goToDetails += "\t\tlabel += " + Utils.makeFirstLetterLowerCase(bean.getName()) + "." + Utils.makeGet(relk.getMasterAttributes().get(k).getName()) + "();\r\n";
          }

          goToDetails += "\t\tSeamUtility.updateMasterDetailPath(\"" + bean.getName() + "\",label," + Utils.makeFirstLetterLowerCase(bean.getName()) + ".getId());\r\n\r\n";
          goToDetails += "\t\treturn \"/list/" + list.getName() + "List.seam?masterReference=true\";\r\n";
          goToDetails += "\t}\r\n";

        }
      }

    }

    /** Gestione della local search -- variabili **/

    localSearchFields += "";
    localSearchFields += "private boolean\t\t\t\t\t\t\t\t\tlocalSearch\t\t\t\t\t\t= false;\r\n\r\n";
    for (int i = 0; i < bean.getLocalSearchAttributes().size(); i++)
    {
      SearchAttribute attr = bean.getLocalSearchAttributes().get(i);

      if (!attr.belongsToRelationship())
      {
        //        localSearchFields += "\t@In(create = true, required = false)\r\n";
        //        localSearchFields += "\t@Out(required = false)\r\n";
        if (attr.getImplementationType() == AttributeImplementationType.TEXT || attr.getImplementationType() == AttributeImplementationType.TEXTAREA)
        {
          localSearchFields += "\tprivate String\t\t\t\t\t\t\t\t\t\tlocalSearch" + Utils.makeFirstLetterUpperCase(attr.getName()) + "\t\t\t\t\t= null;\r\n";
        }
        else
        {
          localSearchFields = "TIPO DI DATO NON SUPPORTATO IN LOCAL SEARCH: " + attr.getImplementationType();
        }
      }
      else
      {
        // Attributo che appartiene ad una relazione
        localSearchFields += "\r\n";
        if (!attr.getRelationship().isToMany())
        {
          //localSearchFields += "\t@In(create = true, required = false)\r\n";
          //localSearchFields += "\t@Out(required = false)\r\n";
          localSearchFields += "\tprivate " + attr.getRelationship().getToBeanName() + "                localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + "  = null;\r\n";
        }
        else
        {
          //localSearchFields += "\t@In(create = true, required = false)\r\n";
          //localSearchFields += "\t@Out(required = false)\r\n";
          localSearchFields += "\tprivate List <" + attr.getRelationship().getToBeanName() + ">            localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + "  = null;\r\n";
        }
      }
    }

    /** Gestione della local search -- funzioni ausiliarie * */
    localSearch = "";
    localSearch += "public boolean isLocalSearch()\r\n";
    localSearch += "\t{\r\n";
    localSearch += "\t\treturn localSearch;\r\n";
    localSearch += "\t}\r\n\r\n";
    localSearch += "\tpublic void setLocalSearch(boolean search)\r\n";
    localSearch += "\t{\r\n";
    localSearch += "\t\tthis.localSearch = search;\r\n";
    localSearch += "\t}\r\n\r\n";
    localSearch += "\tpublic void startLocalSearch()\r\n";
    localSearch += "\t{\r\n";
    localSearch += "\t\tlocalSearch = true;\r\n";
    localSearch += "\t}\r\n\r\n";
    // localSearch += "\t@Begin(join = true)\r\n";
    localSearch += "\tpublic void stopLocalSearch()\r\n";
    localSearch += "\t{\r\n";

    for (int i = 0; i < bean.getLocalSearchAttributes().size(); i++)
    {
      SearchAttribute attr = bean.getLocalSearchAttributes().get(i);

      if (attr.getImplementationType() == AttributeImplementationType.TEXT || attr.getImplementationType() == AttributeImplementationType.TEXTAREA)
      {
        localSearch += "\t\tlocalSearch" + Utils.makeFirstLetterUpperCase(attr.getName()) + " = null;\r\n";
      }
      else
      {
        localSearch += "\t\tlocalSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + " = null;\r\n";
      }
    }

    localSearch += "\t\tlocalSearch = false;\r\n\r\n";
    localSearch += "\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "List = null;\r\n";
    localSearch += "\t}\r\n\r\n";

    // Getter e Setter per gli attributi di ricerca locale

    for (int i = 0; i < bean.getLocalSearchAttributes().size(); i++)
    {
      SearchAttribute attr = bean.getLocalSearchAttributes().get(i);

      if (attr.getImplementationType() == AttributeImplementationType.TEXT || attr.getImplementationType() == AttributeImplementationType.TEXTAREA)
      {
        localSearch += "\tpublic String getLocalSearch" + Utils.makeFirstLetterUpperCase(attr.getName()) + "()\r\n";
        localSearch += "\t{\r\n";
        localSearch += "\t\treturn localSearch" + Utils.makeFirstLetterUpperCase(attr.getName()) + ";\r\n";
        localSearch += "\t}\r\n\r\n";

        localSearch += "\tpublic void setLocalSearch" + Utils.makeFirstLetterUpperCase(attr.getName()) + "(String localSearch" + Utils.makeFirstLetterUpperCase(attr.getName()) + ")\r\n";
        localSearch += "\t{\r\n";
        localSearch += "\t\tthis.localSearch" + Utils.makeFirstLetterUpperCase(attr.getName()) + " = localSearch" + Utils.makeFirstLetterUpperCase(attr.getName()) + ";\r\n";
        localSearch += "\t}\r\n\r\n";
      }
      else
      {
        if (attr.belongsToRelationship())
        {
          if (attr.getRelationship().isToMany())
          {
            localSearch += "\tpublic List<" + attr.getRelationship().getToBeanName() + "> getLocalSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + "()\r\n";
            localSearch += "\t{\r\n";
            localSearch += "\t\treturn localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + ";\r\n";
            localSearch += "\t}\r\n\r\n";

            localSearch += "\tpublic void setLocalSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + "(List<" + attr.getRelationship().getToBeanName() + "> localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + ")\r\n";
            localSearch += "\t{\r\n";
            localSearch += "\t\tthis.localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + " = localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + ";\r\n";
            localSearch += "\t}\r\n\r\n";
          }
          else
          {
            localSearch += "\tpublic " + attr.getRelationship().getToBeanName() + " getLocalSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + "()\r\n";
            localSearch += "\t{\r\n";
            localSearch += "\t\treturn localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + ";\r\n";
            localSearch += "\t}\r\n\r\n";

            localSearch += "\tpublic void setLocalSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + "(" + attr.getRelationship().getToBeanName() + " localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + ")\r\n";
            localSearch += "\t{\r\n";
            localSearch += "\t\tthis.localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + " = localSearch" + attr.getRelationship().getName() + Utils.makeFirstLetterUpperCase(attr.getName()) + ";\r\n";
            localSearch += "\t}\r\n\r\n";
          }
        }

      }
View Full Code Here

  {
    String orderingFunctions = "";

    for (int i = 0; i < attrs.size(); i++)
    {
      ShowAttribute attr = attrs.get(i);

      if (!attr.isKey())
      {
        if (!attr.belongsToRelationship())
        {
          orderingFunctions += "\tpublic void orderBy" + (i + 1) + "A();\r\n";
          orderingFunctions += "\tpublic void orderBy" + (i + 1) + "D();\r\n\r\n";
        }
        else
        {
          if (!attr.getRelationship().isToMany())
          {
            orderingFunctions += "\tpublic void orderBy" + (i + 1) + "A();\r\n";
            orderingFunctions += "\tpublic void orderBy" + (i + 1) + "D();\r\n\r\n";
          }
        }
View Full Code Here

    int orderIndex = 1;
    String defaultOrdering = "";
    for (int i = 0; i < attrs.size(); i++)
    {
      ShowAttribute attr = attrs.get(i);

      if (!attr.isKey())
      {
        if (!attr.belongsToRelationship())
        {
          // Attributo del bean

          if (!attr.isTrans())
          {
            findAll += "\t\t\tcase " + orderIndex + ":\r\n";
            findAll += "\t\t\t\tqb.addOrderBy(\"o." + attr.getNameForOrdering() + " desc\");\r\n";
            findAll += "\t\t\t\tbreak;\r\n";
            orderIndex++;

            findAll += "\t\t\tcase " + orderIndex + ":\r\n";
            findAll += "\t\t\t\tqb.addOrderBy(\"o." + attr.getNameForOrdering() + " asc\");\r\n";
            findAll += "\t\t\t\tbreak;\r\n\r\n";
            orderIndex++;

            if (attr.getDefaultOrderingAttribute().equals("Asc"))
              defaultOrdering += "qb.addOrderBy(\"o." + attr.getNameForOrdering() + " asc\")";

            if (attr.getDefaultOrderingAttribute().equals("Desc"))
              defaultOrdering += "qb.addOrderBy(\"o." + attr.getNameForOrdering() + " desc\")";
          }
          else
          {
            orderIndex += 2;
          }
        }
        else
        {
          // Attributo di una relazione del bean

          if (!attr.getRelationship().isToMany())
          {
            findAll += "\t\t\tcase " + orderIndex + ":\r\n";
            //findAll += "\t\t\t\tqb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getNameForOrdering() + " asc\");\r\n";           
            findAll += "\t\t\t\tqb.addOrderBy(\"o.";

            for (int j = 0; j < attr.getRelationships().size(); j++)
            {
              findAll += Utils.makeMethod2Field(attr.getRelationships().get(j).getName()) + ".";
            }

            findAll += attr.getNameForOrdering() + " desc\");\r\n";
            findAll += "\t\t\t\tbreak;\r\n";
            orderIndex++;

            findAll += "\t\t\tcase " + orderIndex + ":\r\n";
            // findAll += "\t\t\t\tqb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getNameForOrdering() + " desc\");\r\n";
            findAll += "\t\t\t\tqb.addOrderBy(\"o.";

            for (int j = 0; j < attr.getRelationships().size(); j++)
            {
              findAll += Utils.makeMethod2Field(attr.getRelationships().get(j).getName()) + ".";
            }

            findAll += attr.getNameForOrdering() + " asc\");\r\n";

            findAll += "\t\t\t\tbreak;\r\n\r\n";
            orderIndex++;

            if (attr.getDefaultOrderingAttribute().equals("Asc"))
            {
              defaultOrdering += "qb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getNameForOrdering() + " asc\")";
            }

            if (attr.getDefaultOrderingAttribute().equals("Desc"))
            {
              defaultOrdering += "qb.addOrderBy(\"o." + Utils.makeMethod2Field(attr.getRelationship().getName()) + "." + attr.getNameForOrdering() + " desc\")";
            }
          }
        }
      }
    }

    findAll += "// YOUR CODE GOES HERE\r\n";
    findAll += "@YourCode";
    findAll += "// END OF YOUR CODE\r\n";

    findAll += "\t\t\tdefault:\r\n";
    if (defaultOrdering.equals(""))
      findAll += "\t\t\t\tqb.addOrderBy(\"o.id desc\");\r\n";
    else
      findAll += "\t\t\t\t" + defaultOrdering + ";\r\n";

    findAll += "\t\t}\r\n\r\n";

    findAll += "\r\n";

    /** Filtro per relazione con il master * */
    String referenceToMaster = "\t\tPathItem myInfo = SeamUtility.getReferenceToMaster();\r\n";
    Relationship relToMaster = null;

    for (int i = 0; i < bean.getRelationships().size(); i++)
    {
      Relationship rel = bean.getRelationships().get(i);

      if (rel.isUsed() && rel.isMasterDetail() && !rel.isFromMaster())
      {
        relToMaster = rel;

        if (!relToMaster.isToMany())
        {
          referenceToMaster += "\r\n";
          referenceToMaster += "\r\n";
          referenceToMaster += "\t\tif (myInfo.getId()!=null && myInfo.getBeanName().equals(\"" + rel.getToBeanName() + "\"))\r\n";
          referenceToMaster += "\t\t{\r\n";
          referenceToMaster += "\t\t\tqb.addMasterReferenceWhere(\"o.\"+myInfo.getBeanField()+\".id = :masterId\",myInfo.getId());\r\n";
          referenceToMaster += "\t\t\tqb.setMasterReferenceParameter(\"masterId\",myInfo.getId());\r\n";
          referenceToMaster += "\t\t}\r\n";
          referenceToMaster += "\t\t\r\n";
        }
        else
        {
          referenceToMaster += "\r\n";
          referenceToMaster += "\r\n";
          referenceToMaster += "\t\tif (myInfo.getId()!=null && myInfo.getBeanName().equals(\"" + rel.getToBeanName() + "\"))\r\n";
          referenceToMaster += "\t\t{\r\n";

          referenceToMaster += "\t\t\tqb.addInnerJoin(\"o." + Utils.makeMethod2Field(relToMaster.getName()) + " master\");\r\n";
          referenceToMaster += "\t\t\tqb.addTextWhere(\"master.id = :masterId\");\r\n";

          referenceToMaster += "\t\t\tqb.setMasterReferenceParameter(\"masterId\",myInfo.getId());\r\n";
          referenceToMaster += "\t\t}\r\n";
          referenceToMaster += "\t\t\r\n";
        }
      }
    }

    findAll += referenceToMaster;

    //    if (isDetail)
    //    {
    //      if (!relToMaster.isToMany())
    //      {
    //        findAll += "\r\n";
    //        findAll += "\r\n";
    //        findAll += "\t\tPathItem myInfo = SeamUtility.getReferenceToMaster();\r\n";
    //        findAll += "\t\tif (myInfo.getId()!=null)\r\n";
    //        findAll += "\t\t{\r\n";
    //        findAll += "\t\t\tqb.addMasterReferenceWhere(\"o.\"+myInfo.getBeanField()+\".id = :masterId\",myInfo.getId());\r\n";
    //        findAll += "\t\t\tqb.setMasterReferenceParameter(\"masterId\",myInfo.getId());\r\n";
    //        findAll += "\t\t}\r\n";
    //        findAll += "\t\t\r\n";
    //      }
    //      else
    //      {
    //        findAll += "\r\n";
    //        findAll += "\r\n";
    //        findAll += "\t\tPathItem myInfo = SeamUtility.getReferenceToMaster();\r\n";
    //        findAll += "\t\tif (myInfo.getId()!=null)\r\n";
    //        findAll += "\t\t{\r\n";
    //
    //        findAll += "\t\t\tqb.addInnerJoin(\"o." + Utils.makeMethod2Field(relToMaster.getName()) + " master\");\r\n";
    //        findAll += "\t\t\tqb.addTextWhere(\"master.id = :masterId\");\r\n";
    //
    //        findAll += "\t\t\tqb.setMasterReferenceParameter(\"masterId\",myInfo.getId());\r\n";
    //        findAll += "\t\t}\r\n";
    //        findAll += "\t\t\r\n";
    //      }
    // /** Filtro per la relazione con il master nel caso di relazione
    // categorizzata **/
    // findAll +=
    // "\t\tif("+Utils.makeFirstLetterLowerCase(masterBeanName)+" !=
    // null)\r\n";
    // findAll += "\t\t{\r\n";
    // findAll +=
    // "\t\t\tqb.addMasterReferenceWhere(\"o."+Utils.makeFirstLetterLowerCase(masterBeanName)+".id
    // = :masterId\",
    // "+Utils.makeFirstLetterLowerCase(masterBeanName)+".getId());\r\n";
    // findAll += "\t\t\tqb.setMasterReferenceParameter(\"masterId\",
    // "+Utils.makeFirstLetterLowerCase(masterBeanName)+".getId());\r\n";
    // findAll += "\t\t}\r\n";
    //    }

    findAll += "\t\tlog.debug(\"\tquery: \"+qb.getQuery());\r\n";
    findAll += "\t\tlong startTime = System.currentTimeMillis();\r\n";

    findAll += "\r\n";
    findAll += "\t\tentityManager.clear();\r\n";
    findAll += "\r\n";

    findAll += "\t\tListOrderedSet tmp = new ListOrderedSet();\r\n";
    findAll += "\t\ttmp.addAll(qb.getEjbQuery().getResultList());\r\n";

    findAll += "\t\tVector<" + bean.getName() + "> tmp1 = new Vector<" + bean.getName() + ">(tmp.asList());\r\n";
    findAll += "\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "List = tmp1;\r\n";

    findAll += "\r\n";

    /** Gestione della lista delle selezione per le PopUp - FRAMMENTO CODICE 2* */

    String popUpManagementTemplate = "." + File.separator + "templates" + File.separator + "Seam_FindAllPopUpManagement_2.java";

    HashMap<String, String> tags = new HashMap<String, String>();

    tags.put("@Bean", bean.getName());
    tags.put("@bean", Utils.makeFirstLetterLowerCase(bean.getName()));

    String popUpManagement = Utils.SeamReplaceTag2String(tags, null, null, popUpManagementTemplate);

    findAll += popUpManagement;

    /** Gestione dell'ordinamento dei campi transient **/

    findAll += "\r\n\t\t// Gestione ordinamento dei campi transient\r\n";

    findAll += "\t\tswitch (order)\r\n";
    findAll += "\t\t{\r\n";

    orderIndex = 1;

    for (int i = 0; i < attrs.size(); i++)
    {
      ShowAttribute attr = attrs.get(i);

      if (!attr.isKey())
      {
        if (!attr.belongsToRelationship())
        {
          // Attributo del bean

          if (attr.isTrans())
          {
            findAll += "\t\t\tcase " + orderIndex + ":\r\n";
            findAll += "\t\t\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "List = SeamUtility.orderBy(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "List, \"" + attr.getNameForOrdering() + "\", GenericFieldComparator.OrderType.DESC);\r\n";
            findAll += "\t\t\t\tbreak;\r\n";
            orderIndex++;

            findAll += "\t\t\tcase " + orderIndex + ":\r\n";
            findAll += "\t\t\t\t" + Utils.makeFirstLetterLowerCase(bean.getName()) + "List = SeamUtility.orderBy(" + Utils.makeFirstLetterLowerCase(bean.getName()) + "List, \"" + attr.getNameForOrdering() + "\", GenericFieldComparator.OrderType.ASC);\r\n";
            findAll += "\t\t\t\tbreak;\r\n\r\n";
            orderIndex++;
          }
          else
          {
View Full Code Here

          Vector<ShowAttribute> attributes = rel.getRelatedAttributes();

          Vector<ShowAttribute> beanAttr = new Vector<ShowAttribute>();

          beanAttr.add(new ShowAttribute(infoReader.getBeanKey(rel.getToBeanName())));

          beanAttr.addAll(attributes);

          // Sono aggiunti gli attributi derivanti dalle relazioni
          // implementate come ListBox
          Vector<Attribute> attributes1 = bean.getAttributes();
          Vector<ShowAttribute> callingAttributes = new Vector<ShowAttribute>();

          for (int l = 0; l < attributes1.size(); l++)
          {
            Attribute attr = attributes1.get(l);

            if (attr.getImplementationType() != AttributeImplementationType.HIDEINFORM)
              callingAttributes.add(new ShowAttribute(attributes1.get(l)));
          }

          /**
           * Nei calling attributes ci vanno
           *
           * 1) Gli attributi visualizzati del bean origine
           *
           * 2) Gli attributi visualizzati nel bean, ereditati dal
           * superbean origine (se esiste)
           *
           * 3) Gli attributi derivanti da relazioni implementate come
           * LISTBOX
           *
           * 4) Gli attributi derivanti da relazioni implementate come
           * LISTBOX ereditate dal superbean origine (se esiste)
           *
           */

          Vector<Relationship> re = bean.getRelationships();

          for (int j = 0; j < re.size(); j++)
          {
            if (re.get(j).isListBox())
            {
              Attribute a = new Attribute();
              a.setKey(false);
              a.setName(Utils.makeFirstLetterLowerCase(re.get(j).getToBeanName()));

              ShowAttribute attr = new ShowAttribute(re.get(j), a);

              callingAttributes.add(attr);
            }
          }

          Bean targetBean = infoReader.getBean(rel.getToBeanName());

          /**
           * generateSelectionPage2One(String sourceDir, String targetDir,
           * Relationship rel, Vector<ShowAttribute>
           * callingBeanAttributes, String bean, Vector<SearchAttribute>
           * localSearchAttributes, Vector<ShowAttribute>
           * targetBeanAttributes)
           */

          HTMLGenerator.generatePopUpSingleSelection(sourceDir, targetDir, bean, rel, callingAttributes, targetBean.getLocalSearchAttributes(), beanAttr);
        }

        if ((!rel.isMasterDetail() || (rel.isMasterDetail() && rel.getOrderInForm() != 0)) && rel.isToMany())
        {
          // Relazione a n implementata come popup

          // Attributi nella pagina di origine

          Vector<ShowAttribute> attributes = rel.getRelatedAttributes();

          Bean targetBean = infoReader.getBean(rel.getToBeanName());

          Vector<Attribute> tmp = new Vector<Attribute>(bean.getAttributes());
          Vector<ShowAttribute> beanAttr = new Vector<ShowAttribute>();

          for (int l = 0; l < tmp.size(); l++)
          {
            beanAttr.add(new ShowAttribute(tmp.get(l)));
          }

          // Sono aggiunti gli attributi derivanti dalle relazioni
          // implementate come ListBox

          Vector<Relationship> re = bean.getRelationships();

          for (int j = 0; j < re.size(); j++)
          {
            if (re.get(j).isListBox())
            {
              Attribute a = new Attribute();
              a.setKey(false);
              a.setName(Utils.makeFirstLetterLowerCase(re.get(j).getToBeanName()));

              ShowAttribute attr = new ShowAttribute(re.get(j), a);

              beanAttr.add(attr);
            }
          }
          HTMLGenerator.generatePopUpMultipleSelection(sourceDir, targetDir, bean, targetBean.getLocalSearchAttributes(), rel);
View Full Code Here

TOP

Related Classes of org.boco.seamwebappgen.info.ShowAttribute

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.