public ExternalResourceVoCollection getExternalResources(ExternalResourceType externalResourceType, String name, HcpDisType hcpType, PreActiveActiveInactiveStatus status) { ArrayList<String> names = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String prepend = " where "; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from ExternalResource as er "); if (externalResourceType != null) { hql.append(prepend + " er.externalResourceType.id = :resourceType "); names.add("resourceType"); values.add(externalResourceType.getID()); prepend = " and "; } if (name != null) { hql.append(prepend + " upper(er.resourcename) like :name"); names.add("name"); values.add(name.toUpperCase() + "%"); prepend = " and "; } if (hcpType != null) { hql.append(prepend + " er.hCPType.id = :idHcpType "); names.add("idHcpType"); values.add(hcpType.getID()); prepend = " and "; } if (status != null) { hql.append(prepend + " er.resourceStatus.id = :idStatus "); names.add("idStatus"); values.add(status.getID()); } hql.append(" order by er.systemInformation.creationDateTime asc"); List<?> extresources = factory.find(hql.toString(), names, values); return ExternalResourceVoAssembler.createExternalResourceVoCollectionFromExternalResource(extresources); }
public ims.core.vo.ExternalResourceVo saveExternalResource(ims.core.vo.ExternalResourceVo record) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if( record == null) throw new CodingRuntimeException("This ExternalResourceVo is null"); DomainFactory factory = getDomainFactory(); ExternalResource doExternalResource = ExternalResourceVoAssembler.extractExternalResource(factory, record); factory.save(doExternalResource); return ExternalResourceVoAssembler.create(doExternalResource); }
public ims.core.vo.ExternalResourceVoCollection getExternalResources(ims.core.vo.lookups.ExternalResourceType externalResourceType, String name, ims.core.vo.lookups.HcpDisType hcptype, ims.core.vo.lookups.PreActiveActiveInactiveStatus status) { ArrayList names = new ArrayList(); ArrayList values = new ArrayList(); String prepend = " where "; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from ExternalResource as e1_1 "); if (externalResourceType != null) { hql.append(prepend + " e1_1.externalResourceType.id = :resourceType "); names.add("resourceType"); values.add(externalResourceType.getID()); prepend = " and "; } if (name != null) { hql.append(prepend + " upper(e1_1.resourcename) like :name"); names.add("name"); values.add(name.toUpperCase()+"%"); prepend = " and "; } if (hcptype != null) { hql.append(prepend + " e1_1.hCPType.id = :idHcpType "); names.add("idHcpType"); values.add(hcptype.getID()); prepend = " and "; } if (status != null) { hql.append(prepend + " e1_1.resourceStatus.id = :idStatus "); names.add("idStatus"); values.add(status.getID()); } hql.append(" order by e1_1.systemInformation.creationDateTime asc"); List extresources = factory.find(hql.toString(), names, values); return ExternalResourceVoAssembler.createExternalResourceVoCollectionFromExternalResource(extresources); }
public ims.core.vo.ExternalResourceVo getExternalResourceById(ims.core.resource.vo.ExternalResourceRefVo externalResourceRef) { if( externalResourceRef == null) throw new CodingRuntimeException("This ExternalResourceRefVo is null"); DomainFactory factory = getDomainFactory(); ExternalResource doExternalResource = (ExternalResource) factory.getDomainObject(ExternalResource.class, externalResourceRef.getID_ExternalResource()); return ExternalResourceVoAssembler.create(doExternalResource); }