Skip to content

Commit

Permalink
Merge pull request Azure#9 from christav/use-util-date
Browse files Browse the repository at this point in the history
Removed use of XMLGregorianCalendar
  • Loading branch information
Chris Tavares committed Oct 18, 2012
2 parents f5319a3 + 6670f82 commit 1a598d1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 87 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

package com.microsoft.windowsazure.services.media.implementation.content;

import java.util.Date;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.datatype.XMLGregorianCalendar;

import com.microsoft.windowsazure.services.core.utils.DateConverter;
import com.microsoft.windowsazure.services.media.models.AssetInfo;

/**
Expand All @@ -38,10 +38,10 @@ public class AssetType implements MediaServiceDTO {
protected int state;

@XmlElement(name = "Created", namespace = Constants.ODATA_DATA_NS)
protected XMLGregorianCalendar created;
protected Date created;

@XmlElement(name = "LastModified", namespace = Constants.ODATA_DATA_NS)
protected XMLGregorianCalendar lastModified;
protected Date lastModified;

@XmlElement(name = "AlternateId", namespace = Constants.ODATA_DATA_NS)
protected String alternateId;
Expand Down Expand Up @@ -85,30 +85,30 @@ public void setState(int state) {
/**
* @return the created
*/
public XMLGregorianCalendar getCreated() {
public Date getCreated() {
return created;
}

/**
* @param created
* the created to set
*/
public void setCreated(XMLGregorianCalendar created) {
public void setCreated(Date created) {
this.created = created;
}

/**
* @return the lastModified
*/
public XMLGregorianCalendar getLastModified() {
public Date getLastModified() {
return lastModified;
}

/**
* @param lastModified
* the lastModified to set
*/
public void setLastModified(XMLGregorianCalendar lastModified) {
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}

Expand Down Expand Up @@ -160,9 +160,9 @@ public void setOptions(int options) {
public static AssetType create(AssetInfo assetInfo) {
AssetType assetType = new AssetType();
assetType.setAlternateId(assetInfo.getAlternateId());
assetType.setCreated(DateConverter.DateToXMLGregorianCalendar(assetInfo.getCreated()));
assetType.setCreated(assetInfo.getCreated());
assetType.setId(assetInfo.getId());
assetType.setLastModified(DateConverter.DateToXMLGregorianCalendar(assetInfo.getLastModified()));
assetType.setLastModified(assetInfo.getLastModified());
assetType.setName(assetInfo.getName());
assetType.setOptions(assetInfo.getOptions().getCode());
assetType.setState(assetInfo.getState().getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import java.util.Date;

import com.microsoft.windowsazure.services.core.utils.DateConverter;
import com.microsoft.windowsazure.services.media.implementation.ODataEntity;
import com.microsoft.windowsazure.services.media.implementation.atom.EntryType;
import com.microsoft.windowsazure.services.media.implementation.content.AssetType;
Expand Down Expand Up @@ -105,7 +104,7 @@ public AssetInfo setState(AssetState state) {
* @return the date
*/
public Date getCreated() {
return DateConverter.XMLGregorianCalendarToDate(this.getContent().getCreated());
return this.getContent().getCreated();
}

/**
Expand All @@ -116,7 +115,7 @@ public Date getCreated() {
* @return the asset info
*/
public AssetInfo setCreated(Date created) {
getContent().setCreated(DateConverter.DateToXMLGregorianCalendar(created));
getContent().setCreated(created);
return this;
}

Expand All @@ -126,7 +125,7 @@ public AssetInfo setCreated(Date created) {
* @return the date
*/
public Date getLastModified() {
return DateConverter.XMLGregorianCalendarToDate(getContent().getLastModified());
return getContent().getLastModified();
}

/**
Expand All @@ -137,7 +136,7 @@ public Date getLastModified() {
* @return the asset info
*/
public AssetInfo setLastModified(Date lastModified) {
getContent().setLastModified(DateConverter.DateToXMLGregorianCalendar(lastModified));
getContent().setLastModified(lastModified);
return this;
}

Expand Down

0 comments on commit 1a598d1

Please sign in to comment.