public ims.core.vo.ExternalPersonVo saveExternalPerson(ims.core.vo.ExternalPersonVo externalPersonVo) throws ims.domain.exceptions.StaleObjectException { if (!externalPersonVo.isValidated()) { throw new DomainRuntimeException("externalPersonVo VO has not been validated."); } DomainFactory factory = getDomainFactory(); externalPersonVo.getName().setUppers(); ExternalPerson doexternalPersonVo = null; doexternalPersonVo = ExternalPersonVoAssembler.extractExternalPerson(factory, externalPersonVo); factory.save(doexternalPersonVo); return ExternalPersonVoAssembler.create(doexternalPersonVo); }
public ExternalPersonVoCollection listExternalPerson(ims.core.vo.ExternalPersonShortVo voExternalPersonFilter) { DomainFactory factory = getDomainFactory(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); StringBuffer filterString = new StringBuffer(); String andStr=""; int maxPats = ConfigFlag.DOM.PAT_SEARCH_MAX_SIZE.getValue(); java.util.List persons = null; if (voExternalPersonFilter.getNameIsNotNull() && voExternalPersonFilter.getName().getSurnameIsNotNull()) { String strSearchSurname = ""; filterString.append(andStr + " p.name.upperSurname like :surname"); markerNames.add("surname"); strSearchSurname = voExternalPersonFilter.getName().getSurname().toUpperCase().trim(); if(strSearchSurname.startsWith("*") ) { if(strSearchSurname.length() >= 11) { strSearchSurname = '%' + strSearchSurname.substring(1,11); strSearchSurname += '%'; } else { strSearchSurname = '%' + strSearchSurname.substring(1, strSearchSurname.length()); strSearchSurname += '%'; } } else { if(strSearchSurname.length() >= 10) { strSearchSurname = strSearchSurname.substring(0,10); strSearchSurname += '%'; } else { strSearchSurname += '%'; } } markerValues.add(strSearchSurname); andStr = " and "; if (voExternalPersonFilter.getIsActive()== true) { filterString.append(andStr + " p.isActive = :active"); markerNames.add("active"); markerValues.add(voExternalPersonFilter.getIsActive()); } persons = factory.find("from ims.core.generic.domain.objects.ExternalPerson p where " + filterString.toString(), markerNames, markerValues, maxPats); } else { if (voExternalPersonFilter.getIsActive()== true) { //return all active filterString.append(andStr + " p.isActive = :active"); markerNames.add("active"); markerValues.add(voExternalPersonFilter.getIsActive()); persons = factory.find("from ims.core.generic.domain.objects.ExternalPerson p where " + filterString.toString(), markerNames, markerValues, maxPats); } else { //return all persons = factory.find("from ims.core.generic.domain.objects.ExternalPerson p"); } } return ExternalPersonVoAssembler.createExternalPersonVoCollectionFromExternalPerson(persons); }
public ExternalPersonVo getExternalPerson(ExternalPersonRefVo voRefExternalPerson) { DomainFactory factory = getDomainFactory(); return ExternalPersonVoAssembler.create((ExternalPerson)factory.getDomainObject(ExternalPerson.class, voRefExternalPerson.getID_ExternalPerson())); }