Changeset 3850


Ignore:
Timestamp:
Oct 17, 2007, 8:45:22 AM (14 years ago)
Author:
Nicklas Nordborg
Message:

References #788: Select project default platforms / variant

The update must also change the value for project with 'affymetrix' as the current default
raw data type to 'platform.affymetrix'. It also sets the default platform.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/common-queries.xml

    r3820 r3850  
    29432943  </query>
    29442944
     2945  <query id="GET_PROJECTS_WITH_DEFAULT" type="HQL">
     2946    <sql>
     2947      SELECT prj
     2948      FROM ProjectData prj
     2949      WHERE prj.projectDefaults[:name] = :value
     2950    </sql>
     2951    <description>
     2952      A HQL query that loads all projects which has a given default value
     2953      for a setting.
     2954    </description>
     2955  </query>
     2956
    29452957
    29462958</predefined-queries>
  • trunk/src/core/net/sf/basedb/core/Update.java

    r3820 r3850  
    5151import net.sf.basedb.core.data.PluginConfigurationData;
    5252import net.sf.basedb.core.data.PluginDefinitionData;
     53import net.sf.basedb.core.data.ProjectData;
    5354import net.sf.basedb.core.data.RawBioAssayData;
    5455import net.sf.basedb.core.data.SchemaVersionData;
     
    16631664    <li>Set a platform for array designs and raw bioassays
    16641665    <li>Change experiment raw data type if it is "affymetrix" to "platform.affymetrix"
     1666    <li>Change project default raw data type if it is "affymetrix" to "platform.affymetrix"
    16651667    <li>Move CEL and CDF files into FileSet:s
    16661668    <li>Remove filters on ArrayDesign.isAffyChip property
     
    17721774      query.setString("newRawDataType", affyRaw.getId());
    17731775      HibernateUtil.executeUpdate(query);
    1774      
     1776   
     1777      // Change raw data type for 'affymetrix' projects to 'platform.affymetrix'
     1778      query = HibernateUtil.getPredefinedQuery(session,
     1779        "GET_PROJECTS_WITH_DEFAULT");
     1780      /**
     1781        SELECT prj
     1782        FROM ProjectData prj
     1783        WHERE prj.projectDefaults[:name] = :value
     1784      */
     1785      query.setString("name", "raw_data_type");
     1786      query.setString("value", "affymetrix");
     1787      List<ProjectData> projects = HibernateUtil.loadList(ProjectData.class, query);
     1788      for (ProjectData project : projects)
     1789      {
     1790        Project p = dc.getItem(Project.class, project);
     1791        p.setDefaultRawDataType(affyRaw);
     1792        p.setDefaultItem(dc, affymetrix, Project.Default.PLATFORM);
     1793      }
     1794   
    17751795      // Update property filters on 'rawDataType=affymetrix' to 'platform.affymetrix'
    17761796      query = HibernateUtil.getPredefinedSQLQuery(session,
  • trunk/www/my_base/projects/edit_project.jsp

    r3848 r3850  
    110110  Platform currentPlatform = null;
    111111  PlatformVariant currentVariant = null;
     112  RawDataType currentRawDataType = null;
    112113 
    113114  if (itemId == 0)
     
    121122    cc.setObject("item", project);
    122123    title = "Edit project -- " + HTML.encodeTags(project.getName());
     124    currentRawDataType = project.getDefaultRawDataType();
    123125   
    124126    try
     
    126128      currentPlatform = (Platform)project.getDefaultItem(dc, Project.Default.PLATFORM);
    127129      currentVariant = (PlatformVariant)project.getDefaultItem(dc, Project.Default.PLATFORM_VARIANT);
     130      if (currentRawDataType != null)
     131      {
     132        if (currentPlatform == null) currentPlatform = currentRawDataType.getPlatform(dc);
     133        if (currentVariant == null) currentVariant = currentRawDataType.getVariant(dc);
     134      }
    128135    }
    129136    catch (PermissionDeniedException ex)
     
    131138      deniedPlatform = true;
    132139    }
     140   
     141    if (currentRawDataType == null && currentVariant != null) currentRawDataType = currentVariant.getRawDataType();
     142    if (currentRawDataType == null && currentPlatform != null) currentRawDataType = currentPlatform.getRawDataType();
     143    if (currentRawDataType == null) currentRawDataType = project.getDefaultRawDataType();
    133144   
    134145    groupQuery = project.getGroups();
     
    141152    throw new PermissionDeniedException(Permission.WRITE, itemType.toString());
    142153  }
    143   RawDataType currentRawDataType = project != null ?
    144     project.getDefaultRawDataType() : null;
    145154 
    146155  ItemQuery<Platform> platformQuery = Platform.getQuery();
Note: See TracChangeset for help on using the changeset viewer.