Project

General

Profile

Revision 23328aba

ID23328aba8aa930dbc69df4a24655384ca6639459
Parent 024216db
Child b3973259

Added by Andreas Müller over 3 years ago

cleanup

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/occurrence/SpecimenOrObservationBase.java
126 126
    @Column(name="recordBasis")
127 127
    @NotNull
128 128
    @Type(type = "eu.etaxonomy.cdm.hibernate.EnumUserType",
129
        parameters = {@org.hibernate.annotations.Parameter(name  = "enumClass", value = "eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType")}
129
        parameters = {@org.hibernate.annotations.Parameter(name = "enumClass", value = "eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType")}
130 130
    )
131 131
    @Audited
132 132
    private SpecimenOrObservationType recordBasis;
......
206 206
    @ManyToMany(fetch=FetchType.LAZY)
207 207
    @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE, CascadeType.DELETE})
208 208
    @NotNull
209
    protected Set<DerivationEvent> derivationEvents = new HashSet<DerivationEvent>();
209
    protected Set<DerivationEvent> derivationEvents = new HashSet<>();
210 210

  
211 211
    @XmlAttribute(name = "publish")
212 212
    @Field(analyze = Analyze.NO)
......
564 564
     */
565 565
    @Transient
566 566
    public Collection<DescriptionElementBase> characterData() {
567
        Collection<DescriptionElementBase> states = new ArrayList<DescriptionElementBase>();
567
        Collection<DescriptionElementBase> states = new ArrayList<>();
568 568
        Set<DescriptionBase<S>> descriptions = this.getDescriptions();
569 569
        for (DescriptionBase<?> descriptionBase : descriptions) {
570 570
            if (descriptionBase.isInstanceOf(SpecimenDescription.class)) {
......
620 620
        //no changes to: individualCount
621 621
        return result;
622 622
    }
623

  
624

  
625 623
}
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/TaxonListController.java
182 182

  
183 183
        Set<NamedArea> areaSet = null;
184 184
        if(areaList != null){
185
            areaSet = new HashSet<NamedArea>(areaList.size());
185
            areaSet = new HashSet<>(areaList.size());
186 186
            areaSet.addAll(areaList);
187 187
            TaxonListController.includeAllSubAreas(areaSet, termService);
188 188
        }
......
209 209

  
210 210
        Set<PresenceAbsenceTerm> statusSet = null;
211 211
        if(status != null) {
212
                statusSet = new HashSet<PresenceAbsenceTerm>(Arrays.asList(status));
212
                statusSet = new HashSet<>(Arrays.asList(status));
213 213
        }
214 214

  
215 215
        return service.findTaxaAndNamesByFullText(searchModes, query,
......
434 434
     * @param areaSet
435 435
     */
436 436
    static public void includeAllSubAreas(Set<NamedArea> areaSet, ITermService termService) {
437
        Collection<NamedArea> tmpAreas = new HashSet<NamedArea>(areaSet);
437
        Collection<NamedArea> tmpAreas = new HashSet<>(areaSet);
438 438
        // expand all areas to include also the sub areas
439 439
        Pager<NamedArea> pager = null;
440 440
        while(true){
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonServiceImpl.java
1528 1528
        QueryFactory taxonBaseQueryFactory = luceneIndexToolProvider.newQueryFactoryFor(TaxonBase.class);
1529 1529

  
1530 1530
        if(sortFields == null){
1531
            sortFields = new  SortField[]{SortField.FIELD_SCORE, new SortField("titleCache__sort", SortField.Type.STRING,  false)};
1531
            sortFields = new SortField[]{SortField.FIELD_SCORE, new SortField("titleCache__sort", SortField.Type.STRING, false)};
1532 1532
        }
1533 1533
        luceneSearch.setSortFields(sortFields);
1534 1534

  
......
1771 1771
                                , CommonTaxonName.class
1772 1772
                                ).build(), "id", null, ScoreMode.Max);
1773 1773
            logger.debug("byCommonNameJoinQuery: " + byCommonNameJoinQuery.toString());
1774
            LuceneSearch byCommonNameSearch = new LuceneSearch(luceneIndexToolProvider, GroupByTaxonClassBridge.GROUPBY_TAXON_FIELD, Taxon.class);
1774
            LuceneSearch byCommonNameSearch = new LuceneSearch(luceneIndexToolProvider,
1775
                    GroupByTaxonClassBridge.GROUPBY_TAXON_FIELD, Taxon.class);
1775 1776
            byCommonNameSearch.setCdmTypRestriction(Taxon.class);
1776 1777
            byCommonNameSearch.setQuery(byCommonNameJoinQuery);
1777 1778
            byCommonNameSearch.setSortFields(sortFields);
1778 1779

  
1779 1780
            DuplicateFilter df = new DuplicateFilter("inDescription.taxon.id");
1780
            Set<String> results=new HashSet<>();
1781 1781
//            ScoreDoc[] hits = searcher.search(tq,df, 1000).scoreDocs;
1782 1782
//
1783 1783
//            byCommonNameSearch.setFilter(df);
......
1821 1821

  
1822 1822
                /*
1823 1823
                 * Here i was facing wired and nasty bug which took me bugging be really for hours until I found this solution.
1824
                 * Maybe this is a bug in java itself java.
1824
                 * Maybe this is a bug in java itself.
1825 1825
                 *
1826 1826
                 * When the string toField is constructed by using the expression TaxonRelationshipType.MISAPPLIED_NAME_FOR().getUuid().toString()
1827 1827
                 * directly:
......
1848 1848

  
1849 1849
                //TODO replace by createByDistributionJoinQuery
1850 1850
                BooleanQuery byDistributionQuery = createByDistributionQuery(namedAreaList, distributionStatusList, distributionFilterQueryFactory);
1851
                Query taxonAreaJoinQuery = distributionFilterQueryFactory.newJoinQuery(Distribution.class, fromField, true, byDistributionQuery, toField, null, ScoreMode.None);
1851
                Query taxonAreaJoinQuery = distributionFilterQueryFactory.newJoinQuery(Distribution.class,
1852
                        fromField, true, byDistributionQuery, toField, null, ScoreMode.None);
1852 1853

  
1853 1854
//                debug code for bug described above
1854 1855
                //does not compile anymore since changing from lucene 3.6.2 to lucene 4.10+
......
1902 1903
        List<SearchResult<TaxonBase>> searchResults = searchResultBuilder.createResultSet(
1903 1904
                topDocsResultSet, multiSearch.getHighlightFields(), dao, idFieldMap, propertyPaths);
1904 1905

  
1905
        int totalHits = topDocsResultSet != null ? topDocsResultSet.totalGroupCount : 0;
1906
        return new DefaultPagerImpl<>(pageNumber, totalHits, pageSize, searchResults);
1906
        int totalHits = (topDocsResultSet != null) ? topDocsResultSet.totalGroupCount : 0;
1907
        return new DefaultPagerImpl<>(pageNumber, Long.valueOf(totalHits), pageSize, searchResults);
1907 1908
    }
1908 1909

  
1909 1910
    /**
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/search/DocumentSearchResult.java
35 35
    /**
36 36
     * key will be a combination of DocumentBuilder.CLASS_FIELDNAME and id field: ID_FIELD
37 37
     */
38
    private final Map<String, Document> docs = new HashMap<String, Document>();
38
    private final Map<String, Document> docs = new HashMap<>();
39 39
    private Map<String,String[]> fieldHighlightMap;
40 40

  
41 41

  
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/search/QueryFactory.java
245 245
    }
246 246

  
247 247
    /**
248
     * creates a query for searching for documents in which the field specified by <code>uuidFieldName</code> matches at least one of the uuid
249
     * of the <code>entities</code>, the sql equivalent of this is <code>WHERE uuidFieldName IN (uuid_1, uuid_2, ...) </code>.
248
     * Creates a query for searching for documents in which the field specified by <code>uuidFieldName</code>
249
     * matches at least one of the uuid of the <code>entities</code>, the sql equivalent of this is
250
     * <code>WHERE uuidFieldName IN (uuid_1, uuid_2, ...) </code>.
250 251
     * @param uuidFieldName
251 252
     * @param entities
252 253
     * @return
......
264 265

  
265 266

  
266 267
    /**
267
     * creates a query for searching for documents in which the field specified by <code>uuidFieldName</code> matches at least one of the
268
     * Creates a query for searching for documents in which the field specified by <code>uuidFieldName</code> matches at least one of the
268 269
     * supplied <code>uuids</code>
269 270
     * the sql equivalent of this is <code>WHERE uuidFieldName IN (uuid_1, uuid_2, ...) </code>.
270 271
     * @param uuidFieldName

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)