Project

General

Profile

« Previous | Next » 

Revision 60657

author format: surname, name

View differences:

EnrichLabsPlugin.java
35 35

  
36 36
	@Override
37 37
	protected void reconfigure(final Map<String, String> params) {
38
		affiliations = dao.listPersonsWithAffiliations()
39
				.stream()
40
				.collect(Collectors.toMap(Person::getId, a -> a));
38
		affiliations = dao.listPersonsWithAffiliations().stream().collect(Collectors.toMap(Person::getId, a -> a));
41 39
	}
42 40

  
43 41
	@Override
......
58 56
				final Matcher matcher = pattern.matcher(infoId);
59 57
				if (matcher.find()) {
60 58
					final String code = matcher.group(1);
61
					final String fullname = XsltFunctions.capitalize(String.format("%s %s", matcher.group(3), matcher.group(2)));
59
					final String surname = matcher.group(2);
60
					final String name = matcher.group(3);
62 61

  
63 62
					final Person p = affiliations.get(code);
64 63

  
65 64
					if (p != null) {
66 65
						final Set<Group> groups = p.getAffiliations().get(year);
67 66
						if (groups != null) {
68
							cp.setName(p.getName());
67
							cp.setName(p.getFullname());
69 68
							for (final Group g : groups) {
70 69
								if (!g.getId().equals(UNKNOWN_GROUP.getId())) {
71
									cp.getAffiliations().add(new Affiliation(code, g.getType(), g.getId(), g.getName()));
70
									cp.getAffiliations().add(new Affiliation(code,
71
											g.getType(), g.getId(), g.getName()));
72 72
								}
73 73
							}
74 74
						} else {
75
							log.info("Affiliation not found, infoId: " + infoId + ", year: " + year);
75
							log.info("Affiliation not found, infoId: " +
76
									infoId + ", year: " + year);
76 77
							dao.registerAffiliation(code, UNKNOWN_GROUP.getId(), year);
77 78
							p.getAffiliations().put(year, Sets.newHashSet(UNKNOWN_GROUP));
78 79
						}
80

  
79 81
					} else {
80 82
						log.info("Person not found, infoId: " + infoId + ", year: " + year);
81
						dao.registerPerson(code, fullname);
83
						dao.registerPerson(code, XsltFunctions.capitalize(name), XsltFunctions.capitalize((surname)));
82 84
						dao.registerAffiliation(code, UNKNOWN_GROUP.getId(), year);
83 85

  
84
						final Person np = new Person(code, fullname);
86
						final Person np = new Person(code, String.format("%s, %s", surname, name));
85 87
						np.getAffiliations().put(year, Sets.newHashSet(UNKNOWN_GROUP));
86 88

  
87 89
						affiliations.put(code, np);

Also available in: Unified diff