blob: 06cbbf83a5ba9ab190e92e4e5492052f0b197f2d [file] [log] [blame]
/*
*******************************************************************************
* 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.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import java.util.*;
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.setContactUuid(UUID.randomUUID());
epd.setFirstName("Zotto");
epd.setLastName("Briketti");
epd.setContactType(Constants.CONTACT_TYPE_EXTERNAL_PERSON);
epd.setTitle("Dr. von und zu");
epd.setPersonTypeUuid(UUID.randomUUID());
epd.setSalutationUuid(UUID.randomUUID());
epd.setContactNote("Notiz am Rande");
return epd;
}
public static Page<ExternalPersonDto> mockExternalPersonDtoPage() {
ExternalPersonDto ep1 = mockExternalPersonDto();
ExternalPersonDto ep2 = mockExternalPersonDto();
ep2.setFirstName("Strofanov");
ep2.setContactUuid(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 refPersonType = new RefPersonType();
refPersonType.setId(1L);
refPersonType.setUuid(UUID.randomUUID());
refPersonType.setDescription("Ehrenmann");
refPersonType.setType("ElCapitan");
return refPersonType;
}
public static PersonTypeDto mockPersonTypeDto() {
PersonTypeDto personTypeDto = new PersonTypeDto();
personTypeDto.setUuid(UUID.randomUUID());
personTypeDto.setDescription("Ehrenmann");
personTypeDto.setType("ElCapitan");
return personTypeDto;
}
public static List<PersonTypeDto> mockPersonTypesDtos() {
List<PersonTypeDto> dtos = new LinkedList<>();
dtos.add( mockPersonTypeDto() );
PersonTypeDto sd2 = mockPersonTypeDto();
sd2.setType("Gutmensch");
sd2.setDescription("Zu guter Mensch");
dtos.add( sd2 );
return dtos;
}
public static List<RefPersonType> mockRefPersonTypes() {
List<RefPersonType> refs = new LinkedList<>();
refs.add( mockRefPersonType() );
RefPersonType sd2 = mockRefPersonType();
sd2.setType("Gutmensch");
sd2.setDescription("Zu guter Mensch");
refs.add( sd2 );
return refs;
}
public static RefAddressType mockRefAddressType() {
RefAddressType refAddressType = new RefAddressType();
refAddressType.setId(1L);
refAddressType.setUuid(UUID.randomUUID());
refAddressType.setDescription("Zweitwohnsitz");
refAddressType.setType("Nebenadresse");
return refAddressType;
}
public static AddressTypeDto mockAddressTypeDto() {
AddressTypeDto addressTypeDto = new AddressTypeDto();
addressTypeDto.setUuid(UUID.randomUUID());
addressTypeDto.setDescription("Zweitwohnsitz");
addressTypeDto.setType("Nebenadresse");
return addressTypeDto;
}
public static List<AddressTypeDto> mockAddressTypesDtos() {
List<AddressTypeDto> dtos = new LinkedList<>();
dtos.add( mockAddressTypeDto() );
AddressTypeDto sd2 = mockAddressTypeDto();
sd2.setType("Mülltonne");
sd2.setDescription("Drittwohnsitz");
dtos.add( sd2 );
return dtos;
}
public static List<RefAddressType> mockRefAddressTypes() {
List<RefAddressType> refs = new LinkedList<>();
refs.add( mockRefAddressType() );
RefAddressType sd2 = mockRefAddressType();
sd2.setType("Mülltonne");
sd2.setDescription("Drittwohnsitz");
refs.add( sd2 );
return refs;
}
public static TblAddress mockTblAddress(){
TblAddress tblAddress = new TblAddress();
tblAddress.setCommunity("Fischland");
tblAddress.setCommunitySuffix("-");
tblAddress.setHousenumber("13");
tblAddress.setId(5L);
tblAddress.setIsMainAddress(false);
tblAddress.setLatitude("52N");
tblAddress.setLongitude("2E");
tblAddress.setNote("-");
tblAddress.setPostcode("67890");
tblAddress.setRefAddressType(mockRefAddressType());
tblAddress.setStreet("Moosrosenweg");
tblAddress.setTblContact(mockTblContact());
tblAddress.setUrlMap("-");
tblAddress.setUuid(UUID.fromString("f34dfffc-314a-11ea-978f-2e728ce88125"));
tblAddress.setWgs_84_zone("-");
return tblAddress;
}
public static AddressDto mockAddressDto(){
AddressDto addressDto = new AddressDto();
addressDto.setCommunity("Fischland");
addressDto.setCommunitySuffix("-");
addressDto.setHousenumber("13");
addressDto.setIsMainAddress(false);
addressDto.setLatitude("52N");
addressDto.setLongitude("2E");
addressDto.setNote("-");
addressDto.setPostcode("67890");
addressDto.setAddressTypeUuid(UUID.randomUUID());
addressDto.setStreet("Moosrosenweg");
addressDto.setContactUuid(UUID.randomUUID());
addressDto.setUrlMap("-");
addressDto.setUuid(UUID.fromString("f34dfffc-314a-11ea-978f-2e728ce88125"));
addressDto.setWgs84Zone("-");
addressDto.setContactUuid(UUID.randomUUID());
return addressDto;
}
public static List<AddressDto> mockAddressDtoList(){
List<AddressDto> list = new ArrayList<>();
AddressDto addressDto1 = mockAddressDto();
AddressDto addressDto2 = new AddressDto();
addressDto2.setCommunity("Pusemuckel");
addressDto2.setCommunitySuffix("-");
addressDto2.setHousenumber("17");
addressDto2.setIsMainAddress(false);
addressDto2.setLatitude("51N");
addressDto2.setLongitude("3E");
addressDto2.setNote("-");
addressDto2.setPostcode("87655");
//addressDto.setRefAddressType();
addressDto2.setStreet("Birkenweg");
//addressDto.setTblContact();
addressDto2.setUrlMap("-");
addressDto2.setUuid(UUID.fromString("7dff534c-314d-11ea-978f-2e728ce88125"));
addressDto2.setWgs84Zone("-");
list.add(addressDto1);
list.add(addressDto2);
return list;
}
public static List<TblAddress> mockTblAddressList(){
List<TblAddress> list = new ArrayList<>();
TblAddress tblAddressDto1 = mockTblAddress();
TblAddress tblAddressDto2 = new TblAddress();
tblAddressDto2.setCommunity("Pusemuckel");
tblAddressDto2.setCommunitySuffix("-");
tblAddressDto2.setHousenumber("17");
tblAddressDto2.setIsMainAddress(false);
tblAddressDto2.setLatitude("51N");
tblAddressDto2.setLongitude("3E");
tblAddressDto2.setNote("-");
tblAddressDto2.setPostcode("87655");
tblAddressDto2.setRefAddressType(mockRefAddressType());
tblAddressDto2.setStreet("Birkenweg");
//tblAddressDto2.setTblContact();
tblAddressDto2.setUrlMap("-");
tblAddressDto2.setUuid(UUID.fromString("7dff534c-314d-11ea-978f-2e728ce88125"));
tblAddressDto2.setWgs_84_zone("-");
list.add(tblAddressDto1);
list.add(tblAddressDto2);
return list;
}
public static RefCommunicationType mockRefCommunicationType(){
RefCommunicationType communicationType = new RefCommunicationType();
communicationType.setId(2L);
communicationType.setUuid(UUID.randomUUID());
communicationType.setDescription("Fax");
communicationType.setType("Fax");
communicationType.setEditable(true);
communicationType.setMappingLdap(false);
return communicationType;
}
public static CommunicationTypeDto mockCommunicationTypeDto(){
CommunicationTypeDto communicationTypeDto = new CommunicationTypeDto();
communicationTypeDto.setUuid(UUID.randomUUID());
communicationTypeDto.setDescription("Fax");
communicationTypeDto.setType("Fax");
communicationTypeDto.setEditable(true);
communicationTypeDto.setMappingLdap(false);
return communicationTypeDto;
}
public static List<CommunicationTypeDto> mockCommunicationTypeDtoList(){
CommunicationTypeDto ctDto1 = mockCommunicationTypeDto();
CommunicationTypeDto ctDto2 = mockCommunicationTypeDto();
ctDto2.setDescription("Mobil");
ctDto2.setType("Mobil");
CommunicationTypeDto ctDto3 = mockCommunicationTypeDto();
ctDto3.setDescription("Pers�nlich");
ctDto3.setType("Pers�nlich");
List<CommunicationTypeDto> listCtDto = new ArrayList<>();
listCtDto.add(ctDto1);
listCtDto.add(ctDto2);
listCtDto.add(ctDto3);
return listCtDto;
}
public static List<RefCommunicationType> mockRefCommunicationTypeList(){
RefCommunicationType ct1 = mockRefCommunicationType();
RefCommunicationType ct2 = mockRefCommunicationType();
ct2.setDescription("Mobil");
ct2.setType("Mobil");
RefCommunicationType ct3 = mockRefCommunicationType();
ct3.setDescription("Pers�nlich");
ct3.setType("Pers�nlich");
List<RefCommunicationType> listCt = new ArrayList<>();
listCt.add(ct1);
listCt.add(ct2);
listCt.add(ct3);
return listCt;
}
public static TblInternalPerson mockInternalPerson() {
TblContact c = new TblContact();
c.setId( 10L );
c.setContactType(Constants.CONTACT_TYPE_INTERNAL_PERSON);
c.setUuid(UUID.randomUUID());
TblInternalPerson i = new TblInternalPerson();
i.setId( 12L );
i.setContact(c);
i.setFirstName("Wolfi");
i.setLastName("Weinbrenner");
i.setTitle("Freiherr");
i.setDepartment("Forschung");
i.setUid("111-777");
i.setUserRef("WWEINB");
i.setRefPersonType(mockRefPersonType());
i.setSalutation(mockRefSalutation());
c.setNote("Teilzeit");
return i;
}
public static InternalPersonDto mockInternalPersonDto() {
InternalPersonDto ipd = new InternalPersonDto();
ipd.setContactUuid(UUID.randomUUID());
ipd.setFirstName("Hella");
ipd.setLastName("Wahnsinn");
ipd.setContactType(Constants.CONTACT_TYPE_INTERNAL_PERSON);
ipd.setTitle("Mrs.");
ipd.setDepartment("Beschwerdemanagement");
ipd.setUid("222-888");
ipd.setUserRef("HWAHNS");
ipd.setPersonTypeUuid(UUID.randomUUID());
ipd.setSalutationUuid(UUID.randomUUID());
ipd.setContactNote("Vorsicht");
return ipd;
}
public static Page<InternalPersonDto> mockInternalPersonDtoPage(){
InternalPersonDto ip1 = mockInternalPersonDto();
InternalPersonDto ip2 = new InternalPersonDto();
ip2.setContactUuid(UUID.randomUUID());
ip2.setFirstName("Fritz");
ip2.setLastName("Alter");
ip2.setContactType(Constants.CONTACT_TYPE_INTERNAL_PERSON);
ip2.setTitle("Dr.");
ip2.setDepartment("Geschäftsführung");
ip2.setUid("333-999");
ip2.setUserRef("FALTER");
ip2.setPersonTypeUuid(UUID.randomUUID());
ip2.setSalutationUuid(UUID.randomUUID());
ip2.setContactNote("Gründer");
List<InternalPersonDto> list = Arrays.asList(ip1, ip2);
return new PageImpl<>(list, Pageable.unpaged(), list.size());
}
public static TblCompany mockCompany() {
TblContact c = new TblContact();
c.setId( 10L );
c.setContactType(Constants.CONTACT_TYPE_COMPANY);
c.setUuid(UUID.randomUUID());
TblCompany tblCompany = new TblCompany();
tblCompany.setId( 12L );
tblCompany.setContact(c);
tblCompany.setCompanyName("Kuemmelbrot");
tblCompany.setCompanyType("GmbH");
c.setNote("insolvent");
return tblCompany;
}
public static CompanyDto mockCompanyDto() {
CompanyDto tblCompany = new CompanyDto();
tblCompany.setContactUuid(UUID.randomUUID());
tblCompany.setCompanyName("Kuemmelbrot");
tblCompany.setCompanyType("GmbH");
tblCompany.setContactType(Constants.CONTACT_TYPE_COMPANY);
tblCompany.setContactNote("Vorsicht");
return tblCompany;
}
public static Page<CompanyDto> mockCompanyDtoPage(){
CompanyDto com1 = mockCompanyDto();
CompanyDto com2 = new CompanyDto();
com2.setContactUuid(UUID.randomUUID());
com2.setCompanyName("Sputnik 2000");
com2.setCompanyType("AG");
com2.setContactType(Constants.CONTACT_TYPE_COMPANY);
com2.setContactNote("Gründer");
List<CompanyDto> list = Arrays.asList(com1, com2);
return new PageImpl<>(list, Pageable.unpaged(), list.size());
}
public static TblContact mockTblContact(){
TblContact tblContact = new TblContact();
tblContact.setId(5L);
tblContact.setUuid(UUID.randomUUID());
tblContact.setNote("Notiz");
tblContact.setContactType("E_P");
return tblContact;
}
public static ContactDto mockContactDto(){
ContactDto contactDto = new ContactDto();
contactDto.setUuid(UUID.randomUUID());
contactDto.setNote("Notiz");
contactDto.setContactType("E_P");
return contactDto;
}
public static CommunicationDto mockCommunicationDto(){
CommunicationDto dto = new CommunicationDto();
dto.setUuid(UUID.randomUUID());
dto.setContactUuid(UUID.randomUUID());
dto.setCommunicationData("030-12345678");
dto.setCommunicationTypeDescription("Faxgerät");
dto.setCommunicationTypeType("FAX");
dto.setCommunicationTypeUuid(UUID.randomUUID());
return dto;
}
public static List<CommunicationDto> mockCommunicationDtoList(){
List<CommunicationDto> list = new ArrayList<>();
CommunicationDto communicationDto1 = mockCommunicationDto();
CommunicationDto communicationDto2 = new CommunicationDto();
communicationDto2.setUuid(UUID.randomUUID());
communicationDto2.setContactUuid(UUID.randomUUID());
communicationDto2.setCommunicationData("030-456789012");
communicationDto2.setCommunicationTypeDescription("Telefon");
communicationDto2.setCommunicationTypeType("TEL");
communicationDto2.setCommunicationTypeUuid(UUID.randomUUID());
CommunicationDto communicationDto3 = new CommunicationDto();
communicationDto3.setUuid(UUID.randomUUID());
communicationDto3.setContactUuid(UUID.randomUUID());
communicationDto3.setCommunicationData("030-456789012");
communicationDto3.setCommunicationTypeDescription("Telefon");
communicationDto3.setCommunicationTypeType("TEL");
communicationDto3.setCommunicationTypeUuid(UUID.randomUUID());
list.add(communicationDto1);
list.add(communicationDto2);
list.add(communicationDto3);
return list;
}
public static TblCommunication mockTblCommunication(){
TblCommunication tblCommunication = new TblCommunication();
tblCommunication.setUuid(UUID.randomUUID());
tblCommunication.setTblContact(mockTblContact());
tblCommunication.setCommunicationData("030-55555555");
tblCommunication.setRefCommunicationType(mockRefCommunicationType());
return tblCommunication;
}
public static List<TblCommunication> mockTblCommunicationsList(){
List<TblCommunication> list = new ArrayList<>();
TblCommunication tblCommunicationDto1 = mockTblCommunication();
TblCommunication tblCommunicationDto2 = new TblCommunication();
tblCommunicationDto2.setCommunicationData("030-55555555");
tblCommunicationDto2.setRefCommunicationType(mockRefCommunicationType());
tblCommunicationDto2.setTblContact(mockTblContact());
tblCommunicationDto2.setUuid(UUID.randomUUID());
list.add(tblCommunicationDto1);
list.add(tblCommunicationDto2);
return list;
}
}