mirror of
				https://github.com/Alfresco/alfresco-community-repo.git
				synced 2025-10-22 15:12:38 +00:00 
			
		
		
		
	21536: Fix for ALF-4068 - IE6 XSS issue
   21538: Added missing I18N label for when no wiki page defined in dashlet POST component
   21562: Merged BRANCHES/DEV/BELARUS/V3.3-BUG-FIX-2010_06_14 to BRANCHES/DEV/V3.3-BUG-FIX:
      20742: ALF-3572: Treat PasswordText as default for CMIS Web Service authentication
   21575: Merged BRANCHES/DEV/BELARUS/V3.3-BUG-FIX-2010_06_24 to BRANCHES/DEV/V3.3-BUG-FIX:
      21098: Bug is related to unsupported CMISResultSetMetaDataImpl.getLimitBy() method. But LimitBy parameter is required for a lot of search logic parts including permissions and constraints checks. To support LimitBy parameter the following solution was implemented:
   21578: Dictionary DAO: wrap initDictionary in writeLock
      - investigating intermittent failure of RepoAdminServiceImplTest.testSimpleDynamicModelViaNodeService (eg. b29/b59 of V3.3-BUG-FIX)
   21593: Fix ALF-1703: properties of type 'propertyXML' are returned as 'propertyString'
   21594: Fix ALF-4202: Cannot issue query with join via Web Services binding
      - wasn't issuing query with CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS query mode
   21611: Fix ALF-2649: CMIS query join return partial entry result
   21627: Merged V3.3 to V3.3-BUG-FIX
      21532: Fix for ALF-3042: Missing Null check for the propertyDefinition.
         - fixed all unprotected uses within indexing and query
      21534: Fix for ALF-2151: Range queries don't work.
         - docs updated 
         - added unit test to check for failure of d:content ranges as expected
      21558: Fix for ALF-4183 - Publishing a draft blog post does not turn on permission inheritence
      21609: Fix NFS problems with gEdit and OpenOffice when editing documents in the root of the filesystem. ALF-3955.
         Also fixed an unreported issue where an InvalidNodeRefException is thrown by the file cache timer after several edit/save operations on a file.
      21626: Merged PATCHES/V3.2.1 to V3.3
         21606: ALF-4044: Introduced new policy.content.update.ignoreEmpty setting, that when true causes the repository to behave as it did before the fix to ALF-254. I.e. writing empty content will not trigger onContentPropertyUpdate policies or inbound content rules. This enables better compatibility with mac clients using CIFS or WebDAV; they actually create and close a file before appending its data.
         21607: (RECORD ONLY) Incremented version label
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21628 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
		
	
		
			
				
	
	
		
			201 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			201 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| /*
 | |
|  * Copyright (C) 2005-2010 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.cmis.search;
 | |
| 
 | |
| import java.util.LinkedHashMap;
 | |
| import java.util.Map;
 | |
| 
 | |
| import org.alfresco.cmis.CMISDataTypeEnum;
 | |
| import org.alfresco.cmis.CMISDictionaryService;
 | |
| import org.alfresco.cmis.CMISPropertyDefinition;
 | |
| import org.alfresco.cmis.CMISQueryOptions;
 | |
| import org.alfresco.cmis.CMISResultSetColumn;
 | |
| import org.alfresco.cmis.CMISResultSetMetaData;
 | |
| import org.alfresco.cmis.CMISResultSetSelector;
 | |
| import org.alfresco.cmis.CMISTypeDefinition;
 | |
| import org.alfresco.repo.search.impl.querymodel.Column;
 | |
| import org.alfresco.repo.search.impl.querymodel.PropertyArgument;
 | |
| import org.alfresco.repo.search.impl.querymodel.Query;
 | |
| import org.alfresco.repo.search.impl.querymodel.Selector;
 | |
| import org.alfresco.repo.search.impl.querymodel.impl.functions.PropertyAccessor;
 | |
| import org.alfresco.service.cmr.dictionary.DictionaryService;
 | |
| import org.alfresco.service.cmr.dictionary.PropertyDefinition;
 | |
| import org.alfresco.service.cmr.search.LimitBy;
 | |
| import org.alfresco.service.cmr.search.PermissionEvaluationMode;
 | |
| import org.alfresco.service.cmr.search.ResultSetType;
 | |
| import org.alfresco.service.cmr.search.SearchParameters;
 | |
| import org.alfresco.service.namespace.QName;
 | |
| 
 | |
| /**
 | |
|  * @author andyh
 | |
|  */
 | |
| public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
 | |
| {
 | |
|     private CMISQueryOptions options;
 | |
|     private SearchParameters searchParams;
 | |
|     private LimitBy limitBy;
 | |
| 
 | |
|     private Map<String, CMISResultSetColumn> columnMetaData;
 | |
| 
 | |
|     private Map<String, CMISResultSetSelector> selectorMetaData;
 | |
| 
 | |
|     public CMISResultSetMetaDataImpl(CMISQueryOptions options, Query query, LimitBy limitBy, CMISDictionaryService cmisDictionaryService,
 | |
|             DictionaryService alfrescoDictionaryService)
 | |
|     {
 | |
|         this.options = options;
 | |
|         this.searchParams = new SearchParameters(options);
 | |
|         this.limitBy = limitBy;
 | |
|         Map<String, Selector> selectors = query.getSource().getSelectors();
 | |
|         selectorMetaData = new LinkedHashMap<String, CMISResultSetSelector>();
 | |
|         for(Selector selector : selectors.values())
 | |
|         {
 | |
|             CMISTypeDefinition type = cmisDictionaryService.findTypeForClass(selector.getType());
 | |
|             CMISResultSetSelector smd = new CMISResultSetSelectorImpl(selector.getAlias(), type);
 | |
|             selectorMetaData.put(smd.getName(), smd);
 | |
|         }
 | |
| 
 | |
|         columnMetaData = new LinkedHashMap<String, CMISResultSetColumn>();
 | |
|         for (Column column : query.getColumns())
 | |
|         {
 | |
|             CMISPropertyDefinition propertyDefinition = null;
 | |
|             CMISDataTypeEnum type = null;
 | |
|             QName alfrescoPropertyQName = null;
 | |
|             QName alfrescoDataTypeQName = null;
 | |
|             if (column.getFunction().getName().equals(PropertyAccessor.NAME))
 | |
|             {
 | |
|                 PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
 | |
|                 String propertyName = arg.getPropertyName();
 | |
|                 alfrescoPropertyQName = QName.createQName(propertyName);
 | |
|                 PropertyDefinition alfPropDef = alfrescoDictionaryService.getProperty(alfrescoPropertyQName);
 | |
|                 if(alfPropDef == null)
 | |
|                 {
 | |
|                     alfrescoPropertyQName = null;
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     alfrescoDataTypeQName = alfPropDef.getDataType().getName();
 | |
|                 }
 | |
|                 propertyDefinition = cmisDictionaryService.findProperty(propertyName, null);
 | |
|                 type = propertyDefinition.getDataType();
 | |
|             }
 | |
|             if (type == null)
 | |
|             {
 | |
|                 type = cmisDictionaryService.findDataType(column.getFunction().getReturnType());
 | |
|             }
 | |
|             if(alfrescoDataTypeQName == null)
 | |
|             {
 | |
|                 alfrescoDataTypeQName = type.getDefaultDataType();
 | |
|             }
 | |
|             CMISResultSetColumn cmd = new CMISResultSetColumnImpl(column.getAlias(), propertyDefinition, type, alfrescoPropertyQName, alfrescoDataTypeQName);
 | |
|             columnMetaData.put(cmd.getName(), cmd);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     /*
 | |
|      * (non-Javadoc)
 | |
|      * 
 | |
|      * @see org.alfresco.cmis.search.CMISResultSetMetaData#getColumnNames()
 | |
|      */
 | |
|     public String[] getColumnNames()
 | |
|     {
 | |
|         return columnMetaData.keySet().toArray(new String[0]);
 | |
|     }
 | |
| 
 | |
|     /*
 | |
|      * (non-Javadoc)
 | |
|      * 
 | |
|      * @see org.alfresco.cmis.search.CMISResultSetMetaData#getColumns()
 | |
|      */
 | |
|     public CMISResultSetColumn[] getColumns()
 | |
|     {
 | |
|         return columnMetaData.values().toArray(new CMISResultSetColumn[0]);
 | |
|     }
 | |
| 
 | |
|     /*
 | |
|      * (non-Javadoc)
 | |
|      * 
 | |
|      * @see org.alfresco.cmis.search.CMISResultSetMetaData#getCoumn(java.lang.String)
 | |
|      */
 | |
|     public CMISResultSetColumn getColumn(String name)
 | |
|     {
 | |
|         return columnMetaData.get(name);
 | |
|     }
 | |
| 
 | |
|     /*
 | |
|      * (non-Javadoc)
 | |
|      * 
 | |
|      * @see org.alfresco.cmis.search.CMISResultSetMetaData#getQueryOptions()
 | |
|      */
 | |
|     public CMISQueryOptions getQueryOptions()
 | |
|     {
 | |
|         return options;
 | |
|     }
 | |
| 
 | |
|     /*
 | |
|      * (non-Javadoc)
 | |
|      * 
 | |
|      * @see org.alfresco.cmis.search.CMISResultSetMetaData#getSelector(java.lang.String)
 | |
|      */
 | |
|     public CMISResultSetSelector getSelector(String name)
 | |
|     {
 | |
|         return selectorMetaData.get(name);
 | |
|     }
 | |
| 
 | |
|     /*
 | |
|      * (non-Javadoc)
 | |
|      * 
 | |
|      * @see org.alfresco.cmis.search.CMISResultSetMetaData#getSelectorNames()
 | |
|      */
 | |
|     public String[] getSelectorNames()
 | |
|     {
 | |
|         return selectorMetaData.keySet().toArray(new String[0]);
 | |
|     }
 | |
| 
 | |
|     /*
 | |
|      * (non-Javadoc)
 | |
|      * 
 | |
|      * @see org.alfresco.cmis.search.CMISResultSetMetaData#getSelectors()
 | |
|      */
 | |
|     public CMISResultSetSelector[] getSelectors()
 | |
|     {
 | |
|         return selectorMetaData.values().toArray(new CMISResultSetSelector[0]);
 | |
|     }
 | |
| 
 | |
|     public LimitBy getLimitedBy()
 | |
|     {
 | |
|         return limitBy;
 | |
|     }
 | |
| 
 | |
|     public PermissionEvaluationMode getPermissionEvaluationMode()
 | |
|     {
 | |
|         throw new UnsupportedOperationException();
 | |
|     }
 | |
| 
 | |
|     public ResultSetType getResultSetType()
 | |
|     {
 | |
|         return ResultSetType.COLUMN_AND_NODE_REF;
 | |
|     }
 | |
| 
 | |
|     public SearchParameters getSearchParameters()
 | |
|     {
 | |
|         return searchParams;
 | |
|     }
 | |
| 
 | |
| }
 |