idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
15,500
protected void updateMixin ( NodeData node ) { NodeData prevData = ( NodeData ) cache . put ( new CacheId ( getOwnerId ( ) , node . getIdentifier ( ) ) , node , true ) ; if ( ! ( prevData instanceof NullNodeData ) ) { if ( prevData != null ) { if ( prevData . getACL ( ) == null || ! prevData . getACL ( ) . equals ( nod...
Update Node s mixin and ACL .
15,501
protected Set < String > updateTreePath ( QPath prevRootPath , QPath newRootPath , Set < String > idsToSkip ) { return caller . updateTreePath ( prevRootPath , newRootPath , idsToSkip ) ; }
Check all items in cache if it is a descendant of the previous root path and if so update the path according the new root path .
15,502
protected void renameItem ( final ItemState state , final ItemState lastDelete ) { ItemData data = state . getData ( ) ; ItemData prevData = getFromBufferedCacheById . run ( data . getIdentifier ( ) ) ; if ( data . isNode ( ) ) { if ( state . isPersisted ( ) ) { removeItem ( lastDelete . getData ( ) ) ; putItem ( state...
Apply rename operation on cache . Parent node will be re - added into the cache since parent or name might changing . For other children only item data will be replaced .
15,503
private void onCacheEntryUpdated ( ItemData data ) { if ( data == null || data instanceof NullItemData ) { return ; } for ( WorkspaceStorageCacheListener listener : listeners ) { try { listener . onCacheEntryUpdated ( data ) ; } catch ( RuntimeException e ) { LOG . warn ( "The method onCacheEntryUpdated fails for the l...
Called when a cache entry corresponding to the given node has item updated
15,504
private static DNChar denormalize ( String string ) { if ( string . startsWith ( "&lt;" ) ) return new DNChar ( '<' , 4 ) ; else if ( string . startsWith ( "&gt;" ) ) return new DNChar ( '>' , 4 ) ; else if ( string . startsWith ( "&amp;" ) ) return new DNChar ( '&' , 5 ) ; else if ( string . startsWith ( "&quot;" ) ) ...
Denormalizes and print the given character .
15,505
public File getFile ( String hash ) { return new File ( channel . rootDir , channel . makeFilePath ( hash , 0 ) ) ; }
Construct file name of given hash .
15,506
public MultiColumnQueryHits execute ( Query query , Sort sort , long resultFetchHint , InternalQName selectorName ) throws IOException { return new QueryHitsAdapter ( evaluate ( query , sort , resultFetchHint ) , selectorName ) ; }
Executes the query and returns the hits that match the query .
15,507
private boolean authenticate ( Session session , String userName , String password , PasswordEncrypter pe ) throws Exception { boolean authenticated ; Node userNode ; try { userNode = utils . getUserNode ( session , userName ) ; } catch ( PathNotFoundException e ) { return false ; } boolean enabled = userNode . canAddM...
Checks if credentials matches .
15,508
private void createUser ( Session session , UserImpl user , boolean broadcast ) throws Exception { Node userStorageNode = utils . getUsersStorageNode ( session ) ; Node userNode = userStorageNode . addNode ( user . getUserName ( ) ) ; if ( user . getCreatedDate ( ) == null ) { Calendar calendar = Calendar . getInstance...
Persists new user .
15,509
private User removeUser ( Session session , String userName , boolean broadcast ) throws Exception { Node userNode = utils . getUserNode ( session , userName ) ; User user = readUser ( userNode ) ; if ( broadcast ) { preDelete ( user ) ; } removeMemberships ( userNode , broadcast ) ; userNode . remove ( ) ; session . s...
Remove user and related membership entities .
15,510
private void removeMemberships ( Node userNode , boolean broadcast ) throws RepositoryException { PropertyIterator refUserProps = userNode . getReferences ( ) ; while ( refUserProps . hasNext ( ) ) { Node refUserNode = refUserProps . nextProperty ( ) . getParent ( ) ; refUserNode . remove ( ) ; } }
Removes membership entities related to current user .
15,511
private void saveUser ( Session session , UserImpl user , boolean broadcast ) throws Exception { Node userNode = getUserNode ( session , user ) ; if ( broadcast ) { preSave ( user , false ) ; } String oldName = userNode . getName ( ) ; String newName = user . getUserName ( ) ; if ( ! oldName . equals ( newName ) ) { St...
Persists user .
15,512
private Node getUserNode ( Session session , UserImpl user ) throws RepositoryException { if ( user . getInternalId ( ) != null ) { return session . getNodeByUUID ( user . getInternalId ( ) ) ; } else { return utils . getUserNode ( session , user . getUserName ( ) ) ; } }
Returns user node by internal identifier or by name .
15,513
public UserImpl readUser ( Node userNode ) throws Exception { UserImpl user = new UserImpl ( userNode . getName ( ) ) ; Date creationDate = utils . readDate ( userNode , UserProperties . JOS_CREATED_DATE ) ; Date lastLoginTime = utils . readDate ( userNode , UserProperties . JOS_LAST_LOGIN_TIME ) ; String email = utils...
Read user properties from the node in the storage .
15,514
private void writeUser ( User user , Node node ) throws Exception { node . setProperty ( UserProperties . JOS_EMAIL , user . getEmail ( ) ) ; node . setProperty ( UserProperties . JOS_FIRST_NAME , user . getFirstName ( ) ) ; node . setProperty ( UserProperties . JOS_LAST_NAME , user . getLastName ( ) ) ; node . setProp...
Write user properties from the node to the storage .
15,515
void migrateUser ( Node oldUserNode ) throws Exception { String userName = oldUserNode . getName ( ) ; if ( findUserByName ( userName , UserStatus . ANY ) != null ) { removeUser ( userName , false ) ; } UserImpl user = readUser ( oldUserNode ) ; createUser ( user , false ) ; }
Method for user migration .
15,516
private void preSave ( User user , boolean isNew ) throws Exception { for ( UserEventListener listener : listeners ) { listener . preSave ( user , isNew ) ; } }
Notifying listeners before user creation .
15,517
private void postSave ( User user , boolean isNew ) throws Exception { for ( UserEventListener listener : listeners ) { listener . postSave ( user , isNew ) ; } }
Notifying listeners after user creation .
15,518
private void preDelete ( User user ) throws Exception { for ( UserEventListener listener : listeners ) { listener . preDelete ( user ) ; } }
Notifying listeners before user deletion .
15,519
private void postDelete ( User user ) throws Exception { for ( UserEventListener listener : listeners ) { listener . postDelete ( user ) ; } }
Notifying listeners after user deletion .
15,520
private void removeAllRelatedFromCache ( String userName ) { cache . remove ( userName , CacheType . USER_PROFILE ) ; cache . remove ( CacheHandler . USER_PREFIX + userName , CacheType . MEMBERSHIP ) ; }
Remove user and related entities from cache .
15,521
private User getFromCache ( String userName ) { return ( User ) cache . get ( userName , CacheType . USER ) ; }
Get user from cache .
15,522
private void moveMembershipsInCache ( String oldName , String newName ) { cache . move ( CacheHandler . USER_PREFIX + oldName , CacheHandler . USER_PREFIX + newName , CacheType . MEMBERSHIP ) ; }
Move memberships entities from old key to new one .
15,523
private void putInCache ( User user ) { cache . put ( user . getUserName ( ) , user , CacheType . USER ) ; }
Put user in cache .
15,524
public PersistedValueData read ( ObjectReader in , int type ) throws UnknownClassIdException , IOException { File tempDirectory = new File ( SerializationConstants . TEMP_DIR ) ; PrivilegedFileHelper . mkdirs ( tempDirectory ) ; int key ; if ( ( key = in . readInt ( ) ) != SerializationConstants . PERSISTED_VALUE_DATA ...
Read and set PersistedValueData object data .
15,525
private void readFully ( ByteBuffer dst ) throws IOException { int r = channel . read ( dst ) ; if ( r < 0 ) throw new EOFException ( ) ; if ( r < dst . capacity ( ) && r > 0 ) throw new StreamCorruptedException ( "Unexpected EOF in middle of data block." ) ; }
Reads a sequence of bytes from file into the given buffer .
15,526
public void register ( SearchManager searchManager , SearchManager parentSearchManager , QueryHandler handler , QueryHandler parentHandler ) throws RepositoryConfigurationException { indexers . put ( searchManager . getWsId ( ) , new Indexer ( searchManager , parentSearchManager , handler , parentHandler ) ) ; if ( LOG...
This method will register a new Indexer according to the given parameters .
15,527
public static String getNodeType ( String nodeTypeHeader , String defaultNodeType , Set < String > allowedNodeTypes ) throws NoSuchNodeTypeException { if ( nodeTypeHeader == null ) { return defaultNodeType ; } if ( allowedNodeTypes . contains ( nodeTypeHeader ) ) { return nodeTypeHeader ; } throw new NoSuchNodeTypeExce...
Returns parsed nodeType obtained from node - type header . This method is unified for files and folders .
15,528
public static String getContentNodeType ( String contentNodeTypeHeader ) { if ( contentNodeTypeHeader != null ) return contentNodeTypeHeader ; else return WebDavConst . NodeTypes . NT_RESOURCE ; }
Returns the NodeType of content node according to the Content - NodeType header .
15,529
public static ArrayList < String > getMixinTypes ( String mixinTypes ) { return mixinTypes == null ? new ArrayList < String > ( ) : new ArrayList < String > ( Arrays . asList ( mixinTypes . split ( "," ) ) ) ; }
Returns the list of node mixins .
15,530
public TransactionChangesLog read ( ObjectReader in ) throws UnknownClassIdException , IOException { int key ; if ( ( key = in . readInt ( ) ) != SerializationConstants . TRANSACTION_CHANGES_LOG ) { throw new UnknownClassIdException ( "There is unexpected class [" + key + "]" ) ; } TransactionChangesLog log = new Trans...
Read and set TransactionChangesLog data .
15,531
public void setRelativePath ( QPath relPath ) { if ( relPath != null && relPath . isAbsolute ( ) ) { throw new IllegalArgumentException ( "relPath must be relative" ) ; } this . relPath = relPath ; }
Sets the relative path to the property in this relation .
15,532
public long getRepositoryDataSizeDirectly ( ) throws QuotaManagerException { long size = 0 ; for ( WorkspaceQuotaManager wQuotaManager : wsQuotaManagers . values ( ) ) { size += wQuotaManager . getWorkspaceDataSizeDirectly ( ) ; } return size ; }
Returns repository data size by summing size of all workspaces .
15,533
private EditableValueData createEditableCopy ( ValueData oldValue ) throws RepositoryException , IllegalStateException , IOException { if ( oldValue . isByteArray ( ) ) { byte [ ] oldBytes = oldValue . getAsByteArray ( ) ; byte [ ] newBytes = new byte [ oldBytes . length ] ; System . arraycopy ( oldBytes , 0 , newBytes...
Create editable ValueData copy .
15,534
private static String getRepoWS ( String [ ] args , int curArg ) { if ( curArg == args . length ) { System . out . println ( INCORRECT_PARAM + "There is no path to workspace parameter." ) ; return null ; } String repWS = args [ curArg ] ; repWS = repWS . replaceAll ( "\\\\" , "/" ) ; if ( ! repWS . matches ( "[/][^/]+"...
Get parameter from argument list check it and return as valid path to repository and workspace .
15,535
protected int getStartValue ( Connection con ) { Statement stmt = null ; ResultSet trs = null ; try { String query ; String tableItem = DBInitializerHelper . getItemTableName ( containerConfig ) ; if ( JDBCUtils . tableExists ( tableItem , con ) ) { query = "select max(N_ORDER_NUM) from " + tableItem ; } else { return ...
Init Start value for sequence .
15,536
public Query like ( int docNum ) throws IOException { if ( fieldNames == null ) { setFieldNames ( ) ; } return createQuery ( retrieveTerms ( docNum ) ) ; }
Return a query that will return docs like the passed lucene document ID .
15,537
public Query like ( File f ) throws IOException { if ( fieldNames == null ) { setFieldNames ( ) ; } return like ( new FileReader ( f ) ) ; }
Return a query that will return docs like the passed file .
15,538
public Query like ( URL u ) throws IOException { return like ( new InputStreamReader ( u . openConnection ( ) . getInputStream ( ) ) ) ; }
Return a query that will return docs like the passed URL .
15,539
public Query like ( java . io . InputStream is ) throws IOException { return like ( new InputStreamReader ( is ) ) ; }
Return a query that will return docs like the passed stream .
15,540
public String describeParams ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "\t" + "maxQueryTerms : " + maxQueryTerms + "\n" ) ; sb . append ( "\t" + "minWordLen : " + minWordLen + "\n" ) ; sb . append ( "\t" + "maxWordLen : " + maxWordLen + "\n" ) ; sb . append ( "\t" + "fieldNames : " ) ;...
Describe the parameters that control how the more like this query is formed .
15,541
public PriorityQueue < Object [ ] > retrieveTerms ( int docNum ) throws IOException { Map < String , Int > termFreqMap = new HashMap < String , Int > ( ) ; for ( int i = 0 ; i < fieldNames . length ; i ++ ) { String fieldName = fieldNames [ i ] ; TermFreqVector vector = ir . getTermFreqVector ( docNum , fieldName ) ; i...
Find words for a more - like - this query former .
15,542
private void addTermFrequencies ( Map < String , Int > termFreqMap , TermFreqVector vector ) { String [ ] terms = vector . getTerms ( ) ; int [ ] freqs = vector . getTermFrequencies ( ) ; for ( int j = 0 ; j < terms . length ; j ++ ) { String term = terms [ j ] ; if ( isNoiseWord ( term ) ) { continue ; } Int cnt = ter...
Adds terms and frequencies found in vector into the Map termFreqMap
15,543
private void addTermFrequencies ( Reader r , Map < String , Int > termFreqMap , String fieldName ) throws IOException { TokenStream ts = analyzer . tokenStream ( fieldName , r ) ; int tokenCount = 0 ; while ( ts . incrementToken ( ) ) { CharTermAttribute term = ts . getAttribute ( CharTermAttribute . class ) ; String w...
Adds term frequencies found by tokenizing text from reader into the Map words
15,544
private boolean isNoiseWord ( String term ) { int len = term . length ( ) ; if ( minWordLen > 0 && len < minWordLen ) { return true ; } if ( maxWordLen > 0 && len > maxWordLen ) { return true ; } if ( stopWords != null && stopWords . contains ( term ) ) { return true ; } return false ; }
determines if the passed term is likely to be of interest in more like comparisons
15,545
protected String handleAddException ( IOException e , ItemData item ) throws RepositoryException , InvalidItemStateException { StringBuilder message = new StringBuilder ( "[" ) ; message . append ( containerName ) . append ( "] ADD " ) . append ( item . isNode ( ) ? "NODE. " : "PROPERTY. " ) ; String errMessage = e . g...
Handle Add IOException .
15,546
public String handleDeleteException ( SQLException e , ItemData item ) throws RepositoryException , InvalidItemStateException { StringBuilder message = new StringBuilder ( "[" ) ; message . append ( containerName ) . append ( "] DELETE " ) . append ( item . isNode ( ) ? "NODE. " : "PROPERTY. " ) ; String errMessage = e...
Handle delete Exceptions .
15,547
public String handleUpdateException ( SQLException e , ItemData item ) throws RepositoryException , InvalidItemStateException { StringBuilder message = new StringBuilder ( "[" ) ; message . append ( containerName ) . append ( "] EDIT " ) . append ( item . isNode ( ) ? "NODE. " : "PROPERTY. " ) ; String errMessage = e ....
Handle update Exceptions .
15,548
public PropertyDataReader forProperty ( InternalQName name , int type ) { if ( nodePropertyReader == null ) { nodePropertyReader = new PropertyDataReader ( parent , dataManager ) ; } return nodePropertyReader . forProperty ( name , type ) ; }
Read node properties
15,549
public List < ChangesContainer > getSortedList ( ) { List < ChangesContainer > changesContainers = new ArrayList < ChangesContainer > ( changes ) ; Collections . sort ( changesContainers ) ; return changesContainers ; }
Builds single list of modifications from internal structures and sorts it .
15,550
private void createMembership ( Session session , MembershipImpl membership , boolean broadcast ) throws InvalidNameException , Exception { Node userNode ; try { userNode = utils . getUserNode ( session , membership . getUserName ( ) ) ; } catch ( PathNotFoundException e ) { throw new InvalidNameException ( "The user "...
Persist new membership .
15,551
private MembershipByUserGroupTypeWrapper findMembership ( Session session , String id ) throws Exception { IdComponents ids ; try { ids = utils . splitId ( id ) ; } catch ( IndexOutOfBoundsException e ) { throw new ItemNotFoundException ( "Can not find membership by id=" + id , e ) ; } Node groupNode = session . getNod...
Use this method to search for an membership record with the given id .
15,552
private Membership findMembershipByUserGroupAndType ( Session session , String userName , String groupId , String type ) throws Exception { MembershipImpl membership = getFromCache ( userName , groupId , type ) ; if ( membership != null ) { return membership ; } try { Node groupNode = utils . getGroupNode ( session , g...
Use this method to search for a specific membership type of an user in a group .
15,553
private Collection < Membership > findMembershipsByGroup ( Session session , Group group ) throws Exception { Node groupNode ; NodeIterator refUsers ; try { groupNode = utils . getGroupNode ( session , group ) ; refUsers = groupNode . getNode ( JCROrganizationServiceImpl . JOS_MEMBERSHIP ) . getNodes ( ) ; } catch ( Pa...
Use this method to find all the membership in a group .
15,554
private MembershipsByUserWrapper findMembershipsByUser ( Session session , String userName ) throws Exception { Node userNode ; try { userNode = utils . getUserNode ( session , userName ) ; } catch ( PathNotFoundException e ) { return new MembershipsByUserWrapper ( new ArrayList < Membership > ( ) , new ArrayList < Nod...
Use this method to find all the memberships of an user in any group .
15,555
void migrateMemberships ( Node oldUserNode ) throws Exception { Session session = oldUserNode . getSession ( ) ; NodeIterator iterator = ( ( ExtendedNode ) oldUserNode ) . getNodesLazily ( ) ; while ( iterator . hasNext ( ) ) { Node oldMembershipNode = iterator . nextNode ( ) ; if ( oldMembershipNode . isNodeType ( Mig...
Migrates user memberships from old storage into new .
15,556
private Membership removeMembership ( Session session , String id , boolean broadcast ) throws Exception { MembershipByUserGroupTypeWrapper mWrapper ; try { mWrapper = findMembership ( session , id ) ; } catch ( ItemNotFoundException e ) { return null ; } catch ( PathNotFoundException e ) { return null ; } if ( broadca...
Remove memberships entity by identifier .
15,557
void removeMembership ( Node refUserNode , Node refTypeNode ) throws Exception { refTypeNode . remove ( ) ; if ( ! refUserNode . hasNodes ( ) ) { refUserNode . remove ( ) ; } }
Remove membership record .
15,558
private Collection < Membership > removeMembershipByUser ( Session session , String userName , boolean broadcast ) throws Exception { MembershipsByUserWrapper mWrapper = findMembershipsByUser ( session , userName ) ; if ( broadcast ) { for ( Membership m : mWrapper . memberships ) { preDelete ( m ) ; } } for ( Node ref...
Remove memberships entities related to current user .
15,559
private MembershipImpl getFromCache ( String userName , String groupId , String type ) { return ( MembershipImpl ) cache . get ( cache . getMembershipKey ( userName , groupId , type ) , CacheType . MEMBERSHIP ) ; }
Gets membership entity from cache .
15,560
private void removeFromCache ( Membership membership ) { cache . remove ( cache . getMembershipKey ( membership ) , CacheType . MEMBERSHIP ) ; }
Removes membership entities from cache .
15,561
private void putInCache ( MembershipImpl membership ) { cache . put ( cache . getMembershipKey ( membership ) , membership , CacheType . MEMBERSHIP ) ; }
Adds membership entity into cache .
15,562
private void preSave ( Membership membership , boolean isNew ) throws Exception { for ( MembershipEventListener listener : listeners ) { listener . preSave ( membership , isNew ) ; } }
Notifying listeners before membership creation .
15,563
private void postSave ( Membership membership , boolean isNew ) throws Exception { for ( MembershipEventListener listener : listeners ) { listener . postSave ( membership , isNew ) ; } }
Notifying listeners after membership creation .
15,564
private void preDelete ( Membership membership ) throws Exception { for ( MembershipEventListener listener : listeners ) { listener . preDelete ( membership ) ; } }
Notifying listeners before membership deletion .
15,565
private void postDelete ( Membership membership ) throws Exception { for ( MembershipEventListener listener : listeners ) { listener . postDelete ( membership ) ; } }
Notifying listeners after membership deletion .
15,566
protected Node createNode ( final Node parentNode , final String nodeName , final String nodeType , final List < String > mixinTypes , final Map < String , String [ ] > permissions , final boolean isLeaf , final boolean callSave ) throws RepositoryException { boolean useParameters = ! useParametersOnLeafOnly ( ) || ( u...
Creates the node of the given node type with the given node name directly under the given parent node using the given mixin types and permissions
15,567
public NodeTypeIterator getMixinNodeTypes ( ) throws RepositoryException { List < NodeTypeData > allNodeTypes = typesManager . getAllNodeTypes ( ) ; Collections . sort ( allNodeTypes , new NodeTypeDataComparator ( ) ) ; EntityCollection ec = new EntityCollection ( ) ; for ( NodeTypeData nodeTypeData : allNodeTypes ) { ...
Returns an iterator over all available mixin node types .
15,568
public NodeTypeIterator getPrimaryNodeTypes ( ) throws RepositoryException { EntityCollection ec = new EntityCollection ( ) ; NodeTypeIterator allTypes = getAllNodeTypes ( ) ; while ( allTypes . hasNext ( ) ) { NodeType type = allTypes . nextNodeType ( ) ; if ( ! type . isMixin ( ) ) { ec . add ( type ) ; } } return ec...
Returns an iterator over all available primary node types .
15,569
public final Map < String , Set < HierarchicalProperty > > getPropStats ( ) throws RepositoryException { String statname = WebDavConst . getStatusDescription ( HTTPStatus . OK ) ; if ( propNames == null ) { propStats . put ( statname , resource . getProperties ( namesOnly ) ) ; } else { if ( propNames . contains ( Prop...
Returns properties statuses .
15,570
public ItemData getItemData ( String identifier , boolean checkChangesLogOnly ) throws RepositoryException { if ( txStarted ( ) ) { ItemState state = transactionLog . getItemState ( identifier ) ; if ( state != null ) { return state . isDeleted ( ) ? null : state . getData ( ) ; } } return ( checkChangesLogOnly ) ? nul...
Return item data by identifier in this transient storage then in storage container .
15,571
void removeLog ( PlainChangesLog log ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "tx removeLog() " + this + ( transactionLog != null ? "\n" + transactionLog . dump ( ) : "[NULL]" ) ) ; } if ( txStarted ( ) ) { transactionLog . removeLog ( log ) ; if ( transactionLog . getSize ( ) == 0 ) { transactionLog = null ...
Re move a given changes log
15,572
public void save ( ItemStateChangesLog changes ) throws RepositoryException { PlainChangesLog statesLog = ( PlainChangesLog ) changes ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "save() " + this + " txStarted: " + txStarted ( ) + "\n====== Changes ======\n" + ( statesLog != null ? "\n" + statesLog . dump ( ) : "[...
Updates the manager with new changes . If transaction is started it will fill manager s changes log else just move changes to workspace storage manager . It saves the changes AS IS - i . e . id DOES NOT care about cloning of this objects etc . Here PlainChangesLog expected .
15,573
protected List < AccessControlEntry > readACLPermisions ( String cid , Map < String , SortedSet < TempPropertyData > > properties ) throws SQLException , IllegalACLException , IOException { List < AccessControlEntry > naPermissions = new ArrayList < AccessControlEntry > ( ) ; Set < TempPropertyData > permValues = prope...
Read ACL Permissions from properties set .
15,574
protected String readACLOwner ( String cid , Map < String , SortedSet < TempPropertyData > > properties ) throws IllegalACLException , IOException { SortedSet < TempPropertyData > ownerValues = properties . get ( Constants . EXO_OWNER . getAsString ( ) ) ; if ( ownerValues != null ) { try { return ValueDataUtil . getSt...
Read ACL owner .
15,575
protected PersistedNodeData loadNodeFromTemporaryNodeData ( TempNodeData tempData , QPath parentPath , AccessControlList parentACL ) throws RepositoryException , SQLException , IOException { return loadNodeRecord ( parentPath , tempData . cname , tempData . cid , tempData . cpid , tempData . cindex , tempData . cversio...
Create NodeData from TempNodeData content .
15,576
protected int getLastOrderNumber ( ) throws RepositoryException { checkIfOpened ( ) ; try { ResultSet count = findLastOrderNumber ( 1 , true ) ; try { if ( count . next ( ) ) { return count . getInt ( 1 ) - 1 ; } else { return - 1 ; } } finally { try { count . close ( ) ; } catch ( SQLException e ) { LOG . error ( "Can...
Gets the last order number from the sequence
15,577
protected void updateSequence ( ) throws RepositoryException { checkIfOpened ( ) ; try { ResultSet count = updateNextOrderNumber ( localMaxOrderNumber ) ; try { if ( ! count . next ( ) ) { throw new RepositoryException ( "Could not update the sequence: " + "the returned value cannot be found" ) ; } } finally { try { co...
Updates the value of the sequence in order to avoid any gap
15,578
protected String escape ( String pattern ) { char [ ] chars = pattern . toCharArray ( ) ; StringBuilder sb = new StringBuilder ( chars . length + 1 ) ; for ( int i = 0 ; i < chars . length ; i ++ ) { switch ( chars [ i ] ) { case '\'' : sb . append ( getSingleQuoteEscapeSymbol ( ) ) ; default : sb . append ( chars [ i ...
Escape all the single quote found
15,579
protected void appendPattern ( StringBuilder sb , QPathEntry entry , boolean indexConstraint ) { String pattern = entry . getAsString ( false ) ; sb . append ( "(I.NAME" ) ; if ( pattern . contains ( "*" ) ) { sb . append ( " LIKE '" ) ; sb . append ( escapeSpecialChars ( pattern ) ) ; sb . append ( "' ESCAPE '" ) ; sb...
Append pattern expression . Appends String I . NAME LIKE escaped pattern ESCAPE escapeString or I . NAME = pattern to String builder sb .
15,580
public void remove ( ) throws RepositoryException { NodeData vhnode = ( NodeData ) dataManager . getItemData ( vhID ) ; if ( vhnode == null ) { ItemState vhState = null ; List < ItemState > allStates = transientChangesLog . getAllStates ( ) ; for ( int i = allStates . size ( ) - 1 ; i >= 0 ; i -- ) { ItemState state = ...
Remove history .
15,581
private LocalWorkspaceDataManagerStub getWorkspaceDataManager ( ) { if ( workspaceDataManager == null ) { synchronized ( this ) { if ( workspaceDataManager == null ) { LocalWorkspaceDataManagerStub workspaceDataManager = ( LocalWorkspaceDataManagerStub ) container . getComponentInstanceOfType ( LocalWorkspaceDataManage...
Lazily gets the LocalWorkspaceDataManagerStub from the eXo container . This is required to prevent cyclic dependency
15,582
public boolean isGlobalTxActive ( ) { TransactionContext ctx ; try { return ( ctx = contexts . get ( ) ) != null && ctx . getXidContext ( ) != null && tm . getStatus ( ) != Status . STATUS_NO_TRANSACTION ; } catch ( SystemException e ) { log . warn ( "Could not check if a global Tx has been started" , e ) ; } return fa...
Indicates whether a global tx is active or not
15,583
public void putSharedObject ( String key , Object value ) { TransactionContext ctx = contexts . get ( ) ; if ( ctx == null ) { throw new IllegalStateException ( "There is no active transaction context" ) ; } XidContext xidCtx = ctx . getXidContext ( ) ; if ( xidCtx == null ) { throw new IllegalStateException ( "There i...
Registers an object to be shared within the XidContext
15,584
public < T > T getSharedObject ( String key ) { TransactionContext ctx = contexts . get ( ) ; if ( ctx == null ) { throw new IllegalStateException ( "There is no active transaction context" ) ; } XidContext xidCtx = ctx . getXidContext ( ) ; if ( xidCtx == null ) { throw new IllegalStateException ( "There is no active ...
Gives the shared object corresponding to the given key
15,585
public boolean canEnrollChangeToGlobalTx ( final SessionImpl session , final PlainChangesLog changes ) { try { int status ; if ( tm != null && ( status = tm . getStatus ( ) ) != Status . STATUS_NO_TRANSACTION ) { if ( status != Status . STATUS_ACTIVE && status != Status . STATUS_PREPARING ) { throw new IllegalStateExce...
Checks if a global Tx has been started if so the session and its change will be dynamically enrolled
15,586
public void addListener ( TransactionableResourceManagerListener listener ) { TransactionContext ctx = contexts . get ( ) ; if ( ctx == null ) { throw new IllegalStateException ( "There is no active transaction context" ) ; } XidContext xidCtx = ctx . getXidContext ( ) ; if ( xidCtx == null ) { throw new IllegalStateEx...
Add a new listener to register to the current tx
15,587
private void add ( SessionImpl session , PlainChangesLog changes ) throws SystemException , IllegalStateException , RollbackException { Transaction tx = tm . getTransaction ( ) ; if ( tx == null ) { return ; } TransactionContext ctx = getOrCreateTransactionContext ( ) ; ctx . registerTransaction ( tx ) ; ctx . add ( se...
Add session to the transaction group .
15,588
private void abort ( List < TransactionableResourceManagerListener > listeners ) throws XAException { boolean exception = false ; for ( int i = 0 , length = listeners . size ( ) ; i < length ; i ++ ) { TransactionableResourceManagerListener listener = listeners . get ( i ) ; try { listener . onAbort ( ) ; } catch ( Exc...
Call the method onAbort on all the given listeners
15,589
private void setRollbackOnly ( ) { try { tm . getTransaction ( ) . setRollbackOnly ( ) ; } catch ( IllegalStateException e ) { log . warn ( "Could not set the status of the tx to 'rollback-only'" , e ) ; } catch ( SystemException e ) { log . warn ( "Could not set the status of the tx to 'rollback-only'" , e ) ; } }
Change the status of the tx to rollback - only
15,590
private void checkSameNameSibling ( NodeData node , WorkspaceStorageConnection con , final Set < QPath > addedNodes ) throws RepositoryException { if ( node . getQPath ( ) . getIndex ( ) > 1 ) { final QPathEntry [ ] path = node . getQPath ( ) . getEntries ( ) ; final QPathEntry [ ] siblingPath = new QPathEntry [ path ....
Check if given node path contains index higher 1 and if yes if same - name sibling exists in persistence or in current changes log .
15,591
private void checkPersistedSNS ( NodeData node , WorkspaceStorageConnection acon ) throws RepositoryException { NodeData parent = ( NodeData ) acon . getItemData ( node . getParentIdentifier ( ) ) ; QPathEntry myName = node . getQPath ( ) . getEntries ( ) [ node . getQPath ( ) . getEntries ( ) . length - 1 ] ; ItemData...
Check if same - name sibling exists in persistence .
15,592
protected void doDelete ( final ItemData item , final WorkspaceStorageConnection con , ChangedSizeHandler sizeHandler ) throws RepositoryException , InvalidItemStateException { if ( item . isNode ( ) ) { con . delete ( ( NodeData ) item ) ; } else { con . delete ( ( PropertyData ) item , sizeHandler ) ; } }
Performs actual item data deleting .
15,593
protected void doUpdate ( final ItemData item , final WorkspaceStorageConnection con , ChangedSizeHandler sizeHandler ) throws RepositoryException , InvalidItemStateException { if ( item . isNode ( ) ) { con . update ( ( NodeData ) item ) ; } else { con . update ( ( PropertyData ) item , sizeHandler ) ; } }
Performs actual item data updating .
15,594
protected void doAdd ( final ItemData item , final WorkspaceStorageConnection con , final Set < QPath > addedNodes , ChangedSizeHandler sizeHandler ) throws RepositoryException , InvalidItemStateException { if ( item . isNode ( ) ) { final NodeData node = ( NodeData ) item ; checkSameNameSibling ( node , con , addedNod...
Performs actual item data adding .
15,595
protected void doRename ( final ItemData item , final WorkspaceStorageConnection con , final Set < QPath > addedNodes ) throws RepositoryException , InvalidItemStateException { final NodeData node = ( NodeData ) item ; checkSameNameSibling ( node , con , addedNodes ) ; addedNodes . add ( node . getQPath ( ) ) ; con . r...
Perform node rename .
15,596
protected void notifySaveItems ( final ItemStateChangesLog changesLog , boolean isListenerTXAware ) { for ( MandatoryItemsPersistenceListener mlistener : mandatoryListeners ) { if ( mlistener . isTXAware ( ) == isListenerTXAware ) { mlistener . onSaveItems ( changesLog ) ; } } for ( ExtendedMandatoryItemsPersistenceLis...
Notify listeners about current changes log persistent state . Listeners notified according to is listener transaction aware .
15,597
public Set < InternalQName > getSubtypes ( final InternalQName nodeTypeName ) { Set < InternalQName > resultSet = new HashSet < InternalQName > ( ) ; for ( InternalQName ntName : nodeTypes . keySet ( ) ) { if ( getSupertypes ( ntName ) . contains ( nodeTypeName ) ) { resultSet . add ( ntName ) ; } } return resultSet ; ...
Returns all subtypes of this node type in the node type inheritance hierarchy .
15,598
public AccessControlList read ( ObjectReader in ) throws UnknownClassIdException , IOException { int key ; if ( ( key = in . readInt ( ) ) != SerializationConstants . ACCESS_CONTROL_LIST ) { throw new UnknownClassIdException ( "There is unexpected class [" + key + "]" ) ; } String owner ; if ( in . readByte ( ) == Seri...
Read and set AccessControlList data .
15,599
public long getWorkspaceChangedSize ( ) { long wsDelta = 0 ; Iterator < ChangesItem > changes = iterator ( ) ; while ( changes . hasNext ( ) ) { wsDelta += changes . next ( ) . getWorkspaceChangedSize ( ) ; } return wsDelta ; }
Returns workspace changed size accumulated during some period .