added description and lastModified attribute to group

This commit is contained in:
Sebastian Sdorra
2011-02-12 15:07:25 +01:00
parent ffa429de33
commit 89f65b34eb
3 changed files with 85 additions and 6 deletions

View File

@@ -187,6 +187,7 @@ public class Group
group.setName(name); group.setName(name);
group.setMembers(members); group.setMembers(members);
group.setType(type); group.setType(type);
group.setDescription(description);
} }
/** /**
@@ -219,6 +220,20 @@ public class Group
return false; return false;
} }
if ((this.description == null)
? (other.description != null)
: !this.description.equals(other.description))
{
return false;
}
if ((this.lastModified != other.lastModified)
&& ((this.lastModified == null)
||!this.lastModified.equals(other.lastModified)))
{
return false;
}
if ((this.members != other.members) if ((this.members != other.members)
&& ((this.members == null) ||!this.members.equals(other.members))) && ((this.members == null) ||!this.members.equals(other.members)))
{ {
@@ -251,18 +266,24 @@ public class Group
@Override @Override
public int hashCode() public int hashCode()
{ {
int hash = 5; int hash = 7;
hash = 89 * hash + ((this.creationDate != null) hash = 29 * hash + ((this.creationDate != null)
? this.creationDate.hashCode() ? this.creationDate.hashCode()
: 0); : 0);
hash = 89 * hash + ((this.members != null) hash = 29 * hash + ((this.description != null)
? this.description.hashCode()
: 0);
hash = 29 * hash + ((this.lastModified != null)
? this.lastModified.hashCode()
: 0);
hash = 29 * hash + ((this.members != null)
? this.members.hashCode() ? this.members.hashCode()
: 0); : 0);
hash = 89 * hash + ((this.name != null) hash = 29 * hash + ((this.name != null)
? this.name.hashCode() ? this.name.hashCode()
: 0); : 0);
hash = 89 * hash + ((this.type != null) hash = 29 * hash + ((this.type != null)
? this.type.hashCode() ? this.type.hashCode()
: 0); : 0);
@@ -338,6 +359,28 @@ public class Group
return creationDate; return creationDate;
} }
/**
* Method description
*
*
* @return
*/
public String getDescription()
{
return description;
}
/**
* Method description
*
*
* @return
*/
public Long getLastModified()
{
return lastModified;
}
/** /**
* Method description * Method description
* *
@@ -415,6 +458,28 @@ public class Group
this.creationDate = creationDate; this.creationDate = creationDate;
} }
/**
* Method description
*
*
* @param description
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* Method description
*
*
* @param lastModified
*/
public void setLastModified(Long lastModified)
{
this.lastModified = lastModified;
}
/** /**
* Method description * Method description
* *
@@ -454,6 +519,13 @@ public class Group
@XmlJavaTypeAdapter(XmlTimestampDateAdapter.class) @XmlJavaTypeAdapter(XmlTimestampDateAdapter.class)
private Long creationDate; private Long creationDate;
/** Field description */
private String description;
/** Field description */
@XmlJavaTypeAdapter(XmlTimestampDateAdapter.class)
private Long lastModified;
/** Field description */ /** Field description */
private List<String> members; private List<String> members;

View File

@@ -234,6 +234,8 @@ public class XmlGroupManager extends AbstractGroupManager
if (groupDB.contains(name)) if (groupDB.contains(name))
{ {
group.setLastModified(System.currentTimeMillis());
synchronized (XmlGroupManager.class) synchronized (XmlGroupManager.class)
{ {
groupDB.remove(name); groupDB.remove(name);

View File

@@ -53,7 +53,7 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
initComponent: function(){ initComponent: function(){
var groupStore = new Sonia.rest.JsonStore({ var groupStore = new Sonia.rest.JsonStore({
url: restUrl + 'groups.json', url: restUrl + 'groups.json',
fields: [ 'name', 'members', 'creationDate', 'type'], fields: [ 'name', 'members', 'description', 'creationDate', 'type'],
sortInfo: { sortInfo: {
field: 'name' field: 'name'
} }
@@ -67,6 +67,7 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
}, },
columns: [ columns: [
{id: 'name', header: 'Name', dataIndex: 'name'}, {id: 'name', header: 'Name', dataIndex: 'name'},
{id: 'description', header: 'Description', dataIndex: 'description', width: 300 },
{id: 'members', header: 'Members', dataIndex: 'members', renderer: this.renderMembers}, {id: 'members', header: 'Members', dataIndex: 'members', renderer: this.renderMembers},
{id: 'creationDate', header: 'Creation date', dataIndex: 'creationDate'}, {id: 'creationDate', header: 'Creation date', dataIndex: 'creationDate'},
{id: 'type', header: 'Type', dataIndex: 'type', width: 80} {id: 'type', header: 'Type', dataIndex: 'type', width: 80}
@@ -204,6 +205,10 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
name: 'name', name: 'name',
allowBlank: false, allowBlank: false,
readOnly: this.item != null readOnly: this.item != null
},{
fieldLabel: 'Description',
name: 'description',
xtype: 'textarea'
}] }]
},{ },{
id: 'memberGrid', id: 'memberGrid',