Search in sources :

Example 36 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class DossierTest method testGetRelevantPositionsCapitalAsset.

@Test
public void testGetRelevantPositionsCapitalAsset() {
    final int UNIQUE_UNIT_ID = 1;
    Dossier dos1 = new Dossier();
    Document dos1CapitalAsset = new Document(DocumentType.CAPITAL_ASSET, Document.Directive.HAND_OVER_GOODS, null);
    dos1CapitalAsset.setActive(true);
    Position p1 = new Position();
    p1.setUniqueUnitId(UNIQUE_UNIT_ID);
    p1.setType(PositionType.UNIT);
    Position p2 = new Position();
    p2.setType(PositionType.COMMENT);
    dos1CapitalAsset.appendAll(p1, p2);
    dos1.add(dos1CapitalAsset);
    assertEquals(1, dos1.getRelevantUniqueUnitIds().size());
    assertEquals(UNIQUE_UNIT_ID, (int) dos1.getRelevantUniqueUnitIds().iterator().next());
    dos1CapitalAsset.add(Document.Condition.CANCELED);
    assertTrue("Should have no relevant UniqueUnit ids, but there are:  " + dos1.getRelevantUniqueUnitIds(), dos1.getRelevantUniqueUnitIds().isEmpty());
}
Also used : Position(eu.ggnet.dwoss.redtape.ee.entity.Position) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) Test(org.junit.Test)

Example 37 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class DossierTest method testChangesAllowedClosedDossier.

@Test
public void testChangesAllowedClosedDossier() {
    Dossier dos1 = sampleClosedDossier();
    Dossier dos2 = sampleClosedDossier();
    assertTrue(dos1.changesAllowed(dos2));
    dos2.setReminder(new Reminder());
    dos2.setComment("Ein Kommentar");
    assertTrue(dos1.changesAllowed(dos2));
}
Also used : Reminder(eu.ggnet.dwoss.redtape.ee.entity.Reminder) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) Test(org.junit.Test)

Example 38 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class DossierTest method sampleClosedDossier.

private Dossier sampleClosedDossier() {
    Dossier dos = new Dossier(PaymentMethod.ADVANCE_PAYMENT, true, 1);
    Document d1 = new Document(DocumentType.ORDER, Document.Directive.NONE, null);
    d1.setClosed(true);
    dos.add(d1);
    dos.setClosed(true);
    return dos;
}
Also used : Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 39 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class UniversalSearcherOperation method findCustomer.

/**
 * Find a Customer and return a html formated String representing it.
 * Ensure to add the html start/end tags manually
 * <p/>
 * @param id CustomerId to search for
 * @return a html formated String representing a Customer.
 */
@Override
public String findCustomer(int id) {
    List<Dossier> dossiers = new DossierEao(redTapeEm).findOpenByCustomerId(id);
    String res = "";
    res += customerService.asHtmlHighDetailed(Integer.valueOf(id).longValue());
    res += "<p><h3>Offene Vorgänge:</h3><ol>";
    for (Dossier dossier : dossiers) {
        res += "<li>" + DossierFormater.toHtmlSimpleWithDocument(dossier) + "</li>";
    }
    res += "</ol></p>";
    return res;
}
Also used : Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) DossierEao(eu.ggnet.dwoss.redtape.ee.eao.DossierEao)

Example 40 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class ReceiptUnitOperationIT method asserts.

private void asserts(UniqueUnit receiptUnit, StockTransaction stockTransaction, ReceiptOperation receiptOperation, TradeName contractor) {
    String head = "(" + contractor + "," + receiptOperation + "):";
    // Verify the UniqueUnit
    UniqueUnit uniqueUnit = uniqueUnitAgent.findUnitByIdentifierEager(Identifier.REFURBISHED_ID, receiptUnit.getIdentifier(Identifier.REFURBISHED_ID));
    assertNotNull(head + "Receipt Unit should exist", uniqueUnit);
    assertEquals(head + "Serial not equal", receiptUnit.getIdentifier(Identifier.SERIAL), uniqueUnit.getIdentifier(Identifier.SERIAL));
    // Verify the StockUnit
    StockUnit stockUnit = stockAgent.findStockUnitByUniqueUnitIdEager(uniqueUnit.getId());
    assertNotNull(head + "StockUnit should exist", stockUnit);
    assertEquals(head + "RefurbishId of UniqueUnit and StockUnit must be equal", receiptUnit.getIdentifier(Identifier.REFURBISHED_ID), stockUnit.getRefurbishId());
    assertEquals(head + "StockTransaction must be the same", stockTransaction.getId(), stockUnit.getTransaction().getId());
    if (!ReceiptOperation.valuesBackedByCustomer().contains(receiptOperation)) {
        // If unspecial Operation, no more verification needed.
        assertNull(head + "StockUnit.logicTransaction for " + receiptOperation, stockUnit.getLogicTransaction());
        return;
    }
    // Verify RedTape
    LogicTransaction logicTransaction = stockUnit.getLogicTransaction();
    assertNotNull(head + "StockUnit.logicTransaction for " + receiptOperation, logicTransaction);
    Dossier dossier = redTapeAgent.findByIdEager(Dossier.class, stockUnit.getLogicTransaction().getDossierId());
    assertNotNull(head + "Dossier for LogicTransaction must exist", dossier);
    assertEquals(head + "Dossier.customerId for " + contractor + " with " + receiptOperation, receiptCustomers.getCustomerId(contractor, receiptOperation), dossier.getCustomerId());
    assertEquals(head + "Dossier.activeDocuments", 1, dossier.getActiveDocuments().size());
    Document document = dossier.getActiveDocuments().get(0);
    assertEquals(head + "Document.type", DocumentType.BLOCK, document.getType());
    assertEquals(head + "LogicTransaction.stockUnits and Document.positions.uniqueUnitIds", toUniqueUnitIds(logicTransaction), document.getPositionsUniqueUnitIds());
}
Also used : UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) LogicTransaction(eu.ggnet.dwoss.stock.ee.entity.LogicTransaction) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit)

Aggregations

Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)47 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)30 Test (org.junit.Test)17 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)11 DossierEao (eu.ggnet.dwoss.redtape.ee.eao.DossierEao)8 DocumentHistory (eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory)6 LogicTransaction (eu.ggnet.dwoss.stock.ee.entity.LogicTransaction)6 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)6 Address (eu.ggnet.dwoss.redtape.ee.entity.Address)5 StockUnit (eu.ggnet.dwoss.stock.ee.entity.StockUnit)4 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)3 AddressEmo (eu.ggnet.dwoss.redtape.ee.emo.AddressEmo)3 StockUnitEao (eu.ggnet.dwoss.stock.ee.eao.StockUnitEao)3 RepaymentCustomers (eu.ggnet.dwoss.mandator.api.value.RepaymentCustomers)2 PositionBuilder (eu.ggnet.dwoss.redtape.ee.entity.PositionBuilder)2 Reminder (eu.ggnet.dwoss.redtape.ee.entity.Reminder)2 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)2 ReportLineEao (eu.ggnet.dwoss.report.ee.eao.ReportLineEao)2 Report (eu.ggnet.dwoss.report.ee.entity.Report)2 eu.ggnet.dwoss.rules (eu.ggnet.dwoss.rules)2