idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
34,600
private void setExplicitlyStopped ( boolean explicitlyStopped ) { SharedPreferences . Editor editor = mPrefs . edit ( ) ; editor . putBoolean ( constructKey ( EXPLICITLY_STOPPED_SUFFIX ) , explicitlyStopped ) ; editor . apply ( ) ; }
Set a flag in SharedPreferences to indicate whether periodic replications were explicitly stopped .
66
17
34,601
private void resetAlarmDueTimesOnReboot ( ) { // As the device has been rebooted, we use clock time rather than elapsed time since // booting to set check whether we missed any alarms while the device was off and to // make sure the next alarm time isn't too far in the future (indicating the system clock // has been re...
Reset the alarm times stored in SharedPreferences following a reboot of the device . After a reboot the AlarmManager must be setup again so that periodic replications will occur following reboot .
478
38
34,602
public static void setReplicationsPending ( Context context , Class < ? extends PeriodicReplicationService > prsClass , boolean pending ) { SharedPreferences prefs = context . getSharedPreferences ( PREFERENCES_FILE_NAME , Context . MODE_PRIVATE ) ; SharedPreferences . Editor editor = prefs . edit ( ) ; editor . putBoo...
Sets whether there are replications pending . This may be because replications are currently in progress and have not yet completed or because a previous scheduled replication didn t take place because the conditions for replication were not met .
113
43
34,603
public static boolean replicationsPending ( Context context , Class < ? extends PeriodicReplicationService > prsClass ) { SharedPreferences prefs = context . getSharedPreferences ( PREFERENCES_FILE_NAME , Context . MODE_PRIVATE ) ; return prefs . getBoolean ( constructKey ( prsClass , REPLICATIONS_PENDING_SUFFIX ) , tr...
Gets whether there are replications pending . Replications may be pending because they are currently in progress and have not yet completed or because a previous scheduled replication didn t take place because the conditions for replication were not met .
91
44
34,604
private < T > T executeWithRetry ( final Callable < ExecuteResult > task , InputStreamProcessor < T > processor ) throws CouchException { int attempts = 10 ; CouchException lastException = null ; while ( attempts -- > 0 ) { ExecuteResult result = null ; try { result = task . call ( ) ; if ( result . stream != null ) { ...
return an InputStream if successful or throw an exception
261
10
34,605
public Response update ( String id , Object document ) { Misc . checkNotNullOrEmpty ( id , "id" ) ; Misc . checkNotNull ( document , "Document" ) ; // Get the latest rev, will throw if doc doesn't exist getDocumentRev ( id ) ; return putUpdate ( id , document ) ; }
Document should be complete document include _id matches ID
69
10
34,606
public List < Response > bulkCreateSerializedDocs ( List < String > serializedDocs ) { Misc . checkNotNull ( serializedDocs , "Serialized doc list" ) ; String payload = generateBulkSerializedDocsPayload ( serializedDocs ) ; return bulkCreateDocs ( payload ) ; }
Bulk insert a list of document that are serialized to JSON data already . For performance reasons the JSON doc is not validated .
70
26
34,607
@ RenderMapping public String initializeView ( Model model , RenderRequest renderRequest ) { IUserInstance ui = userInstanceManager . getUserInstance ( portalRequestUtils . getCurrentPortalRequest ( ) ) ; UserPreferencesManager upm = ( UserPreferencesManager ) ui . getPreferencesManager ( ) ; IUserLayoutManager ulm = u...
Handles all Favorites portlet EDIT mode renders . Populates model with user s favorites and selects a view to display those favorites .
470
27
34,608
public String getAttributeValue ( String name ) { Attr att = node . getAttributeNode ( name ) ; if ( att == null ) return null ; return att . getNodeValue ( ) ; }
Returns the value of an attribute or null if such an attribute is not defined on the underlying element .
42
20
34,609
public static Element getPLFNode ( Element compViewNode , IPerson person , boolean create , boolean includeChildNodes ) throws PortalException { Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; String ID = compViewNode . getAttribute ( Constants . ATT_ID ) ; Element plfNode = plf . getElementById...
This method returns the PLF version of the passed in compViewNode . If create is false and a node with the same id is not found in the PLF then null is returned . If the create is true then an attempt is made to create the node along with any necessary ancestor nodes needed to represent the path along the tree .
189
67
34,610
public static Element createPlfNodeAndPath ( Element compViewNode , boolean includeChildNodes , IPerson person ) throws PortalException { // first attempt to get parent Element compViewParent = ( Element ) compViewNode . getParentNode ( ) ; Element plfParent = getPLFNode ( compViewParent , person , true , false ) ; Doc...
Creates a copy of the passed in ILF node in the PLF if not already there as well as creating any ancestor nodes along the path from this node up to the layout root if they are not there .
221
43
34,611
private static Element createILFCopy ( Element compViewNode , Element compViewParent , boolean includeChildNodes , Document plf , Element plfParent , IPerson person ) throws PortalException { Element plfNode = ( Element ) plf . importNode ( compViewNode , includeChildNodes ) ; // make sure that we don't include ILF res...
Creates a copy of an ilf node in the plf and sets up necessary storage attributes .
507
20
34,612
static Element createOrMovePLFOwnedNode ( Element compViewNode , Element compViewParent , boolean createIfNotFound , boolean createChildNodes , Document plf , Element plfParent , IPerson person ) throws PortalException { Element child = ( Element ) compViewParent . getFirstChild ( ) ; Element nextOwnedSibling = null ; ...
Creates or moves the plf copy of a node in the composite view and inserting it before its next highest sibling so that if dlm is not used then the model ends up exactly like the original non - dlm persistance version . The position set is also updated and if no ilf copy nodes are found in the sibling list the set is cl...
427
77
34,613
public static void mergeFragment ( Document fragment , Document composite , IAuthorizationPrincipal ap ) throws AuthorizationException { Element fragmentLayout = fragment . getDocumentElement ( ) ; Element fragmentRoot = ( Element ) fragmentLayout . getFirstChild ( ) ; Element compositeLayout = composite . getDocumentE...
Passes the layout root of each of these documents to mergeChildren causing all children of newLayout to be merged into compositeLayout following merging protocal for distributed layout management .
99
34
34,614
private static boolean mergeAllowed ( Element child , IAuthorizationPrincipal ap ) throws AuthorizationException { if ( ! child . getTagName ( ) . equals ( "channel" ) ) return true ; String channelPublishId = child . getAttribute ( "chanID" ) ; return ap . canRender ( channelPublishId ) ; }
Tests to see if channels to be merged from ILF can be rendered by the end user . If not then they are discarded from the merge .
72
30
34,615
private Object [ ] getPersonGroupMemberKeys ( IGroupMember gm ) { Object [ ] keys = null ; EntityIdentifier ei = gm . getUnderlyingEntityIdentifier ( ) ; IPersonAttributes attr = personAttributeDao . getPerson ( ei . getKey ( ) ) ; if ( attr != null && attr . getAttributes ( ) != null && ! attr . getAttributes ( ) . is...
gm should already be determined to be reference to person
186
10
34,616
@ Override public IEntityGroup newInstance ( Class entityType ) throws GroupsException { log . warn ( "Unsupported method accessed: SmartLdapGroupStore.newInstance" ) ; throw new UnsupportedOperationException ( UNSUPPORTED_MESSAGE ) ; }
Return an UnsupportedOperationException !
59
7
34,617
@ Override public EntityIdentifier [ ] searchForGroups ( String query , SearchMethod method , Class leaftype ) throws GroupsException { if ( isTreeRefreshRequired ( ) ) { refreshTree ( ) ; } log . debug ( "Invoking searchForGroups(): query={}, method={}, leaftype=" , query , method , leaftype . getName ( ) ) ; // We on...
Treats case sensitive and case insensitive searching the same .
715
12
34,618
@ RequestMapping ( method = RequestMethod . POST , params = "action=removeElement" ) public ModelAndView removeElement ( HttpServletRequest request , HttpServletResponse response ) throws IOException { IUserInstance ui = userInstanceManager . getUserInstance ( request ) ; IPerson per = getPerson ( ui , response ) ; Use...
Remove an element from the layout .
339
7
34,619
@ RequestMapping ( method = RequestMethod . POST , params = "action=removeByFName" ) public ModelAndView removeByFName ( HttpServletRequest request , HttpServletResponse response , @ RequestParam ( value = "fname" ) String fname ) throws IOException { IUserInstance ui = userInstanceManager . getUserInstance ( request )...
Remove the first element with the provided fname from the layout .
395
13
34,620
@ RequestMapping ( method = RequestMethod . POST , params = "action=addFolder" ) public ModelAndView addFolder ( HttpServletRequest request , HttpServletResponse response , @ RequestParam ( "targetId" ) String targetId , @ RequestParam ( value = "siblingId" , required = false ) String siblingId , @ RequestBody ( requir...
Add a new folder to the layout .
491
8
34,621
@ RequestMapping ( method = RequestMethod . POST , params = "action=renameTab" ) public ModelAndView renameTab ( HttpServletRequest request , HttpServletResponse response ) throws IOException { IUserInstance ui = userInstanceManager . getUserInstance ( request ) ; UserPreferencesManager upm = ( UserPreferencesManager )...
Rename a specified tab .
480
6
34,622
private void setObjectAttributes ( IUserLayoutNodeDescription node , HttpServletRequest request , Map < String , Map < String , String > > attributes ) { // Attempt to set the object attributes for ( String name : attributes . get ( "attributes" ) . keySet ( ) ) { try { BeanUtils . setProperty ( node , name , attribute...
Attempt to map the attribute values to the given object .
227
11
34,623
protected boolean isTab ( IUserLayoutManager ulm , String folderId ) throws PortalException { // we could be a bit more careful here and actually check the type return ulm . getRootFolderId ( ) . equals ( ulm . getParentId ( folderId ) ) ; }
A folder is a tab if its parent element is the layout element
60
13
34,624
protected String getMessage ( String key , String defaultMessage , Locale locale ) { try { return messageSource . getMessage ( key , new Object [ ] { } , defaultMessage , locale ) ; } catch ( Exception e ) { // sadly, messageSource.getMessage can throw e.g. when message is ill formatted. logger . error ( "Error resolvi...
Syntactic sugar for safely resolving a no - args message from message bundle .
92
16
34,625
private boolean moveElementInternal ( HttpServletRequest request , String sourceId , String destinationId , String method ) { logger . debug ( "moveElementInternal invoked for sourceId={}, destinationId={}, method={}" , sourceId , destinationId , method ) ; if ( StringUtils . isEmpty ( destinationId ) ) { // shortcut f...
Moves the source element .
610
6
34,626
protected final void setReportFormGroups ( final F report ) { if ( ! report . getGroups ( ) . isEmpty ( ) ) { return ; } final Set < AggregatedGroupMapping > groups = this . getGroups ( ) ; if ( ! groups . isEmpty ( ) ) { report . getGroups ( ) . add ( groups . iterator ( ) . next ( ) . getId ( ) ) ; } }
Set the groups to have selected by default if not already set
93
12
34,627
protected final boolean showFullColumnHeaderDescriptions ( F form ) { boolean showFullHeaderDescriptions = false ; switch ( form . getFormat ( ) ) { case csv : { showFullHeaderDescriptions = true ; break ; } case html : { showFullHeaderDescriptions = true ; break ; } default : { showFullHeaderDescriptions = false ; } }...
Returns true to indicate report format is only data table and doesn t have report graph titles etc . so the report columns needs to fully describe the data columns . CSV and HTML tables require full column header descriptions .
91
41
34,628
private AggregatedGroupMapping [ ] extractGroupsArray ( Set < D > columnGroups ) { Set < AggregatedGroupMapping > groupMappings = new HashSet < AggregatedGroupMapping > ( ) ; for ( D discriminator : columnGroups ) { groupMappings . add ( discriminator . getAggregatedGroup ( ) ) ; } return groupMappings . toArray ( new ...
use a Set to filter down to unique values .
101
10
34,629
public static Preference createSingleTextPreference ( String name , String label ) { return createSingleTextPreference ( name , "attribute.displayName." + name , TextDisplay . TEXT , null ) ; }
Define a single - valued text input preferences . This method is a convenient wrapper for the most common expected use case and assumes null values for the default value and a predictable label .
44
36
34,630
public static Preference createSingleTextPreference ( String name , String label , TextDisplay displayType , String defaultValue ) { SingleTextPreferenceInput input = new SingleTextPreferenceInput ( ) ; input . setDefault ( defaultValue ) ; input . setDisplay ( displayType ) ; Preference pref = new Preference ( ) ; pre...
Craete a single - valued text input preference .
138
10
34,631
public static Preference createSingleChoicePreference ( String name , String label , SingleChoiceDisplay displayType , List < Option > options , String defaultValue ) { SingleChoicePreferenceInput input = new SingleChoicePreferenceInput ( ) ; input . setDefault ( defaultValue ) ; input . setDisplay ( displayType ) ; in...
Create a single - valued choice preference input .
158
9
34,632
public static Preference createMultiTextPreference ( String name , String label , TextDisplay displayType , List < String > defaultValues ) { MultiTextPreferenceInput input = new MultiTextPreferenceInput ( ) ; input . getDefaults ( ) . addAll ( defaultValues ) ; input . setDisplay ( displayType ) ; Preference pref = ne...
Create a multi - valued text input preference .
147
9
34,633
public static Preference createMultiChoicePreference ( String name , String label , MultiChoiceDisplay displayType , List < Option > options , List < String > defaultValues ) { MultiChoicePreferenceInput input = new MultiChoicePreferenceInput ( ) ; input . getDefaults ( ) . addAll ( defaultValues ) ; input . setDisplay...
Create a multi - valued choice input preference .
167
9
34,634
private void initRelatedPortlets ( ) { final Set < MarketplacePortletDefinition > allRelatedPortlets = new HashSet <> ( ) ; for ( PortletCategory parentCategory : this . portletCategoryRegistry . getParentCategories ( this ) ) { final Set < IPortletDefinition > portletsInCategory = this . portletCategoryRegistry . getA...
Initialize related portlets . This must be called lazily so that MarketplacePortletDefinitions instantiated as related portlets off of a MarketplacePortletDefinition do not always instantiate their related MarketplacePortletDefinitions ad infinitem .
158
49
34,635
public Set < MarketplacePortletDefinition > getRandomSamplingRelatedPortlets ( final IPerson user ) { Validate . notNull ( user , "Cannot filter to BROWSEable by a null user" ) ; final IAuthorizationPrincipal principal = AuthorizationPrincipalHelper . principalFromUser ( user ) ; // lazy init is essential to avoid infi...
Obtain up to QUANTITY_RELATED_PORTLETS_TO_SHOW random related portlets BROWSEable by the given user .
295
31
34,636
public String getRenderUrl ( ) { final String alternativeMaximizedUrl = getAlternativeMaximizedLink ( ) ; if ( null != alternativeMaximizedUrl ) { return alternativeMaximizedUrl ; } final String contextPath = PortalWebUtils . currentRequestContextPath ( ) ; // TODO: stop abstraction violation of relying on knowledge of...
Convenience method for getting a bookmarkable URL for rendering the defined portlet
102
16
34,637
static void evaluateAndApply ( List < NodeInfo > order , Element compViewParent , Element positionSet , IntegrationResult result ) throws PortalException { adjustPositionSet ( order , positionSet , result ) ; if ( hasAffectOnCVP ( order , compViewParent ) ) { applyToNodes ( order , compViewParent ) ; result . setChange...
This method determines if applying all of the positioning rules and restrictions ended up making changes to the compViewParent or the original position set . If changes are applicable to the CVP then they are applied . If the position set changed then the original stored in the PLF is updated .
84
56
34,638
static void adjustPositionSet ( List < NodeInfo > order , Element positionSet , IntegrationResult result ) { Node nodeToMatch = positionSet . getFirstChild ( ) ; Element nodeToInsertBefore = positionSet . getOwnerDocument ( ) . createElement ( "INSERT_POINT" ) ; positionSet . insertBefore ( nodeToInsertBefore , nodeToM...
This method trims down the position set to the position directives on the node info elements still having a position directive . Any directives that violated restrictions were removed from the node info objects so the position set should be made to match the order of those still having one .
447
52
34,639
static boolean hasAffectOnCVP ( List < NodeInfo > order , Element compViewParent ) { if ( order . size ( ) == 0 ) return false ; int idx = 0 ; Element child = ( Element ) compViewParent . getFirstChild ( ) ; NodeInfo ni = order . get ( idx ) ; if ( child == null && ni != null ) // most likely nodes to be pulled in retu...
This method compares the children by id in the order list with the order in the compViewParent s ui visible children and returns true if the ordering differs indicating that the positioning if needed .
265
38
34,640
static void applyToNodes ( List < NodeInfo > order , Element compViewParent ) { // first set up a bogus node to assist with inserting Node insertPoint = compViewParent . getOwnerDocument ( ) . createElement ( "bogus" ) ; Node first = compViewParent . getFirstChild ( ) ; if ( first != null ) compViewParent . insertBefor...
This method applies the ordering specified in the passed in order list to the child nodes of the compViewParent . Nodes specified in the list but located elsewhere are pulled in .
165
35
34,641
static void applyNoHopping ( List < NodeInfo > order ) { if ( isIllegalHoppingSpecified ( order ) == true ) { ArrayList < NodeInfo > cvpNodeInfos = new ArrayList <> ( ) ; // pull those out of the position list from the CVP for ( int i = order . size ( ) - 1 ; i >= 0 ; i -- ) if ( order . get ( i ) . getIndexInCVP ( ) !...
This method is responsible for preventing nodes with identical precedence in the same parent from hopping over each other so that a layout fragment can lock two tabs that are next to each other and they can only be separated by tabs with higher precedence .
224
46
34,642
static boolean isIllegalHoppingSpecified ( List < NodeInfo > order ) { for ( int i = 0 ; i < order . size ( ) ; i ++ ) { NodeInfo ni = ( NodeInfo ) order . get ( i ) ; // look for move restricted nodes if ( ! ni . getNode ( ) . getAttribute ( Constants . ATT_MOVE_ALLOWED ) . equals ( "false" ) ) continue ; // now check...
This method determines if any illegal hopping is being specified . To determine if the positioning is specifying an ordering that will result in hopping I need to determine for each node n in the list if any of the nodes to be positioned to its right currently lie to its left in the CVP and have moveAllowed = false and...
450
102
34,643
static void applyOrdering ( List < NodeInfo > order , Element compViewParent , Element positionSet , NodeInfoTracker tracker ) { // first pull out all visible channel or visible folder children and // put their id's in a list of available children and record their // relative order in the CVP. final Map < String , Node...
This method assembles in the passed in order object a list of NodeInfo objects ordered first by those specified in the position set and whose nodes still exist in the composite view and then by any remaining children in the compViewParent .
630
46
34,644
public static void updatePositionSet ( Element compViewParent , Element plfParent , IPerson person ) throws PortalException { if ( LOG . isDebugEnabled ( ) ) LOG . debug ( "Updating Position Set" ) ; if ( compViewParent . getChildNodes ( ) . getLength ( ) == 0 ) { // no nodes to position. if set exists reclaim the spac...
This method updates the positions recorded in a position set to reflect the ids of the nodes in the composite view of the layout . Any position nodes already in existence are reused to reduce database interaction needed to generate a new ID attribute . If any are left over after updating those position elements are rem...
506
94
34,645
private static Element getPositionSet ( Element plfParent , IPerson person , boolean create ) throws PortalException { Node child = plfParent . getFirstChild ( ) ; while ( child != null ) { if ( child . getNodeName ( ) . equals ( Constants . ELM_POSITION_SET ) ) return ( Element ) child ; child = child . getNextSibling...
This method locates the position set element in the child list of the passed in plfParent or if not found it will create one automatically and return it if the passed in create flag is true .
252
40
34,646
private static Element createAndAppendPosition ( String elementID , Element positions , IPerson person ) throws PortalException { if ( LOG . isDebugEnabled ( ) ) LOG . debug ( "Adding Position Set entry " + elementID + "." ) ; String ID = null ; try { ID = getDLS ( ) . getNextStructDirectiveId ( person ) ; } catch ( Ex...
Create append to the passed in position set and return a position element that references the passed in elementID .
225
21
34,647
private void updateScript ( String target , String databaseQualifier , String outputFile , boolean runIt ) { final ISchemaExport schemaExportBean = this . getSchemaExport ( databaseQualifier ) ; if ( schemaExportBean == null ) { throw new RuntimeException ( target + " could not find schemaExportBean " + databaseQualifi...
This runs a database update or just generates the script
187
10
34,648
private String formatBody ( URL resetUrl , ILocalAccountPerson account , Locale locale ) { final STGroup group = new STGroupDir ( templateDir , ' ' , ' ' ) ; final ST template = group . getInstanceOf ( templateName ) ; String name = findDisplayNameFromLocalAccountPerson ( account ) ; template . add ( "displayName" , na...
Get the body content of the email .
105
8
34,649
protected String findDisplayNameFromLocalAccountPerson ( ILocalAccountPerson person ) { Object name = person . getAttributeValue ( ILocalAccountPerson . ATTR_DISPLAY_NAME ) ; if ( ( name instanceof String ) && ! StringUtils . isEmpty ( ( String ) name ) ) { return ( String ) name ; } // if display name is not set, just...
Determine the name to use in the password reset email that identifies the users whose password has been reset .
92
22
34,650
final void doPopulateTimeDimensions ( ) { final List < TimeDimension > timeDimensions = this . timeDimensionDao . getTimeDimensions ( ) ; if ( timeDimensions . isEmpty ( ) ) { logger . info ( "No TimeDimensions exist, creating them" ) ; } else if ( timeDimensions . size ( ) != ( 24 * 60 ) ) { this . logger . info ( "Th...
Populate the time dimensions
448
5
34,651
protected void createDateDimension ( List < QuarterDetail > quartersDetails , List < AcademicTermDetail > academicTermDetails , DateMidnight date ) { final QuarterDetail quarterDetail = EventDateTimeUtils . findDateRangeSorted ( date , quartersDetails ) ; final AcademicTermDetail termDetail = EventDateTimeUtils . findD...
Creates a date dimension handling the quarter and term lookup logic
133
12
34,652
public static String getStringFromPortletUrl ( PortletUrl portletUrl , HttpServletRequest request ) { if ( portletUrl == null ) { return null ; } // Default urlType UrlType urlType = UrlType . RENDER ; final PortletUrlType type = portletUrl . getType ( ) ; switch ( type ) { case ACTION : urlType = UrlType . ACTION ; br...
A static EL function that is defined in portletUrl . tld Takes a portletUrl object and coverts it into an actual Url Example is in search returns a marketplace entry Url
410
39
34,653
public void setChannelPublishingDefinition ( PortletPublishingDefinition cpd ) { // Set appName/portletName if a descriptor is present. If a framework // portlet, the applicationId is /uPortal. if ( cpd . getPortletDescriptor ( ) != null ) { final PortletDescriptor pDesc = cpd . getPortletDescriptor ( ) ; // PortletDes...
Sets the Java class name and parameter defaults based on the PortletPublishingDefinition .
769
18
34,654
private void initPermissionsForPrincipal ( JsonEntityBean principal ) { permissions . add ( principal . getTypeAndIdHash ( ) + "_" + PortletAdministrationHelper . PortletPermissionsOnForm . BROWSE . getActivity ( ) ) ; permissions . add ( principal . getTypeAndIdHash ( ) + "_" + PortletAdministrationHelper . PortletPer...
Sets the default collection of permissions for newly - added principals . They are BROWSE and SUBSCRIBE .
100
25
34,655
public void setExpirationDateString ( String date ) throws ParseException { if ( StringUtils . isBlank ( date ) ) { expirationDate = null ; return ; } expirationDate = dateFormat . parse ( date ) ; }
Set the expiration date as a string .
50
8
34,656
public void setPublishDateString ( String date ) throws ParseException { if ( StringUtils . isBlank ( date ) ) { publishDate = null ; return ; } publishDate = dateFormat . parse ( date ) ; }
Set the publish date as a string . This is just a webflow workaround .
50
16
34,657
public void setServiceName ( Name newServiceName ) throws GroupsException { try { getCompositeEntityIdentifier ( ) . setServiceName ( newServiceName ) ; } catch ( javax . naming . InvalidNameException ine ) { throw new GroupsException ( "Problem setting service name" , ine ) ; } }
Sets the service Name of the group service of origin .
70
12
34,658
@ Override public void updateMembers ( ) throws GroupsException { // Track objects to invalidate Set < IGroupMember > invalidate = new HashSet <> ( ) ; invalidate . addAll ( getAddedMembers ( ) . values ( ) ) ; invalidate . addAll ( getRemovedMembers ( ) . values ( ) ) ; getLocalGroupService ( ) . updateGroupMembers ( ...
Delegate to the factory .
117
6
34,659
public static String getEventName ( int eventId ) { switch ( eventId ) { case XMLStreamConstants . START_ELEMENT : return "StartElementEvent" ; case XMLStreamConstants . END_ELEMENT : return "EndElementEvent" ; case XMLStreamConstants . PROCESSING_INSTRUCTION : return "ProcessingInstructionEvent" ; case XMLStreamConsta...
Get the human readable event name for the numeric event id
229
11
34,660
@ Override public Evaluator getAttributeEvaluator ( String name , String mode , String value ) { return new GroupMembershipEvaluator ( mode , name ) ; }
Returns an instance of an evaluator specific to this factory and the passed in values . Name should be a well known group name . Case is important . The mode should be memberOf for now . Other modes may be added in the future like deepMemberOf .
40
53
34,661
private List < IPersonAttributes > getVisiblePersons ( final IAuthorizationPrincipal principal , final Set < String > permittedAttributes , List < IPersonAttributes > peopleList ) { List < Future < IPersonAttributes >> futures = new ArrayList <> ( ) ; List < IPersonAttributes > list = new ArrayList <> ( ) ; // Ugly. Pe...
Returns a list of the personAttributes that this principal has permission to view . This implementation does the check on the list items in parallel because personDirectory is consulted for non - admin principals to get the person attributes which is really slow if done on N entries in parallel because personDirectory ...
373
77
34,662
private boolean allListItemsHaveDisplayName ( List < IPersonAttributes > people ) { for ( IPersonAttributes person : people ) { if ( person . getAttributeValue ( "displayName" ) == null ) { return false ; } } return true ; }
Utility class to determine if all items in the list of people have a displayName .
54
18
34,663
protected IAuthorizationPrincipal getPrincipalForUser ( final IPerson person ) { final EntityIdentifier ei = person . getEntityIdentifier ( ) ; return AuthorizationServiceFacade . instance ( ) . newPrincipal ( ei . getKey ( ) , ei . getType ( ) ) ; }
Get the authoriztaion principal matching the supplied IPerson .
66
13
34,664
protected Set < String > getPermittedAttributes ( final IAuthorizationPrincipal principal ) { final Set < String > attributeNames = personAttributeDao . getPossibleUserAttributeNames ( ) ; return getPermittedAttributes ( principal , attributeNames ) ; }
Get the set of all user attribute names defined in the portal for which the specified principal has the attribute viewing permission .
54
23
34,665
@ Override public Map < String , Document > getFragmentLayoutCopies ( ) { // since this is only visible in fragment list in administrative portlet, use default portal // locale final Locale defaultLocale = localeManagerFactory . getPortalLocales ( ) . get ( 0 ) ; final Map < String , Document > layouts = new HashMap <>...
Method for acquiring copies of fragment layouts to assist in debugging . No infrastructure code calls this but channels designed to expose the structure of the cached fragments use this to obtain copies .
247
34
34,666
@ Override public DistributedUserLayout getUserLayout ( IPerson person , IUserProfile profile ) { final DistributedUserLayout layout = this . _getUserLayout ( person , profile ) ; return layout ; }
Returns the layout for a user decorated with any specified decorator . The layout returned is a composite layout for non fragment owners and a regular layout for layout owners . A composite layout is made up of layout pieces from potentially multiple incorporated layouts . If no layouts are defined then the composite l...
45
91
34,667
private Document _safeGetUserLayout ( IPerson person , IUserProfile profile ) { Document layoutDoc ; Tuple < String , String > key = null ; final Cache < Tuple < String , String > , Document > layoutCache = getLayoutImportExportCache ( ) ; if ( layoutCache != null ) { key = new Tuple <> ( person . getUserName ( ) , pro...
Handles locking and identifying proper root and namespaces that used to take place in super class .
213
19
34,668
private DistributedUserLayout _getUserLayout ( IPerson person , IUserProfile profile ) { final String userName = ( String ) person . getAttribute ( "username" ) ; final FragmentDefinition ownedFragment = this . fragmentUtils . getFragmentDefinitionByOwner ( person ) ; final boolean isLayoutOwnerDefault = this . isLayou...
Returns the layout for a user . This method overrides the same method in the superclass to return a composite layout for non fragment owners and a regular layout for layout owners . A composite layout is made up of layout pieces from potentially multiple incorporated layouts . If no layouts are defined then the composi...
786
94
34,669
@ Override public Document getFragmentLayout ( IPerson person , IUserProfile profile ) { return this . _safeGetUserLayout ( person , profile ) ; }
Convenience method for fragment activator to obtain raw layouts for fragments during initialization .
35
17
34,670
private void updateCachedLayout ( Document layout , IUserProfile profile , FragmentDefinition fragment ) { final Locale locale = profile . getLocaleManager ( ) . getLocales ( ) . get ( 0 ) ; // need to make a copy that we can fragmentize layout = ( Document ) layout . cloneNode ( true ) ; // Fix later to handle multipl...
Replaces the layout Document stored on a fragment definition with a new version . This is called when a fragment owner updates their layout .
267
26
34,671
private boolean isLayoutOwnerDefault ( IPerson person ) { final String userName = ( String ) person . getAttribute ( "username" ) ; final List < FragmentDefinition > definitions = this . fragmentUtils . getFragmentDefinitions ( ) ; if ( userName != null && definitions != null ) { for ( final FragmentDefinition fragment...
Returns true if the user is the owner of a layout which is copied as the default for any fragment when first created .
161
24
34,672
@ Override public void setUserLayout ( IPerson person , IUserProfile profile , Document layoutXML , boolean channelsAdded ) { this . setUserLayout ( person , profile , layoutXML , channelsAdded , true ) ; }
This method overrides the same method in the super class to persist only layout information stored in the user s person layout fragment or PLF . If this person is a layout owner then their changes are pushed into the appropriate layout fragment .
49
46
34,673
@ Override public void setUserLayout ( IPerson person , IUserProfile profile , Document layoutXML , boolean channelsAdded , boolean updateFragmentCache ) { final Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "PLF for {}\n{}" , person . getA...
This method overrides the same method in the super class to persist only layout information stored in the user s person layout fragment or PLF . If fragment cache update is requested then it checks to see if this person is a layout owner and if so then their changes are pushed into the appropriate layout fragment .
179
60
34,674
private static synchronized void storeSingleton ( ) { // recheck that we need to run because field could have been // set since we decided to invoke this method but before we acquired // the lock on this object if ( PERSON_DIR_NAME_FINDER_INSTANCE == null ) { IPersonAttributeDao personAttributeDao = PersonAttributeDaoL...
Instantiates the static singleton field PERSON_DIR_NAME_FINDER_INSTANCE . Synchronized to guarantee singleton - ness of the field .
114
35
34,675
protected String getResourceId ( IPortletWindowId portletWindowId , final IPortalRequestInfo portalRequestInfo ) { final IPortletRequestInfo portletRequestInfo = portalRequestInfo . getPortletRequestInfo ( portletWindowId ) ; if ( portletRequestInfo == null ) { return null ; } return portletRequestInfo . getResourceId ...
The portlet resource request resourceId
80
7
34,676
protected final Object getEventSessionMutex ( HttpSession session ) { synchronized ( WebUtils . getSessionMutex ( session ) ) { SerializableObject mutex = ( SerializableObject ) session . getAttribute ( EVENT_SESSION_MUTEX ) ; if ( mutex == null ) { mutex = new SerializableObject ( ) ; session . setAttribute ( EVENT_SE...
Get a session scoped mutex specific to this class
99
11
34,677
public GroupForm getGroupForm ( String key ) { log . debug ( "Initializing group form for group key " + key ) ; // find the current version of this group entity IEntityGroup group = GroupService . findGroup ( key ) ; // update the group form with the existing group's main information GroupForm form = new GroupForm ( ) ...
Construct a group form for the group with the specified key .
204
12
34,678
public void deleteGroup ( String key , IPerson deleter ) { if ( ! canDeleteGroup ( deleter , key ) ) { throw new RuntimeAuthorizationException ( deleter , IPermission . DELETE_GROUP_ACTIVITY , key ) ; } log . info ( "Deleting group with key " + key ) ; // find the current version of this group entity IEntityGroup group...
Delete a group from the group store
153
7
34,679
public void updateGroupDetails ( GroupForm groupForm , IPerson updater ) { if ( ! canEditGroup ( updater , groupForm . getKey ( ) ) ) { throw new RuntimeAuthorizationException ( updater , IPermission . EDIT_GROUP_ACTIVITY , groupForm . getKey ( ) ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Updating group for...
Update the title and description of an existing group in the group store .
184
14
34,680
public void updateGroupMembers ( GroupForm groupForm , IPerson updater ) { if ( ! canEditGroup ( updater , groupForm . getKey ( ) ) ) { throw new RuntimeAuthorizationException ( updater , IPermission . EDIT_GROUP_ACTIVITY , groupForm . getKey ( ) ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Updating group mem...
Update the members of an existing group in the group store .
325
12
34,681
public void createGroup ( GroupForm groupForm , JsonEntityBean parent , IPerson creator ) { if ( ! canCreateMemberGroup ( creator , parent . getId ( ) ) ) { throw new RuntimeAuthorizationException ( creator , IPermission . CREATE_GROUP_ACTIVITY , groupForm . getKey ( ) ) ; } if ( log . isDebugEnabled ( ) ) { log . debu...
Create a new group under the specified parent . The new group will automatically be added to the parent group .
446
21
34,682
private void selectFormExecutionType ( final PortletExecutionReportForm report ) { if ( ! report . getExecutionTypeNames ( ) . isEmpty ( ) ) { // Already execution types set, do nothing return ; } report . getExecutionTypeNames ( ) . add ( ExecutionType . RENDER . name ( ) ) ; }
Select the XXXX execution type by default for the form
73
11
34,683
@ Override protected List < ColumnDescription > getColumnDescriptions ( PortletExecutionAggregationDiscriminator reportColumnDiscriminator , PortletExecutionReportForm form ) { int groupSize = form . getGroups ( ) . size ( ) ; int portletSize = form . getPortlets ( ) . size ( ) ; int executionTypeSize = form . getExecu...
Create column descriptions for the portlet report using the configured report labelling strategy .
249
16
34,684
@ Required public void setServerRegex ( String serverRegex ) { Validate . notBlank ( serverRegex ) ; this . serverRegex = serverRegex ; this . pattern = Pattern . compile ( this . serverRegex ) ; }
Sets the regular expression for the servers you want to select a profile for
53
15
34,685
public synchronized Name getServiceName ( ) { if ( size ( ) < 2 ) { return null ; } if ( cachedServiceName == null ) { cachedServiceName = getCompositeKey ( ) . getPrefix ( size ( ) - 1 ) ; } return cachedServiceName ; }
If the composite key is either empty or has a single node there is no service name .
61
18
34,686
protected String getMediaType ( HttpServletRequest req , HttpServletResponse res , PipelineEventReader < CharacterEventReader , CharacterEvent > pipelineEventReader ) { final String mediaType = pipelineEventReader . getOutputProperty ( OutputKeys . MEDIA_TYPE ) ; if ( mediaType != null ) { return mediaType ; } this . l...
Determine the media type to use for the response
113
11
34,687
protected Set < AggregatedGroupMapping > getGroupsForEvent ( PortalEvent event ) { final Set < AggregatedGroupMapping > groupMappings = new LinkedHashSet < AggregatedGroupMapping > ( ) ; if ( event instanceof LoginEvent ) { for ( final String groupKey : ( ( LoginEvent ) event ) . getGroups ( ) ) { final AggregatedGroup...
Get groups for the event
308
5
34,688
public static void finishedSession ( IPerson person ) { LOGGER . trace ( "Invoking finishedSession for IPerson [{}]" , person ) ; try { instance ( ) . ifinishedSession ( person ) ; } catch ( GroupsException ge ) { LOGGER . error ( "Error upon session finishing for person [{}]" , person , ge ) ; } }
Receives notice that the UserInstance has been unbound from the HttpSession . In response we remove the corresponding group member from the cache .
77
30
34,689
private void ifinishedSession ( IPerson person ) throws GroupsException { IGroupMember gm = getGroupMember ( person . getEntityIdentifier ( ) ) ; try { final EntityIdentifier entityIdentifier = gm . getEntityIdentifier ( ) ; EntityCachingService . getEntityCachingService ( ) . remove ( entityIdentifier . getType ( ) , ...
Receives notice that the UserInstance has been unbound from the HttpSession . In response we remove the corresponding group member from the cache . We use the roundabout route of creating a group member and then getting its EntityIdentifier because we need the EntityIdentifier for the group member which is cached not t...
127
75
34,690
@ Override public String generateToken ( final DynamicSkinInstanceData data ) { final PortletPreferences preferences = data . getPortletRequest ( ) . getPreferences ( ) ; int hash = 0 ; // Add the list of preference names to an ordered list so we can get reliable hashcode // calculations. final Map < String , String [ ...
Returns a String hashcode of the values for the portlet preferences that are configurable by the Dynamic Skin portlet . The hashcode is generated in a repeatable fashion by calculating it based on sorted portlet preference names . Though hashcode does not guarantee uniqueness from a practical perspective we ll have so ...
208
74
34,691
@ RenderMapping public String initializeView ( WebRequest webRequest , PortletRequest portletRequest , Model model , @ RequestParam ( required = false ) String initialFilter ) { this . setUpInitialView ( webRequest , portletRequest , model , initialFilter ) ; return "jsp/Marketplace/portlet/view" ; }
Returns a view of the marketplace landing page
72
8
34,692
public Map < String , Set < ? > > getRegistry ( final IPerson user , final PortletRequest req ) { Map < String , Set < ? > > registry = new TreeMap < String , Set < ? > > ( ) ; // Empty, or the set of categories that are permitted to // be displayed in the Portlet Marketplace (portlet) final Set < PortletCategory > per...
Returns a set of MarketplacePortletDefinitions . Supply a user to limit the set to only portlets the user can use . If user is null this will return all portlets . Setting user to null will superscede all other parameters .
232
49
34,693
public static void deleteNode ( Element compViewNode , IPerson person ) throws PortalException { String ID = compViewNode . getAttribute ( Constants . ATT_ID ) ; if ( ID . startsWith ( Constants . FRAGMENT_ID_USER_PREFIX ) ) // ilf node DeleteManager . addDeleteDirective ( compViewNode , ID , person ) ; else { // plf n...
Handles user requests to delete UI elements . For ILF owned nodes it delegates to the DeleteManager to add a delete directive . For PLF owned nodes it deletes the node outright .
159
38
34,694
private Set < String > detectInvalidFields ( final String name , final String fname , final Map < String , String > attributes ) { final Set < String > rslt = new HashSet <> ( ) ; // Name & Fname try { tenantService . validateName ( name ) ; // Fname is generated from name; the only way to // fix an invalid fname is to...
Returns a collection of invalid fields if any .
219
9
34,695
protected Map < D , SortedSet < T > > getDefaultGroupedColumnDiscriminatorMap ( F form ) { List < Long > groups = form . getGroups ( ) ; // Collections used to track the queried groups and the results final Map < D , SortedSet < T > > groupedAggregations = new TreeMap < D , SortedSet < T > > ( ( Comparator < ? super D ...
Default implementation to create a map of the report column discriminators based on the submitted form to collate the aggregation data into each column of a report when the only grouping parameter is AggregatedGroupMapping .
237
42
34,696
@ Override protected void doHeaders ( RenderRequest request , RenderResponse response ) { try { doDispatch ( request , response ) ; } catch ( IOException | PortletException ex ) { logger . error ( "Exception rendering headers for portlet " + getPortletName ( ) + ". Aborting doHeaders" , ex ) ; } }
Used by the render method to set the response properties and headers .
73
13
34,697
@ Override protected void doRenderService ( RenderRequest request , RenderResponse response ) throws Exception { super . doRenderService ( request , response ) ; }
Processes the actual dispatching to the handler for render requests .
32
13
34,698
@ Override public int purgeCacheEntries ( CacheEntryTag tag ) { final String tagType = tag . getTagType ( ) ; final Set < Ehcache > caches = taggedCaches . getIfPresent ( tagType ) ; // Tag exists in cache(s) if ( caches == null || caches . isEmpty ( ) ) { return 0 ; } int purgeCount = 0 ; // Iterate over each cache to...
Remove all cache entries with keys that have the specified tag
259
11
34,699
protected Set < CacheEntryTag > getTags ( Element element ) { final Object key = element . getObjectKey ( ) ; if ( key instanceof TaggedCacheEntry ) { return ( ( TaggedCacheEntry ) key ) . getTags ( ) ; } final Object value = element . getObjectValue ( ) ; if ( value instanceof TaggedCacheEntry ) { return ( ( TaggedCac...
Get the tags associated with the element
98
7