Beispiel #1
0
  /**
   * Synchronizes the given {@code plugin} with the existing one in the database if it can be found.
   */
  private void synchronizePlugin(Plugin plugin) {

    State pluginState = plugin.getState();
    Database database = getState().getDatabase();
    pluginState.setDatabase(database);

    UUID typeId = pluginState.getTypeId();
    Tool tool = plugin.getTool();
    String internalName = plugin.getInternalName();

    for (Plugin p : getAllPlugins(database)) {
      if (ObjectUtils.equals(typeId, p.getState().getTypeId())
          && ObjectUtils.equals(tool, p.getTool())
          && ObjectUtils.equals(internalName, p.getInternalName())) {
        pluginState.setId(p.getId());
        break;
      }
    }
  }