当前位置: 首页>>代码示例>>Java>>正文


Java SymphonyClient类代码示例

本文整理汇总了Java中org.symphonyoss.client.SymphonyClient的典型用法代码示例。如果您正苦于以下问题:Java SymphonyClient类的具体用法?Java SymphonyClient怎么用?Java SymphonyClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SymphonyClient类属于org.symphonyoss.client包,在下文中一共展示了SymphonyClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createChat

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
private Chat createChat(SymphonyClient senderClient, SymphonyClient receiverClient) throws
        StreamsException,
        UsersClientException {
    Chat chat = new Chat();
    chat.setLocalUser(senderClient.getLocalUser());
    Set<SymUser> remoteUsers = new HashSet<>();

    //You need to add both users because you are using the same chat object for both sender and receiver.
    remoteUsers.add(receiverClient.getLocalUser());
    remoteUsers.add(senderClient.getLocalUser());
    chat.setRemoteUsers(remoteUsers);
    chat.setStream(senderClient.getStreamsClient().getStream(remoteUsers));

    receiverClient.getChatService().addChat(chat);
    return chat;
}
 
开发者ID:symphonyoss,项目名称:symphony-java-sample-bots,代码行数:17,代码来源:EchoBotIT.java

示例2: sendMessage

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static void sendMessage(SymphonyClient client, Chat chat, String message)
        throws MessagesException {
    SymMessage messageSubmission = new SymMessage();
    messageSubmission.setMessageText(message);

    client.getChatService().addChat(chat);

    client.getMessageService().sendMessage(chat, messageSubmission);
}
 
开发者ID:symphonyoss,项目名称:symphony-java-sample-bots,代码行数:10,代码来源:Utils.java

示例3: getSymphonyClient

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static SymphonyClient getSymphonyClient(SymphonyClientConfig symphonyClientConfig) throws InitException, AuthenticationException {
    SymphonyClient symClient = SymphonyClientFactory.getClient(SymphonyClientFactory.TYPE.BASIC);
    String proxy = symphonyClientConfig.get("proxy.url");

    if (proxy == null) {
        symClient.init(symphonyClientConfig);
        return symClient;
    } else {
        ClientConfig clientConfig = new ClientConfig();
        clientConfig.connectorProvider(new ApacheConnectorProvider());
        clientConfig.property(ClientProperties.PROXY_URI, proxy);

        try {
            Client httpClient = CustomHttpClient.getClient(
                    symphonyClientConfig.get(SymphonyClientConfigID.USER_CERT_FILE),
                    symphonyClientConfig.get(SymphonyClientConfigID.USER_CERT_PASSWORD),
                    symphonyClientConfig.get(SymphonyClientConfigID.TRUSTSTORE_FILE),
                    symphonyClientConfig.get(SymphonyClientConfigID.TRUSTSTORE_PASSWORD),
                    clientConfig);
            symClient.init(httpClient, symphonyClientConfig);
            return symClient;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return symClient;
}
 
开发者ID:symphonyoss,项目名称:symphony-java-sample-bots,代码行数:28,代码来源:Utils.java

示例4: sendMessage

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static void sendMessage(String message, SymMessage.Format type, Long userID, SymphonyClient symClient) {
    SymMessage userMessage = new SymMessage();
    userMessage.setFormat(type);
    userMessage.setMessage(message);

    UserIdList list = new UserIdList();
    list.add(userID);
    try {
        symClient.getMessagesClient().sendMessage(symClient.getStreamsClient().getStream(list), userMessage);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:symphonyoss,项目名称:helpdesk-bot,代码行数:14,代码来源:Messenger.java

示例5: getChat

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static Chat getChat(Long userID, SymphonyClient symClient) {
    UserIdList list = new UserIdList();
    list.add(userID);
    Stream stream = null;
    try {
        stream = symClient.getStreamsClient().getStream(list);
    } catch (Exception e) {
        e.printStackTrace();
    }

    return symClient.getChatService().getChatByStream(stream.getId());
}
 
开发者ID:symphonyoss,项目名称:helpdesk-bot,代码行数:13,代码来源:Messenger.java

示例6: sendMessage

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public static void sendMessage(String message, SymMessage.Format type, String email, SymphonyClient symClient) {
    SymMessage userMessage = new SymMessage();
    userMessage.setFormat(type);
    userMessage.setMessage(message);

    try {
        symClient.getMessageService().sendMessage(email, userMessage);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:symphonyoss,项目名称:helpdesk-bot,代码行数:12,代码来源:Messenger.java

示例7: setSymphonyClient

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
@Override
public void setSymphonyClient(SymphonyClient symphonyClient) {
    this.symClient = symphonyClient;

}
 
开发者ID:symphonyoss,项目名称:symphony-java-client,代码行数:6,代码来源:IgniteUserCache.java

示例8: getSymClient

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public SymphonyClient getSymClient() {
    return symClient;
}
 
开发者ID:symphonyoss,项目名称:helpdesk-bot,代码行数:4,代码来源:AiResponder.java

示例9: AiResponder

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public AiResponder(SymphonyClient symClient) {
    this.symClient = symClient;
}
 
开发者ID:symphonyoss,项目名称:symphony-java-client,代码行数:4,代码来源:AiResponder.java

示例10: sendMessage

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
/**
 * Sends a message to a user
 *
 * @param message   the message received from the user
 * @param userID    the id of the user
 * @param symClient the org.org.symphonyoss.ai's sym client
 */

public void sendMessage(String message, Long userID, SymphonyClient symClient) {

    SymUser symUser = new SymUser();
    symUser.setId(userID);


    try {

        sendMessage(message, symClient.getStreamsClient().getStream(symUser), symClient);

    } catch (Exception e) {
        logger.error("Error sending message", e);
    }

}
 
开发者ID:symphonyoss,项目名称:symphony-java-client,代码行数:24,代码来源:AiResponder.java

示例11: AiCommandListener

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public AiCommandListener(SymphonyClient symClient) {
    this.symClient = symClient;
    aiResponder = new AiResponder(symClient);
}
 
开发者ID:symphonyoss,项目名称:symphony-java-client,代码行数:5,代码来源:AiCommandListener.java

示例12: isCommand

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
/**
 * A method that allows other classes to determine if a given message
 * matches a command in this command listener
 *
 * @param message   the message
 * @param symClient Symphony client
 * @return True if the message is a command
 */
@SuppressWarnings("unused")
public static boolean isCommand(SymMessage message, SymphonyClient symClient) {

    logger.debug("Received message for response.");

    MlMessageParser mlMessageParser;

    try {

        mlMessageParser = new MlMessageParser(symClient);
        mlMessageParser.parseMessage(message.getMessage());

        String[] chunks = mlMessageParser.getTextChunks();

        return chunks[0].charAt(0) == AiConstants.COMMAND;

    } catch (Exception e) {
        logger.error("Could not parse message {}", message.getMessage(), e);
    }

    return false;
}
 
开发者ID:symphonyoss,项目名称:symphony-java-client,代码行数:31,代码来源:AiCommandListener.java

示例13: getSymClient

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public SymphonyClient getSymClient() {
    return symClient;
}
 
开发者ID:symphonyoss,项目名称:symphony-java-client,代码行数:5,代码来源:AiCommandListener.java

示例14: ConnectionsService

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public ConnectionsService(SymphonyClient symClient) {
    this.symClient = symClient;
    connectionsWorker = new ConnectionsWorker(symClient, this);
    symClient.getMessageService().addConnectionsEventListener(this);
    new Thread(connectionsWorker,"ConnectionsWorker: "+symClient.getName()).start();
}
 
开发者ID:symphonyoss,项目名称:symphony-java-client,代码行数:7,代码来源:ConnectionsService.java

示例15: ConnectionsWorker

import org.symphonyoss.client.SymphonyClient; //导入依赖的package包/类
public ConnectionsWorker(SymphonyClient symClient, ConnectionsListener connectionsListener) {
    this.symClient = symClient;
    this.connectionsListener = connectionsListener;

}
 
开发者ID:symphonyoss,项目名称:symphony-java-client,代码行数:6,代码来源:ConnectionsWorker.java


注:本文中的org.symphonyoss.client.SymphonyClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。