blob: 88278003180b3b27e554fd2aaee561b0559a9888 [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 pt = new RefPersonType();
pt.setId(6L);
pt.setUuid(UUID.randomUUID());
pt.setDescription("Ehrenmann");
pt.setType("ehrenmann");
return pt;
}
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();
tblAddress.setStreet("Moosrosenweg");
//tblAddress.setTblContact();
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.setRefAddressType();
addressDto.setStreet("Moosrosenweg");
//addressDto.setTblContact();
addressDto.setUrlMap("-");
addressDto.setUuid(UUID.fromString("f34dfffc-314a-11ea-978f-2e728ce88125"));
addressDto.setWgs84Zone("-");
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();
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.setSid("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.setSid("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.setSid("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());
}
}