/** * @param uiRepOfDomain EventParametersForm. * @throws AssignDataException AssignDataException. */ private void setDateTimeFromCalender(D domainObject, EventParametersForm uiRepOfDomain) { final Calendar calendar = Calendar.getInstance(); Date date; try { date = CommonUtilities.parseDate( uiRepOfDomain.getDateOfEvent(), CommonUtilities.datePattern(uiRepOfDomain.getDateOfEvent())); calendar.setTime(date); domainObject.setTimestamp(calendar.getTime()); calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(uiRepOfDomain.getTimeInHours())); calendar.set(Calendar.MINUTE, Integer.parseInt(uiRepOfDomain.getTimeInMinutes())); domainObject.setTimestamp(calendar.getTime()); } catch (final ParseException excp) { // TODO // SpecimenEventParameters.logger.error(excp.getMessage(), excp); excp.printStackTrace(); // final ErrorKey errorKey = // ErrorKey.getErrorKey("assign.data.error"); // throw new AssignDataException(errorKey, null, // "SpecimenEventParameters.java :"); } }
public void overwriteDomainObject(D domainObject, U uiRepOfDomain) { if (SearchUtil.isNullobject(domainObject.getUser())) { InstanceFactory<User> instFact = DomainInstanceFactory.getInstanceFactory(User.class); domainObject.setUser(instFact.createObject()); } if (SearchUtil.isNullobject(domainObject.getTimestamp())) { domainObject.setTimestamp(Calendar.getInstance().getTime()); } domainObject.setComment(uiRepOfDomain.getComments()); domainObject.getUser().setId(Long.valueOf(uiRepOfDomain.getUserId())); if (uiRepOfDomain.getDateOfEvent() != null && uiRepOfDomain.getDateOfEvent().trim().length() != 0) { setDateTimeFromCalender(domainObject, uiRepOfDomain); } if (uiRepOfDomain.isAddOperation()) { domainObject.setSpecimen(new Specimen()); } // logger.debug("uiRepOfDomain.getSpecimenId()" + // "............................." + uiRepOfDomain.getSpecimenId()); if (domainObject.getSpecimen() != null) { domainObject.getSpecimen().setId(Long.valueOf(uiRepOfDomain.getSpecimenId())); } }