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:org.craftercms.social.domain.UGC.java

public UGC(T base) {
    this();
    BeanUtils.copyProperties(base, this);
}

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

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

From source file:com.kazuki43zoo.jpetstore.ui.controller.AccountForm.java

Account toAccount() {
    Account account = new Account();
    BeanUtils.copyProperties(this, account);
    return account;
}

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

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

    BeanUtils.copyProperties(user, usr);
    usr = encryptUser(usr);

    userDao.insertUser(usr);
}

From source file:uk.urchinly.wabi.search.Application.java

@RabbitHandler
public void process(@Payload() AssetEvent assetEvent) {
    Asset newAsset = new Asset();
    BeanUtils.copyProperties(assetEvent, newAsset);

    Asset savedAsset = this.assetRepository.save(newAsset);

    this.rabbitTemplate.convertAndSend(MessagingConstants.AUDIT_ROUTE,
            new AuditEvent("success", savedAsset).toString());

    logger.debug("Added new asset {} to search index.", savedAsset.getId());
}

From source file:com.iselect.kernal.geo.service.GeographicServiceImpl.java

@Override
public CountryDto getCountry(Long countryId) throws EntityNotFoundException {
    CountryModel countryModel = this.countryDao.getCountryById(countryId);
    CountryDto countryDto = (CountryDto) CountryFactory.createCountry(EntityType.DTO);
    BeanUtils.copyProperties(countryModel, countryDto);
    List<StateModel> stateModels = countryModel.getStates();
    for (StateModel stateModel : stateModels) {
        StateDto stateDto = (StateDto) StateFactory.createState(EntityType.DTO);
        BeanUtils.copyProperties(stateModel, stateDto);
        countryDto.addState(stateDto);//from  w ww.  j  ava  2s  . c  o m
    }
    return countryDto;
}

From source file:com.logicaalternativa.ejemplomock.repository.mock.PromotionRepositoryMock.java

private Promotion clone(final Promotion sourceObject) {

    final Promotion newObject = new Promotion();

    BeanUtils.copyProperties(sourceObject, newObject);

    return newObject;

}

From source file:net.microwww.rurl.service.imp.HessianRightServiceImp.java

@Override
public Map<String, Object>[] listUrlRight(String appname) {
    Webapp app = Webapp.getByAppName(appname);
    List<Map<String, Object>> list = new ArrayList();
    List<Webappurl> accs = Webappurl.listWebappurl(app);
    for (Webappurl url : accs) {
        url.setWebapp(app);//  ww w .j av  a  2 s .  com
        RightURL rt = new RightURL();
        BeanUtils.copyProperties(url, rt);
        list.add((JSONObject) JSONObject.toJSON(rt));
    }
    return list.toArray(new Map[list.size()]);
}

From source file:sample.web.account.AccountController.java

@RequestMapping(value = "add", method = RequestMethod.POST)
public String add(@Validated AddAccountForm accountForm, BindingResult bindingResult, Model model) {
    if (bindingResult.hasErrors()) {
        return modelAndViewForAdd(model, accountForm);
    }//from   www . j  a v  a  2 s .c  om
    Account account = new Account();
    BeanUtils.copyProperties(accountForm, account);
    String rawPassword = accountForm.getPassword();
    String encodedPassword = passwordEncoder.encode(rawPassword);
    account.setPassword(encodedPassword);
    accountService.insertAccount(account);
    return "redirect:/signin";
}