Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for <groupBy> in queries
- Loading branch information
1 parent
1f77cf5
commit e52b4b6
Showing
10 changed files
with
438 additions
and
21 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
infra/prism/src/main/java/com/evolveum/midpoint/prism/query/ObjectGrouping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2010-2017 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.evolveum.midpoint.prism.query; | ||
|
||
import com.evolveum.midpoint.prism.path.ItemPath; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* @author acope | ||
*/ | ||
public class ObjectGrouping implements Serializable { | ||
|
||
final private ItemPath groupBy; | ||
|
||
ObjectGrouping(ItemPath groupBy) { | ||
if (ItemPath.isNullOrEmpty(groupBy)) { | ||
throw new IllegalArgumentException("Null or empty groupBy path is not supported."); | ||
} | ||
this.groupBy = groupBy; | ||
} | ||
|
||
public static ObjectGrouping createGrouping(ItemPath groupBy) { | ||
return new ObjectGrouping(groupBy); | ||
} | ||
|
||
public ItemPath getGroupBy() { | ||
return groupBy; | ||
} | ||
|
||
|
||
@Override | ||
public String toString() { | ||
return groupBy.toString(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
return equals(o, true); | ||
} | ||
|
||
public boolean equals(Object o, boolean exact) { | ||
if (this == o) | ||
return true; | ||
if (o == null || getClass() != o.getClass()) | ||
return false; | ||
|
||
ObjectGrouping that = (ObjectGrouping) o; | ||
|
||
if (groupBy != null ? !groupBy.equals(that.groupBy, exact) : that.groupBy != null) | ||
return false; | ||
return true; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return groupBy.hashCode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.