001
014
015 package com.liferay.portal.kernel.dao.orm;
016
017 import com.liferay.portal.kernel.util.OrderByComparator;
018 import com.liferay.portal.kernel.workflow.WorkflowConstants;
019
020 import java.io.Serializable;
021
022 import java.util.HashMap;
023 import java.util.Map;
024
025
028 public class QueryDefinition {
029
030 public QueryDefinition() {
031 }
032
033 public QueryDefinition(int status) {
034 if (status == WorkflowConstants.STATUS_ANY) {
035 setStatus(WorkflowConstants.STATUS_IN_TRASH, true);
036 }
037 else {
038 setStatus(status);
039 }
040 }
041
042 public QueryDefinition(
043 int status, boolean excludeStatus, int start, int end,
044 OrderByComparator obc) {
045
046 _status = status;
047 _excludeStatus = excludeStatus;
048 _start = start;
049 _end = end;
050 _orderByComparator = obc;
051 }
052
053 public QueryDefinition(
054 int status, int start, int end, OrderByComparator obc) {
055
056 if (status == WorkflowConstants.STATUS_ANY) {
057 setStatus(WorkflowConstants.STATUS_IN_TRASH, true);
058 }
059 else {
060 setStatus(status);
061 }
062
063 _start = start;
064 _end = end;
065 _orderByComparator = obc;
066 }
067
068 public Serializable getAttribute(String name) {
069 if (_attributes == null) {
070 return null;
071 }
072
073 return _attributes.get(name);
074 }
075
076 public Map<String, Serializable> getAttributes() {
077 return _attributes;
078 }
079
080 public int getEnd() {
081 return _end;
082 }
083
084 public OrderByComparator getOrderByComparator() {
085 return _orderByComparator;
086 }
087
088 public int getStart() {
089 return _start;
090 }
091
092 public int getStatus() {
093 return _status;
094 }
095
096 public boolean isExcludeStatus() {
097 return _excludeStatus;
098 }
099
100 public void setAttribute(String name, Serializable value) {
101 _attributes.put(name, value);
102 }
103
104 public void setAttributes(Map<String, Serializable> attributes) {
105 if (_attributes == null) {
106 _attributes = new HashMap<String, Serializable>();
107 }
108
109 _attributes = attributes;
110 }
111
112 public void setEnd(int end) {
113 _end = end;
114 }
115
116 public void setOrderByComparator(OrderByComparator orderByComparator) {
117 _orderByComparator = orderByComparator;
118 }
119
120 public void setStart(int start) {
121 _start = start;
122 }
123
124 public void setStatus(int status) {
125 setStatus(status, false);
126 }
127
128 public void setStatus(int status, boolean exclude) {
129 _excludeStatus = exclude;
130 _status = status;
131 }
132
133 private Map<String, Serializable> _attributes;
134 private int _end = QueryUtil.ALL_POS;
135 private boolean _excludeStatus;
136 private OrderByComparator _orderByComparator;
137 private int _start = QueryUtil.ALL_POS;
138 private int _status = WorkflowConstants.STATUS_ANY;
139
140 }