Containsusergetname null

This preview shows page 127 - 131 out of 167 pages.

if(!userWithSpecifiedRole.values(). contains(user.getName())) { if(user.getDisplayName() == null) { userWithSpecifiedRole.put (user.getName(),user.getName()); } else { userWithSpecifiedRole.put (user.getName(), Content Template Developer Guide TeamSite (16.3) Page 127 of 167
Image of page 127
user.getDisplayName()); } } } } } else { //As vpath is null, we cannot get roles for the //user. So, just return an empty array Map defaultUsers = new HashMap<String,String>(); defaultUsers.put("$IW_AREAOWNER","AREAOWNER"); defaultUsers.put("$IW_USER","CURRENT USER"); return defaultUsers; } } catch(Exception e) { e.printStackTrace(); //Just ignore and go to next iteration. } } return userWithSpecifiedRole; } else { //If no role is specified return all users //Add default users also userNameList.put("$IW_AREAOWNER","AREAOWNER" userNameList.put("$IW_USER","CURRENT USER"); return userNameList; } } } // Code for the CSClientUtil.java, which is used in the MapUserPicker.java // file is as follows: package com.interwoven.datasource.examples; import java.util.Locale; import java.util.Map; import java.util.Properties; import com.interwoven.cssdk.access.CSAuthenticationException; import com.interwoven.cssdk.access.CSExpiredSessionException; import com.interwoven.cssdk.access.CSInvalidSessionStringException; import com.interwoven.cssdk.common.CSClient; import com.interwoven.cssdk.common.CSException; import com.interwoven.cssdk.common.CSRemoteException; import com.interwoven.cssdk.factory.CSFactory; import com.interwoven.cssdk.factory.CSFactoryInitializationException; Content Template Developer Guide TeamSite (16.3) Page 128 of 167
Image of page 128
import com.interwoven.log100.Logger; import com.interwoven.log100.LoggerFactory; /** * Utility class with a method to retrieve the CSClient object * from a session string corresponding to a user's session on the TeamSite * server. */ public class CSClientUtil { private static final Logger log = LoggerFactory.getLogger(CSClientUtil.class.getName()); public static final String SERVERNAME = "servername"; public static final String SERVICEBASEURL = "serviceBaseURL"; public static final String CSFACTORY = "csFactory"; public static final String LOCALE = "locale"; public static final String APPLICATION_CONTEXT = "appcontext"; /** * Retrieves the CSClient object for the given sessionString * @param sessionString * @param param should contain the following parameters as keys * servername * serviceBaseURL * csFactory * locale [Optional] * appcontext [Optional] * @return * @throws CSInvalidSessionStringException * @throws CSExpiredSessionException * @throws CSAuthenticationException * @throws CSRemoteException * @throws CSException * @throws CSFactoryInitializationException */ public static CSClient getCSClient(String sessionString, Map param) throws CSInvalidSessionStringException, CSExpiredSessionException, CSAuthenticationException, CSRemoteException, CSException, CSFactoryInitializationException { if(log.isDebugEnabled()) { log.debug("session string :"+sessionString); log.debug("map is :"+param); } Locale locale = null; String serverName = null; CSFactory factory = null; Content Template Developer Guide TeamSite (16.3) Page 129 of 167
Image of page 129
String appcontext = null; //Read the properties from the Map and set it to the Properties object Properties props = new Properties(); //TeamSite server name serverName= (String)param.get(SERVERNAME);
Image of page 130
Image of page 131

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture