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.oscarehr.ws.rest.ProductDispensingService.java

@GET
@Path("/productLocations")
@Produces("application/json")
public ProductLocationResponse listProductLocations() {
    List<ProductLocation> productLocations = drugProductManager.getProductLocations();

    ProductLocationResponse response = new ProductLocationResponse();

    for (ProductLocation result : productLocations) {
        ProductLocationTo1 to = new ProductLocationTo1();
        BeanUtils.copyProperties(result, to);
        response.getProductLocations().add(to);
    }//from  w ww. j a  v  a  2  s  .co  m

    return response;
}

From source file:org.oscarehr.ws.rest.ProductDispensingService.java

@GET
@Path("/drugProductTemplates")
@Produces("application/json")
public DrugProductTemplateResponse listProductTemplates() {
    List<DrugProductTemplate> templates = drugProductManager.getDrugProductTemplates();

    DrugProductTemplateResponse response = new DrugProductTemplateResponse();

    for (DrugProductTemplate result : templates) {
        DrugProductTemplateTo1 to = new DrugProductTemplateTo1();
        BeanUtils.copyProperties(result, to);
        response.getTemplates().add(to);
    }/*from   w w  w  . j a  v  a2s  .c  o m*/

    return response;
}

From source file:org.oscarehr.ws.transfer_objects.AllergyTransfer.java

public static AllergyTransfer toTransfer(Allergy allergy) {
    if (allergy == null)
        return (null);

    AllergyTransfer allergyTransfer = new AllergyTransfer();

    BeanUtils.copyProperties(allergy, allergyTransfer);

    return (allergyTransfer);
}

From source file:org.oscarehr.ws.transfer_objects.DemographicTransfer.java

public static DemographicTransfer toTransfer(Demographic demographic) {
    if (demographic == null)
        return (null);

    DemographicTransfer demographicTransfer = new DemographicTransfer();

    BeanUtils.copyProperties(demographic, demographicTransfer);

    return (demographicTransfer);
}

From source file:org.oscarehr.ws.transfer_objects.DocumentTransfer.java

/**
 * ctlDocument can be null//from  w  ww . java2 s .com
 */
public static DocumentTransfer toTransfer(Document document, CtlDocument ctlDocument) throws IOException {
    if (document == null)
        return (null);

    DocumentTransfer documentTransfer = new DocumentTransfer();

    BeanUtils.copyProperties(document, documentTransfer);

    if (ctlDocument != null) {
        documentTransfer.setCtlModule(ctlDocument.getId().getModule());
        documentTransfer.setCtlModuleId(ctlDocument.getId().getModuleId());
        documentTransfer.setCtlStatus(ctlDocument.getStatus());
    }

    documentTransfer.setFileContents(document.getDocumentFileContentsAsBytes());

    return (documentTransfer);
}

From source file:org.oscarehr.ws.transfer_objects.MeasurementMapTransfer.java

public static MeasurementMapTransfer toTransfer(MeasurementMap measurementMap) {
    if (measurementMap == null)
        return (null);

    MeasurementMapTransfer measurementMapTransfer = new MeasurementMapTransfer();
    BeanUtils.copyProperties(measurementMap, measurementMapTransfer);

    return (measurementMapTransfer);
}

From source file:org.oscarehr.ws.transfer_objects.MeasurementTransfer.java

public static MeasurementTransfer toTransfer(Measurement measurement) {
    if (measurement == null)
        return (null);

    MeasurementTransfer measurementTransfer = new MeasurementTransfer();
    BeanUtils.copyProperties(measurement, measurementTransfer);

    return (measurementTransfer);
}

From source file:org.oscarehr.ws.transfer_objects.PhrVerificationTransfer.java

public static PhrVerificationTransfer toTransfer(PHRVerification phrVerification) {
    if (phrVerification == null)
        return (null);

    PhrVerificationTransfer transfer = new PhrVerificationTransfer();

    BeanUtils.copyProperties(phrVerification, transfer);

    return (transfer);
}

From source file:org.oscarehr.ws.transfer_objects.PrescriptionTransfer.java

/**
 * If prescription is null, then null is returned.
 * If prescription is not null, then drugs must not be null, it should at least be an empty list to signify no drugs.
 *///from  w  w  w  .j  a v a  2 s  .c  om
public static PrescriptionTransfer toTransfer(Prescription prescription, List<Drug> drugs) {
    if (prescription == null)
        return (null);

    PrescriptionTransfer prescriptionTransfer = new PrescriptionTransfer();
    BeanUtils.copyProperties(prescription, prescriptionTransfer);

    prescriptionTransfer.setDrugs(DrugTransfer.toTransfers(drugs));

    return (prescriptionTransfer);
}

From source file:org.oscarehr.ws.transfer_objects.ProgramTransfer.java

public static ProgramTransfer toTransfer(Program program) {
    if (program == null)
        return (null);

    ProgramTransfer programTransfer = new ProgramTransfer();

    BeanUtils.copyProperties(program, programTransfer);

    return (programTransfer);
}