Search in sources :

Example 51 with Document

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

the class DocumentTest method testRemove.

@Test
public void testRemove() {
    Document doc = new Document();
    Position p1 = doc.append(Position.builder().amount(1).type(PositionType.UNIT).build());
    assertEquals("Document.posistion.size", 1, doc.getPositions().size());
    doc.remove(p1);
    assertEquals("Document.posistion.size", 0, doc.getPositions().size());
    p1 = doc.append(Position.builder().amount(1).type(PositionType.UNIT).build());
    doc.append(Position.builder().amount(1).type(PositionType.UNIT).build());
    Position p3 = doc.append(Position.builder().amount(1).type(PositionType.UNIT).build());
    doc.append(Position.builder().amount(1).type(PositionType.UNIT).build());
    assertEquals("Document.posistion.size", 4, doc.getPositions().size());
    assertEquals("Postions order", Arrays.asList(1, 2, 3, 4), new ArrayList<>(doc.getPositions().keySet()));
    doc.remove(p1);
    assertEquals("Document.posistion.size", 3, doc.getPositions().size());
    assertEquals("Postions order", Arrays.asList(1, 2, 3), new ArrayList<>(doc.getPositions().keySet()));
    assertEquals("Position p3 should have id 2", 2, p3.getId());
}
Also used : Position(eu.ggnet.dwoss.redtape.ee.entity.Position) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) Test(org.junit.Test)

Example 52 with Document

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

the class DossierTest method sampleOpenDossierWithClosedInvoice.

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

Example 53 with Document

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

the class DossierTest method testGetRelevantPositionsCapitalReturns.

@Test
public void testGetRelevantPositionsCapitalReturns() {
    final int UNIQUE_UNIT_ID = 1;
    Dossier dos1 = new Dossier();
    Document dos1CapitalAsset = new Document(DocumentType.RETURNS, 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 54 with Document

use of eu.ggnet.dwoss.redtape.ee.entity.Document 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 55 with Document

use of eu.ggnet.dwoss.redtape.ee.entity.Document 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)

Aggregations

Document (eu.ggnet.dwoss.redtape.ee.entity.Document)69 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)30 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)22 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)14 DocumentEao (eu.ggnet.dwoss.redtape.ee.eao.DocumentEao)14 DocumentHistory (eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory)13 Test (org.junit.Test)13 LogicTransaction (eu.ggnet.dwoss.stock.ee.entity.LogicTransaction)9 UiCustomer (eu.ggnet.dwoss.customer.opi.UiCustomer)8 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)8 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)8 StockUnit (eu.ggnet.dwoss.stock.ee.entity.StockUnit)7 Address (eu.ggnet.dwoss.redtape.ee.entity.Address)6 UniqueUnitEao (eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao)6 FileJacket (eu.ggnet.dwoss.util.FileJacket)6 DossierEao (eu.ggnet.dwoss.redtape.ee.eao.DossierEao)5 OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)4 File (java.io.File)4 AddressEmo (eu.ggnet.dwoss.redtape.ee.emo.AddressEmo)3 StockUnitEao (eu.ggnet.dwoss.stock.ee.eao.StockUnitEao)3