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());
}
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));
}
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;
}
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;
}
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());
}
Aggregations