Project

General

Profile

« Previous | Next » 

Revision b4b7ae12

Added by Patrick Plitzner about 8 years ago

Import ex authors

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportAuthor.java
85 85
                String authorName = rs.getString(columnName);
86 86
                TeamOrPersonBase teamOrPerson = null;
87 87
                if(!CdmUtils.isBlank(authorName)){
88
                    //check if it is a team
89
                    if(authorName.contains("&")){
90
                        teamOrPerson = Team.NewInstance();
91
                        String[] split = authorName.split("&");
92
                        for (int i = 0; i < split.length; i++) {
93
                            ((Team) teamOrPerson).addTeamMember(Person.NewTitledInstance(split[i].trim()));
94
                        }
95
                    }
96
                    else{
97
                        teamOrPerson = Person.NewTitledInstance(authorName);
98
                    }
99
                    getAgentService().saveOrUpdate(teamOrPerson);
100
                    state.getAuthorMap().put(authorName, teamOrPerson.getUuid());
88
                    makePerson(state, authorName);
101 89
                }
102 90
            }
103 91
        } catch (SQLException e) {
......
105 93
        }
106 94
    }
107 95

  
96
    private void makePerson(RedListGefaesspflanzenImportState state, String authorName) {
97
        TeamOrPersonBase teamOrPerson;
98
        //check if there are ex authors
99
        if(authorName.contains(" ex ")){
100
            String[] split = authorName.split(" ex ");
101
            for (int i = 0; i < split.length; i++) {
102
                makePerson(state, split[i].trim());
103
            }
104
        }
105
        //check if it is a team
106
        if(authorName.contains("&")){
107
            teamOrPerson = Team.NewInstance();
108
            String[] split = authorName.split("&");
109
            for (int i = 0; i < split.length; i++) {
110
                ((Team) teamOrPerson).addTeamMember(Person.NewTitledInstance(split[i].trim()));
111
            }
112
        }
113
        else{
114
            teamOrPerson = Person.NewTitledInstance(authorName);
115
        }
116
        getAgentService().saveOrUpdate(teamOrPerson);
117
        state.getAuthorMap().put(authorName, teamOrPerson.getUuid());
118
    }
119

  
120

  
108 121
    @Override
109 122
    public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs,
110 123
            RedListGefaesspflanzenImportState state) {

Also available in: Unified diff