Revision 50574
Added by Michele Artini about 6 years ago
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/xml/ISTIUtilityFunction.java | ||
---|---|---|
62 | 62 |
return Arrays.stream(s.split(" ")) |
63 | 63 |
.map(String::toLowerCase) |
64 | 64 |
.map(StringUtils::capitalize) |
65 |
.map(ISTIUtilityFunction::fixApostrophes) |
|
65 | 66 |
.collect(Collectors.joining(" ")); |
66 | 67 |
} |
67 | 68 |
|
69 |
public static String fixApostrophes(final String s) { |
|
70 |
return s.replaceAll("'a", "'A").replaceAll("'e", "'E").replaceAll("'i", "'I").replaceAll("'o", "'O").replaceAll("'u", "'U") |
|
71 |
.replaceAll("a'", "à").replaceAll("e'", "è").replaceAll("i'", "ì").replaceAll("o'", "ò").replaceAll("u'", "ù"); |
|
72 |
} |
|
73 |
|
|
68 | 74 |
public static boolean isValidProject(final String id) { |
69 | 75 |
return Project.isValid(id); |
70 | 76 |
} |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/EnrichLabsPluginNEW.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import org.apache.commons.lang3.StringUtils; |
14 | 14 |
import org.apache.commons.lang3.math.NumberUtils; |
15 |
import org.apache.commons.lang3.text.WordUtils; |
|
16 | 15 |
import org.apache.commons.logging.Log; |
17 | 16 |
import org.apache.commons.logging.LogFactory; |
18 | 17 |
import org.dom4j.Document; |
... | ... | |
32 | 31 |
import eu.dnetlib.data.mdstore.modular.mongodb.MongoMDStore; |
33 | 32 |
import eu.dnetlib.data.mdstore.plugins.objects.CnrAuthor; |
34 | 33 |
import eu.dnetlib.rmi.data.MDStoreServiceException; |
34 |
import eu.dnetlib.xml.ISTIUtilityFunction; |
|
35 | 35 |
|
36 | 36 |
public class EnrichLabsPluginNEW extends AbstractIstiMDStorePlugin { |
37 | 37 |
|
... | ... | |
54 | 54 |
final Map<String, String> names = new HashMap<>(); |
55 | 55 |
|
56 | 56 |
affilationDao.listAffiliations().forEach(a -> { |
57 |
names.putIfAbsent(a.getPid(), WordUtils.capitalize(a.getPerson().toLowerCase()));
|
|
57 |
names.putIfAbsent(a.getPid(), ISTIUtilityFunction.capitalize(a.getPerson()));
|
|
58 | 58 |
labs.putIfAbsent(a.getPid(), new HashMap<>()); |
59 | 59 |
labs.get(a.getPid()).putIfAbsent(a.getYear(), new ArrayList<>()); |
60 | 60 |
labs.get(a.getPid()).get(a.getYear()).add(String.format("%s # %s # %s", a.getGid(), a.getGroupType(), a.getGroup())); |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/EnrichLabsPlugin.java | ||
---|---|---|
9 | 9 |
import java.util.stream.Collectors; |
10 | 10 |
|
11 | 11 |
import org.apache.commons.lang3.math.NumberUtils; |
12 |
import org.apache.commons.lang3.text.WordUtils; |
|
13 | 12 |
import org.apache.commons.logging.Log; |
14 | 13 |
import org.apache.commons.logging.LogFactory; |
15 | 14 |
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; |
... | ... | |
33 | 32 |
import eu.dnetlib.data.mdstore.modular.mongodb.MongoMDStore; |
34 | 33 |
import eu.dnetlib.data.mdstore.plugins.objects.CnrAuthor; |
35 | 34 |
import eu.dnetlib.rmi.data.MDStoreServiceException; |
35 |
import eu.dnetlib.xml.ISTIUtilityFunction; |
|
36 | 36 |
|
37 | 37 |
public class EnrichLabsPlugin extends AbstractIstiMDStorePlugin { |
38 | 38 |
|
... | ... | |
58 | 58 |
for (final Year y : res.getYears()) { |
59 | 59 |
final Integer year = y.getYear(); |
60 | 60 |
for (final Person p : y.getPersons().getList()) { |
61 |
names.putIfAbsent(p.getCode(), WordUtils.capitalize((p.getName() + " " + p.getSurname()).toLowerCase()));
|
|
61 |
names.putIfAbsent(p.getCode(), ISTIUtilityFunction.capitalize(p.getName() + " " + p.getSurname()));
|
|
62 | 62 |
labs.putIfAbsent(p.getCode(), new HashMap<>()); |
63 | 63 |
labs.get(p.getCode()).putIfAbsent(year, p.getLabs().getList()); |
64 | 64 |
} |
Also available in: Unified diff
apostrofi e accenti nei nomi