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