Example usage for org.apache.commons.lang StringUtils contains

List of usage examples for org.apache.commons.lang StringUtils contains

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils contains.

Prototype

public static boolean contains(String str, String searchStr) 

Source Link

Document

Checks if String contains a search String, handling null.

Usage

From source file:net.ymate.framework.validation.UploadFileValidator.java

private ValidateResult __doValidateUploadFileWrapper(ValidateContext context, List<String> allowContentTypes,
        String paramName, VUploadFile vUploadFile, IUploadFileWrapper value) {
    boolean _matched = false;
    boolean _isNotAllowContentType = false;
    ///*from  ww w  .j  a  v  a 2s.c  o  m*/
    if (vUploadFile.min() > 0 && value.getSize() < vUploadFile.min()) {
        _matched = true;
    } else if (vUploadFile.max() > 0 && value.getSize() > vUploadFile.max()) {
        _matched = true;
    } else if (allowContentTypes.size() > 0) {
        boolean _flag = false;
        for (String _contentType : allowContentTypes) {
            if (StringUtils.contains(value.getContentType(), _contentType)) {
                _flag = true;
                break;
            }
        }
        if (!_flag) {
            _matched = true;
            _isNotAllowContentType = true;
        }
    }
    if (_matched) {
        String _msg = StringUtils.trimToNull(vUploadFile.msg());
        if (_msg != null) {
            _msg = __doGetI18nFormatMessage(context, _msg, _msg, paramName);
        } else {
            if (_isNotAllowContentType) {
                _msg = __doGetI18nFormatMessage(context, "ymp.validation.upload_file_content_type",
                        "{0} content type must be match {1}.", paramName,
                        StringUtils.join(vUploadFile.contentTypes(), ","));
            } else {
                if (vUploadFile.max() > 0 && vUploadFile.min() > 0) {
                    _msg = __doGetI18nFormatMessage(context, "ymp.validation.upload_file_between",
                            "{0} size must be between {1} and {2}.", paramName, vUploadFile.min(),
                            vUploadFile.max());
                } else if (vUploadFile.max() > 0) {
                    _msg = __doGetI18nFormatMessage(context, "ymp.validation.upload_file_max",
                            "{0} size must be lt {1}.", paramName, vUploadFile.max());
                } else {
                    _msg = __doGetI18nFormatMessage(context, "ymp.validation.upload_file_min",
                            "{0} size must be gt {1}.", paramName, vUploadFile.min());
                }
            }
        }
        return new ValidateResult(context.getParamName(), _msg);
    }
    return null;
}

From source file:net.ymate.module.mailsender.impl.DefaultModuleCfg.java

@SuppressWarnings("unchecked")
public DefaultModuleCfg(YMP owner) throws Exception {
    Map<String, String> _moduleCfgs = owner.getConfig().getModuleConfigs(IMailSender.MODULE_NAME);
    ///*w  w  w.j  a v a 2s  .  com*/
    if ((__mailSendProvider = ClassUtils.impl(_moduleCfgs.get("provider_class"), IMailSendProvider.class,
            this.getClass())) == null) {
        __mailSendProvider = new DefaultMailSendProvider();
    }
    //
    __threadPoolSize = BlurObject.bind(_moduleCfgs.get("thread_pool_size")).toIntValue();
    if (__threadPoolSize <= 0) {
        __threadPoolSize = Runtime.getRuntime().availableProcessors();
    }
    //
    __defaultServerName = StringUtils.defaultIfBlank(_moduleCfgs.get("default_server_name"), "default");
    //
    __templatePath = RuntimeUtils.replaceEnvVariable(
            StringUtils.defaultIfBlank(_moduleCfgs.get("template_path"), "${root}/mail_templates/"));
    //
    String _defaultDisplayName = StringUtils.trimToNull(_moduleCfgs.get("default_display_name"));
    String _defaultFromAddr = StringUtils.trimToNull(_moduleCfgs.get("default_from_addr"));
    boolean _debugEnabled = BlurObject.bind(_moduleCfgs.get("debug_enabled")).toBooleanValue();
    //
    __mailSendServerCfgs = new HashMap<String, MailSendServerCfgMeta>();
    String _serverNameStr = StringUtils.defaultIfBlank(_moduleCfgs.get("server_name_list"), "default");
    if (StringUtils.contains(_serverNameStr, __defaultServerName)) {
        String[] _serverNameList = StringUtils.split(_serverNameStr, "|");
        for (String _serverName : _serverNameList) {
            String _prefix = "server.".concat(_serverName);
            boolean _needAuth = BlurObject.bind(_moduleCfgs.get(_prefix.concat(".need_auth"))).toBooleanValue();
            boolean _tlsEnabled = BlurObject.bind(_moduleCfgs.get(_prefix.concat(".tls_enabled")))
                    .toBooleanValue();
            MailSendServerCfgMeta _meta;
            if (_needAuth) {
                String _smtpPassword = _moduleCfgs.get(_prefix.concat(".smtp_password"));
                if (BlurObject.bind(_moduleCfgs.get(_prefix.concat(".password_encrypted"))).toBooleanValue()) {
                    IPasswordProcessor _processor = ClassUtils.impl(
                            _moduleCfgs.get(_prefix.concat(".password_class")), IPasswordProcessor.class,
                            this.getClass());
                    if (_processor == null) {
                        _processor = owner.getConfig().getDefaultPasswordClass().newInstance();
                    }
                    _smtpPassword = _processor.decrypt(_smtpPassword);
                }
                _meta = new MailSendServerCfgMeta(_serverName, _moduleCfgs.get(_prefix.concat(".smtp_host")),
                        _tlsEnabled, _moduleCfgs.get(_prefix.concat(".smtp_username")), _smtpPassword);
            } else {
                _meta = new MailSendServerCfgMeta(_serverName, _moduleCfgs.get(_prefix.concat(".smtp_host")),
                        _tlsEnabled);
            }
            _meta.setDebugEnabled(_debugEnabled);
            _meta.setDisplayName(StringUtils.defaultIfBlank(_moduleCfgs.get(_prefix.concat(".display_name")),
                    _defaultDisplayName));
            _meta.setFromAddr(StringUtils.defaultIfBlank(_moduleCfgs.get(_prefix.concat(".from_addr")),
                    _defaultFromAddr));
            if (_tlsEnabled) {
                _meta.setSocketFactoryClassName(
                        StringUtils.defaultIfBlank(_moduleCfgs.get(_prefix.concat(".socket_factory_class")),
                                "javax.net.ssl.SSLSocketFactory"));
                _meta.setSocketFactoryFallback(BlurObject
                        .bind(_moduleCfgs.get(_prefix.concat(".socket_factory_fallback"))).toBooleanValue());
            }
            __mailSendServerCfgs.put(_serverName, _meta);
        }
    } else {
        throw new IllegalArgumentException("The default mail server name does not match");
    }
}

From source file:net.ymate.module.sso.controller.SSOTokenController.java

/**
 * <p>/* ww  w.  j  a  v a 2s  . c  om*/
 * ?SSO?SSO??webmvc.redirect_login_url=sso/authorize?redirect_url=${redirect_url}??????????
 * </p>
 *
 * @param redirectUrl ??URL?
 * @return ???SSO(??)
 * @throws Exception ?
 */
@RequestMapping("/authorize")
@Before(UserSessionStatusInterceptor.class)
public IView __toAuthorize(@RequestParam(Type.Const.REDIRECT_URL) String redirectUrl) throws Exception {
    if (StringUtils.isBlank(redirectUrl) || StringUtils.contains(redirectUrl, "/sso/authorize")) {
        return HttpStatusView.METHOD_NOT_ALLOWED;
    }
    if (UserSessionBean.current() != null) {
        return View.redirectView(redirectUrl);
    }
    //
    if (SSO.get().getModuleCfg().isClientMode()) {
        Map<String, String> _params = new HashMap<String, String>();
        _params.put(Type.Const.REDIRECT_URL, redirectUrl);
        // ???
        return View.redirectView(ParamUtils.appendQueryParamValue(
                SSO.get().getModuleCfg().getServiceBaseUrl().concat("sso/authorize"), _params, true,
                WebContext.getContext().getOwner().getModuleCfg().getDefaultCharsetEncoding()));
    }
    //
    ISSOToken _token = SSO.get().currentToken();
    if (_token != null) {
        Map<String, String> _params = new HashMap<String, String>();
        _params.put(SSO.get().getModuleCfg().getTokenParamName(),
                SSO.get().getModuleCfg().getTokenAdapter().encryptToken(_token));
        // ????redirectUrl??token?
        return View.redirectView(ParamUtils.appendQueryParamValue(redirectUrl, _params, true,
                WebContext.getContext().getOwner().getModuleCfg().getDefaultCharsetEncoding()));
    }
    // ????
    String _redirectUrl = WebUtils
            .buildRedirectURL(null, WebContext.getRequest(),
                    StringUtils.defaultIfBlank(WebContext.getContext().getOwner().getOwner().getConfig()
                            .getParam(Optional.REDIRECT_LOGIN_URL), "login?redirect_url=${redirect_url}"),
                    true);
    _redirectUrl = ExpressionUtils.bind(_redirectUrl)
            .set(Type.Const.REDIRECT_URL, WebUtils.encodeURL(redirectUrl)).getResult();
    return View.redirectView(_redirectUrl);
}

From source file:net.ymate.module.webproxy.WebProxy.java

private String __doParseContentBody(HttpURLConnection _conn, byte[] _content, String charset) throws Exception {
    if (StringUtils.contains(_conn.getHeaderField("Content-Encoding"), "gzip")) {
        ByteArrayInputStream _input = null;
        GZIPInputStream _gzip = null;
        ByteArrayOutputStream _output = null;
        try {// w  w w .  j a v a 2 s .c om
            _input = new ByteArrayInputStream(_content);
            _gzip = new GZIPInputStream(_input);
            _output = new ByteArrayOutputStream();
            //
            IOUtils.copyLarge(_gzip, _output);
            return new String(_output.toByteArray(), charset);
        } finally {
            IOUtils.closeQuietly(_output);
            IOUtils.closeQuietly(_gzip);
            IOUtils.closeQuietly(_input);
        }
    }
    return new String(_content, charset);
}

From source file:net.ymate.module.webproxy.WebProxy.java

@SuppressWarnings("unchecked")
public void transmission(HttpServletRequest request, HttpServletResponse response, String url,
        Type.HttpMethod method) throws Exception {
    StopWatch _consumeTime = null;//from  ww w  .  ja  v  a 2  s. c  om
    long _threadId = 0;
    if (_LOG.isDebugEnabled()) {
        _consumeTime = new StopWatch();
        _consumeTime.start();
        _threadId = Thread.currentThread().getId();
        _LOG.debug("-------------------------------------------------");
        _LOG.debug("--> [" + _threadId + "] URL: " + url);
    }
    //
    HttpURLConnection _conn = null;
    try {
        if (__moduleCfg.isUseProxy()) {
            _conn = (HttpURLConnection) new URL(url).openConnection(__moduleCfg.getProxy());
        } else {
            _conn = (HttpURLConnection) new URL(url).openConnection();
        }
        _conn.setUseCaches(__moduleCfg.isUseCaches());
        _conn.setInstanceFollowRedirects(__moduleCfg.isInstanceFollowRedirects());
        //
        boolean _postFlag = Type.HttpMethod.POST.equals(method);
        boolean _multipartFlag = _postFlag && StringUtils.contains(request.getContentType(), "multipart/");
        if (_postFlag) {
            _conn.setDoOutput(true);
            _conn.setDoInput(true);
            _conn.setRequestMethod(method.name());
        }
        if (__moduleCfg.getConnectTimeout() > 0) {
            _conn.setConnectTimeout(__moduleCfg.getConnectTimeout());
        }
        if (__moduleCfg.getReadTimeout() > 0) {
            _conn.setReadTimeout(__moduleCfg.getReadTimeout());
        }
        //
        if (_LOG.isDebugEnabled()) {
            _LOG.debug("--> [" + _threadId + "] Method: " + method.name());
            _LOG.debug("--> [" + _threadId + "] Request Headers: ");
        }
        //
        Enumeration _header = request.getHeaderNames();
        while (_header.hasMoreElements()) {
            String _name = (String) _header.nextElement();
            String _value = request.getHeader(_name);
            boolean _flag = false;
            if (_postFlag && StringUtils.equalsIgnoreCase(_name, "content-type")
                    || __moduleCfg.isTransferHeaderEnabled()
                            && (!__moduleCfg.getTransferHeaderBlackList().isEmpty()
                                    && !__moduleCfg.getTransferHeaderBlackList().contains(_name)
                                    || !__moduleCfg.getTransferHeaderWhiteList().isEmpty()
                                            && __moduleCfg.getTransferHeaderWhiteList().contains(_name))) {
                _conn.setRequestProperty(_name, _value);
                _flag = true;
            }
            //
            if (_LOG.isDebugEnabled()) {
                _LOG.debug("--> [" + _threadId + "] \t " + (_flag ? " - " : " > ") + _name + ": " + _value);
            }
        }
        _conn.connect();
        //
        if (_postFlag) {
            DataOutputStream _output = new DataOutputStream(_conn.getOutputStream());
            try {
                if (_multipartFlag) {
                    if (_LOG.isDebugEnabled()) {
                        _LOG.debug("--> [" + _threadId + "] Multipart: TRUE");
                    }
                    IOUtils.copyLarge(request.getInputStream(), _output);
                } else {
                    String _charset = request.getCharacterEncoding();
                    String _queryStr = ParamUtils.buildQueryParamStr(request.getParameterMap(), true, _charset);
                    IOUtils.write(_queryStr, _output, _charset);
                    //
                    if (_LOG.isDebugEnabled()) {
                        _LOG.debug("--> [" + _threadId + "] Request Parameters: ");
                        Map<String, String> _paramsMap = ParamUtils.parseQueryParamStr(_queryStr, true,
                                _charset);
                        for (Map.Entry<String, String> _param : _paramsMap.entrySet()) {
                            _LOG.debug("--> [" + _threadId + "] \t - " + _param.getKey() + ": "
                                    + _param.getValue());
                        }
                    }
                }
                _output.flush();
            } finally {
                IOUtils.closeQuietly(_output);
            }
        }
        //
        int _code = _conn.getResponseCode();
        //
        if (_LOG.isDebugEnabled()) {
            _LOG.debug("--> [" + _threadId + "] Response Code: " + _code);
            _LOG.debug("--> [" + _threadId + "] Response Headers: ");
        }
        //
        Map<String, List<String>> _headers = _conn.getHeaderFields();
        for (Map.Entry<String, List<String>> _entry : _headers.entrySet()) {
            if (_entry.getKey() != null) {
                boolean _flag = false;
                String _values = StringUtils.join(_entry.getValue(), ",");
                if (StringUtils.equalsIgnoreCase(_entry.getKey(), "content-type")
                        || __moduleCfg.isTransferHeaderEnabled()
                                && !__moduleCfg.getResponseHeaderWhileList().isEmpty()
                                && __moduleCfg.getResponseHeaderWhileList().contains(_entry.getKey())) {
                    response.setHeader(_entry.getKey(), _values);
                    _flag = true;
                }
                if (_LOG.isDebugEnabled()) {
                    _LOG.debug("--> [" + _threadId + "] \t " + (_flag ? " - " : " > ") + _entry.getKey() + ": "
                            + _values);
                }
            }
        }
        if (HttpURLConnection.HTTP_BAD_REQUEST <= _conn.getResponseCode()) {
            response.sendError(_code);
        } else {
            if (HttpURLConnection.HTTP_OK == _code) {
                InputStream _inputStream = _conn.getInputStream();
                if (_inputStream != null) {
                    if (!_multipartFlag) {
                        byte[] _content = IOUtils.toByteArray(_inputStream);
                        IOUtils.write(_content, response.getOutputStream());
                        //
                        if (_LOG.isDebugEnabled()) {
                            _LOG.debug("--> [" + _threadId + "] Response Content: " + __doParseContentBody(
                                    _conn, _content, WebMVC.get().getModuleCfg().getDefaultCharsetEncoding()));
                        }
                    } else {
                        IOUtils.copyLarge(_conn.getInputStream(), response.getOutputStream());
                        //
                        if (_LOG.isDebugEnabled()) {
                            _LOG.debug("--> [" + _threadId + "] Response Content: MultipartBody");
                        }
                    }
                } else if (_LOG.isDebugEnabled()) {
                    _LOG.debug("--> [" + _threadId + "] Response Content: NULL");
                }
                response.flushBuffer();
            } else {
                InputStream _inputStream = _conn.getInputStream();
                if (_inputStream != null) {
                    byte[] _content = IOUtils.toByteArray(_inputStream);
                    IOUtils.write(_content, response.getOutputStream());
                    //
                    if (_LOG.isDebugEnabled()) {
                        _LOG.debug("--> [" + _threadId + "] Response Content: " + __doParseContentBody(_conn,
                                _content, WebMVC.get().getModuleCfg().getDefaultCharsetEncoding()));
                    }
                } else if (_LOG.isDebugEnabled()) {
                    _LOG.debug("--> [" + _threadId + "] Response Content: NULL");
                }
                response.setStatus(_code);
                response.flushBuffer();
            }
        }
    } catch (Throwable e) {
        _LOG.warn("An exception occurred while processing request mapping '" + url + "': ",
                RuntimeUtils.unwrapThrow(e));
    } finally {
        IOUtils.close(_conn);
        //
        if (_LOG.isDebugEnabled()) {
            if (_consumeTime != null) {
                _consumeTime.stop();
                _LOG.debug("--> [" + _threadId + "] Total execution time: " + _consumeTime.getTime() + "ms");
            }
            _LOG.debug("-------------------------------------------------");
        }
    }
}

From source file:net.ymate.platform.persistence.base.EntityMeta.java

/**
 * ????JavaBean?<br>//from  w ww . ja  v a 2 s.  c  o m
 * ??"user_name"?"UserName"<br>
 *
 * @param propertyName ??
 * @return ?JavaBean?
 */
public static String propertyNameToFieldName(String propertyName) {
    if (StringUtils.contains(propertyName, '_')) {
        String[] _words = StringUtils.split(propertyName, '_');
        if (_words != null) {
            if (_words.length > 1) {
                StringBuilder _returnBuilder = new StringBuilder();
                for (String _word : _words) {
                    _returnBuilder.append(StringUtils.capitalize(_word.toLowerCase()));
                }
                return _returnBuilder.toString();
            }
            return StringUtils.capitalize(_words[0].toLowerCase());
        }
    }
    return propertyName;
}

From source file:net.ymate.platform.persistence.base.EntityMeta.java

/**
 * JavaBean????<br>//from  w  w  w  .  ja v  a2  s .  c o  m
 * ??"userName"?"user_name"<br>
 *
 * @param fieldName  ??
 * @param capitalize ???(?0-?1-?1-)
 * @return ?
 */
public static String fieldNameToPropertyName(String fieldName, int capitalize) {
    if (StringUtils.isNotBlank(fieldName) && !StringUtils.contains(fieldName, '_')) {
        String _currStr = fieldName.substring(0, 1);
        _currStr = capitalize <= 0 ? _currStr.toLowerCase() : _currStr.toUpperCase();
        StringBuilder _returnBuilder = new StringBuilder(_currStr);
        for (int _idx = 1; _idx < fieldName.length(); _idx++) {
            _currStr = fieldName.substring(_idx, _idx + 1);
            if (_currStr.equals(_currStr.toUpperCase()) && !Character.isDigit(_currStr.charAt(0))) {
                _returnBuilder.append("_");
                _currStr = capitalize > 0 ? _currStr.toUpperCase() : _currStr.toLowerCase();
            } else {
                _currStr = capitalize > 1 ? _currStr.toUpperCase() : _currStr.toLowerCase();
            }
            _returnBuilder.append(_currStr);
        }
        return _returnBuilder.toString();
    }
    return fieldName;
}

From source file:net.ymate.platform.persistence.jdbc.impl.DefaultModuleCfg.java

public DefaultModuleCfg(YMP owner) throws Exception {
    Map<String, String> _moduleCfgs = owner.getConfig().getModuleConfigs(IDatabase.MODULE_NAME);
    ////  w  w  w.jav  a 2 s .  c om
    this.dataSourceDefaultName = StringUtils.defaultIfBlank(_moduleCfgs.get("ds_default_name"), "default");
    //
    this.dataSourceCfgMetas = new HashMap<String, DataSourceCfgMeta>();
    String _dsNameStr = StringUtils.defaultIfBlank(_moduleCfgs.get("ds_name_list"), "default");
    if (StringUtils.contains(_dsNameStr, this.dataSourceDefaultName)) {
        String[] _dsNameList = StringUtils.split(_dsNameStr, "|");
        for (String _dsName : _dsNameList) {
            DataSourceCfgMeta _meta = __doParserDataSourceCfgMeta(_dsName, _moduleCfgs);
            if (_meta != null) {
                this.dataSourceCfgMetas.put(_dsName, _meta);
            }
        }
    } else {
        throw new IllegalArgumentException("The default datasource name does not match");
    }
}

From source file:net.ymate.platform.persistence.jdbc.scaffold.EntityGenerator.java

/**
 * ??/*from ww  w  . jav a 2  s  .c o  m*/
 */
public void createEntityClassFiles() {
    Map<String, Object> _propMap = buildPropMap();
    //
    boolean _isUseBaseEntity = BlurObject.bind(__owner.getConfig().getParam("jdbc.use_base_entity"))
            .toBooleanValue();
    boolean _isUseClassSuffix = BlurObject.bind(__owner.getConfig().getParam("jdbc.use_class_suffix"))
            .toBooleanValue();
    boolean _isUseChainMode = BlurObject.bind(__owner.getConfig().getParam("jdbc.use_chain_mode"))
            .toBooleanValue();
    boolean _isUseStateSupport = BlurObject.bind(__owner.getConfig().getParam("jdbc.use_state_support"))
            .toBooleanValue();
    _propMap.put("isUseBaseEntity", _isUseBaseEntity);
    _propMap.put("isUseClassSuffix", _isUseClassSuffix);
    _propMap.put("isUseChainMode", _isUseChainMode);
    _propMap.put("isUseStateSupport", _isUseStateSupport);
    if (_isUseBaseEntity) {
        buildTargetFile("/model/BaseEntity.java", "/BaseEntity.ftl", _propMap);
    }
    //
    List<String> _tableList = Arrays.asList(StringUtils
            .split(StringUtils.defaultIfBlank(__owner.getConfig().getParam("jdbc.table_list"), ""), "|"));
    if (_tableList.isEmpty()) {
        _tableList = getTableNames();
    }
    //
    String _dbName = __owner.getConfig().getParam("jdbc.db_name");
    String _dbUser = __owner.getConfig().getParam("jdbc.db_username");
    String[] _prefixs = StringUtils
            .split(StringUtils.defaultIfBlank(__owner.getConfig().getParam("jdbc.table_prefix"), ""), '|');
    boolean _isRemovePrefix = new BlurObject(__owner.getConfig().getParam("jdbc.remove_table_prefix"))
            .toBooleanValue();
    List<String> _tableExcludeList = Arrays.asList(StringUtils.split(StringUtils
            .defaultIfBlank(__owner.getConfig().getParam("jdbc.table_exclude_list"), "").toLowerCase(), "|"));
    for (String _tableName : _tableList) {
        // ???
        if (!_tableExcludeList.isEmpty()) {
            if (_tableExcludeList.contains(_tableName.toLowerCase())) {
                continue;
            } else {
                boolean _flag = false;
                for (String _excludedName : _tableExcludeList) {
                    if (StringUtils.contains(_excludedName, "*") && StringUtils.startsWithIgnoreCase(_tableName,
                            StringUtils.substringBefore(_excludedName, "*"))) {
                        _flag = true;
                        break;
                    }
                }
                if (_flag) {
                    continue;
                }
            }
        }
        TableMeta _tableMeta = getTableMeta(_dbName, _dbUser, _tableName);
        if (_tableMeta != null) {
            String _modelName = null;
            for (String _prefix : _prefixs) {
                if (_tableName.startsWith(_prefix)) {
                    if (_isRemovePrefix) {
                        _tableName = _tableName.substring(_prefix.length());
                    }
                    _modelName = StringUtils.capitalize(EntityMeta.propertyNameToFieldName(_tableName));
                    break;
                }
            }
            if (StringUtils.isBlank(_modelName)) {
                _modelName = StringUtils.capitalize(EntityMeta.propertyNameToFieldName(_tableName));
            }
            //
            _propMap.put("tableName", _tableName);
            _propMap.put("modelName", _modelName);
            List<Attr> _fieldList = new ArrayList<Attr>(); // 
            List<Attr> _fieldListForNotNullable = new ArrayList<Attr>(); // ?
            List<Attr> _allFieldList = new ArrayList<Attr>(); // ????
            if (_tableMeta.getPkSet().size() > 1) {
                _propMap.put("primaryKeyType", _modelName + "PK");
                _propMap.put("primaryKeyName",
                        StringUtils.uncapitalize((String) _propMap.get("primaryKeyType")));
                List<Attr> _primaryKeyList = new ArrayList<Attr>();
                _propMap.put("primaryKeyList", _primaryKeyList);
                Attr _pkAttr = new Attr((String) _propMap.get("primaryKeyType"),
                        (String) _propMap.get("primaryKeyName"), null, false, false, 0, 0, 0, null, null);
                _fieldList.add(_pkAttr);
                _fieldListForNotNullable.add(_pkAttr);
                //
                for (String pkey : _tableMeta.getPkSet()) {
                    ColumnInfo _ci = _tableMeta.getFieldMap().get(pkey);
                    _primaryKeyList.add(_ci.toAttr());
                    _allFieldList.add(new Attr("String", _ci.getColumnName().toUpperCase(), _ci.getColumnName(),
                            _ci.isAutoIncrement(), _ci.isSigned(), _ci.getPrecision(), _ci.getScale(),
                            _ci.getNullable(), _ci.getDefaultValue(), _ci.getRemarks()));
                }
                for (String key : _tableMeta.getFieldMap().keySet()) {
                    if (_tableMeta.getPkSet().contains(key)) {
                        continue;
                    }
                    ColumnInfo _ci = _tableMeta.getFieldMap().get(key);
                    Attr _attr = _ci.toAttr();
                    _fieldList.add(_attr);
                    _fieldListForNotNullable.add(_attr);
                    _allFieldList.add(new Attr("String", _ci.getColumnName().toUpperCase(), _ci.getColumnName(),
                            _ci.isAutoIncrement(), _ci.isSigned(), _ci.getPrecision(), _ci.getScale(),
                            _ci.getNullable(), _ci.getDefaultValue(), _ci.getRemarks()));
                }
            } else {
                _propMap.put("primaryKeyType",
                        _tableMeta.getFieldMap().get(_tableMeta.getPkSet().get(0)).getColumnType());
                _propMap.put("primaryKeyName", StringUtils
                        .uncapitalize(EntityMeta.propertyNameToFieldName(_tableMeta.getPkSet().get(0))));
                for (String key : _tableMeta.getFieldMap().keySet()) {
                    ColumnInfo _ci = _tableMeta.getFieldMap().get(key);
                    Attr _attr = _ci.toAttr();
                    _fieldList.add(_attr);
                    if (_attr.getNullable() == 0) {
                        _fieldListForNotNullable.add(_attr);
                    }
                    _allFieldList.add(new Attr("String", _ci.getColumnName().toUpperCase(), _ci.getColumnName(),
                            _ci.isAutoIncrement(), _ci.isSigned(), _ci.getPrecision(), _ci.getScale(),
                            _ci.getNullable(), _ci.getDefaultValue(), _ci.getRemarks()));
                }
            }
            _propMap.put("fieldList", _fieldList);
            // ??????
            _propMap.put("notNullableFieldList",
                    _fieldList.size() == _fieldListForNotNullable.size() ? Collections.emptyList()
                            : _fieldListForNotNullable);
            _propMap.put("allFieldList", _allFieldList);
            //
            buildTargetFile("/model/" + _modelName + (_isUseClassSuffix ? "Model.java" : ".java"),
                    "/Entity.ftl", _propMap);
            //
            if (_tableMeta.getPkSet().size() > 1) {
                _propMap.put("modelName", _modelName);
                if (_tableMeta.getPkSet().size() > 1) {
                    List<Attr> _primaryKeyList = new ArrayList<Attr>();
                    _propMap.put("primaryKeyList", _primaryKeyList);
                    //
                    for (String pkey : _tableMeta.getPkSet()) {
                        ColumnInfo _ci = _tableMeta.getFieldMap().get(pkey);
                        _primaryKeyList.add(_ci.toAttr());
                    }
                }
                buildTargetFile("/model/" + _modelName + "PK.java", "/EntityPK.ftl", _propMap);
            }
        }
    }
}