Search in sources :

Example 1 with Tuple2

use of eu.ggnet.dwoss.util.Tuple2 in project dwoss by gg-net.

the class UniversalSearcherOperation method findCustomers.

/**
 * Returns a List of short descriptions of Customers in Html.
 * Ensure to add the html start/end tags manually
 * <p/>
 * @param firma    the firma or null
 * @param vorname  the vorname or null
 * @param nachname the nachname or null
 * @param email    the email or null
 * @return a List of short descriptions of Customers in Html.
 */
// RedTape createCustomer Contorller.
@Override
public List<Tuple2<Long, String>> findCustomers(String firma, String vorname, String nachname, String email) {
    List<UiCustomer> customers = customerService.asUiCustomers(firma, vorname, nachname, email, true);
    List<Tuple2<Long, String>> result = new ArrayList<>(customers.size());
    for (UiCustomer customer : customers) {
        result.add(new Tuple2(customer.getId(), customer.getSimpleHtml()));
    }
    return result;
}
Also used : Tuple2(eu.ggnet.dwoss.util.Tuple2) UiCustomer(eu.ggnet.dwoss.customer.opi.UiCustomer)

Example 2 with Tuple2

use of eu.ggnet.dwoss.util.Tuple2 in project dwoss by gg-net.

the class UniversalSearcherOperation method searchDossiers.

/**
 * Search for Dossiers where the search matches the identifier.
 * This method will search for any partial matches from the beginning of a identifier if a wildcard is used.
 * <p/>
 * @param identifier the identifier to search for
 * @return a List of Tuple2 containing dossier.id and string representation
 */
// Used in Misc. Unversal Search
@Override
public List<Tuple2<Long, String>> searchDossiers(String identifier) {
    List<Tuple2<Long, String>> result = new ArrayList<>();
    List<Dossier> dossiers = new DossierEao(redTapeEm).findByIdentifier(identifier);
    for (Dossier dossier : dossiers) {
        String s = DossierFormater.toHtmlSimple(dossier);
        Tuple2<Long, String> tuple = new Tuple2<>(dossier.getId(), s);
        result.add(tuple);
    }
    return result;
}
Also used : Tuple2(eu.ggnet.dwoss.util.Tuple2) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) DossierEao(eu.ggnet.dwoss.redtape.ee.eao.DossierEao)

Example 3 with Tuple2

use of eu.ggnet.dwoss.util.Tuple2 in project dwoss by gg-net.

the class UnitAvailabillityTryout method main.

public static void main(String[] args) {
    Dl.remote().add(UnitOverseer.class, new UnitOverseer() {

        private Map<String, Tuple2<UnitShard, String>> data = new HashMap<>();

        {
            data.put("1", new Tuple2<>(new UnitShard("1", 1, "SopoNr.: 1", Boolean.TRUE, 1), "Details zu Unit 1"));
            data.put("2", new Tuple2<>(new UnitShard("2", 2, "SopoNr.: 2", Boolean.FALSE, 1), "Details zu Unit 2"));
            data.put("3", new Tuple2<>(new UnitShard("3", 3, "SopoNr.: 3", Boolean.TRUE, 1), "Details zu Unit 3"));
            data.put("4", new Tuple2<>(new UnitShard("4", 4, "SopoNr.: 4", Boolean.FALSE, 1), "Details zu Unit 4"));
            data.put("5", new Tuple2<>(new UnitShard("5", 5, "SopoNr.: 5 exitiert nicht", null, null), "Existiert Nicht"));
            data.put("6", new Tuple2<>(new UnitShard("6", 6, "SopoNr.: 6", Boolean.FALSE, null), "Details zu Unit 6"));
        }

        @Override
        public String toDetailedHtml(String refurbishId, String username) {
            if (!data.containsKey(refurbishId))
                return refurbishId + " existiert nicht";
            return data.get(refurbishId)._2;
        }

        @Override
        public UnitShard find(String refurbishId) {
            if (!data.containsKey(refurbishId))
                return new UnitShard(refurbishId, 0, "SopoNr.: " + refurbishId + " exitiert nicht", null, null);
            return data.get(refurbishId)._1;
        }

        @Override
        public boolean isAvailable(String refurbishId) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void lockStockUnit(long dossierId, String refurbishedId) throws IllegalStateException {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Result<List<Position>> createUnitPosition(String refurbishId, long documentId) throws UserInfoException {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public String toDetailedHtml(int uniqueUnitId, String username) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    Ui.exec(() -> {
        UiCore.startSwing(() -> new JLabel("Main Application"));
        Ui.build().swing().show(() -> new UnitAvailabilityViewCask());
    });
}
Also used : UnitAvailabilityViewCask(eu.ggnet.dwoss.redtapext.ui.cap.UnitAvailabilityViewCask) UnitOverseer(eu.ggnet.dwoss.redtapext.ee.UnitOverseer) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) UnitShard(eu.ggnet.dwoss.uniqueunit.api.UnitShard) JLabel(javax.swing.JLabel) Result(eu.ggnet.dwoss.util.interactiveresult.Result) Tuple2(eu.ggnet.dwoss.util.Tuple2) UserInfoException(eu.ggnet.dwoss.util.UserInfoException)

Example 4 with Tuple2

use of eu.ggnet.dwoss.util.Tuple2 in project dwoss by gg-net.

the class UniversalSearcherOperation method searchCustomers.

/**
 * Returns a List of short descriptions of Customers in Html.
 * Ensure to add the html start/end tags manually
 * <p/>
 * @param search a search string.
 * @return a List of short descriptions of Customers in Html.
 */
// misc and redTape.
@Override
public List<Tuple2<Long, String>> searchCustomers(String search) {
    List<UiCustomer> customers = customerService.asUiCustomers(search);
    List<Tuple2<Long, String>> result = new ArrayList<>(customers.size());
    for (UiCustomer customer : customers) {
        result.add(new Tuple2((long) customer.getId(), customer.getSimpleHtml()));
    }
    return result;
}
Also used : Tuple2(eu.ggnet.dwoss.util.Tuple2) UiCustomer(eu.ggnet.dwoss.customer.opi.UiCustomer)

Example 5 with Tuple2

use of eu.ggnet.dwoss.util.Tuple2 in project dwoss by gg-net.

the class UniversalSearcherOperation method searchUnits.

/**
 * Returns a List of short descriptions of Units in Html.
 * Ensure to add the html start/end tags manually
 * <p/>
 * @param search a search string.
 * @return a List of short descriptions of Units in Html.
 */
// Used in Misc. Unversal Search
@Override
public List<Tuple2<Long, String>> searchUnits(String search) {
    List<UniqueUnit> uus = new UniqueUnitEao(uuEm).find(search);
    List<Tuple2<Long, String>> result = new ArrayList<>(uus.size());
    Set<Long> uurefurbishIds = new HashSet<>();
    for (UniqueUnit uu : uus) {
        // TODO: WARNING, if we start using letters in refurbhisIds, the search will not show any results.
        try {
            long sopoNr = Long.parseLong(uu.getRefurbishId());
            uurefurbishIds.add(sopoNr);
            result.add(new Tuple2(sopoNr, UniqueUnitFormater.toSimpleHtml(uu)));
        } catch (NumberFormatException e) {
            continue;
        }
    }
    if (bridgeInstance.isUnsatisfied())
        return result;
    for (LegacyUnit unit : bridgeInstance.get().findUnit(search)) {
        try {
            if (uurefurbishIds.contains(Long.parseLong(unit.getUnitIdentifier())))
                continue;
            String re = "<b>" + unit.getUnitIdentifier() + "</b> - ";
            re += unit.getSerial() + "<br />";
            re += unit.getManufacturerPartNo() + "<br />";
            re += "Status: <i>Nicht verfügbar (Legacy System:" + bridgeInstance.get().localName() + ")</i><br />";
            result.add(new Tuple2<>(Long.parseLong(unit.getUnitIdentifier()), re));
        } catch (NumberFormatException e) {
        // Ignore
        }
    }
    return result;
}
Also used : LegacyUnit(eu.ggnet.dwoss.redtape.ee.api.LegacyUnit) UniqueUnitEao(eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao) UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) Tuple2(eu.ggnet.dwoss.util.Tuple2)

Aggregations

Tuple2 (eu.ggnet.dwoss.util.Tuple2)7 UiCustomer (eu.ggnet.dwoss.customer.opi.UiCustomer)2 JLabel (javax.swing.JLabel)2 LegacyUnit (eu.ggnet.dwoss.redtape.ee.api.LegacyUnit)1 DocumentEao (eu.ggnet.dwoss.redtape.ee.eao.DocumentEao)1 DossierEao (eu.ggnet.dwoss.redtape.ee.eao.DossierEao)1 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)1 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)1 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)1 UnitOverseer (eu.ggnet.dwoss.redtapext.ee.UnitOverseer)1 UnitAvailabilityViewCask (eu.ggnet.dwoss.redtapext.ui.cap.UnitAvailabilityViewCask)1 UnitShard (eu.ggnet.dwoss.uniqueunit.api.UnitShard)1 UniqueUnitEao (eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao)1 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)1 UserInfoException (eu.ggnet.dwoss.util.UserInfoException)1 Result (eu.ggnet.dwoss.util.interactiveresult.Result)1