public String getText() { return configurationMeta.getId(); }
/** * Return whether a single property has been white listed as being a "main" * configuration property. */ private boolean isWhiteListed(ConfigurationMetadataProperty property, Collection<String> properties) { return properties.contains(property.getId()); }
/** * Return whether a single property has been white listed as being a "main" * configuration property. */ private boolean isWhiteListed(ConfigurationMetadataProperty property, Collection<String> properties) { return properties.contains(property.getId()); }
/** * Return whether a single property has been white listed as being a "main" configuration property. */ private boolean isWhiteListed(ConfigurationMetadataProperty property, Collection<String> properties) { return properties.contains(property.getId()); }
public String getSelectedPropName() { return lCfgProps.getSelectedValue().getId(); }
@Override public int compare(ConfigurationMetadataProperty p1, ConfigurationMetadataProperty p2) { if (!sortDeprLast) { return p1.getId().compareTo(p2.getId()); } else { boolean d1 = p1.isDeprecated(); boolean d2 = p2.isDeprecated(); if (d1 && !d2) { return 1; } else if (d2 && !d1) { return -1; } else { return p1.getId().compareTo(p2.getId()); } } }
/** * Return whether the given property name should be considered matching the candidate * configuration property, also taking into account the list of whitelist properties * (which are tested on their short name). */ static boolean isMatchingProperty(String propertyName, ConfigurationMetadataProperty property, List<ConfigurationMetadataProperty> whiteListedProps) { if (property.getId().equals(propertyName)) { return true; // For any prop } // Handle special case of short form for whitelist else { for (ConfigurationMetadataProperty white : whiteListedProps) { if (property.getId().equals(white.getId())) { // prop#equals() not implemented return property.getName().equals(propertyName); } } return false; } } }
/** * Return whether the given property name should be considered matching the candidate configuration property, also * taking into account the list of whitelist properties (which are tested on their short name). */ static boolean isMatchingProperty(String propertyName, ConfigurationMetadataProperty property, List<ConfigurationMetadataProperty> whiteListedProps) { if (property.getId().equals(propertyName)) { return true; // For any prop } // Handle special case of short form for whitelist else { for (ConfigurationMetadataProperty white : whiteListedProps) { if (property.getId().equals(white.getId())) { // prop#equals() not implemented return property.getName().equals(propertyName); } } return false; } } }
private void assertNoAmbiguity(List<ConfigurationMetadataProperty> longForms) { if (longForms.size() > 1) { Set<String> ids = new HashSet<>(longForms.size()); for (ConfigurationMetadataProperty pty : longForms) { ids.add(pty.getId()); } throw new IllegalArgumentException(String.format("Ambiguous short form property '%s' could mean any of %s", longForms.iterator().next().getName(), ids)); } }
private void assertNoAmbiguity(List<ConfigurationMetadataProperty> longForms) { if (longForms.size() > 1) { Set<String> ids = new HashSet<>(longForms.size()); for (ConfigurationMetadataProperty pty : longForms) { ids.add(pty.getId()); } throw new IllegalArgumentException(String.format("Ambiguous short form property '%s' could mean any of %s", longForms.iterator().next().getName(), ids)); } }
/** * Gets property group id. * * @param prop the prop * @return the property group id */ public static String getPropertyGroupId(final ConfigurationMetadataProperty prop) { if (isCasProperty(prop)) { return StringUtils.substringBeforeLast(prop.getName(), "."); } return StringUtils.substringBeforeLast(prop.getId(), "."); }
private void filterProps(String filter) { DefaultListModel<ConfigurationMetadataProperty> dlmCfgProps = new DefaultListModel<>(); for (ConfigurationMetadataProperty item : sortedProps) { if (filter == null || item.getId().contains(filter)) { if (Utils.isErrorDeprecated(item)) { if (bDeprErrorShow) { dlmCfgProps.addElement(item); } } else { dlmCfgProps.addElement(item); } } } lCfgProps.setModel(dlmCfgProps); if (!dlmCfgProps.isEmpty()) { lCfgProps.setSelectedIndex(0); } }
@Override public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value instanceof ConfigurationMetadataProperty) { ConfigurationMetadataProperty prop = (ConfigurationMetadataProperty) value; if (prop.isDeprecated()) { setText(String.format("<html><s>%s", prop.getId())); if (Utils.isErrorDeprecated(prop)) { setForeground(UIManager.getColor("nb.errorForeground")); } } else { setText(prop.getId()); } } return this; }
/** * Add a {@link ConfigurationMetadataProperty} with the * {@link ConfigurationMetadataSource source} that defines it, if any. * @param property the property to add * @param source the source */ public void add(ConfigurationMetadataProperty property, ConfigurationMetadataSource source) { if (source != null) { putIfAbsent(source.getProperties(), property.getId(), property); } putIfAbsent(getGroup(source).getProperties(), property.getId(), property); }
private String asciidocFor(ConfigurationMetadataProperty property, ClassLoader classLoader) { return String.format("$$%s$$:: $$%s$$ *($$%s$$, default: `$$%s$$`%s)*", property.getId(), niceDescription(property), niceType(property), niceDefault(property), maybeHints(property, classLoader)); }
void addPropertiesProposals(String text, String startsWith, AppRegistration appRegistration, Set<String> alreadyPresentOptions, List<CompletionProposal> collector, int detailLevel){ Resource metadataResource = appRegistry.getAppMetadataResource(appRegistration); // For whitelisted properties, use their simple name if (metadataResource != null) { CompletionProposal.Factory proposals = CompletionProposal.expanding(text); for (ConfigurationMetadataProperty property : metadataResolver.listProperties(metadataResource)) { String name = property.getName(); if (!alreadyPresentOptions.contains(name) && name.startsWith(startsWith)) { collector.add(proposals .withSeparateTokens("--" + property.getName() + "=", property.getShortDescription())); } } // For other properties (including WL'ed in full form), use their id if (detailLevel > 1) { for (ConfigurationMetadataProperty property : metadataResolver.listProperties(metadataResource, true)) { String id = property.getId(); if (!alreadyPresentOptions.contains(id) && id.startsWith(startsWith)) { collector.add(proposals .withSeparateTokens("--" + property.getId() + "=", property.getShortDescription())); } } } } }
public ConfigurationMetadataSearchResult(final ConfigurationMetadataProperty prop, final CasConfigurationMetadataRepository repository) { try { setDefaultValue(prop.getDefaultValue()); setDeprecation(prop.getDeprecation()); setDescription(cleanUpDescription(prop.getDescription())); setShortDescription(cleanUpDescription(prop.getShortDescription())); setId(prop.getId()); setName(prop.getName()); setType(prop.getType()); setGroup(CasConfigurationMetadataRepository.getPropertyGroupId(prop)); setOrder(CasConfigurationMetadataRepository.isCasProperty(prop) ? Ordered.HIGHEST_PRECEDENCE : Ordered.LOWEST_PRECEDENCE); val valueHints = prop.getHints().getValueHints(); valueHints.forEach(hint -> { val values = CollectionUtils.toCollection(hint.getValue()); if (values.contains(RequiresModule.class.getName())) { setRequiredModule(hint.getDescription()); setRequiredModuleAutomated(values.contains(Boolean.TRUE)); } if (values.contains(RequiredProperty.class.getName())) { setRequiredProperty(true); } }); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } }