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

项目:AvoinApotti    文件:ActivityImpl.java   
public ActivitySchedVo saveSchedActivity(ActivitySchedVo activityVo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if(!activityVo.isValidated())
        throw new DomainRuntimeException("ActivitySchedVo not validated");

    DomainFactory factory = getDomainFactory();

    //TODO this implementation is not ideal - the recordExistForNameAndIsActiveAndActivityType should really take the record id attemptimg to be saved if applicable(update) as a param
    //instead of calling getActivityFromactivity_unq1 to check that the conflict is not with this record itself(update)
    if(Activity.recordExistForNameAndIsActiveAndActivityType(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType())))
    {
        if(activityVo.getID_ActivityIsNotNull())
        {
            Activity doConflictingActivity = Activity.getActivityFromactivity_unq1(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType()));
            if(!doConflictingActivity.getId().equals(activityVo.getID_Activity()))
                throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists");
        }
        else
            throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists");
    }

    Activity doActivity = ActivitySchedVoAssembler.extractActivity(factory, activityVo);

    try
    {
        factory.save(doActivity);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException("An activity with the same code mapping exists");
    }

    return ActivitySchedVoAssembler.create(doActivity);
}
项目:AvoinApotti    文件:ActivityImpl.java   
public ActivitySchedVoCollection listSchedActivities(Boolean isActive)
{   
    DomainFactory factory = getDomainFactory();

    if(isActive == null)
        return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.listDomainObjects(Activity.class));

    return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find(" select act from Activity act left join act.activityType as type where act.isActive = :isActive and type.id=-599" , new String[]{"isActive"},new Object[]{isActive}));
}
项目:AvoinApotti    文件:BookAppointmentImpl.java   
/**
 * list activities for ActivityType
 */
public ims.core.vo.ActivitySchedVoCollection listActivitiesForType(ims.core.vo.lookups.ActivityType actType, CatsReferralRefVo catsReferral)
{
    if(catsReferral == null)
        return null;

    DomainFactory factory = getDomainFactory();

    List appointments  = factory.find("select appts.id from CatsReferral as cats right join cats.appointments as appts where cats.id = :CatsReferralId", new String[] {"CatsReferralId"}, new Object[] {catsReferral.getID_CatsReferral()});

    String query = null;
    if(appointments == null || appointments.size() == 0)
    {
        query = "select act from Activity act where act.activityType = :actType and act.isActive = :isActive  and (act.firstAppointment = 1 or act.diagnostic = 1) order by act.name asc";
    }
    else
    {
        query = "select act from Activity act where act.activityType = :actType and act.isActive = :isActive order by act.name asc";
    }

    if(query != null && query.length() > 0)
    {
        return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find(query, new String[]{"actType", "isActive"}, new Object[]{getDomLookup(actType), Boolean.TRUE}));//WDEV-16073
    }

    return null;
}
项目:openMAXIMS    文件:ActivityImpl.java   
public ActivitySchedVo saveSchedActivity(ActivitySchedVo activityVo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if(!activityVo.isValidated())
        throw new DomainRuntimeException("ActivitySchedVo not validated");

    DomainFactory factory = getDomainFactory();

    //TODO this implementation is not ideal - the recordExistForNameAndIsActiveAndActivityType should really take the record id attemptimg to be saved if applicable(update) as a param
    //instead of calling getActivityFromactivity_unq1 to check that the conflict is not with this record itself(update)
    if(Activity.recordExistForNameAndIsActiveAndActivityType(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType())))
    {
        if(activityVo.getID_ActivityIsNotNull())
        {
            Activity doConflictingActivity = Activity.getActivityFromactivity_unq1(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType()));
            if(!doConflictingActivity.getId().equals(activityVo.getID_Activity()))
                throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists");
        }
        else
            throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists");
    }

    Activity doActivity = ActivitySchedVoAssembler.extractActivity(factory, activityVo);

    try
    {
        factory.save(doActivity);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException("An activity with the same code mapping exists");
    }

    return ActivitySchedVoAssembler.create(doActivity);
}
项目:openMAXIMS    文件:ActivityImpl.java   
public ActivitySchedVoCollection listSchedActivities(Boolean isActive)
{   
    DomainFactory factory = getDomainFactory();

    if(isActive == null)
        return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.listDomainObjects(Activity.class));

    return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find(" select act from Activity act left join act.activityType as type where act.isActive = :isActive and type.id=-599" , new String[]{"isActive"},new Object[]{isActive}));
}
项目:openMAXIMS    文件:BookAppointmentImpl.java   
/**
 * list activities for ActivityType
 */
public ims.core.vo.ActivitySchedVoCollection listActivitiesForType(ims.core.vo.lookups.ActivityType actType, CatsReferralRefVo catsReferral, ServiceRefVo service)
{
    if(catsReferral == null || service == null || service.getID_Service() == null)
        return null;

    DomainFactory factory = getDomainFactory();
    String query = null;

    // WDEV-22672
    Long noConsultationActivityRequiredForReferral = factory.countWithHQL("select count(cats.id) from CatsReferral as cats where cats.id = :CatsReferralId and (cats.consultationActivityRequired = 0 or cats.consultationActivityRequired is null) ", new String[] {"CatsReferralId"}, new Object[] {catsReferral.getID_CatsReferral()});

    if (noConsultationActivityRequiredForReferral == null || noConsultationActivityRequiredForReferral == 0) //WDEV-22672
    {
        List appointments  = factory.find("select appts.id from CatsReferral as cats right join cats.appointments as appts where appts.theatreBooking is null and cats.id = :CatsReferralId", new String[] {"CatsReferralId"}, new Object[] {catsReferral.getID_CatsReferral()});

        if(appointments == null || appointments.size() == 0)
        {
            query = "select act from ServiceActivity as servActivity left join servActivity.activity as act left join servActivity.service as serv where serv.id = :serviceID and act.activityType = :actType and servActivity.isActive = :isActive  and (act.firstAppointment = 1 or act.diagnostic = 1) order by act.name asc";
        }
        else
        {
            query = "select act from ServiceActivity as servActivity left join servActivity.activity as act left join servActivity.service as serv where serv.id = :serviceID and act.activityType = :actType and servActivity.isActive = :isActive order by act.name asc";
        }
    }
    else
    {
        query = "select act from ServiceActivity as servActivity left join servActivity.activity as act left join servActivity.service as serv where serv.id = :serviceID and act.activityType = :actType and servActivity.isActive = :isActive order by act.name asc";
    }

    if(query != null && query.length() > 0)
    {
        return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find(query, new String[]{"serviceID", "actType", "isActive"}, new Object[]{service.getID_Service(), getDomLookup(actType), Boolean.TRUE}));//WDEV-16073
    }

    return null;
}
项目:openMAXIMS    文件:ActivityImpl.java   
public ActivitySchedVo saveSchedActivity(ActivitySchedVo activityVo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if(!activityVo.isValidated())
        throw new DomainRuntimeException("ActivitySchedVo not validated");

    DomainFactory factory = getDomainFactory();

    //TODO this implementation is not ideal - the recordExistForNameAndIsActiveAndActivityType should really take the record id attemptimg to be saved if applicable(update) as a param
    //instead of calling getActivityFromactivity_unq1 to check that the conflict is not with this record itself(update)
    if(Activity.recordExistForNameAndIsActiveAndActivityType(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType())))
    {
        if(activityVo.getID_ActivityIsNotNull())
        {
            Activity doConflictingActivity = Activity.getActivityFromactivity_unq1(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType()));
            if(!doConflictingActivity.getId().equals(activityVo.getID_Activity()))
                throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists");
        }
        else
            throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists");
    }

    Activity doActivity = ActivitySchedVoAssembler.extractActivity(factory, activityVo);

    try
    {
        factory.save(doActivity);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException("An activity with the same code mapping exists");
    }

    return ActivitySchedVoAssembler.create(doActivity);
}
项目:openMAXIMS    文件:ActivityImpl.java   
public ActivitySchedVoCollection listSchedActivities(Boolean isActive)
{   
    DomainFactory factory = getDomainFactory();

    if(isActive == null)
        return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.listDomainObjects(Activity.class));

    return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find(" select act from Activity act left join act.activityType as type where act.isActive = :isActive and type.id=-599" , new String[]{"isActive"},new Object[]{isActive}));
}
项目:openMAXIMS    文件:BookAppointmentImpl.java   
/**
 * list activities for ActivityType
 */
public ims.core.vo.ActivitySchedVoCollection listActivitiesForType(ims.core.vo.lookups.ActivityType actType, CatsReferralRefVo catsReferral)
{
    if(catsReferral == null)
        return null;

    DomainFactory factory = getDomainFactory();

    List appointments  = factory.find("select appts.id from CatsReferral as cats right join cats.appointments as appts where cats.id = :CatsReferralId", new String[] {"CatsReferralId"}, new Object[] {catsReferral.getID_CatsReferral()});

    String query = null;
    if(appointments == null || appointments.size() == 0)
    {
        query = "select act from Activity act where act.activityType = :actType and act.isActive = :isActive  and (act.firstAppointment = 1 or act.diagnostic = 1) order by act.name asc";
    }
    else
    {
        query = "select act from Activity act where act.activityType = :actType and act.isActive = :isActive order by act.name asc";
    }

    if(query != null && query.length() > 0)
    {
        return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find(query, new String[]{"actType", "isActive"}, new Object[]{getDomLookup(actType), Boolean.TRUE}));//WDEV-16073
    }

    return null;
}
项目:openmaxims-linux    文件:ActivityImpl.java   
public ActivitySchedVo saveSchedActivity(ActivitySchedVo activityVo) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
{
    if(!activityVo.isValidated())
        throw new DomainRuntimeException("ActivitySchedVo not validated");

    DomainFactory factory = getDomainFactory();

    //TODO this implementation is not ideal - the recordExistForNameAndIsActiveAndActivityType should really take the record id attemptimg to be saved if applicable(update) as a param
    //instead of calling getActivityFromactivity_unq1 to check that the conflict is not with this record itself(update)
    if(Activity.recordExistForNameAndIsActiveAndActivityType(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType())))
    {
        if(activityVo.getID_ActivityIsNotNull())
        {
            Activity doConflictingActivity = Activity.getActivityFromactivity_unq1(factory, activityVo.getName(), activityVo.getIsActive(), getDomLookup( activityVo.getActivityType()));
            if(!doConflictingActivity.getId().equals(activityVo.getID_Activity()))
                throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists");
        }
        else
            throw new UniqueKeyViolationException("An " + (activityVo.getIsActive() ? "active" : "inactive") + " Activity of this Type and Name already exists");
    }

    Activity doActivity = ActivitySchedVoAssembler.extractActivity(factory, activityVo);

    try
    {
        factory.save(doActivity);
    }
    catch (UnqViolationUncheckedException e)
    {
        throw new UniqueKeyViolationException("An activity with the same code mapping exists");
    }

    return ActivitySchedVoAssembler.create(doActivity);
}
项目:openmaxims-linux    文件:ActivityImpl.java   
public ActivitySchedVoCollection listSchedActivities(Boolean isActive)
{   
    DomainFactory factory = getDomainFactory();

    if(isActive == null)
        return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.listDomainObjects(Activity.class));

    return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find(" select act from Activity act left join act.activityType as type where act.isActive = :isActive and type.id=-599" , new String[]{"isActive"},new Object[]{isActive}));
}
项目:AvoinApotti    文件:BookAppointmentImpl.java   
public ActivitySchedVoCollection listActivitiesForType(ActivityType actType)
{
    DomainFactory factory = getDomainFactory();
    return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find("from Activity act where act.activityType = :actType and act.isActive = :isActive", new String[]{"actType", "isActive"}, new Object[]{getDomLookup(actType), Boolean.TRUE}));
}
项目:openMAXIMS    文件:BookAppointmentImpl.java   
public ActivitySchedVoCollection listActivitiesForType(ActivityType actType)
{
    DomainFactory factory = getDomainFactory();
    return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find("from Activity act where act.activityType = :actType and act.isActive = :isActive", new String[]{"actType", "isActive"}, new Object[]{getDomLookup(actType), Boolean.TRUE}));
}
项目:openMAXIMS    文件:BookAppointmentImpl.java   
public ActivitySchedVoCollection listActivitiesForType(ActivityType actType)
{
    DomainFactory factory = getDomainFactory();
    return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find("from Activity act where act.activityType = :actType and act.isActive = :isActive", new String[]{"actType", "isActive"}, new Object[]{getDomLookup(actType), Boolean.TRUE}));
}
项目:openmaxims-linux    文件:BookAppointmentImpl.java   
public ActivitySchedVoCollection listActivitiesForType(ActivityType actType)
{
    DomainFactory factory = getDomainFactory();
    return ActivitySchedVoAssembler.createActivitySchedVoCollectionFromActivity(factory.find("from Activity act where act.activityType = :actType and act.isActive = :isActive", new String[]{"actType", "isActive"}, new Object[]{getDomLookup(actType), Boolean.TRUE}));
}