Changeset 20754


Ignore:
Timestamp:
01/03/10 14:19:02 (2 years ago)
Author:
julie
Message:

portal bug fix

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bio/tools/main/src/org/intermine/bio/logic/Mine.java

    r20698 r20754  
    2929    private Set<String> organismNames = new HashSet(); 
    3030 
    31     // gene.organismName --> gene.orthologue.organismName --> local/remote --> gene.orthologue.datasets 
     31    // gene.organismName --> gene.orthologue.organismName --> local/remote 
     32    // --> gene.orthologue.datasets 
    3233    private Map<String, Map<String, Set[]>> orthologues = new HashMap(); 
    3334 
  • trunk/bio/webapp/src/org/intermine/bio/web/logic/OrthologueConverter.java

    r20752 r20754  
    3838{ 
    3939 
    40  
    4140    // D. melanogaster, C. lupus familiaris 
    4241    private static final Pattern ORGANISM_SHORTNAME_MATCHER = Pattern.compile("([a-zA-Z]\\..+)"); 
    4342    private Model model; 
    44  
    4543 
    4644    /** 
     
    5149        super(im, webConfig); 
    5250        model = im.getModel(); 
    53  
    5451    } 
    5552 
     
    7067    /** 
    7168     * runs the orthologue conversion pathquery and returns a comma-delimited list of identifiers 
     69     * used on list analysis page for intermine linking 
    7270     * @param profile the user's profile 
    7371     * @param bagType the class of the list, has to be gene I think 
     
    10199    /** 
    102100     * runs the orthologue conversion pathquery and returns list of intermine IDs 
     101     * used in the portal  
    103102     * @param profile the user's profile 
    104103     * @param bagType the class of the list, has to be gene I think 
     
    111110        PathQuery pathQuery = constructPathQuery(bagType, bagName, organismName); 
    112111        pathQuery.setView(bagType + ".id"); 
     112        pathQuery.syncLogicExpression("and"); 
    113113        PathQueryExecutor executor = im.getPathQueryExecutor(profile); 
    114114        ExportResultsIterator it = executor.execute(pathQuery); 
  • trunk/intermine/web/main/src/org/intermine/web/struts/PortalQueryAction.java

    r20753 r20754  
    4949import org.intermine.pathquery.PathException; 
    5050import org.intermine.pathquery.PathQuery; 
     51import org.intermine.util.StringUtil; 
    5152import org.intermine.web.logic.Constants; 
    5253import org.intermine.web.logic.bag.BagConverter; 
     
    114115        } 
    115116 
    116  
    117117        String[] idList = extId.split(","); 
    118118 
     
    130130 
    131131        // If the class is not in the model, we can't continue 
     132        className = StringUtil.capitalise(className); 
    132133        if (model.getClassDescriptorByName(className) == null) { 
    133134            recordError(new ActionMessage("errors.badportalclass"), request); 
     
    166167            for (String converterClassName : additionalConverters.keySet()) { 
    167168 
    168                 String[] addparameters = getAdditionalParameters(request, 
     169                String addparameter = getAdditionalParameter(request, 
    169170                        additionalConverters.get(converterClassName)); 
    170171 
    171                 if (addparameters.length > 0) { 
     172                if (StringUtils.isNotEmpty(addparameter)) { 
    172173 
    173174                    BagConverter bagConverter = getBagConverter(im, webConfig, converterClassName); 
     
    175176                    imBag = profile.createBag(bagName, className, ""); 
    176177                    List<Integer> converted = bagConverter.getConvertedObjectIds(profile, 
    177                             className, bagName, addparameters[0]); 
     178                            className, bagName, addparameter); 
    178179                    // No matches 
    179180                    if (converted.size() <= 0) { 
    180181                        actionMessages.add(Constants.PORTAL_MSG, 
    181                             new ActionMessage("portal.noorthologues", addparameters, extId)); 
     182                            new ActionMessage("portal.noorthologues", addparameter, extId)); 
    182183                        session.setAttribute(Constants.PORTAL_MSG, actionMessages); 
    183184                        return goToResults(mapping, session, webResults); 
    184185                    } 
    185186                    actionMessages.add(Constants.PORTAL_MSG, bagConverter.getActionMessage(extId, 
    186                             converted.size(), className, addparameters)); 
     187                            converted.size(), className, addparameter)); 
    187188                    session.setAttribute(Constants.PORTAL_MSG, actionMessages); 
    188189 
     
    234235    } 
    235236 
    236     private String[] getAdditionalParameters(HttpServletRequest request, String[] paramArray) 
     237    private String getAdditionalParameter(HttpServletRequest request, String[] paramArray) 
    237238    throws UnsupportedEncodingException { 
    238239 
    239     String[] urlFields = paramArray[0].split(","); 
    240     String[] addparameters = new String[urlFields.length]; 
    241     int i = 0; 
    242     for (String urlField : urlFields) { 
    243         // if one of the request vars matches the variables listed in the bagquery 
    244         // config, add the variable to be passed to the custom converter 
    245         String param = request.getParameter(urlField); 
    246         if (StringUtils.isNotEmpty(param)) { 
    247             // the spaces in organisms, eg. D.%20rerio, need to be handled 
    248             addparameters[i] = URLDecoder.decode(param, "UTF-8"); 
    249         } 
    250     } 
    251     return addparameters; 
    252     } 
    253  
    254     private ActionForward goToResults(ActionMapping mapping, 
    255                                       HttpSession session, WebResults webResults) { 
     240        String[] urlFields = paramArray[0].split(","); 
     241        String addparameter = null; 
     242        for (String urlField : urlFields) { 
     243            // if one of the request vars matches the variables listed in the bagquery 
     244            // config, add the variable to be passed to the custom converter 
     245            String param = request.getParameter(urlField); 
     246            if (StringUtils.isNotEmpty(param)) { 
     247                // the spaces in organisms, eg. D.%20rerio, need to be handled 
     248                addparameter = URLDecoder.decode(param, "UTF-8"); 
     249            } 
     250        } 
     251        return addparameter; 
     252    } 
     253 
     254    private ActionForward goToResults(ActionMapping mapping, HttpSession session, 
     255            WebResults webResults) { 
    256256        PagedTable pc = new PagedTable(webResults); 
    257257        String identifier = "col" + index++; 
     
    285285        if (bagListSize == 0 && bagQueryResultSize == 1) { 
    286286            ActionMessage msg = new ActionMessage("results.lookup.noresults.one", 
    287                     new Integer(bagQueryResultSize), 
    288                     className); 
     287                    new Integer(bagQueryResultSize), className); 
    289288            actionMessages.add(Constants.PORTAL_MSG, msg); 
    290289        } else if (bagListSize == 0 && bagQueryResultSize > 1) { 
    291290            ActionMessage msg = new ActionMessage("results.lookup.noresults.many", 
    292                     new Integer(bagQueryResultSize), 
    293                     className); 
     291                    new Integer(bagQueryResultSize), className); 
    294292            actionMessages.add(Constants.PORTAL_MSG, msg); 
    295293        } else if (bagListSize > 0) { 
Note: See TracChangeset for help on using the changeset viewer.