CPD Results

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

Duplications

File Line
at\ac\tuwien\vitalab\hrcrm\xsl\address\AddressXslView.java 40
at\ac\tuwien\vitalab\hrcrm\xsl\party\PartyXslView.java 40
			object = this.partyAdaptor.partyType2Party( partyTypes.get( i ) );
			Field[] fields = object.getClass().getDeclaredFields();

			for( int j = 0; j < fields.length; j++ ) {
				Field field = fields[j];
				field.setAccessible( true );

				HSSFRow row = sheet.createRow( rowNum );
				HSSFCell cell = row.createCell( (short) j );
				cell.setCellValue( String.valueOf( field.get( object ) ) );
			}
			rowNum++;
		}
	}

	private int generateTableHeader( final HSSFWorkbook workbook, final T object, final HSSFSheet sheet, int rowNum ) throws Exception {
		Field[] fields = object.getClass().getDeclaredFields();
		for( int i = 0; i < fields.length; i++ ) {
			Field field = fields[i];
			field.setAccessible( true );

			HSSFRow row = sheet.createRow( rowNum );
			HSSFCell cell = row.createCell( (short) i );
			cell.setCellValue( field.getName().toUpperCase() );

			HSSFCellStyle style = workbook.createCellStyle();
			style.setFillBackgroundColor( HSSFColor.AQUA.index );
			style.setFillPattern( HSSFCellStyle.BIG_SPOTS );
			cell.setCellStyle( style );
		}
		return ++rowNum;
	}

	//	}

	/**
	 * Write access to private field.
	 * @param partyAdaptor
	 *            The partyAdaptor to set.
	 */
	@Required
	public void setPartyAdaptor( final PartyAdaptor<T> partyAdaptor ) {

File Line
at\ac\tuwien\vitalab\hrcrm\pdf\name\NamesPdfView.java 37
at\ac\tuwien\vitalab\hrcrm\pdf\party\PartyPdfView.java 37
		this.generateTableBody( partyTypes, table );

		document.add( table );
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	@SuppressWarnings( "unchecked" )
	protected void buildPdfMetadata( Map model, Document document, HttpServletRequest request ) {
		document.addCreationDate();
		document.addAuthor( "HR-CRM Service" );
		document.addTitle( "All Available Party Names" );
	}

	private Table generateTableStub( T object ) throws Exception {
		Table table = new Table( object.getClass().getDeclaredFields().length );
		table.setWidth( 90 );
		table.setBorderWidth( 1 );
		table.setBorderColor( Color.BLACK );
		table.setBackgroundColor( Color.LIGHT_GRAY );
		table.setPadding( 3 );
		return table;
	}

	private void generateTableHeader( final T object, final Table table ) throws Exception {
		Field[] fields = object.getClass().getDeclaredFields();
		for( Field field : fields ) {
			field.setAccessible( true );
			table.addCell( field.getName().toUpperCase() );
		}
	}

	private void generateTableBody( final List<PartyType> partyTypes, final Table table ) throws Exception {

File Line
at\ac\tuwien\vitalab\hrcrm\pdf\address\AddressPdfView.java 50
at\ac\tuwien\vitalab\hrcrm\pdf\name\NamesPdfView.java 51
		document.addTitle( "All Available Party Names" );
	}


	private Table generateTableStub( T object ) throws Exception {
		Table table = new Table( object.getClass().getDeclaredFields().length );
		table.setWidth( 90 );
		table.setBorderWidth( 1 );
		table.setBorderColor( Color.BLACK );
		table.setBackgroundColor( Color.LIGHT_GRAY );
		table.setPadding( 3 );
		return table;
	}

	private void generateTableHeader( final T object, final Table table ) throws Exception {
		Field[] fields = object.getClass().getDeclaredFields();
		for( Field field : fields ) {
			field.setAccessible( true );
			table.addCell( field.getName().toUpperCase() );
		}
	}

	private void generateTableBody( final List<PartyNameType> partyNameTypes, final Table table ) throws Exception {