r428 - in trunk/chorem-webmotion/src: main/java/org/chorem/webmotion/actions/financial main/java/org/chorem/webmotion/bean/financial test/java/org/chorem/webmotion/converters
Author: ymartel Date: 2014-08-07 14:04:36 +0200 (Thu, 07 Aug 2014) New Revision: 428 Url: http://forge.chorem.org/projects/chorem/repository/revisions/428 Log: use timestamp in ExpenseAccountEntryBean \& fix error with update Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-06 16:34:52 UTC (rev 427) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/financial/ExpenseAccountAction.java 2014-08-07 12:04:36 UTC (rev 428) @@ -33,6 +33,7 @@ import com.google.common.base.Function; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import org.apache.commons.lang3.StringUtils; import org.chorem.ChoremClient; import org.chorem.entities.Category; @@ -41,6 +42,7 @@ import org.chorem.entities.ExpenseAccountEntry; import org.chorem.entities.ExpenseAccountEntryImpl; import org.chorem.entities.ExpenseAccountImpl; +import org.chorem.entities.Project; import org.chorem.entities.Quotation; import org.chorem.webmotion.PaginatedResult; import org.chorem.webmotion.bean.financial.ExpenseAccountBean; @@ -148,7 +150,7 @@ expenseAccountWikitty.setBeginDate(new Date(expenseAccountBean.getStartDate())); expenseAccountWikitty.setEndDate(new Date(expenseAccountBean.getEndDate())); - Set<String> missingAccountEntryIds = expenseAccountWikitty.getExpenseAccountEntry(); + Set<String> missingAccountEntryIds = Sets.newHashSet(expenseAccountWikitty.getExpenseAccountEntry()); expenseAccountWikitty.clearExpenseAccountEntry(); //manage each Expense Account Entry : try to find them or create new one @@ -167,7 +169,7 @@ } expenseAccountEntry.setReference(expenseAccountEntryBean.getJustificationNumber()); - expenseAccountEntry.setEmittedDate(new Date(expenseAccountEntryBean.getEmittedDate().getTime())); + expenseAccountEntry.setEmittedDate(new Date(expenseAccountEntryBean.getEmittedDate())); expenseAccountEntry.setDescription(expenseAccountEntryBean.getDescription()); expenseAccountEntry.setAmount(expenseAccountEntryBean.getAmount()); expenseAccountEntry.setVAT(expenseAccountEntryBean.getVAT()); @@ -247,6 +249,12 @@ expenseAccountEntryBean.setCategoryName(category.getName()); } + Wikitty project = expenseAccountEntry.getTarget(false); + if (project != null) { + expenseAccountEntryBean.setProjectId(project.getWikittyId()); + expenseAccountEntryBean.setProjectName(project.getFieldAsWikitty(Project.EXT_PROJECT, Project.FIELD_PROJECT_NAME)); + } + Date emittedDate = expenseAccountEntry.getEmittedDate(); if (emittedDate != null) { expenseAccountEntryBean.setEmittedDate(new Date(emittedDate.getTime())); Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java 2014-08-06 16:34:52 UTC (rev 427) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/bean/financial/ExpenseAccountEntryBean.java 2014-08-07 12:04:36 UTC (rev 428) @@ -34,8 +34,8 @@ protected String id; protected String categoryName; protected String categoryId; - protected Date emittedDate; - protected Date paymentDate; + protected long emittedDate; + protected long paymentDate; protected String description; protected String justificationNumber; protected Double amount; @@ -68,20 +68,28 @@ this.categoryId = categoryId; } - public Date getEmittedDate() { + public long getEmittedDate() { return emittedDate; } + public void setEmittedDate(long emittedDate) { + this.emittedDate = emittedDate; + } + public void setEmittedDate(Date emittedDate) { - this.emittedDate = new Date(emittedDate.getTime()); + this.emittedDate = emittedDate.getTime(); } - public Date getPaymentDate() { + public long getPaymentDate() { return paymentDate; } + public void setPaymentDate(long paymentDate) { + this.paymentDate = paymentDate; + } + public void setPaymentDate(Date paymentDate) { - this.paymentDate = new Date(paymentDate.getTime()); + this.paymentDate = paymentDate.getTime(); } public String getDescription() { Modified: trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java =================================================================== --- trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java 2014-08-06 16:34:52 UTC (rev 427) +++ trunk/chorem-webmotion/src/test/java/org/chorem/webmotion/converters/JsonConverterTest.java 2014-08-07 12:04:36 UTC (rev 428) @@ -43,7 +43,7 @@ Assert.assertNotNull(expenseAccountEntries); Assert.assertEquals(1, expenseAccountEntries.size()); ExpenseAccountEntryBean expenseAccountEntryBean = expenseAccountEntries.iterator().next(); - Assert.assertEquals(emittedDate.getTime(), expenseAccountEntryBean.getEmittedDate().getTime()); + Assert.assertEquals(emittedDate.getTime(), expenseAccountEntryBean.getEmittedDate()); }
participants (1)
-
ymartel@users.chorem.org