Java 类ims.therapies.vo.domain.StrengtheningProgramVoAssembler 实例源码

项目:AvoinApotti    文件:StrengtheningProgramImpl.java   
/**
 * save StrenghteningProgram
 * @throws UniqueKeyViolationException 
 */
public ims.therapies.vo.StrengtheningProgramVo saveStrenghteningProgram(ims.therapies.vo.StrengtheningProgramVo voStrenghteningProgram) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if (voStrenghteningProgram == null)
        throw new RuntimeException("Cannot save null StrengtheningProgramVo.");
    if (voStrenghteningProgram.isValidated() == false)
        throw new CodingRuntimeException("StrengtheningProgramVo is not validated");

    DomainFactory factory = getDomainFactory();
    if (voStrenghteningProgram.getID_StrengtheningProgram() == null)//Inserting a record
    {
        StrengtheningProgramVo voSP = getStrengthProgByClinicalContact(voStrenghteningProgram.getClinicalContact());
        if(voSP != null)
            throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed");
    }
    StrengtheningProgram doStregtheningProgram = StrengtheningProgramVoAssembler.extractStrengtheningProgram(factory, voStrenghteningProgram);
    factory.save(doStregtheningProgram);
    return StrengtheningProgramVoAssembler.create(doStregtheningProgram);
}
项目:AvoinApotti    文件:StrengtheningProgramImpl.java   
public StrengtheningProgramVo getStrenghteningProgram(CareContextRefVo careContextRefVo)
{
    if (careContextRefVo == null)
        throw new CodingRuntimeException("Cannot get CareContextRefVo CareContextRefVo ");

    DomainFactory factory = getDomainFactory();
    String hql = " from StrengtheningProgram sp where sp.clinicalContact.careContext.id = :clinContactId";
    ArrayList names = new ArrayList();
    ArrayList values = new ArrayList();
    names.add("clinContactId");
    values.add(careContextRefVo.getID_CareContext());
    List list = factory.find(hql, names, values);

    int listSize = list.size();
    if (listSize == 1)
        return StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(list).get(0);

    if (listSize > 1)
        throw new RuntimeException("More than one record for the current Clinical Contact exists.");

    return null;
}
项目:openMAXIMS    文件:StrengtheningProgramImpl.java   
/**
 * save StrenghteningProgram
 * @throws UniqueKeyViolationException 
 */
public ims.therapies.vo.StrengtheningProgramVo saveStrenghteningProgram(ims.therapies.vo.StrengtheningProgramVo voStrenghteningProgram) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if (voStrenghteningProgram == null)
        throw new RuntimeException("Cannot save null StrengtheningProgramVo.");
    if (voStrenghteningProgram.isValidated() == false)
        throw new CodingRuntimeException("StrengtheningProgramVo is not validated");

    DomainFactory factory = getDomainFactory();
    if (voStrenghteningProgram.getID_StrengtheningProgram() == null)//Inserting a record
    {
        StrengtheningProgramVo voSP = getStrengthProgByClinicalContact(voStrenghteningProgram.getClinicalContact());
        if(voSP != null)
            throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed");
    }
    StrengtheningProgram doStregtheningProgram = StrengtheningProgramVoAssembler.extractStrengtheningProgram(factory, voStrenghteningProgram);
    factory.save(doStregtheningProgram);
    return StrengtheningProgramVoAssembler.create(doStregtheningProgram);
}
项目:openMAXIMS    文件:StrengtheningProgramImpl.java   
public StrengtheningProgramVo getStrenghteningProgram(CareContextRefVo careContextRefVo)
{
    if (careContextRefVo == null)
        throw new CodingRuntimeException("Cannot get CareContextRefVo CareContextRefVo ");

    DomainFactory factory = getDomainFactory();
    String hql = " from StrengtheningProgram sp where sp.clinicalContact.careContext.id = :clinContactId";
    ArrayList names = new ArrayList();
    ArrayList values = new ArrayList();
    names.add("clinContactId");
    values.add(careContextRefVo.getID_CareContext());
    List list = factory.find(hql, names, values);

    int listSize = list.size();
    if (listSize == 1)
        return StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(list).get(0);

    if (listSize > 1)
        throw new RuntimeException("More than one record for the current Clinical Contact exists.");

    return null;
}
项目:openMAXIMS    文件:StrengtheningProgramImpl.java   
/**
 * save StrenghteningProgram
 * @throws UniqueKeyViolationException 
 */
public ims.therapies.vo.StrengtheningProgramVo saveStrenghteningProgram(ims.therapies.vo.StrengtheningProgramVo voStrenghteningProgram) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if (voStrenghteningProgram == null)
        throw new RuntimeException("Cannot save null StrengtheningProgramVo.");
    if (voStrenghteningProgram.isValidated() == false)
        throw new CodingRuntimeException("StrengtheningProgramVo is not validated");

    DomainFactory factory = getDomainFactory();
    if (voStrenghteningProgram.getID_StrengtheningProgram() == null)//Inserting a record
    {
        StrengtheningProgramVo voSP = getStrengthProgByClinicalContact(voStrenghteningProgram.getClinicalContact());
        if(voSP != null)
            throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed");
    }
    StrengtheningProgram doStregtheningProgram = StrengtheningProgramVoAssembler.extractStrengtheningProgram(factory, voStrenghteningProgram);
    factory.save(doStregtheningProgram);
    return StrengtheningProgramVoAssembler.create(doStregtheningProgram);
}
项目:openMAXIMS    文件:StrengtheningProgramImpl.java   
public StrengtheningProgramVo getStrenghteningProgram(CareContextRefVo careContextRefVo)
{
    if (careContextRefVo == null)
        throw new CodingRuntimeException("Cannot get CareContextRefVo CareContextRefVo ");

    DomainFactory factory = getDomainFactory();
    String hql = " from StrengtheningProgram sp where sp.clinicalContact.careContext.id = :clinContactId";
    ArrayList names = new ArrayList();
    ArrayList values = new ArrayList();
    names.add("clinContactId");
    values.add(careContextRefVo.getID_CareContext());
    List list = factory.find(hql, names, values);

    int listSize = list.size();
    if (listSize == 1)
        return StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(list).get(0);

    if (listSize > 1)
        throw new RuntimeException("More than one record for the current Clinical Contact exists.");

    return null;
}
项目:openmaxims-linux    文件:StrengtheningProgramImpl.java   
/**
 * save StrenghteningProgram
 * @throws UniqueKeyViolationException 
 */
public ims.therapies.vo.StrengtheningProgramVo saveStrenghteningProgram(ims.therapies.vo.StrengtheningProgramVo voStrenghteningProgram) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if (voStrenghteningProgram == null)
        throw new RuntimeException("Cannot save null StrengtheningProgramVo.");
    if (voStrenghteningProgram.isValidated() == false)
        throw new CodingRuntimeException("StrengtheningProgramVo is not validated");

    DomainFactory factory = getDomainFactory();
    if (voStrenghteningProgram.getID_StrengtheningProgram() == null)//Inserting a record
    {
        StrengtheningProgramVo voSP = getStrengthProgByClinicalContact(voStrenghteningProgram.getClinicalContact());
        if(voSP != null)
            throw new UniqueKeyViolationException("A record exists for this clinical contact, the screen will be refreshed");
    }
    StrengtheningProgram doStregtheningProgram = StrengtheningProgramVoAssembler.extractStrengtheningProgram(factory, voStrenghteningProgram);
    factory.save(doStregtheningProgram);
    return StrengtheningProgramVoAssembler.create(doStregtheningProgram);
}
项目:openmaxims-linux    文件:StrengtheningProgramImpl.java   
public StrengtheningProgramVo getStrenghteningProgram(CareContextRefVo careContextRefVo)
{
    if (careContextRefVo == null)
        throw new CodingRuntimeException("Cannot get CareContextRefVo CareContextRefVo ");

    DomainFactory factory = getDomainFactory();
    String hql = " from StrengtheningProgram sp where sp.clinicalContact.careContext.id = :clinContactId";
    ArrayList names = new ArrayList();
    ArrayList values = new ArrayList();
    names.add("clinContactId");
    values.add(careContextRefVo.getID_CareContext());
    List list = factory.find(hql, names, values);

    int listSize = list.size();
    if (listSize == 1)
        return StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(list).get(0);

    if (listSize > 1)
        throw new RuntimeException("More than one record for the current Clinical Contact exists.");

    return null;
}
项目:AvoinApotti    文件:StrengtheningProgramImpl.java   
public StrengtheningProgramVo getStrengthProgByClinicalContact(ClinicalContactRefVo voClinicalContactRefVo) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from StrengtheningProgram sp ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voClinicalContactRefVo != null)
    {
        hql.append(andStr + " sp.clinicalContact.id = :id_ClinicalContact");
        markers.add("id_ClinicalContact");
        values.add(voClinicalContactRefVo.getID_ClinicalContact());         
        andStr = " and ";
    }

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


    List skills = factory.find(query, markers, values); 
    StrengtheningProgramVoCollection collStrengtheningProgramVo = StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(skills);
    if(collStrengtheningProgramVo != null && collStrengtheningProgramVo.size() > 0)
        return collStrengtheningProgramVo.get(0);

    return null;
}
项目:openMAXIMS    文件:StrengtheningProgramImpl.java   
public StrengtheningProgramVo getStrengthProgByClinicalContact(ClinicalContactRefVo voClinicalContactRefVo) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from StrengtheningProgram sp ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voClinicalContactRefVo != null)
    {
        hql.append(andStr + " sp.clinicalContact.id = :id_ClinicalContact");
        markers.add("id_ClinicalContact");
        values.add(voClinicalContactRefVo.getID_ClinicalContact());         
        andStr = " and ";
    }

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


    List skills = factory.find(query, markers, values); 
    StrengtheningProgramVoCollection collStrengtheningProgramVo = StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(skills);
    if(collStrengtheningProgramVo != null && collStrengtheningProgramVo.size() > 0)
        return collStrengtheningProgramVo.get(0);

    return null;
}
项目:openMAXIMS    文件:StrengtheningProgramImpl.java   
public StrengtheningProgramVo getStrengthProgByClinicalContact(ClinicalContactRefVo voClinicalContactRefVo) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from StrengtheningProgram sp ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voClinicalContactRefVo != null)
    {
        hql.append(andStr + " sp.clinicalContact.id = :id_ClinicalContact");
        markers.add("id_ClinicalContact");
        values.add(voClinicalContactRefVo.getID_ClinicalContact());         
        andStr = " and ";
    }

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


    List skills = factory.find(query, markers, values); 
    StrengtheningProgramVoCollection collStrengtheningProgramVo = StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(skills);
    if(collStrengtheningProgramVo != null && collStrengtheningProgramVo.size() > 0)
        return collStrengtheningProgramVo.get(0);

    return null;
}
项目:openmaxims-linux    文件:StrengtheningProgramImpl.java   
public StrengtheningProgramVo getStrengthProgByClinicalContact(ClinicalContactRefVo voClinicalContactRefVo) 
{
    DomainFactory factory = getDomainFactory();
    StringBuffer hql = new StringBuffer(" ");
    String query = "from StrengtheningProgram sp ";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();
    String andStr = " ";

    if (voClinicalContactRefVo != null)
    {
        hql.append(andStr + " sp.clinicalContact.id = :id_ClinicalContact");
        markers.add("id_ClinicalContact");
        values.add(voClinicalContactRefVo.getID_ClinicalContact());         
        andStr = " and ";
    }

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


    List skills = factory.find(query, markers, values); 
    StrengtheningProgramVoCollection collStrengtheningProgramVo = StrengtheningProgramVoAssembler.createStrengtheningProgramVoCollectionFromStrengtheningProgram(skills);
    if(collStrengtheningProgramVo != null && collStrengtheningProgramVo.size() > 0)
        return collStrengtheningProgramVo.get(0);

    return null;
}