use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class IncomingInvoice_verifySupplier method $$.
@Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
public IncomingInvoice $$(final OrganisationNameNumberViewModel organisationCheck) {
Organisation orgToVerify = (Organisation) incomingInvoice.getSeller();
orgToVerify.verify(organisationCheck);
return incomingInvoice;
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class OrganisationMenu method newOrganisation.
@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
@MemberOrder(sequence = "1")
public Organisation newOrganisation(@Parameter(regexPattern = ReferenceType.Meta.REGEX, regexPatternReplacement = ReferenceType.Meta.REGEX_DESCRIPTION, optionality = Optionality.OPTIONAL) final String reference, final String name, final Country country, final List<IPartyRoleType> partyRoleTypes) {
boolean useNumerator = Strings.isNullOrEmpty(reference);
final Organisation organisation = organisationRepository.newOrganisation(reference, useNumerator, name, country);
for (IPartyRoleType partyRoleType : partyRoleTypes) {
partyRoleRepository.findOrCreate(organisation, partyRoleType);
}
return organisation;
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class OrganisationImport method importData.
@Override
public List<Object> importData(final Object previousRow) {
final ApplicationTenancy applicationTenancy = applicationTenancyRepository.findByPath(atPath);
Organisation org = (Organisation) partyRepository.findPartyByReference(reference);
if (org == null) {
try {
if (applicationTenancy == null) {
throw new IllegalArgumentException("atPath not found");
}
org = organisationRepository.newOrganisation(reference, false, name, applicationTenancy);
} catch (Exception e) {
LOG.error("Error importing organisation : " + reference, e);
}
}
org.setApplicationTenancyPath(atPath);
org.setName(name);
org.setFiscalCode(fiscalCode);
org.setVatCode(vatCode);
if (chamberOfCommerceCode != null && !chamberOfCommerceCode.matches("[ \t]+")) {
org.setChamberOfCommerceCode(chamberOfCommerceCode.replace(" ", ""));
}
return Lists.newArrayList(org);
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class EstatioApplicationTenancyRepositoryForLease_Test method partyWith.
private Party partyWith(final String hello) {
Party pa = new Organisation();
pa.setReference(hello);
return pa;
}
use of org.estatio.module.party.dom.Organisation in project estatio by estatio.
the class IncomingDocAsInvoiceViewModel_Test method notification_BuyerBarcodeMatchValidation_works.
@Test
public void notification_BuyerBarcodeMatchValidation_works() {
String notification;
// given
IncomingDocAsInvoiceViewModel viewModel = new IncomingDocAsInvoiceViewModel();
Party buyerDerived = new Organisation();
BuyerFinder buyerFinder = new BuyerFinder() {
@Override
public Party buyerDerivedFromDocumentName(final IncomingInvoice incomingInvoice) {
return buyerDerived;
}
};
IncomingInvoice invoice = new IncomingInvoice();
Party buyerOnViewmodel = new Organisation();
viewModel.setDomainObject(invoice);
viewModel.buyerFinder = buyerFinder;
viewModel.setBuyer(buyerOnViewmodel);
// when
notification = viewModel.getNotification();
// then
Assertions.assertThat(notification).isEqualTo("Buyer does not match barcode (document name); ");
// and given (buyers matching)
viewModel.setBuyer(buyerDerived);
// when
notification = viewModel.getNotification();
// then
Assertions.assertThat(notification).isNull();
// and given (no buyer derived)
BuyerFinder buyerFinderReturningNull = new BuyerFinder() {
@Override
public Party buyerDerivedFromDocumentName(final IncomingInvoice incomingInvoice) {
return null;
}
};
viewModel.buyerFinder = buyerFinderReturningNull;
// when
notification = viewModel.getNotification();
// then
Assertions.assertThat(notification).isNull();
}
Aggregations