protected String doResolvePackageName(String typeName, boolean exceptUtil) {
   if (typeName == null) {
     return typeName;
   }
   final String processed = processLanguageType(typeName, exceptUtil);
   if (processed != null) {
     return processed;
   }
   if (typeName.contains(VAR_CDEF)) {
     final DfBasicProperties prop = getBasicProperties();
     final String pkg = prop.getBaseCommonPackage();
     final String prefix = prop.getProjectPrefix();
     typeName = DfStringUtil.replace(typeName, VAR_CDEF, pkg + "." + prefix + "CDef");
   }
   if (typeName.contains(VAR_DOMAIN + ".")) { // as domain entity
     final String pkg = getBasicProperties().getExtendedEntityPackage();
     typeName = Srl.replace(typeName, VAR_DOMAIN + ".", pkg + ".");
   }
   if (typeName.contains(VAR_CUSTOMIZE + ".")) { // as customize entity
     final String pkg = getOutsideSqlProperties().getExtendedEntityPackage();
     typeName = Srl.replace(typeName, VAR_CUSTOMIZE + ".", pkg + ".");
   }
   if (typeName.contains(VAR_PMB + ".")) { // as parameter-bean
     final String pkg = getOutsideSqlProperties().getExtendedParameterBeanPackage();
     typeName = Srl.replace(typeName, VAR_PMB + ".", pkg + ".");
   }
   return typeName;
 }
Ejemplo n.º 2
0
 // ===================================================================================
 //                                                                      General Helper
 //                                                                      ==============
 // -----------------------------------------------------
 //                                       String Handling
 //                                       ---------------
 protected final String replaceString(String text, String fromText, String toText) {
   return Srl.replace(text, fromText, toText);
 }
 // ===================================================================================
 //                                                                  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);
   }
 }