Project

General

Profile

« Previous | Next » 

Revision 2e477cf4

Added by Andreas Müller almost 7 years ago

clean up old cyprus import activators

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/cyprus/CyprusUserImport.java
1 1
/**
2 2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy 
3
 * European Distributed Institute of Taxonomy
4 4
 * http://www.e-taxonomy.eu
5
 * 
5
 *
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
......
10 10
package eu.etaxonomy.cdm.io.cyprus;
11 11

  
12 12
import org.apache.log4j.Logger;
13
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
14
import org.springframework.security.core.Authentication;
15
import org.springframework.security.core.context.SecurityContextHolder;
16 13
import org.springframework.stereotype.Component;
17 14

  
18 15
import eu.etaxonomy.cdm.io.common.CdmImportBase;
19
import eu.etaxonomy.cdm.model.common.User;
20 16

  
21 17
/**
22 18
 * @author a.babadshanjan
23 19
 * @created 08.01.2009
24
 * @version 1.0
25 20
 */
26 21

  
27 22
@Component
28 23
public class CyprusUserImport extends CdmImportBase<CyprusImportConfigurator, CyprusImportState> {
29
	private static final Logger logger = Logger.getLogger(CyprusUserImport.class);
30
	
24
    private static final long serialVersionUID = 3941622961913569851L;
25
    private static final Logger logger = Logger.getLogger(CyprusUserImport.class);
26

  
31 27
	@Override
32 28
	protected boolean isIgnore(CyprusImportState state) {
33 29
		return ! state.getConfig().isDoTaxa();
34 30
	}
35
	
36
	
37
	/* (non-Javadoc)
38
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IoStateBase)
39
	 */
31

  
40 32
	@Override
41 33
	protected boolean doCheck(CyprusImportState state) {
42 34
		logger.warn("DoCheck not yet implemented for CyprusExcelImport");
......
47 39
	@Override
48 40
	protected void doInvoke(CyprusImportState state) {
49 41
		this.getAuthenticationManager();
50
		
51
		String username = "cmi";
52
		String password = "fasfowjo0490";
53
		String personTitle = "Cyprus initial import";
54
		User user = User.NewInstance(personTitle, username, password);
55
//		user.setAccountNonLocked(false);
56
//		user.setEnabled(false);
57
		getUserService().save(user);
58
		UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
59
		Authentication authentication = getAuthenticationManager().authenticate(token);
60
		
61
		SecurityContextHolder.getContext().setAuthentication(authentication);
62
		
63
		
64
		username = "zypern";
65
		password = "r4i6wpo";
66
		personTitle = "Cyprus editor";
67
		User userZypern = User.NewInstance(personTitle, username, password);
68
		getUserService().save(userZypern);
69
		
70
		
71 42

  
72 43
		return;
73 44
	}
74 45

  
75

  
76
	
77 46
}

Also available in: Unified diff