Merged 5.2.N (5.2.1) to HEAD (5.2)

128332 adavis: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
      128253 adavis: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2)
         128241 adavis: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4)
            128225 adavis: Merged V4.1-BUG-FIX (4.1.11) to V4.2-BUG-FIX (4.2.7)
               128166 amorarasu: Merged V4.1.9 (4.1.9.16) to V4.1-BUG-FIX (4.1.11)
                  128155 amorarasu: MNT-16316: GET /alfresco/service/api/groups API slow performance when the 'zone' filter is used.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129283 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alexandru Epure
2016-08-09 13:55:31 +00:00
parent c06c9a208a
commit 43724e8ec6
6 changed files with 121 additions and 51 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* #%L
* Alfresco Repository
* %%
@@ -9,20 +9,20 @@
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.security.authority;
import org.alfresco.repo.domain.node.NodeEntity;
@@ -45,6 +45,8 @@ public class AuthorityInfoEntity
// Supplemental query-related parameters
private Long parentNodeId;
private Long authorityDisplayNameQNameId;
// Authority type
private Long typeQNameId;
/**
* Default constructor
@@ -53,10 +55,11 @@ public class AuthorityInfoEntity
{
}
public AuthorityInfoEntity(Long parentNodeId, Long authorityDisplayNameQNameId)
public AuthorityInfoEntity(Long parentNodeId, Long authorityDisplayNameQNameId, Long typeQNameId)
{
this.parentNodeId = parentNodeId;
this.authorityDisplayNameQNameId = authorityDisplayNameQNameId;
this.typeQNameId = typeQNameId;
}
public Long getId()
@@ -110,4 +113,9 @@ public class AuthorityInfoEntity
{
return authorityDisplayNameQNameId;
}
public Long getTypeQNameId()
{
return typeQNameId;
}
}

View File

@@ -1,4 +1,4 @@
/*
/*
* #%L
* Alfresco Repository
* %%
@@ -9,20 +9,20 @@
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.security.authority;
import java.util.ArrayList;
@@ -116,8 +116,11 @@ public class GetAuthoritiesCannedQueryFactory extends AbstractCannedQueryFactory
qnameAuthDisplayNameId = qnameAuthDisplayNamePair.getFirst();
}
// this can be null, in which case, there is no filtering on type, done at the database level
Long typeQNameId = getQNameIdForType(type);
// specific query params
GetAuthoritiesCannedQueryParams paramBean = new GetAuthoritiesCannedQueryParams(type,
typeQNameId,
containerNodeId,
qnameAuthDisplayNameId,
displayNameFilter);
@@ -140,7 +143,29 @@ public class GetAuthoritiesCannedQueryFactory extends AbstractCannedQueryFactory
// return canned query instance
return getCannedQuery(params);
}
private Long getQNameIdForType(AuthorityType type)
{
if (type == null)
{
return null;
}
Pair<Long, QName> typeQNamePair = null;
switch (type)
{
case GROUP:
case ROLE:
typeQNamePair = qnameDAO.getQName(ContentModel.TYPE_AUTHORITY_CONTAINER);
break;
case USER:
typeQNamePair = qnameDAO.getQName(ContentModel.TYPE_PERSON);
break;
default:
break;
}
return typeQNamePair != null ? typeQNamePair.getFirst() : null;
}
@Override
public void afterPropertiesSet() throws Exception
{

View File

@@ -1,4 +1,4 @@
/*
/*
* #%L
* Alfresco Repository
* %%
@@ -9,20 +9,20 @@
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.security.authority;
import org.alfresco.service.cmr.security.AuthorityType;
@@ -39,9 +39,9 @@ public class GetAuthoritiesCannedQueryParams extends AuthorityInfoEntity
private String displayNameFilter; // startsWith / ignoreCase (note: trailing * is implied)
private AuthorityType type;
public GetAuthoritiesCannedQueryParams(AuthorityType type, Long parentNodeId, Long authorityDisplayNameQNameId, String displayNameFilter)
public GetAuthoritiesCannedQueryParams(AuthorityType type, Long typeQNameId, Long parentNodeId, Long authorityDisplayNameQNameId, String displayNameFilter)
{
super(parentNodeId, authorityDisplayNameQNameId);
super(parentNodeId, authorityDisplayNameQNameId, typeQNameId);
if ((displayNameFilter == null) || (displayNameFilter.equals("")) || (displayNameFilter.equals("*")))
{