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

项目:AvoinApotti    文件:MUSTImpl.java   
public MUSTVoCollection listMUSTByCareContext(CareContextRefVo voCareContextRef) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from MUST m ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContextRef != null)
    {
        hql.append(andStr + " m.careContext.id = :id_CareContext");
        markers.add("id_CareContext");
        values.add(voCareContextRef.getID_CareContext());           
        andStr = " and ";
    }

    if (markers.size() > 0) query += " where ";
    query += hql.toString();

    List must = factory.find(query, markers, values);   
    MUSTVoCollection collMUSTVo = MUSTVoAssembler.createMUSTVoCollectionFromMUST(must);
    if(collMUSTVo != null)
        return collMUSTVo.sort();

    return null;
}
项目:AvoinApotti    文件:MUSTImpl.java   
public MUSTVo getLastComplementedMustRecord(CareContextRefVo voCareContextRef)
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer("from MUST m ");
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContextRef != null)
    {
        hql.append(" where ");
        hql.append(andStr + " m.careContext.id = :id_CareContext");
        markers.add("id_CareContext");
        values.add(voCareContextRef.getID_CareContext());
        andStr = " and ";
    }

    hql.append(" order by m.authoringInformation.authoringDateTime 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);
    }

    MUSTVoCollection collMUSTVo = MUSTVoAssembler.createMUSTVoCollectionFromMUST(list);
    if (collMUSTVo != null && collMUSTVo.size() > 0)
        return collMUSTVo.get(0);

    return null;
}
项目:AvoinApotti    文件:MUSTImpl.java   
public MUSTVo saveMUST(MUSTVo voMUST) throws StaleObjectException 
{
    if(!voMUST.isValidated())
        throw new DomainRuntimeException("This MUST has not been validated");

    DomainFactory factory = getDomainFactory();
    MUST doMUST = MUSTVoAssembler.extractMUST(factory, voMUST);
    factory.save(doMUST);
    return MUSTVoAssembler.create(doMUST);
}
项目:openMAXIMS    文件:MUSTImpl.java   
public MUSTVoCollection listMUSTByCareContext(CareContextRefVo voCareContextRef) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from MUST m ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContextRef != null)
    {
        hql.append(andStr + " m.careContext.id = :id_CareContext");
        markers.add("id_CareContext");
        values.add(voCareContextRef.getID_CareContext());           
        andStr = " and ";
    }

    if (markers.size() > 0) query += " where ";
    query += hql.toString();

    List must = factory.find(query, markers, values);   
    MUSTVoCollection collMUSTVo = MUSTVoAssembler.createMUSTVoCollectionFromMUST(must);
    if(collMUSTVo != null)
        return collMUSTVo.sort();

    return null;
}
项目:openMAXIMS    文件:MUSTImpl.java   
public MUSTVo getLastComplementedMustRecord(CareContextRefVo voCareContextRef)
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer("from MUST m ");
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContextRef != null)
    {
        hql.append(" where ");
        hql.append(andStr + " m.careContext.id = :id_CareContext");
        markers.add("id_CareContext");
        values.add(voCareContextRef.getID_CareContext());
        andStr = " and ";
    }

    hql.append(" order by m.authoringInformation.authoringDateTime 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);
    }

    MUSTVoCollection collMUSTVo = MUSTVoAssembler.createMUSTVoCollectionFromMUST(list);
    if (collMUSTVo != null && collMUSTVo.size() > 0)
        return collMUSTVo.get(0);

    return null;
}
项目:openMAXIMS    文件:MUSTImpl.java   
public MUSTVo saveMUST(MUSTVo voMUST) throws StaleObjectException 
{
    if(!voMUST.isValidated())
        throw new DomainRuntimeException("This MUST has not been validated");

    DomainFactory factory = getDomainFactory();
    MUST doMUST = MUSTVoAssembler.extractMUST(factory, voMUST);
    factory.save(doMUST);
    return MUSTVoAssembler.create(doMUST);
}
项目:openMAXIMS    文件:MUSTImpl.java   
public MUSTVoCollection listMUSTByCareContext(CareContextRefVo voCareContextRef) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from MUST m ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContextRef != null)
    {
        hql.append(andStr + " m.careContext.id = :id_CareContext");
        markers.add("id_CareContext");
        values.add(voCareContextRef.getID_CareContext());           
        andStr = " and ";
    }

    if (markers.size() > 0) query += " where ";
    query += hql.toString();

    List must = factory.find(query, markers, values);   
    MUSTVoCollection collMUSTVo = MUSTVoAssembler.createMUSTVoCollectionFromMUST(must);
    if(collMUSTVo != null)
        return collMUSTVo.sort();

    return null;
}
项目:openMAXIMS    文件:MUSTImpl.java   
public MUSTVo getLastComplementedMustRecord(CareContextRefVo voCareContextRef)
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer("from MUST m ");
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContextRef != null)
    {
        hql.append(" where ");
        hql.append(andStr + " m.careContext.id = :id_CareContext");
        markers.add("id_CareContext");
        values.add(voCareContextRef.getID_CareContext());
        andStr = " and ";
    }

    hql.append(" order by m.authoringInformation.authoringDateTime 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);
    }

    MUSTVoCollection collMUSTVo = MUSTVoAssembler.createMUSTVoCollectionFromMUST(list);
    if (collMUSTVo != null && collMUSTVo.size() > 0)
        return collMUSTVo.get(0);

    return null;
}
项目:openMAXIMS    文件:MUSTImpl.java   
public MUSTVo saveMUST(MUSTVo voMUST) throws StaleObjectException 
{
    if(!voMUST.isValidated())
        throw new DomainRuntimeException("This MUST has not been validated");

    DomainFactory factory = getDomainFactory();
    MUST doMUST = MUSTVoAssembler.extractMUST(factory, voMUST);
    factory.save(doMUST);
    return MUSTVoAssembler.create(doMUST);
}
项目:openmaxims-linux    文件:MUSTImpl.java   
public MUSTVoCollection listMUSTByCareContext(CareContextRefVo voCareContextRef) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from MUST m ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContextRef != null)
    {
        hql.append(andStr + " m.careContext.id = :id_CareContext");
        markers.add("id_CareContext");
        values.add(voCareContextRef.getID_CareContext());           
        andStr = " and ";
    }

    if (markers.size() > 0) query += " where ";
    query += hql.toString();

    List must = factory.find(query, markers, values);   
    MUSTVoCollection collMUSTVo = MUSTVoAssembler.createMUSTVoCollectionFromMUST(must);
    if(collMUSTVo != null)
        return collMUSTVo.sort();

    return null;
}
项目:openmaxims-linux    文件:MUSTImpl.java   
public MUSTVo getLastComplementedMustRecord(CareContextRefVo voCareContextRef)
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer("from MUST m ");
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voCareContextRef != null)
    {
        hql.append(" where ");
        hql.append(andStr + " m.careContext.id = :id_CareContext");
        markers.add("id_CareContext");
        values.add(voCareContextRef.getID_CareContext());
        andStr = " and ";
    }

    hql.append(" order by m.authoringInformation.authoringDateTime 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);
    }

    MUSTVoCollection collMUSTVo = MUSTVoAssembler.createMUSTVoCollectionFromMUST(list);
    if (collMUSTVo != null && collMUSTVo.size() > 0)
        return collMUSTVo.get(0);

    return null;
}
项目:openmaxims-linux    文件:MUSTImpl.java   
public MUSTVo saveMUST(MUSTVo voMUST) throws StaleObjectException 
{
    if(!voMUST.isValidated())
        throw new DomainRuntimeException("This MUST has not been validated");

    DomainFactory factory = getDomainFactory();
    MUST doMUST = MUSTVoAssembler.extractMUST(factory, voMUST);
    factory.save(doMUST);
    return MUSTVoAssembler.create(doMUST);
}