idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
34,800
@ Override @ RequestCache public boolean mayAddPortlet ( final IPerson user , final IPortletDefinition portletDefinition ) { Validate . notNull ( user , "Cannot determine if null users can browse portlets." ) ; Validate . notNull ( portletDefinition , "Cannot determine whether a user can browse a null portlet definitio...
Answers whether the given user may add the portlet to their layout
145
14
34,801
void lock ( String serverId ) { Assert . notNull ( serverId ) ; if ( this . locked ) { throw new IllegalStateException ( "Cannot lock already locked mutex: " + this ) ; } this . locked = true ; this . lockStart = new Date ( ) ; this . lastUpdate = this . lockStart ; this . serverId = serverId ; }
Mark the mutex as locked by the specific server
81
10
34,802
public static void setUserPreference ( Element compViewNode , String attributeName , IPerson person ) { Document doc = compViewNode . getOwnerDocument ( ) ; NodeList nodes = doc . getElementsByTagName ( "layout" ) ; boolean layoutOwner = false ; Attr attrib ; Element e ; // Search Elements in nodelist for ( int i = 0 ;...
Records changes made to element attributes that are defined as being part of a user s user preferences object and not part of the layout . These attributes are specified in the . sdf files for the structure and theme stylesheets . The value is not stored in the layout but the loading of user prefs joins to a layout str...
239
110
34,803
@ Override public Set < String > getPossibleUserAttributeNames ( ) { final Set < String > names = new HashSet < String > ( ) ; names . addAll ( this . possibleUserAttributes ) ; names . addAll ( localAccountDao . getCurrentAttributeNames ( ) ) ; names . add ( displayNameAttribute ) ; return names ; }
Return the list of all possible attribute names . This implementation queries the database to provide a list of all mapped attribute names plus all attribute keys currently in - use in the database .
76
35
34,804
@ Override public Set < String > getAvailableQueryAttributes ( ) { if ( this . queryAttributeMapping == null ) { return Collections . emptySet ( ) ; } return Collections . unmodifiableSet ( this . queryAttributeMapping . keySet ( ) ) ; }
Return the list of all possible query attributes . This implementation queries the database to provide a list of all mapped query attribute names plus all attribute keys currently in - use in the database .
58
36
34,805
protected IPersonAttributes mapPersonAttributes ( final ILocalAccountPerson person ) { final Map < String , List < Object > > mappedAttributes = new LinkedHashMap < String , List < Object > > ( ) ; mappedAttributes . putAll ( person . getAttributes ( ) ) ; // map the user's username to the portal's username attribute i...
This implementation uses the result attribute mapping to supplement rather than replace the attributes returned from the database .
663
19
34,806
@ Override public EntityIdentifier [ ] searchForGroups ( String query , IGroupConstants . SearchMethod method , Class leaftype ) throws GroupsException { Set allIds = new HashSet ( ) ; for ( Iterator services = getComponentServices ( ) . values ( ) . iterator ( ) ; services . hasNext ( ) ; ) { IIndividualGroupService s...
Find EntityIdentifiers for groups whose name matches the query string according to the specified method and matches the provided leaf type
251
23
34,807
public IEntityGroupStore newInstance ( ) throws GroupsException { try { return new RDBMEntityGroupStore ( ) ; } catch ( Exception ex ) { log . error ( "ReferenceEntityGroupStoreFactory.newInstance(): " + ex ) ; throw new GroupsException ( ex ) ; } }
Return an instance of the group store implementation .
63
9
34,808
private void initMapper ( ) { final BeanPropertyFilter filterOutAllExcept = SimpleBeanPropertyFilter . filterOutAllExcept ( "fname" , "executionTimeNano" ) ; this . mapper . addMixInAnnotations ( PortalEvent . class , PortletRenderExecutionEventFilterMixIn . class ) ; final SimpleFilterProvider filterProvider = new Sim...
Configure the ObjectMapper to filter out all fields on the events except those that are actually needed for the analytics reporting
131
24
34,809
@ Override protected Properties mergeProperties ( ) throws IOException { Properties rslt = null ; /* * If properties file encryption is used in this deployment, the * encryption key will be made available to the application as an * environment variable called UP_JASYPT_KEY. */ final String encryptionKey = System . gete...
Override PropertiesLoaderSupport . mergeProprties in order to slip in a properly - configured EncryptableProperties instance allowing us to encrypt property values at rest .
400
33
34,810
public String generateRandomToken ( int length ) { final char [ ] token = new char [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { final int tokenIndex = random . nextInt ( this . tokenChars . length ) ; token [ i ] = tokenChars [ tokenIndex ] ; } return new String ( token ) ; }
Generate a random token of the specified length
78
9
34,811
@ PostLoad @ PostPersist @ PostUpdate @ PostRemove private void init ( ) { if ( this . internalPortletDefinitionId != - 1 && ( this . portletDefinitionId == null || this . portletDefinitionId . getLongId ( ) != this . internalPortletDefinitionId ) ) { this . portletDefinitionId = PortletDefinitionIdImpl . create ( this...
Used to initialize fields after persistence actions .
91
8
34,812
@ BasePortalJpaDao . PortalTransactional public void resetUserLayoutAllProfiles ( final IPersonAttributes personAttributes ) { final IPerson person = PersonFactory . createRestrictedPerson ( ) ; person . setAttributes ( personAttributes . getAttributes ( ) ) ; // get the integer uid into the person object without creat...
Resets a users layout for all the users profiles
169
10
34,813
@ Override @ PortalTransactional public IMarketplaceRating createOrUpdateRating ( IMarketplaceRating marketplaceRatingImplementation ) { Validate . notNull ( marketplaceRatingImplementation , "MarketplaceRatingImpl must not be null" ) ; final EntityManager entityManager = this . getEntityManager ( ) ; IMarketplaceRatin...
This method will either create a new rating or update an existing rating
180
13
34,814
protected void afterMarkup ( ) { final Set < StackState > state = scopeState . getFirst ( ) ; state . add ( StackState . WROTE_MARKUP ) ; }
Note that markup or indentation was written .
40
9
34,815
protected void afterData ( ) { final Set < StackState > state = scopeState . getFirst ( ) ; state . add ( StackState . WROTE_DATA ) ; }
Note that data were written .
37
6
34,816
protected String getIndent ( int depth , int size ) { final int length = depth * size ; String indent = indentCache . get ( length ) ; if ( indent == null ) { indent = getLineSeparator ( ) + StringUtils . repeat ( " " , length ) ; indentCache . put ( length , indent ) ; } return indent ; }
Generate an indentation string for the specified depth and indent size
76
13
34,817
protected Tuple < String , IPortletWindowId > parsePortletParameterName ( HttpServletRequest request , String name , Set < String > additionalPortletIds ) { // Look for a 2nd separator which might indicate a portlet window id for ( final String additionalPortletId : additionalPortletIds ) { final int windowIdIdx = name...
Parse the parameter name and the optional portlet window id from a fully qualified query parameter .
250
19
34,818
protected String getEncoding ( HttpServletRequest request ) { final String encoding = request . getCharacterEncoding ( ) ; if ( encoding != null ) { return encoding ; } return this . defaultEncoding ; }
Tries to determine the encoded from the request if not available falls back to configured default .
46
18
34,819
public void updateIndex ( ) { if ( ! isEnabled ( ) ) { return ; } final IndexWriterConfig indexWriterConfig = new IndexWriterConfig ( new StandardAnalyzer ( ) ) ; indexWriterConfig . setCommitOnClose ( true ) . setOpenMode ( IndexWriterConfig . OpenMode . CREATE_OR_APPEND ) ; try ( IndexWriter indexWriter = new IndexWr...
Called by Quatrz .
161
8
34,820
@ Override public IEntitySearcher newEntitySearcher ( ) throws GroupsException { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Creating New Grouper GrouperEntitySearcherFactory" ) ; } return ( IEntitySearcher ) new GrouperEntityGroupStoreFactory ( ) . newGroupStore ( ) ; }
Creates an instance of EntitySearcher .
77
9
34,821
private boolean checkDatabaseVersion ( String databaseName ) { final Version softwareVersion = this . requiredProductVersions . get ( databaseName ) ; if ( softwareVersion == null ) { throw new IllegalStateException ( "No version number is configured for: " + databaseName ) ; } final Version databaseVersion = this . ve...
Check if the database and software versions match
118
8
34,822
@ Override public SearchResults getSearchResults ( PortletRequest request , SearchRequest query ) { final String queryString = query . getSearchTerms ( ) . toLowerCase ( ) ; final List < IPortletDefinition > portlets = portletDefinitionRegistry . getAllPortletDefinitions ( ) ; final HttpServletRequest httpServletReques...
Returns a list of search results that pertain to the marketplace query is the query to search will search name title description fname and captions
678
28
34,823
@ Override public IOpaqueCredentials getOpaqueCredentials ( ) { if ( parentContext != null && parentContext . isAuthenticated ( ) ) { NotSoOpaqueCredentials oc = new CacheOpaqueCredentials ( ) ; oc . setCredentials ( this . cachedcredentials ) ; return oc ; } else return null ; }
We need to override this method in order to return a class that implements the NotSoOpaqueCredentials interface .
85
25
34,824
public static boolean isAdmin ( IPerson p ) { IAuthorizationPrincipal iap = AuthorizationServiceFacade . instance ( ) . newPrincipal ( p . getEntityIdentifier ( ) . getKey ( ) , p . getEntityIdentifier ( ) . getType ( ) ) ; return isAdmin ( iap ) ; }
Determines if the passed - in IPerson represents a user that is a member of the administrator group or any of its sub groups .
70
28
34,825
public static boolean isAdmin ( IAuthorizationPrincipal ap ) { IGroupMember member = AuthorizationServiceFacade . instance ( ) . getGroupMember ( ap ) ; return isAdmin ( member ) ; }
Determines if the passed - in authorization principal represents a user that is a member of the administrator group or any of its sub groups .
43
28
34,826
public static boolean isAdmin ( IGroupMember member ) { IEntityGroup adminGroup = null ; try { adminGroup = GroupService . getDistinguishedGroup ( PORTAL_ADMINISTRATORS_DISTINGUISHED_GROUP ) ; } catch ( GroupsException ge ) { // cannot determine whether or not the user is an admin. cLog . error ( "Administrative group ...
Determines if the passed - in group member represents a user that is a member of the administrator group or any of its sub groups .
123
28
34,827
@ Override public boolean skinCssFileExists ( DynamicSkinInstanceData data ) { final String cssInstanceKey = getCssInstanceKey ( data ) ; // Check the existing map first since it is faster than accessing the actual file. if ( instanceKeysForExistingCss . contains ( cssInstanceKey ) ) { return true ; } boolean exists = ...
Return true if the skin file already exists . Check memory first in a concurrent manner to allow multiple threads to check simultaneously .
142
24
34,828
@ Override public void generateSkinCssFile ( DynamicSkinInstanceData data ) { final String cssInstanceKey = getCssInstanceKey ( data ) ; synchronized ( cssInstanceKey ) { if ( instanceKeysForExistingCss . contains ( cssInstanceKey ) ) { /* * Two or more threads needing the same CSS file managed to invoke * this method....
Creates the skin css file in a thread - safe manner that allows multiple different skin files to be created simultaneously to handle large tenant situations where all the custom CSS files were cleared away after a uPortal deploy .
405
44
34,829
private void processLessFile ( DynamicSkinInstanceData data ) throws IOException , LessException { // Prepare the LESS sources for compilation final LessSource lessSource = new LessSource ( new File ( getSkinLessPath ( data ) ) ) ; if ( logger . isDebugEnabled ( ) ) { final String result = lessSource . getNormalizedCon...
Less compile the include file into a temporary css file . When done rename the temporary css file to the correct output filename . Since the less compilation phase takes several seconds this insures the output css file is does not exist on the filesystem until it is complete .
245
54
34,830
@ Override public SortedSet < String > getSkinNames ( PortletRequest request ) { // Context to access the filesystem PortletContext ctx = request . getPortletSession ( ) . getPortletContext ( ) ; // Determine the full path to the skins directory String skinsFilepath = ctx . getRealPath ( localRelativeRootPath + "/skinL...
Returns the set of skins to use . This implementation parses the skinList . xml file and returns the set of skin - key element values . If there is an error parsing the XML file return an empty set .
327
43
34,831
@ Override public ClientHttpResponse intercept ( HttpRequest req , byte [ ] body , ClientHttpRequestExecution execution ) throws IOException { Assert . notNull ( propertyResolver ) ; Assert . notNull ( id ) ; try { String authString = getOAuthAuthString ( req ) ; req . getHeaders ( ) . add ( Headers . Authorization . n...
Intercept a request and add the oauth headers .
123
11
34,832
private String getOAuthAuthString ( HttpRequest req ) throws OAuthException , IOException , URISyntaxException { RealmOAuthConsumer consumer = getConsumer ( ) ; OAuthAccessor accessor = new OAuthAccessor ( consumer ) ; String method = req . getMethod ( ) . name ( ) ; URI uri = req . getURI ( ) ; OAuthMessage msg = acce...
Get the oauth Authorization string .
122
7
34,833
private synchronized RealmOAuthConsumer getConsumer ( ) { // could just inject these, but I kinda prefer pushing this out // to the properties file... if ( consumer == null ) { OAuthServiceProvider serviceProvider = new OAuthServiceProvider ( "" , "" , "" ) ; String realm = propertyResolver . getProperty ( "org.jasig.r...
Get the OAuthConsumer . Will initialize it lazily .
261
12
34,834
@ RenderMapping public String getView ( RenderRequest req , Model model ) { final String [ ] images = imageSetSelectionStrategy . getImageSet ( req ) ; model . addAttribute ( "images" , images ) ; final String [ ] thumbnailImages = imageSetSelectionStrategy . getImageThumbnailSet ( req ) ; model . addAttribute ( "thumb...
Display the main user - facing view of the portlet .
298
12
34,835
private int getElementIndex ( Node node ) { final String nodeName = node . getNodeName ( ) ; int count = 1 ; for ( Node previousSibling = node . getPreviousSibling ( ) ; previousSibling != null ; previousSibling = previousSibling . getPreviousSibling ( ) ) { if ( previousSibling . getNodeType ( ) == Node . ELEMENT_NODE...
Gets the index of this element relative to other siblings with the same node name
112
16
34,836
static void applyAndUpdateDeleteSet ( Document plf , Document ilf , IntegrationResult result ) { Element dSet = null ; try { dSet = getDeleteSet ( plf , null , false ) ; } catch ( Exception e ) { LOG . error ( "Exception occurred while getting user's DLM delete-set." , e ) ; } if ( dSet == null ) return ; NodeList dele...
Get the delete set if any from the plf and process each delete command removing any that fail from the delete set so that the delete set is self cleaning .
231
32
34,837
private static boolean applyDelete ( Element delete , Document ilf ) { String nodeID = delete . getAttribute ( Constants . ATT_NAME ) ; Element e = ilf . getElementById ( nodeID ) ; if ( e == null ) return false ; String deleteAllowed = e . getAttribute ( Constants . ATT_DELETE_ALLOWED ) ; if ( deleteAllowed . equals (...
Attempt to apply a single delete command and return true if it succeeds or false otherwise . If the delete is disallowed or the target element no longer exists in the document the delete command fails and returns false .
136
41
34,838
private static Element getDeleteSet ( Document plf , IPerson person , boolean create ) throws PortalException { Node root = plf . getDocumentElement ( ) ; Node child = root . getFirstChild ( ) ; while ( child != null ) { if ( child . getNodeName ( ) . equals ( Constants . ELM_DELETE_SET ) ) return ( Element ) child ; c...
Get the delete set if any stored in the root of the document or create it is passed in create flag is true .
253
24
34,839
private static void addDeleteDirective ( Element compViewNode , String elementID , IPerson person , Document plf , Element delSet ) throws PortalException { String ID = null ; try { ID = getDLS ( ) . getNextStructDirectiveId ( person ) ; } catch ( Exception e ) { throw new PortalException ( "Exception encountered while...
This method does the actual work of adding a delete directive and then recursively calling itself for any incoporated children that need to be deleted as well .
308
33
34,840
@ Override public void perform ( ) throws PortalException { /* * push the change into the PLF */ if ( nodeId . startsWith ( Constants . FRAGMENT_ID_USER_PREFIX ) ) { // remove the parm edit EditManager . removeEditDirective ( nodeId , name , person ) ; } /* * push the fragment value into the ILF if not the name element...
Reset a parameter to not override the value specified by a fragment . This is done by removing the parm edit in the PLF and setting the value in the ILF to the passed - in fragment value .
135
43
34,841
@ Override public EntityIdentifier [ ] searchForEntities ( String query , SearchMethod method ) throws GroupsException { boolean allowPartial = true ; switch ( method ) { case DISCRETE : allowPartial = false ; break ; case STARTS_WITH : query = query + "%" ; break ; case ENDS_WITH : query = "%" + query ; break ; case C...
Internal search so shouldn t be called as case insensitive .
319
11
34,842
public void setProviders ( Map < String , IPermissionTargetProvider > providers ) { this . providers . clear ( ) ; for ( Map . Entry < String , IPermissionTargetProvider > provider : providers . entrySet ( ) ) { this . providers . put ( provider . getKey ( ) , provider . getValue ( ) ) ; } }
Construct a new target provider registry and initialize it with the supplied map of key - > provider pairs .
74
20
34,843
@ Override public String parseString ( String expressionString , PortletRequest request ) { return getValue ( expressionString , request , String . class ) ; }
Primary method used assuming all defaults .
33
7
34,844
protected EvaluationContext getEvaluationContext ( PortletRequest request ) { Map < String , String > userInfo = ( Map < String , String > ) request . getAttribute ( PortletRequest . USER_INFO ) ; final SpELEnvironmentRoot root = new SpELEnvironmentRoot ( new PortletWebRequest ( request ) , userInfo ) ; final StandardE...
Return a SpEL evaluation context for the supplied portlet request .
123
13
34,845
private Version getSimpleVersion ( String product ) { final Tuple coreNumbers ; try { final TypedQuery < Tuple > coreNumbersQuery = this . createQuery ( this . findCoreVersionNumbers ) ; coreNumbersQuery . setParameter ( this . productParameter , product ) ; coreNumbers = DataAccessUtils . singleResult ( coreNumbersQue...
Load a Version object with direct field queries . Used to deal with DB upgrades where not all of the fields have been loaded
360
24
34,846
private String calculateDynamicSkinUrlPathToUse ( PortletRequest request , String lessfileBaseName ) throws IOException { final DynamicSkinInstanceData data = new DefaultDynamicSkinInstanceDataImpl ( request ) ; if ( ! service . skinCssFileExists ( data ) ) { // Trigger the LESS compilation service . generateSkinCssFil...
Calculate the default skin URL path or the path to a skin CSS file that is specific to the set of portlet preference values currently defined .
90
30
34,847
protected long getLastModified ( Resource resource ) { try { return resource . lastModified ( ) ; } catch ( IOException e ) { this . logger . warn ( "Could not determine lastModified for " + resource + ". This resource will never be reloaded due to lastModified changing." , e ) ; } return 0 ; }
Determine the last modified time stamp for the resource
72
11
34,848
@ Override public IUserInstance getUserInstance ( HttpServletRequest request ) throws PortalException { try { request = this . portalRequestUtils . getOriginalPortalRequest ( request ) ; } catch ( IllegalArgumentException iae ) { // ignore, just means that this isn't a wrapped request } // Use request attributes first ...
Returns the UserInstance object that is associated with the given request .
577
13
34,849
private boolean containsElmentWithId ( Node node , String id ) { String nodeName = node . getNodeName ( ) ; if ( "channel" . equals ( nodeName ) || "folder" . equals ( nodeName ) ) { Element e = ( Element ) node ; if ( id . equals ( e . getAttribute ( "ID" ) ) ) { return true ; } if ( "folder" . equals ( nodeName ) ) {...
Recursevly find out whether node contains a folder or channel with given identifier .
147
17
34,850
public static String currentRequestContextPath ( ) { final RequestAttributes requestAttributes = RequestContextHolder . getRequestAttributes ( ) ; if ( null == requestAttributes ) { throw new IllegalStateException ( "Request attributes are not bound. " + "Not operating in context of a Spring-processed Request?" ) ; } i...
Get the request context path from the current request . Copes with both HttpServletRequest and PortletRequest and so usable when handling Spring - processed Servlet or Portlet requests . Requires that Spring have bound the request as in the case of dispatcher servlet or portlet or when the binding filter or listener is...
204
85
34,851
protected List < ? extends UserAttribute > getExpectedUserAttributes ( HttpServletRequest request , final IPortletWindow portletWindow ) { final IPortletEntity portletEntity = portletWindow . getPortletEntity ( ) ; final IPortletDefinition portletDefinition = portletEntity . getPortletDefinition ( ) ; final PortletAppl...
Get the list of user attributes the portlet expects .
128
11
34,852
public static IAuthorizationPrincipal principalFromUser ( final IPerson user ) { Validate . notNull ( user , "Cannot determine an authorization principal for null user." ) ; final EntityIdentifier userEntityIdentifier = user . getEntityIdentifier ( ) ; Validate . notNull ( user , "The user object is defective: lacks en...
Convenience method for converting an IPerson to an IAuthorizationPrincipal .
189
17
34,853
private String primGetName ( String key ) { String name = key ; final IPersonAttributes personAttributes = this . paDao . getPerson ( name ) ; if ( personAttributes != null ) { Object displayName = personAttributes . getAttributeValue ( "displayName" ) ; String displayNameStr = "" ; if ( displayName != null ) { display...
Actually lookup a user name using the underlying IPersonAttributeDao .
116
14
34,854
private Set < IPermission > removeInactivePermissions ( final IPermission [ ] perms ) { Date now = new Date ( ) ; Set < IPermission > rslt = new HashSet <> ( 1 ) ; for ( int i = 0 ; i < perms . length ; i ++ ) { IPermission p = perms [ i ] ; if ( ( p . getEffective ( ) == null || ! p . getEffective ( ) . after ( now ) ...
Returns a Set containing those IPermission instances where the present date is neither after the permission expiration if present nor before the permission start date if present . Only permissions objects that have been filtered by this method should be checked .
145
44
34,855
static void throwIfUnrecognizedParamName ( Enumeration initParamNames ) throws ServletException { final Set < String > recognizedParameterNames = new HashSet < String > ( ) ; recognizedParameterNames . add ( ALLOW_MULTI_VALUED_PARAMETERS ) ; recognizedParameterNames . add ( PARAMETERS_TO_CHECK ) ; recognizedParameterNa...
Examines the Filter init parameter names and throws ServletException if they contain an unrecognized init parameter name .
213
22
34,856
static Set < String > parseParametersToCheck ( final String initParamValue ) { final Set < String > parameterNames = new HashSet < String > ( ) ; if ( null == initParamValue ) { return parameterNames ; } final String [ ] tokens = initParamValue . split ( "\\s+" ) ; if ( 0 == tokens . length ) { throw new IllegalArgumen...
Parse the whitespace delimited String of parameters to check .
198
13
34,857
static void requireNotMultiValued ( final Set < String > parametersToCheck , final Map parameterMap ) { for ( final String parameterName : parametersToCheck ) { if ( parameterMap . containsKey ( parameterName ) ) { final String [ ] values = ( String [ ] ) parameterMap . get ( parameterName ) ; if ( values . length > 1 ...
For each parameter to check verify that it has zero or one value .
122
14
34,858
@ Override public synchronized void authenticate ( ) throws PortalSecurityException { int i ; Enumeration e = mySubContexts . elements ( ) ; while ( e . hasMoreElements ( ) ) { ISecurityContext sctx = ( ( Entry ) e . nextElement ( ) ) . getCtx ( ) ; // The principal and credential are now set for all subcontexts in Aut...
We walk the chain of subcontexts assigning principals and opaqueCredentials from the parent . Note that the contexts themselves should resist actually performing the assignment if an assignment has already been made to either the credentials or the UID .
284
45
34,859
@ Override public synchronized Enumeration getSubContexts ( ) { Enumeration e = mySubContexts . elements ( ) ; class Adapter implements Enumeration { Enumeration base ; public Adapter ( Enumeration e ) { this . base = e ; } @ Override public boolean hasMoreElements ( ) { return base . hasMoreElements ( ) ; } @ Override...
be returned in the order they appeared in the properties file .
119
12
34,860
@ Override public synchronized Enumeration getSubContextNames ( ) { Vector scNames = new Vector ( ) ; for ( int i = 0 ; i < mySubContexts . size ( ) ; i ++ ) { Entry entry = ( Entry ) mySubContexts . get ( i ) ; if ( entry . getKey ( ) != null ) { scNames . add ( entry . getKey ( ) ) ; } } return scNames . elements ( )...
Returns an Enumeration of the names of the subcontexts .
98
14
34,861
@ RenderMapping public String initializeView ( PortletRequest req , Model model ) { final IUserInstance ui = userInstanceManager . getUserInstance ( portalRequestUtils . getCurrentPortalRequest ( ) ) ; final UserPreferencesManager upm = ( UserPreferencesManager ) ui . getPreferencesManager ( ) ; final IUserLayoutManage...
Handles all Favorites portlet VIEW mode renders . Populates model with user s favorites and selects a view to display those favorites .
635
27
34,862
protected final Date getExpiration ( RenderRequest renderRequest ) { // Expiration of the JWT final PortletSession portletSession = renderRequest . getPortletSession ( ) ; final Date rslt = new Date ( portletSession . getLastAccessedTime ( ) + ( ( long ) portletSession . getMaxInactiveInterval ( ) * 1000L ) ) ; return ...
Point at which the JWT expires
85
7
34,863
@ Override @ RequestCache public boolean canPrincipalManage ( IAuthorizationPrincipal principal , String portletDefinitionId ) throws AuthorizationException { final String owner = IPermission . PORTAL_PUBLISH ; final String target = IPermission . PORTLET_PREFIX + portletDefinitionId ; // Retrieve the indicated portlet ...
Answers if the principal has permission to MANAGE this Channel .
563
13
34,864
@ Override @ RequestCache public boolean canPrincipalRender ( IAuthorizationPrincipal principal , String portletDefinitionId ) throws AuthorizationException { // This code simply assumes that anyone who can subscribe to a channel // should be able to render it. In the future, we'd like to update this // implementation ...
Answers if the principal has permission to RENDER this Channel . This implementation currently delegates to the SUBSCRIBE permission .
86
27
34,865
@ Override @ RequestCache public boolean canPrincipalSubscribe ( IAuthorizationPrincipal principal , String portletDefinitionId ) { String owner = IPermission . PORTAL_SUBSCRIBE ; // retrieve the indicated channel from the channel registry store and // determine its current lifecycle state IPortletDefinition portlet = ...
Answers if the principal has permission to SUBSCRIBE to this Channel .
438
17
34,866
@ Override public IAuthorizationPrincipal newPrincipal ( String key , Class type ) { final Tuple < String , Class > principalKey = new Tuple <> ( key , type ) ; final Element element = this . principalCache . get ( principalKey ) ; // principalCache is self populating, it can never return a null entry return ( IAuthori...
Factory method for IAuthorizationPrincipal . First check the principal cache and if not present create the principal and cache it .
89
25
34,867
private IPermission [ ] primGetPermissionsForPrincipal ( IAuthorizationPrincipal principal ) throws AuthorizationException { if ( ! this . cachePermissions ) { return getUncachedPermissionsForPrincipal ( principal , null , null , null ) ; } IPermissionSet ps = null ; // Check the caching service for the Permissions fir...
Returns permissions for a principal . First check the entity caching service and if the permissions have not been cached retrieve and cache them .
169
25
34,868
private String getUsernameForUserId ( int id ) { if ( id > 0 ) { String username = userIdentityStore . getPortalUserName ( id ) ; if ( username != null ) { return username ; } logger . warn ( "Invalid userID {} found when exporting a portlet; return system username instead" , id ) ; } return systemUsername ; }
Returns the username for a valid userId else the system username
80
12
34,869
private IPortletDefinition savePortletDefinition ( IPortletDefinition definition , List < PortletCategory > categories , Map < ExternalPermissionDefinition , Set < IGroupMember > > permissionMap ) { boolean newChannel = ( definition . getPortletDefinitionId ( ) == null ) ; // save the channel definition = portletDefini...
Save a portlet definition .
775
6
34,870
private static Calendar getCalendar ( Date date ) { Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( date ) ; return calendar ; }
Utility method to convert a date to a calendar .
33
11
34,871
private Set < IGroupMember > toGroupMembers ( List < String > groupNames , String fname ) { final Set < IGroupMember > groups = new HashSet <> ( ) ; for ( String groupName : groupNames ) { // Assumes the groupName case matches the DB values. EntityIdentifier [ ] gs = GroupService . searchForGroups ( groupName , IGroupC...
Convert a list of group names to a list of groups .
219
13
34,872
private ExternalPermissionDefinition toExternalPermissionDefinition ( String system , String activity ) { ExternalPermissionDefinition def = ExternalPermissionDefinition . find ( system , activity ) ; if ( def != null ) { return def ; } String delim = "" ; StringBuilder buffer = new StringBuilder ( ) ; for ( ExternalPe...
Check that a permission type from the XML file matches with a real permission .
153
15
34,873
public static void setCachingHeaders ( int maxAge , boolean publicScope , long lastModified , PortletResourceOutputHandler portletResourceOutputHandler ) { if ( maxAge != 0 ) { portletResourceOutputHandler . setDateHeader ( "Last-Modified" , lastModified ) ; if ( publicScope ) { portletResourceOutputHandler . setHeader...
Set the Last - Modified CacheControl and Expires headers based on the maxAge publicScope and lastModified .
214
23
34,874
@ Override public void perform ( ) throws PortalException { Element plfNode = HandlerUtils . getPLFNode ( ilfNode , person , false , false ) ; if ( plfNode == null ) return ; changeRestriction ( Constants . ATT_MOVE_ALLOWED , plfNode , moveAllowed ) ; changeRestriction ( Constants . ATT_MOVE_ALLOWED , ilfNode , moveAll...
Pushes the indicated restriction attribute changes into both the ILF and PLF versions of the layouts since this will only be done when editing a fragment .
310
30
34,875
private String getProxyTicket ( PortletRequest request ) { final HttpServletRequest httpServletRequest = this . portalRequestUtils . getPortletHttpRequest ( request ) ; // try to determine the URL for our portlet String targetService = null ; try { URL url = null ; // if the server port is 80 or 443, don't include it i...
Attempt to get a proxy ticket for the current portlet .
502
12
34,876
@ SuppressWarnings ( "unchecked" ) private static ISecurityContext getCasContext ( ISecurityContext context ) { if ( context instanceof ICasSecurityContext ) { return context ; } Enumeration contextEnum = context . getSubContexts ( ) ; while ( contextEnum . hasMoreElements ( ) ) { ISecurityContext subContext = ( ISecur...
Looks for a security context
118
5
34,877
protected List < AcademicTermDetail > getAcademicTermsAfter ( DateTime start ) { final List < AcademicTermDetail > terms = this . eventAggregationManagementDao . getAcademicTermDetails ( ) ; final int index = Collections . binarySearch ( terms , new AcademicTermDetailImpl ( start . toDateMidnight ( ) , start . plusDays...
Return a sorted list of AcademicTermDetail objects where the the first element of the list where the first element is the first term that starts after the specified start DateTime .
149
35
34,878
protected File getFileRoot ( Class type ) { String path = getGroupsRootPath ( ) + type . getName ( ) ; File f = new File ( path ) ; return ( f . exists ( ) ) ? f : null ; }
Returns a File that is the root for groups of the given type .
51
14
34,879
private void primGetAllDirectoriesBelow ( File dir , Set allDirectories ) { File [ ] files = dir . listFiles ( fileFilter ) ; for ( int i = 0 ; i < files . length ; i ++ ) { if ( files [ i ] . isDirectory ( ) ) { primGetAllDirectoriesBelow ( files [ i ] , allDirectories ) ; allDirectories . add ( files [ i ] ) ; } } }
Returns all directories under dir .
94
6
34,880
@ RequestMapping ( value = "/deletePermission" , method = RequestMethod . POST ) public void deletePermission ( @ RequestParam ( "principal" ) String principal , @ RequestParam ( "owner" ) String owner , @ RequestParam ( "activity" ) String activity , @ RequestParam ( "target" ) String target , HttpServletRequest reque...
Deletes a specific permission
330
5
34,881
protected void cancelWorker ( HttpServletRequest request , IPortletExecutionWorker < ? > portletExecutionWorker ) { final IPortletWindowId portletWindowId = portletExecutionWorker . getPortletWindowId ( ) ; final IPortletWindow portletWindow = this . portletWindowRegistry . getPortletWindow ( request , portletWindowId ...
Cancel the worker and add it to the hung workers queue
175
12
34,882
@ Override public void startPortletHeaderRender ( IPortletWindowId portletWindowId , HttpServletRequest request , HttpServletResponse response ) { if ( doesPortletNeedHeaderWorker ( portletWindowId , request ) ) { this . startPortletHeaderRenderInternal ( portletWindowId , request , response ) ; } else { this . logger ...
Only actually starts rendering the head if the portlet has the javax . portlet . renderHeaders container - runtime - option present and set to true .
114
33
34,883
protected PortletRenderResult getPortletRenderResult ( IPortletWindowId portletWindowId , HttpServletRequest request , HttpServletResponse response ) throws Exception { final IPortletRenderExecutionWorker tracker = getRenderedPortletBodyWorker ( portletWindowId , request , response ) ; final long timeout = getPortletRe...
Returns the PortletRenderResult waiting up to the portlet s timeout
95
14
34,884
protected IPortletRenderExecutionWorker startPortletHeaderRenderInternal ( IPortletWindowId portletWindowId , HttpServletRequest request , HttpServletResponse response ) { IPortletRenderExecutionWorker portletHeaderRenderWorker = this . portletWorkerFactory . createRenderHeaderWorker ( request , response , portletWindo...
create and submit the portlet header rendering job to the thread pool
163
13
34,885
protected IPortletRenderExecutionWorker startPortletRenderInternal ( IPortletWindowId portletWindowId , HttpServletRequest request , HttpServletResponse response ) { // first check to see if there is a Throwable in the session for this IPortletWindowId final Map < IPortletWindowId , Exception > portletFailureMap = getP...
create and submit the portlet content rendering job to the thread pool
436
13
34,886
private boolean add ( T e , boolean failWhenFull ) { final Queue < T > queue = this . getOrCreateQueue ( e ) ; this . writeLock . lock ( ) ; try { if ( this . size == this . capacity ) { if ( failWhenFull ) { throw new IllegalStateException ( "Queue is at capacity: " + this . capacity ) ; } return false ; } final boole...
Adds the element to the queue
132
6
34,887
protected void deletePortletEntity ( HttpServletRequest request , IPortletEntity portletEntity , boolean cacheOnly ) { final IPortletEntityId portletEntityId = portletEntity . getPortletEntityId ( ) ; // Remove from request cache final PortletEntityCache < IPortletEntity > portletEntityMap = this . getPortletEntityMap ...
Delete a portlet entity removes it from the request session and persistent stores
342
14
34,888
protected IPortletEntity getPortletEntity ( HttpServletRequest request , PortletEntityCache < IPortletEntity > portletEntityCache , IPortletEntityId portletEntityId , String layoutNodeId , int userId ) { IPortletEntity portletEntity ; // First look in the request map if ( portletEntityId != null ) { portletEntity = por...
Lookup the portlet entity by layoutNodeId and userId
867
13
34,889
private static Element getEditSet ( Element node , Document plf , IPerson person , boolean create ) throws PortalException { Node child = node . getFirstChild ( ) ; while ( child != null ) { if ( child . getNodeName ( ) . equals ( Constants . ELM_EDIT_SET ) ) return ( Element ) child ; child = child . getNextSibling ( ...
Get the edit set if any stored in the passed in node . If not found and if the create flag is true then create a new edit set and add it as a child to the passed in node . Then return it .
238
45
34,890
static void addEditDirective ( Element plfNode , String attributeName , IPerson person ) throws PortalException { addDirective ( plfNode , attributeName , Constants . ELM_EDIT , person ) ; }
Create and append an edit directive to the edit set if not there . This only records that the attribute was changed and the value in the plf copy node should be used if allowed during the merge at login time .
47
43
34,891
public static void addPrefsDirective ( Element plfNode , String attributeName , IPerson person ) throws PortalException { addDirective ( plfNode , attributeName , Constants . ELM_PREF , person ) ; }
Create and append a user preferences edit directive to the edit set if not there . This only records that the attribute was changed . The value will be in the user preferences object for the user .
50
38
34,892
private static void addDirective ( Element plfNode , String attributeName , String type , IPerson person ) throws PortalException { Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; Element editSet = getEditSet ( plfNode , plf , person , true ) ; // see if attributes has already been marked as bei...
Create and append an edit directive to the edit set if not there .
314
14
34,893
public static boolean applyEditSet ( Element plfChild , Element original ) { // first get edit set if it exists Element editSet = null ; try { editSet = getEditSet ( plfChild , null , null , false ) ; } catch ( Exception e ) { // should never occur unless problem during create in getEditSet // and we are telling it not...
Evaluate whether attribute changes exist in the ilfChild and if so apply them . Returns true if some changes existed . If changes existed but matched those in the original node then they are not applicable are removed from the editSet and false is returned .
573
51
34,894
private static void removeDirective ( String elementId , String attributeName , String type , IPerson person ) { Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; Element node = plf . getElementById ( elementId ) ; if ( node == null ) return ; Element editSet = null ; try { editSet = getEditSet ( ...
Searches for a command of the passed - in type and if found removes it from the user s PLF .
344
24
34,895
protected void removeExpiredPortletCookies ( HttpServletRequest request ) { Map < String , SessionOnlyPortletCookieImpl > sessionOnlyCookies = getSessionOnlyPortletCookieMap ( request ) ; for ( Entry < String , SessionOnlyPortletCookieImpl > entry : sessionOnlyCookies . entrySet ( ) ) { String key = entry . getKey ( ) ...
Remove expired session only portlet cookies .
136
8
34,896
@ Override public InputSource resolveEntity ( String publicId , String systemId ) { InputStream inStream = null ; // Check for a match on the systemId if ( systemId != null ) { if ( dtdName != null && systemId . indexOf ( dtdName ) != - 1 ) { inStream = getResourceAsStream ( dtdPath + "/" + dtdName ) ; } else if ( syst...
Sets up a new input source based on the dtd specified in the xml document
298
17
34,897
protected String verifyPortletWindowId ( HttpServletRequest request , IPortletWindowId portletWindowId ) { final IUserInstance userInstance = this . userInstanceManager . getUserInstance ( request ) ; final IUserPreferencesManager preferencesManager = userInstance . getPreferencesManager ( ) ; final IUserLayoutManager ...
Verify the requested portlet window corresponds to a node in the user s layout and return the corresponding layout node id
269
23
34,898
private synchronized void initialize ( ) { Iterator types = EntityTypesLocator . getEntityTypes ( ) . getAllEntityTypes ( ) ; String factoryName = null ; while ( types . hasNext ( ) ) { Class type = ( Class ) types . next ( ) ; if ( type != Object . class ) { String factoryKey = "org.apereo.portal.services.EntityNameFi...
Gets all the entity types and tries to instantiate and cache a finder for each one . There needn t be a finder for every entity type so if there s no entry in the portal . properties we just log the fact and continue .
296
51
34,899
protected void synchronizeGroupMembersOnDelete ( IEntityGroup group ) throws GroupsException { GroupMemberImpl gmi = null ; for ( Iterator it = group . getChildren ( ) . iterator ( ) ; it . hasNext ( ) ; ) { gmi = ( GroupMemberImpl ) it . next ( ) ; gmi . invalidateInParentGroupsCache ( Collections . singleton ( ( IGro...
Remove the back pointers of the group members of the deleted group . Then update the cache to invalidate copies on peer servers .
111
25