Project

General

Profile

« Previous | Next » 

Revision 39068

first step

View differences:

modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/service/utils/ManagerSaveLogger.java
1
package eu.dnetlib.goldoa.service.utils;
2

  
3
import eu.dnetlib.goldoa.domain.GoldBean;
4
import org.apache.log4j.Logger;
5
import org.aspectj.lang.ProceedingJoinPoint;
6
import org.aspectj.lang.annotation.Around;
7
import org.aspectj.lang.annotation.Aspect;
8
import org.springframework.stereotype.Component;
9

  
10
import javax.mail.MessagingException;
11
import java.io.PrintWriter;
12
import java.io.StringWriter;
13

  
14
/**
15
 * Created by antleb on 8/26/15.
16
 */
17
@Component
18
@Aspect
19
public class ManagerSaveLogger {
20

  
21
	private static Logger logger = Logger.getLogger(ManagerSaveLogger.class);
22

  
23
	@Around("execution(public * eu.dnetlib.goldoa.service.*Manager.save* (..))")
24
	public Object logSaves(ProceedingJoinPoint joinPoint) throws Throwable {
25

  
26
		System.out.println("Saving something!!! ");
27

  
28
		if (joinPoint.getArgs().length == 1) {
29
			Object arg = joinPoint.getArgs()[0];
30
			System.out.println("Saving with one argument");
31

  
32
			if (arg instanceof GoldBean) {
33
				GoldBean bean = (GoldBean) arg;
34
				System.out.println("It is goldbean (" + bean.getId() + ")");
35

  
36
				if (bean.getId() != null && !bean.isFromDB()) {
37
					System.out.println("Saving existing gold bean (" + bean.getClass() + " - " + bean.getId() + ") that is not coming from the db!!!");
38
				} else
39
					System.out.println("Saving existing gold bean (" + bean.getClass() + " - " + bean.getId() + ") that is not coming from the db!!!");
40
			}
41
		}
42

  
43
		return joinPoint.proceed();
44
	}
45
}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Organization.java
7 7
/**
8 8
 * Created by antleb on 3/4/15.
9 9
 */
10
public class Organization implements IsSerializable {
10
public class Organization extends GoldBean implements IsSerializable {
11 11

  
12
	private String id;
13 12
	private String name;
14 13
	private String shortName;
15 14
    private String source;
......
18 17
	public Organization() {
19 18
	}
20 19

  
20
	public Organization(String id) {
21
		super(id);
22
	}
23

  
21 24
    public Organization(String id, String name, String shortName, String source, List<Budget> budgets) {
22
        this.id = id;
25
        super(id);
23 26
        this.name = name;
24 27
        this.shortName = shortName;
25 28
        this.source = source;
26 29
        this.budgets = budgets;
27 30
    }
28 31

  
29
    public Organization(String id) {
30
		this.id = id;
31
	}
32

  
33
	public String getId() {
34
		return id;
35
	}
36

  
37
	public void setId(String id) {
38
		this.id = id;
39
	}
40

  
41 32
	public String getName() {
42 33
		return name;
43 34
	}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Person.java
7 7
/**
8 8
 * Created by antleb on 3/4/15.
9 9
 */
10
public class Person implements IsSerializable {
11
    private String id;
10
public class Person extends GoldBean implements IsSerializable {
11

  
12 12
	private String email;
13 13
	private String name;
14 14
	private String lastname;
......
24 24
    private String source;
25 25

  
26 26
    public Person(String id, String email, String name, String lastname, String initials, String password, String telephone, boolean active, String orcidId, Publisher publisher, List<Project> coordinatedProjects, List<Affiliation> affiliations, List<PersonRole> roles, String source) {
27
        this.id = id;
27
        super(id);
28 28
        this.email = email;
29 29
        this.name = name;
30 30
        this.lastname = lastname;
......
43 43
    public Person() {
44 44
	}
45 45

  
46
    public Person(String id) {
47
        this.id = id;
48
    }
46
	public Person(String id) {
47
		super(id);
48
	}
49 49

  
50
    public String getId() {
51
        return id;
52
    }
53

  
54
    public void setId(String id) {
55
        this.id = id;
56
    }
57

  
58 50
    public String getEmail() {
59 51
		return email;
60 52
	}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Journal.java
5 5
/**
6 6
 * Created by antleb on 3/13/15.
7 7
 */
8
public class Journal implements IsSerializable {
8
public class Journal extends  GoldBean implements IsSerializable {
9 9

  
10
	private String id;
11 10
	private String title;
12 11
	private String alternativeTitle;
13 12
	private String url;
......
26 25
	public Journal() {
27 26
	}
28 27

  
28
	public Journal(String journalId) {
29
		super(journalId);
30
	}
31

  
29 32
    public Journal(String id, String title, String alternativeTitle, String url, Publisher publisher, String languages, String issn, String country, String subjects, String licence, float apc, Currency currency, float discount, String status, String source) {
30
        this.id = id;
33
        super(id);
31 34
        this.title = title;
32 35
        this.alternativeTitle = alternativeTitle;
33 36
        this.url = url;
......
44 47
        this.source = source;
45 48
    }
46 49

  
47
    public Journal(String id) {
48
		this.id = id;
49
	}
50

  
51
	public String getId() {
52
		return id;
53
	}
54

  
55
	public void setId(String id) {
56
		this.id = id;
57
	}
58

  
59 50
	public String getTitle() {
60 51
		return title;
61 52
	}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/GoldBean.java
1
package eu.dnetlib.goldoa.domain;
2

  
3
import com.google.gwt.user.client.rpc.IsSerializable;
4

  
5
/**
6
 * Created by antleb on 8/27/15.
7
 */
8
public class GoldBean implements IsSerializable {
9
	protected String id = null;
10
	private boolean fromDB = false;
11

  
12
	public GoldBean(String id) {
13
		this.id = id;
14
	}
15

  
16
	public GoldBean() {
17
	}
18

  
19
	public String getId() {
20
		return id;
21
	}
22

  
23
	public void setId(String id) {
24
		this.id = id;
25
	}
26

  
27
	public boolean isFromDB() {
28
		return fromDB;
29
	}
30

  
31
	public void setFromDB(boolean fromDB) {
32
		this.fromDB = fromDB;
33
	}
34
}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Publisher.java
5 5
/**
6 6
 * Created by antleb on 3/13/15.
7 7
 */
8
public class Publisher implements IsSerializable {
9
	private String id;
8
public class Publisher extends GoldBean implements IsSerializable {
9

  
10 10
	private String name;
11 11
	private String email;
12 12
	private Person contact;
......
17 17
	private String source;
18 18

  
19 19
	public Publisher(String id) {
20
		this.id = id;
20
		super(id);
21 21
	}
22 22

  
23 23
    public Publisher() {
24 24
	}
25 25

  
26 26
    public Publisher(String id, String name, String email, Person contact, float APC, Currency currency, float discount, BankAccount bankAccount, String source) {
27
        this.id = id;
27
        this(id);
28 28
        this.name = name;
29 29
        this.email = email;
30 30
        this.contact = contact;
......
35 35
        this.source = source;
36 36
    }
37 37

  
38
    public String getId() {
39
		return id;
40
	}
41

  
42
	public void setId(String id) {
43
		this.id = id;
44
	}
45

  
46 38
	public String getName() {
47 39
		return name;
48 40
	}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Project.java
8 8
/**
9 9
 * Created by antleb on 3/4/15.
10 10
 */
11
public class Project implements IsSerializable {
11
public class Project extends GoldBean implements IsSerializable {
12 12

  
13
	private String id;
14 13
	private String acronym;
15 14
	private String title;
16 15
	private String funder;
......
29 28
	}
30 29

  
31 30
	public Project(String id) {
32
		this.id = id;
31
		super(id);
33 32
	}
34 33

  
35
	public String getId() {
36
		return id;
37
	}
38

  
39
	public void setId(String id) {
40
		this.id = id;
41
	}
42

  
43 34
	public String getAcronym() {
44 35
		return acronym;
45 36
	}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Publication.java
8 8
/**
9 9
 * Created by antleb on 3/13/15.
10 10
 */
11
public class Publication implements IsSerializable {
11
public class Publication extends GoldBean implements IsSerializable {
12 12
	public enum Type implements IsSerializable {
13 13
		ARTICLE("article"),
14 14
		MONOGRAPH("monograph");
......
24 24
		}
25 25
	}
26 26

  
27
	private String id;
28 27
	private String title;
29 28
	private String languages;
30 29
	private String subjects;
......
43 42
	}
44 43

  
45 44
    public Publication(String id, String title, String languages, String subjects, String doi, Date publicationDate, Date acceptanceDate, Type type, Journal journal, Publisher publisher, List<Affiliation> authors, List<PublicationIdentifier> identifiers, String repository, String source) {
46
        this.id = id;
45
        super(id);
47 46
        this.title = title;
48 47
        this.languages = languages;
49 48
        this.subjects = subjects;
......
59 58
        this.source = source;
60 59
    }
61 60

  
62
    public Publication(String id) {
63
		this.id = id;
64
	}
65

  
66
	public String getId() {
67
		return id;
68
	}
69

  
70
	public void setId(String id) {
71
		this.id = id;
72
	}
73

  
74 61
	public String getTitle() {
75 62
		return title;
76 63
	}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Budget.java
7 7
/**
8 8
 * Created by antleb on 3/8/15.
9 9
 */
10
public class Budget implements IsSerializable {
10
public class Budget extends GoldBean implements IsSerializable {
11 11

  
12 12
    public enum Status implements IsSerializable {
13 13
        INCOMPLETE("Incomplete", 1),
......
33 33
        }
34 34
    }
35 35

  
36
	private String id;
37 36
	private Date date;
38 37
    private Date startDate;
39 38
    private Date endDate;
......
49 48
	public Budget() {
50 49
	}
51 50

  
51
    public Budget(String budgetId) {
52
        super(budgetId);
53
    }
54

  
52 55
    public Budget(String id, Date date, Date startDate, Date endDate, float amountRequested, float amountGranted, Currency currency, float remaining, int statusCode, String user, String organisation, BankAccount bankAccount) {
53
        this.id = id;
56
        super(id);
54 57
        this.date = date;
55 58
        this.startDate = startDate;
56 59
        this.endDate = endDate;
......
64 67
        this.bankAccount = bankAccount;
65 68
    }
66 69

  
67
    public Budget(String id) {
68
		this.id = id;
69
	}
70

  
71
	public String getId() {
72
		return id;
73
	}
74

  
75
	public void setId(String id) {
76
		this.id = id;
77
	}
78

  
79 70
	public Date getDate() {
80 71
		return date;
81 72
	}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Request.java
9 9
/**
10 10
 * Created by antleb on 3/9/15.
11 11
 */
12
public class Request implements IsSerializable {
12
public class Request extends GoldBean implements IsSerializable {
13 13

  
14 14
    public enum RequestStatus implements IsSerializable {
15 15
        INCOMPLETE("Incomplete", 0),
......
39 39
        }
40 40
    }
41 41

  
42
	private String id;
43 42
	private String user;
44 43
	private Date date = new Date();
45 44
	private String researcher;
......
68 67
	}
69 68

  
70 69
    public Request(String id, String user, Date date, String researcher, String organization, String project, String publication, String journal, String publisher, String publisherEmail, String budget, String invoice, Float apc, Float discount, Float projectParticipation, Float fundingRequested, Currency currency, BankAccount bankAccount, List<RequestCoFunder> coFunders, Float apc_paid, Float transfer_cost, Float other_cost, Date date_paid, int status) {
71
        this.id = id;
70
        super(id);
72 71
        this.user = user;
73 72
        this.date = date;
74 73
        this.researcher = researcher;
......
129 128
        bankAccount = requestInfo.getBankAccount();
130 129
    }
131 130

  
132
    public String getId() {
133
		return id;
134
	}
135

  
136
	public void setId(String id) {
137
		this.id = id;
138
	}
139

  
140 131
	public String getUser() {
141 132
		return user;
142 133
	}
modules/uoa-goldoa-service/branches/savelog/src/main/java/eu/dnetlib/goldoa/domain/Help.java
5 5
/**
6 6
 * Created by antleb on 4/17/15.
7 7
 */
8
public class Help implements IsSerializable {
8
public class Help extends GoldBean implements IsSerializable {
9 9

  
10
    private String id;
11 10
    private String name;
12 11
    private String text;
13 12

  
14 13
    public Help() {
14
        super();
15 15
    }
16 16

  
17 17
    public Help(String id, String name, String text) {
18
        this.id = id;
18
        super(id);
19 19
        this.name = name;
20 20
        this.text = text;
21 21
    }
22 22

  
23
    public String getId() {
24
        return id;
25
    }
26

  
27
    public void setId(String id) {
28
        this.id = id;
29
    }
30

  
31 23
    public String getName() {
32 24
        return name;
33 25
    }

Also available in: Unified diff