List of usage examples for java.lang StringBuilder charAt
char charAt(int index);
From source file:com.cohort.util.String2.java
/** * This is like encodeMatlabNameSafe, but simpler and won't always retain all the info. * <ul>//from w w w. j a va 2 s . c o m * <li>first character must be A-Z, a-z. * <li>subsequent characters must be A-Z, a-z, _, 0-9. * </ul> * <br>non-safe characters are some safe variant. * <br>See posix fully portable file names at https://en.wikipedia.org/wiki/Filename . * <br>When the encoding is more than 25 characters, this stops encoding and * adds "xh" and the hash code for the entire original string, * so the result will always be less than ~41 characters. * <br>This meets MatLab restrictions: * https://www.mathworks.com/help/matlab/ref/matlab.lang.makevalidname.html * * <p>THIS WON'T BE CHANGED. SOME datasetIDs DEPEND ON SAME ENCODING OVER TIME. * * @param s * @return s with all of the non-variableNameSafe characters changed. * <br>If s is null, this returns "null_". * <br>If s is "", this returns "nothing_". */ public static String simpleMatlabNameSafe(String s) { if (s == null) return "null_"; int n = s.length(); if (n == 0) return "nothing_"; s = modifyToBeASCII(s); StringBuilder sb = new StringBuilder(4 * Math.min(50, n) / 3); for (int i = 0; i < n; i++) { if (sb.length() >= 25) { sb.append("_" + md5Hex12(s)); //was Math2.reduceHashCode(s.hashCode())); break; } char ch = s.charAt(i); if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) { //1st chars sb.append(ch); } else if (sb.length() > 0 && ch >= '0' && ch <= '9') { //subsequent chars sb.append(ch); //all other chars get converted to '_' //but '_' can't be first char and no two '_' in a row } else if (sb.length() > 0 && sb.charAt(sb.length() - 1) != '_') { sb.append('_'); } } if (sb.length() == 0) sb.append("a_"); return sb.toString(); }
From source file:com.quinsoft.epamms.ZGlobal1_Operation.java
public void SetFirstCharacterCase(StringBuilder sbTarget, int bUpper) { if (sbTarget.length() > 0) { char ch;/*from w w w .ja v a2 s . c om*/ if (bUpper != 0) { ch = Character.toUpperCase(sbTarget.charAt(0)); } else { ch = Character.toLowerCase(sbTarget.charAt(0)); } sbTarget.setCharAt(0, ch); } }
From source file:com.quinsoft.epamms.ZGlobal1_Operation.java
public int RemoveLeadingBlanksFromAttrib(View view, String stringEntity, String stringAttribute) { StringBuilder sb = new StringBuilder(256); MutableInt i = new MutableInt(0); int k;/*from w w w. j a va 2 s . c om*/ // Remove any leading blanks from the attribute. GetVariableFromAttribute(sb, i, zTYPE_STRING, 253, view, stringEntity, stringAttribute, "", 0); if (sb.charAt(0) == ' ') { k = 1; while (sb.charAt(k) == ' ') k++; SetAttributeFromString(view, stringEntity, stringAttribute, sb.substring(k)); } return 0; }
From source file:com.quinsoft.zencas.ZGLOBAL1_Operation.java
public int InsertOI_DataIntoTemplateFile(View view, View workView, String toFile, String fromFile, String stringRootEntityName) throws IOException { BufferedWriter bw;// ww w . jav a2 s .c o m StringBuilder sbInsertTemplate = new StringBuilder(); StringBuilder sbRawTemplate = new StringBuilder(); StringBuilder sbEntityBuffer; StringBuilder sbAttributeBuffer; String swapString = null; String stringStart = "{"; String stringEnd = "}"; int nRC = 0; int lSelectedCount = 0; int lTemplateLth = 0; nRC = SetCursorFirstEntity(workView, stringRootEntityName, ""); while (nRC > zCURSOR_UNCHANGED) { lSelectedCount++; nRC = SetCursorNextEntity(workView, stringRootEntityName, ""); } if (lSelectedCount <= 0) return 0; lTemplateLth = ReadFileDataIntoMemory(workView, fromFile, lTemplateLth, sbRawTemplate); if (lTemplateLth > Integer.MAX_VALUE) return 0; // File not found. if (lTemplateLth < 0) return -1; swapString = sbRawTemplate.substring(1, (lTemplateLth - 1)); lTemplateLth = swapString.length(); sbRawTemplate = new StringBuilder(); nRC = SetCursorFirstEntity(workView, stringRootEntityName, ""); while (nRC > zCURSOR_UNCHANGED) { sbRawTemplate.insert(0, swapString); for (int i = 0; i < sbRawTemplate.length(); i++) { sbEntityBuffer = new StringBuilder(); sbAttributeBuffer = new StringBuilder(); if (sbRawTemplate.charAt(i) == '[' && sbRawTemplate.charAt(i + 1) == 'Z') { int j = i; i += 2; while (sbRawTemplate.charAt(++i) != '.') sbEntityBuffer.append(sbRawTemplate.charAt(i)); while (sbRawTemplate.charAt(++i) != ']') sbAttributeBuffer.append(sbRawTemplate.charAt(i)); i++; sbRawTemplate.replace(j, i, GetStringFromAttribute(workView, sbEntityBuffer.toString(), sbAttributeBuffer.toString())); } } sbInsertTemplate.append(sbRawTemplate); sbRawTemplate = new StringBuilder(); nRC = SetCursorNextEntity(workView, stringRootEntityName, ""); } sbInsertTemplate.insert(0, stringStart); sbInsertTemplate.append(stringEnd); bw = new BufferedWriter(new FileWriter(toFile)); bw.write(sbInsertTemplate.toString()); bw.flush(); bw.close(); return 0; }
From source file:com.quinsoft.zeidon.vml.VmlOperation.java
public static int AppendPathSeparator(StringBuilder sbDirectoryName) { char pathSeparator = File.separatorChar; char replaceCharacter = pathSeparator == '/' ? '\\' : '/'; String s = sbDirectoryName.toString(); s = s.replace(replaceCharacter, pathSeparator); int nLth = s.length(); sbDirectoryName.setLength(0); // Use sb.setLength( 0 ); to clear a string buffer. sbDirectoryName.append(s);/*from w ww . j a v a 2 s . com*/ if (nLth > 1 && sbDirectoryName.charAt(nLth - 1) != pathSeparator) { sbDirectoryName.insert(nLth++, pathSeparator); } return nLth; }
From source file:com.wabacus.config.database.type.Oracle.java
public void constructInsertSql(String configInsertSql, ReportBean rbean, String reportTypeKey, SQLInsertAction insertSqlAction, List<AbsUpdateAction> lstActionsResult) { int idxwhere = configInsertSql.toLowerCase().indexOf(" where "); if (idxwhere < 0) { super.constructInsertSql(configInsertSql, rbean, reportTypeKey, insertSqlAction, lstActionsResult); return;/*w w w . ja v a 2s . c o m*/ } String whereclause = configInsertSql.substring(idxwhere).trim(); if (whereclause.equals("")) { super.constructInsertSql(configInsertSql, rbean, reportTypeKey, insertSqlAction, lstActionsResult); return; } insertSqlAction.setPreparedStatement(true); configInsertSql = configInsertSql.substring(0, idxwhere).trim(); List lstParams = new ArrayList(); StringBuilder sqlBuffer = new StringBuilder(); sqlBuffer.append("insert into "); configInsertSql = configInsertSql.substring("insert".length()).trim(); if (configInsertSql.toLowerCase().indexOf("into ") == 0) { configInsertSql = configInsertSql.substring("into".length()).trim(); } boolean isAutoReportData = insertSqlAction.getOwnerUpdateBean().isAutoReportdata(); Map<String, EditableReportParamBean> mLobParamsBean = new HashMap<String, EditableReportParamBean>(); String tablename = null; int idxleft = configInsertSql.indexOf("("); if (idxleft < 0 || configInsertSql.endsWith("()")) {//??????<col/> if (!isAutoReportData) { throw new WabacusConfigLoadingException("" + rbean.getPath() + "autoreportdatafalse<button/>??insert into table??SQL?"); } if (configInsertSql.endsWith("()")) configInsertSql = configInsertSql.substring(0, configInsertSql.length() - 2).trim(); tablename = configInsertSql; sqlBuffer.append(tablename).append("("); for (ColBean cbean : rbean.getDbean().getLstCols()) { EditableReportParamBean paramBean = insertSqlAction.createParamBeanByColbean(cbean.getProperty(), reportTypeKey, false, false); if (paramBean == null) continue; sqlBuffer.append(cbean.getColumn() + ","); lstParams.add( processLobTypeInsert(mLobParamsBean, cbean.getColumn(), paramBean, cbean.getDatatypeObj())); } } else { tablename = configInsertSql.substring(0, idxleft); sqlBuffer.append(tablename).append("("); int idxright = configInsertSql.lastIndexOf(")"); if (idxright != configInsertSql.length() - 1) { throw new WabacusConfigLoadingException("" + rbean.getPath() + "??SQL?" + configInsertSql + "??"); } String cols = configInsertSql.substring(idxleft + 1, idxright); List<String> lstInsertCols = Tools.parseStringToList(cols, ",", new String[] { "'", "'" }, false); String columnname = null; String columnvalue = null; ColBean cb; for (String configColPropertyTmp : lstInsertCols) { if (configColPropertyTmp == null || configColPropertyTmp.trim().equals("")) continue; int idxequals = configColPropertyTmp.indexOf("="); if (idxequals > 0) { columnname = configColPropertyTmp.substring(0, idxequals).trim(); columnvalue = configColPropertyTmp.substring(idxequals + 1).trim(); Object paramObjTmp = insertSqlAction.createEditParams(columnvalue, reportTypeKey); if (paramObjTmp == null) continue; sqlBuffer.append(columnname + ","); IDataType datatypeObj = null; if (Tools.isDefineKey("#", columnvalue)) {//<params/>??? datatypeObj = ((EditableReportExternalValueBean) ((EditableReportParamBean) paramObjTmp) .getOwner()).getTypeObj(); } else if (isAutoReportData && Tools.isDefineKey("@", columnvalue)) { datatypeObj = ((ColBean) ((EditableReportParamBean) paramObjTmp).getOwner()) .getDatatypeObj(); } lstParams.add(processLobTypeInsert(mLobParamsBean, columnname, paramObjTmp, datatypeObj)); } else { if (!Tools.isDefineKey("@", configColPropertyTmp)) { throw new WabacusConfigLoadingException("" + rbean.getPath() + "??SQL?" + configInsertSql + "??"); } if (isAutoReportData) { configColPropertyTmp = Tools.getRealKeyByDefine("@", configColPropertyTmp); String realColProperty = configColPropertyTmp.trim(); if (realColProperty.endsWith("__old")) realColProperty = realColProperty.substring(0, realColProperty.length() - "__old".length()); cb = rbean.getDbean().getColBeanByColProperty(realColProperty); if (cb == null) { throw new WabacusConfigLoadingException("" + rbean.getPath() + "??" + configColPropertyTmp + "???<col/>"); } sqlBuffer.append(cb.getColumn() + ","); lstParams.add(processLobTypeInsert(mLobParamsBean, cb.getColumn(), insertSqlAction .createParamBeanByColbean(configColPropertyTmp, reportTypeKey, true, true), cb.getDatatypeObj())); } else { ((EditableReportSQLButtonDataBean) insertSqlAction.getOwnerUpdateBean()) .setHasReportDataParams(true); EditableReportParamBean paramBean = new EditableReportParamBean(); paramBean.setParamname(configColPropertyTmp); sqlBuffer.append(Tools.getRealKeyByDefine("@", configColPropertyTmp) + ","); lstParams.add(paramBean); } } } } if (lstParams.size() == 0) { throw new WabacusConfigLoadingException("?" + rbean.getPath() + "sql?" + configInsertSql + "SQL???"); } if (sqlBuffer.charAt(sqlBuffer.length() - 1) == ',') sqlBuffer.deleteCharAt(sqlBuffer.length() - 1); sqlBuffer.append(") values("); List<EditableReportParamBean> lstCommonTypeParamsBean = new ArrayList<EditableReportParamBean>();//????clob?blog? for (int j = 0; j < lstParams.size(); j++) { if (lstParams.get(j) instanceof EditableReportParamBean) { sqlBuffer.append("?,"); lstCommonTypeParamsBean.add((EditableReportParamBean) lstParams.get(j)); } else { sqlBuffer.append(lstParams.get(j)).append(","); } } if (sqlBuffer.charAt(sqlBuffer.length() - 1) == ',') sqlBuffer.deleteCharAt(sqlBuffer.length() - 1); sqlBuffer.append(")"); insertSqlAction.setSqlsp(sqlBuffer.toString()); insertSqlAction.setLstParamBeans(lstCommonTypeParamsBean); lstActionsResult.add(insertSqlAction); if (mLobParamsBean.size() > 0) { List<EditableReportParamBean> lstParamsBean2 = new ArrayList<EditableReportParamBean>(); sqlBuffer = new StringBuilder("select "); for (Entry<String, EditableReportParamBean> entry : mLobParamsBean.entrySet()) { sqlBuffer.append(entry.getKey()).append(","); lstParamsBean2.add(entry.getValue()); } if (sqlBuffer.charAt(sqlBuffer.length() - 1) == ',') sqlBuffer.deleteCharAt(sqlBuffer.length() - 1); sqlBuffer.append(" from ").append(tablename); List<EditableReportParamBean> lstDynParamsInWhereClause = new ArrayList<EditableReportParamBean>(); whereclause = insertSqlAction.getOwnerUpdateBean().parseStandardEditSql(whereclause, lstDynParamsInWhereClause, reportTypeKey, true, false); lstParamsBean2.addAll(lstDynParamsInWhereClause); sqlBuffer.append(" ").append(whereclause).append(" for update"); insertSqlAction = insertSqlAction.cloneWithAllDefaultValues(); insertSqlAction.setSqlsp(sqlBuffer.toString()); insertSqlAction.setLstParamBeans(lstParamsBean2); insertSqlAction.setReturnValueParamname(null); lstActionsResult.add(insertSqlAction); } }
From source file:com.quinsoft.epamms.ZGlobal1_Operation.java
public int InsertOI_DataIntoTemplateFile(View view, View workView, String toFile, String fromFile, String stringRootEntityName) throws IOException { BufferedWriter bw;/*from ww w.jav a 2s.c o m*/ StringBuilder sbInsertTemplate = new StringBuilder(); StringBuilder sbRawTemplate = new StringBuilder(); StringBuilder sbEntityBuffer; StringBuilder sbAttributeBuffer; String swapString = null; String stringStart = "{"; String stringEnd = "}"; String szTmp = null; int nRC = 0; int lSelectedCount = 0; int lTemplateLth = 0; nRC = SetCursorFirstEntity(workView, stringRootEntityName, ""); while (nRC > zCURSOR_UNCHANGED) { lSelectedCount++; nRC = SetCursorNextEntity(workView, stringRootEntityName, ""); } if (lSelectedCount <= 0) return 0; lTemplateLth = ReadFileDataIntoMemory(workView, fromFile, lTemplateLth, sbRawTemplate); if (lTemplateLth > Integer.MAX_VALUE) return 0; // File not found. if (lTemplateLth < 0) return -1; swapString = sbRawTemplate.substring(1, (lTemplateLth - 1)); lTemplateLth = swapString.length(); sbRawTemplate = new StringBuilder(); nRC = SetCursorFirstEntity(workView, stringRootEntityName, ""); while (nRC > zCURSOR_UNCHANGED) { sbRawTemplate.insert(0, swapString); for (int i = 0; i < sbRawTemplate.length(); i++) { sbEntityBuffer = new StringBuilder(); sbAttributeBuffer = new StringBuilder(); if (sbRawTemplate.charAt(i) == '[' && sbRawTemplate.charAt(i + 1) == 'Z') { int j = i; i += 2; while (sbRawTemplate.charAt(++i) != '.') sbEntityBuffer.append(sbRawTemplate.charAt(i)); while (sbRawTemplate.charAt(++i) != ']') sbAttributeBuffer.append(sbRawTemplate.charAt(i)); i++; szTmp = sbRawTemplate.substring(j, i + 10).toString(); sbRawTemplate.replace(j, i, GetStringFromAttribute(workView, sbEntityBuffer.toString(), sbAttributeBuffer.toString())); szTmp = sbRawTemplate.substring(j, j + 12).toString(); } } sbInsertTemplate.append(sbRawTemplate); //szTmp = sbInsertTemplate.substring(87284, 87296).toString(); sbRawTemplate = new StringBuilder(); nRC = SetCursorNextEntity(workView, stringRootEntityName, ""); } sbInsertTemplate.insert(0, stringStart); sbInsertTemplate.append(stringEnd); //szTmp = sbInsertTemplate.substring(87285, 87297).toString(); szTmp = sbInsertTemplate.substring(13917, 13929).toString(); bw = new BufferedWriter(new FileWriter(toFile)); //bw.write(sbInsertTemplate.toString()); szTmp = sbInsertTemplate.toString(); bw.write(szTmp); bw.flush(); bw.close(); return 0; }
From source file:com.wabacus.config.database.type.Oracle.java
public List<SQLUpdateAction> constructUpdateSql(String configUpdateSql, ReportBean rbean, String reportTypeKey, SQLUpdateAction updateSqlAction) { if (!hasClobBlobColumn(configUpdateSql, rbean, reportTypeKey, updateSqlAction)) { return super.constructUpdateSql(configUpdateSql, rbean, reportTypeKey, updateSqlAction); }/* w w w . j a v a2 s. c o m*/ updateSqlAction.setPreparedStatement(true); StringBuilder sqlBuffer = new StringBuilder(); List<EditableReportParamBean> lstParamsBean = new ArrayList<EditableReportParamBean>(); Map<String, EditableReportParamBean> mLobParamsBean = new HashMap<String, EditableReportParamBean>(); boolean isAutoReportData = updateSqlAction.getOwnerUpdateBean().isAutoReportdata();//?????? int idxleft = configUpdateSql.indexOf("("); boolean hasNonLobTypeUpdateParams = false; if (idxleft < 0 || configUpdateSql.endsWith("()")) {//????<col/>?displaytypehidden<col/> if (!isAutoReportData) { throw new WabacusConfigLoadingException("" + rbean.getPath() + "autoreportdatafalse<button/>??insert into table??SQL?"); } if (configUpdateSql.endsWith("()")) configUpdateSql = configUpdateSql.substring(0, configUpdateSql.length() - 2); sqlBuffer.append(configUpdateSql).append(" set "); for (ColBean cbean : rbean.getDbean().getLstCols()) { EditableReportParamBean paramBean = updateSqlAction.createParamBeanByColbean(cbean.getProperty(), reportTypeKey, false, false); if (paramBean == null) continue; if (cbean.getDatatypeObj() instanceof ClobType || cbean.getDatatypeObj() instanceof BlobType) { mLobParamsBean.put(cbean.getColumn(), paramBean); } else { hasNonLobTypeUpdateParams = true; sqlBuffer.append(cbean.getColumn() + "=?,"); lstParamsBean.add(paramBean); } } } else { sqlBuffer.append(configUpdateSql.substring(0, idxleft)).append(" set "); int idxright = configUpdateSql.lastIndexOf(")"); if (idxright != configUpdateSql.length() - 1) { throw new WabacusConfigLoadingException("" + rbean.getPath() + "??SQL?" + configUpdateSql + "??"); } String cols = configUpdateSql.substring(idxleft + 1, idxright); List<String> lstUpdateCols = Tools.parseStringToList(cols, ",", new String[] { "'", "'" }, false); String columnname = null; String columnvalue = null; ColBean cb; for (String updatecol : lstUpdateCols) { if (updatecol == null || updatecol.trim().equals("")) continue; int idxequals = updatecol.indexOf("="); if (idxequals > 0) { columnname = updatecol.substring(0, idxequals).trim(); columnvalue = updatecol.substring(idxequals + 1).trim(); Object paramObjTmp = updateSqlAction.createEditParams(columnvalue, reportTypeKey); if (paramObjTmp == null) continue; IDataType datatypeObj = null; if (Tools.isDefineKey("#", columnvalue)) {//<params/>??? datatypeObj = ((EditableReportExternalValueBean) ((EditableReportParamBean) paramObjTmp) .getOwner()).getTypeObj(); } else if (isAutoReportData && Tools.isDefineKey("@", columnvalue)) { datatypeObj = ((ColBean) ((EditableReportParamBean) paramObjTmp).getOwner()) .getDatatypeObj(); } if (datatypeObj instanceof ClobType || datatypeObj instanceof BlobType) { mLobParamsBean.put(columnname, (EditableReportParamBean) paramObjTmp); } else { hasNonLobTypeUpdateParams = true; sqlBuffer.append(columnname + "="); if (paramObjTmp instanceof EditableReportParamBean) { sqlBuffer.append("?"); lstParamsBean.add((EditableReportParamBean) paramObjTmp); } else { sqlBuffer.append(paramObjTmp); } sqlBuffer.append(","); } } else { if (!Tools.isDefineKey("@", updatecol)) { throw new WabacusConfigLoadingException( "" + rbean.getPath() + "??SQL?" + configUpdateSql + "??@{}?"); } if (isAutoReportData) { updatecol = Tools.getRealKeyByDefine("@", updatecol); String realColProperty = updatecol.trim(); if (realColProperty.endsWith("__old")) realColProperty = realColProperty.substring(0, realColProperty.length() - "__old".length()); cb = rbean.getDbean().getColBeanByColProperty(realColProperty); if (cb == null) { throw new WabacusConfigLoadingException( "" + rbean.getPath() + "??" + updatecol + "???<col/>"); } EditableReportParamBean paramBean = updateSqlAction .createParamBeanByColbean(cb.getProperty(), reportTypeKey, true, true); if (cb.getDatatypeObj() instanceof ClobType || cb.getDatatypeObj() instanceof BlobType) { mLobParamsBean.put(cb.getColumn(), paramBean); } else { hasNonLobTypeUpdateParams = true; sqlBuffer.append(cb.getColumn() + "=?,"); lstParamsBean.add(paramBean); } } else { ((EditableReportSQLButtonDataBean) updateSqlAction.getOwnerUpdateBean()) .setHasReportDataParams(true); EditableReportParamBean paramBean = new EditableReportParamBean(); paramBean.setParamname(updatecol); sqlBuffer.append(Tools.getRealKeyByDefine("@", updatecol) + "=?,"); lstParamsBean.add(paramBean); } } } } if (sqlBuffer.charAt(sqlBuffer.length() - 1) == ',') sqlBuffer.deleteCharAt(sqlBuffer.length() - 1); List<SQLUpdateAction> lstUpdateSqlActions = new ArrayList<SQLUpdateAction>(); if (mLobParamsBean != null && mLobParamsBean.size() > 0) { String tablename = configUpdateSql.substring("update".length() + 1).trim(); if (tablename.indexOf("(") > 0) tablename = tablename.substring(0, tablename.indexOf("(")).trim(); List<EditableReportParamBean> lstParamsBean2 = new ArrayList<EditableReportParamBean>(); StringBuilder sqlSelectLob = new StringBuilder("select "); StringBuilder sqlUpdateLob = new StringBuilder("update "); sqlUpdateLob.append(tablename).append(" set "); for (Entry<String, EditableReportParamBean> entry : mLobParamsBean.entrySet()) { sqlSelectLob.append(entry.getKey()).append(","); lstParamsBean2.add(entry.getValue()); sqlUpdateLob.append(entry.getKey()).append("="); if (entry.getValue().getDataTypeObj() instanceof ClobType) { sqlUpdateLob.append("EMPTY_CLOB(),"); } else {//BLOB sqlUpdateLob.append("EMPTY_BLOB(),"); } } if (sqlUpdateLob.charAt(sqlUpdateLob.length() - 1) == ',') sqlUpdateLob.deleteCharAt(sqlUpdateLob.length() - 1); if (sqlSelectLob.charAt(sqlSelectLob.length() - 1) == ',') sqlSelectLob.deleteCharAt(sqlSelectLob.length() - 1); sqlSelectLob.append(" from "); sqlSelectLob.append(tablename).append(" %where% for update"); //update =EMPTY_C/BLOB() SQLUpdateAction updateSqlActionNew = updateSqlAction.cloneWithAllDefaultValues(); updateSqlActionNew.setSqlsp(sqlUpdateLob.toString()); updateSqlActionNew.setLstParamBeans(new ArrayList<EditableReportParamBean>()); updateSqlActionNew.setReturnValueParamname(null); lstUpdateSqlActions.add(updateSqlActionNew); updateSqlActionNew = updateSqlAction.cloneWithAllDefaultValues(); updateSqlActionNew.setSqlsp(sqlSelectLob.toString()); updateSqlActionNew.setLstParamBeans(lstParamsBean2); updateSqlActionNew.setReturnValueParamname(null); lstUpdateSqlActions.add(updateSqlActionNew); } if (hasNonLobTypeUpdateParams) { updateSqlAction.setSqlsp(sqlBuffer.toString()); updateSqlAction.setLstParamBeans(lstParamsBean); lstUpdateSqlActions.add(updateSqlAction); } return lstUpdateSqlActions; }
From source file:bfile.util.StringUtils.java
private static void convertRemainingAccentCharacters(final StringBuilder decomposed) { for (int i = 0; i < decomposed.length(); i++) { if (decomposed.charAt(i) == '\u0141') { decomposed.deleteCharAt(i);/*w w w .j av a 2 s . co m*/ decomposed.insert(i, 'L'); } else if (decomposed.charAt(i) == '\u0142') { decomposed.deleteCharAt(i); decomposed.insert(i, 'l'); } } }
From source file:com.wabacus.system.component.application.report.EditableListReportType2.java
private String createColInfosForAddRow() { if (ersqlbean == null || ersqlbean.getInsertbean() == null) return ""; AbsInputBox boxObjTmp;//from w w w .j a v a2 s .c om StringBuilder colsBuf = new StringBuilder(); colsBuf.append("{"); int currentTotalRowcount = this.cacheDataBean.getRecordcount(); int[] maxminrownums = getMaxMinRownums(); int maxrownum = maxminrownums[0]; int minrownum = maxminrownums[1]; if (maxrownum > 0 && minrownum > 0 && minrownum > currentTotalRowcount) { /* * ??? */ if (this.cacheDataBean.getPagesize() > 0) { /*********************************************************** * */ int tmp = this.cacheDataBean.getFinalPageno() * this.cacheDataBean.getPagesize(); if (tmp > minrownum) tmp = minrownum;//??pagesize? /***********************************************************/ tmp = tmp - this.cacheDataBean.getRecordcount(); if (tmp > 0) { if (tmp >= this.cacheDataBean.getPagesize()) { if (this.cacheDataBean.getFinalPageno() < this.cacheDataBean.getPagecount()) { tmp = this.cacheDataBean.getPagesize(); } else {//?? tmp = minrownum - ((this.cacheDataBean.getFinalPageno() - 1) * this.cacheDataBean.getPagesize()); } } currentTotalRowcount = currentTotalRowcount + tmp; } } else {//? currentTotalRowcount = minrownum; } } colsBuf.append("currentRecordCount:").append(currentTotalRowcount); colsBuf.append(",maxRecordCount:").append(maxrownum); if (ersqlbean.getInsertbean().getInsertstyle() != null && !ersqlbean.getInsertbean().getInsertstyle().trim().equals("")) { colsBuf.append(",insertstyle:\"").append(ersqlbean.getInsertbean().getInsertstyle()).append("\""); } colsBuf.append(",cols:["); int displaymodeTmp; boolean isReadonlyCol; EditableReportColBean ercbeanTmp; for (ColBean cbean : this.getLstDisplayColBeans()) { ercbeanTmp = (EditableReportColBean) cbean.getExtendConfigDataForReportType(KEY); colsBuf.append("{"); displaymodeTmp = this.cacheDataBean.getColDisplayModeAfterAuthorize(cbean, true); if (displaymodeTmp <= 0) colsBuf.append("hidden:\"true\","); if (ercbeanTmp == null || displaymodeTmp <= 0 || cbean.isControlCol() || !ercbeanTmp.isEditableForInsert() || cbean.checkReadonlyPermission(rrequest)) { isReadonlyCol = true; } else { isReadonlyCol = false; } String wrapstart = this.getColDisplayValueWrapStart(cbean, true, isReadonlyCol, true); if (!wrapstart.trim().equals("")) { colsBuf.append("colWrapStart:\"").append(wrapstart).append("\","); colsBuf.append("colWrapEnd:\"") .append(this.getColDisplayValueWrapEnd(cbean, true, isReadonlyCol, true)).append("\","); } if (cbean.isRowSelectCol()) { if (Consts.ROWSELECT_RADIOBOX.equalsIgnoreCase(alrbean.getRowSelectType()) || Consts.ROWSELECT_SINGLE_RADIOBOX.equalsIgnoreCase(alrbean.getRowSelectType())) { colsBuf.append("coltype:\"ROWSELECTED-RADIOBOX\""); } else {//?checkbox? colsBuf.append("coltype:\"ROWSELECTED-CHECKBOX\""); } colsBuf.append("},"); continue; } else if (cbean.getProperty() == null || cbean.getProperty().trim().equals("") || cbean.isNonValueCol() || cbean.isSequenceCol() || cbean.isRoworderCol()) { colsBuf.append("coltype:\"EMPTY\"},"); continue; } colsBuf.append("boxid:\"").append(EditableReportAssistant.getInstance().getInputBoxId(cbean)) .append("\""); boxObjTmp = null; String defaultvalue = null, defaultvaluelabel = null; if (cbean.getUpdateColBeanSrc(false) != null) { EditableReportColBean ercbeanTmp2 = (EditableReportColBean) cbean.getUpdateColBeanSrc(false) .getExtendConfigDataForReportType(KEY); defaultvalue = ercbeanTmp2.getInputbox().getDefaultvalue(rrequest); colsBuf.append(",updatecolSrc:\"" + ercbeanTmp.getUpdatecolSrc() + "\""); } else if (cbean.getUpdateColBeanDest(false) != null) { boxObjTmp = ercbeanTmp.getInputbox(); defaultvalue = boxObjTmp.getDefaultlabel(rrequest); colsBuf.append(",updatecolDest:\"" + ercbeanTmp.getUpdatecolDest() + "\""); } else if (ercbeanTmp != null && ercbeanTmp.getInputbox() != null) { boxObjTmp = ercbeanTmp.getInputbox(); defaultvalue = boxObjTmp.getDefaultvalue(rrequest); defaultvaluelabel = boxObjTmp.getDefaultlabel(rrequest); } colsBuf.append(",value_name:\""); if (displaymodeTmp < 0) { colsBuf.append(Consts_Private.COL_NONDISPLAY_PERMISSION_PREX); } else if (boxObjTmp instanceof PasswordBox && defaultvalue != null && !defaultvalue.trim().equals("")) { if (((PasswordBox) boxObjTmp).getEncodelength() > 0) {//???? colsBuf.append(Consts_Private.COL_NONDISPLAY_PERMISSION_PREX); String encodevalue = this.currentSecretColValuesBean .getUniqueEncodeString(((PasswordBox) boxObjTmp).getEncodelength()); this.currentSecretColValuesBean.addParamValue(encodevalue, defaultvalue); defaultvalue = encodevalue; defaultvaluelabel = encodevalue; } } colsBuf.append(EditableReportAssistant.getInstance().getColParamName(cbean)).append("\""); if (defaultvalue != null) { colsBuf.append(",defaultvalue:\"").append(defaultvalue).append("\""); colsBuf.append(",defaultvaluelabel:\"").append(defaultvaluelabel).append("\""); } if (Consts.COL_DISPLAYTYPE_HIDDEN.equals(cbean.getDisplaytype(true))) { colsBuf.append("},"); continue; } if (!ercbeanTmp.isEditableForInsert() || cbean.checkReadonlyPermission(rrequest)) { colsBuf.append(",coltype:\"NONE-EDITABLE\"},"); continue; } colsBuf.append(",coltype:\"EDITABLE\""); colsBuf.append("},"); } if (colsBuf.length() > 0 && colsBuf.charAt(colsBuf.length() - 1) == ',') colsBuf.deleteCharAt(colsBuf.length() - 1); colsBuf.append("]}"); return " newRowCols=\"" + Tools.jsParamEncode(colsBuf.toString()) + "\""; }