// ----------------------------------------------------- // filter // ------ protected void filterCommonColumnSetupValue(Map<String, Object> map) { final String allcommonExp = "$$allcommon$$"; final String accessContextExp = "$$AccessContext$$"; final String accessDateExp = accessContextExp + ".getAccessDateOnThread()"; final String accessTimestampExp = accessContextExp + ".getAccessTimestampOnThread()"; final String baseCommonPackage = getBasicProperties().getBaseCommonPackage(); final Set<String> keySet = map.keySet(); for (String key : keySet) { String value = (String) map.get(key); if (value != null && value.contains(allcommonExp)) { value = DfStringUtil.replace(value, allcommonExp, baseCommonPackage); } value = doFilterJava8TimeLocalDate(accessDateExp, accessTimestampExp, value); if (value != null && value.contains(accessContextExp)) { final String accessContext = getAccessContextFqcn(); value = DfStringUtil.replace(value, accessContextExp, accessContext); } final String prefixMark = COMMON_COLUMN_SETUP_RESOURCE_PREFIX_MARK; final String secondMark = COMMON_COLUMN_SETUP_RESOURCE_SECOND_MARK; final String variablePrefix = COMMON_COLUMN_SETUP_RESOURCE_VARIABLE_PREFIX; if (value != null && value.startsWith(prefixMark)) { final boolean valid = setupCommonColumnSetupResource(value); if (valid) { final String tmp = value.substring(prefixMark.length()); value = variablePrefix + tmp.substring(tmp.indexOf(secondMark) + secondMark.length()); } } map.put(key, value); } }
// =================================================================================== // Main // ==== public String getPackageAsPath(String pckge) { if (pckge == null) { String msg = "The argument 'pckge' should not be null."; throw new IllegalArgumentException(msg); } final String omitDirectoryPackage = _basicProperties != null ? _basicProperties.getOmitDirectoryPackage() : null; if (omitDirectoryPackage != null && omitDirectoryPackage.trim().length() > 0) { pckge = removeOmitPackage(pckge, omitDirectoryPackage); } final String flatDirectoryPackage = _basicProperties != null ? _basicProperties.getFlatDirectoryPackage() : null; if (flatDirectoryPackage == null || flatDirectoryPackage.trim().length() == 0) { return resolvePackageAsPath(pckge); } if (!pckge.contains(flatDirectoryPackage)) { return resolvePackageAsPath(pckge); } final String flatMark = "$$df:flatMark$$"; pckge = DfStringUtil.replace(pckge, flatDirectoryPackage, flatMark); pckge = resolvePackageAsPath(pckge); pckge = DfStringUtil.replace(pckge, flatMark, flatDirectoryPackage); return pckge; }
// =================================================================================== // General Helper // ============== public String replaceString(String text, String fromText, String toText) { return DfStringUtil.replace(text, fromText, toText); }