@Override public String toString() { return "RequestHistory: lastProcessedRequestSequenceNo=" + m_lastProcessedRequestSequenceNo + ", missingRequestSequenceNos=[" + CollectionUtility.format(m_missingRequestSequenceNos) + "]"; } }
@Override public String toString() { return ResourceListTransferObject.class.getSimpleName() + "[resources=" + CollectionUtility.format(m_resources) + "]"; } }
@Override public String toString() { return "[" + CollectionUtility.format(m_responses.keySet()) + "]"; } }
public void popProperty(String propertyName) { if (ObjectUtility.notEquals(m_propertyStack.peek(), propertyName)) { throw new IllegalStateException("'" + propertyName + "' is not the last element in the stack: [" + CollectionUtility.format(m_propertyStack) + "]"); } m_propertyStack.pop(); }
@Override public String toString() { StringBuilder sb = new StringBuilder("EventBuffer"); if (isEmpty()) { sb.append(" is empty"); } else { sb.append(" contains ").append(size()).append(" events:"); sb.append("\n- "); sb.append(CollectionUtility.format(m_buffer, "\n- ")); } return sb.toString(); } }
/** * comma separated list of simple patterns with * */ public static Pattern simplePatternListToRegex(String patList) { Set<String> patSet = new HashSet<>(); if (patList != null) { for (String s : patList.split("[,\\s]")) { s = s.trim(); if (!s.isEmpty()) { if (!s.startsWith("/")) { s = "/" + s; } s = simplePatternToRegex(s); if (s != null) { patSet.add(s); } } } } if (patSet.isEmpty()) { return null; } return Pattern.compile("(" + CollectionUtility.format(patSet, "|") + ")", Pattern.CASE_INSENSITIVE); }
protected void generateObjectTypeHierarchyRec(JSONObject json, List<String> currentParentObjectTypes, Map<String, List<String>> targetMap) { if (json == null) { return; } if (targetMap == null) { throw new IllegalArgumentException("Argument 'targetMap' must not be null"); } for (Iterator it = json.keys(); it.hasNext();) { String objectType = (String) it.next(); Object subHierarchy = json.opt(objectType); // Create a copy of the current object type list and add the current type to the front List<String> newParentObjectTypes = new ArrayList<>(); newParentObjectTypes.add(objectType); if (currentParentObjectTypes != null) { newParentObjectTypes.addAll(currentParentObjectTypes); } if (subHierarchy instanceof JSONObject && ((JSONObject) subHierarchy).length() > 0) { generateObjectTypeHierarchyRec((JSONObject) subHierarchy, newParentObjectTypes, targetMap); } // Store current result List<String> existingParentObjectTypes = targetMap.get(objectType); if (existingParentObjectTypes != null) { throw new IllegalStateException("Object type '" + objectType + "' has ambiguous parent object types: [" + CollectionUtility.format(existingParentObjectTypes) + "] vs. [" + CollectionUtility.format(newParentObjectTypes) + "]"); } targetMap.put(objectType, newParentObjectTypes); } }
/** * @param cssClass * one or more CSS classes separated by space */ default void addCssClass(String cssClass) { List<String> cssClasses = cssClassesAsList(cssClass); List<String> existingCssClasses = cssClassesAsList(getCssClass()); for (String cssClassStr : cssClasses) { if (existingCssClasses.indexOf(cssClassStr) >= 0) { continue; } existingCssClasses.add(cssClassStr); } setCssClass(CollectionUtility.format(existingCssClasses, " ")); }
/** * @param cssClass * one or more CSS classes separated by space */ default void removeCssClass(String cssClass) { List<String> cssClasses = cssClassesAsList(cssClass); List<String> existingCssClasses = cssClassesAsList(getCssClass()); if (existingCssClasses.removeAll(cssClasses)) { setCssClass(CollectionUtility.format(existingCssClasses, " ")); } }
/** * Creates a where constraints based on the {@link EntityContribution}. This means that from parts etc. are wrapped * inside an EXISTS (SELECT 1 FROM ... WHERE ... ) clause. * * @return a where constraint or null if the {@link EntityContribution} is empty. * <p> * The constraint does not start with "AND" and can be added with {@link #addWhere(String, NVPair...)} by * prepending "AND" */ public static String contributionToConstraintText(EntityContribution contrib) { // if there are no where parts, do nothing EntityContribution whereContribution = createConstraintsContribution(contrib); if (whereContribution == null) { return null; } if (whereContribution.getWhereParts().isEmpty()) { return null; } return CollectionUtility.format(whereContribution.getWhereParts(), " AND "); }
/** * adding an attribute as an entity contribution * <p> * * @param stm * may contain attribute, fromPart and wherePart tags */ @SuppressWarnings("squid:S00107") public String createAttributePartSimple(AttributeStrategy attributeStrategy, Integer aggregationType, String stm, int operation, List<String> bindNames, List<Object> bindValues, boolean plainBind, Map<String, String> parentAliasMap) { EntityContribution contrib = createAttributePart(attributeStrategy, aggregationType, stm, operation, bindNames, bindValues, plainBind, parentAliasMap); if (contrib.isEmpty()) { return null; } return CollectionUtility.format(contrib.getWhereParts(), " AND "); }
sb.append(CollectionUtility.format(contrib.getFromParts(), ", ")); if (!contrib.getWhereParts().isEmpty()) { sb.append(" WHERE "); sb.append(CollectionUtility.format(contrib.getWhereParts(), " AND ")); sb.append(CollectionUtility.format(contrib.getGroupByParts(), ", ")); sb.append(CollectionUtility.format(contrib.getHavingParts(), " AND "));
buf.append(CollectionUtility.format(CollectionUtility.combine(subContrib.getWhereParts(), subContrib.getHavingParts()), " AND ").replaceAll("\\(\\+\\)", "")); buf.append(")"); count++;
@Override public IValidateContentDescriptor validateContent() { IValidateContentDescriptor desc = super.validateContent(); //super check if (desc != null) { return desc; } ITable table = getTable(); //check cells ValidateTableFieldDescriptor tableDesc = null; Set<String> columnNames = new TreeSet<>(); if (table != null) { for (ITableRow row : table.getRows()) { for (IColumn col : table.getColumns()) { if (!col.isContentValid(row)) { if (tableDesc == null) { tableDesc = new ValidateTableFieldDescriptor(this, row, col); } columnNames.add(getColumnName(col)); } } } table.ensureInvalidColumnsVisible(); } if (tableDesc != null) { tableDesc.setDisplayText(TEXTS.get("TableName") + " " + getLabel() + ": " + CollectionUtility.format(columnNames)); } return tableDesc; }
final String s = CollectionUtility.format(childContributions.getWhereParts(), " AND "); if (StringUtility.getTag(entityPart, "whereParts") != null) { entityPart = StringUtility.replaceTags(entityPart, "whereParts", (tagName, tagContent) -> { checkGroupByPart(s); final String s = CollectionUtility.format(childContributions.getGroupByParts(), ", "); if (StringUtility.getTag(entityPart, "groupByParts") != null) { entityPart = StringUtility.replaceTags(entityPart, "groupByParts", (tagName, tagContent) -> { final String s = CollectionUtility.format(childContributions.getHavingParts(), " AND "); if (StringUtility.getTag(entityPart, "havingParts") != null) { entityPart = StringUtility.replaceTags(entityPart, "havingParts", (tagName, tagContent) -> {