Getting user aliases

	

	IInfoStore boInfoStore = null;
	IInfoStore boInfoStore2 = null;
	IInfoObject boIInfoObject = null;
	IInfoObject boIInfoObject2 = null;
	IInfoObjects boInfoObjects = null;
	IInfoObjects boInfoObjects2 = null;
	SDKException sdkException = null;
	IEnterpriseSession boEnterpriseSession = null;
	IPluginMgr boPluginMgr;
	IPluginInfo boPluginInfo;
	IUser boCurUser = null;
	IUserGroup boGroup = null;
	IUserAliases allias = null;

boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(
					USERNAME, PASSWORD, SERVER, AUTHTYPE);
			boInfoStore = (IInfoStore) boEnterpriseSession.getService("",
					"InfoStore");
	boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(
					USERNAME, PASSWORD, SERVER, AUTHTYPE);
			boInfoStore = (IInfoStore) boEnterpriseSession.getService("",
					"InfoStore");

public String[] getUserAliases(String userName) {
		String[] userCurrentAliases = new String[10];
		int arrLoc = 0;
		try {

			logger.debug("get user aliases ");

			boInfoStore = (IInfoStore) boEnterpriseSession.getService("",
					"InfoStore");

			IUserAliases allias = null;

			boInfoObjects = boInfoStore
					.query("Select * from CI_SYSTEMOBJECTS where SI_PROGID = 'CrystalEnterprise.User' and SI_NAME = '"
							+ userName + "'");

			allias = ((IUser) boInfoObjects.get(0)).getAliases();
			Iterator<IUserAlias> iterator = allias.iterator();
			while (iterator.hasNext()) {
				IUserAlias iUserAlias = (IUserAlias) iterator.next();
				userCurrentAliases[arrLoc] = iUserAlias.getName();
				arrLoc++;
			}
			
			

		} catch (SDKException e) {
			logger.error("get user aliases  " + userName );
		}
		return userCurrentAliases;
	}

Leave a Reply

Your email address will not be published. Required fields are marked *