/** * Return true if the the string is not empty also trimmed. * * @param _in The string to test * @return true if the string is not null and not an empty string and not only contains whitespaces */ public static boolean isSetTrim(String _in) { return !isEmptyTrim(_in); }
public static List<Object> getObjects(DbManager manager, Class<?> type, String id) throws MException { LinkedList<Object> out = new LinkedList<>(); if (MString.isEmptyTrim(id)) return out; if (id.startsWith("(") && id.endsWith(")")) { String aql = id.substring(1, id.length()-1); for (Object o : manager.getByQualification(type, aql, null)) out.add(o); } else { // TODO separate PKs, currently only one PK is supported Object obj = manager.getObject(type, id); if (obj != null) out.add(obj); } return out; }
/** * Try to find initials out of the given title. Use the first letters after whitspaces for the initials. The * returned string is not in upper letters. If you need Upper Letters append toUpper(). * @param title The input String * @param upperOnly Set true if only collect upper characters in title * @param digits Set true if digits (after whitespaces) should also be used. * @param maxSize Max size in characters of the initilas or 0 for no limit. * @return The initials in mixed letters. */ public static String findInitials(String title, boolean upperOnly, boolean digits, int maxSize) { if (isEmptyTrim(title)) return "?"; StringBuilder out = new StringBuilder(); // find first letters boolean isSpace = true; for (int i = 0; i < title.length(); i++) { char c = title.charAt(i); if (isWhitespace(c)) { isSpace = true; } else { if (isSpace) { if ((c >= 'A' && c <= 'Z') || !upperOnly && ( c >= 'a' && c <= 'z') || digits && (c >= '0' && c <= '9')) out.append(c); if (maxSize > 0 && out.length() >= maxSize) break; } isSpace = false; } } return out.toString(); }
public static List<Object> getObjects(DbManagerService service, Class<?> type, String id) throws MException { LinkedList<Object> out = new LinkedList<>(); if (MString.isEmptyTrim(id)) return out; if (id.startsWith("(") && id.endsWith(")")) { String aql = id.substring(1, id.length()-1); for (Object o : service.getManager().getByQualification(type, aql, null)) out.add(o); } else { // TODO separate PKs, currently only one PK is supported Object obj = service.getManager().getObject(type, id); if (obj != null) out.add(obj); } return out; }
if (attribute.length > 1 && !MString.isEmptyTrim(attribute[1])) { type = attribute[1]; } else {
if (MString.isEmptyTrim(configString)) return new HashConfig(); if (configString.startsWith("[") || configString.startsWith("{") ) { try {
/** {@inheritDoc} */ @Override public void inject(DefComponent root) throws MException { String name = root.getString("name", null); if (MString.isEmptyTrim(name)) { System.out.println("default source needs a name"); return; } new FmSource(DataSource.CONNECTOR_TASK_DATA, dbPackage + "." + name).inject(root); new FmSource(DataSource.CONNECTOR_TASK_ENABLED, memPackage + "." + name + "enabled").inject(root); new FmSource(DataSource.CONNECTOR_TASK_OPTIONS, dbPackage + "." + name + "options").inject(root); }
name = tableName; } else if (table == null || MString.isEmptyTrim(table.tableName())) { name = clazz.getSimpleName(); } else { if (table != null &&!MString.isEmptyTrim(table.attributes())) { attributes = MConfig.toConfig(table.attributes()); } else {