コード例 #1
0
ファイル: MetaTab.java プロジェクト: OpenXavaEx/OpenXavaEx
 public void setDefaultValues() {
   for (MetaTab t : MetaTabsDefaultValues.getMetaTabsForModel(getMetaComponent().getName())) {
     if (t.getMetaFilter() != null && getMetaFilter() == null) setMetaFilter(t.getMetaFilter());
     if (t.getMetaRowStyles() != null && getMetaRowStyles() == null)
       setMetaRowStyles(t.getMetaRowStyles());
     if (t.properties != null && properties == null) properties = t.properties;
     if (!Is.emptyString(t.getBaseCondition()) && Is.emptyString(getBaseCondition()))
       setBaseCondition(t.getBaseCondition());
     if (!Is.emptyString(t.getDefaultOrder()) & Is.emptyString(getDefaultOrder()))
       setDefaultOrder(t.getDefaultOrder());
   }
 }
コード例 #2
0
 public String getTable() {
   // Change this if by polymorphism ?
   if (isCodeGenerationTime()) return table;
   if (XavaPreferences.getInstance().isJPAPersistence()
       && getSchema() == null
       && !Is.emptyString(XPersistence.getDefaultSchema())) {
     return XPersistence.getDefaultSchema() + "." + table;
   } else if (XavaPreferences.getInstance().isHibernatePersistence()
       && getSchema() == null
       && !Is.emptyString(XHibernate.getDefaultSchema())) {
     return XHibernate.getDefaultSchema() + "." + table;
   }
   return table;
 }
コード例 #3
0
  public String getQualifiedColumn(String modelProperty) throws XavaException {
    PropertyMapping propertyMapping = (PropertyMapping) propertyMappings.get(modelProperty);
    if (propertyMapping != null && propertyMapping.hasFormula()) return getColumn(modelProperty);

    String tableColumn = getTableColumn(modelProperty, true);
    if (Is.emptyString(tableColumn)) return "'" + modelProperty + "'";
    if (referencePropertyWithFormula) {
      referencePropertyWithFormula = false;
      return tableColumn;
    }
    // for calculated fields or created by multiple converter

    if (modelProperty.indexOf('.') >= 0) {
      if (tableColumn.indexOf('.') < 0) return tableColumn;
      String reference = modelProperty.substring(0, modelProperty.lastIndexOf('.'));
      if (tableColumn.startsWith(getTableToQualifyColumn() + ".")) {
        String member = modelProperty.substring(modelProperty.lastIndexOf('.') + 1);
        if (getMetaModel().getMetaReference(reference).getMetaModelReferenced().isKey(member))
          return tableColumn;
      }

      // The next code uses the alias of the table instead of its name. In order to
      // support multiple references to the same model
      if (reference.indexOf('.') >= 0) {
        if (getMetaModel().getMetaProperty(modelProperty).isKey()) {
          reference = reference.substring(0, reference.lastIndexOf('.'));
        }
        reference = reference.replaceAll("\\.", "_");
      }
      return "T_" + reference + tableColumn.substring(tableColumn.lastIndexOf('.'));
    } else {
      return getTableToQualifyColumn() + "." + tableColumn;
    }
  }
コード例 #4
0
ファイル: MetaTab.java プロジェクト: OpenXavaEx/OpenXavaEx
 private List obtainPropertiesNamesUsedToCalculate() throws XavaException {
   Set result = new HashSet();
   Iterator itProperties = getMetaPropertiesCalculated().iterator();
   while (itProperties.hasNext()) {
     MetaProperty metaProperty = (MetaProperty) itProperties.next();
     if (!metaProperty.hasCalculator()) continue;
     MetaSetsContainer metaCalculator = metaProperty.getMetaCalculator();
     if (!metaCalculator.containsMetaSets()) continue;
     Iterator itSets = metaCalculator.getMetaSets().iterator();
     while (itSets.hasNext()) {
       MetaSet set = (MetaSet) itSets.next();
       String propertyNameFrom = set.getPropertyNameFrom();
       if (!Is.emptyString(propertyNameFrom)) {
         String qualifiedName = metaProperty.getQualifiedName();
         int idx = qualifiedName.indexOf('.');
         String ref = idx < 0 ? "" : qualifiedName.substring(0, idx + 1);
         String qualifiedPropertyNameFrom = ref + propertyNameFrom;
         if (!getPropertiesNames().contains(qualifiedPropertyNameFrom)) {
           result.add(qualifiedPropertyNameFrom);
         }
       }
     }
   }
   return new ArrayList(result);
 }
コード例 #5
0
ファイル: MetaTab.java プロジェクト: OpenXavaEx/OpenXavaEx
 public static String getTitleI18n(Locale locale, String modelName, String tabName)
     throws XavaException {
   String id = null;
   if (Is.emptyString(tabName)) {
     id = modelName + ".tab.title";
   } else {
     id = modelName + ".tabs." + tabName + ".title";
   }
   if (Labels.existsExact(id, locale)) {
     return Labels.get(id, locale);
   } else {
     return null;
   }
 }
コード例 #6
0
ファイル: MetaTab.java プロジェクト: OpenXavaEx/OpenXavaEx
 public boolean hasDefaultOrder() {
   return !Is.emptyString(this.defaultOrder);
 }
コード例 #7
0
ファイル: MetaTab.java プロジェクト: OpenXavaEx/OpenXavaEx
 public boolean hasBaseCondition() {
   return !Is.emptyString(this.baseCondition);
 }