Java 类ims.core.vo.domain.PatientHomeSituationVoAssembler 实例源码

项目:AvoinApotti    文件:PatientHomeSituationImpl.java   
public ims.core.vo.PatientHomeSituationVo saveHomeSituation(ims.core.vo.PatientHomeSituationVo homesituation) throws ims.domain.exceptions.StaleObjectException
{   
    if(homesituation == null)
        throw new CodingRuntimeException("Cannot save null homesituation");
    if(!homesituation.isValidated())
        throw new CodingRuntimeException("PatientHomeSituationVo has not been validated");

    if (homesituation.getID_PatientHomeSituation() == null && getHomeSituationByCareContext(homesituation.getCareContext()) != null)
        throw new StaleObjectException(null, "A Home Situation record already exists for this Care Context, the screen will be refreshed.");

    DomainFactory factory = getDomainFactory();
    PatientHomeSituation doHomeSituation = PatientHomeSituationVoAssembler.extractPatientHomeSituation(factory, homesituation);
    factory.save(doHomeSituation);

    return PatientHomeSituationVoAssembler.create(doHomeSituation);
}
项目:AvoinApotti    文件:PatientHomeSituationImpl.java   
public PatientHomeSituationVo getHomeSituationByCareContext(CareContextRefVo careContext)
{
    if (careContext == null)
        throw new RuntimeException("Cannot get PatientHomeSituationVo for null CareContextRefVo");

    String hql = new String("from PatientHomeSituation p1_1 where p1_1.careContext.id = :CARECONTEXT_ID");

    java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", careContext.getID_CareContext());

    if (list.size() == 0)
        return null;
    else if (list.size() > 1)
        throw new RuntimeException("More than one Home Situation for current CareContext found");

    return PatientHomeSituationVoAssembler.createPatientHomeSituationVoCollectionFromPatientHomeSituation(list).get(0);
}
项目:openMAXIMS    文件:PatientHomeSituationImpl.java   
public ims.core.vo.PatientHomeSituationVo saveHomeSituation(ims.core.vo.PatientHomeSituationVo homesituation) throws ims.domain.exceptions.StaleObjectException
{   
    if(homesituation == null)
        throw new CodingRuntimeException("Cannot save null homesituation");
    if(!homesituation.isValidated())
        throw new CodingRuntimeException("PatientHomeSituationVo has not been validated");

    if (homesituation.getID_PatientHomeSituation() == null && getHomeSituationByCareContext(homesituation.getCareContext()) != null)
        throw new StaleObjectException(null, "A Home Situation record already exists for this Care Context, the screen will be refreshed.");

    DomainFactory factory = getDomainFactory();
    PatientHomeSituation doHomeSituation = PatientHomeSituationVoAssembler.extractPatientHomeSituation(factory, homesituation);
    factory.save(doHomeSituation);

    return PatientHomeSituationVoAssembler.create(doHomeSituation);
}
项目:openMAXIMS    文件:PatientHomeSituationImpl.java   
public PatientHomeSituationVo getHomeSituationByCareContext(CareContextRefVo careContext)
{
    if (careContext == null)
        throw new RuntimeException("Cannot get PatientHomeSituationVo for null CareContextRefVo");

    String hql = new String("from PatientHomeSituation p1_1 where p1_1.careContext.id = :CARECONTEXT_ID");

    java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", careContext.getID_CareContext());

    if (list.size() == 0)
        return null;
    else if (list.size() > 1)
        throw new RuntimeException("More than one Home Situation for current CareContext found");

    return PatientHomeSituationVoAssembler.createPatientHomeSituationVoCollectionFromPatientHomeSituation(list).get(0);
}
项目:openMAXIMS    文件:PatientHomeSituationImpl.java   
public ims.core.vo.PatientHomeSituationVo saveHomeSituation(ims.core.vo.PatientHomeSituationVo homesituation) throws ims.domain.exceptions.StaleObjectException
{   
    if(homesituation == null)
        throw new CodingRuntimeException("Cannot save null homesituation");
    if(!homesituation.isValidated())
        throw new CodingRuntimeException("PatientHomeSituationVo has not been validated");

    if (homesituation.getID_PatientHomeSituation() == null && getHomeSituationByCareContext(homesituation.getCareContext()) != null)
        throw new StaleObjectException(null, "A Home Situation record already exists for this Care Context, the screen will be refreshed.");

    DomainFactory factory = getDomainFactory();
    PatientHomeSituation doHomeSituation = PatientHomeSituationVoAssembler.extractPatientHomeSituation(factory, homesituation);
    factory.save(doHomeSituation);

    return PatientHomeSituationVoAssembler.create(doHomeSituation);
}
项目:openMAXIMS    文件:PatientHomeSituationImpl.java   
public PatientHomeSituationVo getHomeSituationByCareContext(CareContextRefVo careContext)
{
    if (careContext == null)
        throw new RuntimeException("Cannot get PatientHomeSituationVo for null CareContextRefVo");

    String hql = new String("from PatientHomeSituation p1_1 where p1_1.careContext.id = :CARECONTEXT_ID");

    java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", careContext.getID_CareContext());

    if (list.size() == 0)
        return null;
    else if (list.size() > 1)
        throw new RuntimeException("More than one Home Situation for current CareContext found");

    return PatientHomeSituationVoAssembler.createPatientHomeSituationVoCollectionFromPatientHomeSituation(list).get(0);
}
项目:openmaxims-linux    文件:PatientHomeSituationImpl.java   
public ims.core.vo.PatientHomeSituationVo saveHomeSituation(ims.core.vo.PatientHomeSituationVo homesituation) throws ims.domain.exceptions.StaleObjectException
{   
    if(homesituation == null)
        throw new CodingRuntimeException("Cannot save null homesituation");
    if(!homesituation.isValidated())
        throw new CodingRuntimeException("PatientHomeSituationVo has not been validated");

    if (homesituation.getID_PatientHomeSituation() == null && getHomeSituationByCareContext(homesituation.getCareContext()) != null)
        throw new StaleObjectException(null, "A Home Situation record already exists for this Care Context, the screen will be refreshed.");

    DomainFactory factory = getDomainFactory();
    PatientHomeSituation doHomeSituation = PatientHomeSituationVoAssembler.extractPatientHomeSituation(factory, homesituation);
    factory.save(doHomeSituation);

    return PatientHomeSituationVoAssembler.create(doHomeSituation);
}
项目:openmaxims-linux    文件:PatientHomeSituationImpl.java   
public PatientHomeSituationVo getHomeSituationByCareContext(CareContextRefVo careContext)
{
    if (careContext == null)
        throw new RuntimeException("Cannot get PatientHomeSituationVo for null CareContextRefVo");

    String hql = new String("from PatientHomeSituation p1_1 where p1_1.careContext.id = :CARECONTEXT_ID");

    java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", careContext.getID_CareContext());

    if (list.size() == 0)
        return null;
    else if (list.size() > 1)
        throw new RuntimeException("More than one Home Situation for current CareContext found");

    return PatientHomeSituationVoAssembler.createPatientHomeSituationVoCollectionFromPatientHomeSituation(list).get(0);
}