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


Java ProgramType类代码示例

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


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

示例1: getProgramsForOrganisationUnit

import org.hisp.dhis.client.sdk.models.program.ProgramType; //导入依赖的package包/类
public static List<ProgramFlow> getProgramsForOrganisationUnit(String UId,
        ProgramType... programType) {

    List<OrganisationUnitToProgramRelationFlow> organisationUnitProgramRelationships =
            new Select().from(OrganisationUnitToProgramRelationFlow.class).where(
                    OrganisationUnitToProgramRelationFlow_Table.organisationUnit.
                            is(UId)).queryList();

    List<ProgramFlow> programs = new ArrayList<ProgramFlow>();
    for (OrganisationUnitToProgramRelationFlow oupr : organisationUnitProgramRelationships) {
        if (programType != null) {
            for (ProgramType kind : programType) {
                if (oupr.getProgram() == null) {
                    continue;
                }
                List<ProgramFlow> plist = new Select().from(ProgramFlow.class).where(
                        ProgramFlow_Table.uId.is(oupr.getProgram().getUId()))
                        .and(
                                ProgramFlow_Table.programType.is(kind)).queryList();
                programs.addAll(plist);
            }
        }
    }
    return programs;
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:26,代码来源:SdkQueries.java

示例2: getProgramsForOrganisationUnit

import org.hisp.dhis.client.sdk.models.program.ProgramType; //导入依赖的package包/类
public static List<ProgramFlow> getProgramsForOrganisationUnit(String UId,
        ProgramType... programType) {

    List<OrganisationUnitToProgramRelationFlow> organisationUnitProgramRelationships =
            new Select().from(OrganisationUnitToProgramRelationFlow.class).where(
                    OrganisationUnitToProgramRelationFlow_Table.organisationUnit.
                            is(UId)).queryList();

    List<ProgramFlow> programs = new ArrayList<ProgramFlow>();
    for (OrganisationUnitToProgramRelationFlow oupr : organisationUnitProgramRelationships) {
        if (programType != null) {
            for (ProgramType kind : programType) {
                List<ProgramFlow> plist = new Select().from(ProgramFlow.class).where(
                        ProgramFlow_Table.id.is(oupr.getProgram().getId()))
                        .and(
                                ProgramFlow_Table.programType.is(kind)).queryList();
                programs.addAll(plist);
            }
        }
    }
    return programs;
}
 
开发者ID:EyeSeeTea,项目名称:pictureapp,代码行数:23,代码来源:SdkQueries.java

示例3: syncMetaData

import org.hisp.dhis.client.sdk.models.program.ProgramType; //导入依赖的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: buildOrgUnitProgramRelation

import org.hisp.dhis.client.sdk.models.program.ProgramType; //导入依赖的package包/类
/**
 * Due to permissions programs 'belongs' to a given orgunit and that relationship has a
 * productivity
 *
 * @param sdkOrganisationUnitExtended Extended sdk orgUnit (used to cache array with values)
 */
public void buildOrgUnitProgramRelation(OrganisationUnitExtended sdkOrganisationUnitExtended) {
    OrgUnit appOrgUnit = sdkOrganisationUnitExtended.getAppOrgUnit();
    Log.d(TAG, "buildOrgUnitProgramRelation " + appOrgUnit.getName());
    //Each assigned program
    for (ProgramExtended sdkProgramExtended : ProgramExtended.getExtendedList(
            SdkQueries.getProgramsForOrganisationUnit(appOrgUnit.getUid(),
                    ProgramType.WITHOUT_REGISTRATION))) {
        sdkProgramExtended.setAppProgram(programMapObjects.get(sdkProgramExtended.getUid()));

        addOrgUnitProgramRelation(sdkOrganisationUnitExtended, sdkProgramExtended);
    }
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:19,代码来源:ConvertFromSDKVisitor.java

示例5: convertDataValues

import org.hisp.dhis.client.sdk.models.program.ProgramType; //导入依赖的package包/类
/**
 * Turns events and datavalues into
 */
private void convertDataValues(ConvertFromSDKVisitor converter) {
    if (!PullController.PULL_IS_ACTIVE) return;
    callback.onStep(PullStep.PREPARING_SURVEYS);
    //XXX This is the right place to apply additional filters to data conversion (only
    // predefined orgunit for instance)
    //For each unit
    for (OrganisationUnitExtended organisationUnit : OrganisationUnitExtended.getExtendedList(
            SdkQueries.getAssignedOrganisationUnits())) {
        //Each assigned program
        for (ProgramExtended program : ProgramExtended.getExtendedList(
                SdkQueries.getProgramsForOrganisationUnit(organisationUnit.getId(),
                        ProgramType.WITHOUT_REGISTRATION))) {
            converter.actualProgram = program;
            List<EventExtended> events = EventExtended.getExtendedList(
                    SdkQueries.getEvents(organisationUnit.getId(), program.getUid()));
            System.out.printf("Converting surveys and values for orgUnit: %s | program: %s",
                    organisationUnit.getLabel(), program.getDisplayName());
            for (EventExtended event : events) {
                if (!PullController.PULL_IS_ACTIVE) return;
                if (event.getEventDate() == null
                        || event.getEventDate().equals("")) {
                    Log.d(TAG, "Alert, ignoring event without eventdate, event uid:"+event.getUid());
                    continue;
                }
                event.accept(converter);
            }
        }
    }

    //Plan surveys for the future
    SurveyPlanner.getInstance().buildNext();
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:36,代码来源:ConversionLocalDataSource.java

示例6: createPickerTree

import org.hisp.dhis.client.sdk.models.program.ProgramType; //导入依赖的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


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