Yi EungJun 2013-03-27
Rename 'date' fields to 'createdDate'.
'date' may be reserved by DBMS.
@08121da72dc640400bfe241ba9bd54133a2b4eef
app/controllers/AbstractPostingApp.java
--- app/controllers/AbstractPostingApp.java
+++ app/controllers/AbstractPostingApp.java
@@ -91,7 +91,7 @@
         }
 
         posting.id = original.id;
-        posting.date = original.date;
+        posting.createdDate = original.createdDate;
         posting.authorId = original.authorId;
         posting.authorLoginId = original.authorLoginId;
         posting.authorName = original.authorName;
app/controllers/BoardApp.java
--- app/controllers/BoardApp.java
+++ app/controllers/BoardApp.java
@@ -79,7 +79,7 @@
             return redirect(routes.BoardApp.newPost(userName, projectName));
         } else {
             Posting post = postForm.get();
-            post.date = JodaDateUtil.now();
+            post.createdDate = JodaDateUtil.now();
             post.setAuthor(UserApp.currentUser());
             post.project = project;
 
app/controllers/IssueApp.java
--- app/controllers/IssueApp.java
+++ app/controllers/IssueApp.java
@@ -195,7 +195,7 @@
             return badRequest(newIssue.render(issueForm.errors().toString(), issueForm, project));
         } else {
             Issue newIssue = issueForm.get();
-            newIssue.date = JodaDateUtil.now();
+            newIssue.createdDate = JodaDateUtil.now();
             newIssue.setAuthor(UserApp.currentUser());
             newIssue.project = project;
 
app/controllers/ProjectApp.java
--- app/controllers/ProjectApp.java
+++ app/controllers/ProjectApp.java
@@ -250,7 +250,7 @@
         OrderParams orderParams = new OrderParams();
         SearchParams searchParams = new SearchParams();
 
-        orderParams.add("date", Direction.DESC);
+        orderParams.add("createdDate", Direction.DESC);
         searchParams.add("name", filter, Matching.CONTAINS);
         if (state.toLowerCase().equals("public")) {
             searchParams.add("share_option", true, Matching.EQUALS);
app/models/AbstractPosting.java
--- app/models/AbstractPosting.java
+++ app/models/AbstractPosting.java
@@ -44,7 +44,7 @@
 
     @Constraints.Required
     @Formats.DateTime(pattern = "YYYY/MM/DD/hh/mm/ss")
-    public Date date;
+    public Date createdDate;
 
     public Long authorId;
     public String authorLoginId;
@@ -60,7 +60,7 @@
     abstract public int computeNumOfComments();
 
     public AbstractPosting() {
-        this.date = JodaDateUtil.now();
+        this.createdDate = JodaDateUtil.now();
     }
 
     public void save() {
@@ -85,7 +85,7 @@
      * @return
      */
     public Duration ago() {
-        return JodaDateUtil.ago(this.date);
+        return JodaDateUtil.ago(this.createdDate);
     }
 
     abstract public Resource asResource();
app/models/Comment.java
--- app/models/Comment.java
+++ app/models/Comment.java
@@ -22,18 +22,18 @@
     public String contents;
 
     @Constraints.Required
-    public Date date;
+    public Date createdDate;
 
     public Long authorId;
     public String authorLoginId;
     public String authorName;
 
     public Comment() {
-        date = new Date();
+        createdDate = new Date();
     }
 
     public Duration ago() {
-        return JodaDateUtil.ago(this.date);
+        return JodaDateUtil.ago(this.createdDate);
     }
 
     abstract public Resource asResource();
app/models/Issue.java
--- app/models/Issue.java
+++ app/models/Issue.java
@@ -22,7 +22,7 @@
      * @param title           이슈 제목
      * @param body            이슈 내용
      * @param state           이슈 상태(열림, 닫힘)
-     * @param date            이슈 등록 날짜
+     * @param createdDate            이슈 등록 날짜
      * @param authorId        이슈 작성자 ID
      * @param project         이슈가 등록된 프로젝트
      * @param assigneeId      이슈에 배정된 담당자 Id
@@ -34,7 +34,7 @@
 
     public static Finder<Long, Issue> finder = new Finder<Long, Issue>(Long.class, Issue.class);
 
-    public static final String DEFAULT_SORTER = "date";
+    public static final String DEFAULT_SORTER = "createdDate";
     public static final String TO_BE_ASSIGNED = "TBA";
 
     public State state;
@@ -125,7 +125,7 @@
             sheet.addCell(new Label(colcnt++, i, issue.state.toString(), cf2));
             sheet.addCell(new Label(colcnt++, i, issue.title, cf2));
             sheet.addCell(new Label(colcnt++, i, getAssigneeName(issue.assignee), cf2));
-            sheet.addCell(new Label(colcnt++, i, issue.date.toString(), cf2));
+            sheet.addCell(new Label(colcnt++, i, issue.createdDate.toString(), cf2));
         }
         workbook.write();
 
app/models/Project.java
--- app/models/Project.java
+++ app/models/Project.java
@@ -64,7 +64,7 @@
 	public boolean share_option;
 	public boolean isAuthorEditable;
 
-	public Date date;
+	public Date createdDate;
 
 	@OneToMany(mappedBy = "project", cascade = CascadeType.ALL)
 	public Set<Issue> issues;
@@ -83,7 +83,7 @@
 
 	public static Long create(Project newProject) {
 		newProject.siteurl = "http://localhost:9000/" + newProject.name;
-        newProject.date = new Date();
+        newProject.createdDate = new Date();
         newProject.save();
 		ProjectUser.assignRole(User.SITE_MANAGER_ID, newProject.id,
 				RoleType.SITEMANAGER);
@@ -191,9 +191,9 @@
             return sortByNameWithIgnoreCaseDesc;
         } else if ( orderString.contains("name") ) {
             return sortByNameWithIgnoreCase;
-        } else if ( orderString.contains("date desc") ){
+        } else if ( orderString.contains("createdDate desc") ){
             return sortByDateDesc;
-        } else if ( orderString.contains("date") ){
+        } else if ( orderString.contains("createdDate") ){
             return sortByDate;
         } else {  // TODO: another sorting case doesn't exist in this moment
             throw new UnsupportedOperationException("unsupported sorting type");
@@ -236,7 +236,7 @@
 		} catch (ServletException e) {
 			e.printStackTrace();
 		}
-		return this.date;
+		return this.createdDate;
 	}
 
 	public Duration ago() {
@@ -269,7 +269,7 @@
         public int compare(Object o1, Object o2) {
             Project s1 = (Project) o1;
             Project s2 = (Project) o2;
-            return s1.date.compareTo(s2.date);
+            return s1.createdDate.compareTo(s2.createdDate);
         }
     }
     public static class SortByDateDesc implements Comparator<Object> {
app/models/User.java
--- app/models/User.java
+++ app/models/User.java
@@ -57,7 +57,7 @@
     public boolean rememberMe;
 
     @Formats.DateTime(pattern = "yyyy-MM-dd")
-    public Date date;
+    public Date createdDate;
 
     @OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
     public List<ProjectUser> projectUser;
@@ -74,7 +74,7 @@
      */
     public String getDateString() {
         SimpleDateFormat sdf = new SimpleDateFormat("MMM dd yyyy");
-        return sdf.format(this.date);
+        return sdf.format(this.createdDate);
     }
 
     public List<Project> myProjects(){
@@ -82,7 +82,7 @@
     }
 
     public static Long create(User user) {
-    	user.date = JodaDateUtil.now();
+    	user.createdDate = JodaDateUtil.now();
         user.save();
         return user.id;
     }
app/playRepository/GitRepository.java
--- app/playRepository/GitRepository.java
+++ app/playRepository/GitRepository.java
@@ -136,7 +136,7 @@
         result.put("type", type);
         result.put("msg", commit.getShortMessage());
         result.put("author", commit.getAuthorIdent().getName());
-        result.put("date", commitTime);
+        result.put("createdDate", commitTime);
 
         result.put("commitMessage", commit.getShortMessage());
         result.put("commiter", commit.getAuthorIdent().getName());
@@ -165,7 +165,7 @@
             data.put("type", treeWalk.isSubtree() ? "folder" : "file");
             data.put("msg", commit.getShortMessage());
             data.put("author", commit.getAuthorIdent().getName());
-            data.put("date", commit.getCommitTime() * 1000l);
+            data.put("createdDate", commit.getCommitTime() * 1000l);
             listData.put(treeWalk.getNameString(), data);
         }
         result.put("data", listData);
app/playRepository/SVNRepository.java
--- app/playRepository/SVNRepository.java
+++ app/playRepository/SVNRepository.java
@@ -85,7 +85,7 @@
                 data.put("type", entry.getKind() == SVNNodeKind.DIR ? "folder" : "file");
                 data.put("msg", entry.getCommitMessage());
                 data.put("author", entry.getAuthor());
-                data.put("date", entry.getDate().getTime());
+                data.put("createdDate", entry.getDate().getTime());
 
                 listData.put(entry.getName(), data);
             }
@@ -107,7 +107,7 @@
             result.put("revisionNo", prop.getStringValue(SVNProperty.COMMITTED_REVISION));
             result.put("author", prop.getStringValue(SVNProperty.LAST_AUTHOR));
 
-            result.put("date", prop.getStringValue(SVNProperty.COMMITTED_DATE));
+            result.put("createdDate", prop.getStringValue(SVNProperty.COMMITTED_DATE));
 
             result.put("data", baos.toString());
             return result;
@@ -142,7 +142,7 @@
                 data.put("type", entry.getKind() == SVNNodeKind.DIR ? "folder" : "file");
                 data.put("msg", entry.getCommitMessage());
                 data.put("author", entry.getAuthor());
-                data.put("date", entry.getDate().getTime());
+                data.put("createdDate", entry.getDate().getTime());
 
                 listData.put(entry.getName(), data);
             }
@@ -164,7 +164,7 @@
             result.put("revisionNo", prop.getStringValue(SVNProperty.COMMITTED_REVISION));
             result.put("author", prop.getStringValue(SVNProperty.LAST_AUTHOR));
 
-            result.put("date", prop.getStringValue(SVNProperty.COMMITTED_DATE));
+            result.put("createdDate", prop.getStringValue(SVNProperty.COMMITTED_DATE));
 
             result.put("data", baos.toString());
             return result;
 
conf/evolutions/default/3.sql (added)
+++ conf/evolutions/default/3.sql
@@ -0,0 +1,17 @@
+# --- !Ups
+
+ALTER TABLE issue ALTER COLUMN date RENAME TO created_date;
+ALTER TABLE issue_comment ALTER COLUMN date RENAME TO created_date;
+ALTER TABLE posting ALTER COLUMN date RENAME TO created_date;
+ALTER TABLE posting_comment ALTER COLUMN date RENAME TO created_date;
+ALTER TABLE project ALTER COLUMN date RENAME TO created_date;
+ALTER TABLE n4user ALTER COLUMN date RENAME TO created_date;
+
+# --- !Downs
+
+ALTER TABLE issue ALTER COLUMN created_date RENAME TO date;
+ALTER TABLE issue_comment ALTER COLUMN created_date RENAME TO date;
+ALTER TABLE posting ALTER COLUMN created_date RENAME TO date;
+ALTER TABLE posting_comment ALTER COLUMN created_date RENAME TO date;
+ALTER TABLE project ALTER COLUMN created_date RENAME TO date;
+ALTER TABLE n4user ALTER COLUMN created_date RENAME TO date;
conf/initial-data.yml
--- conf/initial-data.yml
+++ conf/initial-data.yml
@@ -7,7 +7,7 @@
         passwordSalt:   '[B@1032a4'
         email:          admin@nhn.com
         avatarUrl:      /assets/images/default-avatar-128.png
-        date:           2012-11-01 08:00:00
+        createdDate:           2012-11-01 08:00:00
     - !!models.User
         name:           Hobi
         loginId:        hobi
@@ -15,7 +15,7 @@
         passwordSalt:   '[B@1032a4'        
         email:          hobi@nhn.com
         avatarUrl:      /assets/images/default-avatar-128.png
-        date:           2012-12-01 08:00:00
+        createdDate:           2012-12-01 08:00:00
     - !!models.User
         name:           scott
         loginId:        k16wire
@@ -23,7 +23,7 @@
         passwordSalt:   '[B@1032a4'        
         email:          k16wire@naver.com
         avatarUrl:      /assets/images/default-avatar-128.png
-        date:           2012-01-01 08:00:00
+        createdDate:           2012-01-01 08:00:00
     - !!models.User
         name:           suwon
         loginId:        doortts
@@ -31,7 +31,7 @@
         passwordSalt:   '[B@1032a4'        
         email:          doortts@gmail.com
         avatarUrl:      /assets/images/default-avatar-128.png
-        date:           2012-07-01 08:00:00
+        createdDate:           2012-07-01 08:00:00
     - !!models.User
         name:           eungjun
         loginId:        nori
@@ -39,7 +39,7 @@
         passwordSalt:   '[B@1032a4'        
         email:          ejlee@nhn.com
         avatarUrl:      /assets/images/default-avatar-128.png
-        date:           2012-05-01 08:00:00
+        createdDate:           2012-05-01 08:00:00
 
 siteAdmins:
      - !!models.SiteAdmin
@@ -56,7 +56,7 @@
         siteurl:       http://localhost:9000/nForge4java
         owner:          hobi
         isAuthorEditable: true
-        date:           2012-02-01 08:00:00
+        createdDate:           2012-02-01 08:00:00
     - !!models.Project
         name:           Jindo
         overview:       Jindo는 NHN에서 제작한 Javascript Library 이다.
@@ -65,7 +65,7 @@
         siteurl:       http://localhost:9000/Jindo
         owner:          k16wire
         isAuthorEditable: false
-        date:           2012-01-01 08:00:00        
+        createdDate:           2012-01-01 08:00:00        
     - !!models.Project
         name:           CUBRID
         overview:       CUBRID는 엔터프라이즈급 오픈 소스 DBMS로서, 인터넷 서비스에 최적화된 DBMS를 지향하고 있습니다.
@@ -74,7 +74,7 @@
         siteurl:       http://localhost:9000/CUBRID
         owner:          doortts
         isAuthorEditable: true
-        date:           2012-08-01 08:00:00        
+        createdDate:           2012-08-01 08:00:00        
     - !!models.Project
         name:           HelloSocialApp
         overview:       네이버 앱팩토리 플랫폼에서 제공하는 오픈소셜 API를 직접 실행해 볼 수 있는 애플리케이션입니다.
@@ -83,7 +83,7 @@
         siteurl:       http://localhost:9000/HelloSocialApp
         owner:          hobi
         isAuthorEditable: true
-        date:           2012-12-01 08:00:00        
+        createdDate:           2012-12-01 08:00:00        
 
 # Board
 postings:
@@ -115,7 +115,7 @@
         state:          OPEN
         milestone:      !!models.Milestone
                             id: 1
-        date:           2012-11-01 08:00:00
+        createdDate:           2012-11-01 08:00:00
         project:        !!models.Project
                             id: 1
     - !!models.Issue
@@ -126,7 +126,7 @@
         state:          OPEN
         milestone:      !!models.Milestone
                             id: 2
-        date:           2012-11-02 08:00:00
+        createdDate:           2012-11-02 08:00:00
         project:        !!models.Project
                             id: 1
     - !!models.Issue
@@ -137,7 +137,7 @@
         state:          CLOSED
         milestone:      !!models.Milestone
                             id: 2
-        date:           2012-11-03 08:00:00
+        createdDate:           2012-11-03 08:00:00
         project:        !!models.Project
                             id: 1
         numOfComments:  1
@@ -149,7 +149,7 @@
         state:          CLOSED
         milestone:      !!models.Milestone
                             id: 2
-        date:           2012-11-04 08:00:00
+        createdDate:           2012-11-04 08:00:00
         project:        !!models.Project
                             id: 1
     - !!models.Issue
@@ -158,7 +158,7 @@
         title:          CUBRID 설치 문제
         body:           IOS는 설치 못하나요?
         state:          OPEN
-        date:           2012-11-05 08:00:00
+        createdDate:           2012-11-05 08:00:00
         project:        !!models.Project
                             id: 3
     - !!models.Issue
@@ -169,7 +169,7 @@
         state:          CLOSED
         milestone:      !!models.Milestone
                             id: 6
-        date:           2012-11-06 08:00:00
+        createdDate:           2012-11-06 08:00:00
         project:        !!models.Project
                             id: 3
     - !!models.Issue
@@ -180,7 +180,7 @@
         state:          OPEN
         milestone:      !!models.Milestone
                             id: 5
-        date:           2012-11-07 08:00:00
+        createdDate:           2012-11-07 08:00:00
         project:        !!models.Project
                             id: 3
     - !!models.Issue
@@ -191,7 +191,7 @@
         state:          CLOSED
         milestone:      !!models.Milestone
                             id: 5
-        date: 2012-11-08 08:00:00
+        createdDate: 2012-11-08 08:00:00
         project:        !!models.Project
                             id: 3
     - !!models.Issue
@@ -202,7 +202,7 @@
         state:          CLOSED
         milestone:      !!models.Milestone
                             id: 1
-        date: 2012-11-09 08:00:00
+        createdDate: 2012-11-09 08:00:00
         project:        !!models.Project
                             id: 1
     - !!models.Issue
@@ -213,7 +213,7 @@
         state:          CLOSED
         milestone:      !!models.Milestone
                             id: 1
-        date:           2012-11-10 08:00:00
+        createdDate:           2012-11-10 08:00:00
         project:        !!models.Project
                             id: 1
     - !!models.Issue
@@ -224,7 +224,7 @@
         state:          OPEN
         milestone:      !!models.Milestone
                             id: 1
-        date:           2012-11-11 08:00:00
+        createdDate:           2012-11-11 08:00:00
         project:        !!models.Project
                             id: 1
     - !!models.Issue
@@ -235,7 +235,7 @@
         state:          CLOSED
         milestone:      !!models.Milestone
                             id: 3
-        date:           2012-11-12 08:00:00
+        createdDate:           2012-11-12 08:00:00
         project:        !!models.Project
                             id: 2
     - !!models.Issue
@@ -246,7 +246,7 @@
         state:          CLOSED
         milestone:      !!models.Milestone
                             id: 3
-        date:           2012-11-13 08:00:00
+        createdDate:           2012-11-13 08:00:00
         project:        !!models.Project
                             id: 2
     - !!models.Issue
@@ -257,7 +257,7 @@
         state:          OPEN
         milestone:      !!models.Milestone
                             id: 4
-        date:           2012-11-14 08:00:00
+        createdDate:           2012-11-14 08:00:00
         project:        !!models.Project
                             id: 2
     - !!models.Issue
@@ -268,7 +268,7 @@
         state:          OPEN
         milestone:      !!models.Milestone
                             id: 4
-        date:           2012-11-15 08:00:00
+        createdDate:           2012-11-15 08:00:00
         project:        !!models.Project
                             id: 2
     - !!models.Issue
@@ -279,7 +279,7 @@
         state:          OPEN
         milestone:      !!models.Milestone
                             id: 4
-        date:           2012-11-15 08:00:00
+        createdDate:           2012-11-15 08:00:00
         project:        !!models.Project
                             id: 2
     - !!models.Issue
@@ -290,7 +290,7 @@
         state:          OPEN
         milestone:      !!models.Milestone
                             id: 4
-        date:           2012-11-16 08:00:00
+        createdDate:           2012-11-16 08:00:00
         project:        !!models.Project
                             id: 3
 issueComments:
test/models/MilestoneTest.java
--- test/models/MilestoneTest.java
+++ test/models/MilestoneTest.java
@@ -186,7 +186,7 @@
         int openNumber = m5.getNumOpenIssues();
         Issue issue = new Issue();
         issue.title = "불필요한 로그 출력 코드 제거test";
-        issue.date = JodaDateUtil.today();
+        issue.createdDate = JodaDateUtil.today();
         issue.state = State.OPEN;
         issue.authorId = User.find.byId(1l).id;
         issue.milestone = Milestone.find.byId(5l);
test/models/PostingTest.java
--- test/models/PostingTest.java
+++ test/models/PostingTest.java
@@ -57,7 +57,7 @@
         Posting post = new Posting();
         post.setBody("new Contents");
         post.title = "new_title";
-        post.date = JodaDateUtil.now();
+        post.createdDate = JodaDateUtil.now();
         post.project = Project.find.byId(1l);
         post.setAuthor(getTestUser());
 
@@ -70,7 +70,7 @@
         assertThat(post.id).isGreaterThan(0);
         assertThat(actual.title).isEqualTo(post.title);
         assertThat(actual.getBody()).isEqualTo(post.getBody());
-        assertThat(actual.date).isEqualTo(post.date);
+        assertThat(actual.createdDate).isEqualTo(post.createdDate);
         assertThat(actual.authorId).isEqualTo(getTestUser().id);
         assertThat(actual.id).isEqualTo(post.id);
     }
Add a comment
List