Fork me on GitHub

CPD Results

The following document contains the results of PMD's CPD 5.3.5.

Duplications

File Line
fr/paris/lutece/plugins/dila/modules/solr/utils/parsers/DilaSolrLocalParser.java 238
fr/paris/lutece/plugins/dila/modules/solr/utils/parsers/DilaSolrPublicParser.java 268
        {
            dateUpdate = null;
        }

        if ( StringUtils.isNotEmpty( _strId ) )
        {
            // Creates a new lucene document
            SolrItem item = new SolrItem(  );

            item.setUrl( url.getUrl(  ) );
            item.setDate( dateUpdate );
            item.setUid( _strId );
            item.setContent( _strContents );
            item.setTitle( _strTitle );
            item.setType( _strType );
            item.setSite( _strSite );

            String[] categories = new String[] { _strAudience };
            item.setCategorie( Arrays.asList( categories ) );

            // Adds the new item to the list
            _listSolrItems.add( item );
        }
    }

    /**
     * Event received at the start of an element
     *
     * @param uri the Namespace URI
     * @param localName the local name
     * @param qName the qualified XML name
     * @param atts the attributes attached to the element
     *
     * @throws SAXException any SAX exception
     */
    public void startElement( String uri, String localName, String qName, Attributes atts )
        throws SAXException
    {
        // Updates the XPath
        _strXPath += ( STRING_SLASH + qName );

        // Gets the URL (attribute)
        String strXPathCard = AppPropertiesService.getProperty( PROPERTY_XPATH_CARD );

        if ( ( _strXPath != null ) && _strXPath.equals( strXPathCard ) )
        {
            String strAttributeId = AppPropertiesService.getProperty( PROPERTY_ATTRIBUTE_ID );
            _strId = atts.getValue( strAttributeId );
        }
    }

    /**
     * Event received at the end of an element
     *
     * @param uri the Namespace URI
     * @param localName the local name
     * @param qName the qualified XML name
     *
     * @throws SAXException any SAX exception
     */
    public void endElement( String uri, String localName, String qName )
        throws SAXException
    {
        // Updates the XPath
        _strXPath = _strXPath.substring( 0, _strXPath.lastIndexOf( STRING_SLASH ) );
    }

    /**
     * Event received when the analyzer encounters text (between two tags)
     *
     * @param ch the characters from the XML document
     * @param start the start position in the array
     * @param length the number of characters to read from the array
     *
     * @throws SAXException any SAX exception
     */
    public void characters( char[] ch, int start, int length )
        throws SAXException
    {
        // Gets the XPath comparisons properties
        String strXPathDate = AppPropertiesService.getProperty( PROPERTY_XPATH_DATE );
        String strXPathTitle = AppPropertiesService.getProperty( PROPERTY_XPATH_TITLE );
        String strXPathAudience = AppPropertiesService.getProperty( PROPERTY_XPATH_AUDIENCE );
File Line
fr/paris/lutece/plugins/dila/modules/solr/search/SolrDilaLocalIndexer.java 93
fr/paris/lutece/plugins/dila/modules/solr/search/SolrDilaPublicIndexer.java 93
        List<SolrItem> listDocuments = localParser.getLocalSolrItems(  );

        List<String> lstErrors = new ArrayList<String>(  );

        for ( SolrItem solrItem : listDocuments )
        {
            try
            {
                SolrIndexerService.write( solrItem );
            }
            catch ( Exception e )
            {
                lstErrors.add( SolrIndexerService.buildErrorMessage( e ) );
                AppLogService.error( COM_INDEXATION_ERROR, e );
            }
        }

        return lstErrors;
    }

    /**
     * {@inheritDoc}
     */
    public boolean isEnable(  )
    {
        return "true".equalsIgnoreCase( AppPropertiesService.getProperty( PROPERTY_INDEXER_ENABLE ) );
    }

    /**
     * {@inheritDoc}
     */
    public List<Field> getAdditionalFields(  )
    {
        // No additional fields for this indexer
        return new ArrayList<Field>(  );
    }

    /**
     * {@inheritDoc}
     */
    public List<SolrItem> getDocuments( String strIdDocument )
    {
        // There is no incremental indexation
        return null;
    }

    /**
     * {@inheritDoc}
     */
    public String getResourceUid( String strResourceId, String strResourceType )
    {
        // There is no incremental indexation
        return null;
    }

    /**
     * {@inheritDoc}
     */
    public List<String> getResourcesName(  )
    {
        // There is no incremental indexation
        return null;
    }
}