CPD Results

The following document contains the results of PMD's CPD 5.0.5.

Duplications

File Line
com\poscoict\glueframework\biz\activity\hibernate\GlueHibernateDelete.java 136
com\poscoict\glueframework\biz\activity\hibernate\GlueHibernateUpdate.java 136
        this.preRunActivity( ctx );

        /* Get Propeties */
        String daoName = this.getProperty( GlueActivityConstants.DAO );
        String queryId = this.getProperty( GlueActivityConstants.SQLKEY );
        String resultKey = this.getProperty( GlueActivityConstants.RESULT_KEY );
        String entityName = this.getProperty( GlueActivityConstants.ENTITY_NAME );
        String entityBingings = this.getProperty( GlueActivityConstants.ENTITY_BINDINGS );
        String paramBindings = this.getProperty( GlueActivityConstants.PARAM_BINDINGS );
        /* Set Default Values */
        if ( resultKey == null )
        {
            resultKey = queryId + GlueActivityConstants.RESULT;
        }

        if ( entityName != null )
        {
            /* Set GlueHibernateParameter */
            GlueParameter<?> param = new GlueHibernateParameter<GlueContext>( ctx, entityName );
            if ( paramBindings != null )
            {
                Map<String, Object> dataMap = new HashMap<String, Object>();
                StringTokenizer tokenizer = new StringTokenizer( paramBindings, GlueActivityConstants.PARAM_SEPERATORS );
                while ( tokenizer.hasMoreElements() )
                {
                    String token = tokenizer.nextToken();
                    String pair[] = token.split( GlueActivityConstants.EQUALS, 2 );
                    dataMap.put( pair[0], ctx.get( pair[1] ) );
                }
                param = new GlueHibernateParameter<Map<String, Object>>( dataMap, entityName );
            }
            if ( entityBingings != null )
            {
                Map<String, String> typeInfoMap = new HashMap<String, String>();
                StringTokenizer tokenizer = new StringTokenizer( entityBingings, GlueActivityConstants.PARAM_SEPERATORS );
                while ( tokenizer.hasMoreElements() )
                {
                    String token = tokenizer.nextToken();
                    String pair[] = token.split( GlueActivityConstants.EQUALS, 2 );
                    if ( pair.length > 1 && !pair[0].equals( pair[1] ) )
                        typeInfoMap.put( pair[0], pair[1] );
                }
                if ( typeInfoMap.size() > 0 )
                {
                    ( (GlueHibernateParameter<?>) param ).setBindingNamings( typeInfoMap );
                }
            }

            /* Process Data */
            GlueGenericDao dao = this.getDao( daoName );
            int count = dao.delete( queryId, param );
File Line
com\poscoict\glueframework\dao\hibernate\GlueHibernateTemplate.java 297
com\poscoict\glueframework\dao\hibernate\GlueHibernateTemplate.java 351
                    Field[] fields = dummyEntity.getClass().getDeclaredFields();
                    for ( Field field : fields )
                    {
                        String fieldName = field.getName();
                        String dataKey = keyMap != null && keyMap.containsKey( fieldName ) ? keyMap.get( fieldName ) : fieldName;
                        if ( dataMap.get( dataKey ) != null )
                        {
                            Object data = TypeCastingUtil.getParamValue( dataMap, dataKey, field );
                            String methodName = "set" + fieldName.substring( 0, 1 ).toUpperCase() + fieldName.substring( 1 );
                            try
                            {
                                this.logger.debug( "Setter Name : {}, param Type : {}, param Value : {}", methodName, field.getType().getName(), data );
                                Method method = entity.getClass().getDeclaredMethod( methodName, new Class[] { field.getType() } );
                                method.invoke( entity, new Object[] { data } );
                            } catch ( Exception e )
                            {
                                throw new GlueException( methodName + "," + field.getType().getName() + "," + data, e );
                            }
                        }
                    }
                } catch ( GlueException e )
                {
                    throw e;
                } catch ( Throwable t )
                {
                    throw new GlueException( t.getMessage(), t );
                }

                Serializable savedEntity = session.save( entity );
                return savedEntity;
            }
        }, false, false );
    }
File Line
com\poscoict\glueframework\biz\activity\hibernate\GlueHibernateDelete.java 165
com\poscoict\glueframework\biz\activity\hibernate\GlueHibernateSearch.java 199
com\poscoict\glueframework\biz\activity\hibernate\GlueHibernateUpdate.java 164
                param = new GlueHibernateParameter<Map<String, Object>>( dataMap, entityName );
            }
            if ( entityBingings != null )
            {
                Map<String, String> typeInfoMap = new HashMap<String, String>();
                StringTokenizer tokenizer = new StringTokenizer( entityBingings, GlueActivityConstants.PARAM_SEPERATORS );
                while ( tokenizer.hasMoreElements() )
                {
                    String token = tokenizer.nextToken();
                    String pair[] = token.split( GlueActivityConstants.EQUALS, 2 );
                    if ( pair.length > 1 && !pair[0].equals( pair[1] ) )
                        typeInfoMap.put( pair[0], pair[1] );
                }
                if ( typeInfoMap.size() > 0 )
                {
                    ( (GlueHibernateParameter<?>) param ).setBindingNamings( typeInfoMap );
                }
            }

            /* Process Data */
            GlueGenericDao dao = this.getDao( daoName );
File Line
com\poscoict\glueframework\biz\activity\hibernate\GlueHibernateEntityCreator.java 99
com\poscoict\glueframework\biz\activity\hibernate\GlueHibernateEntityModifier.java 110
        }

        if ( entityName != null )
        {
            GlueParameter<?> param = new GlueHibernateParameter<GlueContext>( ctx, entityName );
            if ( entityBingings != null )
            {
                Map<String, Object> dataMap = new HashMap<String, Object>();
                StringTokenizer tokenizer = new StringTokenizer( entityBingings, GlueActivityConstants.PARAM_SEPERATORS );
                while ( tokenizer.hasMoreElements() )
                {
                    String token = tokenizer.nextToken();
                    String pair[] = token.split( GlueActivityConstants.EQUALS, 2 );
                    dataMap.put( pair[0], ctx.get( pair[1] ) );
                }
                param = new GlueHibernateParameter<Map<String, Object>>( dataMap, entityName );
            }