179 lines
3.9 KiB
Java
179 lines
3.9 KiB
Java
package org.gcube.portlets.user.td.gwtservice.shared.rule;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.ArrayList;
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleColumnType;
|
|
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
|
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
|
|
|
/**
|
|
*
|
|
* @author "Giancarlo Panichi" <a
|
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
*
|
|
*/
|
|
public class RuleDescriptionData implements Serializable {
|
|
|
|
private static final long serialVersionUID = 2238695825091799598L;
|
|
private long id;
|
|
private String name;
|
|
private String description;
|
|
private Contacts owner;
|
|
private ArrayList<Contacts> contacts;
|
|
private RuleScopeType scope;
|
|
private TDRuleColumnType tdRuleColumnType;
|
|
private C_Expression expression;
|
|
|
|
public RuleDescriptionData() {
|
|
super();
|
|
}
|
|
|
|
public RuleDescriptionData(long id, String name, String description,
|
|
Contacts owner, ArrayList<Contacts> contacts, RuleScopeType scope,
|
|
C_Expression expression) {
|
|
super();
|
|
this.id = id;
|
|
this.name = name;
|
|
this.description = description;
|
|
this.owner = owner;
|
|
this.contacts = contacts;
|
|
this.scope = scope;
|
|
this.tdRuleColumnType = null;
|
|
this.expression = expression;
|
|
}
|
|
|
|
public RuleDescriptionData(long id, String name, String description,
|
|
Contacts owner, ArrayList<Contacts> contacts, RuleScopeType scope,
|
|
TDRuleColumnType tdRuleColumnType, C_Expression expression) {
|
|
super();
|
|
this.id = id;
|
|
this.name = name;
|
|
this.description = description;
|
|
this.owner = owner;
|
|
this.contacts = contacts;
|
|
this.scope = scope;
|
|
this.tdRuleColumnType = tdRuleColumnType;
|
|
this.expression = expression;
|
|
}
|
|
|
|
public long getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public void setDescription(String description) {
|
|
this.description = description;
|
|
}
|
|
|
|
public Contacts getOwner() {
|
|
return owner;
|
|
}
|
|
|
|
public void setOwner(Contacts owner) {
|
|
this.owner = owner;
|
|
}
|
|
|
|
public String getOwnerLogin() {
|
|
String login = null;
|
|
if (owner != null) {
|
|
login = owner.getLogin();
|
|
}
|
|
return login;
|
|
}
|
|
|
|
public ArrayList<Contacts> getContacts() {
|
|
return contacts;
|
|
}
|
|
|
|
public void setContacts(ArrayList<Contacts> contacts) {
|
|
this.contacts = contacts;
|
|
}
|
|
|
|
public ArrayList<String> getContactsAsStringList(){
|
|
ArrayList<String> contactsList=new ArrayList<String>();
|
|
for(Contacts contact:contacts){
|
|
contactsList.add(contact.getLogin());
|
|
}
|
|
return contactsList;
|
|
}
|
|
|
|
|
|
public RuleScopeType getScope() {
|
|
return scope;
|
|
}
|
|
|
|
public void setScope(RuleScopeType scope) {
|
|
this.scope = scope;
|
|
}
|
|
|
|
public String getScopeLabel() {
|
|
if (scope == null) {
|
|
return "";
|
|
} else {
|
|
return scope.getLabel();
|
|
}
|
|
}
|
|
|
|
public TDRuleColumnType getTdRuleColumnType() {
|
|
return tdRuleColumnType;
|
|
}
|
|
|
|
public void setTdRuleColumnType(TDRuleColumnType tdRuleColumnType) {
|
|
this.tdRuleColumnType = tdRuleColumnType;
|
|
}
|
|
|
|
public C_Expression getExpression() {
|
|
return expression;
|
|
}
|
|
|
|
public void setExpression(C_Expression expression) {
|
|
this.expression = expression;
|
|
}
|
|
|
|
public String getReadableExpression() {
|
|
if (expression != null) {
|
|
return expression.getReadableExpression();
|
|
} else {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public boolean equals(RuleDescriptionData ruleDescriptionData) {
|
|
if (ruleDescriptionData == null) {
|
|
return false;
|
|
} else {
|
|
if (id - ruleDescriptionData.getId() == 0) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "RuleDescriptionData [id=" + id + ", name=" + name
|
|
+ ", description=" + description + ", owner=" + owner
|
|
+ ", scope=" + scope + ", tdRuleColumnType=" + tdRuleColumnType
|
|
+ ", expression=" + expression + "]";
|
|
}
|
|
|
|
}
|