congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PluginProperty
Code IndexAdd Tabnine to your IDE (free)

How to use
PluginProperty
in
org.jtalks.jcommune.model.entity

Best Java code snippets using org.jtalks.jcommune.model.entity.PluginProperty (Showing top 13 results out of 315)

origin: jtalks-org/jcommune

@Override
public List<PluginProperty> getDefaultConfiguration() {
  PluginProperty width = new PluginProperty(WIDTH_PROPERTY, INT, "100");
  PluginProperty height = new PluginProperty(HEIGHT_PROPERTY, INT, "50");
  PluginProperty length = new PluginProperty(LENGTH_PROPERTY, INT, "4");
  PluginProperty possibleSymbols = new PluginProperty(POSSIBLE_SYMBOLS_PROPERTY, STRING, "0123456789");
  return Arrays.asList(width, height, length, possibleSymbols);
}
origin: jtalks-org/jcommune

/**
 * {@inheritDoc}
 */
@Override
public List<PluginProperty> getConfiguration() {
  PluginProperty orderProperty = new PluginProperty(ORDER_PROPERTY, PluginProperty.Type.INT,
      String.valueOf(order));
  orderProperty.setHint(ORDER_HINT);
  return Arrays.asList(orderProperty);
}
origin: jtalks-org/jcommune

/**
 * {@inheritDoc}
 */
@Override
protected Map<PluginProperty, String> applyConfiguration(List<PluginProperty> properties)
    throws PluginConfigurationException {
  if (properties.size() == 1 && ORDER_PROPERTY.equalsIgnoreCase(properties.get(0).getName())) {
    order = properties.get(0).getValue() == null ? DEFAULT_ORDER_VALUE
        : Integer.parseInt(properties.get(0).getValue());
    properties.get(0).setHint(ORDER_HINT);
    return new HashMap<>();
  } else {
    throw new PluginConfigurationException(
        "Can't apply configuration: incorrect parameters count or order not found");
  }
}
origin: jtalks-org/jcommune

@Override
protected Map<PluginProperty, String> applyConfiguration(List<PluginProperty> properties)
    throws PluginConfigurationException {
  String url = null;
  String login = null;
  String password = null;
  for (PluginProperty property : properties) {
    if (URL_PROPERTY.equalsIgnoreCase(property.getName())) {
      url = property.getValue() == null ? null : property.getValue().trim();
    } else if (LOGIN_PROPERTY.equalsIgnoreCase(property.getName())) {
      login = property.getValue() == null ? null : property.getValue().trim();
    } else if (PASSWORD_PROPERTY.equalsIgnoreCase(property.getName())) {
      password = property.getValue();
    }
  }
  if (url == null || url.isEmpty()) {
    // this should be returned as a map, but this mechanism should be implemented in the plugin API first
    throw new PluginConfigurationException("Can't apply configuration: Url should not be null.");
  } else if (!validateUrl(url)) {
    throw new PluginConfigurationException("Can't apply configuration: Incorrect format for Url value.");
  }
  service = new PoulpeAuthService(url, login, password);
  pluginProperties = properties;
  return new HashMap<>();
}
origin: jtalks-org/jcommune

public static PluginProperty getDefaultPluginConfigurationProperty() {
  PluginProperty property = new PluginProperty("Property", PluginProperty.Type.BOOLEAN, "true");
  PluginConfiguration configuration = new PluginConfiguration("Default name", true, Arrays.asList(property));
  property.setPluginConfiguration(configuration);
  persist(configuration);
  return property;
}
origin: jtalks-org/jcommune

  /**
   * {@inheritDoc}
   */
  @Override
  public void updateProperties(List<PluginProperty> properties) {

    for (PluginProperty property: properties) {
      PluginProperty persistedProperty = (PluginProperty) session().load(property.getClass(), property.getId());
      persistedProperty.setValue(property.getValue());
      session().saveOrUpdate(persistedProperty);
    }

    session().flush();
  }
}
origin: jtalks-org/jcommune

/**
 * Translate labels for specified plugin into language which selected by current user as forum language.
 *
 * @param properties list of properties to translate
 * @param plugin plugin with have specified properties
 *
 * @return map of properties translation depending from name
 */
private Map<String, String> translatePropertiesLabels(List<PluginProperty> properties, Plugin plugin) {
  Map<String, String> labels = new HashMap<>();
  Locale locale = userService.getCurrentUser().getLanguage().getLocale();
  for (PluginProperty property : properties) {
    String translation = plugin.translateLabel(property.getName(), locale);
    labels.put(property.getName(), translation);
    if (property.getHint() != null) {
      String hintTranslation = plugin.translateLabel(property.getHint(), locale);
      labels.put(property.getHint(), hintTranslation);
    }
  }
  return labels;
}
origin: jtalks-org/jcommune

/**
 * {@inheritDoc}
 */
@Override
public void saveOrUpdate(PluginConfiguration entity) {
  for (PluginProperty property: entity.getProperties()) {
    property.setPluginConfiguration(entity);
  }
  super.saveOrUpdate(entity);
}
origin: jtalks-org/jcommune

for (PluginProperty property : properties) {
  try {
    switch (property.getName()) {
      case WIDTH_PROPERTY:
        width = Integer.valueOf(property.getValue());
        break;
      case HEIGHT_PROPERTY:
        height = Integer.valueOf(property.getValue());
        break;
      case LENGTH_PROPERTY:
        length = Integer.valueOf(property.getValue());
        break;
      case POSSIBLE_SYMBOLS_PROPERTY:
        possibleSymbols = property.getValue();
        break;
    LOGGER.error(property.getValue() + " is not valid value for property " + property.getName(), ex);
origin: jtalks-org/jcommune

/**
 * {@inheritDoc}
 */
@Override
public List<PluginProperty> getDefaultConfiguration() {
  PluginProperty orderProperty = new PluginProperty(ORDER_PROPERTY, PluginProperty.Type.INT,
      String.valueOf(DEFAULT_ORDER_VALUE));
  orderProperty.setHint(ORDER_HINT);
  return Arrays.asList(orderProperty);
}
origin: jtalks-org/jcommune

private void saveNewPluginConfiguration(PluginConfiguration newPluginConfiguration) {
  List<PluginProperty> properties = newPluginConfiguration.getProperties();
  for (PluginProperty property : properties) {
    property.setPluginConfiguration(newPluginConfiguration);
  }
  this.getDao().updateProperties(newPluginConfiguration.getProperties());
}
origin: jtalks-org/jcommune

@Override
public List<PluginProperty> getDefaultConfiguration() {
  PluginProperty url = new PluginProperty(URL_PROPERTY, STRING, "http://localhost:8080");
  PluginProperty login = new PluginProperty(LOGIN_PROPERTY, STRING, "user");
  PluginProperty password = new PluginProperty(PASSWORD_PROPERTY, STRING, "1234");
  return Arrays.asList(url, login, password);
}
origin: jtalks-org/jcommune

@Override
public List<PluginProperty> getDefaultConfiguration() {
  PluginProperty url = new PluginProperty("URL", STRING, "http://localhost:1234");
  return Arrays.asList(url);
}
org.jtalks.jcommune.model.entityPluginProperty

Most used methods

  • <init>
  • getName
  • getValue
  • setPluginConfiguration
  • getHint
  • getId
  • setHint
  • setValue

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JCheckBox (javax.swing)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now