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


Java OrganisationUnit类代码示例

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


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

示例1: pullData

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
public void pullData(PullFilters pullFilters, List<OrganisationUnit> organisationUnits,
        final Callback callback) {

    if (cancelPull) {
        callback.onCancel();
        return;
    }

    mPullRemoteDataSource.pullData(pullFilters, organisationUnits,
            new IDataSourceCallback<List<Event>>() {
                @Override
                public void onSuccess(List<Event> result) {
                    mPullControllerStrategy.onPullDataComplete(callback);
                }

                @Override
                public void onError(Throwable throwable) {
                    callback.onError(throwable);
                }
            });
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:22,代码来源:PullController.java

示例2: onPullDataComplete

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
@Override
public void onPullDataComplete(final IPullController.Callback callback) {
    ICredentialsRepository credentialsLocalDataSource = new CredentialsLocalDataSource();
    IOrganisationUnitRepository orgUnitDataSource = new OrganisationUnitRepository();
    IProgramRepository programLocalDataSource = new ProgramLocalDataSource();
    try {
        org.eyeseetea.malariacare.domain.entity.OrganisationUnit orgUnit =
                orgUnitDataSource.getUserOrgUnit(
                        credentialsLocalDataSource.getOrganisationCredentials());
        org.eyeseetea.malariacare.domain.entity.Program program = orgUnit.getProgram();
        programLocalDataSource.saveUserProgramId(program);
    } catch (Exception e) {
        e.printStackTrace();
        callback.onError(e);
    }
    mPullController.convertData(callback);
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:18,代码来源:PullControllerStrategy.java

示例3: syncMetaData

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
public Observable<List<Program>> syncMetaData() {
    Set<ProgramType> programTypes = new HashSet<>();
    programTypes.add(ProgramType.WITHOUT_REGISTRATION);

    return Observable.zip(userOrganisationUnitInteractor.pull(),
            userProgramInteractor.pull(ProgramFields.DESCENDANTS, programTypes),
            new Func2<List<OrganisationUnit>, List<Program>, List<Program>>() {
                @Override
                public List<Program> call(List<OrganisationUnit> units, List<Program> programs) {
                    if (syncDateWrapper != null) {
                        syncDateWrapper.setLastSyncedNow();
                    }
                    return programs;
                }
            });
}
 
开发者ID:dhis2,项目名称:dhis2-android-eventcapture,代码行数:17,代码来源:SyncWrapper.java

示例4: pullEvents

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
private void pullEvents(PullFilters filters, IPullSourceCallback callback) {
    Scheduler listThread = Schedulers.newThread();
    List<Program> sdkPrograms = D2.me().programs().list().subscribeOn(listThread)
            .observeOn(listThread).toBlocking().single();
    List<OrganisationUnit> sdkOrganisationUnits =
            D2.me().organisationUnits().list().subscribeOn(listThread)
                    .observeOn(listThread).toBlocking().single();

    if (!PullController.PULL_IS_ACTIVE) return;
    for (Program program : sdkPrograms) {
        for (OrganisationUnit organisationUnit : sdkOrganisationUnits) {
            for (Program orgunitProgram : organisationUnit.getPrograms()) {
                if (orgunitProgram.getUId().equals(program.getUId())) {
                    if (!PullController.PULL_IS_ACTIVE) return;

                    EventFilters eventFilters = new EventFilters();
                    eventFilters.setProgramUId(program.getUId());
                    eventFilters.setOrganisationUnitUId(organisationUnit.getUId());
                    eventFilters.setStartDate(filters.getStartDate());
                    eventFilters.setEndDate(filters.getEndDate());
                    eventFilters.setMaxEvents(filters.getMaxEvents());

                    Scheduler pullEventsThread = Schedulers.newThread();
                    D2.events().pull(eventFilters)
                            .subscribeOn(pullEventsThread)
                            .observeOn(pullEventsThread).toBlocking().single();
                }
            }
        }
    }
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:32,代码来源:PullDhisSDKDataSource.java

示例5: pullMetada

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
public void pullMetada(final PullFilters pullFilters, final Callback callback) {
    if (cancelPull) {
        callback.onCancel();
        return;
    }
    if(pullFilters.pullMetaData()) {
        mPullRemoteDataSource.pullMetadata(
                new IDataSourceCallback<List<OrganisationUnit>>() {
                    @Override
                    public void onSuccess(List<OrganisationUnit> organisationUnits) {
                        if (!pullFilters.downloadData() || pullFilters.pullDataAfterMetadata()) {
                            convertMetaData(callback);
                            callback.onComplete();
                        } else {
                            convertMetaData(callback);
                            pullData(pullFilters, organisationUnits, callback);
                        }
                    }

                    @Override
                    public void onError(Throwable throwable) {
                        callback.onError(throwable);
                    }
                });
    }
    else {
        if (pullFilters.downloadData()) {
            List<OrganisationUnit> organisationUnitsList = D2.me().organisationUnits().list().toBlocking().first();
            pullData(pullFilters, organisationUnitsList, callback);
        }
        else{
            callback.onComplete();
        }
    }
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:36,代码来源:PullController.java

示例6: pullMetadata

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
public void pullMetadata(final IDataSourceCallback<List<OrganisationUnit>> callback) {

        boolean isNetworkAvailable = isNetworkAvailable();

        if (!isNetworkAvailable) {
            callback.onError(new NetworkException());
        } else {
            new PullDhisSDKDataSourceStrategy().pullMetadata(mPullDhisSDKDataSourceStrategy, callback);
        }
    }
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:11,代码来源:PullDhisSDKDataSource.java

示例7: pullData

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
public void pullData(PullFilters pullFilters, List<OrganisationUnit> organisationUnits,
        IDataSourceCallback<List<Event>> callback) {
    boolean isNetworkAvailable = isNetworkAvailable();

    if (!isNetworkAvailable) {
        callback.onError(new NetworkException());
    } else {
        List<Event> events = new ArrayList<>();

        for (OrganisationUnit organisationUnit : organisationUnits) {
                if(pullFilters.getDataByOrgUnit() != null && !pullFilters.getDataByOrgUnit().equals("")){
                    if(!pullFilters.getDataByOrgUnit().equals(organisationUnit.getName())){
                        continue;
                    }
                }
                Scheduler pullEventsThread = Schedulers.newThread();

                EventFilters eventFilters = new EventFilters();

                eventFilters.setStartDate(pullFilters.getStartDate());
                eventFilters.setEndDate(pullFilters.getEndDate());
                eventFilters.setMaxEvents(pullFilters.getMaxEvents());

                eventFilters.setOrganisationUnitUId(organisationUnit.getUId());

                mPullDhisSDKDataSourceStrategy.setEventFilters(eventFilters);

                List<Event> eventsByOrgUnit = D2.events().pull(eventFilters)
                        .subscribeOn(pullEventsThread)
                        .observeOn(pullEventsThread)
                        .toBlocking()
                        .single();

                events.addAll(eventsByOrgUnit);
            }
            callback.onSuccess(events);
    }
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:39,代码来源:PullDhisSDKDataSource.java

示例8: pull

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
@Override
public void pull(PullFilters pullFilters, IPullController.Callback callback) {
    Log.d(TAG, "Starting PULL process...");
    callback.onStep(PullStep.METADATA);

    try {
        mPullController.populateMetadataFromCsvs(pullFilters.isDemo());
        mPullController.pullData(pullFilters, new ArrayList<OrganisationUnit>(), callback);
    } catch (Exception ex) {
        Log.e(TAG, "pull: " + ex.getLocalizedMessage());
        callback.onError(ex);
    }
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:14,代码来源:PullControllerStrategy.java

示例9: init

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
public Observable<Boolean> init(String eventUid) {
    return eventInteractor.get(eventUid)
            .switchMap(new Func1<Event, Observable<? extends Boolean>>() {
                @Override
                public Observable<? extends Boolean> call(final Event event) {
                    final OrganisationUnit organisationUnit = new OrganisationUnit();
                    final Program program = new Program();

                    organisationUnit.setUId(event.getOrgUnit());
                    program.setUId(event.getProgram());

                    return Observable.zip(loadRulesEngine(program),
                            eventInteractor.list(organisationUnit, program),
                            new Func2<RuleEngine, List<Event>, Boolean>() {
                                @Override
                                public Boolean call(RuleEngine engine, List<Event> events) {
                                    // assign rules engine
                                    ruleEngine = engine;
                                    currentEvent = event;

                                    // clear events map
                                    eventsMap.clear();

                                    // put all existing events into map
                                    eventsMap.putAll(ModelUtils.toMap(eventInteractor.list(
                                            organisationUnit, program).toBlocking().first()));

                                    // ruleEffectSubject = BehaviorSubject.create();
                                    ruleEffectSubject = ReplaySubject.createWithSize(1);
                                    ruleEffectSubject.subscribeOn(Schedulers.computation());
                                    ruleEffectSubject.observeOn(AndroidSchedulers.mainThread());

                                    return true;
                                }
                            });
                }
            });
}
 
开发者ID:dhis2,项目名称:dhis2-android-eventcapture,代码行数:39,代码来源:RxRulesEngine.java

示例10: listPickers

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
@Override
public void listPickers() {
    logger.d(TAG, "listPickers()");
    subscription.add(Observable.zip(
            userOrganisationUnitInteractor.list(),
            userProgramInteractor.list(),
            new Func2<List<OrganisationUnit>, List<Program>, Picker>() {
                @Override
                public Picker call(List<OrganisationUnit> units, List<Program> programs) {
                    return createPickerTree(units, programs);
                }
            })
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Action1<Picker>() {
                @Override
                public void call(Picker picker) {
                    if (selectorView != null) {
                        selectorView.showPickers(picker);
                    }
                }
            }, new Action1<Throwable>() {
                @Override
                public void call(Throwable throwable) {
                    logger.e(TAG, "Failed listing pickers.", throwable);
                }
            }));
}
 
开发者ID:dhis2,项目名称:dhis2-android-eventcapture,代码行数:29,代码来源:SelectorPresenterImpl.java

示例11: onMetadataSucceed

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
@Override
public void onMetadataSucceed(IDataSourceCallback callback,
        List<OrganisationUnit> organisationUnits) {
    callback.onSuccess(organisationUnits);
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:6,代码来源:PullDhisSDKDataSourceStrategy.java

示例12: pullMetadata

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
@Override
public void pullMetadata(final IPullDhisSDKDataSourceStrategy mPullDhisSDKDataSourceStrategy,
        final IDataSourceCallback<List<OrganisationUnit>> callback) {

}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:6,代码来源:PullDhisSDKDataSourceStrategy.java

示例13: onMetadataSucceed

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
@Override
public void onMetadataSucceed(final IDataSourceCallback callback,
        final List<OrganisationUnit> organisationUnits) {
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:5,代码来源:PullDhisSDKDataSourceStrategy.java

示例14: createPickerTree

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
private Picker createPickerTree(List<OrganisationUnit> units, List<Program> programs) {
    Map<String, OrganisationUnit> organisationUnitMap = ModelUtils.toMap(units);
    Map<String, Program> assignedProgramsMap = ModelUtils.toMap(programs);

    String chooseOrganisationUnit = selectorView != null ? selectorView
            .getPickerLabel(SelectorView.ID_CHOOSE_ORGANISATION_UNIT) : "";
    String chooseProgram = selectorView != null ? selectorView
            .getPickerLabel(SelectorView.ID_CHOOSE_PROGRAM) : "";

    if (selectorView != null &&
            (organisationUnitMap == null || organisationUnitMap.isEmpty())) {
        selectorView.showNoOrganisationUnitsError();
    }

    Picker rootPicker = new Picker.Builder()
            .hint(chooseOrganisationUnit)
            .build();
    for (String unitKey : organisationUnitMap.keySet()) {
        // creating organisation unit picker items
        OrganisationUnit organisationUnit = organisationUnitMap.get(unitKey);
        Picker organisationUnitPicker = new Picker.Builder()
                .id(organisationUnit.getUId())
                .name(organisationUnit.getDisplayName())
                .hint(chooseProgram)
                .parent(rootPicker)
                .build();

        if (organisationUnit.getPrograms() != null && !organisationUnit.getPrograms().isEmpty()) {
            for (Program program : organisationUnit.getPrograms()) {
                Program assignedProgram = assignedProgramsMap.get(program.getUId());

                if (assignedProgram != null && ProgramType.WITHOUT_REGISTRATION
                        .equals(assignedProgram.getProgramType())) {
                    Picker programPicker = new Picker.Builder()
                            .id(assignedProgram.getUId())
                            .name(assignedProgram.getDisplayName())
                            .parent(organisationUnitPicker)
                            .build();
                    organisationUnitPicker.addChild(programPicker);
                }
            }
        }
        rootPicker.addChild(organisationUnitPicker);
    }

    // set saved selections or default ones:
    if (sessionPreferences.getSelectedPickerUid(0) != null) {
        traverseAndSetSavedSelection(rootPicker);
    } else {
        // Traverse the tree. If there is a path with nodes
        // which have only one child, set default selection
        traverseAndSetDefaultSelection(rootPicker);
    }
    return rootPicker;
}
 
开发者ID:dhis2,项目名称:dhis2-android-eventcapture,代码行数:56,代码来源:SelectorPresenterImpl.java

示例15: pullMetadata

import org.hisp.dhis.client.sdk.models.organisationunit.OrganisationUnit; //导入依赖的package包/类
void pullMetadata(IPullDhisSDKDataSourceStrategy mPullDhisSDKDataSourceStrategy,  final IDataSourceCallback<List<OrganisationUnit>> callback); 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:2,代码来源:IPullDhisSDKDataSourceStrategy.java


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