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:de.ingrid.interfaces.csw.admin.command.IBusHarvesterCommandObject.java

public IBusHarvesterCommandObject(HarvesterConfiguration config) {
    super();
    BeanUtils.copyProperties(config, this);
}

From source file:com.googlecode.starflow.engine.core.participant.impl.ActLogicParticipantMode.java

@SuppressWarnings("unchecked")
public List<Participant> creatParticipants(AbstractFlowEvent event, ActivityElement activityXml) {
    ProcessInstance cloneProcessInstance = new ProcessInstance();
    BeanUtils.copyProperties(event.getProcessInstance(), cloneProcessInstance);
    String beanName = activityXml.getParticiLogic();
    List<Participant> participants;
    try {// ww  w  .ja v  a 2 s  . c om
        //beanName ????IToolAppAction.execute
        int index = beanName.indexOf("#");
        IParticipantService action = ApplicationContextHolder.getBean(beanName, IParticipantService.class);
        if (index == -1) {
            participants = action.createWorkItemParticipants(cloneProcessInstance);
        } else {
            //??bean
            String methodName = beanName.substring(index + 1);
            if ("".equals(beanName))
                throw new ProcessEngineException(
                        "IParticipantService Bean" + beanName + "??");

            beanName = beanName.substring(0, index);
            try {
                Method method = action.getClass().getMethod(methodName, long.class, long.class);
                participants = (List<Participant>) method.invoke(action, cloneProcessInstance);
            } catch (Exception e) {
                throw new ProcessEngineException(
                        "IParticipantService Bean" + beanName + "", e);
            }
        }
    } catch (Exception e) {
        throw new ProcessEngineException("??", e);
    }

    return participants;
}

From source file:com.jagornet.dhcp.server.request.binding.V4BindingAddress.java

/**
 * Instantiates a new binding address./*ww  w . java 2 s.  c  om*/
 * 
 * @param iaAddr the ia addr
 * @param configObj the config object
 */
public V4BindingAddress(IaAddress iaAddr, DhcpConfigObject configObj) {
    // populate *this* IaAddress from the given one
    BeanUtils.copyProperties(iaAddr, this);
    this.configObj = configObj;
}

From source file:com.jagornet.dhcp.server.request.binding.V6BindingPrefix.java

/**
 * Instantiates a new binding address./*from   w ww.  j av  a  2 s  . c  om*/
 * 
 * @param iaPrefix the ia addr
 * @param configObj the config object
 */
public V6BindingPrefix(IaPrefix iaPrefix, DhcpConfigObject configObj) {
    // populate *this* IaPrefix from the given one
    BeanUtils.copyProperties(iaPrefix, this);
    this.configObj = configObj;
}

From source file:com.mycompany.apps.domain.services.UserDetailsServiceImpl.java

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    Users users = usersMapper.selectByUsername(username);
    if (users == null) {
        throw new UnsupportedOperationException("User not found...");
    }//from w  ww.j  a v  a 2  s.  co m
    List<String> roles = usersMapper.hasRoles(username);

    // Users (entity to dto) copy and Authority(ROLE) set
    com.mycompany.apps.domain.dto.Users user = new com.mycompany.apps.domain.dto.Users();
    BeanUtils.copyProperties(users, user);
    user.setAuthorities(roles);
    return user;
}

From source file:com.jagornet.dhcp.server.request.binding.V6BindingAddress.java

/**
 * Instantiates a new binding address./*  w w  w . ja va 2  s  .  c om*/
 * 
 * @param iaAddr the ia addr
 * @param configObj the config object
 */
public V6BindingAddress(IaAddress iaAddr, DhcpConfigObject configObj) {
    // populate *this* IaAddress from the given one
    BeanUtils.copyProperties(iaAddr, this);
    this.configObj = configObj;
}

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

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

From source file:com.jagornet.dhcp.server.request.binding.Binding.java

/**
 * Instantiates a new binding./*w w w .j a  v a 2  s.c  om*/
 * 
 * @param ia the ia
 * @param link the link
 */
public Binding(IdentityAssoc ia, DhcpLink dhcpLink) {
    this.origIa = ia; // save a reference to the original IA
    BeanUtils.copyProperties(ia, this);
    this.dhcpLink = dhcpLink;
}

From source file:org.nebula.service.admin.GetRegistrationProcessor.java

public GetRegistrationResponse processInternal(GetRegistrationRequest request) {

    Registration registration = registrationMapper.findById(request.getId());

    GetRegistrationResponse response = new GetRegistrationResponse();

    if (registration != null) {
        BeanUtils.copyProperties(registration, response);

        response.setRegistrationInfo(//  ww w  .  j a  va 2s.  co m
                (RegistrationInfo) JsonUtils.toObject(registration.getData(), RegistrationInfo.class));
    }

    return response;
}

From source file:com.funtl.framework.smoke.core.modules.act.service.creator.RuntimeActivityCreatorSupport.java

protected TaskDefinition cloneTaskDefinition(TaskDefinition taskDefinition) {
    TaskDefinition newTaskDefinition = new TaskDefinition(taskDefinition.getTaskFormHandler());
    BeanUtils.copyProperties(taskDefinition, newTaskDefinition);
    return newTaskDefinition;
}