Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
refactor code based on review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Jul 30, 2013
1 parent 716f406 commit 4985db5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions zanata-model/src/main/java/org/zanata/model/Activity.java
Expand Up @@ -90,18 +90,19 @@ public class Activity extends ModelEntityBase implements Serializable
@Enumerated(EnumType.STRING)
private ActivityType actionType;

//Event count starts with 1 because there is a single event when new activity created
private int eventCount = 1;

private int wordCount;

public Activity(HPerson actor, EntityType contextType, Long contextId, EntityType lastTargetType, Long lastTargetId,
ActivityType actionType, int wordCount)
public Activity(HPerson actor, IsEntityWithType context, IsEntityWithType target, ActivityType actionType,
int wordCount)
{
this.actor = actor;
this.contextType = contextType;
this.contextId = contextId;
this.lastTargetType = lastTargetType;
this.lastTargetId = lastTargetId;
this.contextType = context.getEntityType();
this.contextId = context.getId();
this.lastTargetType = target.getEntityType();
this.lastTargetId = target.getId();
this.actionType = actionType;
this.wordCount = wordCount;
}
Expand Down
Expand Up @@ -110,7 +110,7 @@ public void logActivity(HPerson actor, IsEntityWithType context, IsEntityWithTyp
}
else
{
activity = new Activity(actor, context.getEntityType(), context.getId(), target.getEntityType(), target.getId(), actionType, wordCount);
activity = new Activity(actor, context, target, actionType, wordCount);
}
activityDAO.makePersistent(activity);
activityDAO.flush();
Expand Down

0 comments on commit 4985db5

Please sign in to comment.