show url and creationdate on gui

This commit is contained in:
Sebastian Sdorra
2010-09-19 17:38:40 +02:00
parent 6de88bfc85
commit 60da0dc453
4 changed files with 83 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.util.DateAdapter;
import sonia.scm.util.Util;
//~--- JDK imports ------------------------------------------------------------
@@ -20,14 +21,18 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
*
* @author Sebastian Sdorra
*/
@XmlRootElement(name = "repositories")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder =
{
"id", "type", "name", "contact", "description", "creationDate", "url",
@@ -277,6 +282,7 @@ public class Repository implements Serializable
private String contact;
/** Field description */
@XmlJavaTypeAdapter(DateAdapter.class)
private Date creationDate;
/** Field description */

View File

@@ -0,0 +1,54 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package sonia.scm.util;
//~--- JDK imports ------------------------------------------------------------
import java.util.Date;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
*
* @author Sebastian Sdorra
*/
public class DateAdapter extends XmlAdapter<String, Date>
{
/**
* Method description
*
*
* @param data
*
* @return
*
* @throws Exception
*/
@Override
public String marshal(Date data) throws Exception
{
return Util.formatDate(data);
}
/**
* Method description
*
*
* @param string
*
* @return
*
* @throws Exception
*/
@Override
public Date unmarshal(String string) throws Exception
{
return Util.parseDate(string);
}
}