Example usage for org.springframework.beans BeanUtils copyProperties

List of usage examples for org.springframework.beans BeanUtils copyProperties

Introduction

In this page you can find the example usage for org.springframework.beans BeanUtils copyProperties.

Prototype

public static void copyProperties(Object source, Object target) throws BeansException 

Source Link

Document

Copy the property values of the given source bean into the target bean.

Usage

From source file:technology.tikal.ventas.model.producto.ofy.CatalogoOfy.java

@Override
public void update(Catalogo source) {
    BeanUtils.copyProperties(source, this);
}

From source file:sample.service.AccountService.java

public void insertAccount(Account account) {
    accountDao.insertAccount(account);/* w ww  . j  a v a2 s  .c  om*/

    Profile profile = new Profile();
    BeanUtils.copyProperties(account, profile);
    profileDao.insertProfile(profile);

    Signon signon = new Signon();
    BeanUtils.copyProperties(account, signon);
    signonDao.insertSignon(signon);
}

From source file:org.openmrs.contrib.metadatarepository.service.UserExistsExceptionTest.java

@Test
@ExpectedException(UserExistsException.class)
public void testAddExistingUser() throws Exception {
    log.debug("entered 'testAddExistingUser' method");
    assertNotNull(manager);/*from w w w .  j  ava 2  s  .  c  om*/

    User user = manager.getUser("1");

    // create new object with null id - Hibernate doesn't like setId(null)
    User user2 = new User();
    BeanUtils.copyProperties(user, user2);
    user2.setId(null);
    user2.setVersion(null);
    user2.setRoles(null);

    // try saving as new user, this should fail UserExistsException b/c of unique keys
    manager.saveUser(user2);
}

From source file:com.iselect.kernal.account.service.AccountServiceImpl.java

@Override
@Transactional(readOnly = true)/*  w ww.j a va 2 s  .  co  m*/
public UserDto getUser(String userName) {
    UserModel userModel = this.userDaoExt.getByUserName(userName);
    UserDto userDto = new UserDtoImpl();
    BeanUtils.copyProperties(userModel, userDto);

    return userDto;
}

From source file:io.toffees.exception.ErrorMessage.java

public ErrorMessage(AppException ex) {
    // TO-DO should(?) use a try-catch clause in case it doesn't work BUT I can't make those compile
    BeanUtils.copyProperties(this, ex);
}

From source file:technology.tikal.customers.model.name.NombrePersonaSimpleMxIndexed.java

@Override
public void update(NombrePersonaSimpleMx source) {
    BeanUtils.copyProperties(source, this);
}

From source file:org.wallride.web.controller.admin.customfield.CustomFieldEditForm.java

public static CustomFieldEditForm fromDomainObject(CustomField customField) {
    CustomFieldEditForm form = new CustomFieldEditForm();
    BeanUtils.copyProperties(customField, form);
    form.setType(customField.getFieldType());

    List<String> options = new LinkedList<>();
    customField.getOptions().stream().map(o -> o.getName()).forEach(options::add);

    return form;//from  w  ww .  j a  v a  2s  .  com
}

From source file:com.oneops.search.msg.processor.NotificationMessageProcessor.java

@Override
public void processMessage(String message, String msgType, String msgId) {
    NotificationMessage notification = GSON.fromJson(message, NotificationMessage.class);
    CmsNotificationSearch notificationSearch = new CmsNotificationSearch();
    BeanUtils.copyProperties(notification, notificationSearch);
    notificationSearch.setPayload(notification.getPayload());
    String notificationTS = new SimpleDateFormat(CmsConstants.SEARCH_TS_PATTERN)
            .format(new Date(notification.getTimestamp()));
    notificationSearch.setTs(notificationTS);
    if ("ops".equals(notification.getSource())) {
        processNotificationMsg(notificationSearch);
    }//from  w ww.  j  a v a2 s. co m
    String notificationMsg = GSON_ES.toJson(notificationSearch);
    indexer.index(null, "notification", notificationMsg);
}

From source file:technology.tikal.customers.model.name.NombrePersonaMxIndexed.java

@Override
public void update(NombrePersonaMx source) {
    BeanUtils.copyProperties(source, this);
}

From source file:com.vidyo.services.UserBusiness.java

public void updateUser(User user) {
    User usr = new User();

    BeanUtils.copyProperties(user, usr);
    usr.setPassword(EncriptDecript.encrypt(usr.getPassword()));

    userDao.updateUser(usr);/*from   w w  w.ja v  a  2 s .  co m*/
}