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


Java Configuration类代码示例

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


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

示例1: UserModule

import org.hisp.dhis.client.sdk.core.common.network.Configuration; //导入依赖的package包/类
public UserModule(String serverUrl, String authority, String accountType) {
    this.authority = authority;
    this.accountType = accountType;

    if (!isEmpty(serverUrl)) {
        // it can throw exception in case if configuration has failed
        Configuration configuration = new Configuration(serverUrl);
        D2.configure(configuration).toBlocking().first();
    }
}
 
开发者ID:dhis2,项目名称:dhis2-android-eventcapture,代码行数:11,代码来源:UserModule.java

示例2: login

import org.hisp.dhis.client.sdk.core.common.network.Configuration; //导入依赖的package包/类
@Override
public void login(final Credentials credentials,
        final IDataSourceCallback<UserAccount> callback) {

    boolean isNetworkAvailable = isNetworkAvailable();

    if (!isNetworkAvailable) {
        callback.onError(new NetworkException());
    } else {

        Configuration configuration = new Configuration(credentials.getServerURL());

        D2.configure(configuration)
                .flatMap(
                        new Func1<Void, Observable<org.hisp.dhis.client.sdk.models.user
                                .UserAccount>>() {
                            @Override
                            public Observable<org.hisp.dhis.client.sdk.models.user.UserAccount>
                            call(
                                    Void aVoid) {
                                return D2.me().signIn(credentials.getUsername(),
                                        credentials.getPassword());
                            }
                        })
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<org.hisp.dhis.client.sdk.models.user.UserAccount>() {
                    @Override
                    public void call(
                            org.hisp.dhis.client.sdk.models.user.UserAccount dhisUserAccount) {
                        UserAccount userAccount = new UserAccount(credentials.getUsername(),
                                dhisUserAccount.getUId());
                        callback.onSuccess(userAccount);
                    }
                }, new Action1<Throwable>() {
                    @Override
                    public void call(Throwable throwable) {
                        Throwable throwableResult = mapThrowable(throwable);

                        callback.onError(throwableResult);
                    }
                });
    }
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:45,代码来源:UserAccountDhisSDKDataSource.java

示例3: login

import org.hisp.dhis.client.sdk.core.common.network.Configuration; //导入依赖的package包/类
@Override
public void login(final Credentials credentials,
        final IDataSourceCallback<UserAccount> callback) {

    boolean isNetworkAvailable = isNetworkAvailable();

    if (!isNetworkAvailable) {
        callback.onError(new NetworkException());
    } else {

        Configuration configuration = new Configuration(credentials.getServerURL());

        D2.configure(configuration)
                .flatMap(
                        new Func1<Void, Observable<org.hisp.dhis.client.sdk.models.user
                                .UserAccount>>() {
                            @Override
                            public Observable<org.hisp.dhis.client.sdk.models.user.UserAccount>
                            call(
                                    Void aVoid) {
                                return D2.me().signIn(credentials.getUsername(),
                                        credentials.getPassword());
                            }
                        })
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<org.hisp.dhis.client.sdk.models.user.UserAccount>() {
                    @Override
                    public void call(
                            org.hisp.dhis.client.sdk.models.user.UserAccount dhisUserAccount) {
                        UserAccount userAccount = new UserAccount(credentials.getUsername(), dhisUserAccount.getUId(),
                                credentials.isDemoCredentials());
                        callback.onSuccess(userAccount);
                    }
                }, new Action1<Throwable>() {
                    @Override
                    public void call(Throwable throwable) {
                        Throwable throwableResult = mapThrowable(throwable);

                        callback.onError(throwableResult);
                    }
                });
    }
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:45,代码来源:AuthenticationDhisSDKDataSource.java


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