mirror of
				https://github.com/Alfresco/alfresco-community-repo.git
				synced 2025-10-22 15:12:38 +00:00 
			
		
		
		
	30744: ALF-9524: WCM: Defining a complex type with 'abstract' attribute to true does not allow other complex types to define elements with the same name 
      - Fix by Pavel
   30804: ALF-9524: Fix to NPE by Pavel
   30812: ALF-718: Rules Fire Emails before Transaction Commit/Rollback
   Added tests and moved email sending into a post commit callback.
   30820: Fix for ALF-10516 - 'My Sites' dashlet should indicate it is loading rather than say 'No sites'
   30824: Fixed ALF-10470: DeclaritiveRegistry is looping continuously and re-initializing
    - Only replicate removals for the cache.  The reset always does a remove first.
       <cache 
           name="org.alfresco.cache.webScriptsRegistryCache"
                                    ...
                                    replicateUpdates = false,
                                    ...
       </cache>
   30827: ALF-10513 60k Site Performance: Unable to delete user + request not acknowledged for 2 minutes
     Now about 3 to 4 seconds
   30828: Andy H recommended change to lucene indexer values
   30831: ALF-718: Fix for InvitationServiceImplTest
   Fixes behaviour broken by original fix for ALF-718: the send-after-commit does NOT work for the invitation service, so it was necessary
   to change the code to only send-after-commit in the context of a rule.  
   30843: Fixed ALF-7698 "Defects in tags picker in SHARE." according to feedback provided in ALF-9953 "Decide order where new items shall appear in the object finder."
   30844: ALF-9544 - Inbound email restricts file name to 86 characters or less.
     used QName.createQNameWithValidLocalName()  as suggested.
     added new EmailServiceImplTest
   30849: Fixed ALF-8776 "Rule details dialog handling of apostrophes"
   30862: Merged DEV/TEMPORARY to V3.4-BUG-FIX (with improvements)
      30856: ALF-10288: Regression of ALF-1997: non domain users cannot bypass SSO in Share using /share/page?pt=login
         In SSOAuthenticationFilter.doFilter() method added check (PAGE_SERVLET_PATH.equals(req.getServletPath()) && LOGIN_PATH_INFORMATION.equals(req.getPathInfo()).
   30864: SMTP Server, To and From address format.
     - Out standards for from and to address were stuck in the 1980s!
   30867: ALF-10517 - 'My Content' slow
    - performance improvements by reworking Lucene queries used to retrieve recently modified and recently created content for a user
    - converted queries to fts-alfresco
    - improvements from 3.5sec per page render down to 1.1 secs
   30874: MERGE DEV to V3.4-BUG-FIX
         30851 : ALF-9558 - Unchecked Return Value
   30882: - ScriptGroup.isRootGroup() now stops if it finds a single parent rather than doing a size on all parent groups.
     Not sure the logic (not changed by me) is correct as it includes parents that are site groups.
   - SiteServiceImpl now only gets the specified number of sites. Sometimes it would have return more if AuthorityDAOImpl
     switched approach used to get containing authorities.
   - Overloaded getContainingAuthorities to take a size parameter, deprecated other and switched calling code
     Done for isRootGroup activity.
   30910: - Fix build error
   - Found a better way to use filter in AuthorityDAOImpl.getContainingAuthoritiesInZone
     so that we don't need to reset the filter, by using the +ve hits from first approach
     if we switch to second approach.
   30925: - ALF-10501 60k Site Performance: Searching for a group to add to a site with a value that matches a few sites takes 2 minutes
     ALF-10502 60k Site Performance: Admin Console | Groups: search with a value that matches a few sites takes 70 seconds
     ALF-10504 60k Site Performance: Admin Console | Groups | Browse Groups page appears corrupt as it never finishes loading
     - All the above were slow as a result of ScriptGroup.isRootGroup()
     - ScriptGroup.isRootGroup() and ScriptGroup.isAdminGroup() removed - Checked with KevinR that these are not needed any more.
     - Removed code added on 30 Sep 11 to support isRootGroup (the size parameter to AuthorityDAO.getContainingAuthorities)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
		
	
		
			
				
	
	
		
			205 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			205 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| /*
 | |
|  * Copyright (C) 2005-2011 Alfresco Software Limited.
 | |
|  *
 | |
|  * This file is part of Alfresco
 | |
|  *
 | |
|  * 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/>.
 | |
|  */
 | |
| 
 | |
| package org.alfresco.util;
 | |
| 
 | |
| import org.alfresco.service.cmr.admin.RepoAdminService;
 | |
| import org.alfresco.service.cmr.admin.RepoUsage.LicenseMode;
 | |
| 
 | |
| import java.util.ArrayList;
 | |
| import java.util.Arrays;
 | |
| import java.util.Collection;
 | |
| import java.util.HashMap;
 | |
| import java.util.List;
 | |
| import java.util.Map;
 | |
| 
 | |
| /**
 | |
|  * Model related utility functions.
 | |
|  * 
 | |
|  * @since 3.5
 | |
|  */
 | |
| public class ModelUtil
 | |
| {
 | |
|     private static final String SHARE = "Share";
 | |
|     private static final String TEAM = "Team";
 | |
| 
 | |
|     public static final String PAGING_MAX_ITEMS = "maxItems";
 | |
|     public static final String PAGING_SKIP_COUNT = "skipCount";
 | |
|     public static final String PAGING_TOTAL_ITEMS = "totalItems";
 | |
|     public static final String PAGING_TOTAL_ITEMS_RANGE_END = "totalItemsRangeEnd";
 | |
|     public static final String PAGING_CONFIDENCE = "confidence";
 | |
| 
 | |
|     /**
 | |
|      * Returns the name of the product currently running, determined
 | |
|      * by the current license.
 | |
|      * 
 | |
|      * @param repoAdminService The RepoAdminService
 | |
|      * @return "Share" or "Team"
 | |
|      */
 | |
|     public static String getProductName(RepoAdminService repoAdminService)
 | |
|     {
 | |
|         // the product name is never localised so it's safe to
 | |
|         // return a hard-coded string but if we ever need to it's
 | |
|         // centralised here.
 | |
|         
 | |
|         String productName = SHARE;
 | |
|         
 | |
|         if (repoAdminService != null && 
 | |
|             repoAdminService.getRestrictions().getLicenseMode().equals(LicenseMode.TEAM))
 | |
|         {
 | |
|             productName = TEAM;
 | |
|         }
 | |
|         
 | |
|         return productName;
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Returns representation of paging object
 | |
|      * 
 | |
|      * @param totalItems all count of object
 | |
|      * @param maxItems max count of object that should be returned
 | |
|      * @param skipCount count of skipped objects
 | |
|      * @param confidence the confidence in the total, default is exact
 | |
|      * @param totalItemsRangeEnd if the total is a range, what is the upper end of it
 | |
|      * @return A model map of the details
 | |
|      */
 | |
|     public static Map<String, Object> buildPaging(int totalItems, int maxItems, int skipCount, 
 | |
|                     ScriptPagingDetails.ItemsSizeConfidence confidence, int totalItemsRangeEnd)
 | |
|     {
 | |
|         HashMap<String, Object> model = new HashMap<String, Object>();
 | |
|         if(confidence == null)
 | |
|         {
 | |
|            confidence = ScriptPagingDetails.ItemsSizeConfidence.EXACT;
 | |
|         }
 | |
| 
 | |
|         model.put(PAGING_MAX_ITEMS, maxItems);
 | |
|         model.put(PAGING_SKIP_COUNT, skipCount);
 | |
|         model.put(PAGING_TOTAL_ITEMS, totalItems);
 | |
|         model.put(PAGING_TOTAL_ITEMS_RANGE_END, totalItemsRangeEnd);
 | |
|         model.put(PAGING_CONFIDENCE, confidence);
 | |
|         
 | |
|         return model;
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Returns representation of paging object
 | |
|      * 
 | |
|      * @param totalItems all count of object
 | |
|      * @param maxItems max count of object that should be returned
 | |
|      * @param skipCount count of skipped objects
 | |
|      * @return A model map of the details
 | |
|      */
 | |
|     public static Map<String, Object> buildPaging(int totalItems, int maxItems, int skipCount)
 | |
|     {
 | |
|         return buildPaging(totalItems, maxItems, skipCount, null, -1);
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Returns representation of paging object
 | |
|      * 
 | |
|      * @param paging The paging object with total, skip, max etc
 | |
|      */
 | |
|     public static Map<String, Object> buildPaging(ScriptPagingDetails paging)
 | |
|     {
 | |
|         return buildPaging(
 | |
|                 paging.getTotalItems(),
 | |
|                 paging.getMaxItems(),
 | |
|                 paging.getSkipCount(),
 | |
|                 paging.getConfidence(),
 | |
|                 paging.getTotalItemsRangeMax()
 | |
|         );
 | |
|     }
 | |
|     
 | |
|     public static <T> List<T> page(Collection<T> objects, int maxItems, int skipCount)
 | |
|     {
 | |
|         return page(objects, new ScriptPagingDetails(maxItems, skipCount));
 | |
|     }
 | |
|     
 | |
|     public static <T> List<T> page(Collection<T> objects, ScriptPagingDetails paging)
 | |
|     {
 | |
|         int maxItems = paging.getMaxItems();
 | |
|         int skipCount = paging.getSkipCount();
 | |
|         paging.setTotalItems(objects.size());
 | |
|         
 | |
|         List<T> result = new ArrayList<T>();
 | |
|         
 | |
|         // Do the paging
 | |
|         int totalItems = objects.size();
 | |
|         if (maxItems<1 || maxItems>totalItems)
 | |
|         {
 | |
|             maxItems = totalItems;
 | |
|         }
 | |
|         if (skipCount<0)
 | |
|         {
 | |
|             skipCount = 0;
 | |
|         }
 | |
|         int endPoint = skipCount + maxItems;
 | |
|         if (endPoint > totalItems)
 | |
|         {
 | |
|             endPoint = totalItems;
 | |
|         }
 | |
|         
 | |
|         int pos = 0;
 | |
|         for (T entry : objects)
 | |
|         {
 | |
|             if(pos >= skipCount)
 | |
|             {
 | |
|                 if(pos < endPoint)
 | |
|                 {
 | |
|                     result.add(entry);
 | |
|                 } 
 | |
|                 else
 | |
|                 {
 | |
|                     break;
 | |
|                 }
 | |
|             }
 | |
|             pos++;
 | |
|         }
 | |
|         return result;
 | |
|     }
 | |
|     
 | |
|     public static <T> T[] page(T[] objects, int maxItems, int skipCount)
 | |
|     {
 | |
|         // Do the paging
 | |
|         int totalItems = objects.length;
 | |
|         if (maxItems<1 || maxItems>totalItems)
 | |
|         {
 | |
|             maxItems = totalItems;
 | |
|         }
 | |
|         if (skipCount<0)
 | |
|         {
 | |
|             skipCount = 0;
 | |
|         }
 | |
|         int endPoint = skipCount + maxItems;
 | |
|         if (endPoint > totalItems)
 | |
|         {
 | |
|             endPoint = totalItems;
 | |
|         }
 | |
|         int size = skipCount > endPoint ? 0 : endPoint - skipCount;
 | |
| 
 | |
|         if(size == totalItems)
 | |
|         {
 | |
|             return objects;
 | |
|         }
 | |
|         
 | |
|         T[] result = Arrays.copyOfRange(objects, skipCount, endPoint);
 | |
|         return result;
 | |
|     }
 | |
| }
 |