Project

General

Profile

« Previous | Next » 

Revision 62093

cris repository registration functionality

View differences:

RepositoryServiceImpl.java
116 116
        LOGGER.debug("Initialization method of repository api!");
117 117
        LOGGER.debug("Updated version!");
118 118

  
119
        dataSourceClass.put("opendoar", Arrays.asList("pubsrepository::institutional", "pubsrepository::thematic", "pubsrepository::unknown", "pubsrepository::mock"));
120
        dataSourceClass.put("re3data", Collections.singletonList("datarepository::unknown"));
121
        dataSourceClass.put("journal", Collections.singletonList("pubsrepository::journal"));
122
        dataSourceClass.put("aggregator", Arrays.asList("aggregator::pubsrepository::institutional", "aggregator::pubsrepository::journals", "aggregator::datarepository", "aggregator::pubsrepository::unknown"));
119
        for (String key : this.getVocabulary("dnet:datasource_typologies").getAsMap().keySet()) {
120
            if (key.contains("aggregator")) {
121
                dataSourceClass.putIfAbsent("aggregator", new ArrayList<>());
122
                dataSourceClass.get("aggregator").add(key);
123
            } else if (key.contains("crissystem")) {
124
                dataSourceClass.putIfAbsent("cris", new ArrayList<>());
125
                dataSourceClass.get("cris").add(key);
126
            } else if (key.contains("pubsrepository::journal")) { // do not change order -->
127
                dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
128
            } else if (key.contains("pubsrepository")) { // do not change order <--
129
                dataSourceClass.putIfAbsent("opendoar", new ArrayList<>());
130
                dataSourceClass.get("opendoar").add(key);
131
            } else if (key.contains("datarepository")) {
132
                dataSourceClass.putIfAbsent("re3data", Collections.singletonList("datarepository::unknown"));
133
            } else if (key.contains("pubsrepository::journal")) {
134
                dataSourceClass.putIfAbsent("journal", Collections.singletonList("pubsrepository::journal"));
135
            }
136
        }
123 137

  
124
        invertedDataSourceClass.put("pubsrepository::institutional", "opendoar");
125
        invertedDataSourceClass.put("pubsrepository::thematic", "opendoar");
126
        invertedDataSourceClass.put("pubsrepository::unknown", "opendoar");
127
        invertedDataSourceClass.put("pubsrepository::mock", "opendoar");
128
        invertedDataSourceClass.put("datarepository::unknown", "re3data");
129
        invertedDataSourceClass.put("pubsrepository::journal", "journal");
130
        invertedDataSourceClass.put("aggregator::pubsrepository::institutional", "aggregator");
131
        invertedDataSourceClass.put("aggregator::pubsrepository::journals", "aggregator");
132
        invertedDataSourceClass.put("aggregator::datarepository", "aggregator");
133
        invertedDataSourceClass.put("aggregator::pubsrepository::unknown", "aggregator");
138
        for (Map.Entry<String, List<String>> entry : dataSourceClass.entrySet()) {
139
            entry.getValue().forEach(v -> invertedDataSourceClass.put(v, entry.getKey()));
140
        }
134 141

  
135

  
136 142
        httpHeaders = new HttpHeaders();
137 143
        httpHeaders.setContentType(MediaType.APPLICATION_JSON_UTF8);
138 144

  
......
245 251
            filterKey = "openaire____::opendoar";
246 252
        else if (mode.equalsIgnoreCase("re3data"))
247 253
            filterKey = "openaire____::re3data";
254
        else if (mode.equalsIgnoreCase("cris"))
255
            filterKey = "eurocrisdris::dris";
248 256

  
249 257

  
250 258
        LOGGER.debug("Country code equals : " + country);
......
804 812
            } else if (mode.equalsIgnoreCase("re3data")) {
805 813
                if (entry.getKey().contains("datarepository"))
806 814
                    resultSet.add(entry.getValue());
815
            } else if (mode.equalsIgnoreCase("cris")) {
816
                if (entry.getKey().contains("crissystem"))
817
                    resultSet.add(entry.getValue());
807 818
            }
808 819
        }
809 820

  
......
836 847
                    retMap.put(entry.getKey(), entry.getValue());
837 848
                    foundData = true;
838 849
                }
850
            }
851
            else if (mode.equalsIgnoreCase("cris")) {
852
                if (entry.getKey().contains("openaire-cris")) {
853
                    retMap.put(entry.getKey(), entry.getValue());
854
                    foundData = true;
855
                }
839 856
            } else {
840 857
                if (entry.getKey().matches("^openaire[1-9].0$") || entry.getKey().equals("driver"))
841 858
                    retMap.put(entry.getKey(), entry.getValue());
......
869 886
            } else if (mode.equalsIgnoreCase("re3data")) {
870 887
                if (entry.getKey().contains("datarepository"))
871 888
                    retMap.put(entry.getKey(), entry.getValue());
889
            } else if (mode.equalsIgnoreCase("cris")) {
890
                if (entry.getKey().contains("crissystem"))
891
                    retMap.put(entry.getKey(), entry.getValue());
872 892
            }
873 893
        }
874 894
        return filterResults(retMap, mode);
......
909 929
    public Map<String, String> getListLatestUpdate(String mode) throws JSONException {
910 930
        if (mode.equals("opendoar"))
911 931
            return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("openaire____::" + mode).get(0).getLastCollectionDate());
932
        else if (mode.equals("cris"))
933
            return Collections.singletonMap("lastCollectionDate", getRepositoryInterface("eurocrisdris::dris").get(0).getLastCollectionDate());
912 934
        else
913 935
            /*
914 936
             * first api of re3data has null value on collection date

Also available in: Unified diff