Changeset 7290


Ignore:
Timestamp:
Jan 31, 2017, 1:13:44 PM (5 years ago)
Author:
Nicklas Nordborg
Message:

Merged pre-3.10 release changes back to trunk.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/config/dist/mysql-queries.xml

    r7259 r7290  
    8787  </query>
    8888
     89  <query id="PS_FIND_OVERRIDE_ID_FOR_PROJECT_ANNOTATION" type="SQL">
     90    <sql>
     91      UPDATE [Annotations]
     92      SET [override_id] = COALESCE(
     93        (SELECT [tmp].[id] FROM (
     94          SELECT [id] FROM [Annotations]
     95          WHERE [annotationset_id] = :annotationSetId
     96          AND [annotationtype_id] = :annotationTypeId
     97          AND [source] = 0 AND [project_id] = 0
     98        ) [tmp] )
     99        , 0)
     100      WHERE id = :annotationId
     101    </sql>
     102    <description>
     103      Updates the "override_id" column on a newly created project-specific
     104      (PRIMARY) annotation to point to the existing default annotation id
     105      or 0 if no default annotation exists. To make this query work in MySQL
     106      we need a double inner subselect to force a temporary table for the
     107      single value we are after.
     108    </description>
     109  </query>
     110 
     111  <query id="PS_UPDATE_PROJECT_ANNOTATION_OVERRIDE_REF_INHERITED" type="HQL">
     112    <sql>
     113      UPDATE [Annotations]
     114      SET [override_id] = :annotationId
     115      WHERE [annotationset_id] = :annotationSetId
     116      AND [inherited_id] IN (
     117        SELECT [tmp].[id] FROM (
     118          SELECT [id] FROM [Annotations]
     119          WHERE [annotationset_id] = :parentSetId
     120          AND [override_id] = :parentId
     121        ) [tmp]
     122      )
     123    </sql>
     124    <description>
     125      Updates the "override_id" column on project-specific annotations
     126      to point to a newly created default annotation (INHERITED and
     127      CLONED annotations). The subquery will find project-specific annotation
     128      on the parent annotation set that is overriding the inherited annotation.
     129     
     130      To make this query work in MySQL we need a double inner subselect
     131      to force a temporary table for the values we are after.
     132    </description>
     133  </query>
     134 
     135  <query id="PS_FIND_OVERRIDE_ID_FOR_PROJECT_ANNOTATION_INHERITED" type="SQL">
     136    <sql>
     137      UPDATE [Annotations]
     138      SET [override_id] = COALESCE(
     139        (SELECT [tmp].[id] FROM (
     140          SELECT [id] FROM [Annotations]
     141          WHERE [annotationset_id] = :annotationSetId
     142          AND [inherited_id] = :parentOverrideId
     143          AND [source] &lt;&gt; 0
     144          AND [project_id] = 0
     145        ) [tmp])
     146        , 0)
     147      WHERE id = :annotationId
     148    </sql>
     149    <description>
     150      Updates the "override_id" column on a newly created project-specific
     151      (CLONED or INHERITED) annotation to point to the existing default
     152      annotation id or 0 if no default annotation exists.
     153     
     154      To make this query work in MySQL we need a double inner subselect
     155      to force a temporary table for the values we are after.
     156    </description>
     157  </query>
    89158
     159  <query id="PS_RESET_OVERRIDE_ON_PROJECT_ANNOTATIONS" type="HQL">
     160    <sql>
     161      UPDATE [Annotations] 
     162      SET [override_id] = 0
     163      WHERE [override_id] IN (:deletedAnnotations)
     164      OR [inherited_id] IN (
     165        SELECT [tmp].[id] FROM (
     166          SELECT [id] FROM [Annotations]
     167          WHERE [override_id] IN (:deletedPrimaryAnnotations)
     168        ) [tmp]
     169      )
     170    </sql>
     171    <description>
     172      Reset the "override_id" column on project-specific annotations
     173      that points to a default annotation that has been removed.
     174
     175      To make this query work in MySQL we need a double inner subselect
     176      to force a temporary table for the values we are after.
     177    </description>
     178  </query>
     179 
    90180</predefined-queries>
  • trunk/src/clients/web/net/sf/basedb/clients/web/AnnotationUtil.java

    r7208 r7290  
    167167    // The base object has 'id', 'source', 'annotationType' and 'annotation'
    168168    JSONObject json = new JSONObject();
    169     json.put("id", ""+at.getId() + (a!=null ? "-" + a.getId() : ""));
     169    String id = ""+at.getId();
     170    if (a != null) id += "-" + a.getId();
     171    if (inherited != null) id += "-" + inherited.getId();
     172    json.put("id", id);
    170173    // If 'a' is null this is a primary annotation that has no current values
    171174    json.put("source", a == null ? (inherited == null ? "PRIMARY" : "INHERITED") : a.getSource().name());
  • trunk/src/core/common-queries.xml

    r7263 r7290  
    38233823    <description>
    38243824      Updates the "override_id" column on a newly created project-specific
    3825       (PRIMARY) annotation to point to the existing default annotation id
    3826       or 0 if no default annotation exists.
     3825      (CLONED or INHERITED) annotation to point to the existing default
     3826      annotation id or 0 if no default annotation exists.
    38273827    </description>
    38283828  </query>
  • trunk/src/core/net/sf/basedb/core/HibernateUtil.java

    r7252 r7290  
    14021402      session.flush();
    14031403    }
    1404     catch(HibernateException ex)
     1404    catch (ConstraintViolationException ex)
     1405    {
     1406      // This is the best we can do... I think...
     1407      throw new DatabaseException(ex.getSQLException());
     1408    }
     1409    catch (StaleStateException ex)
     1410    {
     1411      throw new ItemModifiedException(ex);
     1412    }
     1413    catch (HibernateException ex)
    14051414    {
    14061415      throw new BaseException(ex);
  • trunk/src/test/TestAnnotation.java

    r7260 r7290  
    100100    // Test: inherit and clone annotations
    101101    int rawBioAssayId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", null, 0, 0, 0, 0, arrayDesignId, false);
     102    int rawBioAssayId2 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", null, 0, 0, 0, 0, arrayDesignId2, false);
    102103    test_inherit_annotation(Item.RAWBIOASSAY, rawBioAssayId, intAnnotationId, false);
    103104    int clonedId = test_inherit_annotation(Item.RAWBIOASSAY, rawBioAssayId, stringAnnotationId, true);
     
    110111    // Test project specific annotations -- set a default value and a project-specific for "Project #1"
    111112    int defaultProjectAnnotationId = test_annotatate(Item.ARRAYDESIGN, arrayDesignId2, projectSpecificId, 0, "default value");
     113    test_inherit_annotation(Item.RAWBIOASSAY, rawBioAssayId2, defaultProjectAnnotationId, false);
     114   
    112115    TestProject.test_activate_project(project1, null);
    113116    int project1AnnotationId = test_annotatate(Item.ARRAYDESIGN, arrayDesignId2, projectSpecificId, 0, "project 1 value");
     117    test_inherit_annotation(Item.RAWBIOASSAY, rawBioAssayId2, project1AnnotationId, false);
    114118    TestProject.test_noactive_project();
     119   
     120    if (defaultProjectAnnotationId == project1AnnotationId)
     121    {
     122      write("--Create project-specific annotation value FAILED (test returns the default value");
     123      ok = false;
     124    }
    115125
    116126    // Check that the annotation values are as expected
     
    120130    TestProject.test_activate_project(project2, null);
    121131    test_project_annotation(Item.ARRAYDESIGN, arrayDesignId2, projectSpecificId, "default value", "project 1 value");
     132
     133   
     134    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
     135   
     136    // Remove project-specific annotation
     137    test_remove_annotation(Item.ARRAYDESIGN, arrayDesignId2, projectSpecificId);
    122138    TestProject.test_noactive_project();
    123    
    124     if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
     139    test_remove_annotation(Item.ARRAYDESIGN, arrayDesignId2, projectSpecificId);
     140   
    125141    // Remove an annotation that is inherited
    126142    test_remove_annotation(Item.ARRAYDESIGN, arrayDesignId, intId);
     
    128144   
    129145    TestRawBioAssay.test_delete(rawBioAssayId);
     146    TestRawBioAssay.test_delete(rawBioAssayId2);
    130147
    131148    // Remove the annotations
     
    184201        l.addAll(Arrays.asList(value));
    185202        Unit unit = unitId != 0 ? Unit.getById(dc, unitId) : null;
    186         a.setValuesIfDifferent(l, unit);
     203        boolean changed = a.setValuesIfDifferent(l, unit);
     204        if (changed && at.getProjectAnnotations() && dc.getSessionControl().getActiveProjectId() != a.getProjectId())
     205        {
     206          // We have created  a different (project-specific) annotation
     207          a = as.getAnnotation(at);
     208        }
    187209      }
    188210      dc.commit();
     
    368390    if (!TestUtil.getSilent())
    369391    {
    370       write("   \tID \tAnnotation type\tAnnotation set\tSource\tParent\tValues\tUnit\tRaw values");
    371       write("-- \t-- \t---------------\t--------------\t------\t------\t------\t----\t----------");
     392      write("   \tID \tAnnotation type\tAnnotation set\tSource\tProject\tParent\tValues\tUnit\tRaw values");
     393      write("-- \t-- \t---------------\t--------------\t------\t-------\t------\t------\t----\t----------");
    372394    }
    373395  }
     
    387409    }
    388410    write(i+":\t"+a.getId()+"\t"+a.getAnnotationType()+"\t"+a.getAnnotationSet()+"\t"+
    389         a.getSource()+"\t"+a.getInheritedFrom()+"\t" +
     411        a.getSource()+"\t"+a.getProjectId()+"\t"+a.getInheritedFrom()+"\t" +
    390412        values + "\t" + a.getUnit() + "\t" + a.getValues());
    391413  }
  • trunk/src/test/TestAnnotationType.java

    r7245 r7290  
    107107    test_delete(id_boolean);
    108108    test_delete(id_enum);
     109    test_delete(id2_enum);
    109110    write("++Testing annotation types "+(ok ? "OK" : "Failed")+"\n");
    110111    return ok;
  • trunk/src/test/TestFileServer.java

    r6576 r7290  
    7979        out.close();
    8080        fs.setServerCertificate(out.toByteArray());
     81        fs.getServerX509Certificate().checkValidity();
    8182      }
    8283      if (clientCertificateFile != null)
     
    8788        fs.setClientCertificate(out.toByteArray());
    8889        fs.setClientCertificatePassword(clientCertificatePassword);
     90        fs.getClientX509Certificate().checkValidity();
    8991      }
    9092      dc.saveItem(fs);
  • trunk/src/test/data/base.onk.lu.se.crt

    r7223 r7290  
    11-----BEGIN CERTIFICATE-----
    2 MIIGADCCBOigAwIBAgISA+0qhg6EOXsjmCadwu8LeW99MA0GCSqGSIb3DQEBCwUA
     2MIIGADCCBOigAwIBAgISA8zlhTYbJUemcfpe5z8gx/03MA0GCSqGSIb3DQEBCwUA
    33MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
    4 ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xNjExMDEyMzE1MDBaFw0x
    5 NzAxMzAyMzE1MDBaMBkxFzAVBgNVBAMTDmJhc2Uub25rLmx1LnNlMIICIjANBgkq
    6 hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwP4+FsJWvAe88wM6JYimiwtruCyhXa4u
    7 pl+tL9Sirkv7huBkcnLTDK7ZLNYIdui0BPGj09Toqjt+DtrzbFzMkLxRWetDIsMV
    8 B0N3nqseAcJQW8bdZ2lXx1rv0Jyaeo/nLQocw/5U83TAGiEtdxHNa4d39AROCcSw
    9 +pbO4R6dhXlAden77iEVL+ojxwX4ckeFUl3k/gB6kQ2ux+JkMyjglO8INC2ub9XQ
    10 9Jb1S4atCKEJLduhcVOD20kPy3iZ/ooU1fvhf3CJqofdAqt70iyR6lpZ07bdmh13
    11 JVTpcKxIFPAAM3iYspxQlMjrpLuFFXXLrCle/7iVD8gl84h63DKST+INk4UN5zku
    12 cbKC82/7RbHDupRYo9KidtKrwKMhLW0ApnBupaZfPmLdE4n+m8v+AxN32XOWCG6c
    13 wrrEcDrZEyR39IA7E6e8CUdhjo6yE91zU5Qepp5LSnwRhA/dzc29/rlye8kNvZqg
    14 C09aJtwb8VM93QJfDYLEBqZE5ra5oE2tP/WNZy5+jw1lwxRUfDvQzjckdl7JWmOn
    15 7F6pMdj7DsGv6BnOzDOGVgxMAspkFBKmW057wNeUoTxPVfM0rbjWPagn7iOnGWnp
    16 7wazFw4+YoHj9WRepLBoB79zJt89ThvuXbD1ngWx0idcRXC4XeaxsRUiDZByoevs
    17 MccblD9oB8sCAwEAAaOCAg8wggILMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAU
    18 BggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUYfM/
    19 iXdjQF2+JZ1KcILFsRxv03owHwYDVR0jBBgwFoAUqEpqYwR93brm0Tm3pkVl7/Oo
     4ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xNjEyMzEyMzAxMDBaFw0x
     5NzAzMzEyMzAxMDBaMBkxFzAVBgNVBAMTDmJhc2Uub25rLmx1LnNlMIICIjANBgkq
     6hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0tH9L14uQFw9IHdkbNiUscUC8+3g3SNb
     7cdBG/g4AWyK8YOdEA5+Rn/C9wNXeZVghUU8McgLx3EN6YNHbyecoBi9wHOlDtiHV
     8ynU6kTB18LSl2D/ZP+qI/ai1VmHeBPBRXIzOImh/2JXQ/dKjie6VBeDZOLDrv94D
     90c/fJvfmupCOm6VTzDqziBjSU32VTXoWCJN9BjgQkEZ5awGKg4SurAohhwiy5teE
     10Fd1n5W4z9fy4ymX/5lxfK3P7V4frYsdqOEYDevLB+X8KigaFzaM3WJdnluHwRHjP
     11jfmeeHPCHTvqNXKHlaf2S72ak27z5VTqw3HfMd0KUO3oRJxZhocV2HErK/k9CxA6
     122zy7VqmfpfDW094hED6c0tp5+kXRo4x9ure8S2HWzLc6GXxQf+7SH5sXgxDYwQbp
     13nesz8Z5E/KdgBs53NRNALoUsc/wcaJw1ba+S8IagqQY8sbubOUialhGjssjjRw7c
     14rjtc2ahNArUBa6/mT973eJ8XzvJ6lOvIIdwNp8xMwh5qNITCtE4/RIvMgoDlmO9f
     15JMG0twaIfetsjndmzBK3Wf3wHK/glW3M/3plxAvlHNWUNuwGURspKudBhQQKyEa3
     16HDPl2qFCeyH4oVSZzr1FjKEKC1A00BTdSPUUu88/gxb3o/nmW7Mz4SRcP5ZhLMcL
     17XNwa0OBQ+C8CAwEAAaOCAg8wggILMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAU
     18BggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQUI7U9
     19wQUPViEUkRZMaQ1yUfmtSP4wHwYDVR0jBBgwFoAUqEpqYwR93brm0Tm3pkVl7/Oo
    20207KEwcAYIKwYBBQUHAQEEZDBiMC8GCCsGAQUFBzABhiNodHRwOi8vb2NzcC5pbnQt
    2121eDMubGV0c2VuY3J5cHQub3JnLzAvBggrBgEFBQcwAoYjaHR0cDovL2NlcnQuaW50
     
    2626IFJlbHlpbmcgUGFydGllcyBhbmQgb25seSBpbiBhY2NvcmRhbmNlIHdpdGggdGhl
    2727IENlcnRpZmljYXRlIFBvbGljeSBmb3VuZCBhdCBodHRwczovL2xldHNlbmNyeXB0
    28 Lm9yZy9yZXBvc2l0b3J5LzANBgkqhkiG9w0BAQsFAAOCAQEAMghFDTBKAZfqUUrT
    29 Njwy86ufTj2XMR1HyVQbxxrVh3bPGePYEK3pEMaAcFey84zr0N6R89fYr6XcKupK
    30 x3XG9COY9PkgkOGTzJDiz8850Y41P96XpMvY8g2HeuRol+dieHpE2kQE7QWk+wsp
    31 QwA0avvI68+gg+d6JGE7IyphVmC9waTStx09P77gOjh4mdV7Xk5pWl6XIwsXjxeG
    32 hGMMfYo4oLA2M6Le7StD4fLpm9AFkctDVMH71FQSImaWMg4HmN63dKljOYjKHjad
    33 +9abpO6JC0DvNcu3FLnb02X8+B8R9MBUmibKL+ole2RN7RrzR8MjQXVIKdbBpXyj
    34 bktITw==
     28Lm9yZy9yZXBvc2l0b3J5LzANBgkqhkiG9w0BAQsFAAOCAQEAK1bssuC+i7ZtoSZy
     29QaGqG9z1cTZ2GN2kPhFjDPA+3G2KHAiZBpEi85GhpJ+l3WdoV3ncmsTWelZ1+1+k
     30VwGz+N4P4gPLmoDj999kUpRN9dys8jeypcDPx9lqqqSSWWXqmF0a9E9bbzrjI+N0
     31RfnWGuBDBWU0Y8CzcOFlwUxJ8C54V3Z4JsniBADK0SWFUHZHcF9HOZMmH+y5awMs
     329BJSmwVgo1GXZnTL5fBC2WFUfL7+SJnp+1dJx+FejYhghKThDjc3zKACgHNYc6wm
     333EEca3idN08FFdQOMOy0xcIxcR5O+hgq6czVbEv2/ypY/ERtDrhL7BuuuQs8/uQ8
     34pTISGw==
    3535-----END CERTIFICATE-----
  • trunk/www/views/jobs/list_jobs.jsp

    r7269 r7290  
    196196        exportable="true"
    197197      />
    198       <%
    199       Enumeration<String, String> jobTypes = new Enumeration<String, String>();
    200       for (ItemSubtype subtype : typeQuery.list(dc))
    201       {
    202         jobTypes.add(Integer.toString(subtype.getId()), HTML.encodeTags(subtype.getName()));
    203       }
    204       %>   
    205198      <tbl:columndef
    206199        id="itemSubtype"
     
    209202        exportproperty="itemSubtype.name:string"
    210203        datatype="int"
    211         enumeration="<%=jobTypes%>"
     204        enumeration="<%=Enumeration.fromItems(typeQuery.list(dc), "-none-")%>"
    212205        title="Subtype"
    213206        sortable="true"
Note: See TracChangeset for help on using the changeset viewer.