idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
34,700
protected void putElement ( Ehcache cache , Element element ) { final Set < CacheEntryTag > tags = this . getTags ( element ) ; // Check if the key is tagged if ( tags != null && ! tags . isEmpty ( ) ) { final String cacheName = cache . getName ( ) ; final Object key = element . getObjectKey ( ) ; final LoadingCache < ...
If the element has a TaggedCacheKey record the tag associations
240
13
34,701
protected void removeElement ( Ehcache cache , Element element ) { final Set < CacheEntryTag > tags = this . getTags ( element ) ; // Check if the key is tagged if ( tags != null && ! tags . isEmpty ( ) ) { final String cacheName = cache . getName ( ) ; final LoadingCache < CacheEntryTag , Set < Object > > cacheKeys = ...
If the element has a TaggedCacheKey remove the tag associations
203
13
34,702
public Evaluator getAttributeEvaluator ( String name , String mode , String value ) throws Exception { return new AttributeEvaluator ( name , mode , value ) ; }
returns an Evaluator unique to the type of attribute being evaluated . subclasses can override this method to return the Evaluator that s appropriate to their implementation .
40
34
34,703
@ Override public synchronized void authenticate ( ) throws PortalSecurityException { if ( this . remoteUser != null ) { // Set the UID for the principal this . myPrincipal . setUID ( this . remoteUser ) ; // Check that the principal UID matches the remote user final String newUid = this . myPrincipal . getUID ( ) ; if...
Verify that remoteUser is not null and set the principal s UID to this value .
235
18
34,704
@ Override public synchronized boolean updateNode ( IUserLayoutNodeDescription node ) throws PortalException { if ( canUpdateNode ( node ) ) { String nodeId = node . getId ( ) ; IUserLayoutNodeDescription oldNode = getNode ( nodeId ) ; if ( oldNode instanceof IUserLayoutChannelDescription ) { IUserLayoutChannelDescript...
Handles pushing changes made to the passed - in node into the user s layout . If the node is an ILF node then the change is recorded via directives in the PLF if such changes are allowed by the owning fragment . If the node is a user owned node then the changes are applied directly to the corresponding node in the PLF ...
311
69
34,705
private void updateFolderNode ( String nodeId , IUserLayoutFolderDescription newFolderDesc , IUserLayoutFolderDescription oldFolderDesc ) throws PortalException { Element ilfNode = ( Element ) getUserLayoutDOM ( ) . getElementById ( nodeId ) ; List < ILayoutProcessingAction > pendingActions = new ArrayList < ILayoutPro...
Compares the new folder description object with the old folder description object to determine what items were changed and if those changes are allowed . Once all changes are verified as being allowed changes then they are pushed into both the ILF and the PLF as appropriate . No changes are made until we determine that...
479
64
34,706
private void updateNodeAttribute ( Element ilfNode , String nodeId , String attName , String newVal , String oldVal , List < ILayoutProcessingAction > pendingActions ) throws PortalException { if ( newVal == null && oldVal != null || newVal != null && oldVal == null || ( newVal != null && oldVal != null && ! newVal . e...
Handles checking for updates to a named attribute verifying such change is allowed and generates an action object to make that change .
483
24
34,707
private Map getPublishedChannelParametersMap ( String channelPublishId ) throws PortalException { try { IPortletDefinitionRegistry registry = PortletDefinitionRegistryLocator . getPortletDefinitionRegistry ( ) ; IPortletDefinition def = registry . getPortletDefinition ( channelPublishId ) ; return def . getParametersAs...
Return a map parameter names to channel parameter objects representing the parameters specified at publish time for the channel with the passed - in publish id .
103
27
34,708
protected boolean canDeleteNode ( IUserLayoutNodeDescription node ) throws PortalException { if ( node == null ) return false ; // todo if isFragmentOwner should probably verify node is part of the // same layout fragment as the fragment owner to insure a misbehaving front-end doesn't // do an improper operation. retur...
Returns true if the node exists in the underlying DOM model and it does not contain a deleteAllowed attribute with a value of false .
83
27
34,709
@ Override public boolean canUpdateNode ( IUserLayoutNodeDescription node ) { if ( node == null ) return false ; return isFragmentOwner || node . isEditAllowed ( ) || node instanceof IUserLayoutChannelDescription ; }
Returns true if we are dealing with a fragment layout or if editing of attributes is allowed or the node is a channel since ad - hoc parameters can always be added .
51
33
34,710
@ Override public String getSubscribeId ( String fname ) { final Document userLayout = this . getUserLayoutDOM ( ) ; return new PortletSubscribeIdResolver ( fname ) . traverseDocument ( userLayout ) ; }
Returns the subscribe ID of a channel having the passed in functional name or null if it can t find such a channel in the layout .
49
27
34,711
public boolean resetLayout ( String loginId ) { boolean resetSuccess = false ; boolean resetCurrentUserLayout = ( null == loginId ) ; if ( resetCurrentUserLayout || ( ! resetCurrentUserLayout && AdminEvaluator . isAdmin ( owner ) ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Reset layout requested for user wit...
Resets the layout of the user with the specified user id if the current user is an administrator or a member of any administrative sub - group . Has no effect if these requirements are not met .
297
39
34,712
private boolean resetLayout ( IPerson person ) { final String userName = person . getUserName ( ) ; if ( PersonFactory . getGuestUsernames ( ) . contains ( userName ) ) { throw new IllegalArgumentException ( "CANNOT RESET LAYOUT FOR A GUEST USER: " + person ) ; } LOG . warn ( "Resetting user layout for: " + userName , ...
Resets the layout of the specified user .
273
9
34,713
protected String getDefaultTabIndex ( HttpServletRequest httpServletRequest ) { final String stylesheetParameter = this . stylesheetUserPreferencesService . getStylesheetParameter ( httpServletRequest , PreferencesScope . STRUCTURE , this . defaultTabParameter ) ; if ( stylesheetParameter != null ) { return stylesheetP...
Get the index of the default tab for the user
186
10
34,714
@ Override public void delete ( IEntityLock lock ) throws LockingException { Map m = getLockCache ( lock . getEntityType ( ) ) ; synchronized ( m ) { m . remove ( getCacheKey ( lock ) ) ; } }
Deletes this IEntityLock from the store .
52
10
34,715
public IEntityLock find ( IEntityLock lock ) throws LockingException { IEntityLock foundLock = null ; Map m = getLockCache ( lock . getEntityType ( ) ) ; foundLock = getLockFromCache ( getCacheKey ( lock ) , m ) ; if ( foundLock != null ) { if ( lock . getLockType ( ) != foundLock . getLockType ( ) || ! lock . getExpir...
Returns this lock if it exists in the store .
121
10
34,716
@ Override public void update ( IEntityLock lock , java . util . Date newExpiration , Integer newLockType ) throws LockingException { if ( find ( lock ) == null ) { throw new LockingException ( "Problem updating " + lock + " : not found in store." ) ; } primAdd ( lock , newExpiration ) ; }
Make sure the store has a reference to the lock and then add the lock to refresh the SmartCache wrapper .
75
22
34,717
private void primAdd ( IEntityLock lock , Date expiration ) throws LockingException { long now = System . currentTimeMillis ( ) ; long willExpire = expiration . getTime ( ) ; long cacheIntervalSecs = ( willExpire - now ) / 1000 ; if ( cacheIntervalSecs > 0 ) { SmartCache sc = ( SmartCache ) getLockCache ( lock . getEnt...
Adds this IEntityLock to the store .
129
9
34,718
public IEntityLock newReadLock ( Class entityType , String entityKey , String owner ) throws LockingException { return lockService . newLock ( entityType , entityKey , IEntityLockService . READ_LOCK , owner ) ; }
Returns a read lock for the entity type entity key and owner .
50
13
34,719
public IEntityLock newWriteLock ( Class entityType , String entityKey , String owner ) throws LockingException { return lockService . newLock ( entityType , entityKey , IEntityLockService . WRITE_LOCK , owner ) ; }
Returns a write lock for the entity type entity key and owner .
50
13
34,720
@ Override public void storeJson ( PortletPreferences prefs , String key , Object data ) throws IOException , ReadOnlyException , ValidatorException { final String configData = mapper . writeValueAsString ( data ) ; prefs . setValue ( key , configData ) ; prefs . store ( ) ; }
Stores a Java object as JSON in a portlet preference
70
12
34,721
@ Override public < E > E getJson ( PortletPreferences prefs , String key , Class < E > type ) throws IOException { final String prefValue = StringUtils . trimToNull ( prefs . getValue ( key , null ) ) ; if ( prefValue == null ) { return null ; } return mapper . readValue ( prefValue , type ) ; }
Read the specified portlet preference and parse it as a JSON string into the specified type . If the preference is null returns null .
83
26
34,722
public List < Preference > getEditableUserAttributes ( IPerson currentUser ) { EntityIdentifier ei = currentUser . getEntityIdentifier ( ) ; IAuthorizationPrincipal ap = AuthorizationServiceFacade . instance ( ) . newPrincipal ( ei . getKey ( ) , ei . getType ( ) ) ; List < Preference > allowedAttributes = new ArrayLis...
Returns the collection of attributes that the specified currentUser can edit .
153
13
34,723
private String fixPortletPath ( HttpServletRequest request , IPortalUrlBuilder urlBuilder ) { String path = urlBuilder . getUrlString ( ) ; String context = request . getContextPath ( ) ; if ( StringUtils . isBlank ( context ) ) { context = "/" ; } if ( ! path . startsWith ( context + "/f/" ) ) { return path . replaceF...
This entire method is a hack! The login portlet URL only seems to load correctly if you pass in the folder name for the guest layout . For the short term allow configuration of the folder name and manually re - write the URL to include the folder if it doesn t already .
107
56
34,724
private void saveLayout ( UserView view , IPerson owner ) throws Exception { IUserProfile profile = new UserProfile ( ) ; profile . setProfileId ( view . getProfileId ( ) ) ; userLayoutStore . setUserLayout ( owner , profile , view . getLayout ( ) , true , false ) ; }
Saves the loaded layout in the database for the user and profile .
67
14
34,725
private void fragmentizeLayout ( UserView view , FragmentDefinition fragment ) { // if fragment not bound to user or layout empty due to error, return if ( view . getUserId ( ) == - 1 || view . getLayout ( ) == null ) { return ; } // Choose what types of content to apply from the fragment Pattern contentPattern = STAND...
Removes unwanted and hidden folders then changes all node ids to their globally safe incorporated version .
507
19
34,726
private void setIdsAndAttribs ( Element parent , String labelBase , String index , String precedence ) { NodeList children = parent . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { if ( children . item ( i ) . getNodeType ( ) == Node . ELEMENT_NODE ) { Element child = ( Element ) children...
Recursive method that passes through a layout tree and changes all ids from the regular format of sXX or nXX to the globally safe incorporated id of form uXlXsXX or uXlXnXX indicating the user id and layout id from which this node came .
235
58
34,727
public boolean isPasswordRequested ( PortletRequest request , PortletWindow plutoPortletWindow ) throws PortletContainerException { // get the list of requested user attributes final HttpServletRequest httpServletRequest = this . portalRequestUtils . getPortletHttpRequest ( request ) ; final IPortletWindow portletWindo...
Determine whether the portlet has expects a password as one of the user attributes .
280
18
34,728
private String getPassword ( ISecurityContext baseContext ) { String password = null ; IOpaqueCredentials oc = baseContext . getOpaqueCredentials ( ) ; if ( oc instanceof NotSoOpaqueCredentials ) { NotSoOpaqueCredentials nsoc = ( NotSoOpaqueCredentials ) oc ; password = nsoc . getCredentials ( ) ; } // If still no pass...
Retrieves the users password by iterating over the user s security contexts and returning the first available cached password .
175
23
34,729
@ Override public void perform ( ) throws PortalException { // push the change into the PLF if ( nodeId . startsWith ( Constants . FRAGMENT_ID_USER_PREFIX ) ) { // we are dealing with an incorporated node, adding will replace // an existing one for the same target node id and name ParameterEditManager . addParmEditDire...
Change the parameter for a channel in both the ILF and PLF using the appropriate mechanisms for incorporated nodes versus owned nodes .
176
25
34,730
static void changeParameterChild ( Element node , String name , String value ) { if ( node != null ) { boolean foundIt = false ; for ( Element parm = ( Element ) node . getFirstChild ( ) ; parm != null ; parm = ( Element ) parm . getNextSibling ( ) ) { Attr att = parm . getAttributeNode ( Constants . ATT_NAME ) ; if ( ...
Look in the passed - in element for a parameter child element whose value is to be changed to the passed - in value .
165
25
34,731
@ Bean ( name = "resourcesElementsProvider" ) public ResourcesElementsProvider getResourcesElementsProvider ( ) { ResourcesElementsProviderImpl rslt = new ResourcesElementsProviderImpl ( ) ; rslt . setResourcesDao ( getResourcesDao ( ) ) ; return rslt ; }
This bean is not an element of the rendering pipeline .
63
11
34,732
protected void checkAttributesMap ( MessageContext context , String basePath , Set < String > swappableAttributes , Map < String , Attribute > attributesToCopy ) { for ( final String attribute : attributesToCopy . keySet ( ) ) { if ( ! swappableAttributes . contains ( attribute ) ) { final MessageBuilder messageBuilder...
Checks the keys in the Map on the model against a Set to ensure there are no values in the Map that aren t also in the Set
157
29
34,733
@ Deprecated @ RequestMapping ( value = "/layoutDoc" , method = RequestMethod . GET ) public ModelAndView getRESTController ( HttpServletRequest request , @ RequestParam ( value = "tab" , required = false ) String tab ) { final IPerson person = personManager . getPerson ( request ) ; List < LayoutPortlet > portlets = n...
A REST call to get a json feed of the current users layout . Intent was to provide a layout document without per - tab information for mobile device rendering .
810
31
34,734
public Set < IPersonAttributesGroupDefinition > getPagsDefinitions ( IPerson person ) { Set < IPersonAttributesGroupDefinition > rslt = new HashSet <> ( ) ; for ( IPersonAttributesGroupDefinition def : pagsGroupDefDao . getPersonAttributesGroupDefinitions ( ) ) { if ( hasPermission ( person , IPermission . VIEW_GROUP_A...
All the definitions filtered by the user s access rights .
155
11
34,735
@ Override public synchronized void authenticate ( ) throws PortalSecurityException { this . isauth = false ; if ( this . myPrincipal . UID != null && this . myOpaqueCredentials . credentialstring != null ) { try { ILocalAccountDao accountStore = LocalAccountDaoLocator . getLocalAccountDao ( ) ; IPortalPasswordService ...
Authenticate user .
458
4
34,736
@ Resource ( name = "portletPropertyToAttributeMappings" ) public void setPropertyMappings ( Map < String , String > propertyMappings ) { this . propertyToAttributeMappings = ImmutableBiMap . copyOf ( propertyMappings ) ; this . attributeToPropertyMappings = this . propertyToAttributeMappings . inverse ( ) ; }
Map of portlet property names to attribute names if the value is null the key will be used for both the property and attribute name
75
26
34,737
@ Resource ( name = "nonNamespacedPortletProperties" ) public void setNonNamespacedProperties ( Set < String > nonNamespacedProperties ) { this . nonNamespacedProperties = ImmutableSet . copyOf ( nonNamespacedProperties ) ; }
Properties that should not be namespaced with the portlet s windowId when stored as request attributes
58
20
34,738
private String getPropertyName ( final String windowIdStr , final String fullAttributeName ) { final String attributeName ; if ( this . nonNamespacedProperties . contains ( fullAttributeName ) ) { attributeName = fullAttributeName ; } else if ( fullAttributeName . startsWith ( windowIdStr ) ) { attributeName = fullAttr...
Convert a request attribute name to a portlet property name
177
12
34,739
public void addParameter ( String paramName , String paramValue ) { this . parameters . add ( new StructureParameter ( paramName , paramValue ) ) ; }
Add a parameter to this LayoutStructure .
33
9
34,740
protected void addFetches ( final Root < StylesheetUserPreferencesImpl > descriptorRoot ) { descriptorRoot . fetch ( StylesheetUserPreferencesImpl_ . layoutAttributes , JoinType . LEFT ) ; descriptorRoot . fetch ( StylesheetUserPreferencesImpl_ . outputProperties , JoinType . LEFT ) ; descriptorRoot . fetch ( Styleshee...
Add the needed fetches to a critera query
91
10
34,741
private void initialize ( ) { String sep ; try { sep = GroupServiceConfiguration . getConfiguration ( ) . getNodeSeparator ( ) ; } catch ( Exception ex ) { sep = DEFAULT_NODE_SEPARATOR ; } groupNodeSeparator = sep ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "RDBMEntityGroupStore.initialize(): Node separator set t...
Get the node separator character from the GroupServiceConfiguration . Default it to IGroupConstants . DEFAULT_NODE_SEPARATOR .
97
30
34,742
@ Override public void delete ( IEntityGroup group ) throws GroupsException { if ( existsInDatabase ( group ) ) { try { primDelete ( group ) ; } catch ( SQLException sqle ) { throw new GroupsException ( "Problem deleting " + group , sqle ) ; } } }
If this entity exists delete it .
64
7
34,743
private boolean existsInDatabase ( IEntityGroup group ) throws GroupsException { IEntityGroup ug = this . find ( group . getLocalKey ( ) ) ; return ug != null ; }
Answer if the IEntityGroup entity exists in the database .
41
12
34,744
public java . util . Iterator findParentGroups ( IEntity ent ) throws GroupsException { String memberKey = ent . getKey ( ) ; Integer type = EntityTypesLocator . getEntityTypes ( ) . getEntityIDFromType ( ent . getLeafType ( ) ) ; return findParentGroupsForEntity ( memberKey , type . intValue ( ) ) ; }
Find the groups that this entity belongs to .
81
9
34,745
public java . util . Iterator findParentGroups ( IEntityGroup group ) throws GroupsException { String memberKey = group . getLocalKey ( ) ; String serviceName = group . getServiceName ( ) . toString ( ) ; Integer type = EntityTypesLocator . getEntityTypes ( ) . getEntityIDFromType ( group . getLeafType ( ) ) ; return f...
Find the groups that this group belongs to .
103
9
34,746
@ Override public Iterator findParentGroups ( IGroupMember gm ) throws GroupsException { if ( gm . isGroup ( ) ) { IEntityGroup group = ( IEntityGroup ) gm ; return findParentGroups ( group ) ; } else { IEntity ent = ( IEntity ) gm ; return findParentGroups ( ent ) ; } }
Find the groups that this group member belongs to .
79
10
34,747
private java . util . Iterator findParentGroupsForEntity ( String memberKey , int type ) throws GroupsException { Connection conn = null ; Collection groups = new ArrayList ( ) ; IEntityGroup eg = null ; try { conn = RDBMServices . getConnection ( ) ; String sql = getFindParentGroupsForEntitySql ( ) ; PreparedStatement...
Find the groups associated with this member key .
298
9
34,748
@ Override public String [ ] findMemberGroupKeys ( IEntityGroup group ) throws GroupsException { Connection conn = null ; Collection groupKeys = new ArrayList ( ) ; String groupKey = null ; try { conn = RDBMServices . getConnection ( ) ; String sql = getFindMemberGroupKeysSql ( ) ; PreparedStatement ps = conn . prepare...
Find the keys of groups that are members of group .
316
11
34,749
@ Override public Iterator findMemberGroups ( IEntityGroup group ) throws GroupsException { Connection conn = null ; Collection groups = new ArrayList ( ) ; IEntityGroup eg = null ; String serviceName = group . getServiceName ( ) . toString ( ) ; String localKey = group . getLocalKey ( ) ; try { conn = RDBMServices . g...
Find the IUserGroups that are members of the group .
316
13
34,750
private void primDelete ( IEntityGroup group ) throws SQLException { Connection conn = null ; String deleteGroupSql = getDeleteGroupSql ( group ) ; String deleteMembershipSql = getDeleteMembersInGroupSql ( group ) ; try { conn = RDBMServices . getConnection ( ) ; Statement stmnt = conn . createStatement ( ) ; setAutoCo...
Delete this entity from the database after first deleting its memberships . Exception SQLException - if we catch a SQLException we rollback and re - throw it .
260
36
34,751
private void primUpdate ( IEntityGroup group , Connection conn ) throws SQLException , GroupsException { try { PreparedStatement ps = conn . prepareStatement ( getUpdateGroupSql ( ) ) ; try { Integer typeID = EntityTypesLocator . getEntityTypes ( ) . getEntityIDFromType ( group . getLeafType ( ) ) ; ps . setString ( 1 ...
Update the entity in the database .
332
7
34,752
@ Override public void update ( IEntityGroup group ) throws GroupsException { Connection conn = null ; boolean exists = existsInDatabase ( group ) ; try { conn = RDBMServices . getConnection ( ) ; setAutoCommit ( conn , false ) ; try { if ( exists ) { primUpdate ( group , conn ) ; } else { primAdd ( group , conn ) ; } ...
Commit this entity AND ITS MEMBERSHIPS to the underlying store .
212
16
34,753
@ Override public void updateMembers ( IEntityGroup eg ) throws GroupsException { Connection conn = null ; EntityGroupImpl egi = ( EntityGroupImpl ) eg ; if ( egi . isDirty ( ) ) try { conn = RDBMServices . getConnection ( ) ; setAutoCommit ( conn , false ) ; try { primUpdateMembers ( egi , conn ) ; commit ( conn ) ; }...
Insert and delete group membership rows inside a transaction .
207
10
34,754
protected String evaluateSpelExpression ( String value , PortletRequest request ) { if ( StringUtils . isNotBlank ( value ) ) { String result = portletSpELService . parseString ( value , request ) ; return result ; } throw new IllegalArgumentException ( "SQL Query expression required" ) ; }
Substitute any SpEL expressions with values from the PortletRequest and other attributes added to the SpEL context .
69
24
34,755
private Cache getCache ( PortletRequest req ) { String cacheName = req . getPreferences ( ) . getValue ( PREF_CACHE_NAME , DEFAULT_CACHE_NAME ) ; if ( StringUtils . isNotBlank ( cacheName ) ) { log . debug ( "Looking up cache '{}'" , cacheName ) ; Cache cache = CacheManager . getInstance ( ) . getCache ( cacheName ) ; ...
Obtain the cache configured for this portlet instance .
193
11
34,756
@ Override public boolean preHandle ( HttpServletRequest request , HttpServletResponse response , Object handler ) throws Exception { final List < IRequestParameterProcessor > incompleteDynamicProcessors = new LinkedList < IRequestParameterProcessor > ( this . dynamicRequestParameterProcessors ) ; // Loop while there a...
Process the request first with the dynamic processors until all are complete and then the static processors .
313
18
34,757
private HashMap < String , String > getPropertyFromRequest ( HashMap < String , String > tokens , HttpServletRequest request ) { // Iterate through all of the other property keys looking for the first property // named like propname that has a value in the request HashMap < String , String > retHash = new HashMap <> ( ...
Get the values represented by each token from the request and load them into a HashMap that is returned .
500
21
34,758
@ Override public void add ( IEntityLock lock ) throws LockingException { Connection conn = null ; try { conn = RDBMServices . getConnection ( ) ; primDeleteExpired ( new Date ( ) , lock . getEntityType ( ) , lock . getEntityKey ( ) , conn ) ; primAdd ( lock , conn ) ; } catch ( SQLException sqle ) { throw new LockingE...
Adds the lock to the underlying store .
119
8
34,759
@ Override public void delete ( IEntityLock lock ) throws LockingException { Connection conn = null ; try { conn = RDBMServices . getConnection ( ) ; primDelete ( lock , conn ) ; } catch ( SQLException sqle ) { throw new LockingException ( "Problem deleting " + lock , sqle ) ; } finally { RDBMServices . releaseConnecti...
If this IEntityLock exists delete it .
90
9
34,760
@ Override public void deleteAll ( ) throws LockingException { Connection conn = null ; Statement stmnt = null ; try { String sql = "DELETE FROM " + LOCK_TABLE ; if ( log . isDebugEnabled ( ) ) log . debug ( "RDBMEntityLockStore.deleteAll(): " + sql ) ; conn = RDBMServices . getConnection ( ) ; try { stmnt = conn . cre...
Delete all IEntityLocks from the underlying store .
224
11
34,761
public void deleteExpired ( IEntityLock lock ) throws LockingException { deleteExpired ( new Date ( ) , lock . getEntityType ( ) , lock . getEntityKey ( ) ) ; }
Delete all expired IEntityLocks from the underlying store .
43
12
34,762
@ Override public IEntityLock [ ] findUnexpired ( Date expiration , Class entityType , String entityKey , Integer lockType , String lockOwner ) throws LockingException { Timestamp ts = new Timestamp ( expiration . getTime ( ) ) ; return selectUnexpired ( ts , entityType , entityKey , lockType , lockOwner ) ; }
Retrieve IEntityLocks from the underlying store . Expiration must not be null .
76
18
34,763
private static String getDeleteLockSql ( ) { if ( deleteLockSql == null ) { deleteLockSql = "DELETE FROM " + LOCK_TABLE + " WHERE " + ENTITY_TYPE_COLUMN + EQ + "?" + " AND " + ENTITY_KEY_COLUMN + EQ + "?" + " AND " + EXPIRATION_TIME_COLUMN + EQ + "?" + " AND " + LOCK_TYPE_COLUMN + EQ + "?" + " AND " + LOCK_OWNER_COLUMN...
SQL for deleting a row on the lock table .
138
10
34,764
private static String getUpdateSql ( ) { if ( updateSql == null ) { updateSql = "UPDATE " + LOCK_TABLE + " SET " + EXPIRATION_TIME_COLUMN + EQ + "?, " + LOCK_TYPE_COLUMN + EQ + "?" + " WHERE " + ENTITY_TYPE_COLUMN + EQ + "?" + " AND " + ENTITY_KEY_COLUMN + EQ + "?" + " AND " + LOCK_OWNER_COLUMN + EQ + "?" + " AND " + E...
SQL for updating a row on the lock table .
165
10
34,765
private void initialize ( ) throws LockingException { Date expiration = new Date ( System . currentTimeMillis ( ) - ( 60 * 60 * 1000 ) ) ; deleteExpired ( expiration , null , null ) ; }
Cleanup the store by deleting locks expired an hour ago .
46
12
34,766
private IEntityLock instanceFromResultSet ( java . sql . ResultSet rs ) throws SQLException , LockingException { Integer entityTypeID = rs . getInt ( 1 ) ; Class entityType = EntityTypesLocator . getEntityTypes ( ) . getEntityTypeFromID ( entityTypeID ) ; String key = rs . getString ( 2 ) ; int lockType = rs . getInt (...
Extract values from ResultSet and create a new lock .
133
12
34,767
private void primAdd ( IEntityLock lock , Connection conn ) throws SQLException , LockingException { Integer typeID = EntityTypesLocator . getEntityTypes ( ) . getEntityIDFromType ( lock . getEntityType ( ) ) ; String key = lock . getEntityKey ( ) ; int lockType = lock . getLockType ( ) ; Timestamp ts = new Timestamp (...
Add the lock to the underlying store .
331
8
34,768
private IEntityLock [ ] primSelect ( String sql ) throws LockingException { Connection conn = null ; Statement stmnt = null ; ResultSet rs = null ; List locks = new ArrayList ( ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "RDBMEntityLockStore.primSelect(): " + sql ) ; try { conn = RDBMServices . getConnection ( ) ...
Retrieve IEntityLocks from the underlying store .
247
11
34,769
@ Override public IEntityGroupStore newGroupStore ( ComponentGroupServiceDescriptor svcDescriptor ) throws GroupsException { FileSystemGroupStore fsGroupStore = ( FileSystemGroupStore ) getGroupStore ( ) ; String groupsRoot = ( String ) svcDescriptor . get ( "groupsRoot" ) ; if ( groupsRoot != null ) { fsGroupStore . s...
Return an instance of the entity group store implementation .
98
10
34,770
@ Deprecated public static DataSource getDataSource ( String name ) { if ( PORTAL_DB . equals ( name ) ) { return PortalDbLocator . getPortalDb ( ) ; } final ApplicationContext applicationContext = PortalApplicationContextLocator . getApplicationContext ( ) ; final DataSource dataSource = ( DataSource ) applicationCont...
Gets a named DataSource from JNDI with special handling for the PORTAL_DB datasource . Successful lookups are cached and not done again . Lookup failure is remembered and blocks retry for a number of milliseconds specified by JNDI_RETRY_TIME to reduce JNDI overhead and log spam .
91
68
34,771
@ Deprecated public static Connection getConnection ( String dbName ) { final DataSource dataSource = getDataSource ( dbName ) ; try { final long start = System . currentTimeMillis ( ) ; final Connection c = dataSource . getConnection ( ) ; lastDatabase = databaseTimes . add ( System . currentTimeMillis ( ) - start ) ;...
Returns a connection produced by a DataSource found in the JNDI context . The DataSource should be configured and loaded into JNDI by the J2EE container or may be the portal default database .
151
42
34,772
public static void closeResultSet ( final ResultSet rs ) { if ( rs == null ) { return ; } try { rs . close ( ) ; } catch ( Exception e ) { if ( LOG . isWarnEnabled ( ) ) LOG . warn ( "Error closing ResultSet: " + rs , e ) ; } }
Close a ResultSet
68
4
34,773
public static void closeStatement ( final Statement st ) { if ( st == null ) { return ; } try { st . close ( ) ; } catch ( Exception e ) { if ( LOG . isWarnEnabled ( ) ) LOG . warn ( "Error closing Statement: " + st , e ) ; } }
Close a Statement
65
3
34,774
public static final void rollback ( final Connection connection ) { try { connection . rollback ( ) ; } catch ( Exception e ) { if ( LOG . isWarnEnabled ( ) ) LOG . warn ( "Error rolling back Connection: " + connection , e ) ; } }
rollback unwanted changes to the database
58
7
34,775
public static final boolean dbFlag ( final String flag ) { return flag != null && ( FLAG_TRUE . equalsIgnoreCase ( flag ) || FLAG_TRUE_OTHER . equalsIgnoreCase ( flag ) ) ; }
Return boolean value of DB flag Y or N .
50
10
34,776
public static final String sqlEscape ( final String sql ) { if ( sql == null ) { return "" ; } int primePos = sql . indexOf ( "'" ) ; if ( primePos == - 1 ) { return sql ; } final StringBuffer sb = new StringBuffer ( sql . length ( ) + 4 ) ; int startPos = 0 ; do { sb . append ( sql . substring ( startPos , primePos + ...
Make a string SQL safe
164
5
34,777
protected EvaluationContext getEvaluationContext ( WebRequest request ) { final HttpServletRequest httpRequest = this . portalRequestUtils . getOriginalPortalRequest ( request ) ; final IUserInstance userInstance = this . userInstanceManager . getUserInstance ( httpRequest ) ; final IPerson person = userInstance . getP...
Return a SpEL evaluation context for the supplied web request .
132
12
34,778
@ Override public IPermission [ ] getPermissions ( String activity , String target ) throws AuthorizationException { return getAuthorizationService ( ) . getPermissionsForOwner ( getOwner ( ) , activity , target ) ; }
Retrieve an array of IPermission objects based on the given parameters . Any null parameters will be ignored .
48
22
34,779
protected void addFetches ( final Root < PortletEntityImpl > definitionRoot ) { definitionRoot . fetch ( PortletEntityImpl_ . portletPreferences , JoinType . LEFT ) . fetch ( PortletPreferencesImpl_ . portletPreferences , JoinType . LEFT ) . fetch ( PortletPreferenceImpl_ . values , JoinType . LEFT ) ; definitionRoot ....
Add all the fetches needed for completely loading the object graph
103
12
34,780
public void mark ( int eventLimit ) { this . eventLimit = eventLimit ; // Buffering no events now, clear the buffer and buffered reader if ( this . eventLimit == 0 ) { this . eventBuffer . clear ( ) ; this . bufferReader = null ; } // Buffering limited set of events, lets trim the buffer if needed else if ( this . even...
Start buffering events
247
4
34,781
private void addToLocaleList ( List localeList , List < Locale > locales ) { if ( locales != null ) { for ( Locale locale : locales ) { if ( locale != null && ! localeList . contains ( locale ) ) localeList . add ( locale ) ; } } }
Add locales to the locale list if they aren t in there already
65
14
34,782
public static String permissionTargetIdForPortletDefinition ( final IPortletDefinition portletDefinition ) { Validate . notNull ( portletDefinition , "Cannot compute permission target ID for a null portlet definition." ) ; final String portletPublicationId = portletDefinition . getPortletDefinitionId ( ) . getStringId ...
Static utility method computing the permission target ID for a portlet definition .
97
14
34,783
public void startServer ( ) { if ( ! System . getProperties ( ) . containsKey ( JMX_ENABLED_PROPERTY ) ) { this . logger . info ( "System Property '" + JMX_ENABLED_PROPERTY + "' is not set, skipping initialization." ) ; return ; } try { // Get the base rmi port final int portOne = this . getPortOne ( ) ; // Get the sec...
Starts the RMI server and JMX connector server
606
11
34,784
public void stopServer ( ) { if ( this . jmxConnectorServer == null ) { this . logger . info ( "No JMXConnectorServer to stop" ) ; return ; } try { try { this . jmxConnectorServer . stop ( ) ; this . logger . info ( "Stopped JMXConnectorServer" ) ; } catch ( IOException ioe ) { throw new IllegalStateException ( "Failed...
Stops the JMX connector server and RMI server
154
11
34,785
protected int calculatePortTwo ( final int portOne ) { int portTwo = this . portTwo ; if ( portTwo <= 0 ) { portTwo = portOne + 1 ; } if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Using " + portTwo + " for portTwo." ) ; } return portTwo ; }
Get the second rmi port from the init parameters or calculate it
77
13
34,786
protected JMXServiceURL getServiceUrl ( final int portOne , int portTwo ) { final String jmxHost ; if ( this . host == null ) { final InetAddress inetHost ; try { inetHost = InetAddress . getLocalHost ( ) ; } catch ( UnknownHostException uhe ) { throw new IllegalStateException ( "Cannot resolve localhost InetAddress." ...
Generates the JMXServiceURL for the two specified ports .
296
13
34,787
protected Map < String , Object > getJmxServerEnvironment ( ) { final Map < String , Object > jmxEnv = new HashMap < String , Object > ( ) ; // SSL Options final String enableSSL = System . getProperty ( JMX_SSL_PROPERTY ) ; if ( Boolean . getBoolean ( enableSSL ) ) { SslRMIClientSocketFactory csf = new SslRMIClientSoc...
Generates the environment Map for the JMX server based on system properties
362
14
34,788
protected final Set < AggregatedGroupMapping > collectAllGroupsFromParams ( Set < K > keys , AggregatedGroupMapping [ ] aggregatedGroupMappings ) { final Builder < AggregatedGroupMapping > groupsBuilder = ImmutableSet . < AggregatedGroupMapping > builder ( ) ; // Add all groups from the keyset for ( K aggregationKey : ...
and set in query .
130
5
34,789
public String getSelectedProfile ( PortletRequest request ) { // if a profile selection exists in the session, use it final PortletSession session = request . getPortletSession ( ) ; String profileName = ( String ) session . getAttribute ( SessionAttributeProfileMapperImpl . DEFAULT_SESSION_ATTRIBUTE_NAME , PortletSess...
Get the profile that should be pre - selected in the local login form .
276
15
34,790
public static void addParameter ( IUrlBuilder urlBuilder , String name , String value ) { urlBuilder . addParameter ( name , value ) ; }
Needed due to compile - time type checking limitations of the XSLTC compiler
31
16
34,791
public boolean nameExists ( final String name ) { boolean rslt = false ; // default try { final ITenant tenant = this . tenantDao . getTenantByName ( name ) ; rslt = tenant != null ; } catch ( IllegalArgumentException iae ) { // This exception is completely fine; it simply // means there is no tenant with this name. rs...
Returns true if a tenant with the specified name exists otherwise false .
90
13
34,792
public boolean fnameExists ( final String fname ) { boolean rslt = false ; // default try { final ITenant tenant = getTenantByFName ( fname ) ; rslt = tenant != null ; } catch ( IllegalArgumentException iae ) { // This exception is completely fine; it simply // means there is no tenant with this fname. rslt = false ; }...
Returns true if a tenant with the specified fname exists otherwise false .
89
14
34,793
public void validateName ( final String name ) { Validate . validState ( TENANT_NAME_VALIDATOR_PATTERN . matcher ( name ) . matches ( ) , "Invalid tenant name '%s' -- names must match %s ." , name , TENANT_NAME_VALIDATOR_REGEX ) ; }
Throws an exception if the specified String isn t a valid tenant name .
73
15
34,794
public void validateFname ( final String fname ) { Validate . validState ( TENANT_FNAME_VALIDATOR_PATTERN . matcher ( fname ) . matches ( ) , "Invalid tenant fname '%s' -- fnames must match %s ." , fname , TENANT_FNAME_VALIDATOR_REGEX ) ; }
Throws an exception if the specified String isn t a valid tenant fname .
81
16
34,795
@ RenderMapping public String showConfigPage ( RenderRequest request , PortletPreferences preferences , Model model ) { // Add skin names SortedSet < String > skins = skinService . getSkinNames ( request ) ; model . addAttribute ( "skinNames" , skins ) ; // Get the list of preferences and add them to the model Enumerat...
Display a form to manage skin choices .
172
8
34,796
public static synchronized IEntityGroupStore getGroupStore ( ) { if ( groupStore == null ) { groupStore = new GrouperEntityGroupStore ( ) ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "returning IEntityGroupStore: " + groupStore ) ; } return groupStore ; }
returns the instance of GrouperEntityGroupStore .
72
12
34,797
@ Override public IEntityGroupStore newGroupStore ( ComponentGroupServiceDescriptor svcDescriptor ) throws GroupsException { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Creating New Grouper IEntityGroupStore" ) ; } return getGroupStore ( ) ; }
Construction with parameters .
67
4
34,798
@ Override public void onApplicationEvent ( LoginEvent loginEvent ) { if ( enableMarketplacePreloading ) { final IPerson person = loginEvent . getPerson ( ) ; /* * Passing an empty collection pre-loads an unfiltered collection; * instances of PortletMarketplace that specify filtering will * trigger a new collection to ...
Handle the portal LoginEvent . If marketplace caching is enabled will preload marketplace entries for the currently logged in user .
103
23
34,799
private void collectSpecifiedAndDescendantCategories ( PortletCategory specified , Set < PortletCategory > gathered ) { final Set < PortletCategory > children = portletCategoryRegistry . getAllChildCategories ( specified ) ; for ( PortletCategory child : children ) { collectSpecifiedAndDescendantCategories ( child , ga...
Called recursively to gather all specified categories and descendants
82
12