use of org.incode.module.country.dom.impl.Country in project estatio by estatio.
the class PropertyImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
final Party owner = partyRepository.findPartyByReference(ownerReference);
final Country country = countryRepository.findCountry(countryCode);
final ApplicationTenancy appTenancy = applicationTenancyRepository.findByPath(atPath);
Property property = propertyRepository.findPropertyByReference(reference);
if (property == null) {
property = propertyRepository.newProperty(reference, name, PropertyType.valueOf(type), city, country, acquireDate);
}
property.setName(name);
property.setFullName(fullName);
property.setCountry(country);
property.setCity(city);
property.setType(PropertyType.valueOf(type));
property.setAcquireDate(acquireDate);
property.setDisposalDate(disposalDate);
property.setOpeningDate(openingDate);
property.setExternalReference(externalReference);
property.addRoleIfDoesNotExist(owner, FixedAssetRoleTypeEnum.PROPERTY_OWNER, null, null);
property.setParkingSpaces(parkingSpaces);
property.setArea(grossLettableArea);
property.setDisplayOrder(displayOrder);
return Lists.newArrayList(property);
}
use of org.incode.module.country.dom.impl.Country in project estatio by estatio.
the class CommunicationChannelImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
List<Object> results = new ArrayList<>();
// Party
final Party party = fetchParty(partyReference);
if (party == null)
throw new ApplicationException(String.format("Party with reference [%s] not found", partyReference));
// Address
if (address1 != null || address2 != null || address3 != null) {
final Country country = countryRepository.findCountry(countryCode);
PostalAddress comm = (PostalAddress) postalAddressRepository.findByAddress(party, address1, address2, address3, postalCode, city, country);
if (comm == null) {
comm = communicationChannelRepository.newPostal(party, CommunicationChannelType.POSTAL_ADDRESS, address1, address2, address3, postalCode, city, stateRepository.findState(stateCode), countryRepository.findCountry(countryCode));
}
if (legal != null && legal) {
comm.setLegal(true);
}
// attach to lease
if (leaseReference != null) {
Lease lease = fetchLease(leaseReference);
if (lease != null && addressType != null) {
final AgreementRoleType art = agreementRoleTypeRepository.find(LeaseAgreementRoleTypeEnum.TENANT);
final AgreementRoleCommunicationChannelType arcct = agreementRoleCommunicationChannelTypeRepository.findByTitle(addressType);
lease.findRoleWithType(art, lease.getStartDate()).addCommunicationChannel(arcct, comm, lease.getStartDate());
}
}
}
// Phone
if (phoneNumber != null) {
CommunicationChannel comm = phoneOrFaxNumberRepository.findByPhoneOrFaxNumber(party, phoneNumber);
if (comm == null) {
comm = communicationChannelRepository.newPhoneOrFax(party, CommunicationChannelType.PHONE_NUMBER, phoneNumber);
comm.setReference(leaseReference);
}
}
// Fax
if (faxNumber != null) {
CommunicationChannel comm = phoneOrFaxNumberRepository.findByPhoneOrFaxNumber(party, faxNumber);
if (comm == null) {
comm = communicationChannelRepository.newPhoneOrFax(party, CommunicationChannelType.FAX_NUMBER, faxNumber);
comm.setReference(leaseReference);
}
}
// Email
if (emailAddress != null) {
CommunicationChannel comm = emailAddressRepository.findByEmailAddress(party, emailAddress);
if (comm == null) {
comm = communicationChannelRepository.newEmail(party, CommunicationChannelType.EMAIL_ADDRESS, emailAddress);
comm.setReference(leaseReference);
}
}
return results;
}
use of org.incode.module.country.dom.impl.Country in project estatio by estatio.
the class StatesRefData method execute.
@Override
protected void execute(ExecutionContext executionContext) {
Country countryGBR = countryRepository.findCountry(GBR);
Country countryNED = countryRepository.findCountry(NLD);
Country countryITA = countryRepository.findCountry(ITA);
Country countryFRA = countryRepository.findCountry(FRA);
Country countrySWE = countryRepository.findCountry(SWE);
createState(countryNED, "-DRN", "Drenthe", executionContext);
createState(countryNED, "-FLE", "Flevoland", executionContext);
createState(countryNED, "-FRI", "Friesland", executionContext);
createState(countryNED, "-GEL", "Gelderland", executionContext);
createState(countryNED, "-GRO", "Groningen", executionContext);
createState(countryNED, "-LIM", "Limburg", executionContext);
createState(countryNED, "-NBT", "Noord-Brabant", executionContext);
createState(countryNED, "-NOH", "Noord-Holland", executionContext);
createState(countryNED, "-OIJ", "Overijssel", executionContext);
createState(countryNED, "-UTR", "Utrecht", executionContext);
createState(countryNED, "-ZEL", "Zeeland", executionContext);
createState(countryNED, "-ZUH", "Zuid-Holland", executionContext);
createState(countryGBR, "-BED", "Bedfordshire", executionContext);
createState(countryGBR, "-BEK", "Berkshire", executionContext);
createState(countryGBR, "-BUK", "Buckinghamshire", executionContext);
createState(countryGBR, "-CMB", "Cambridgeshire", executionContext);
createState(countryGBR, "-CHE", "Cheshire", executionContext);
createState(countryGBR, "-COR", "Cornwall", executionContext);
createState(countryGBR, "-DBY", "Derbyshire", executionContext);
createState(countryGBR, "-DEV", "Devon", executionContext);
createState(countryGBR, "-DOR", "Dorset", executionContext);
createState(countryGBR, "-DUR", "Durham", executionContext);
createState(countryGBR, "-ESX", "Essex", executionContext);
createState(countryGBR, "-GLO", "Gloucestershire", executionContext);
createState(countryGBR, "-HAN", "Hampshire", executionContext);
createState(countryGBR, "-KNT", "Kent", executionContext);
createState(countryGBR, "-LAN", "Lancashire", executionContext);
createState(countryGBR, "-LEI", "Leicerstershire", executionContext);
createState(countryGBR, "-LIN", "Lincolnshire", executionContext);
createState(countryGBR, "-NFK", "Norfolk", executionContext);
createState(countryGBR, "-NTP", "Northamptonshire", executionContext);
createState(countryGBR, "-NTB", "Northumberland", executionContext);
createState(countryGBR, "-OXF", "Oxfordshire", executionContext);
createState(countryGBR, "-RUT", "Rutland", executionContext);
createState(countryGBR, "-SHR", "Shropshire", executionContext);
createState(countryGBR, "-SOM", "Somerset", executionContext);
createState(countryGBR, "-STA", "Staffordshire", executionContext);
createState(countryGBR, "-SUF", "Suffolk", executionContext);
createState(countryGBR, "-WAR", "Warwickshire", executionContext);
createState(countryGBR, "-WIL", "Wiltshire", executionContext);
createState(countryGBR, "-WOR", "Worcerstershire", executionContext);
}
use of org.incode.module.country.dom.impl.Country in project estatio by estatio.
the class EstatioApplicationTenancyRepositoryForCountry_Test method testFindOrCreateCountryTenancy_whenDoesNotExist.
@Test
public void testFindOrCreateCountryTenancy_whenDoesNotExist() throws Exception {
// given
final Country country = new Country("GBR", "UK", "United Kingdom");
// expect
final ApplicationTenancy newlyCreatedTenancy = new ApplicationTenancy();
context.checking(new Expectations() {
{
oneOf(mockApplicationTenancies).newTenancy("GBR", "/GBR", global);
will(returnValue(newlyCreatedTenancy));
}
});
// when
ApplicationTenancy countryTenancy = estatioApplicationTenancyRepository.findOrCreateTenancyFor(country);
// then
assertThat(countryTenancy).isEqualTo(newlyCreatedTenancy);
}
use of org.incode.module.country.dom.impl.Country in project estatio by estatio.
the class EstatioApplicationTenancyRepositoryForCountry_Test method country.
private static Country country(final String reference) {
Country country = new Country();
country.setReference(reference);
return country;
}
Aggregations