#112 base ping activities
parent
eba3592410
commit
482e2b3595
@ -0,0 +1,86 @@
|
|||||||
|
package ru.ulstu.user.model;
|
||||||
|
|
||||||
|
import ru.ulstu.ping.model.Ping;
|
||||||
|
|
||||||
|
public class DiagramElement {
|
||||||
|
private User user;
|
||||||
|
private int conferences = 0;
|
||||||
|
private int projects = 0;
|
||||||
|
private int grants = 0;
|
||||||
|
private int papers = 0;
|
||||||
|
|
||||||
|
public DiagramElement() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DiagramElement(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getConferences() {
|
||||||
|
return conferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConferences(int conferences) {
|
||||||
|
this.conferences = conferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProjects() {
|
||||||
|
return projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjects(int projects) {
|
||||||
|
this.projects = projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGrants() {
|
||||||
|
return grants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrants(int grants) {
|
||||||
|
this.grants = grants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPapers() {
|
||||||
|
return papers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPapers(int papers) {
|
||||||
|
this.papers = papers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementPapers(int value) {
|
||||||
|
this.papers ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementProjects(int value) {
|
||||||
|
this.projects ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementConferences(int value) {
|
||||||
|
this.conferences ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementGrants(int value) {
|
||||||
|
this.grants ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementActivity(Ping ping) {
|
||||||
|
if (ping.getConference() != null) {
|
||||||
|
this.conferences ++;
|
||||||
|
} else if(ping.getPaper() != null) {
|
||||||
|
this.papers ++;
|
||||||
|
} else if(ping.getProject() != null) {
|
||||||
|
this.projects ++;
|
||||||
|
} else if(ping.getGrant() != null) {
|
||||||
|
this.grants ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||||
|
<changeSet author="arefyev" id="20190525_000000-1">
|
||||||
|
<addColumn tableName="ping">
|
||||||
|
<column name="paper_id" type="integer"/>
|
||||||
|
<column name="grant_id" type="integer"/>
|
||||||
|
<column name="project_id" type="integer"/>
|
||||||
|
</addColumn>
|
||||||
|
<addForeignKeyConstraint baseTableName="ping" baseColumnNames="paper_id" constraintName="paper_fk" referencedTableName="paper"
|
||||||
|
referencedColumnNames="id"/>
|
||||||
|
<addForeignKeyConstraint baseTableName="ping" baseColumnNames="grant_id" constraintName="grant_fk" referencedTableName="grants"
|
||||||
|
referencedColumnNames="id"/>
|
||||||
|
<addForeignKeyConstraint baseTableName="ping" baseColumnNames="project_id" constraintName="project_fk" referencedTableName="project"
|
||||||
|
referencedColumnNames="id"/>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
Loading…
Reference in New Issue