コード例 #1
0
 // ===================================================================================
 //                                                                 Behavior Query Path
 //                                                                 ===================
 protected void setupBehaviorQueryPath() {
   final DfOutsideSqlPack sqlFileList = collectOutsideSqlChecked();
   final DfBehaviorQueryPathSetupper setupper = new DfBehaviorQueryPathSetupper();
   setupper.setupBehaviorQueryPath(sqlFileList);
 }
コード例 #2
0
 // ===================================================================================
 //                                                                  Parameter Property
 //                                                                  ==================
 protected void processParameterProperty(
     String sql, String parameterBeanName, DfPmbMetaData pmbMetaData) {
   final Map<String, String> propertyNameTypeMap = new LinkedHashMap<String, String>();
   final Map<String, String> propertyNameOptionMap = new LinkedHashMap<String, String>();
   final Set<String> autoDetectedPropertyNameSet = new LinkedHashSet<String>();
   pmbMetaData.setPropertyNameTypeMap(propertyNameTypeMap);
   pmbMetaData.setPropertyNameOptionMap(propertyNameOptionMap);
   pmbMetaData.setAutoDetectedPropertyNameSet(autoDetectedPropertyNameSet);
   final List<DfSql2EntityMark> parameterBeanElement = getParameterBeanPropertyTypeList(sql);
   final String autoDetectMark = "AutoDetect";
   for (DfSql2EntityMark mark : parameterBeanElement) {
     final String element = mark.getContent().trim();
     if (element.equalsIgnoreCase(autoDetectMark)) {
       processAutoDetect(
           sql, propertyNameTypeMap, propertyNameOptionMap, autoDetectedPropertyNameSet);
       break;
     }
   }
   for (DfSql2EntityMark mark : parameterBeanElement) {
     final String element = mark.getContent().trim();
     final String nameDelimiter = " ";
     final String optionDelimiter = ":";
     if (autoDetectMark.equals(element)) {
       continue; // because of already resolved
     }
     final int delimiterIndex = element.indexOf(optionDelimiter);
     final String slaslaOption;
     {
       final String optionPrefix = DfPmbPropertyOptionComment.OPTION_PREFIX;
       final String optionSuffix = DfPmbPropertyOptionComment.OPTION_SUFFIX;
       final String comment = mark.getComment();
       if (Srl.is_NotNull_and_NotTrimmedEmpty(comment)) {
         final String filtered = Srl.replace(comment, "|", "/").trim();
         slaslaOption = optionPrefix + filtered + optionSuffix;
       } else {
         slaslaOption = null;
       }
     }
     final String propertyDef;
     final String optionDef;
     if (delimiterIndex > 0) {
       propertyDef = element.substring(0, delimiterIndex).trim();
       final int optionIndex = delimiterIndex + optionDelimiter.length();
       final String basicOption = element.substring(optionIndex).trim();
       optionDef = basicOption + (slaslaOption != null ? "|" + slaslaOption : "");
     } else {
       propertyDef = element;
       optionDef = (slaslaOption != null ? slaslaOption : null);
     }
     final int nameIndex = propertyDef.lastIndexOf(nameDelimiter);
     if (nameIndex <= 0) {
       String msg = "The parameter bean element should be [typeName propertyName].";
       msg = msg + " But: element=" + element + " srcFile=" + _outsideSqlFile;
       throw new IllegalStateException(msg);
     }
     // ParameterBean has the "import" clause of language-embedded utility
     final String typeName = prepareDefinedPropertyType(propertyDef, nameIndex);
     final String propertyName = propertyDef.substring(nameIndex + nameDelimiter.length()).trim();
     if (propertyNameTypeMap.containsKey(propertyName)) {
       // means the auto-detected property is found,
       // and it should be overridden
       propertyNameTypeMap.remove(propertyName);
       propertyNameOptionMap.remove(propertyName);
     }
     propertyNameTypeMap.put(propertyName, typeName);
     if (optionDef != null) {
       propertyNameOptionMap.put(propertyName, optionDef);
     }
   }
   final Map<String, Map<String, String>> bqpMap =
       _bqpSetupper.extractBasicBqpMap(createOutsideSqlPackAsOne());
   if (!bqpMap.isEmpty()) {
     final Map<String, String> bqpElementMap = bqpMap.values().iterator().next();
     pmbMetaData.setBqpElementMap(bqpElementMap);
   }
 }