Java 类ims.nursing.vo.domain.BradenScaleAssembler 实例源码

项目:AvoinApotti    文件:BradenScaleVIEWImpl.java   
public BradenScale getLastCompletedBradenScale(CareContextRefVo voCareContextRef)
{
    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("from BradenScale bs");
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    if (voCareContextRef != null)
    {
        hql.append(" where ");
        hql.append(" bs.careContext.id = :cc");
        markers.add("cc");
        values.add(voCareContextRef.getID_CareContext());
    }
    hql.append(" order by bs.dateTimeInitiated desc ");
    List list = factory.find(hql.toString(), markers, values);

    //Get only the first record (to optimise the work of the assembler) 
    if(list != null && list.size() > 1)
    {
        Object firstItem = list.get(0);
        list.removeAll(list);
        list.add(firstItem);
    }
    BradenScaleCollection voBradenScaleColl = BradenScaleAssembler.createBradenScaleCollectionFromBradenScale(list);
    if (voBradenScaleColl != null && voBradenScaleColl.size() > 0)
        return voBradenScaleColl.get(0);

    return null;
}
项目:AvoinApotti    文件:BradenScaleDialogImpl.java   
/**
* Retrieves header record
*/
public ims.nursing.vo.BradenScale getRecord(Integer recordID) 
{
    DomainFactory factory = getDomainFactory();

    BradenScale domAssess = (BradenScale)factory.getDomainObject(BradenScale.class, recordID);
    return(BradenScaleAssembler.create(domAssess));
}
项目:AvoinApotti    文件:BradenScaleDialogImpl.java   
public Boolean isPartOfSkinAssessment(
        ims.nursing.vo.BradenScale bradenRecord)
        throws DomainInterfaceException
{
    DomainFactory factory = getDomainFactory();

    BradenScale domBraden = BradenScaleAssembler.extractBradenScale(factory, bradenRecord);
    java.util.List braden = factory.find("from SkinComponent S where S.bradenScale = :braden", "braden", domBraden);

    if(braden == null || braden.size() == 0)
        return Boolean.FALSE;

    return Boolean.TRUE;
}
项目:AvoinApotti    文件:BradenScaleDialogImpl.java   
/**
* Save the record
*/
public AssessmentHeaderInfo saveRecord(ims.nursing.vo.BradenScale bradenScale, AssessmentHeaderInfo assessment, AssessmentComponent component) throws StaleObjectException 
{
    // Ensure the Value Object was validated
    if (!bradenScale.isValidated())
        throw new DomainRuntimeException("This Braden Assessment has not been validated");

    DomainFactory factory = getDomainFactory();         


    BradenScale domAssessment = BradenScaleAssembler.extractBradenScale(factory, bradenScale);

    factory.save(domAssessment);

    if (assessment != null)
    {
        ims.nursing.vo.BradenScale braden = BradenScaleAssembler.create(domAssessment);
        braden.validate();

        if(component != null && component instanceof AssessmentSkin)
            ((AssessmentSkin)component).setBradenScale(braden);

        if(component != null && component instanceof NurAssessmentSkinVo)
            ((NurAssessmentSkinVo)component).setBradenScale(braden);

        component.validate();
        assessment.validate();

        assessment.setCurrentComponent(component);

        return saveAssessmentComponent(assessment, component);
    }

    return null;  // It otherwise expects assessment header
}
项目:openMAXIMS    文件:BradenScaleVIEWImpl.java   
public BradenScale getLastCompletedBradenScale(CareContextRefVo voCareContextRef)
{
    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("from BradenScale bs");
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    if (voCareContextRef != null)
    {
        hql.append(" where ");
        hql.append(" bs.careContext.id = :cc");
        markers.add("cc");
        values.add(voCareContextRef.getID_CareContext());
    }
    hql.append(" order by bs.dateTimeInitiated desc ");
    List list = factory.find(hql.toString(), markers, values);

    //Get only the first record (to optimise the work of the assembler) 
    if(list != null && list.size() > 1)
    {
        Object firstItem = list.get(0);
        list.removeAll(list);
        list.add(firstItem);
    }
    BradenScaleCollection voBradenScaleColl = BradenScaleAssembler.createBradenScaleCollectionFromBradenScale(list);
    if (voBradenScaleColl != null && voBradenScaleColl.size() > 0)
        return voBradenScaleColl.get(0);

    return null;
}
项目:openMAXIMS    文件:BradenScaleDialogImpl.java   
/**
* Retrieves header record
*/
public ims.nursing.vo.BradenScale getRecord(Integer recordID) 
{
    DomainFactory factory = getDomainFactory();

    BradenScale domAssess = (BradenScale)factory.getDomainObject(BradenScale.class, recordID);
    return(BradenScaleAssembler.create(domAssess));
}
项目:openMAXIMS    文件:BradenScaleDialogImpl.java   
public Boolean isPartOfSkinAssessment(
        ims.nursing.vo.BradenScale bradenRecord)
        throws DomainInterfaceException
{
    DomainFactory factory = getDomainFactory();

    BradenScale domBraden = BradenScaleAssembler.extractBradenScale(factory, bradenRecord);
    java.util.List braden = factory.find("from SkinComponent S where S.bradenScale = :braden", "braden", domBraden);

    if(braden == null || braden.size() == 0)
        return Boolean.FALSE;

    return Boolean.TRUE;
}
项目:openMAXIMS    文件:BradenScaleDialogImpl.java   
/**
* Save the record
*/
public AssessmentHeaderInfo saveRecord(ims.nursing.vo.BradenScale bradenScale, AssessmentHeaderInfo assessment, AssessmentComponent component) throws StaleObjectException 
{
    // Ensure the Value Object was validated
    if (!bradenScale.isValidated())
        throw new DomainRuntimeException("This Braden Assessment has not been validated");

    DomainFactory factory = getDomainFactory();         


    BradenScale domAssessment = BradenScaleAssembler.extractBradenScale(factory, bradenScale);

    factory.save(domAssessment);

    if (assessment != null)
    {
        ims.nursing.vo.BradenScale braden = BradenScaleAssembler.create(domAssessment);
        braden.validate();

        if(component != null && component instanceof AssessmentSkin)
            ((AssessmentSkin)component).setBradenScale(braden);

        if(component != null && component instanceof NurAssessmentSkinVo)
            ((NurAssessmentSkinVo)component).setBradenScale(braden);

        component.validate();
        assessment.validate();

        assessment.setCurrentComponent(component);

        return saveAssessmentComponent(assessment, component);
    }

    return null;  // It otherwise expects assessment header
}
项目:openMAXIMS    文件:BradenScaleVIEWImpl.java   
public BradenScale getLastCompletedBradenScale(CareContextRefVo voCareContextRef)
{
    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("from BradenScale bs");
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    if (voCareContextRef != null)
    {
        hql.append(" where ");
        hql.append(" bs.careContext.id = :cc");
        markers.add("cc");
        values.add(voCareContextRef.getID_CareContext());
    }
    hql.append(" order by bs.dateTimeInitiated desc ");
    List list = factory.find(hql.toString(), markers, values);

    //Get only the first record (to optimise the work of the assembler) 
    if(list != null && list.size() > 1)
    {
        Object firstItem = list.get(0);
        list.removeAll(list);
        list.add(firstItem);
    }
    BradenScaleCollection voBradenScaleColl = BradenScaleAssembler.createBradenScaleCollectionFromBradenScale(list);
    if (voBradenScaleColl != null && voBradenScaleColl.size() > 0)
        return voBradenScaleColl.get(0);

    return null;
}
项目:openMAXIMS    文件:BradenScaleDialogImpl.java   
/**
* Retrieves header record
*/
public ims.nursing.vo.BradenScale getRecord(Integer recordID) 
{
    DomainFactory factory = getDomainFactory();

    BradenScale domAssess = (BradenScale)factory.getDomainObject(BradenScale.class, recordID);
    return(BradenScaleAssembler.create(domAssess));
}
项目:openMAXIMS    文件:BradenScaleDialogImpl.java   
public Boolean isPartOfSkinAssessment(
        ims.nursing.vo.BradenScale bradenRecord)
        throws DomainInterfaceException
{
    DomainFactory factory = getDomainFactory();

    BradenScale domBraden = BradenScaleAssembler.extractBradenScale(factory, bradenRecord);
    java.util.List braden = factory.find("from SkinComponent S where S.bradenScale = :braden", "braden", domBraden);

    if(braden == null || braden.size() == 0)
        return Boolean.FALSE;

    return Boolean.TRUE;
}
项目:openMAXIMS    文件:BradenScaleDialogImpl.java   
/**
* Save the record
*/
public AssessmentHeaderInfo saveRecord(ims.nursing.vo.BradenScale bradenScale, AssessmentHeaderInfo assessment, AssessmentComponent component) throws StaleObjectException 
{
    // Ensure the Value Object was validated
    if (!bradenScale.isValidated())
        throw new DomainRuntimeException("This Braden Assessment has not been validated");

    DomainFactory factory = getDomainFactory();         


    BradenScale domAssessment = BradenScaleAssembler.extractBradenScale(factory, bradenScale);

    factory.save(domAssessment);

    if (assessment != null)
    {
        ims.nursing.vo.BradenScale braden = BradenScaleAssembler.create(domAssessment);
        braden.validate();

        if(component != null && component instanceof AssessmentSkin)
            ((AssessmentSkin)component).setBradenScale(braden);

        if(component != null && component instanceof NurAssessmentSkinVo)
            ((NurAssessmentSkinVo)component).setBradenScale(braden);

        component.validate();
        assessment.validate();

        assessment.setCurrentComponent(component);

        return saveAssessmentComponent(assessment, component);
    }

    return null;  // It otherwise expects assessment header
}
项目:openmaxims-linux    文件:BradenScaleVIEWImpl.java   
public BradenScale getLastCompletedBradenScale(CareContextRefVo voCareContextRef)
{
    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer("from BradenScale bs");
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    if (voCareContextRef != null)
    {
        hql.append(" where ");
        hql.append(" bs.careContext.id = :cc");
        markers.add("cc");
        values.add(voCareContextRef.getID_CareContext());
    }
    hql.append(" order by bs.dateTimeInitiated desc ");
    List list = factory.find(hql.toString(), markers, values);

    //Get only the first record (to optimise the work of the assembler) 
    if(list != null && list.size() > 1)
    {
        Object firstItem = list.get(0);
        list.removeAll(list);
        list.add(firstItem);
    }
    BradenScaleCollection voBradenScaleColl = BradenScaleAssembler.createBradenScaleCollectionFromBradenScale(list);
    if (voBradenScaleColl != null && voBradenScaleColl.size() > 0)
        return voBradenScaleColl.get(0);

    return null;
}
项目:openmaxims-linux    文件:BradenScaleDialogImpl.java   
/**
* Retrieves header record
*/
public ims.nursing.vo.BradenScale getRecord(Integer recordID) 
{
    DomainFactory factory = getDomainFactory();

    BradenScale domAssess = (BradenScale)factory.getDomainObject(BradenScale.class, recordID);
    return(BradenScaleAssembler.create(domAssess));
}
项目:openmaxims-linux    文件:BradenScaleDialogImpl.java   
public Boolean isPartOfSkinAssessment(
        ims.nursing.vo.BradenScale bradenRecord)
        throws DomainInterfaceException
{
    DomainFactory factory = getDomainFactory();

    BradenScale domBraden = BradenScaleAssembler.extractBradenScale(factory, bradenRecord);
    java.util.List braden = factory.find("from SkinComponent S where S.bradenScale = :braden", "braden", domBraden);

    if(braden == null || braden.size() == 0)
        return Boolean.FALSE;

    return Boolean.TRUE;
}
项目:openmaxims-linux    文件:BradenScaleDialogImpl.java   
/**
* Save the record
*/
public AssessmentHeaderInfo saveRecord(ims.nursing.vo.BradenScale bradenScale, AssessmentHeaderInfo assessment, AssessmentComponent component) throws StaleObjectException 
{
    // Ensure the Value Object was validated
    if (!bradenScale.isValidated())
        throw new DomainRuntimeException("This Braden Assessment has not been validated");

    DomainFactory factory = getDomainFactory();         


    BradenScale domAssessment = BradenScaleAssembler.extractBradenScale(factory, bradenScale);

    factory.save(domAssessment);

    if (assessment != null)
    {
        ims.nursing.vo.BradenScale braden = BradenScaleAssembler.create(domAssessment);
        braden.validate();

        if(component != null && component instanceof AssessmentSkin)
            ((AssessmentSkin)component).setBradenScale(braden);

        if(component != null && component instanceof NurAssessmentSkinVo)
            ((NurAssessmentSkinVo)component).setBradenScale(braden);

        component.validate();
        assessment.validate();

        assessment.setCurrentComponent(component);

        return saveAssessmentComponent(assessment, component);
    }

    return null;  // It otherwise expects assessment header
}
项目:AvoinApotti    文件:BradenScaleVIEWImpl.java   
/**
 * lists Assessments
 */
public BradenScaleCollection listAssessments(Date dateFrom, Date dateTo, CareContextRefVo voCareContextRef) throws DomainInterfaceException
{
    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer(" ");
    String query = "from BradenScale bs ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";
    boolean conditionFound = false;

    if (dateFrom != null && dateTo != null)
    {
        hql.append(" bs.dateTimeInitiated > :fromDate and bs.dateTimeInitiated < :toDate ");
        conditionFound = true;
        markers.add("fromDate");
        markers.add("toDate");
        values.add(dateFrom.addDay(-1).getDate());
        values.add(dateTo.addDay(1).getDate());
        // andStr = " and ";
    }
    else if (dateFrom != null)
    {
        hql.append(" bs.dateTimeInitiated > :fromDate ");
        conditionFound = true;
        markers.add("fromDate");

        values.add(dateFrom.addDay(-1).getDate());

        // andStr = " and ";
    }

    if (voCareContextRef != null)
    {
        if (conditionFound)
            hql.append(" and ");

        hql.append(andStr + " bs.careContext.id = :cc");
        markers.add("cc");
        values.add(voCareContextRef.getID_CareContext());
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();
    List braden = factory.find(query, markers, values);

    return (BradenScaleAssembler.createBradenScaleCollectionFromBradenScale(braden).sort());
}
项目:openMAXIMS    文件:BradenScaleVIEWImpl.java   
/**
 * lists Assessments
 */
public BradenScaleCollection listAssessments(Date dateFrom, Date dateTo, CareContextRefVo voCareContextRef) throws DomainInterfaceException
{
    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer(" ");
    String query = "from BradenScale bs ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";
    boolean conditionFound = false;

    if (dateFrom != null && dateTo != null)
    {
        hql.append(" bs.dateTimeInitiated > :fromDate and bs.dateTimeInitiated < :toDate ");
        conditionFound = true;
        markers.add("fromDate");
        markers.add("toDate");
        values.add(dateFrom.addDay(-1).getDate());
        values.add(dateTo.addDay(1).getDate());
        // andStr = " and ";
    }
    else if (dateFrom != null)
    {
        hql.append(" bs.dateTimeInitiated > :fromDate ");
        conditionFound = true;
        markers.add("fromDate");

        values.add(dateFrom.addDay(-1).getDate());

        // andStr = " and ";
    }

    if (voCareContextRef != null)
    {
        if (conditionFound)
            hql.append(" and ");

        hql.append(andStr + " bs.careContext.id = :cc");
        markers.add("cc");
        values.add(voCareContextRef.getID_CareContext());
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();
    List braden = factory.find(query, markers, values);

    return (BradenScaleAssembler.createBradenScaleCollectionFromBradenScale(braden).sort());
}
项目:openMAXIMS    文件:BradenScaleVIEWImpl.java   
/**
 * lists Assessments
 */
public BradenScaleCollection listAssessments(Date dateFrom, Date dateTo, CareContextRefVo voCareContextRef) throws DomainInterfaceException
{
    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer(" ");
    String query = "from BradenScale bs ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";
    boolean conditionFound = false;

    if (dateFrom != null && dateTo != null)
    {
        hql.append(" bs.dateTimeInitiated > :fromDate and bs.dateTimeInitiated < :toDate ");
        conditionFound = true;
        markers.add("fromDate");
        markers.add("toDate");
        values.add(dateFrom.addDay(-1).getDate());
        values.add(dateTo.addDay(1).getDate());
        // andStr = " and ";
    }
    else if (dateFrom != null)
    {
        hql.append(" bs.dateTimeInitiated > :fromDate ");
        conditionFound = true;
        markers.add("fromDate");

        values.add(dateFrom.addDay(-1).getDate());

        // andStr = " and ";
    }

    if (voCareContextRef != null)
    {
        if (conditionFound)
            hql.append(" and ");

        hql.append(andStr + " bs.careContext.id = :cc");
        markers.add("cc");
        values.add(voCareContextRef.getID_CareContext());
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();
    List braden = factory.find(query, markers, values);

    return (BradenScaleAssembler.createBradenScaleCollectionFromBradenScale(braden).sort());
}
项目:openmaxims-linux    文件:BradenScaleVIEWImpl.java   
/**
 * lists Assessments
 */
public BradenScaleCollection listAssessments(Date dateFrom, Date dateTo, CareContextRefVo voCareContextRef) throws DomainInterfaceException
{
    DomainFactory factory = getDomainFactory();

    StringBuffer hql = new StringBuffer(" ");
    String query = "from BradenScale bs ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";
    boolean conditionFound = false;

    if (dateFrom != null && dateTo != null)
    {
        hql.append(" bs.dateTimeInitiated > :fromDate and bs.dateTimeInitiated < :toDate ");
        conditionFound = true;
        markers.add("fromDate");
        markers.add("toDate");
        values.add(dateFrom.addDay(-1).getDate());
        values.add(dateTo.addDay(1).getDate());
        // andStr = " and ";
    }
    else if (dateFrom != null)
    {
        hql.append(" bs.dateTimeInitiated > :fromDate ");
        conditionFound = true;
        markers.add("fromDate");

        values.add(dateFrom.addDay(-1).getDate());

        // andStr = " and ";
    }

    if (voCareContextRef != null)
    {
        if (conditionFound)
            hql.append(" and ");

        hql.append(andStr + " bs.careContext.id = :cc");
        markers.add("cc");
        values.add(voCareContextRef.getID_CareContext());
        andStr = " and ";
    }

    if (markers.size() > 0)
        query += " where ";
    query += hql.toString();
    List braden = factory.find(query, markers, values);

    return (BradenScaleAssembler.createBradenScaleCollectionFromBradenScale(braden).sort());
}