Exemplo n.º 1
0
 protected Tab getTab() throws XavaException {
   if (tab == null) {
     String tabObject =
         Is.emptyString(collection)
             ? "xava_tab"
             : Tab.COLLECTION_PREFIX + Strings.change(collection, ".", "_");
     tab = (Tab) getContext().get(getRequest(), tabObject);
     if (tab.getCollectionView() != null) {
       tab.getCollectionView().refreshCollections();
     }
   }
   return tab;
 }
Exemplo n.º 2
0
 private String createSelect() throws XavaException {
   if (hasBaseCondition()) {
     String baseCondition = getBaseCondition();
     if (baseCondition.trim().toUpperCase().startsWith("SELECT ")) {
       return baseCondition;
     }
   }
   // basic select
   StringBuffer select = new StringBuffer("select ");
   Iterator itProperties = getPropertiesNames().iterator();
   while (itProperties.hasNext()) {
     String property = (String) itProperties.next();
     if (Strings.isModelName(property))
       select.append("0"); // the property is a table name not column name
     else {
       select.append("${");
       select.append(property);
       select.append('}');
     }
     if (itProperties.hasNext()) select.append(", ");
   }
   Iterator itHiddenProperties = getHiddenPropertiesNames().iterator();
   while (itHiddenProperties.hasNext()) {
     select.append(", ");
     select.append("${");
     select.append(itHiddenProperties.next());
     select.append('}');
   }
   select.append(" from ${");
   select.append(getModelName());
   select.append('}');
   select.append(' ');
   if (hasBaseCondition()) {
     select.append(" where ");
     select.append(getBaseCondition());
   }
   return select.toString();
 }
 public String getColumnName(int c) {
   return labelAsHeader
       ? getMetaProperty(c).getLabel(locale)
       : Strings.change(getMetaProperty(c).getQualifiedName(), ".", "_");
 }