private String getAttrValueForMonthAsString(EmployeeDO employee, String attrGroup, String attrProperty, Calendar selectedDate) { final EmployeeTimedDO attribute = timeableService.getAttrRowForSameMonth(employee, attrGroup, selectedDate.getTime()); return attribute != null ? attribute.getStringAttribute(attrProperty) : null; }
private boolean getAttrValueForMonthAsBoolean(EmployeeDO employee, String attrGroup, String attrProperty, Calendar selectedDate) { final EmployeeTimedDO attribute = timeableService.getAttrRowForSameMonth(employee, attrGroup, selectedDate.getTime()); if (attribute == null) { return false; } final Boolean value = attribute.getAttribute(attrProperty, Boolean.class); return Boolean.TRUE.equals(value); }
private BigDecimal getAttrValueForMonthAsBigDecimal(EmployeeDO employee, String attrGroupString, String attrProperty, Calendar selectedDate) { final EmployeeTimedDO attribute = timeableService.getAttrRowForSameMonth(employee, attrGroupString, selectedDate.getTime()); return attribute != null ? attribute.getAttribute(attrProperty, BigDecimal.class) : null; }
private BigDecimal getAttrValueForMonthAsBigDecimal(EmployeeConfigurationDO configuration, String attrGroup, String attrProperty, Calendar selectedDate) { EmployeeConfigurationTimedDO attribute = timeableService.getAttrRowForSameMonth(configuration, attrGroup, selectedDate.getTime()); return attribute != null ? attribute.getAttribute(attrProperty, BigDecimal.class) : null; }
private String getAttribute(final EmployeeDO employee, final AttrColumnDescription desc) { final EmployeeTimedDO attrRow = timeableService.getAttrRowForSameMonth(employee, desc.getGroupName(), dateToSelectAttrRow); return attrRow.getStringAttribute(desc.getPropertyName()); } }
private PropertyDelta createPropertyDelta(final AttrColumnDescription colDesc) { final String fieldName = colDesc.getGroupName() + "." + colDesc.getPropertyName(); final T attrRow = timeableService.getAttrRowForSameMonth(value, colDesc.getGroupName(), dateToSelectAttrRow); final T oldAttrRow = timeableService.getAttrRowForSameMonth(oldValue, colDesc.getGroupName(), dateToSelectAttrRow); if (attrRow == null) { return null; } final Object newVal = attrRow.getAttribute(colDesc.getPropertyName()); final Object oldVal = (oldAttrRow == null) ? null : oldAttrRow.getAttribute(colDesc.getPropertyName()); if (newVal == null && oldVal == null) { return null; } final Class type = (newVal != null) ? newVal.getClass() : oldVal.getClass(); return createPropertyDelta(fieldName, newVal, oldVal, type).orElse(null); } }
@Override protected void addMappings(PropertyMapping mapping, Object entry) { @SuppressWarnings("unchecked") final EntityWithTimeableAttr<PK, T> entity = (EntityWithTimeableAttr<PK, T>) entry; for (final AttrColumnDescription attrFieldToExport : attrFieldsToExport) { final T attrRow = timeableService.getAttrRowForSameMonth(entity, attrFieldToExport.getGroupName(), dateToSelectAttrRow); if (attrRow != null) { final String attributeValue = attrRow.getStringAttribute(attrFieldToExport.getPropertyName()); mapping.add(attrFieldToExport.getCombinedName(), attributeValue); } } }
/** * Call CellItemListener. If a property model object is of type I18nEnum then the translation is automatically used. * * @see org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item, * java.lang.String, org.apache.wicket.model.IModel) * @see CellItemListener#populateItem(Item, String, IModel) */ @Override public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { final EmployeeDO employee = (EmployeeDO) rowModel.getObject(); final Calendar cal = new GregorianCalendar(selectedYear, selectedMonth - 1, 1, 0, 0); EmployeeTimedDO row = timeableService.getAttrRowForSameMonth(employee, getPropertyExpression(), cal.getTime()); if (row == null) { row = employeeService.addNewTimeAttributeRow(employee, getPropertyExpression()); row.setStartTime(cal.getTime()); } final AttrGroup attrGroup = guiAttrSchemaService.getAttrGroup(employee, getPropertyExpression()); final AttrDescription attrDescription = guiAttrSchemaService.getAttrDescription(attrGroup, groupAttribute); item.add((Component) guiAttrSchemaService.createWicketComponent(componentId, attrGroup, attrDescription, row)); if (cellItemListener != null) { cellItemListener.populateItem(item, componentId, rowModel); } } }
private void getOrCreateAttrRowAndPutAttribute(final EmployeeDO employee, final AttrColumnDescription colDesc, final EmployeeBillingExcelRow row) { EmployeeTimedDO attrRow = timeableService.getAttrRowForSameMonth(employee, colDesc.getGroupName(), dateToSelectAttrRow); if (attrRow == null) { attrRow = employeeService.addNewTimeAttributeRow(employee, colDesc.getGroupName()); attrRow.setStartTime(dateToSelectAttrRow); } final Object fieldValue = PrivateBeanUtils.readField(row, colDesc.getCombinedName()); attrRow.putAttribute(colDesc.getPropertyName(), fieldValue); } }