Java Code Examples for org.alfresco.model.ContentModel#PROP_NAME
The following examples show how to use
org.alfresco.model.ContentModel#PROP_NAME .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VirtualStoreImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Reference getChildByName(Reference reference, QName assocTypeQName, String childName) throws VirtualizationException { VirtualFolderDefinition structure = resolveVirtualFolderDefinition(reference); VirtualFolderDefinition theChild = structure.findChildByName(childName); if (theChild != null) { return reference.execute(new GetChildByIdMethod(theChild.getId())); } else { final VirtualQuery query = structure.getQuery(); if (query != null) { PropertyValueConstraint constraint = new PropertyValueConstraint(new FilesFoldersConstraint(BasicConstraint.INSTANCE, true, true), ContentModel.PROP_NAME, childName, environment .getNamespacePrefixResolver()); PagingResults<Reference> result = query.perform(environment, constraint, null, reference); List<Reference> page = result.getPage(); return page == null || page.isEmpty() ? null : page.get(0); } else { return null; } } }
Example 2
Source File: FileFolderServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Performs a full search, but doesn't translate the node references into * file info objects. This allows {@link #checkExists(NodeRef, String)} to * bypass the retrieval of node properties. */ private List<NodeRef> searchInternal( NodeRef contextNodeRef, String namePattern, boolean fileSearch, boolean folderSearch, boolean includeSubFolders) { // shortcut if the search is requesting nothing if (!fileSearch && !folderSearch) { return Collections.emptyList(); } if (namePattern == null) { namePattern = LUCENE_MULTI_CHAR_WILDCARD; // default to wildcard } // now check if we can use Lucene to handle this query boolean anyName = namePattern.equals(LUCENE_MULTI_CHAR_WILDCARD); List<NodeRef> nodeRefs = null; if (anyName) { // This is search for any name if(includeSubFolders) { nodeRefs = listSimpleDeep(contextNodeRef, fileSearch, folderSearch, null); } else { nodeRefs = listImpl(contextNodeRef, fileSearch, folderSearch).getPage(); } } else { // TODO - we need to get rid of this xpath stuff // if the name pattern is null, then we use the ANY pattern QueryParameterDefinition[] params = null; if (namePattern != null) { // the interface specifies the Lucene syntax, so perform a conversion namePattern = SearchLanguageConversion.convert( SearchLanguageConversion.DEF_LUCENE, SearchLanguageConversion.DEF_XPATH_LIKE, namePattern); params = new QueryParameterDefinition[1]; params[0] = new QueryParameterDefImpl( ContentModel.PROP_NAME, dictionaryService.getDataType(DataTypeDefinition.TEXT), true, namePattern); } // determine the correct query to use String query = null; if (includeSubFolders) { // this is a deep search if(!fileSearch && folderSearch) { // This is a folder search only; query = XPATH_QUERY_DEEP_FOLDERS; } else if(fileSearch && !folderSearch) { // This is a folder search only; query = XPATH_QUERY_DEEP_FILES; } else { query = XPATH_QUERY_DEEP_ALL; } } else { // this is a shallow search query = XPATH_QUERY_SHALLOW_ALL; } // execute the query nodeRefs = searchService.selectNodes( contextNodeRef, query, params, namespaceService, false); } // done return nodeRefs; }
Example 3
Source File: VirtualQueryImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * @deprecated will be replaced by * {@link #perform(ActualEnvironment, VirtualQueryConstraint,Reference)} * once complex constrains are implemented */ @Override public PagingResults<Reference> perform(ActualEnvironment environment, boolean files, boolean folders, String pattern, Set<QName> searchTypeQNames, Set<QName> ignoreTypeQNames, Set<QName> ignoreAspectQNames, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest, Reference parentReference) throws VirtualizationException { if (!files && !folders) { if (logger.isDebugEnabled()) { logger.debug("Deprecated query will be skipped due do incompatible types request."); } return asPagingResults(environment, pagingRequest, new EmptyResultSet(), parentReference); } else { VirtualQueryConstraint constraint = BasicConstraint.INSTANCE; constraint = new FilesFoldersConstraint(constraint, files, folders); if(pattern != null){ constraint = new NamePatternPropertyValueConstraint(constraint, ContentModel.PROP_NAME, pattern, environment.getNamespacePrefixResolver()); } constraint = new IgnoreConstraint(constraint, ignoreTypeQNames, ignoreAspectQNames); constraint = new PagingRequestConstraint(constraint, pagingRequest); constraint = new SortConstraint(constraint, sortProps); return perform(environment, constraint, null, parentReference); } }
Example 4
Source File: VirtualStoreImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public List<Reference> search(Reference reference, String namePattern, boolean fileSearch, boolean folderSearch, boolean includeSubFolders) throws VirtualizationException { VirtualFolderDefinition structure = resolveVirtualFolderDefinition(reference); List<Reference> result = new LinkedList<Reference>(); List<Reference> childReferences = createChildReferences(reference, structure); if (folderSearch) { result.addAll(childReferences); } if (includeSubFolders) { for (Reference childRef : childReferences) { List<Reference> childResults = search(childRef, namePattern, fileSearch, folderSearch, includeSubFolders); result.addAll(childResults); } } if (fileSearch) { final VirtualQuery query = structure.getQuery(); if (query != null) { VirtualQueryConstraint vqConstraint = null; if (namePattern == null) { vqConstraint = BasicConstraint.INSTANCE; } else { vqConstraint = new NamePatternPropertyValueConstraint(new FilesFoldersConstraint(BasicConstraint.INSTANCE, true, true), ContentModel.PROP_NAME, namePattern, environment.getNamespacePrefixResolver()); } PagingResults<Reference> queryNodes = query.perform(environment, vqConstraint, null, reference); result.addAll(queryNodes.getPage()); } } return result; }
Example 5
Source File: ImporterComponent.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Get the child name to import node under * * @param context the node * @return the child name */ private QName getChildName(ImportNode context) { QName assocType = getAssocType(context); QName childQName = null; // Determine child name String childName = context.getChildName(); if (childName != null) { childName = bindPlaceHolder(childName, binding); // <Fix for ETHREEOH-2299> if (ContentModel.TYPE_PERSON.equals(context.getTypeDefinition().getName()) && assocType.equals(ContentModel.ASSOC_CHILDREN)) { childName = childName.toLowerCase(); } // </Fix for ETHREEOH-2299> String[] qnameComponents = QName.splitPrefixedQName(childName); childQName = QName.createQName(qnameComponents[0], QName.createValidLocalName(qnameComponents[1]), namespaceService); } else { Map<QName, Serializable> typeProperties = context.getProperties(); Serializable nameValue = typeProperties.get(ContentModel.PROP_NAME); if(nameValue != null && !String.class.isAssignableFrom(nameValue.getClass())) { throw new ImporterException("Unable to use childName property: "+ ContentModel.PROP_NAME + " is not a string"); } String name = (String)nameValue; if (name != null && name.length() > 0) { name = bindPlaceHolder(name, binding); String localName = QName.createValidLocalName(name); childQName = QName.createQName(assocType.getNamespaceURI(), localName); } } return childQName; }
Example 6
Source File: TransformActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
protected TransformationOptions newTransformationOptions(Action ruleAction, NodeRef sourceNodeRef) { return new TransformationOptions(sourceNodeRef, ContentModel.PROP_NAME, null, ContentModel.PROP_NAME); }
Example 7
Source File: NameProperty.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
public QName getMappedProperty() { return ContentModel.PROP_NAME; }
Example 8
Source File: ContentStreamFileNameProperty.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
public ContentStreamFileNameProperty(ServiceRegistry serviceRegistry, CMISConnector connector) { super(serviceRegistry, connector, PropertyIds.CONTENT_STREAM_FILE_NAME, ContentModel.PROP_NAME); }