Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
PT-1987-projects: Fixed AbstractContainerPrimaryEntityGroupManager.ge…
Browse files Browse the repository at this point in the history
…tGroupsForEntity().
  • Loading branch information
itaiGershtansky authored and sdumitriu committed Feb 24, 2017
1 parent 79d46d3 commit 9b54608
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,21 @@ public Collection<G> getGroupsForEntity(PrimaryEntity entity)
{
try {
// FIXME GROUP_MEMBER_CLASS should be replaced with a static method call
String bindingClassName = this.localSerializer.serialize(
AbstractContainerPrimaryEntityGroup.GROUP_MEMBER_CLASS);
String groupClass = this.localSerializer.serialize(getEntityXClassReference());
Query q = this.qm.createQuery(
"select gdoc.fullName from Document gdoc, gdoc.object("
+ this.localSerializer.serialize(AbstractContainerPrimaryEntityGroup.GROUP_MEMBER_CLASS)
+ ") as binding, gdoc.object("
+ this.localSerializer.serialize(getEntityXClassReference())
+ ") as grp where gdoc.space = :gspace and binding.reference = :name order by gdoc.fullName asc",
Query.XWQL);
", BaseObject obj, BaseObject groupObj, StringProperty property "
+ "where obj.id.id = property.id and "
+ "groupObj.name = doc.fullName and "
+ "groupObj.name = obj.name and "
+ "groupObj.className = '" + groupClass + "' and "
+ "property.id.name = 'reference' and "
+ "property.value = :referenceValue and "
+ "obj.className = '" + bindingClassName + "' and "
+ "doc.space = :gspace", Query.HQL);
q.bindValue("gspace", this.getDataSpace().getName());
q.bindValue("name", this.defaultSerializer.serialize(entity.getDocument()));
q.bindValue("referenceValue", this.defaultSerializer.serialize(entity.getDocument()));
List<String> docNames = q.execute();
Collection<G> result = new ArrayList<>(docNames.size());
for (String docName : docNames) {
Expand Down

0 comments on commit 9b54608

Please sign in to comment.