Skip to content

Commit

Permalink
Update copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBestPessimist committed Jun 26, 2020
1 parent 5f8d8f3 commit 502ee46
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 92 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
package de.metas.invoice.invoiceProcessingServiceCompany;

import com.google.common.collect.ImmutableList;
import de.metas.bpartner.BPartnerId;
import de.metas.document.DocTypeId;
import de.metas.product.ProductId;
import de.metas.util.lang.Percent;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;
import lombok.Value;

import java.time.ZonedDateTime;
import java.util.Optional;

/*
* #%L
* de.metas.business
Expand All @@ -36,6 +20,22 @@
* #L%
*/

package de.metas.invoice.invoiceProcessingServiceCompany;

import com.google.common.collect.ImmutableList;
import de.metas.bpartner.BPartnerId;
import de.metas.document.DocTypeId;
import de.metas.product.ProductId;
import de.metas.util.lang.Percent;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;
import lombok.Value;

import java.time.ZonedDateTime;
import java.util.Optional;

@Value
@Builder
public class InvoiceProcessingServiceCompanyConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
package de.metas.invoice.invoiceProcessingServiceCompany;

import com.google.common.collect.ImmutableList;
import de.metas.bpartner.BPartnerId;
import de.metas.cache.CCache;
import de.metas.document.DocTypeId;
import de.metas.product.ProductId;
import de.metas.util.GuavaCollectors;
import de.metas.util.Services;
import de.metas.util.lang.Percent;
import lombok.NonNull;
import org.adempiere.ad.dao.IQueryBL;
import org.compiere.model.I_InvoiceProcessingServiceCompany;
import org.compiere.model.I_InvoiceProcessingServiceCompany_BPartnerAssignment;
import org.compiere.util.TimeUtil;
import org.springframework.stereotype.Repository;

import java.time.ZonedDateTime;
import java.util.Optional;

/*
* #%L
* de.metas.business
Expand All @@ -40,6 +20,26 @@
* #L%
*/

package de.metas.invoice.invoiceProcessingServiceCompany;

import com.google.common.collect.ImmutableList;
import de.metas.bpartner.BPartnerId;
import de.metas.cache.CCache;
import de.metas.document.DocTypeId;
import de.metas.product.ProductId;
import de.metas.util.GuavaCollectors;
import de.metas.util.Services;
import de.metas.util.lang.Percent;
import lombok.NonNull;
import org.adempiere.ad.dao.IQueryBL;
import org.compiere.model.I_InvoiceProcessingServiceCompany;
import org.compiere.model.I_InvoiceProcessingServiceCompany_BPartnerAssignment;
import org.compiere.util.TimeUtil;
import org.springframework.stereotype.Repository;

import java.time.ZonedDateTime;
import java.util.Optional;

@Repository
public class InvoiceProcessingServiceCompanyConfigRepository
{
Expand All @@ -64,22 +64,25 @@ private InvoiceProcessingServiceCompanyConfigMap retrieveAllCompanyConfigs()
.addOnlyActiveRecordsFilter()
.create()
.iterateAndStream()
.map(record -> {
final ImmutableList<InvoiceProcessingServiceCompanyConfigBPartnerDetails> partnerDetails = readAllBPartnerDetails(record);

return InvoiceProcessingServiceCompanyConfig.builder()
.serviceCompanyBPartnerId(BPartnerId.ofRepoId(record.getServiceCompany_BPartner_ID()))
.serviceInvoiceDocTypeId(DocTypeId.ofRepoId(record.getServiceInvoice_DocType_ID()))
.serviceFeeProductId(ProductId.ofRepoId(record.getServiceFee_Product_ID()))
.validFrom(TimeUtil.asZonedDateTime(record.getValidFrom()))
.bpartnerDetails(partnerDetails)
.build();
})
.map(this::fromPO)
.collect(GuavaCollectors.toImmutableList());
return new InvoiceProcessingServiceCompanyConfigMap(collect);
}

private ImmutableList<InvoiceProcessingServiceCompanyConfigBPartnerDetails> readAllBPartnerDetails(@NonNull final I_InvoiceProcessingServiceCompany company)
private InvoiceProcessingServiceCompanyConfig fromPO(@NonNull final I_InvoiceProcessingServiceCompany record)
{
final ImmutableList<InvoiceProcessingServiceCompanyConfigBPartnerDetails> partnerDetails = retrieveAllBPartnerDetails(record);

return InvoiceProcessingServiceCompanyConfig.builder()
.serviceCompanyBPartnerId(BPartnerId.ofRepoId(record.getServiceCompany_BPartner_ID()))
.serviceInvoiceDocTypeId(DocTypeId.ofRepoId(record.getServiceInvoice_DocType_ID()))
.serviceFeeProductId(ProductId.ofRepoId(record.getServiceFee_Product_ID()))
.validFrom(TimeUtil.asZonedDateTime(record.getValidFrom()))
.bpartnerDetails(partnerDetails)
.build();
}

private ImmutableList<InvoiceProcessingServiceCompanyConfigBPartnerDetails> retrieveAllBPartnerDetails(@NonNull final I_InvoiceProcessingServiceCompany company)
{
return queryBL
.createQueryBuilder(I_InvoiceProcessingServiceCompany_BPartnerAssignment.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
* #%L
* de.metas.business
* %%
* Copyright (C) 2020 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/

package de.metas.invoice.invoiceProcessingServiceCompany;

import de.metas.adempiere.model.I_C_InvoiceLine;
Expand Down Expand Up @@ -34,28 +56,6 @@

import static org.adempiere.model.InterfaceWrapperHelper.newInstance;

/*
* #%L
* de.metas.business
* %%
* Copyright (C) 2020 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/

@Service
public class InvoiceProcessingServiceCompanyService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
* #%L
* de.metas.business
* %%
* Copyright (C) 2020 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/

package de.metas.invoice.invoiceProcessingServiceCompany;

import de.metas.adempiere.model.I_C_Invoice;
Expand Down Expand Up @@ -76,28 +98,6 @@
import static org.adempiere.model.InterfaceWrapperHelper.saveRecord;
import static org.assertj.core.api.Assertions.assertThat;

/*
* #%L
* de.metas.business
* %%
* Copyright (C) 2020 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/

@ExtendWith(AdempiereTestWatcher.class)
public class InvoiceProcessingServiceCompanyServiceTest
{
Expand Down

0 comments on commit 502ee46

Please sign in to comment.