Changeset 557 for ether_megapoli


Ignore:
Timestamp:
09/26/12 18:42:00 (12 years ago)
Author:
vmipsl
Message:

simulation

  • display real data
  • getPlateformsByParameter
Location:
ether_megapoli/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/persistence/implementation/com/ether/dao/ParameterDAOImpl.java

    r297 r557  
    55import org.hibernate.criterion.DetachedCriteria; 
    66import org.hibernate.criterion.Order; 
     7import org.hibernate.criterion.Projections; 
    78import org.hibernate.criterion.Restrictions; 
    89import org.jetbrains.annotations.NotNull; 
     
    5758        return selectAllByCriteria( Parametre.class, criteria ); 
    5859    } 
     60 
     61    @Nullable 
     62    public Integer getParameterByCode( @NotNull final String parameterCode ) 
     63            throws PersistenceException 
     64    { 
     65        final DetachedCriteria criteria = DetachedCriteria.forClass( Parametre.class ) 
     66                .add( Restrictions.eq( "parametreCode", parameterCode ) ) 
     67                .setProjection( Projections.property( "parametreId" ) ); 
     68 
     69        return selectByCriteria( Integer.class, criteria ); 
     70    } 
    5971} 
  • ether_megapoli/trunk/persistence/interface/com/ether/dao/ParameterDAO.java

    r297 r557  
    2626    List<Parametre> getAllParametersOrderByCategoryByName() 
    2727            throws PersistenceException; 
     28 
     29    @Nullable 
     30    Integer getParameterByCode( @NotNull final String parameterCode ) 
     31            throws PersistenceException; 
    2832} 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherPlotServiceImpl.java

    r547 r557  
    6969 
    7070        // Bottom Pane 
    71         final JPane jPaneBottom = createBottomPane( megapoliPlot.getValuesNumber(), locale ); 
     71        final JPane jPaneBottom; 
     72        if( megapoliPlot instanceof SimulationPlot ) 
     73            jPaneBottom = createBottomPane( megapoliPlot.getValuesNumber(), ( (SimulationPlot) megapoliPlot ).getRealDataNumber(), locale ); 
     74        else 
     75            jPaneBottom = createBottomPane( megapoliPlot.getValuesNumber(), null, locale ); 
    7276        jPane.add( jPaneBottom, BorderLayout.SOUTH ); 
    7377 
     
    149153     * Create the bottom JPane with the text "published .. (date)" 
    150154     * 
    151      * @param dataNumber : the number of datas extracted from the base 
     155     * @param dataNumber 
     156     * @param realDataNumber 
    152157     * @param locale 
    153158     * @return 
    154159     */ 
    155160    @NotNull 
    156     public JPane createBottomPane( @Nullable final Integer dataNumber, @Nullable final Locale locale ) 
     161    public JPane createBottomPane( @Nullable final Integer dataNumber, @Nullable final Integer realDataNumber, @Nullable final Locale locale ) 
    157162    { 
    158163        final ResourceBundle bundle = WebHelper.getBundle( locale ); 
     
    171176        if( null != dataNumber ) 
    172177        { 
    173             final String messageDataNumber = bundle.getString( "plot.dataNumber" ); 
    174             final JLabel jLabelDataNumber = new JLabel( messageDataNumber + ' ' + dataNumber ); 
    175             jLabelDataNumber.setFont( police ); 
    176             jPaneBottom.add( jLabelDataNumber, BorderLayout.WEST ); 
     178            if( null != realDataNumber ) 
     179            { 
     180                final JLabel jLabelDataNumber = new JLabel( bundle.getString( "plot.dataNumber" ) + ' ' + dataNumber + ' ' + bundle.getString( "plot.simulatedDataNumber" ) + ", " + realDataNumber + ' ' + bundle.getString( "plot.realDataNumber" ) ); 
     181                jLabelDataNumber.setFont( police ); 
     182                jPaneBottom.add( jLabelDataNumber, BorderLayout.WEST ); 
     183            } 
     184            else 
     185            { 
     186                final String messageDataNumber = bundle.getString( "plot.dataNumber" ); 
     187                final JLabel jLabelDataNumber = new JLabel( messageDataNumber + ' ' + dataNumber ); 
     188                jLabelDataNumber.setFont( police ); 
     189                jPaneBottom.add( jLabelDataNumber, BorderLayout.WEST ); 
     190            } 
    177191        } 
    178192 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherServiceImpl.java

    r556 r557  
    997997    } 
    998998 
     999    @Nullable 
     1000    @Transactional(readOnly = true) 
     1001    public Integer getParameterByCode( @NotNull final String parameterCode ) 
     1002            throws ServiceException 
     1003    { 
     1004        try 
     1005        { 
     1006            return _parameterDAO.getParameterByCode( parameterCode ); 
     1007        } 
     1008        catch( PersistenceException e ) 
     1009        { 
     1010            throw new ServiceException( ServiceException.ServiceCode.PARAMETER_NOT_FOUND, e ); 
     1011        } 
     1012    } 
     1013 
    9991014    /** 
    10001015     * This method insert in database the new dimensions, attributes, variables and simulation 
  • ether_megapoli/trunk/service/interface/com/ether/EtherPlotService.java

    r547 r557  
    2323 
    2424    @NotNull 
    25     public JPane createBottomPane( @Nullable final Integer dataNumber, @Nullable final Locale locale ); 
     25    public JPane createBottomPane( @Nullable final Integer dataNumber, @Nullable final Integer realDataNumber, @Nullable final Locale locale ); 
    2626 
    2727    @NotNull 
  • ether_megapoli/trunk/service/interface/com/ether/EtherService.java

    r556 r557  
    231231    List<Plateforme> getPlateformsByParameter( @NotNull final String parameterCode ) 
    232232            throws ServiceException; 
     233 
     234    @Nullable 
     235    Integer getParameterByCode( @NotNull final String parameterCode ) 
     236            throws ServiceException; 
    233237} 
  • ether_megapoli/trunk/web/src/ApplicationResources.properties

    r556 r557  
    552552plot.published=Publi\u00E9 le 
    553553plot.dataNumber=Nombre de donn\u00E9es extraites : 
     554plot.simulatedDataNumber=(simul\u00E9es) 
     555plot.realDataNumber=(r\u00E9elles) 
    554556plot.errorMessage=Erreur de cr\u00E9ation du quicklook. <BR>Veuillez essayer de corriger les erreurs suivantes ou contacter l'administrateur en indiquant les erreurs rencontr\u00E9es. 
    555557plot.noData=Aucune donn\u00E9e extraite 
  • ether_megapoli/trunk/web/src/ApplicationResources_en.properties

    r556 r557  
    553553plot.published=Published 
    554554plot.dataNumber=Number of extracted datas : 
     555plot.simulatedDataNumber=(simulated) 
     556plot.realDataNumber=(real) 
    555557plot.errorMessage=Error creating the quicklook. <BR>Please try to correct the following errors or contact the administrator with the detected errors. 
    556558plot.noData=No extracted data 
  • ether_megapoli/trunk/web/src/com/ether/ControllerSimulation.java

    r556 r557  
    7171 
    7272    @ControllerMethod(jsonResult = true) 
    73     public JSONObject searchPlateformsByVariable( @Mandatory @ParamName(ParameterConstants.PARAMETER_CODE) final String variableCode ) 
     73    public JSONObject searchMobilePlateformsByVariable( @Mandatory @ParamName(ParameterConstants.PARAMETER_CODE) final String variableCode ) 
    7474            throws ServiceException 
    7575    { 
    7676        final List<Plateforme> plateformsByParameter = getEtherService().getPlateformsByParameter( variableCode ); 
    7777 
     78        final List<Plateforme> mobilePlateforms = new ArrayList<Plateforme>(); 
     79        for( final Plateforme plateforme : plateformsByParameter ) 
     80        { 
     81            if( "MOBILE".equals( plateforme.getTypePlateforme().getTypePlateformeNom() ) ) 
     82                mobilePlateforms.add( plateforme ); 
     83        } 
     84 
    7885        final JSONObject result = new JSONObject(); 
    79         result.put( ParameterConstants.PARAMETER_PLATEFORMS, getJsonHelper().toJSON( plateformsByParameter ) ); 
     86        result.put( ParameterConstants.PARAMETER_PLATEFORMS, getJsonHelper().toJSON( mobilePlateforms ) ); 
    8087        return result; 
    8188    } 
  • ether_megapoli/trunk/web/src/com/ether/ControllerSimulationPlot.java

    r556 r557  
    1818import java.io.IOException; 
    1919import java.util.ArrayList; 
     20import java.util.Calendar; 
     21import java.util.Date; 
    2022import java.util.LinkedHashSet; 
    2123import java.util.List; 
     
    5658            throws ServletException 
    5759    { 
    58 //        final boolean flagException = false; 
    59  
    6060        try 
    6161        { 
     
    7070            final boolean displayRealData = Boolean.parseBoolean( request.getParameter( "isRealDataToDisplay" ) ); 
    7171 
    72             // Dates 
    73 //            final String dateBegin = request.getParameter( ParameterConstants.PARAMETER_DATE_BEGIN ); 
    74 //            final String dateEnd = request.getParameter( ParameterConstants.PARAMETER_DATE_END ); 
    75 //            final Calendar calendar = Calendar.getInstance(); 
    76 //            Date formatedDateBegin = null; 
    77 //            Date formatedDateEnd = null; 
    78 //            if( null != dateBegin && null != dateEnd && !"false".equals( dateBegin ) && !"false".equals( dateEnd ) ) 
    79 //                try 
    80 //                { 
    81 //                    calendar.setTimeInMillis( Long.valueOf( dateBegin ) ); 
    82 //                    formatedDateBegin = calendar.getTime(); 
    83 //                    calendar.setTimeInMillis( Long.valueOf( dateEnd ) ); 
    84 //                    formatedDateEnd = calendar.getTime(); 
    85 //                } 
    86 //                catch( Exception e ) 
    87 //                { 
    88 //                    createErrorPane( response, request, WebException.WebCode.INVALID_DATE.toString(), e ); 
    89 //                    flagException = true; 
    90 //                    throw new ServletException( WebException.WebCode.INVALID_DATE.toString(), e ); 
    91 //                } 
     72            Integer plateformId = null; 
     73            if( null != request.getParameter( ParameterConstants.PARAMETER_PLATEFORM_ID ) ) 
     74                plateformId = Integer.parseInt( request.getParameter( ParameterConstants.PARAMETER_PLATEFORM_ID ) ); 
    9275 
    9376            // Create plot 
     
    118101            megapoliPlot.setValuesNumber( parameterValues.size() ); 
    119102 
    120             if( displayRealData ) 
     103            if( displayRealData && null != plateformId ) 
    121104            { 
    122                 // 2D plot : only one parameter to display 
    123 //                final Integer plateformId = (Integer) pIdPIdList.get( 0 ).getFirstValue(); 
    124 //                final Integer parameterId = (Integer) pIdPIdList.get( 0 ).getSecondValue(); 
    125 //                final Data realValuesLists = _etherService.getListsByPlateformByParameterByPeriodFor2D( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 
    126 //                final Data<List, List, List> valuesLists = BouchonHelper.createValuesFor2D( 50 ); 
    127 //                megapoliPlot.setRealData( valuesLists ); 
     105                final Integer parameterId = _etherService.getParameterByCode( variableName ); 
     106                // Dates 
     107                final Calendar calendar = Calendar.getInstance(); 
     108                final Date formatedDateBegin = DateHelper.parseDate( date, "yyyy-MM-dd" ); 
     109                calendar.setTime( formatedDateBegin ); 
     110                calendar.add( Calendar.DAY_OF_YEAR, 1 ); 
     111                final Date formatedDateEnd = calendar.getTime(); 
    128112 
    129 //                megapoliPlot.setRealDataNumber( ( (ArrayList) realValuesLists.getFirstArray() ).size() ); 
     113                final Data realValuesLists = _etherService.getListsByPlateformByParameterByPeriodFor2D( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 
     114                megapoliPlot.setRealData( realValuesLists ); 
     115                megapoliPlot.setRealDataNumber( ( (ArrayList) realValuesLists.getFirstArray() ).size() ); 
    130116            } 
    131117 
     
    137123            try 
    138124            { 
    139 //                if( !flagException ) 
    140125                createErrorPane( response, request, "", e1 ); 
    141126            } 
  • ether_megapoli/trunk/web/visualization/visu_simulation-script.jsp

    r556 r557  
    109109        if( this.selectedVariable ) 
    110110            $.ajax( { 
    111                 url: "simulation?methodName=searchPlateformsByVariable&code=" + this.selectedVariable.getName(), 
     111                url: "simulation?methodName=searchMobilePlateformsByVariable&code=" + this.selectedVariable.getName(), 
    112112                success:jQuery.proxy( this.handlePlateformsByVariable, this ) 
    113113            } ); 
     
    242242                    + "&level=" + this.selectLevels.getValue() 
    243243                    + "&isRasterContour=" + this.selectTypes.getValue() 
    244                     + "&displayRealData=" + $( "#displayRealData" ).attr( 'checked' ) 
     244                    + "&isRealDataToDisplay=" + $( "#displayRealData" ).attr( 'checked' ) 
    245245                    + "&title=" + encodeURIComponent( $( "#textareaTitle" ).val() ); 
     246 
     247            if( this.selectPlateforms && this.selectPlateforms.getValue() ) 
     248                parameters += "&plateformId=" + this.selectPlateforms.getValue(); 
    246249 
    247250            var url = "simulation/simulationPlotEther?" + parameters; 
Note: See TracChangeset for help on using the changeset viewer.