| /* |
| ******************************************************************************* |
| * Copyright (c) 2019 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| ******************************************************************************* |
| */ |
| package org.eclipse.openk.contactbasedata.support; |
| |
| import org.eclipse.openk.contactbasedata.constants.Constants; |
| import org.eclipse.openk.contactbasedata.model.*; |
| import org.eclipse.openk.contactbasedata.viewmodel.ExternalPersonDto; |
| import org.eclipse.openk.contactbasedata.viewmodel.SalutationDto; |
| import org.eclipse.openk.contactbasedata.viewmodel.VersionDto; |
| import org.springframework.data.domain.Page; |
| import org.springframework.data.domain.PageImpl; |
| import org.springframework.data.domain.Pageable; |
| |
| import java.util.Arrays; |
| import java.util.LinkedList; |
| import java.util.List; |
| import java.util.UUID; |
| |
| public class MockDataHelper { |
| |
| public static Version mockVersion() { |
| Version version = new Version(); |
| version.setId(4711L); |
| version.setVersion("db-version_mock_1"); |
| return version; |
| } |
| |
| public static VersionDto mockVersionDto() { |
| VersionDto versionDto = new VersionDto(); |
| versionDto.setBackendVersion("660"); |
| versionDto.setDbVersion("550"); |
| return versionDto; |
| } |
| |
| public static VwDetailedContact mockVDetailedContact() { |
| VwDetailedContact contact = new VwDetailedContact(); |
| contact.setId(1L); |
| contact.setUuid(UUID.randomUUID()); |
| contact.setName("Haferkamp"); |
| return contact; |
| } |
| |
| public static Page<VwDetailedContact> mockVDetailedContactPage() { |
| VwDetailedContact v1 = mockVDetailedContact(); |
| VwDetailedContact v2 = mockVDetailedContact(); |
| v2.setId(2L); |
| v2.setName("Strofanov"); |
| List<VwDetailedContact> list = Arrays.asList(v1, v2); |
| return new PageImpl<>(list, Pageable.unpaged(), list.size()); |
| } |
| |
| public static TblExternalPerson mockExternalPerson() { |
| TblContact c = new TblContact(); |
| c.setId( 3L ); |
| c.setContactType(Constants.CONTACT_TYPE_EXTERNAL_PERSON); |
| c.setUuid(UUID.randomUUID()); |
| TblExternalPerson e = new TblExternalPerson(); |
| e.setId( 34L ); |
| e.setContact(c); |
| e.setFirstName("Florinda"); |
| e.setLastName("Fieselbrink"); |
| e.setTitle("Dr. von und zu"); |
| e.setRefPersonType(mockRefPersonType()); |
| e.setSalutation(mockRefSalutation()); |
| c.setNote("Notiz am Rande"); |
| return e; |
| } |
| |
| public static ExternalPersonDto mockExternalPersonDto() { |
| ExternalPersonDto epd = new ExternalPersonDto(); |
| epd.setContactId(UUID.randomUUID()); |
| epd.setFirstName("Zotto"); |
| epd.setLastName("Briketti"); |
| epd.setContactType(Constants.CONTACT_TYPE_EXTERNAL_PERSON); |
| epd.setTitle("Dr. von und zu"); |
| epd.setPersonTypeId(UUID.randomUUID()); |
| epd.setSalutationId(UUID.randomUUID()); |
| epd.setContactNote("Notiz am Rande"); |
| return epd; |
| } |
| |
| public static Page<ExternalPersonDto> mockExternalPersonDtoPage() { |
| ExternalPersonDto ep1 = mockExternalPersonDto(); |
| ExternalPersonDto ep2 = mockExternalPersonDto(); |
| ep2.setFirstName("Strofanov"); |
| ep2.setContactId(UUID.randomUUID()); |
| List<ExternalPersonDto> list = Arrays.asList(ep1, ep2); |
| return new PageImpl<>(list, Pageable.unpaged(), list.size()); |
| } |
| public static RefSalutation mockRefSalutation() { |
| RefSalutation sal = new RefSalutation(); |
| sal.setId(1L); |
| sal.setUuid(UUID.randomUUID()); |
| sal.setDescription("Ave Marcus Antonius"); |
| sal.setType("Maitre"); |
| return sal; |
| } |
| |
| public static SalutationDto mockSalutationDto() { |
| SalutationDto sal = new SalutationDto(); |
| sal.setUuid(UUID.randomUUID()); |
| sal.setDescription("Ave Caesar"); |
| sal.setType("Maitre"); |
| return sal; |
| } |
| |
| public static List<SalutationDto> mockSalutationsDtos() { |
| List<SalutationDto> dtos = new LinkedList<>(); |
| dtos.add( mockSalutationDto() ); |
| SalutationDto sd2 = mockSalutationDto(); |
| sd2.setType("Magistra"); |
| sd2.setDescription("Ave Cleopatra"); |
| dtos.add( sd2 ); |
| return dtos; |
| } |
| |
| public static List<RefSalutation> mockRefSalutations() { |
| List<RefSalutation> refs = new LinkedList<>(); |
| refs.add( mockRefSalutation() ); |
| RefSalutation sd2 = mockRefSalutation(); |
| sd2.setType("Magistra"); |
| sd2.setDescription("Ave Messalina"); |
| refs.add( sd2 ); |
| return refs; |
| } |
| |
| public static RefPersonType mockRefPersonType() { |
| RefPersonType pt = new RefPersonType(); |
| pt.setId(6L); |
| pt.setUuid(UUID.randomUUID()); |
| pt.setDescription("Ehrenmann"); |
| pt.setType("ehrenmann"); |
| return pt; |
| } |
| } |