idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
32,900
public void setStrategy ( T minimum , T maximum ) { this . bucketingStrategy = new ExplicitBucketingStrategy ( minimum , maximum ) ; this . bucketWidth = null ; }
Set the histogram to use the supplied minimum and maximum values to determine the bucket size .
32,901
public Histogram < T > setSignificantFigures ( int significantFigures ) { if ( significantFigures != this . significantFigures ) { this . significantFigures = significantFigures ; this . bucketWidth = null ; this . buckets . clear ( ) ; } return this ; }
Set the number of significant figures used in the calculation of the bucket widths .
32,902
public Histogram < T > setBucketCount ( int count ) { if ( count != this . bucketCount ) { this . bucketCount = count ; this . bucketWidth = null ; this . buckets . clear ( ) ; } return this ; }
Set the number of buckets that this histogram will use .
32,903
public synchronized void start ( BootstrapContext ctx ) throws ResourceAdapterInternalException { if ( engine == null ) { engine = new ModeShapeEngine ( ) ; engine . start ( ) ; } }
This is called when a resource adapter instance is bootstrapped .
32,904
public synchronized void stop ( ) { if ( engine != null ) { Future < Boolean > shutdown = engine . shutdown ( ) ; final int SHUTDOWN_TIMEOUT = 30 ; try { LOGGER . debug ( "Shutting down engine to stop resource adapter" ) ; if ( ! shutdown . get ( SHUTDOWN_TIMEOUT , TimeUnit . SECONDS ) ) { LOGGER . error ( JcaI18n . unableToStopEngine ) ; } } catch ( TimeoutException e ) { LOGGER . error ( e , JcaI18n . unableToStopEngineWithinTimeLimit , SHUTDOWN_TIMEOUT ) ; } catch ( InterruptedException e ) { LOGGER . error ( e , JcaI18n . interruptedWhileStoppingJcaAdapter , e . getMessage ( ) ) ; } catch ( ExecutionException e ) { LOGGER . error ( e , JcaI18n . errorWhileStoppingJcaAdapter , e . getMessage ( ) ) ; } engine = null ; } }
This is called when a resource adapter instance is undeployed or during application server shutdown .
32,905
public Serializer < ? > serializerFor ( TypeFactory < ? > type ) { if ( type instanceof TupleFactory ) { return ( ( TupleFactory < ? > ) type ) . getSerializer ( this ) ; } return serializers . serializerFor ( type . getType ( ) ) ; }
Obtain a serializer for the given value type .
32,906
public BTreeKeySerializer < ? > bTreeKeySerializerFor ( TypeFactory < ? > type , boolean pack ) { return serializers . bTreeKeySerializerFor ( type . getType ( ) , type . getComparator ( ) , pack ) ; }
Obtain a serializer for the given key type .
32,907
JcrNodeDefinition getNodeDefinition ( NodeDefinitionId definitionId ) { if ( definitionId == null ) return null ; return nodeTypes ( ) . getChildNodeDefinition ( definitionId ) ; }
Get the node definition given the supplied identifier .
32,908
JcrPropertyDefinition getPropertyDefinition ( PropertyDefinitionId definitionId ) { if ( definitionId == null ) return null ; return nodeTypes ( ) . getPropertyDefinition ( definitionId ) ; }
Get the property definition given the supplied identifier .
32,909
public boolean isDerivedFrom ( String [ ] testTypeNames , String primaryTypeName , String [ ] mixinNames ) throws RepositoryException { CheckArg . isNotEmpty ( testTypeNames , "testTypeNames" ) ; CheckArg . isNotEmpty ( primaryTypeName , "primaryTypeName" ) ; NameFactory nameFactory = context ( ) . getValueFactories ( ) . getNameFactory ( ) ; Name [ ] typeNames = nameFactory . create ( testTypeNames ) ; for ( Name typeName : typeNames ) { JcrNodeType nodeType = getNodeType ( typeName ) ; if ( ( nodeType != null ) && nodeType . isNodeType ( primaryTypeName ) ) { return true ; } } if ( mixinNames != null ) { for ( String mixin : mixinNames ) { for ( Name typeName : typeNames ) { JcrNodeType nodeType = getNodeType ( typeName ) ; if ( ( nodeType != null ) && nodeType . isNodeType ( mixin ) ) { return true ; } } } } return false ; }
Determine if any of the test type names are equal to or have been derived from the primary type or any of the mixins .
32,910
public static int valueFromName ( String name ) { if ( name . equals ( TYPENAME_SIMPLE_REFERENCE ) ) { return SIMPLE_REFERENCE ; } return javax . jcr . PropertyType . valueFromName ( name ) ; }
Returns the numeric constant value of the type with the specified name .
32,911
protected CachedNode nodeInWorkspace ( AbstractSessionCache session ) { return isNew ( ) ? null : session . getWorkspace ( ) . getNode ( key ) ; }
Get the CachedNode within the workspace cache .
32,912
protected final Segment getSegment ( NodeCache cache , CachedNode parent ) { if ( parent != null ) { ChildReference ref = parent . getChildReferences ( cache ) . getChild ( key ) ; if ( ref == null ) { throw new NodeNotFoundInParentException ( key , parent . getKey ( ) ) ; } return ref . getSegment ( ) ; } return workspace ( cache ) . childReferenceForRoot ( ) . getSegment ( ) ; }
Get the segment for this node .
32,913
private void emitValue ( Value value , ContentHandler contentHandler , int propertyType , boolean skipBinary ) throws RepositoryException , SAXException { if ( PropertyType . BINARY == propertyType ) { startElement ( contentHandler , JcrSvLexicon . VALUE , null ) ; if ( ! skipBinary ) { byte [ ] bytes = new byte [ BASE_64_BUFFER_SIZE ] ; int len ; Binary binary = value . getBinary ( ) ; try { InputStream stream = new Base64 . InputStream ( binary . getStream ( ) , Base64 . ENCODE ) ; try { while ( - 1 != ( len = stream . read ( bytes ) ) ) { contentHandler . characters ( new String ( bytes , 0 , len ) . toCharArray ( ) , 0 , len ) ; } } finally { stream . close ( ) ; } } catch ( IOException ioe ) { throw new RepositoryException ( ioe ) ; } finally { binary . dispose ( ) ; } } endElement ( contentHandler , JcrSvLexicon . VALUE ) ; } else { emitValue ( value . getString ( ) , contentHandler ) ; } }
Fires the appropriate SAX events on the content handler to build the XML elements for the value .
32,914
private Node nodeFor ( ITransaction transaction , ResolvedRequest request ) throws RepositoryException { return ( ( JcrSessionTransaction ) transaction ) . nodeFor ( request ) ; }
Get the node that corresponds to the resolved request using the supplied active transaction .
32,915
private String [ ] childrenFor ( ITransaction transaction , ResolvedRequest request ) throws RepositoryException { return ( ( JcrSessionTransaction ) transaction ) . childrenFor ( request ) ; }
Determine the names of the children given the supplied request
32,916
public RestQueryResult addColumn ( String name , String type ) { if ( ! StringUtil . isBlank ( name ) ) { columns . put ( name , type ) ; } return this ; }
Adds a new column to this result .
32,917
static < T > LocalDuplicateIndex < T > create ( String name , String workspaceName , DB db , Converter < T > converter , Serializer < T > valueSerializer , Comparator < T > comparator ) { return new LocalDuplicateIndex < > ( name , workspaceName , db , converter , valueSerializer , comparator ) ; }
Create a new index that allows duplicate values across all keys .
32,918
public String currentTransactionId ( ) { try { javax . transaction . Transaction txn = txnMgr . getTransaction ( ) ; return txn != null ? txn . toString ( ) : null ; } catch ( SystemException e ) { return null ; } }
Get a string representation of the current transaction if there already is an existing transaction .
32,919
public Transaction begin ( ) throws NotSupportedException , SystemException , RollbackException { NestableThreadLocalTransaction localTx = LOCAL_TRANSACTION . get ( ) ; if ( localTx != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Found active ModeShape transaction '{0}' " , localTx ) ; } return localTx . begin ( ) ; } javax . transaction . Transaction txn = txnMgr . getTransaction ( ) ; if ( txn != null && Status . STATUS_ACTIVE != txn . getStatus ( ) ) { throw new IllegalStateException ( JcrI18n . errorInvalidUserTransaction . text ( txn ) ) ; } if ( txn == null ) { txnMgr . begin ( ) ; localTx = new NestableThreadLocalTransaction ( txnMgr ) ; localTx . begin ( ) ; localTx . started ( ) ; return logTransactionInformation ( localTx ) ; } SynchronizedTransaction synchronizedTransaction = transactionTable . get ( txn ) ; if ( synchronizedTransaction != null ) { synchronizedTransaction . started ( ) ; return logTransactionInformation ( synchronizedTransaction ) ; } else { synchronizedTransaction = new SynchronizedTransaction ( txnMgr , txn ) ; transactionTable . put ( txn , synchronizedTransaction ) ; txn . registerSynchronization ( synchronizedTransaction ) ; synchronizedTransaction . started ( ) ; return logTransactionInformation ( synchronizedTransaction ) ; } }
Starts a new transaction if one does not already exist and associate it with the calling thread .
32,920
public void commit ( ) throws HeuristicRollbackException , RollbackException , HeuristicMixedException , SystemException { Transaction transaction = currentTransaction ( ) ; if ( transaction == null ) { throw new IllegalStateException ( "No active transaction" ) ; } transaction . commit ( ) ; }
Commits the current transaction if one exists .
32,921
public void rollback ( ) throws SystemException { Transaction transaction = currentTransaction ( ) ; if ( transaction == null ) { throw new IllegalStateException ( "No active transaction" ) ; } transaction . rollback ( ) ; }
Rolls back the current transaction if one exists .
32,922
protected NodeTypes without ( Collection < JcrNodeType > removedNodeTypes ) { if ( removedNodeTypes . isEmpty ( ) ) return this ; Collection < JcrNodeType > nodeTypes = new HashSet < JcrNodeType > ( this . nodeTypes . values ( ) ) ; nodeTypes . removeAll ( removedNodeTypes ) ; return new NodeTypes ( this . context , nodeTypes , getVersion ( ) + 1 ) ; }
Obtain a new version of this cache with the specified node types removed from the new cache .
32,923
protected NodeTypes with ( Collection < JcrNodeType > addedNodeTypes ) { if ( addedNodeTypes . isEmpty ( ) ) return this ; Collection < JcrNodeType > nodeTypes = new HashSet < JcrNodeType > ( this . nodeTypes . values ( ) ) ; nodeTypes . removeAll ( addedNodeTypes ) ; nodeTypes . addAll ( addedNodeTypes ) ; return new NodeTypes ( this . context , nodeTypes , getVersion ( ) + 1 ) ; }
Obtain a new version of this cache with the specified node types added to the new cache .
32,924
public boolean isTypeOrSubtype ( Name nodeTypeName , Name candidateSupertypeName ) { if ( JcrNtLexicon . BASE . equals ( candidateSupertypeName ) ) { return true ; } if ( nodeTypeName . equals ( candidateSupertypeName ) ) return true ; JcrNodeType nodeType = getNodeType ( nodeTypeName ) ; return nodeType != null && nodeType . isNodeType ( candidateSupertypeName ) ; }
Determine whether the node s given node type matches or extends the node type with the supplied name .
32,925
public boolean isTypeOrSubtype ( Set < Name > nodeTypeNames , Name candidateSupertypeName ) { for ( Name nodeTypeName : nodeTypeNames ) { if ( isTypeOrSubtype ( nodeTypeName , candidateSupertypeName ) ) return true ; } return false ; }
Determine whether at least one of the node s given node types matches or extends the node type with the supplied name .
32,926
public boolean allowsNameSiblings ( Name primaryType , Set < Name > mixinTypes ) { if ( isUnorderedCollection ( primaryType , mixinTypes ) ) { return false ; } if ( nodeTypeNamesThatAllowSameNameSiblings . contains ( primaryType ) ) return true ; if ( mixinTypes != null && ! mixinTypes . isEmpty ( ) ) { for ( Name mixinType : mixinTypes ) { if ( nodeTypeNamesThatAllowSameNameSiblings . contains ( mixinType ) ) return true ; } } return false ; }
Determine if either the primary type or any of the mixin types allows SNS .
32,927
public int getBucketIdLengthForUnorderedCollection ( Name nodeTypeName , Set < Name > mixinTypes ) { Set < Name > allTypes = new LinkedHashSet < > ( ) ; allTypes . add ( nodeTypeName ) ; if ( mixinTypes != null && ! mixinTypes . isEmpty ( ) ) { allTypes . addAll ( mixinTypes ) ; } for ( Name typeName : allTypes ) { if ( isTypeOrSubtype ( typeName , ModeShapeLexicon . TINY_UNORDERED_COLLECTION ) ) { return 1 ; } else if ( isTypeOrSubtype ( typeName , ModeShapeLexicon . SMALL_UNORDERED_COLLECTION ) ) { return 2 ; } else if ( isTypeOrSubtype ( typeName , ModeShapeLexicon . LARGE_UNORDERED_COLLECTION ) ) { return 3 ; } else if ( isTypeOrSubtype ( typeName , ModeShapeLexicon . HUGE_UNORDERED_COLLECTION ) ) { return 4 ; } } throw new IllegalArgumentException ( "None of the node types are known unordered collection types: " + allTypes ) ; }
Determine the length of a bucket ID for an unordered collection based on its type and possible mixins .
32,928
public boolean isReferenceProperty ( Name nodeTypeName , Name propertyName ) { JcrNodeType type = getNodeType ( nodeTypeName ) ; if ( type != null ) { for ( JcrPropertyDefinition propDefn : type . allPropertyDefinitions ( propertyName ) ) { int requiredType = propDefn . getRequiredType ( ) ; if ( requiredType == PropertyType . REFERENCE || requiredType == PropertyType . WEAKREFERENCE || requiredType == org . modeshape . jcr . api . PropertyType . SIMPLE_REFERENCE ) { return true ; } } } return false ; }
Determine if the named property on the node type is a reference property .
32,929
public boolean hasMandatoryPropertyDefinitions ( Name primaryType , Set < Name > mixinTypes ) { if ( mandatoryPropertiesNodeTypes . containsKey ( primaryType ) ) return true ; for ( Name mixinType : mixinTypes ) { if ( mandatoryPropertiesNodeTypes . containsKey ( mixinType ) ) return true ; } return false ; }
Determine if the named primary node type or mixin types has at least one mandatory property definitions declared on it or any of its supertypes .
32,930
public boolean hasMandatoryChildNodeDefinitions ( Name primaryType , Set < Name > mixinTypes ) { if ( mandatoryChildrenNodeTypes . containsKey ( primaryType ) ) return true ; for ( Name mixinType : mixinTypes ) { if ( mandatoryChildrenNodeTypes . containsKey ( mixinType ) ) return true ; } return false ; }
Determine if the named primary node type or mixin types has at least one mandatory child node definitions declared on it or any of its supertypes .
32,931
public boolean isQueryable ( Name nodeTypeName , Set < Name > mixinTypes ) { if ( nonQueryableNodeTypes . contains ( nodeTypeName ) ) { return false ; } if ( ! mixinTypes . isEmpty ( ) ) { for ( Name mixinType : mixinTypes ) { if ( nonQueryableNodeTypes . contains ( mixinType ) ) { return false ; } } } return true ; }
Check if the node type and mixin types are queryable or not .
32,932
boolean canRemoveItem ( Name primaryTypeNameOfParent , List < Name > mixinTypeNamesOfParent , Name itemName , boolean skipProtected ) { JcrNodeType primaryType = getNodeType ( primaryTypeNameOfParent ) ; if ( primaryType != null ) { for ( JcrPropertyDefinition definition : primaryType . allPropertyDefinitions ( itemName ) ) { if ( skipProtected && definition . isProtected ( ) ) continue ; return ! definition . isMandatory ( ) ; } } if ( primaryType != null ) { for ( JcrNodeDefinition definition : primaryType . allChildNodeDefinitions ( itemName ) ) { if ( skipProtected && definition . isProtected ( ) ) continue ; return ! definition . isMandatory ( ) ; } } if ( mixinTypeNamesOfParent != null && ! mixinTypeNamesOfParent . isEmpty ( ) ) { for ( Name mixinTypeName : mixinTypeNamesOfParent ) { JcrNodeType mixinType = getNodeType ( mixinTypeName ) ; if ( mixinType == null ) continue ; for ( JcrPropertyDefinition definition : mixinType . allPropertyDefinitions ( itemName ) ) { if ( skipProtected && definition . isProtected ( ) ) continue ; return ! definition . isMandatory ( ) ; } } } if ( mixinTypeNamesOfParent != null && ! mixinTypeNamesOfParent . isEmpty ( ) ) { for ( Name mixinTypeName : mixinTypeNamesOfParent ) { JcrNodeType mixinType = getNodeType ( mixinTypeName ) ; if ( mixinType == null ) continue ; for ( JcrNodeDefinition definition : mixinType . allChildNodeDefinitions ( itemName ) ) { if ( skipProtected && definition . isProtected ( ) ) continue ; return ! definition . isMandatory ( ) ; } } } if ( ! itemName . equals ( JcrNodeType . RESIDUAL_NAME ) ) return canRemoveItem ( primaryTypeNameOfParent , mixinTypeNamesOfParent , JcrNodeType . RESIDUAL_NAME , skipProtected ) ; return false ; }
Determine if the node and property definitions of the supplied primary type and mixin types allow the item with the supplied name to be removed .
32,933
protected JcrNodeType findTypeInMapOrList ( Name typeName , Collection < JcrNodeType > pendingList ) { for ( JcrNodeType pendingNodeType : pendingList ) { if ( pendingNodeType . getInternalName ( ) . equals ( typeName ) ) { return pendingNodeType ; } } return nodeTypes . get ( typeName ) ; }
Finds the named type in the given collection of types pending registration if it exists else returns the type definition from the repository
32,934
protected List < JcrNodeType > supertypesFor ( NodeTypeDefinition nodeType , Collection < JcrNodeType > pendingTypes ) throws RepositoryException { assert nodeType != null ; List < JcrNodeType > supertypes = new LinkedList < JcrNodeType > ( ) ; boolean isMixin = nodeType . isMixin ( ) ; boolean needsPrimaryAncestor = ! isMixin ; String nodeTypeName = nodeType . getName ( ) ; for ( String supertypeNameStr : nodeType . getDeclaredSupertypeNames ( ) ) { Name supertypeName = nameFactory . create ( supertypeNameStr ) ; JcrNodeType supertype = findTypeInMapOrList ( supertypeName , pendingTypes ) ; if ( supertype == null ) { throw new InvalidNodeTypeDefinitionException ( JcrI18n . invalidSupertypeName . text ( supertypeNameStr , nodeTypeName ) ) ; } needsPrimaryAncestor &= supertype . isMixin ( ) ; supertypes . add ( supertype ) ; } if ( needsPrimaryAncestor ) { Name nodeName = nameFactory . create ( nodeTypeName ) ; if ( ! JcrNtLexicon . BASE . equals ( nodeName ) ) { JcrNodeType ntBase = findTypeInMapOrList ( JcrNtLexicon . BASE , pendingTypes ) ; assert ntBase != null ; supertypes . add ( 0 , ntBase ) ; } } return supertypes ; }
Returns the list of node types for the supertypes defined in the given node type .
32,935
final Collection < JcrNodeType > subtypesFor ( JcrNodeType nodeType ) { List < JcrNodeType > subtypes = new LinkedList < JcrNodeType > ( ) ; for ( JcrNodeType type : this . nodeTypes . values ( ) ) { if ( type . supertypes ( ) . contains ( nodeType ) ) { subtypes . add ( type ) ; } } return subtypes ; }
Returns the list of subtypes for the given node .
32,936
final Collection < JcrNodeType > declaredSubtypesFor ( JcrNodeType nodeType ) { CheckArg . isNotNull ( nodeType , "nodeType" ) ; String nodeTypeName = nodeType . getName ( ) ; List < JcrNodeType > subtypes = new LinkedList < JcrNodeType > ( ) ; for ( JcrNodeType type : this . nodeTypes . values ( ) ) { if ( Arrays . asList ( type . getDeclaredSupertypeNames ( ) ) . contains ( nodeTypeName ) ) { subtypes . add ( type ) ; } } return subtypes ; }
Returns the list of declared subtypes for the given node .
32,937
protected void validate ( JcrNodeType nodeType , List < JcrNodeType > supertypes , List < JcrNodeType > pendingTypes ) throws RepositoryException { validateSupertypes ( supertypes ) ; List < Name > supertypeNames = new ArrayList < Name > ( supertypes . size ( ) ) ; for ( JcrNodeType supertype : supertypes ) { supertypeNames . add ( supertype . getInternalName ( ) ) ; } boolean foundExact = false ; boolean foundResidual = false ; boolean foundSNS = false ; Name primaryItemName = nodeType . getInternalPrimaryItemName ( ) ; for ( JcrNodeDefinition node : nodeType . getDeclaredChildNodeDefinitions ( ) ) { validateChildNodeDefinition ( node , supertypeNames , pendingTypes ) ; if ( node . isResidual ( ) ) { foundResidual = true ; } if ( primaryItemName != null && primaryItemName . equals ( node . getInternalName ( ) ) ) { foundExact = true ; } if ( node . allowsSameNameSiblings ( ) ) { foundSNS = true ; } } for ( JcrPropertyDefinition prop : nodeType . getDeclaredPropertyDefinitions ( ) ) { validatePropertyDefinition ( prop , supertypeNames , pendingTypes ) ; if ( prop . isResidual ( ) ) { foundResidual = true ; } if ( primaryItemName != null && primaryItemName . equals ( prop . getInternalName ( ) ) ) { if ( foundExact ) { throw new RepositoryException ( JcrI18n . ambiguousPrimaryItemName . text ( primaryItemName ) ) ; } foundExact = true ; } } if ( primaryItemName != null && ! foundExact && ! foundResidual ) { throw new RepositoryException ( JcrI18n . invalidPrimaryItemName . text ( primaryItemName ) ) ; } Name internalName = nodeType . getInternalName ( ) ; if ( isUnorderedCollection ( internalName , supertypeNames ) ) { boolean isVersionable = isVersionable ( internalName , supertypeNames ) ; if ( isVersionable || foundSNS || nodeType . hasOrderableChildNodes ( ) ) { throw new RepositoryException ( JcrI18n . invalidUnorderedCollectionType . text ( internalName . toString ( ) ) ) ; } } }
Validates that the given node type definition is valid under the ModeShape and JCR type rules within the given context .
32,938
public boolean isCaseSensitive ( ) { switch ( getJcrType ( ) ) { case PropertyType . DOUBLE : case PropertyType . LONG : case PropertyType . DECIMAL : case PropertyType . WEAKREFERENCE : case PropertyType . REFERENCE : case PropertyType . BOOLEAN : return false ; } return true ; }
Get the indicator if the value is case sensitive
32,939
public boolean isSigned ( ) { switch ( getJcrType ( ) ) { case PropertyType . DOUBLE : case PropertyType . LONG : case PropertyType . DECIMAL : case PropertyType . DATE : return true ; } return false ; }
Get the indicator if the value is considered a signed value .
32,940
public static < T > Iterable < T > concat ( final Iterable < T > a , final Iterable < T > b ) { assert ( a != null ) ; assert ( b != null ) ; return ( ) -> Collections . concat ( a . iterator ( ) , b . iterator ( ) ) ; }
Concatenate two Iterable sources
32,941
public static < T > Iterator < T > concat ( final Iterator < T > a , final Iterator < T > b ) { assert ( a != null ) ; assert ( b != null ) ; return new Iterator < T > ( ) { public boolean hasNext ( ) { return a . hasNext ( ) || b . hasNext ( ) ; } public T next ( ) { if ( a . hasNext ( ) ) { return a . next ( ) ; } return b . next ( ) ; } public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ; }
Concatenate two Iterators
32,942
public EsIndexColumn column ( String name ) { return columns . get ( noprefix ( name , EsIndexColumn . LENGTH_PREFIX , EsIndexColumn . LOWERCASE_PREFIX , EsIndexColumn . UPPERCASE_PREFIX ) ) ; }
Gets column with given name .
32,943
private String noprefix ( String name , String ... prefix ) { for ( int i = 0 ; i < prefix . length ; i ++ ) { if ( name . startsWith ( prefix [ i ] ) ) { name = name . replaceAll ( prefix [ i ] , "" ) ; } } return name ; }
Cuts name prefix for the pseudo column case .
32,944
public EsRequest mappings ( String type ) { EsRequest mappings = new EsRequest ( ) ; EsRequest mappingsValue = new EsRequest ( ) ; EsRequest mtype = new EsRequest ( ) ; EsRequest properties = new EsRequest ( ) ; for ( EsIndexColumn col : columns ( ) ) { properties . put ( col . getName ( ) , fieldMapping ( col . getType ( ) ) ) ; properties . put ( col . getLowerCaseFieldName ( ) , fieldMapping ( PropertyType . STRING ) ) ; properties . put ( col . getUpperCaseFieldName ( ) , fieldMapping ( PropertyType . STRING ) ) ; properties . put ( col . getLengthFieldName ( ) , fieldMapping ( PropertyType . LONG ) ) ; } mtype . put ( "properties" , properties ) ; mappingsValue . put ( type , mtype ) ; mappings . put ( "mappings" , mappingsValue ) ; return mappings ; }
Provides Elasticsearch mapping definition for the given type and this columns .
32,945
private EsRequest fieldMapping ( PropertyType type ) { EsRequest mappings = new EsRequest ( ) ; switch ( type ) { case BINARY : mappings . put ( "type" , "binary" ) ; break ; case BOOLEAN : mappings . put ( "type" , "boolean" ) ; break ; case DATE : mappings . put ( "type" , "long" ) ; break ; case LONG : case DECIMAL : mappings . put ( "type" , "long" ) ; break ; case DOUBLE : mappings . put ( "type" , "double" ) ; break ; default : mappings . put ( "type" , "string" ) ; mappings . put ( "analyzer" , "whitespace" ) ; } return mappings ; }
Creates mapping definition for the specified column type .
32,946
public void setControls ( FormItem ... items ) { FormItem [ ] controls = new FormItem [ items . length + 3 ] ; int i = 0 ; for ( FormItem item : items ) { controls [ i ++ ] = item ; } controls [ i ++ ] = new SpacerItem ( ) ; controls [ i ++ ] = confirmButton ; controls [ i ++ ] = cancelButton ; form . setItems ( controls ) ; }
Adds controls to this dialog .
32,947
public static void unzip ( InputStream zipFile , String dest ) throws IOException { byte [ ] buffer = new byte [ 1024 ] ; File folder = new File ( dest ) ; if ( folder . exists ( ) ) { FileUtil . delete ( folder ) ; } folder . mkdir ( ) ; try ( ZipInputStream zis = new ZipInputStream ( zipFile ) ) { ZipEntry ze = zis . getNextEntry ( ) ; File parent = new File ( dest ) ; while ( ze != null ) { String fileName = ze . getName ( ) ; if ( ze . isDirectory ( ) ) { File newFolder = new File ( parent , fileName ) ; newFolder . mkdir ( ) ; } else { File newFile = new File ( parent , fileName ) ; try ( FileOutputStream fos = new FileOutputStream ( newFile ) ) { int len ; while ( ( len = zis . read ( buffer ) ) > 0 ) { fos . write ( buffer , 0 , len ) ; } } } ze = zis . getNextEntry ( ) ; } zis . closeEntry ( ) ; } }
Unzip archive to the specified destination .
32,948
public static void zipDir ( String dirName , String nameZipFile ) throws IOException { try ( FileOutputStream fW = new FileOutputStream ( nameZipFile ) ; ZipOutputStream zip = new ZipOutputStream ( fW ) ) { addFolderToZip ( "" , dirName , zip ) ; } }
Compresses directory into zip archive .
32,949
public static void addFolderToZip ( String path , String srcFolder , ZipOutputStream zip ) throws IOException { File folder = new File ( srcFolder ) ; if ( folder . list ( ) . length == 0 ) { addFileToZip ( path , srcFolder , zip , true ) ; } else { for ( String fileName : folder . list ( ) ) { if ( path . equals ( "" ) ) { addFileToZip ( folder . getName ( ) , srcFolder + "/" + fileName , zip , false ) ; } else { addFileToZip ( path + "/" + folder . getName ( ) , srcFolder + "/" + fileName , zip , false ) ; } } } }
Adds folder to the archive .
32,950
public static void addFileToZip ( String path , String srcFile , ZipOutputStream zip , boolean flag ) throws IOException { File folder = new File ( srcFile ) ; if ( flag ) { zip . putNextEntry ( new ZipEntry ( path + "/" + folder . getName ( ) + "/" ) ) ; } else { if ( folder . isDirectory ( ) ) { addFolderToZip ( path , srcFile , zip ) ; } else { byte [ ] buf = new byte [ 1024 ] ; int len ; try ( FileInputStream in = new FileInputStream ( srcFile ) ) { zip . putNextEntry ( new ZipEntry ( path + "/" + folder . getName ( ) ) ) ; while ( ( len = in . read ( buf ) ) > 0 ) { zip . write ( buf , 0 , len ) ; } } } } }
Appends file to the archive .
32,951
public static String getExtension ( final String filename ) { Objects . requireNonNull ( filename , "filename cannot be null" ) ; int lastDotIdx = filename . lastIndexOf ( "." ) ; return lastDotIdx >= 0 ? filename . substring ( lastDotIdx ) : "" ; }
Returns the extension of a file including the dot .
32,952
public void read ( InputStream stream , Node outputNode ) throws Exception { read ( new InputSource ( stream ) , outputNode ) ; }
Read the document from the supplied stream and produce the derived content .
32,953
private JcrSession openSession ( ) throws ResourceException { try { Repository repo = mcf . getRepository ( ) ; Session s = repo . login ( cri . getCredentials ( ) , cri . getWorkspace ( ) ) ; return ( JcrSession ) s ; } catch ( RepositoryException e ) { throw new ResourceException ( "Failed to create session: " + e . getMessage ( ) , e ) ; } }
Create a new session .
32,954
public void destroy ( ) throws ResourceException { LOGGER . debug ( "Shutting down connection to repo '{0}'" , mcf . getRepositoryURL ( ) ) ; this . session . logout ( ) ; this . handles . clear ( ) ; }
Destroys the physical connection to the underlying resource manager .
32,955
public ManagedConnectionMetaData getMetaData ( ) throws ResourceException { try { return new JcrManagedConnectionMetaData ( mcf . getRepository ( ) , session ) ; } catch ( Exception e ) { throw new ResourceException ( e ) ; } }
Gets the metadata information for this connection s underlying EIS resource manager instance .
32,956
public Session getSession ( JcrSessionHandle handle ) { if ( ( handles . size ( ) > 0 ) && ( handles . get ( 0 ) == handle ) ) { return session ; } throw new java . lang . IllegalStateException ( "Inactive logical session handle called" ) ; }
Searches session object using handle .
32,957
public static String combineLines ( String [ ] lines , char separator ) { if ( lines == null || lines . length == 0 ) return "" ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i != lines . length ; ++ i ) { String line = lines [ i ] ; if ( i != 0 ) sb . append ( separator ) ; sb . append ( line ) ; } return sb . toString ( ) ; }
Combine the lines into a single string using the supplied separator as the delimiter .
32,958
public static List < String > splitLines ( final String content ) { if ( content == null || content . length ( ) == 0 ) return Collections . emptyList ( ) ; String [ ] lines = content . split ( "[\\r]?\\n" ) ; return Arrays . asList ( lines ) ; }
Split the supplied content into lines returning each line as an element in the returned list .
32,959
public static String createString ( final char charToRepeat , int numberOfRepeats ) { assert numberOfRepeats >= 0 ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < numberOfRepeats ; ++ i ) { sb . append ( charToRepeat ) ; } return sb . toString ( ) ; }
Create a new string containing the specified character repeated a specific number of times .
32,960
public static String justify ( Justify justify , String str , final int width , char padWithChar ) { switch ( justify ) { case LEFT : return justifyLeft ( str , width , padWithChar ) ; case RIGHT : return justifyRight ( str , width , padWithChar ) ; case CENTER : return justifyCenter ( str , width , padWithChar ) ; } assert false ; return null ; }
Justify the contents of the string .
32,961
public static String justifyRight ( String str , final int width , char padWithChar ) { assert width > 0 ; str = str != null ? str . trim ( ) : "" ; final int length = str . length ( ) ; int addChars = width - length ; if ( addChars < 0 ) { return str . subSequence ( length - width , length ) . toString ( ) ; } final StringBuilder sb = new StringBuilder ( ) ; while ( addChars > 0 ) { sb . append ( padWithChar ) ; -- addChars ; } sb . append ( str ) ; return sb . toString ( ) ; }
Right justify the contents of the string ensuring that the string ends at the last character . If the supplied string is longer than the desired width the leading characters are removed so that the last character in the supplied string at the last position . If the supplied string is shorter than the desired width the padding character is inserted one or more times such that the last character in the supplied string appears as the last character in the resulting string and that the length matches that specified .
32,962
public static String justifyLeft ( String str , final int width , char padWithChar ) { return justifyLeft ( str , width , padWithChar , true ) ; }
Left justify the contents of the string ensuring that the supplied string begins at the first character and that the resulting string is of the desired length . If the supplied string is longer than the desired width it is truncated to the specified length . If the supplied string is shorter than the desired width the padding character is added to the end of the string one or more times such that the length is that specified . All leading and trailing whitespace is removed .
32,963
public static String justifyCenter ( String str , final int width , char padWithChar ) { str = str != null ? str . trim ( ) : "" ; int addChars = width - str . length ( ) ; if ( addChars < 0 ) { return str . subSequence ( 0 , width ) . toString ( ) ; } int prependNumber = addChars / 2 ; int appendNumber = prependNumber ; if ( ( prependNumber + appendNumber ) != addChars ) { ++ prependNumber ; } final StringBuilder sb = new StringBuilder ( ) ; while ( prependNumber > 0 ) { sb . append ( padWithChar ) ; -- prependNumber ; } sb . append ( str ) ; while ( appendNumber > 0 ) { sb . append ( padWithChar ) ; -- appendNumber ; } return sb . toString ( ) ; }
Center the contents of the string . If the supplied string is longer than the desired width it is truncated to the specified length . If the supplied string is shorter than the desired width padding characters are added to the beginning and end of the string such that the length is that specified ; one additional padding character is prepended if required . All leading and trailing whitespace is removed before centering .
32,964
public static String truncate ( Object obj , int maxLength , String suffix ) { CheckArg . isNonNegative ( maxLength , "maxLength" ) ; if ( obj == null || maxLength == 0 ) { return "" ; } String str = obj . toString ( ) ; if ( str . length ( ) <= maxLength ) return str ; if ( suffix == null ) suffix = "..." ; int maxNumChars = maxLength - suffix . length ( ) ; if ( maxNumChars < 0 ) { str = suffix . substring ( 0 , maxLength ) ; } else if ( str . length ( ) > maxNumChars ) { str = str . substring ( 0 , maxNumChars ) + suffix ; } return str ; }
Truncate the supplied string to be no more than the specified length . This method returns an empty string if the supplied object is null .
32,965
public static String getStackTrace ( Throwable throwable ) { if ( throwable == null ) return null ; final ByteArrayOutputStream bas = new ByteArrayOutputStream ( ) ; final PrintWriter pw = new PrintWriter ( bas ) ; throwable . printStackTrace ( pw ) ; pw . close ( ) ; return bas . toString ( ) ; }
Get the stack trace of the supplied exception .
32,966
public static String normalize ( String text ) { CheckArg . isNotNull ( text , "text" ) ; return NORMALIZE_PATTERN . matcher ( text ) . replaceAll ( " " ) . trim ( ) ; }
Removes leading and trailing whitespace from the supplied text and reduces other consecutive whitespace characters to a single space . Whitespace includes line - feeds .
32,967
public static String getHexString ( byte [ ] bytes ) { try { byte [ ] hex = new byte [ 2 * bytes . length ] ; int index = 0 ; for ( byte b : bytes ) { int v = b & 0xFF ; hex [ index ++ ] = HEX_CHAR_TABLE [ v >>> 4 ] ; hex [ index ++ ] = HEX_CHAR_TABLE [ v & 0xF ] ; } return new String ( hex , "ASCII" ) ; } catch ( UnsupportedEncodingException e ) { BigInteger bi = new BigInteger ( 1 , bytes ) ; return String . format ( "%0" + ( bytes . length << 1 ) + "x" , bi ) ; } }
Get the hexadecimal string representation of the supplied byte array .
32,968
public static boolean containsAnyOf ( String str , char ... chars ) { CharacterIterator iter = new StringCharacterIterator ( str ) ; for ( char c = iter . first ( ) ; c != CharacterIterator . DONE ; c = iter . next ( ) ) { for ( char match : chars ) { if ( c == match ) return true ; } } return false ; }
Return whether the supplied string contains any of the supplied characters .
32,969
protected void refreshFromSystem ( ) { try { SessionCache systemCache = repository . createSystemSession ( repository . context ( ) , false ) ; SystemContent system = new SystemContent ( systemCache ) ; CachedNode locks = system . locksNode ( ) ; MutableCachedNode mutableLocks = null ; Set < NodeKey > corruptedLocks = new HashSet < > ( ) ; for ( ChildReference ref : locks . getChildReferences ( systemCache ) ) { CachedNode node = systemCache . getNode ( ref ) ; if ( node == null ) { if ( mutableLocks == null ) { mutableLocks = system . mutableLocksNode ( ) ; } NodeKey lockKey = ref . getKey ( ) ; logger . warn ( JcrI18n . lockNotFound , lockKey ) ; mutableLocks . removeChild ( systemCache , lockKey ) ; corruptedLocks . add ( lockKey ) ; continue ; } ModeShapeLock lock = new ModeShapeLock ( node , systemCache ) ; locksByNodeKey . put ( lock . getLockedNodeKey ( ) , lock ) ; } if ( mutableLocks != null ) { system . save ( ) ; for ( Iterator < Map . Entry < NodeKey , ModeShapeLock > > locksIterator = locksByNodeKey . entrySet ( ) . iterator ( ) ; locksIterator . hasNext ( ) ; ) { NodeKey lockKey = locksIterator . next ( ) . getValue ( ) . getLockKey ( ) ; if ( corruptedLocks . contains ( lockKey ) ) { locksIterator . remove ( ) ; } } } } catch ( Throwable e ) { logger . error ( e , JcrI18n . errorRefreshingLocks , repository . name ( ) ) ; } }
Refresh the locks from the stored representation .
32,970
protected void record ( final Sequencer . Context context , final char [ ] sourceCode , final Node outputNode ) throws Exception { if ( ( sourceCode == null ) || ( sourceCode . length == 0 ) ) { LOGGER . debug ( "No source code was found for output node {0}" , outputNode . getName ( ) ) ; return ; } this . context = context ; this . sourceCode = new String ( sourceCode ) ; this . compilationUnit = ( CompilationUnit ) CompilationUnitParser . runJLS3Conversion ( sourceCode , true ) ; outputNode . addMixin ( ClassFileSequencerLexicon . COMPILATION_UNIT ) ; record ( this . compilationUnit , outputNode ) ; }
Convert the compilation unit into JCR nodes .
32,971
private String getTypeName ( Type type ) { CheckArg . isNotNull ( type , "type" ) ; if ( type . isPrimitiveType ( ) ) { PrimitiveType primitiveType = ( PrimitiveType ) type ; return primitiveType . getPrimitiveTypeCode ( ) . toString ( ) ; } if ( type . isSimpleType ( ) ) { SimpleType simpleType = ( SimpleType ) type ; return JavaMetadataUtil . getName ( simpleType . getName ( ) ) ; } if ( type . isParameterizedType ( ) ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; return getTypeName ( parameterizedType . getType ( ) ) ; } if ( type . isArrayType ( ) ) { ArrayType arrayType = ( ArrayType ) type ; Type elementType = arrayType . getElementType ( ) ; if ( elementType . isPrimitiveType ( ) ) { return ( ( PrimitiveType ) elementType ) . getPrimitiveTypeCode ( ) . toString ( ) ; } if ( elementType . isSimpleType ( ) ) { return JavaMetadataUtil . getName ( ( ( SimpleType ) elementType ) . getName ( ) ) ; } } return null ; }
Extract the type name
32,972
public static DatabaseType determineType ( DatabaseMetaData metaData ) throws SQLException { metaData = Objects . requireNonNull ( metaData , "metaData cannot be null" ) ; int majorVersion = metaData . getDatabaseMajorVersion ( ) ; int minorVersion = metaData . getDatabaseMinorVersion ( ) ; String name = metaData . getDatabaseProductName ( ) . toLowerCase ( ) ; if ( name . contains ( "mysql" ) ) { return new DatabaseType ( DatabaseType . Name . MYSQL , majorVersion , minorVersion ) ; } else if ( name . contains ( "postgres" ) ) { return new DatabaseType ( DatabaseType . Name . POSTGRES , majorVersion , minorVersion ) ; } else if ( name . contains ( "derby" ) ) { return new DatabaseType ( DatabaseType . Name . DERBY , majorVersion , minorVersion ) ; } else if ( name . contains ( "hsql" ) || name . toLowerCase ( ) . contains ( "hypersonic" ) ) { return new DatabaseType ( DatabaseType . Name . HSQL , majorVersion , minorVersion ) ; } else if ( name . contains ( "h2" ) ) { return new DatabaseType ( DatabaseType . Name . H2 , majorVersion , minorVersion ) ; } else if ( name . contains ( "sqlite" ) ) { return new DatabaseType ( DatabaseType . Name . SQLITE , majorVersion , minorVersion ) ; } else if ( name . contains ( "db2" ) ) { return new DatabaseType ( DatabaseType . Name . DB2 , majorVersion , minorVersion ) ; } else if ( name . contains ( "informix" ) ) { return new DatabaseType ( DatabaseType . Name . INFORMIX , majorVersion , minorVersion ) ; } else if ( name . contains ( "interbase" ) ) { return new DatabaseType ( DatabaseType . Name . INTERBASE , majorVersion , minorVersion ) ; } else if ( name . contains ( "firebird" ) ) { return new DatabaseType ( DatabaseType . Name . FIREBIRD , majorVersion , minorVersion ) ; } else if ( name . contains ( "sqlserver" ) || name . toLowerCase ( ) . contains ( "microsoft" ) ) { return new DatabaseType ( DatabaseType . Name . SQLSERVER , majorVersion , minorVersion ) ; } else if ( name . contains ( "access" ) ) { return new DatabaseType ( DatabaseType . Name . ACCESS , majorVersion , minorVersion ) ; } else if ( name . contains ( "oracle" ) ) { return new DatabaseType ( DatabaseType . Name . ORACLE , majorVersion , minorVersion ) ; } else if ( name . contains ( "adaptive" ) ) { return new DatabaseType ( DatabaseType . Name . SYBASE , majorVersion , minorVersion ) ; } else if ( name . contains ( "cassandra" ) ) { return new DatabaseType ( DatabaseType . Name . CASSANDRA , majorVersion , minorVersion ) ; } return DatabaseType . UNKNOWN ; }
Determine the type of a database based on the metadata information from the DB metadata .
32,973
@ SuppressWarnings ( "unchecked" ) public synchronized void addConsumer ( MessageConsumer < ? extends Serializable > consumer ) { consumers . add ( ( MessageConsumer < Serializable > ) consumer ) ; }
Adds a new message consumer to this service .
32,974
public synchronized boolean shutdown ( ) { if ( channel == null ) { return false ; } Address address = channel . getAddress ( ) ; LOGGER . debug ( "{0} shutting down clustering service..." , address ) ; consumers . clear ( ) ; isOpen . set ( false ) ; try { channel . disconnect ( ) ; channel . removeChannelListener ( listener ) ; channel . setReceiver ( null ) ; channel . close ( ) ; LOGGER . debug ( "{0} successfully closed main channel" , address ) ; } finally { channel = null ; } membersInCluster . set ( 1 ) ; return true ; }
Shuts down and clears resources held by this service .
32,975
public boolean sendMessage ( Serializable payload ) { if ( ! isOpen ( ) || ! multipleMembersInCluster ( ) ) { return false ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "{0} SENDING {1} " , toString ( ) , payload ) ; } try { byte [ ] messageData = toByteArray ( payload ) ; Message jgMessage = new Message ( null , channel . getAddress ( ) , messageData ) ; channel . send ( jgMessage ) ; return true ; } catch ( Exception e ) { throw new SystemFailureException ( ClusteringI18n . errorSendingMessage . text ( clusterName ( ) ) , e ) ; } }
Sends a message of a given type across a cluster .
32,976
public static ClusteringService startStandalone ( String clusterName , String jgroupsConfig ) { ClusteringService clusteringService = new StandaloneClusteringService ( clusterName , jgroupsConfig ) ; clusteringService . init ( ) ; return clusteringService ; }
Starts a standalone clustering service which in turn will start & connect its own JGroup channel .
32,977
public static ClusteringService startStandalone ( String clusterName , Channel channel ) { ClusteringService clusteringService = new StandaloneClusteringService ( clusterName , channel ) ; clusteringService . init ( ) ; return clusteringService ; }
Starts a standalone clustering service which uses the supplied channel .
32,978
public static ClusteringService startForked ( Channel mainChannel ) { if ( ! mainChannel . isConnected ( ) ) { throw new IllegalStateException ( ClusteringI18n . channelNotConnected . text ( ) ) ; } ClusteringService clusteringService = new ForkedClusteringService ( mainChannel ) ; clusteringService . init ( ) ; return clusteringService ; }
Starts a new clustering service by forking a channel of an existing JGroups channel .
32,979
public boolean isNotOneOf ( Type first , Type ... rest ) { return isNotOneOf ( EnumSet . of ( first , rest ) ) ; }
Return true if this node s type does not match any of the supplied types
32,980
public boolean isOneOf ( Type first , Type ... rest ) { return isOneOf ( EnumSet . of ( first , rest ) ) ; }
Return true if this node s type matches one of the supplied types
32,981
public boolean isBelow ( PlanNode possibleAncestor ) { PlanNode node = this ; while ( node != null ) { if ( node == possibleAncestor ) return true ; node = node . getParent ( ) ; } return false ; }
Determine if the supplied node is an ancestor of this node .
32,982
public boolean replaceChild ( PlanNode child , PlanNode replacement ) { assert child != null ; assert replacement != null ; if ( child . parent == this ) { int i = this . children . indexOf ( child ) ; if ( replacement . parent == this ) { int j = this . children . indexOf ( replacement ) ; this . children . set ( i , replacement ) ; this . children . set ( j , child ) ; return true ; } this . children . set ( i , replacement ) ; replacement . removeFromParent ( ) ; replacement . parent = this ; child . parent = null ; return true ; } return false ; }
Replace the supplied child with another node . If the replacement is already a child of this node this method effectively swaps the position of the child and replacement nodes .
32,983
public Set < Property > getPropertyKeys ( ) { return nodeProperties != null ? nodeProperties . keySet ( ) : Collections . < Property > emptySet ( ) ; }
Get the keys for the property values that are set on this node .
32,984
public Object getProperty ( Property propertyId ) { return nodeProperties != null ? nodeProperties . get ( propertyId ) : null ; }
Get the node s value for this supplied property .
32,985
public < ValueType > ValueType getProperty ( Property propertyId , Class < ValueType > type ) { return nodeProperties != null ? type . cast ( nodeProperties . get ( propertyId ) ) : null ; }
Get the node s value for this supplied property casting the result to the supplied type .
32,986
public Object setProperty ( Property propertyId , Object value ) { if ( value == null ) { return nodeProperties != null ? nodeProperties . remove ( propertyId ) : null ; } if ( nodeProperties == null ) nodeProperties = new TreeMap < Property , Object > ( ) ; return nodeProperties . put ( propertyId , value ) ; }
Set the node s value for the supplied property .
32,987
public Object removeProperty ( Object propertyId ) { return nodeProperties != null ? nodeProperties . remove ( propertyId ) : null ; }
Remove the node s value for this supplied property .
32,988
public boolean hasCollectionProperty ( Property propertyId ) { Object value = getProperty ( propertyId ) ; return ( value instanceof Collection < ? > && ! ( ( Collection < ? > ) value ) . isEmpty ( ) ) ; }
Indicates if there is a non - null and non - empty Collection value for the property .
32,989
public boolean replaceSelector ( SelectorName original , SelectorName replacement ) { if ( original != null && replacement != null ) { if ( selectors . remove ( original ) ) { selectors . add ( replacement ) ; return true ; } } return false ; }
Replace this plan s use of the named selector with the replacement . to this plan node . This method does nothing if either of the supplied selector names is null or if the supplied original selector name is not found .
32,990
public List < PlanNode > findAllFirstNodesAtOrBelow ( Type typeToFind ) { List < PlanNode > results = new LinkedList < PlanNode > ( ) ; LinkedList < PlanNode > queue = new LinkedList < PlanNode > ( ) ; queue . add ( this ) ; while ( ! queue . isEmpty ( ) ) { PlanNode aNode = queue . poll ( ) ; if ( aNode . getType ( ) == Type . PROJECT ) { results . add ( aNode ) ; } else { queue . addAll ( 0 , aNode . getChildren ( ) ) ; } } return results ; }
Look at nodes below this node searching for nodes that have the supplied type . As soon as a node with a matching type is found then no other nodes below it are searched .
32,991
public void apply ( Traversal order , final Operation operation , final Type type ) { apply ( order , new Operation ( ) { public void apply ( PlanNode node ) { if ( node . getType ( ) == type ) operation . apply ( node ) ; } } ) ; }
Walk the plan tree starting in the specified traversal order and apply the supplied operation to every plan node with a type that matches the given type .
32,992
public void apply ( Traversal order , Operation operation ) { assert order != null ; switch ( order ) { case LEVEL_ORDER : operation . apply ( this ) ; applyLevelOrder ( order , operation ) ; break ; case PRE_ORDER : operation . apply ( this ) ; for ( PlanNode child : this ) { child . apply ( order , operation ) ; } break ; case POST_ORDER : for ( PlanNode child : this ) { child . apply ( order , operation ) ; } operation . apply ( this ) ; break ; } }
Walk the plan tree starting in the specified traversal order and apply the supplied operation to every plan node .
32,993
public void applyToAncestorsUpTo ( Type stopType , Operation operation ) { PlanNode ancestor = getParent ( ) ; while ( ancestor != null ) { if ( ancestor . getType ( ) == stopType ) return ; operation . apply ( ancestor ) ; ancestor = ancestor . getParent ( ) ; } }
Apply the operation to all ancestor nodes below a node of the given type .
32,994
public void applyToAncestors ( Operation operation ) { PlanNode ancestor = getParent ( ) ; while ( ancestor != null ) { operation . apply ( ancestor ) ; ancestor = ancestor . getParent ( ) ; } }
Apply the operation to all ancestor nodes .
32,995
public List < PlanNode > findAllAtOrBelow ( Traversal order ) { assert order != null ; LinkedList < PlanNode > results = new LinkedList < PlanNode > ( ) ; LinkedList < PlanNode > queue = new LinkedList < PlanNode > ( ) ; queue . add ( this ) ; while ( ! queue . isEmpty ( ) ) { PlanNode aNode = queue . poll ( ) ; switch ( order ) { case LEVEL_ORDER : results . add ( aNode ) ; queue . addAll ( aNode . getChildren ( ) ) ; break ; case PRE_ORDER : results . add ( aNode ) ; queue . addAll ( 0 , aNode . getChildren ( ) ) ; break ; case POST_ORDER : queue . addAll ( 0 , aNode . getChildren ( ) ) ; results . addFirst ( aNode ) ; break ; } } return results ; }
Find all of the nodes that are at or below this node .
32,996
public List < PlanNode > findAllAtOrBelow ( Traversal order , Type typeToFind ) { return findAllAtOrBelow ( order , EnumSet . of ( typeToFind ) ) ; }
Find all of the nodes of the specified type that are at or below this node .
32,997
public PlanNode findAtOrBelow ( Traversal order , Type typeToFind ) { return findAtOrBelow ( order , EnumSet . of ( typeToFind ) ) ; }
Find the first node with the specified type that are at or below this node .
32,998
public String findJcrName ( String cmisName ) { for ( Relation aList : list ) { if ( aList . cmisName . equals ( cmisName ) ) { return aList . jcrName ; } } return cmisName ; }
Gets the name of the given property in JCR domain .
32,999
public String findCmisName ( String jcrName ) { for ( Relation aList : list ) { if ( aList . jcrName . equals ( jcrName ) ) { return aList . cmisName ; } } return jcrName ; }
Gets the name of the given property in CMIS domain .