idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
151,900
public List < LocaleBean > getLocales ( Locale currentLocale ) { List < LocaleBean > locales = new ArrayList < > ( ) ; List < Locale > portalLocales = localeManagerFactory . getPortalLocales ( ) ; for ( Locale locale : portalLocales ) { if ( currentLocale != null ) { locales . add ( new LocaleBean ( locale , currentLoc...
Return a list of LocaleBeans matching the currently available locales for the portal .
151,901
public Locale getCurrentUserLocale ( PortletRequest request ) { final HttpServletRequest originalPortalRequest = this . portalRequestUtils . getPortletHttpRequest ( request ) ; IUserInstance ui = userInstanceManager . getUserInstance ( originalPortalRequest ) ; IUserPreferencesManager upm = ui . getPreferencesManager (...
Return the current user s locale .
151,902
public void updateUserLocale ( HttpServletRequest request , String localeString ) { IUserInstance ui = userInstanceManager . getUserInstance ( request ) ; IUserPreferencesManager upm = ui . getPreferencesManager ( ) ; final IUserProfile userProfile = upm . getUserProfile ( ) ; LocaleManager localeManager = userProfile ...
Update the current user s locale to match the selected locale . This implementation will update the session locale and if the user is not a guest will also update the locale in the user s persisted preferences .
151,903
public TenantOperationResponse importWithResources ( final ITenant tenant , final Set < Resource > resources ) { final Map < PortalDataKey , Set < BucketTuple > > importQueue ; try { importQueue = prepareImportQueue ( tenant , resources ) ; } catch ( Exception e ) { final TenantOperationResponse error = new TenantOpera...
High - level implementation method that brokers the queuing importing and reporting that is common to Create and Update .
151,904
private Map < PortalDataKey , Set < BucketTuple > > prepareImportQueue ( final ITenant tenant , final Set < Resource > templates ) throws Exception { final Map < PortalDataKey , Set < BucketTuple > > rslt = new HashMap < > ( ) ; Resource rsc = null ; try { for ( Resource r : templates ) { rsc = r ; if ( log . isDebugEn...
Loads dom4j Documents and sorts the entity files into the proper order for Import .
151,905
private void importQueue ( final ITenant tenant , final Map < PortalDataKey , Set < BucketTuple > > queue , final StringBuilder importReport ) throws Exception { final StandardEvaluationContext ctx = new StandardEvaluationContext ( ) ; ctx . setRootObject ( new RootObjectImpl ( tenant ) ) ; IDataTemplatingStrategy temp...
Imports the specified entities in the proper order .
151,906
public void updateCurrentUsername ( String newUsername ) { final String originalThreadName = originalThreadNameLocal . get ( ) ; if ( originalThreadName != null && newUsername != null ) { final Thread currentThread = Thread . currentThread ( ) ; final String threadName = getThreadName ( originalThreadName , newUsername...
Update the thread name to use the specified username . Useful for authentication requests where the username changes mid - request
151,907
public Set < Entity > search ( String entityType , String searchTerm ) { if ( StringUtils . isBlank ( entityType ) && StringUtils . isBlank ( searchTerm ) ) { return null ; } Set < Entity > results = new HashSet < Entity > ( ) ; EntityEnum entityEnum = EntityEnum . getEntityEnum ( entityType ) ; EntityIdentifier [ ] id...
External search thus case insensitive .
151,908
private IAuthorizationPrincipal getAuthorizationPrincipal ( Authentication authentication ) { final Object authPrincipal = authentication . getPrincipal ( ) ; logger . trace ( "getAuthorizationPrincipal -- authPrincipal=[{}]" , authPrincipal ) ; String username ; if ( authPrincipal instanceof UserDetails ) { UserDetail...
Prepare a uPortal IAuthorizationPrincipal based in the Spring principal
151,909
public final void setDuration ( int duration ) { if ( isComplete ( ) ) { this . getLogger ( ) . warn ( "{} is already closed, the new duration of {} will be ignored on: {}" , this . getClass ( ) . getSimpleName ( ) , duration , this ) ; return ; } this . duration = duration ; }
Set the duration of the interval
151,910
protected IEntityGroup createUportalGroupFromGrouperGroup ( WsGroup wsGroup ) { IEntityGroup iEntityGroup = new EntityGroupImpl ( wsGroup . getName ( ) , IPerson . class ) ; iEntityGroup . setName ( wsGroup . getDisplayName ( ) ) ; iEntityGroup . setDescription ( wsGroup . getDescription ( ) ) ; return iEntityGroup ; }
Construct an IEntityGroup from a Grouper WsGroup .
151,911
protected WsGroup findGroupFromKey ( String key ) { WsGroup wsGroup = null ; if ( key != null ) { GcFindGroups gcFindGroups = new GcFindGroups ( ) ; gcFindGroups . addGroupName ( key ) ; WsFindGroupsResults results = gcFindGroups . execute ( ) ; if ( results != null && results . getGroupResults ( ) != null && results ....
Find the Grouper group matching the specified key .
151,912
protected static String getStemPrefix ( ) { String uportalStem = GrouperClientUtils . propertiesValue ( STEM_PREFIX , false ) ; if ( ! StringUtils . isBlank ( uportalStem ) ) { if ( uportalStem . endsWith ( ":" ) ) { uportalStem = uportalStem . substring ( 0 , uportalStem . length ( ) - 1 ) ; } } return uportalStem ; }
Get the prefix for the stem containing uPortal groups . If this value is non - empty all groups will be required to be prefixed with the specified stem name .
151,913
public void perform ( ) throws PortalException { if ( nodeId . startsWith ( Constants . FRAGMENT_ID_USER_PREFIX ) ) { ParameterEditManager . removeParmEditDirective ( nodeId , name , person ) ; } else { Document plf = RDBMDistributedLayoutStore . getPLF ( person ) ; Element plfNode = plf . getElementById ( nodeId ) ; r...
Remove the parameter from a channel in both the ILF and PLF using the appropriate mechanisms for incorporated nodes versus owned nodes .
151,914
public static PortletCategoryBean create ( String id , String name , String description , Set < PortletCategoryBean > subcategories , Set < PortletDefinitionBean > portlets ) { return new PortletCategoryBean ( id , name , description , subcategories , portlets ) ; }
Creates a new bean based on the provided inputs .
151,915
@ PreAuthorize ( "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))" ) @ RequestMapping ( value = "/permissions/owners.json" , method = RequestMethod . GET ) public ModelAndView getOwners ( ) { List < IPermissionOwner > o...
Provide a JSON view of all known permission owners registered with uPortal .
151,916
@ PreAuthorize ( "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))" ) @ RequestMapping ( value = "/permissions/owners/{owner}.json" , method = RequestMethod . GET ) public ModelAndView getOwners ( @ PathVariable ( "owner...
Provide a detailed view of the specified IPermissionOwner . This view should contain a list of the owner s defined activities .
151,917
@ PreAuthorize ( "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))" ) @ RequestMapping ( value = "/permissions/activities.json" , method = RequestMethod . GET ) public ModelAndView getActivities ( @ RequestParam ( value ...
Provide a list of all registered IPermissionActivities . If an optional search string is provided the returned list will be restricted to activities matching the query .
151,918
@ PreAuthorize ( "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))" ) @ RequestMapping ( value = "/permissions/{activity}/targets.json" , method = RequestMethod . GET ) public ModelAndView getTargets ( @ PathVariable ( "...
Return a list of targets defined for a particular IPermissionActivity matching the specified search query .
151,919
@ PreAuthorize ( "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))" ) @ RequestMapping ( "/v5-5/permissions/assignments/users/{username}" ) public ModelAndView getAssignmentsForUser ( @ PathVariable ( "username" ) String...
Provides the collection of permission assignments that apply to the specified user optionally including inherited assignments .
151,920
private void setReportFormTabs ( final TabRenderReportForm report ) { if ( ! report . getTabs ( ) . isEmpty ( ) ) { return ; } final Set < AggregatedTabMapping > tabs = this . getTabs ( ) ; if ( ! tabs . isEmpty ( ) ) { report . getTabs ( ) . add ( tabs . iterator ( ) . next ( ) . getId ( ) ) ; } }
Set the tab names to have first selected by default
151,921
@ javax . annotation . Resource ( name = "dataFileIncludes" ) public void setDataFileIncludes ( Set < String > dataFileIncludes ) { this . dataFileIncludes = dataFileIncludes ; }
Ant path matching patterns that files must match to be included
151,922
private void importDataArchive ( final Resource resource , final ArchiveInputStream resourceStream , BatchImportOptions options ) { final File tempDir = Files . createTempDir ( ) ; try { ArchiveEntry archiveEntry ; while ( ( archiveEntry = resourceStream . getNextEntry ( ) ) != null ) { final File entryFile = new File ...
Extracts the archive resource and then runs the batch - import process on it .
151,923
private List < FutureHolder < ? > > waitForFutures ( final Queue < ? extends FutureHolder < ? > > futures , final PrintWriter reportWriter , final File reportDirectory , final boolean wait ) throws InterruptedException { final List < FutureHolder < ? > > failedFutures = new LinkedList < > ( ) ; for ( Iterator < ? exten...
Used by batch import and export to wait for queued tasks to complete . Handles fail - fast behavior if any of the tasks threw and exception by canceling all queued futures and logging a summary of the failures . All completed futures are removed from the queue .
151,924
public String setParameterValue ( String parameterName , String parameterValue ) { if ( parameterValue == null ) return null ; return ( String ) parameters . put ( parameterName , parameterValue ) ; }
Set a channel parameter value .
151,925
static void applyAndUpdateParmEditSet ( Document plf , Document ilf , IntegrationResult result ) { Element pSet = null ; try { pSet = getParmEditSet ( plf , null , false ) ; } catch ( Exception e ) { LOG . error ( "Exception occurred while getting user's DLM " + "paramter-edit-set." , e ) ; } if ( pSet == null ) return...
Get the parm edit set if any from the plf and process each edit command removing any that fail from the set so that the set is self cleaning .
151,926
private static boolean applyEdit ( Element edit , Document ilf ) { String nodeID = edit . getAttribute ( Constants . ATT_TARGET ) ; Element channel = ilf . getElementById ( nodeID ) ; if ( channel == null ) return false ; String parmName = edit . getAttribute ( Constants . ATT_NAME ) ; String parmValue = edit . getAttr...
Attempt to apply a single channel parameter edit command and return true if it succeeds or false otherwise . If the edit is disallowed or the target element no longer exists in the document the edit command fails and returns false .
151,927
private static Element getParmEditSet ( 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_PARM_SET ) ) return ( Element ) child ; c...
Get the parameter edits set if any stored in the root of the document or create it if passed - in create flag is true .
151,928
public static synchronized void addParmEditDirective ( String targetId , String name , String value , IPerson person ) throws PortalException { Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; Element parmSet = getParmEditSet ( plf , person , true ) ; NodeList edits = parmSet . getChildNodes ( ) ...
Create and append a parameter edit directive to parameter edits set for applying a user specified value to a named parameter of the incorporated channel represented by the passed - in target id . If one already exists for that node and that name then the value of the existing edit is changed to the passed - in value .
151,929
private static void addParmEditDirective ( String targetID , String name , String value , IPerson person , Document plf , Element parmSet ) throws PortalException { String ID = null ; try { ID = getDLS ( ) . getNextStructDirectiveId ( person ) ; } catch ( Exception e ) { throw new PortalException ( "Exception encounter...
This method does the actual work of adding a newly created parameter edit and adding it to the parameter edits set .
151,930
public static void removeParmEditDirective ( String targetId , String name , IPerson person ) throws PortalException { Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; Element parmSet = getParmEditSet ( plf , person , false ) ; if ( parmSet == null ) return ; NodeList edits = parmSet . getChildNo...
Remove a parameter edit directive from the parameter edits set for applying user specified values to a named parameter of an incorporated channel represented by the passed - in target id . If one doesn t exists for that node and that name then this call returns without any effects .
151,931
public static final < T > T dropTableIfExists ( JdbcOperations jdbcOperations , final String table , final Function < JdbcOperations , T > preDropCallback ) { LOGGER . info ( "Dropping table: " + table ) ; final boolean tableExists = doesTableExist ( jdbcOperations , table ) ; if ( tableExists ) { final T ret = preDrop...
Check if the named table exists if it does drop it calling the preDropCallback first
151,932
public static boolean doesTableExist ( JdbcOperations jdbcOperations , final String table ) { final boolean tableExists = jdbcOperations . execute ( new ConnectionCallback < Boolean > ( ) { public Boolean doInConnection ( Connection con ) throws SQLException , DataAccessException { final DatabaseMetaData metaData = con...
Check if the specified table exists
151,933
public int getPortalUID ( IPerson person , boolean createPortalData ) throws AuthorizationException { int uid ; String username = ( String ) person . getAttribute ( IPerson . USERNAME ) ; if ( PersonFactory . getGuestUsernames ( ) . contains ( username ) ) { uid = __getPortalUID ( person , createPortalData ) ; } else {...
Get the portal user ID for this person object .
151,934
private PortalUser getPortalUser ( final String userName ) { return jdbcOperations . execute ( ( ConnectionCallback < PortalUser > ) con -> { PortalUser portalUser = null ; PreparedStatement pstmt = null ; try { String query = "SELECT USER_ID FROM UP_USER WHERE USER_NAME=?" ; pstmt = con . prepareStatement ( query ) ; ...
Gets the PortalUser data store object for the specified user name .
151,935
@ RequestMapping ( params = "action=export" ) public ModelAndView getExportView ( PortletRequest request ) { Map < String , Object > model = new HashMap < String , Object > ( ) ; final Iterable < IPortalDataType > exportPortalDataTypes = this . portalDataHandlerService . getExportPortalDataTypes ( ) ; final List < IPor...
Display the entity export form view .
151,936
@ RequestMapping ( params = "action=delete" ) public ModelAndView getDeleteView ( PortletRequest request ) { Map < String , Object > model = new HashMap < String , Object > ( ) ; final Iterable < IPortalDataType > deletePortalDataTypes = this . portalDataHandlerService . getDeletePortalDataTypes ( ) ; final List < IPor...
Display the entity deletion form view .
151,937
public void validateEditDetails ( GroupForm group , MessageContext context ) { if ( StringUtils . isBlank ( group . getName ( ) ) ) { context . addMessage ( new MessageBuilder ( ) . error ( ) . source ( "name" ) . code ( "please.enter.name" ) . build ( ) ) ; } }
Validate the detail editing group view
151,938
public String getTypeAndIdHash ( ) { assert ( entityType != null ) ; assert ( id != null ) ; String idStr = id . replaceAll ( "\\W" , "__" ) ; return entityType . toString ( ) . toLowerCase ( ) + "_" + idStr ; }
Compute a hash based on type and ID to uniquely identify this bean . This method helps avoid the unlikely case where a group and person in the same principal list have the same ID .
151,939
private void filterAnalyticsGroups ( IGroupMember groupMember , JsonNode config , Map < String , Boolean > isMemberCache ) { if ( config == null ) { return ; } final JsonNode dimensionGroups = config . get ( "dimensionGroups" ) ; if ( dimensionGroups == null ) { return ; } for ( final Iterator < JsonNode > groupItr = d...
Remove groups from the AnalyticsConfig that the current user is not a member of
151,940
private boolean isMember ( IGroupMember groupMember , String groupName ) { try { IEntityGroup group = GroupService . findGroup ( groupName ) ; if ( group != null ) { return groupMember . isDeepMemberOf ( group ) ; } final EntityIdentifier [ ] results = GroupService . searchForGroups ( groupName , GroupService . SearchM...
Check if the user is a member of the specified group name
151,941
public void warnOnApathyKeyInMappings ( ) { if ( null != profileKeyForNoSelection && immutableMappings . containsKey ( profileKeyForNoSelection ) ) { logger . warn ( "Configured to treat profile key {} as apathy, " + "yet also configured to map that key to profile fname {}. Apathy wins. " + "This is likely just fine...
Log a warning when configured such that a profile key both means apathy and means a particular profile fname .
151,942
protected void chunkString ( final List < CharacterEvent > characterEvents , final CharSequence buffer , int patternIndex ) { for ( ; patternIndex < this . chunkingPatterns . length ; patternIndex ++ ) { final Pattern pattern = this . chunkingPatterns [ patternIndex ] ; final Matcher matcher = pattern . matcher ( buffe...
Breaks up the String into a List of CharacterEvents based on the configured Map of Patterns to CharacterEventSources
151,943
public IPerson getPerson ( HttpServletRequest request ) throws PortalSecurityException { if ( ! remoteUserSecurityContextFactory . isEnabled ( ) ) { return super . getPerson ( request ) ; } final HttpSession session = request . getSession ( false ) ; IPerson person = null ; if ( session != null ) { person = ( IPerson )...
Retrieve an IPerson object for the incoming request
151,944
public static String makeSafeFilename ( String filename ) { for ( final Map . Entry < Pattern , String > pair : REPLACEMENT_PAIRS . entrySet ( ) ) { final Pattern pattern = pair . getKey ( ) ; final Matcher matcher = pattern . matcher ( filename ) ; filename = matcher . replaceAll ( pair . getValue ( ) ) ; } for ( Patt...
Makes safe filename
151,945
@ SuppressWarnings ( "unchecked" ) protected < D extends CachedPortletResultHolder < T > , T extends Serializable > CacheState < D , T > getPortletCacheState ( HttpServletRequest request , IPortletWindow portletWindow , PublicPortletCacheKey publicCacheKey , Ehcache publicOutputCache , Ehcache privateOutputCache ) { fi...
Get the cached portlet data looking in both the public and then private caches returning the first found
151,946
@ PreAuthorize ( "hasPermission('ALL', 'java.lang.String', new org.apereo.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))" ) @ RequestMapping ( value = "/permissions/principals.json" , method = RequestMethod . GET ) public ModelAndView getPrincipals ( @ RequestParam ( value ...
Return a JSON view of the uPortal principals matching the supplied query string .
151,947
static Element appendChild ( Element plfChild , Element parent , boolean copyChildren ) { Document document = parent . getOwnerDocument ( ) ; Element copy = ( Element ) document . importNode ( plfChild , false ) ; parent . appendChild ( copy ) ; String id = copy . getAttribute ( Constants . ATT_ID ) ; if ( id != null &...
This method copies a plf node and any of its children into the passed in compViewParent .
151,948
private boolean isLocked ( Class entityType , String entityKey ) throws LockingException { return isLocked ( entityType , entityKey , null ) ; }
Answers if the entity represented by the entityType and entityKey already has a lock of some type .
151,949
public void renew ( IEntityLock lock , int duration ) throws LockingException { if ( isValid ( lock ) ) { Date newExpiration = getNewExpiration ( duration ) ; getLockStore ( ) . update ( lock , newExpiration ) ; ( ( EntityLockImpl ) lock ) . setExpirationTime ( newExpiration ) ; } else { throw new LockingException ( "C...
Extends the expiration time of the lock by some service - defined increment .
151,950
public PortletDefinitionForm createPortletDefinitionForm ( IPerson person , String portletId ) { IPortletDefinition def = portletDefinitionRegistry . getPortletDefinition ( portletId ) ; final PortletDefinitionForm form ; if ( def != null ) { form = new PortletDefinitionForm ( def ) ; form . setId ( def . getPortletDef...
Construct a new PortletDefinitionForm for the given IPortletDefinition id . If a PortletDefinition matching this ID already exists the form will be pre - populated with the PortletDefinition s current configuration . If the PortletDefinition does not yet exist a new default form will be created .
151,951
public void removePortletRegistration ( IPerson person , PortletDefinitionForm form ) { if ( ! hasLifecyclePermission ( person , form . getLifecycleState ( ) , form . getCategories ( ) ) ) { logger . warn ( "User '" + person . getUserName ( ) + "' attempted to remove portlet '" + form . getFname ( ) + "' without the pr...
Delete the portlet with the given portlet ID .
151,952
public boolean shouldDisplayLayoutLink ( IPerson person , PortletDefinitionForm form , String portletId ) { if ( ! form . isNew ( ) ) { return false ; } if ( form . getLifecycleState ( ) != PortletLifecycleState . PUBLISHED ) { return false ; } Map < String , String > layouts = fragmentAdminHelper . getAuthorizedDlmFra...
Check if the link to the Fragment admin portlet should display in the status message .
151,953
public String getFragmentAdminURL ( HttpServletRequest request ) { IPortalUrlBuilder builder = urlProvider . getPortalUrlBuilderByPortletFName ( request , PORTLET_FNAME_FRAGMENT_ADMIN_PORTLET , UrlType . RENDER ) ; IPortletUrlBuilder portletUrlBuilder = builder . getTargetedPortletUrlBuilder ( ) ; portletUrlBuilder . s...
Get the link to the fragment admin portlet .
151,954
public Set < String > getArbitraryPortletPreferenceNames ( PortletDefinitionForm form ) { PortletPublishingDefinition cpd = this . portletPublishingDefinitionDao . getChannelPublishingDefinition ( form . getTypeId ( ) ) ; Set < String > currentPrefs = new HashSet < > ( ) ; currentPrefs . addAll ( form . getPortletPrefe...
Get a list of the key names of the currently - set arbitrary portlet preferences .
151,955
public List < PortletApplicationDefinition > getPortletApplications ( ) { final PortletRegistryService portletRegistryService = portalDriverContainerServices . getPortletRegistryService ( ) ; final List < PortletApplicationDefinition > contexts = new ArrayList < > ( ) ; for ( final Iterator < String > iter = portletReg...
Retreive the list of portlet application contexts currently available in this portlet container .
151,956
private void copyAssertionAttributesToUserAttributes ( Assertion assertion ) { if ( ! copyAssertionAttributesToUserAttributes ) { return ; } if ( assertion . getPrincipal ( ) . getAttributes ( ) == null || assertion . getPrincipal ( ) . getAttributes ( ) . isEmpty ( ) ) { return ; } Map < String , List < Object > > att...
If enabled convert CAS assertion person attributes into uPortal user attributes .
151,957
public IBasicEntity get ( Class < ? extends IBasicEntity > type , String key ) throws CachingException { return EntityCachingServiceLocator . getEntityCachingService ( ) . get ( type , key ) ; }
Returns the cached entity identified by type and key .
151,958
public IBasicEntity get ( EntityIdentifier entityID ) throws CachingException { return EntityCachingServiceLocator . getEntityCachingService ( ) . get ( entityID . getType ( ) , entityID . getKey ( ) ) ; }
Returns the cached entity referred to by entityID .
151,959
public void remove ( Class < ? extends IBasicEntity > type , String key ) throws CachingException { EntityCachingServiceLocator . getEntityCachingService ( ) . remove ( type , key ) ; }
Removes the entity identified by type and key from the cache and notifies peer caches .
151,960
@ RequestMapping ( "VIEW" ) public String renderError ( RenderRequest request , RenderResponse response , ModelMap model ) throws Exception { HttpServletRequest httpRequest = this . portalRequestUtils . getPortletHttpRequest ( request ) ; IPortletWindowId currentFailedPortletWindowId = ( IPortletWindowId ) request . ge...
Render the error portlet view .
151,961
private String getAttributeValue ( Attributes attrs , int attribute ) throws NamingException { NamingEnumeration values = null ; String aValue = "" ; if ( ! isAttribute ( attribute ) ) return aValue ; Attribute attrib = attrs . get ( attributes [ attribute ] ) ; if ( attrib != null ) { for ( values = attrib . getAll ( ...
Return a single value of an attribute from possibly multiple values grossly ignoring anything else . If there are no values then return an empty string .
151,962
public UserProfile addUserProfile ( final IPerson person , final IUserProfile profile ) { final int userId = person . getID ( ) ; final int layoutId = getLayoutId ( person , profile ) ; return jdbcOperations . execute ( ( ConnectionCallback < UserProfile > ) con -> { String sQuery ; PreparedStatement pstmt = con . prep...
Add a user profile
151,963
private void createLayout ( HashMap layoutStructure , Document doc , Element root , int structId ) { while ( structId != 0 ) { LayoutStructure ls = ( LayoutStructure ) layoutStructure . get ( structId ) ; Element structure = getStructure ( doc , ls ) ; root . appendChild ( structure ) ; String id = structure . getAttri...
Create a layout
151,964
protected String getNextStructId ( final IPerson person , final String prefix ) { final int userId = person . getID ( ) ; return nextStructTransactionOperations . execute ( status -> jdbcOperations . execute ( new ConnectionCallback < String > ( ) { public String doInConnection ( Connection con ) throws SQLException , ...
Return the next available structure id for a user
151,965
private int getLayoutID ( final int userId , final int profileId ) { return jdbcOperations . execute ( ( ConnectionCallback < Integer > ) con -> { String query = "SELECT LAYOUT_ID " + "FROM UP_USER_PROFILE " + "WHERE USER_ID=? AND PROFILE_ID=?" ; int layoutId = 0 ; PreparedStatement pstmt = con . prepareStatement ( que...
Returns the current layout ID for the user and profile . If the profile doesn t exist or the layout_id field is null 0 is returned .
151,966
public static String getResourceAsURLString ( Class < ? > requestingClass , String resource ) throws ResourceMissingException { return getResourceAsURL ( requestingClass , resource ) . toString ( ) ; }
Returns the requested resource as a URL string .
151,967
public static InputStream getResourceAsStream ( Class < ? > requestingClass , String resource ) throws ResourceMissingException , IOException { return getResourceAsURL ( requestingClass , resource ) . openStream ( ) ; }
Returns the requested resource as a stream .
151,968
public static InputSource getResourceAsSAXInputSource ( Class < ? > requestingClass , String resource ) throws ResourceMissingException , IOException { URL url = getResourceAsURL ( requestingClass , resource ) ; InputSource source = new InputSource ( url . openStream ( ) ) ; source . setPublicId ( url . toExternalForm ...
Returns the requested resource as a SAX input source .
151,969
public static Document getResourceAsDocument ( Class < ? > requestingClass , String resource , boolean validate ) throws ResourceMissingException , IOException , ParserConfigurationException , SAXException { Document document = null ; InputStream inputStream = null ; try { DocumentBuilderFactory factoryToUse = null ; i...
Get the contents of a URL as an XML Document
151,970
public static Document getResourceAsDocument ( Class < ? > requestingClass , String resource ) throws ResourceMissingException , IOException , ParserConfigurationException , SAXException { return getResourceAsDocument ( requestingClass , resource , false ) ; }
Get the contents of a URL as an XML Document first trying to read the Document with validation turned on and falling back to reading it with validation turned off .
151,971
public static Properties getResourceAsProperties ( Class < ? > requestingClass , String resource ) throws ResourceMissingException , IOException { InputStream inputStream = null ; Properties props = null ; try { inputStream = getResourceAsStream ( requestingClass , resource ) ; props = new Properties ( ) ; props . load...
Get the contents of a URL as a java . util . Properties object
151,972
public static String getResourceAsString ( Class < ? > requestingClass , String resource ) throws ResourceMissingException , IOException { String line = null ; BufferedReader in = null ; StringBuffer sbText = null ; try { in = new BufferedReader ( new InputStreamReader ( getResourceAsStream ( requestingClass , resource...
Get the contents of a URL as a String
151,973
public void setContextParameters ( Map < String , String > principals , Map < String , String > credentials , String ctxName , ISecurityContext securityContext ) { if ( log . isDebugEnabled ( ) ) { final StringBuilder msg = new StringBuilder ( ) ; msg . append ( "Preparing to authenticate; setting parameters for conte...
Get the principal and credential for a specific context and store them in the context .
151,974
protected void publishRenderEvent ( IPortletWindow portletWindow , HttpServletRequest httpServletRequest , RenderPart renderPart , long executionTime , boolean cached ) { final IPortletWindowId portletWindowId = portletWindow . getPortletWindowId ( ) ; final IPortalRequestInfo portalRequestInfo = this . urlSyntaxProvid...
Publish the portlet render event
151,975
protected void publishResourceEvent ( IPortletWindow portletWindow , HttpServletRequest httpServletRequest , long executionTime , boolean usedBrowserCache , boolean usedPortalCache ) { final IPortletWindowId portletWindowId = portletWindow . getPortletWindowId ( ) ; this . portalEventFactory . publishPortletResourceExe...
Publish the portlet resource event
151,976
protected void enforceConfigPermission ( final HttpServletRequest httpServletRequest , final IPortletWindow portletWindow ) { Validate . notNull ( httpServletRequest , "Servlet request must not be null to determine remote user." ) ; Validate . notNull ( portletWindow , "Portlet window must not be null to determine its ...
Enforces config mode access control . If requesting user does not have CONFIG permission and the PortletWindow specifies config mode throws AuthorizationException . Otherwise does nothing .
151,977
public Object [ ] getAttributeValues ( String key ) { if ( userAttributes == null ) { return null ; } final List < Object > values = userAttributes . get ( key ) ; if ( values != null ) { return values . toArray ( ) ; } return null ; }
Returns multiple attributes for a key . If only one value exists it will be returned in an array of size one .
151,978
public void setAttribute ( String key , Object value ) { if ( value == null ) { setAttribute ( key , null ) ; } else { setAttribute ( key , Collections . singletonList ( value ) ) ; } }
Sets the specified attribute to a value .
151,979
public boolean isGuest ( ) { String userName = ( String ) getAttribute ( IPerson . USERNAME ) ; boolean isGuestUsername = PersonFactory . getGuestUsernames ( ) . contains ( userName ) ; boolean isAuthenticated = m_securityContext != null && m_securityContext . isAuthenticated ( ) ; return isGuestUsername && ! isAuthent...
Determines whether or not this person is a guest user .
151,980
public IEntityStore newInstance ( ) throws GroupsException { try { return new RDBMEntityStore ( ) ; } catch ( Exception ex ) { log . error ( "ReferenceEntityStoreFactory.newInstance(): " + ex ) ; throw new GroupsException ( ex ) ; } }
Return an instance of the entity store implementation .
151,981
protected Deque < XMLEvent > getAdditionalEvents ( XMLEvent event ) { final XMLEvent additionalEvent = this . getAdditionalEvent ( event ) ; if ( additionalEvent == null ) { return null ; } final Deque < XMLEvent > additionalEvents = new LinkedList < XMLEvent > ( ) ; additionalEvents . push ( additionalEvent ) ; return...
The Deque with the additional events WILL BE MODIFIED by the calling code .
151,982
protected String getStyleSheetName ( final HttpServletRequest request , PreferencesScope scope ) { final String stylesheetNameFromRequest ; if ( scope . equals ( PreferencesScope . STRUCTURE ) ) { stylesheetNameFromRequest = ( String ) request . getAttribute ( STYLESHEET_STRUCTURE_OVERRIDE_REQUEST_ATTRIBUTE ) ; } else ...
Returns the stylesheet name if overridden in the request object .
151,983
public void doLogout ( HttpServletRequest request , HttpServletResponse response ) throws IOException { String redirect = this . selectRedirectionUrl ( request ) ; final HttpSession session = request . getSession ( false ) ; if ( session != null ) { try { final IPerson person = personManager . getPerson ( request ) ; i...
Process the incoming request and response .
151,984
protected static void loadProps ( ) { PropertiesManager . props = new Properties ( ) ; try { String pfile = System . getProperty ( PORTAL_PROPERTIES_FILE_SYSTEM_VARIABLE ) ; if ( pfile == null ) { pfile = PORTAL_PROPERTIES_FILE_NAME ; } PropertiesManager . props . load ( PropertiesManager . class . getResourceAsStream ...
Load up the portal properties . Right now the portal properties is a simple . properties file with name value pairs . It may evolve to become an XML file later on .
151,985
public static String getProperty ( String name ) throws MissingPropertyException { if ( log . isTraceEnabled ( ) ) { log . trace ( "entering getProperty(" + name + ")" ) ; } if ( PropertiesManager . props == null ) loadProps ( ) ; String val = getPropertyUntrimmed ( name ) ; val = val . trim ( ) ; if ( log . isTraceEna...
Returns the value of a property for a given name . Any whitespace is trimmed off the beginning and end of the property value . Note that this method will never return null . If the requested property cannot be found this method throws an UndeclaredPortalException .
151,986
public static String getPropertyUntrimmed ( String name ) throws MissingPropertyException { if ( PropertiesManager . props == null ) loadProps ( ) ; if ( props == null ) { boolean alreadyReported = registerMissingProperty ( name ) ; throw new MissingPropertyException ( name , alreadyReported ) ; } String val = props . ...
Returns the value of a property for a given name including whitespace trailing the property value but not including whitespace leading the property value . An UndeclaredPortalException is thrown if the property cannot be found . This method will never return null .
151,987
private static boolean registerMissingProperty ( String name ) { final boolean previouslyReported = ! PropertiesManager . missingProperties . add ( name ) ; if ( ! previouslyReported && log . isInfoEnabled ( ) ) { log . info ( "Property [" + name + "] was requested but not found." ) ; } return previouslyReported ; }
Registers that a given property was sought but not found . Currently adds the property to the set of missing properties and logs if this is the first time the property has been requested .
151,988
public static String getProperty ( String name , String defaultValue ) { if ( PropertiesManager . props == null ) loadProps ( ) ; String returnValue = defaultValue ; try { returnValue = getProperty ( name ) ; } catch ( MissingPropertyException mpe ) { } return returnValue ; }
Get the value of the property with the given name . If the named property is not found returns the supplied default value . This error handling behavior makes this method attractive for use in static initializers .
151,989
public static boolean getPropertyAsBoolean ( final String name , final boolean defaultValue ) { if ( PropertiesManager . props == null ) loadProps ( ) ; boolean returnValue = defaultValue ; try { returnValue = getPropertyAsBoolean ( name ) ; } catch ( MissingPropertyException mpe ) { } return returnValue ; }
Get a property as a boolean specifying a default value . If for any reason we are unable to lookup the desired property this method returns the supplied default value . This error handling behavior makes this method suitable for calling from static initializers .
151,990
public static byte getPropertyAsByte ( final String name , final byte defaultValue ) { if ( PropertiesManager . props == null ) loadProps ( ) ; byte returnValue = defaultValue ; try { returnValue = getPropertyAsByte ( name ) ; } catch ( Throwable t ) { log . error ( "Could not retrieve or parse as byte property [" + na...
Get the value of the given property as a byte specifying a fallback default value . If for any reason we are unable to lookup the desired property this method returns the supplied default value . This error handling behavior makes this method suitable for calling from static initializers .
151,991
public static Version parseVersion ( String versionString ) { final Matcher versionMatcher = VERSION_PATTERN . matcher ( versionString ) ; if ( ! versionMatcher . matches ( ) ) { return null ; } final int major = Integer . parseInt ( versionMatcher . group ( 1 ) ) ; final int minor = Integer . parseInt ( versionMatcher...
Parse a version string into a Version object if the string doesn t match the pattern null is returned .
151,992
public static Version . Field getMostSpecificMatchingField ( Version v1 , Version v2 ) { if ( v1 . getMajor ( ) != v2 . getMajor ( ) ) { return null ; } if ( v1 . getMinor ( ) != v2 . getMinor ( ) ) { return Version . Field . MAJOR ; } if ( v1 . getPatch ( ) != v2 . getPatch ( ) ) { return Version . Field . MINOR ; } f...
Determine how much of two versions match . Returns null if the versions do not match at all .
151,993
public UrlStringBuilder setParameter ( String name , String ... values ) { this . setParameter ( name , values != null ? Arrays . asList ( values ) : null ) ; return this ; }
Sets a URL parameter replacing any existing parameter with the same name .
151,994
public UrlStringBuilder addParameter ( String name , String ... values ) { this . addParameter ( name , values != null ? Arrays . asList ( values ) : null ) ; return this ; }
Adds to a URL parameter if a parameter with the same name already exists its values are added to
151,995
public UrlStringBuilder setParameters ( String namespace , Map < String , List < String > > parameters ) { for ( final String name : parameters . keySet ( ) ) { Validate . notNull ( name , "parameter map cannot contain any null keys" ) ; } this . parameters . clear ( ) ; this . addParameters ( namespace , parameters ) ...
Removes all existing parameters and sets the contents of the specified Map as the parameters .
151,996
public UrlStringBuilder setPath ( String ... elements ) { Validate . noNullElements ( elements , "elements cannot be null" ) ; this . path . clear ( ) ; this . addPath ( elements ) ; return this ; }
Removes any existing path elements and sets the provided elements as the path
151,997
public UrlStringBuilder addPath ( String element ) { Validate . notNull ( element , "element cannot be null" ) ; this . path . add ( element ) ; return this ; }
Adds a single element to the path .
151,998
public UrlStringBuilder addPath ( String ... elements ) { Validate . noNullElements ( elements , "elements cannot be null" ) ; for ( final String element : elements ) { this . path . add ( element ) ; } return this ; }
Adds the provided elements to the path
151,999
@ SuppressWarnings ( "unchecked" ) protected Map < String , IPortletPreference > getSessionPreferences ( IPortletEntityId portletEntityId , HttpServletRequest httpServletRequest ) { final HttpSession session = httpServletRequest . getSession ( ) ; final Map < IPortletEntityId , Map < String , IPortletPreference > > por...
Gets the session - stored list of IPortletPreferences for the specified request and IPortletEntityId .