idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
15,400
protected R execute ( A ... arg ) throws E { if ( arg == null || arg . length == 0 ) { return execute ( ( A ) null ) ; } return execute ( arg [ 0 ] ) ; }
Executes the action
44
4
15,401
public NodeRepresentation getNodeRepresentation ( Node node , String mediaTypeHint ) throws RepositoryException { NodeRepresentationFactory factory = factory ( node ) ; if ( factory != null ) return factory . createNodeRepresentation ( node , mediaTypeHint ) ; else return new DocumentViewNodeRepresentation ( node ) ; }
Get NodeRepresentation for given node . String mediaTypeHint can be used as external information for representation . By default node will be represented as doc - view .
69
33
15,402
public void spoolDone ( ) { final CountDownLatch sl = this . spoolLatch . get ( ) ; this . spoolLatch . set ( null ) ; sl . countDown ( ) ; }
Mark the file ready for read .
46
7
15,403
public ItemData getItemData ( NodeData parent , QPathEntry [ ] relPathEntries , ItemType itemType ) throws RepositoryException { ItemData item = parent ; for ( int i = 0 ; i < relPathEntries . length ; i ++ ) { if ( i == relPathEntries . length - 1 ) { item = getItemData ( parent , relPathEntries [ i ] , itemType ) ; }...
Return item data by parent NodeDada and relPathEntries If relpath is JCRPath . THIS_RELPATH = . it return itself
188
30
15,404
public ItemData getItemData ( String identifier , boolean checkChangesLogOnly ) throws RepositoryException { ItemData data = null ; // 1. Try in transient changes ItemState state = changesLog . getItemState ( identifier ) ; if ( state == null ) { // 2. Try from txdatamanager data = transactionableManager . getItemData ...
Return item data by identifier in this transient storage then in workspace container .
121
14
15,405
public ItemImpl getItem ( NodeData parent , QPathEntry name , boolean pool , ItemType itemType ) throws RepositoryException { return getItem ( parent , name , pool , itemType , true ) ; }
Return Item by parent NodeDada and the name of searched item .
45
14
15,406
public ItemImpl getItem ( NodeData parent , QPathEntry name , boolean pool , ItemType itemType , boolean apiRead , boolean createNullItemData ) throws RepositoryException { long start = 0 ; if ( LOG . isDebugEnabled ( ) ) { start = System . currentTimeMillis ( ) ; LOG . debug ( "getItem(" + parent . getQPath ( ) . getA...
For internal use . Return Item by parent NodeDada and the name of searched item .
250
18
15,407
public ItemImpl getItem ( NodeData parent , QPathEntry [ ] relPath , boolean pool , ItemType itemType ) throws RepositoryException { long start = 0 ; if ( LOG . isDebugEnabled ( ) ) { start = System . currentTimeMillis ( ) ; StringBuilder debugPath = new StringBuilder ( ) ; for ( QPathEntry rp : relPath ) { debugPath ....
Return Item by parent NodeDada and array of QPathEntry which represent a relative path to the searched item
302
22
15,408
public ItemImpl getItem ( QPath path , boolean pool ) throws RepositoryException { long start = 0 ; if ( LOG . isDebugEnabled ( ) ) { start = System . currentTimeMillis ( ) ; LOG . debug ( "getItem(" + path . getAsString ( ) + " ) >>>>>" ) ; } ItemImpl item = null ; try { return item = readItem ( getItemData ( path ) ,...
Return item by absolute path in this transient storage then in workspace container .
179
14
15,409
protected ItemImpl readItem ( ItemData itemData , boolean pool ) throws RepositoryException { return readItem ( itemData , null , pool , true ) ; }
Read ItemImpl of given ItemData . Will call postRead Action and check permissions .
34
17
15,410
protected ItemImpl readItem ( ItemData itemData , NodeData parent , boolean pool , boolean apiRead ) throws RepositoryException { if ( ! apiRead ) { // Need privileges SecurityManager security = System . getSecurityManager ( ) ; if ( security != null ) { security . checkPermission ( JCRRuntimePermissions . INVOKE_INTER...
Create or reload pooled ItemImpl with the given ItemData .
247
12
15,411
public ItemImpl getItemByIdentifier ( String identifier , boolean pool ) throws RepositoryException { return getItemByIdentifier ( identifier , pool , true ) ; }
Return item by identifier in this transient storage then in workspace container .
35
13
15,412
public ItemImpl getItemByIdentifier ( String identifier , boolean pool , boolean apiRead ) throws RepositoryException { long start = 0 ; if ( LOG . isDebugEnabled ( ) ) { start = System . currentTimeMillis ( ) ; LOG . debug ( "getItemByIdentifier(" + identifier + " ) >>>>>" ) ; } ItemImpl item = null ; try { return ite...
For internal use required privileges . Return item by identifier in this transient storage then in workspace container .
184
19
15,413
public AccessControlList getACL ( QPath path ) throws RepositoryException { long start = 0 ; if ( LOG . isDebugEnabled ( ) ) { start = System . currentTimeMillis ( ) ; LOG . debug ( "getACL(" + path . getAsString ( ) + " ) >>>>>" ) ; } try { NodeData parent = ( NodeData ) getItemData ( Constants . ROOT_UUID ) ; if ( pa...
Return the ACL of the location . A session pending changes will be searched too . Item path will be traversed from the root node to a last existing item .
426
32
15,414
protected List < ItemState > reindexSameNameSiblings ( NodeData cause , ItemDataConsumer dataManager ) throws RepositoryException { List < ItemState > changes = new ArrayList < ItemState > ( ) ; NodeData parentNodeData = ( NodeData ) dataManager . getItemData ( cause . getParentIdentifier ( ) ) ; NodeData nextSibling =...
Reindex same - name siblings of the node Reindex is actual for remove move only . If node is added then its index always is a last in list of childs .
573
35
15,415
public List < PropertyData > getReferencesData ( String identifier , boolean skipVersionStorage ) throws RepositoryException { List < PropertyData > persisted = transactionableManager . getReferencesData ( identifier , skipVersionStorage ) ; List < PropertyData > sessionTransient = new ArrayList < PropertyData > ( ) ; ...
Returns all REFERENCE properties that refer to this node .
89
12
15,416
private void validate ( QPath path ) throws RepositoryException , AccessDeniedException , ReferentialIntegrityException { List < ItemState > changes = changesLog . getAllStates ( ) ; for ( ItemState itemState : changes ) { if ( itemState . isInternallyCreated ( ) ) { // skip internally created if ( itemState . isMixinC...
Validate all user created changes saves like access permeations mandatory items value constraint .
311
16
15,417
private void validateAccessPermissions ( ItemState changedItem ) throws RepositoryException , AccessDeniedException { if ( changedItem . isAddedAutoCreatedNodes ( ) ) { validateAddNodePermission ( changedItem ) ; } else if ( changedItem . isDeleted ( ) ) { validateRemoveAccessPermission ( changedItem ) ; } else if ( ch...
Validate ItemState for access permeations
450
8
15,418
private void validateMandatoryItem ( ItemState changedItem ) throws ConstraintViolationException , AccessDeniedException { if ( changedItem . getData ( ) . isNode ( ) && ( changedItem . isAdded ( ) || changedItem . isMixinChanged ( ) ) && ! changesLog . getItemState ( changedItem . getData ( ) . getQPath ( ) ) . isDele...
Validate ItemState which represents the add node for it s all mandatory items
231
15
15,419
void rollback ( ItemData item ) throws InvalidItemStateException , RepositoryException { // remove from changes log (Session pending changes) PlainChangesLog slog = changesLog . pushLog ( item . getQPath ( ) ) ; SessionChangesLog changes = new SessionChangesLog ( slog . getAllStates ( ) , session ) ; for ( Iterator < I...
Removes all pending changes of this item
446
8
15,420
protected List < ? extends ItemData > mergeList ( ItemData rootData , DataManager dataManager , boolean deep , int action ) throws RepositoryException { // 1 get all transient descendants List < ItemState > transientDescendants = new ArrayList < ItemState > ( ) ; traverseTransientDescendants ( rootData , action , trans...
Merge a list of nodes and properties of root data . NOTE . Properties in the list will have empty value data . I . e . for operations not changes properties content . USED FOR DELETE .
363
42
15,421
private void traverseStoredDescendants ( ItemData parent , DataManager dataManager , int action , Map < String , ItemData > ret , boolean listOnly , Collection < ItemState > transientDescendants ) throws RepositoryException { if ( parent . isNode ( ) && ! isNew ( parent . getIdentifier ( ) ) ) { if ( action != MERGE_PR...
Calculate all stored descendants for the given parent node
566
11
15,422
private List < ? extends ItemData > getStoredDescendants ( ItemData parent , DataManager dataManager , int action ) throws RepositoryException { if ( parent . isNode ( ) ) { List < ItemData > childItems = null ; List < NodeData > childNodes = dataManager . getChildNodesData ( ( NodeData ) parent ) ; if ( action != MERG...
Get all stored descendants for the given parent node
178
9
15,423
private void traverseTransientDescendants ( ItemData parent , int action , List < ItemState > ret ) throws RepositoryException { if ( parent . isNode ( ) ) { if ( action != MERGE_PROPS ) { Collection < ItemState > childNodes = changesLog . getLastChildrenStates ( parent , true ) ; for ( ItemState childNode : childNodes...
Calculate all transient descendants for the given parent node
150
11
15,424
private void reloadDescendants ( QPath parentOld , QPath parent ) throws RepositoryException { List < ItemImpl > items = itemsPool . getDescendats ( parentOld ) ; for ( ItemImpl item : items ) { ItemData oldItemData = item . getData ( ) ; ItemData newItemData = updatePath ( parentOld , parent , oldItemData ) ; ItemImpl...
Reload item s descendants in item reference pool
116
9
15,425
private ItemData updatePathIfNeeded ( ItemData data ) throws IllegalPathException { if ( data == null || changesLog . getAllPathsChanged ( ) == null ) return data ; List < ItemState > states = changesLog . getAllPathsChanged ( ) ; for ( int i = 0 , length = states . size ( ) ; i < length ; i ++ ) { ItemState state = st...
Updates the path if needed and gives the updated item data if an update was needed or the provided item data otherwise
152
23
15,426
private ItemData updatePath ( QPath parentOld , QPath parent , ItemData oldItemData ) throws IllegalPathException { int relativeDegree = oldItemData . getQPath ( ) . getDepth ( ) - parentOld . getDepth ( ) ; QPath newQPath = QPath . makeChildPath ( parent , oldItemData . getQPath ( ) . getRelPath ( relativeDegree ) ) ;...
Updates the path of the item data and gives the updated objects
313
13
15,427
private static Statistics getStatistics ( Class < ? > target , String signature ) { initIfNeeded ( ) ; Statistics statistics = MAPPING . get ( signature ) ; if ( statistics == null ) { synchronized ( JCRAPIAspect . class ) { Class < ? > interfaceClass = findInterface ( target ) ; if ( interfaceClass != null ) { Map < S...
Gives the corresponding statistics for the given target class and AspectJ signature
256
15
15,428
private static void initIfNeeded ( ) { if ( ! INITIALIZED ) { synchronized ( JCRAPIAspect . class ) { if ( ! INITIALIZED ) { ExoContainer container = ExoContainerContext . getTopContainer ( ) ; JCRAPIAspectConfig config = null ; if ( container != null ) { config = ( JCRAPIAspectConfig ) container . getComponentInstance...
Initializes the aspect if needed
312
6
15,429
public static DBCleaningScripts prepareScripts ( String dialect , WorkspaceEntry wsEntry ) throws DBCleanException { if ( dialect . startsWith ( DialectConstants . DB_DIALECT_MYSQL ) ) { return new MySQLCleaningScipts ( dialect , wsEntry ) ; } else if ( dialect . startsWith ( DialectConstants . DB_DIALECT_DB2 ) ) { ret...
Prepare SQL scripts for cleaning workspace data from database .
399
11
15,430
private void triggerRSyncSynchronization ( ) { // Call RSync to retrieve actual index from coordinator if ( modeHandler . getMode ( ) == IndexerIoMode . READ_ONLY ) { EmbeddedCacheManager cacheManager = cache . getCacheManager ( ) ; if ( cacheManager . getCoordinator ( ) instanceof JGroupsAddress && cacheManager . getT...
Call to system RSync binary implementation
468
7
15,431
public static SessionProvider createAnonimProvider ( ) { Identity id = new Identity ( IdentityConstants . ANONIM , new HashSet < MembershipEntry > ( ) ) ; return new SessionProvider ( new ConversationState ( id ) ) ; }
Helper for creating Anonymous session provider .
51
7
15,432
public synchronized Session getSession ( String workspaceName , ManageableRepository repository ) throws LoginException , NoSuchWorkspaceException , RepositoryException { if ( closed ) { throw new IllegalStateException ( "Session provider already closed" ) ; } if ( workspaceName == null ) { throw new IllegalArgumentExc...
Gets the session from an internal cache if a similar session has already been used or creates a new session and puts it into the internal cache .
219
29
15,433
private String key ( ManageableRepository repository , String workspaceName ) { String repositoryName = repository . getConfiguration ( ) . getName ( ) ; return repositoryName + workspaceName ; }
Key generator for sessions cache .
40
6
15,434
public static String extractCommonAncestor ( String pattern , String absPath ) { pattern = normalizePath ( pattern ) ; absPath = normalizePath ( absPath ) ; String [ ] patterEntries = pattern . split ( "/" ) ; String [ ] pathEntries = absPath . split ( "/" ) ; StringBuilder ancestor = new StringBuilder ( ) ; int count ...
Returns common ancestor for paths represented by absolute path and pattern .
190
12
15,435
protected void doUpdateIndex ( Set < String > removedNodes , Set < String > addedNodes , Set < String > parentRemovedNodes , Set < String > parentAddedNodes ) { ChangesHolder changes = searchManager . getChanges ( removedNodes , addedNodes ) ; ChangesHolder parentChanges = parentSearchManager . getChanges ( parentRemov...
Update index .
223
3
15,436
private int forceCloseSession ( String repositoryName , String workspaceName ) throws RepositoryException , RepositoryConfigurationException { ManageableRepository mr = repositoryService . getRepository ( repositoryName ) ; WorkspaceContainerFacade wc = mr . getWorkspaceContainer ( workspaceName ) ; SessionRegistry ses...
Close sessions on specific workspace .
102
6
15,437
public List < String > readList ( ) throws IOException { InputStream in = PrivilegedFileHelper . fileInputStream ( logFile ) ; try { List < String > list = new ArrayList < String > ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; String line ; while ( ( line = reader . readLine ( ) ) ...
Reads the log file .
164
6
15,438
public void addJobEntry ( BackupJob job ) { // jobEntries try { JobEntryInfo info = new JobEntryInfo ( ) ; info . setDate ( Calendar . getInstance ( ) ) ; info . setType ( job . getType ( ) ) ; info . setState ( job . getState ( ) ) ; info . setURL ( job . getStorageURL ( ) ) ; logWriter . write ( info , config ) ; } c...
Adding the the backup job .
162
6
15,439
public Collection < JobEntryInfo > getJobEntryStates ( ) { HashMap < Integer , JobEntryInfo > infos = new HashMap < Integer , JobEntryInfo > ( ) ; for ( JobEntryInfo jobEntry : jobEntries ) { infos . put ( jobEntry . getID ( ) , jobEntry ) ; } return infos . values ( ) ; }
Getting the states for jobs .
79
6
15,440
public Response mkCol ( Session session , String path , String nodeType , List < String > mixinTypes , List < String > tokens ) { Node node ; try { nullResourceLocks . checkLock ( session , path , tokens ) ; node = session . getRootNode ( ) . addNode ( TextUtil . relativizePath ( path ) , nodeType ) ; // We set the new...
Webdav Mkcol method implementation .
396
8
15,441
private void addMixins ( Node node , List < String > mixinTypes ) { for ( int i = 0 ; i < mixinTypes . size ( ) ; i ++ ) { String curMixinType = mixinTypes . get ( i ) ; try { node . addMixin ( curMixinType ) ; } catch ( Exception exc ) { log . error ( "Can't add mixin [" + curMixinType + "]" , exc ) ; } } }
Adds mixins to node .
101
6
15,442
public Response unLock ( Session session , String path , List < String > tokens ) { try { try { Node node = ( Node ) session . getItem ( path ) ; if ( node . isLocked ( ) ) { node . unlock ( ) ; session . save ( ) ; } return Response . status ( HTTPStatus . NO_CONTENT ) . build ( ) ; } catch ( PathNotFoundException exc...
Webdav Unlock method implementation .
261
7
15,443
public static HierarchicalProperty lockDiscovery ( String token , String lockOwner , String timeOut ) { HierarchicalProperty lockDiscovery = new HierarchicalProperty ( new QName ( "DAV:" , "lockdiscovery" ) ) ; HierarchicalProperty activeLock = lockDiscovery . addChild ( new HierarchicalProperty ( new QName ( "DAV:" , ...
Returns the information about lock .
459
6
15,444
protected HierarchicalProperty supportedLock ( ) { HierarchicalProperty supportedLock = new HierarchicalProperty ( new QName ( "DAV:" , "supportedlock" ) ) ; HierarchicalProperty lockEntry = new HierarchicalProperty ( new QName ( "DAV:" , "lockentry" ) ) ; supportedLock . addChild ( lockEntry ) ; HierarchicalProperty l...
The information about supported locks .
218
6
15,445
protected HierarchicalProperty supportedMethodSet ( ) { HierarchicalProperty supportedMethodProp = new HierarchicalProperty ( SUPPORTEDMETHODSET ) ; supportedMethodProp . addChild ( new HierarchicalProperty ( new QName ( "DAV:" , "supported-method" ) ) ) . setAttribute ( "name" , "PROPFIND" ) ; supportedMethodProp . ad...
The information about supported methods .
792
6
15,446
private void updateVersion ( Node fileNode , InputStream inputStream , String autoVersion , List < String > mixins ) throws RepositoryException { if ( ! fileNode . isCheckedOut ( ) ) { fileNode . checkout ( ) ; fileNode . getSession ( ) . save ( ) ; } if ( CHECKOUT . equals ( autoVersion ) ) { updateContent ( fileNode ...
Updates the content of the versionable file according to auto - version value .
155
16
15,447
void put ( String uuid , CachingIndexReader reader , int n ) { LRUMap cacheSegment = docNumbers [ getSegmentIndex ( uuid . charAt ( 0 ) ) ] ; //UUID key = UUID.fromString(uuid); String key = uuid ; synchronized ( cacheSegment ) { Entry e = ( Entry ) cacheSegment . get ( key ) ; if ( e != null ) { // existing entry // i...
Puts a document number into the cache using a uuid as key . An entry is only overwritten if the according reader is younger than the reader associated with the existing entry .
237
36
15,448
public Value createValue ( JCRName value ) throws RepositoryException { if ( value == null ) return null ; try { return new NameValue ( value . getInternalName ( ) , locationFactory ) ; } catch ( IOException e ) { throw new RepositoryException ( "Cannot create NAME Value from JCRName" , e ) ; } }
Create Value from JCRName .
74
7
15,449
public Value createValue ( JCRPath value ) throws RepositoryException { if ( value == null ) return null ; try { return new PathValue ( value . getInternalPath ( ) , locationFactory ) ; } catch ( IOException e ) { throw new RepositoryException ( "Cannot create PATH Value from JCRPath" , e ) ; } }
Create Value from JCRPath .
74
7
15,450
public Value createValue ( Identifier value ) { if ( value == null ) return null ; try { return new ReferenceValue ( value ) ; } catch ( IOException e ) { LOG . warn ( "Cannot create REFERENCE Value from Identifier " + value , e ) ; return null ; } }
Create Value from Id .
64
5
15,451
public Value loadValue ( ValueData data , int type ) throws RepositoryException { try { switch ( type ) { case PropertyType . STRING : return new StringValue ( data ) ; case PropertyType . BINARY : return new BinaryValue ( data , spoolConfig ) ; case PropertyType . BOOLEAN : return new BooleanValue ( data ) ; case Prop...
Creates new Value object using ValueData
239
8
15,452
protected Connection openConnection ( ) throws SQLException { return SecurityHelper . doPrivilegedSQLExceptionAction ( new PrivilegedExceptionAction < Connection > ( ) { public Connection run ( ) throws SQLException { return ds . getConnection ( ) ; } } ) ; }
Opens connection to database .
62
6
15,453
public String getUrlParams ( ) { StringBuffer osParams = new StringBuffer ( ) ; for ( Iterator i = this . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) i . next ( ) ; if ( entry . getValue ( ) != null ) osParams . append ( "&" + encodeConfig ( entry . getKey ( ) . toString ( ) ...
Generate the url parameter sequence used to pass this configuration to the editor .
132
15
15,454
public String addLock ( Session session , String path ) throws LockException { String repoPath = session . getRepository ( ) . hashCode ( ) + "/" + session . getWorkspace ( ) . getName ( ) + "/" + path ; if ( ! nullResourceLocks . containsKey ( repoPath ) ) { String newLockToken = IdGenerator . generate ( ) ; session ....
Locks the node .
181
5
15,455
public void removeLock ( Session session , String path ) { String repoPath = session . getRepository ( ) . hashCode ( ) + "/" + session . getWorkspace ( ) . getName ( ) + "/" + path ; String token = nullResourceLocks . get ( repoPath ) ; session . removeLockToken ( token ) ; nullResourceLocks . remove ( repoPath ) ; }
Removes lock from the node .
85
7
15,456
public boolean isLocked ( Session session , String path ) { String repoPath = session . getRepository ( ) . hashCode ( ) + "/" + session . getWorkspace ( ) . getName ( ) + "/" + path ; if ( nullResourceLocks . get ( repoPath ) != null ) { return true ; } return false ; }
Checks if the node is locked .
75
8
15,457
public void checkLock ( Session session , String path , List < String > tokens ) throws LockException { String repoPath = session . getRepository ( ) . hashCode ( ) + "/" + session . getWorkspace ( ) . getName ( ) + "/" + path ; String currentToken = nullResourceLocks . get ( repoPath ) ; if ( currentToken == null ) { ...
Checks if the node can be unlocked using current tokens .
132
12
15,458
private Object getObject ( Class cl , byte [ ] data ) throws Exception { JsonHandler jsonHandler = new JsonDefaultHandler ( ) ; JsonParser jsonParser = new JsonParserImpl ( ) ; InputStream inputStream = new ByteArrayInputStream ( data ) ; jsonParser . parse ( inputStream , jsonHandler ) ; JsonValue jsonValue = jsonHand...
Will be created the Object from JSON binary data .
103
10
15,459
public Response propPatch ( Session session , String path , HierarchicalProperty body , List < String > tokens , String baseURI ) { try { lockHolder . checkLock ( session , path , tokens ) ; Node node = ( Node ) session . getItem ( path ) ; WebDavNamespaceContext nsContext = new WebDavNamespaceContext ( session ) ; URI...
Webdav Proppatch method method implementation .
392
10
15,460
public List < HierarchicalProperty > setList ( HierarchicalProperty request ) { HierarchicalProperty set = request . getChild ( new QName ( "DAV:" , "set" ) ) ; HierarchicalProperty prop = set . getChild ( new QName ( "DAV:" , "prop" ) ) ; List < HierarchicalProperty > setList = prop . getChildren ( ) ; return setList ...
List of properties to set .
92
6
15,461
public List < HierarchicalProperty > removeList ( HierarchicalProperty request ) { HierarchicalProperty remove = request . getChild ( new QName ( "DAV:" , "remove" ) ) ; HierarchicalProperty prop = remove . getChild ( new QName ( "DAV:" , "prop" ) ) ; List < HierarchicalProperty > removeList = prop . getChildren ( ) ; ...
List of properties to remove .
92
6
15,462
public Response orderPatch ( Session session , String path , HierarchicalProperty body , String baseURI ) { try { Node node = ( Node ) session . getItem ( path ) ; List < OrderMember > members = getMembers ( body ) ; WebDavNamespaceContext nsContext = new WebDavNamespaceContext ( session ) ; URI uri = new URI ( TextUti...
Webdav OrderPatch method implementation .
293
8
15,463
protected List < OrderMember > getMembers ( HierarchicalProperty body ) { ArrayList < OrderMember > members = new ArrayList < OrderMember > ( ) ; List < HierarchicalProperty > childs = body . getChildren ( ) ; for ( int i = 0 ; i < childs . size ( ) ; i ++ ) { OrderMember member = new OrderMember ( childs . get ( i ) )...
Get oder members .
100
5
15,464
protected boolean doOrder ( Node parentNode , List < OrderMember > members ) { boolean success = true ; for ( int i = 0 ; i < members . size ( ) ; i ++ ) { OrderMember member = members . get ( i ) ; int status = HTTPStatus . OK ; try { parentNode . getSession ( ) . refresh ( false ) ; String positionedNodeName = null ;...
Order members .
563
3
15,465
private InputStream spoolInputStream ( ObjectReader in , long contentLen ) throws IOException { byte [ ] buffer = new byte [ 0 ] ; byte [ ] tmpBuff ; long readLen = 0 ; File sf = null ; OutputStream sfout = null ; try { while ( true ) { int needToRead = contentLen - readLen > 2048 ? 2048 : ( int ) ( contentLen - readLe...
Spool input stream .
402
5
15,466
protected TransientItemData copyItemDataDelete ( final ItemData item ) throws RepositoryException { if ( item == null ) { return null ; } // make a copy if ( item . isNode ( ) ) { final NodeData node = ( NodeData ) item ; // the node ACL can't be are null as ACL manager does care about this final AccessControlList acl ...
Copy ItemData for Delete operation .
305
7
15,467
protected List < ValueData > copyValues ( PropertyData property ) throws RepositoryException { List < ValueData > src = property . getValues ( ) ; List < ValueData > copy = new ArrayList < ValueData > ( src . size ( ) ) ; try { for ( ValueData vd : src ) { copy . add ( ValueDataUtil . createTransientCopy ( vd ) ) ; } }...
Do actual copy of the property ValueDatas .
129
10
15,468
public NodeTypeData build ( ) { if ( nodeDefinitionDataBuilders . size ( ) > 0 ) { childNodeDefinitions = new NodeDefinitionData [ nodeDefinitionDataBuilders . size ( ) ] ; for ( int i = 0 ; i < childNodeDefinitions . length ; i ++ ) { childNodeDefinitions [ i ] = nodeDefinitionDataBuilders . get ( i ) . build ( ) ; } ...
Creates instance of NodeTypeData using parameters stored in this object .
201
14
15,469
public static void createVersion ( Node nodeVersioning ) throws Exception { if ( ! nodeVersioning . isNodeType ( NT_FILE ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Version history is not impact with non-nt:file documents, there'is not any version created." ) ; } return ; } if ( ! nodeVersioning . isNodeType...
Create new version and clear redundant versions
243
7
15,470
private static void removeRedundant ( Node nodeVersioning ) throws Exception { VersionHistory versionHistory = nodeVersioning . getVersionHistory ( ) ; String baseVersion = nodeVersioning . getBaseVersion ( ) . getName ( ) ; String rootVersion = nodeVersioning . getVersionHistory ( ) . getRootVersion ( ) . getName ( ) ...
Remove redundant version - Remove versions has been expired - Remove versions over max allow
437
15
15,471
protected List < PropertyData > getChildProps ( String parentId , boolean withValue ) { return getChildProps . run ( parentId , withValue ) ; }
Internal get child properties .
36
5
15,472
protected ItemData putItem ( ItemData item ) { if ( item . isNode ( ) ) { return putNode ( ( NodeData ) item , ModifyChildOption . MODIFY ) ; } else { return putProperty ( ( PropertyData ) item , ModifyChildOption . MODIFY ) ; } }
Internal put Item .
66
4
15,473
protected ItemData putNode ( NodeData node , ModifyChildOption modifyListsOfChild ) { if ( node . getParentIdentifier ( ) != null ) { if ( modifyListsOfChild == ModifyChildOption . NOT_MODIFY ) { cache . putIfAbsent ( new CacheQPath ( getOwnerId ( ) , node . getParentIdentifier ( ) , node . getQPath ( ) , ItemType . NO...
Internal put Node .
407
4
15,474
protected void putNullItem ( NullItemData item ) { boolean inTransaction = cache . isTransactionActive ( ) ; try { if ( ! inTransaction ) { cache . beginTransaction ( ) ; } cache . setLocal ( true ) ; if ( ! item . getIdentifier ( ) . equals ( NullItemData . NULL_ID ) ) { cache . putIfAbsent ( new CacheId ( getOwnerId ...
Internal put NullNode .
209
5
15,475
protected void updateMixin ( NodeData node ) { NodeData prevData = ( NodeData ) cache . put ( new CacheId ( getOwnerId ( ) , node . getIdentifier ( ) ) , node , true ) ; // prevent update NullNodeData if ( ! ( prevData instanceof NullNodeData ) ) { if ( prevData != null ) { // do update ACL if needed if ( prevData . ge...
Update Node s mixin and ACL .
188
8
15,476
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 .
53
27
15,477
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 ( ) ) { // it is state where name can be changed by rename operat...
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 .
372
33
15,478
private void onCacheEntryUpdated ( ItemData data ) { if ( data == null || data instanceof NullItemData ) { return ; } for ( WorkspaceStorageCacheListener listener : listeners ) { try { listener . onCacheEntryUpdated ( data ) ; } catch ( RuntimeException e ) //NOSONAR { LOG . warn ( "The method onCacheEntryUpdated fails...
Called when a cache entry corresponding to the given node has item updated
96
14
15,479
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 .
441
9
15,480
public File getFile ( String hash ) { // work with digest return new File ( channel . rootDir , channel . makeFilePath ( hash , 0 ) ) ; }
Construct file name of given hash .
35
7
15,481
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 .
56
13
15,482
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 .
248
6
15,483
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 .
159
5
15,484
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 .
114
7
15,485
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 .
76
9
15,486
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 .
180
4
15,487
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 .
73
10
15,488
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 .
334
10
15,489
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 .
209
10
15,490
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 .
75
5
15,491
private void preSave ( User user , boolean isNew ) throws Exception { for ( UserEventListener listener : listeners ) { listener . preSave ( user , isNew ) ; } }
Notifying listeners before user creation .
38
7
15,492
private void postSave ( User user , boolean isNew ) throws Exception { for ( UserEventListener listener : listeners ) { listener . postSave ( user , isNew ) ; } }
Notifying listeners after user creation .
38
7
15,493
private void preDelete ( User user ) throws Exception { for ( UserEventListener listener : listeners ) { listener . preDelete ( user ) ; } }
Notifying listeners before user deletion .
31
7
15,494
private void postDelete ( User user ) throws Exception { for ( UserEventListener listener : listeners ) { listener . postDelete ( user ) ; } }
Notifying listeners after user deletion .
31
7
15,495
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 .
58
8
15,496
private User getFromCache ( String userName ) { return ( User ) cache . get ( userName , CacheType . USER ) ; }
Get user from cache .
30
5
15,497
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 .
58
11
15,498
private void putInCache ( User user ) { cache . put ( user . getUserName ( ) , user , CacheType . USER ) ; }
Put user in cache .
32
5
15,499
public PersistedValueData read ( ObjectReader in , int type ) throws UnknownClassIdException , IOException { File tempDirectory = new File ( SerializationConstants . TEMP_DIR ) ; PrivilegedFileHelper . mkdirs ( tempDirectory ) ; // read id int key ; if ( ( key = in . readInt ( ) ) != SerializationConstants . PERSISTED_...
Read and set PersistedValueData object data .
448
10