File |
Line |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisInsert.java |
201 |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisModify.java |
195 |
}
ctx.put( resultkey, new Integer( cnt ) );
return GlueBizControlConstants.SUCCESS;
}
/**
* @param paramBindings
* @return
*/
private Map<String, String> parseProperty( String paramBindings )
{
Map<String, String> keymap = new HashMap<String, String>();
StringTokenizer tokenizer = new StringTokenizer( paramBindings, GlueActivityConstants.PARAM_SEPERATORS );
while ( tokenizer.hasMoreElements() )
{
String token = tokenizer.nextToken();
String pair[] = token.split( GlueActivityConstants.EQUALS, 2 );
keymap.put( pair[0], pair.length > 1 && pair[1].length() > 1 ? pair[1] : pair[0] );
}
return keymap;
}
/**
* @param nameMap
* @param idx
* @param data
* @return
*/
private GlueParameter<Map<String, Object>> makeMapParameter( Map<String, String> nameMap, int idx, Map<?, ?> data )
{
if ( nameMap == null || nameMap.size() < 1 )
{
return null;
}
Map<String, Object> args = new HashMap<String, Object>();
for ( String keyInSql : nameMap.keySet() )
{
String keyInData = nameMap.get( keyInSql );
Object value = data.get( keyInData );
if ( value instanceof Object[] )
{
args.put( keyInSql, ( (Object[]) value )[idx] );
} else
{
args.put( keyInSql, value );
}
}
return new GlueParameter<Map<String, Object>>( args );
}
/**
* Audit Attribute를 Get.
*
* @param ctx
* @param isAudit
* @return
*/
private GlueAuditAttributes getAuditAttribute( GlueContext ctx, String isAudit )
{
if ( isAudit != null && Boolean.valueOf( isAudit ).booleanValue() )
{
if ( ctx.getAuditAttributes() == null )
{
throw new GlueException( "no data. not defined 'audit.insert.key' and 'audit.update.key' in 'glue.properties'" );
}
return ctx.getAuditAttributes();
}
return null;
}
} |
File |
Line |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisDelete.java |
175 |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisInsert.java |
201 |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisModify.java |
195 |
}
ctx.put( resultkey, new Integer( cnt ) );
return GlueBizControlConstants.SUCCESS;
}
/**
* @param paramBindings
* @return
*/
private Map<String, String> parseProperty( String paramBindings )
{
Map<String, String> keymap = new HashMap<String, String>();
StringTokenizer tokenizer = new StringTokenizer( paramBindings, GlueActivityConstants.PARAM_SEPERATORS );
while ( tokenizer.hasMoreElements() )
{
String token = tokenizer.nextToken();
String pair[] = token.split( GlueActivityConstants.EQUALS, 2 );
keymap.put( pair[0], pair.length > 1 && pair[1].length() > 1 ? pair[1] : pair[0] );
}
return keymap;
}
/**
* @param nameMap
* @param idx
* @param data
* @return
*/
private GlueParameter<Map<String, Object>> makeMapParameter( Map<String, String> nameMap, int idx, Map<?, ?> data )
{
if ( nameMap == null || nameMap.size() < 1 )
{
return null;
}
Map<String, Object> args = new HashMap<String, Object>();
for ( String keyInSql : nameMap.keySet() )
{
String keyInData = nameMap.get( keyInSql );
Object value = data.get( keyInData );
if ( value instanceof Object[] )
{
args.put( keyInSql, ( (Object[]) value )[idx] );
} else
{
args.put( keyInSql, value );
}
}
return new GlueParameter<Map<String, Object>>( args );
} |
File |
Line |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisInsert.java |
131 |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisModify.java |
125 |
public class GlueMybatisInsert extends GlueActivity<GlueContext>
{
@Override
public String runActivity( GlueContext ctx )
{
GlueGenericDao dao = this.getDao( this.getProperty( GlueActivityConstants.DAO ) );
String queryId = this.getProperty( GlueActivityConstants.SQLKEY );
String chkName = this.getProperty( GlueActivityConstants.CHK_NAME );
String listKey = this.getProperty( GlueActivityConstants.LIST_KEY );
String isAudit = this.getProperty( GlueActivityConstants.IS_AUDIT );
if ( chkName != null && listKey != null )
{
throw new GlueException( "DO NOT USE 'chk-name' and 'list-key' together." );
}
String paramBindings = this.getProperty( GlueActivityConstants.PARAM_BINDINGS );
String resultkey = this.getProperty( GlueActivityConstants.RESULT_KEY );
Map<String, String> nameMap = null;
if ( paramBindings != null && paramBindings.trim().length() > 0 )
{
nameMap = this.parseProperty( paramBindings );
}
GlueAuditAttributes audit = getAuditAttribute( ctx, isAudit );
int cnt = 0;
if ( chkName != null && ctx.get( chkName ) != null )
{
/*
* chk-name이 있으면, request(ui)의 것이 사용되므로 String[] 형태임..
*/
String[] checked = (String[]) ctx.get( chkName );
for ( int i = 0, iz = checked.length, idx = 0; i < iz; i++ )
{
idx = Integer.parseInt( checked[i] );
GlueParameter<?> param = makeMapParameter( nameMap, idx, ctx );
param.setAuditAttributes( audit );
cnt += dao.insert( queryId, param ); |
File |
Line |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisDelete.java |
176 |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisInsert.java |
202 |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisModify.java |
196 |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisSearch.java |
80 |
ctx.put( resultkey, new Integer( cnt ) );
return GlueBizControlConstants.SUCCESS;
}
/**
* @param paramBindings
* @return
*/
private Map<String, String> parseProperty( String paramBindings )
{
Map<String, String> keymap = new HashMap<String, String>();
StringTokenizer tokenizer = new StringTokenizer( paramBindings, GlueActivityConstants.PARAM_SEPERATORS );
while ( tokenizer.hasMoreElements() )
{
String token = tokenizer.nextToken();
String pair[] = token.split( GlueActivityConstants.EQUALS, 2 );
keymap.put( pair[0], pair.length > 1 && pair[1].length() > 1 ? pair[1] : pair[0] );
}
return keymap;
}
/**
* @param nameMap
* @param idx
* @param data
* @return
*/
private GlueParameter<Map<String, Object>> makeMapParameter( Map<String, String> nameMap, int idx, Map<?, ?> data ) |
File |
Line |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisInsert.java |
170 |
com\poscoict\glueframework\biz\activity\mybatis\GlueMybatisModify.java |
164 |
cnt += dao.insert( queryId, param );
}
} else if ( listKey != null && ctx.get( listKey ) != null )
{
/*
* chk-name이 없으며, list-key가 있으면 list(non-ui)의 것이 사용되며, map이 list로 담겨있는 형태임.
*/
List<?> dataSet = (List<?>) ctx.get( listKey );
if ( dataSet == null || dataSet.size() == 0 )
{
throw new GlueException( "list-key[" + listKey + "] of ctx, List Data for delete has no Data." );
}
for ( Object map : dataSet )
{
GlueParameter<?> param = makeMapParameter( nameMap, 0, (Map<?, ?>) map );
param.setAuditAttributes( audit );
cnt += dao.insert( queryId, param ); |