Changeset 8107


Ignore:
Timestamp:
Jan 23, 2023, 8:27:43 AM (8 months ago)
Author:
Nicklas Nordborg
Message:

Merge BASE 3.19.6 to the trunk

Location:
trunk
Files:
1 deleted
23 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/.classpath

    r8094 r8107  
    2626  <classpathentry kind="lib" path="lib/dist/json-simple-1.1.1-1.jar"/>
    2727  <classpathentry kind="lib" path="lib/dist/utf8-with-fallback-1.1.0.jar"/>
    28   <classpathentry kind="lib" path="lib/dist/postgresql-42.2.20.jar"/>
    2928  <classpathentry kind="lib" path="lib/dist/httpclient-4.5.13.jar"/>
    3029  <classpathentry kind="lib" path="lib/dist/httpcore-4.4.14.jar"/>
     
    3534  <classpathentry kind="lib" path="lib/dist/poi-ooxml-5.0.0.jar"/>
    3635  <classpathentry kind="lib" path="lib/dist/hibernate-core-5.5.6.Final.jar"/>
     36  <classpathentry kind="lib" path="lib/dist/postgresql-42.5.1.jar"/>
    3737  <classpathentry kind="lib" path="lib/dist/zip4j-2.11.2.jar"/>
    3838  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
  • trunk/doc/3rd-party-components.txt

    r8094 r8107  
    118118
    119119More info : http://jdbc.postgresql.org/
    120 Version   : 42.2.20
     120Version   : 42.5.1
    121121License   : BSD License (postgres.license.txt)
    122 Jar files : postgresql-42.2.20.jar
     122Jar files : postgresql-42.5.1.jar
    123123
    124124
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/ColumnDef.java

    r8083 r8107  
    935935      if (isFilterable && hasFilter)
    936936      {
    937         table.addFilteredColumn(getFilterproperty(), isVisible);
     937        table.addFilteredColumn(getId(), getFilterproperty(), isVisible);
    938938      }
    939939    }
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/PresetSelector.java

    r8083 r8107  
    319319              if (value.startsWith("/"))
    320320              {
    321                 if (value.endsWith("/name") || value.endsWith(".name"))
     321                if (value.endsWith("/name"))
    322322                {
    323323                  value = value.replace("/name", "/.");
  • trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Table.java

    r8083 r8107  
    565565    columnFilter.put(columnId+"@"+row, filterHtml);
    566566  }
    567   void addFilteredColumn(String columnId, boolean visible)
     567  void addFilteredColumn(String columnId, String filterProperty, boolean visible)
    568568  {
    569569    numFilteredColumns++;
    570     if (visible) hiddenFilteredColumns.remove(columnId);
     570    // Swap the filter property with column id if needed
     571    hiddenFilteredColumns.remove(filterProperty);
     572    if (!visible) hiddenFilteredColumns.add(columnId);
    571573  }
    572574  Set<String> getHiddenFilteredColumns()
  • trunk/src/core/common-queries.xml

    r8083 r8107  
    18561856      )
    18571857      AND plg.disabled = false
     1858      AND (cfg.id IS NULL OR cfg.disabled = false)
    18581859      GROUP BY plg.mainType
    18591860    </sql>
  • trunk/src/core/net/sf/basedb/core/Install.java

    r7963 r8107  
    119119    method.
    120120  */
    121   public static final int NEW_SCHEMA_VERSION = Integer.valueOf(151).intValue();
     121  public static final int NEW_SCHEMA_VERSION = Integer.valueOf(152).intValue();
    122122 
    123123  public static synchronized int createTables(SchemaGenerator.Mode mode, ProgressReporter progress,
  • trunk/src/core/net/sf/basedb/core/Job.java

    r7962 r8107  
    128128      {
    129129        throw new InvalidDataException("Plugin " + plugin.getName() + " requires a configuration");
     130      }
     131     
     132      if (plugin.isDisabled())
     133      {
     134        throw new PermissionDeniedException("The plugin is disabled: " + plugin.getName());
     135      }
     136      if (config != null && config.isDisabled())
     137      {
     138        throw new PermissionDeniedException("The plugin configuration is disabled: " + config.getName());
    130139      }
    131140     
  • trunk/src/core/net/sf/basedb/core/PluginConfiguration.java

    r7513 r8107  
    364364    getData().setPluginDefinition(pd.getData());
    365365  }
     366 
     367  /**
     368    Checks if this plugin configuration is disabled or not. A disabled configuration
     369    can't be used.
     370    @since 3.19.6
     371  */
     372  public boolean isDisabled()
     373  {
     374    return getData().isDisabled();
     375  }
     376 
     377  /**
     378    Disabled or enable this plugin configuration.
     379    @since 3.19.6
     380  */
     381  public void setDisabled(boolean disabled)
     382  {
     383    checkPermission(Permission.WRITE);
     384    getData().setDisabled(disabled);
     385  }
    366386
    367387  /**
  • trunk/src/core/net/sf/basedb/core/PluginDefinition.java

    r7513 r8107  
    303303      )
    304304      AND plg.disabled = false
     305      AND (cfg.id IS NULL OR cfg.disabled = false)
    305306      GROUP BY plg.mainType
    306307    */
  • trunk/src/core/net/sf/basedb/core/PropertyFilter.java

    r8094 r8107  
    907907      ItemContext targetItemContext = new ItemContext(targetType, pp);
    908908      targetItemContext.configureQuery(dc, subquery, subContext, true);
     909      subquery.setIncludes(Include.ALL);
    909910      if (context != null && targetItemContext.getException() != null)
    910911      {
  • trunk/src/core/net/sf/basedb/core/Update.java

    r8026 r8107  
    467467    </td>
    468468  </tr>
     469  <tr>
     470    <td>152</td>
     471    <td>
     472      Added {@link PluginConfiguration#isDisabled()}. The update will set the value to FALSE
     473      for all existing configurations.
     474    </td>
     475  </tr>
    469476  </table>
    470477
     
    767774        if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 151...");
    768775        schemaVersion = updateToSchemaVersion151(session, schemaVersion, progress);
     776        progress_current += progress_step;
     777      }
     778     
     779      if (schemaVersion < 152)
     780      {
     781        if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 150...");
     782        schemaVersion = setSchemaVersionInTransaction(session, 152);
    769783        progress_current += progress_step;
    770784      }
  • trunk/src/core/net/sf/basedb/core/data/PluginConfigurationData.java

    r6127 r8107  
    5858  }
    5959// -------------------------------------------
     60  private boolean disabled;
     61  /**
     62    If the plugin is enabled or disabled.
     63    // Mapped in hibernate-properties-PluginConfigurationData.xml since annotation doesn't support a default value
     64    @since 3.19.6
     65  */
     66  public boolean isDisabled()
     67  {
     68    return disabled;
     69  }
     70  public void setDisabled(boolean disabled)
     71  {
     72    this.disabled = disabled;
     73  }
    6074
    6175  private PluginDefinitionData pluginDefinition;
  • trunk/src/core/net/sf/basedb/core/dtd/raw-data-types.dtd

    r5679 r8107  
    2020  along with BASE. If not, see <http://www.gnu.org/licenses/>.
    2121-->
    22 <!ELEMENT raw-data-types (raw-data-type+) >
     22<!ELEMENT raw-data-types (raw-data-type*) >
    2323
    2424<!ELEMENT raw-data-type (property*,intensity-formula*) >
  • trunk/src/core/net/sf/basedb/util/AutoDetectFileFormat.java

    r6127 r8107  
    130130        ItemQuery<PluginConfiguration> configQuery = plugin.getPluginConfigurations();
    131131        configQuery.restrict(Restrictions.gt(Hql.property("parameterVersion"), Expressions.integer(0)));
     132        configQuery.restrict(Restrictions.eq(Hql.property("disabled"), Expressions.parameter("isDisabled", false)));
    132133        configQuery.order(Orders.asc(Hql.property("name")));
    133134        configQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
  • trunk/src/core/net/sf/basedb/util/extensions/manager/Settings.java

    r7231 r8107  
    3232import java.util.List;
    3333
     34import net.sf.basedb.core.Config;
    3435import net.sf.basedb.core.Presets;
    3536import net.sf.basedb.core.Presets.Preset;
     
    7071  private final File file;
    7172  private final ExtensionsManager manager;
     73  private final String pluginsDir;
     74  private final String userFilesDir;
    7275  private boolean hasChanged;
    7376  private Presets presets;
     
    8992    this.manager = manager;
    9093    this.file = file;
     94    this.pluginsDir = new File(Config.getString("plugins.dir")).getAbsolutePath();
     95    this.userFilesDir = new File(Config.getString("userfiles")).getAbsolutePath();
    9196    this.presets = new Presets();
    9297    if (file != null && file.isFile())
     
    104109    }
    105110    this.settings = presets.getDefault();
    106     this.installedFiles = presets.getPreset("installed-files");
    107     this.ignoredFiles = presets.getPreset("ignored-files");
     111    this.installedFiles = fixPaths(presets.getPreset("installed-files"));
     112    this.ignoredFiles = fixPaths(presets.getPreset("ignored-files"));
    108113    this.disabledExtensionPoints = presets.getPreset("disabled-extension-points");
    109114    this.disabledExtensions = presets.getPreset("disabled-extensions");
     
    200205 
    201206  /**
     207    A file is typically stored under the absolute path, but
     208    if it matches the plug-ins directory we replace it with {plugins.dir}.
     209    @since 3.19.6
     210  */
     211  private String toKey(File file)
     212  {
     213    String key = file.getAbsolutePath();
     214    if (pluginsDir != null) key = key.replace(pluginsDir, "{plugins.dir}");
     215    if (userFilesDir != null) key = key.replace(userFilesDir, "{userfiles.dir}");
     216    return key;
     217  }
     218 
     219  /**
     220    A file is typically stored under the absolute path, but
     221    if it matches the plug-ins directory we replace it with {plugins.dir}.
     222    @since 3.19.6
     223  */
     224  private File toFile(String key)
     225  {
     226    if (pluginsDir != null) key = key.replace("{plugins.dir}", pluginsDir);
     227    if (userFilesDir != null) key = key.replace("{userfiles.dir}", userFilesDir);
     228    return new File(key);
     229  }
     230 
     231  /**
     232    Fix paths in older config files. This code can be removed some time in the future when
     233    we are sure that everyone has upgraded. Eg. in BASE 3.21 since we must allow upgrades
     234    between BASE 3.19.x and BASE 3.20.x.
     235  */
     236  private Preset fixPaths(Preset preset)
     237  {
     238    for (String key : preset.getKeys())
     239    {
     240      if (key.contains(pluginsDir))
     241      {
     242        preset.setSetting(key.replace(pluginsDir, "{plugins.dir}"), preset.getSetting(key));
     243        preset.setSetting(key, null);
     244        hasChanged = true;
     245      }
     246      else if (key.contains(userFilesDir))
     247      {
     248        preset.setSetting(key.replace(userFilesDir, "{userfiles.dir}"), preset.getSetting(key));
     249        preset.setSetting(key, null);
     250        hasChanged = true;
     251      }
     252    }
     253    return preset;
     254  }
     255 
     256  /**
    202257    Check if the given file is marked as installed.
    203258    @since 3.0
     
    205260  public boolean isInstalledFile(File file)
    206261  {
    207     return Values.getBoolean(installedFiles.getSetting(file.getAbsolutePath()));
     262    String key = toKey(file);
     263    return Values.getBoolean(installedFiles.getSetting(key));
    208264  }
    209265 
     
    216272    if (file == null) return;
    217273    hasChanged = true;
    218     installedFiles.setSetting(file.getAbsolutePath(), "1");
     274    installedFiles.setSetting(toKey(file), "1");
    219275  }
    220276 
     
    227283    if (file == null) return;
    228284    hasChanged = true;
    229     installedFiles.setSetting(file.getAbsolutePath(), null);
     285    installedFiles.setSetting(toKey(file), null);
    230286  }
    231287 
     
    236292  public List<File> getInstalledFiles()
    237293  {
    238     List<String> paths = installedFiles.getKeys();
    239     List<File> files = new ArrayList<File>(paths.size());
    240     for (String path : paths)
    241     {
    242       files.add(new File(path));
     294    List<String> keys = installedFiles.getKeys();
     295    List<File> files = new ArrayList<File>(keys.size());
     296    for (String key : keys)
     297    {
     298      files.add(toFile(key));
    243299    }
    244300    return files;
     
    252308  public boolean isIgnoredFile(File file)
    253309  {
    254     return Values.getBoolean(ignoredFiles.getSetting(file.getAbsolutePath()));
     310    return Values.getBoolean(ignoredFiles.getSetting(toKey(file)));
    255311  }
    256312 
     
    263319    if (file == null) return;
    264320    hasChanged = true;
    265     ignoredFiles.setSetting(file.getAbsolutePath(), ignore ? "1" :  null);
     321    ignoredFiles.setSetting(toKey(file), ignore ? "1" :  null);
    266322  }
    267323 
     
    272328  public List<File> getIgnoredFiles()
    273329  {
    274     List<String> paths = ignoredFiles.getKeys();
    275     List<File> files = new ArrayList<File>(paths.size());
    276     for (String path : paths)
    277     {
    278       files.add(new File(path));
     330    List<String> keys = ignoredFiles.getKeys();
     331    List<File> files = new ArrayList<File>(keys.size());
     332    for (String key : keys)
     333    {
     334      files.add(toFile(key));
    279335    }
    280336    return files;
  • trunk/www/admin/pluginconfigurations/edit_configuration.jsp

    r7954 r8107  
    7171  String name = null;
    7272  String description = null;
     73  boolean isDisabled = false;
    7374 
    7475  // Load recently used items
     
    105106    name = "Copy of " + originalConfiguration.getName();
    106107    description = originalConfiguration.getDescription();
     108    isDisabled = originalConfiguration.isDisabled();
    107109    try
    108110    {
     
    122124    name = configuration.getName();
    123125    description = configuration.getDescription();
     126    isDisabled = configuration.isDisabled();
    124127    try
    125128    {
     
    193196        <td></td>
    194197      </tr>
     198      <tr>
     199        <th>Disabled</th>
     200        <td>
     201          <input type="radio" name="disabled" id="disabledNo" value="0"
     202            <%=!isDisabled ? "checked" : ""%>><label for="disabledNo">no</label>
     203          <input type="radio" name="disabled" id="disabledYes" value="1"
     204            <%=isDisabled ? "checked" : ""%>><label for="disabledYes">yes</label>
     205        </td>
     206        <td></td>
     207      </tr>
    195208      <tr class="dynamic">
    196209        <th>Description</th>
  • trunk/www/admin/pluginconfigurations/index.jsp

    r7954 r8107  
    174174      configuration.setName(Values.getStringOrNull(request.getParameter("name")));
    175175      configuration.setDescription(Values.getStringOrNull(request.getParameter("description")));
     176      configuration.setDisabled(Values.getBoolean(request.getParameter("disabled")));
    176177      // Annotations tab
    177178      Base.updateAnnotations(dc, configuration, configuration, request);
  • trunk/www/admin/pluginconfigurations/list_configurations.jsp

    r7982 r8107  
    211211        datatype="string"
    212212        title="Plugin definition"
     213        sortable="true"
     214        filterable="true"
     215        exportable="true"
     216      />
     217      <tbl:columndef
     218        id="disabled"
     219        property="disabled"
     220        datatype="boolean"
     221        title="Disabled"
    213222        sortable="true"
    214223        filterable="true"
     
    472481                <tbl:cell column="contexts"><%=plugin == null ? "<i>- denied -</i>" : (contexts.isEmpty() ? "<i>- none -</i>" : Values.getString(contexts, ", ", true))%></tbl:cell>
    473482                <tbl:cell column="pluginDefinition"><%=mode.hasPropertyLink() ? Base.getLinkedName(ID, plugin, plugin == null, mode.hasEditLink()): Base.getEncodedName(nameableProxy, plugin == null)%></tbl:cell>
     483                <tbl:cell column="disabled"><%=item.isDisabled()%></tbl:cell>
    474484                <tbl:cell column="owner"
    475485                  ><base:propertyvalue
  • trunk/www/admin/pluginconfigurations/view_configuration.jsp

    r7954 r8107  
    260260        <th>Registered</th>
    261261        <td><%=dateFormatter.format(configuration.getEntryDate())%></td>
     262      </tr>
     263      <tr>
     264        <th>Disabled</th>
     265        <td><%=configuration.isDisabled() ? "Yes" : "No"%></td>
    262266      </tr>
    263267      <tr>
  • trunk/www/common/import/index.jsp

    r7954 r8107  
    107107        )
    108108      );
     109    configQuery.restrict(Restrictions.eq(Hql.property("disabled"), Expressions.parameter("isDisabled", false)));
    109110    configQuery.order(Orders.asc(Hql.property("name")));
    110111    configQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
  • trunk/www/common/plugin/index.jsp

    r7954 r8107  
    180180      );
    181181    configQuery.restrict(Restrictions.gt(Hql.property("parameterVersion"), Expressions.integer(0)));
     182    configQuery.restrict(Restrictions.eq(Hql.property("disabled"), Expressions.parameter("isDisabled", false)));
    182183    configQuery.order(Orders.asc(Hql.property("name")));
    183184    configQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
Note: See TracChangeset for help on using the changeset viewer.