本文整理汇总了Java中org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit类的典型用法代码示例。如果您正苦于以下问题:Java OrganisationUnit类的具体用法?Java OrganisationUnit怎么用?Java OrganisationUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrganisationUnit类属于org.hisp.dhis.android.sdk.persistence.models包,在下文中一共展示了OrganisationUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertOrgUnits
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
/**
* Turns sdk organisationUnit and levels into app info
* @param converter
* @return
*/
private boolean convertOrgUnits(ConvertFromSDKVisitor converter) {
postProgress(context.getString(R.string.progress_pull_preparing_orgs));
Log.i(TAG, "Converting organisationUnitLevels...");
List<OrganisationUnitLevel> organisationUnitLevels = MetaDataController.getOrganisationUnitLevels();
for(OrganisationUnitLevel organisationUnitLevel:organisationUnitLevels){
if(!ProgressActivity.PULL_IS_ACTIVE) return false;
OrganisationUnitLevelExtended organisationUnitLevelExtended = new OrganisationUnitLevelExtended(organisationUnitLevel);
organisationUnitLevelExtended.accept(converter);
}
Log.i(TAG, "Converting organisationUnits...");
List<OrganisationUnit> assignedOrganisationsUnits = MetaDataController.getAssignedOrganisationUnits();
for (OrganisationUnit assignedOrganisationsUnit : assignedOrganisationsUnits) {
if (!ProgressActivity.PULL_IS_ACTIVE) return false;
OrganisationUnitExtended organisationUnitExtended = new OrganisationUnitExtended(assignedOrganisationsUnit);
organisationUnitExtended.accept(converter);
}
Log.i(TAG,"Building orgunit hierarchy...");
return converter.buildOrgUnitHierarchy(assignedOrganisationsUnits);
}
示例2: convertDataValues
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
/**
* Turns events and datavalues into
*
* @param converter
*/
private void convertDataValues(ConvertFromSDKVisitor converter) {
if (!ProgressActivity.PULL_IS_ACTIVE) return;
postProgress(context.getString(R.string.progress_pull_surveys));
//XXX This is the right place to apply additional filters to data conversion (only predefined orgunit for instance)
//For each unit
for (OrganisationUnit organisationUnit : MetaDataController.getAssignedOrganisationUnits()) {
//Each assigned program
for (org.hisp.dhis.android.sdk.persistence.models.Program program : MetaDataController.getProgramsForOrganisationUnit(organisationUnit.getId(), ProgramType.WITHOUT_REGISTRATION)) {
converter.actualProgram=program;
List<Event> events = TrackerController.getEvents(organisationUnit.getId(), program.getUid());
Log.i(TAG, String.format("Converting surveys and values for orgUnit: %s | program: %s", organisationUnit.getLabel(), program.getDisplayName()));
for (Event event : events) {
if (!ProgressActivity.PULL_IS_ACTIVE) return;
if(event.getEventDate()==null || event.getEventDate().equals(""))
break;
EventExtended eventExtended = new EventExtended(event);
eventExtended.accept(converter);
}
}
}
//Plan surveys for the future
SurveyPlanner.getInstance().buildNext();
}
示例3: testSdkOrganisationUnit
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
private void testSdkOrganisationUnit(OrganisationUnit sdkOrganisationUnit) {
assertTrue(sdkOrganisationUnit.getLabel().equals(goldenOrganisationUnit.getLabel()));
assertTrue(sdkOrganisationUnit.getUuid().equals(goldenOrganisationUnit.getUuid()));
assertTrue(sdkOrganisationUnit.getLevel()== goldenOrganisationUnit.getLevel());
assertTrue(sdkOrganisationUnit.getParent().equals(goldenOrganisationUnit.getParent()));
assertTrue(sdkOrganisationUnit.getUuid().equals(goldenOrganisationUnit.getUuid()));
assertTrue(sdkOrganisationUnit.getLastUpdated().equals(goldenOrganisationUnit.getLastUpdated()));
assertTrue(sdkOrganisationUnit.getCreated().equals(goldenOrganisationUnit.getCreated()));
assertTrue(sdkOrganisationUnit.getName().equals(goldenOrganisationUnit.getName()));
assertTrue(sdkOrganisationUnit.getShortName().equals(goldenOrganisationUnit.getShortName()));
assertTrue(sdkOrganisationUnit.getDisplayName().equals(goldenOrganisationUnit.getDisplayName()));
assertTrue(sdkOrganisationUnit.getDisplayShortName().equals(goldenOrganisationUnit.getDisplayShortName()));
assertTrue(sdkOrganisationUnit.getExternalAccess().equals(goldenOrganisationUnit.getExternalAccess()));
assertTrue(sdkOrganisationUnit.getPath().equals(goldenOrganisationUnit.getPath()));
assertTrue(sdkOrganisationUnit.getFeatureType().equals(goldenOrganisationUnit.getFeatureType()));
assertTrue(sdkOrganisationUnit.getOpeningDate().equals(goldenOrganisationUnit.getOpeningDate()));
assertTrue(sdkOrganisationUnit.getDimensionItem().equals(goldenOrganisationUnit.getDimensionItem()));
testOrganisationUnitGroups(sdkOrganisationUnit);
testOrganisationUnitDataSets(sdkOrganisationUnit);
}
示例4: testSdkOrganisationUnit
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
private void testSdkOrganisationUnit(OrganisationUnit sdkOrganisationUnit) {
assertTrue(sdkOrganisationUnit.getLabel().equals(goldenOrganisationUnit.getLabel()));
assertTrue(sdkOrganisationUnit.getUId().equals(goldenOrganisationUnit.getUId()));
assertTrue(sdkOrganisationUnit.getLevel()== goldenOrganisationUnit.getLevel());
assertTrue(sdkOrganisationUnit.getParent().equals(goldenOrganisationUnit.getParent()));
assertTrue(sdkOrganisationUnit.getUId().equals(goldenOrganisationUnit.getUId()));
assertTrue(sdkOrganisationUnit.getLastUpdated().equals(goldenOrganisationUnit.getLastUpdated()));
assertTrue(sdkOrganisationUnit.getCreated().equals(goldenOrganisationUnit.getCreated()));
assertTrue(sdkOrganisationUnit.getName().equals(goldenOrganisationUnit.getName()));
assertTrue(sdkOrganisationUnit.getShortName().equals(goldenOrganisationUnit.getShortName()));
assertTrue(sdkOrganisationUnit.getDisplayName().equals(goldenOrganisationUnit.getDisplayName()));
assertTrue(sdkOrganisationUnit.getDisplayShortName().equals(goldenOrganisationUnit.getDisplayShortName()));
assertTrue(sdkOrganisationUnit.getExternalAccess().equals(goldenOrganisationUnit.getExternalAccess()));
assertTrue(sdkOrganisationUnit.getPath().equals(goldenOrganisationUnit.getPath()));
assertTrue(sdkOrganisationUnit.getFeatureType().equals(goldenOrganisationUnit.getFeatureType()));
assertTrue(sdkOrganisationUnit.getOpeningDate().equals(goldenOrganisationUnit.getOpeningDate()));
assertTrue(sdkOrganisationUnit.getDimensionItem().equals(goldenOrganisationUnit.getDimensionItem()));
}
示例5: visit
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
/**
* Turns a sdk organisationUnit into an app OrgUnit
*
* @param sdkOrganisationUnitExtended
*/
@Override
public void visit(OrganisationUnitExtended sdkOrganisationUnitExtended) {
//Create and save OrgUnitLevel
OrganisationUnit organisationUnit=sdkOrganisationUnitExtended.getOrgUnit();
OrgUnitLevel appOrgUnitLevel = orgUnitLevelMap.get(OrganisationUnitLevelExtended.buildKey(organisationUnit.getLevel()));
//create the orgUnit
org.eyeseetea.malariacare.database.model.OrgUnit appOrgUnit= new org.eyeseetea.malariacare.database.model.OrgUnit();
//Set name
if(organisationUnit.getLabel()==null)
appOrgUnit.setName(organisationUnit.getName());
else
appOrgUnit.setName(organisationUnit.getLabel());
//Set uid
appOrgUnit.setUid(organisationUnit.getId());
//Set orgUnitLevel
appOrgUnit.setOrgUnitLevel(appOrgUnitLevel);
//Since there is no guaranteed order in orgunits parent unit might not be yet converted or even pulled at all
//Thus building hierarchy must be done in a second step
appOrgUnit.save();
//Annotate built orgunit
orgUnitDict.put(organisationUnit.getId(), appOrgUnit);
//Associate programs
sdkOrganisationUnitExtended.setAppOrgUnit(appOrgUnit);
buildOrgUnitProgramRelation(sdkOrganisationUnitExtended);
}
示例6: getOrganisationUnit
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
/**
* Get an OU given its id
* @param id
* @return
*/
public static OrganisationUnit getOrganisationUnit(String id){
return new Select()
.from(OrganisationUnit.class)
.where(Condition.column(OrganisationUnit$Table.ID)
.eq(id))
.querySingle();
}
示例7: createRealOrganisationUnit
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
public void createRealOrganisationUnit(){
//Create program and organisationUnit to test the download and saved objects in SDK DB.
goldenOrganisationUnit =new OrganisationUnit();
goldenDataSets =new ArrayList<>();
goldenOrganisationUnitGroups =new ArrayList<>();
goldenOrganisationUnit.setId("QS7sK8XzdQc");
goldenOrganisationUnit.setLabel("KE - HNQIS SF pilot test facility 1");
goldenOrganisationUnit.setLevel(8);
goldenOrganisationUnit.setParent("spT8zFVQsvx");
goldenOrganisationUnit.setUuid("68c66a34-806f-49d1-9593-ba5d399ce95e");
goldenOrganisationUnit.setLastUpdated("2016-02-19T14:55:53.084+0000");
goldenOrganisationUnit.setCreated("2015-08-06T12:25:04.675+0000");
goldenOrganisationUnit.setName("KE - HNQIS SF pilot test facility 1");
goldenOrganisationUnit.setUser("NjbJCa6JkQu");
goldenOrganisationUnit.setShortName("KE - HNQIS SF pilot test facility 1");
goldenOrganisationUnit.setDisplayName("KE - HNQIS SF pilot test facility 1");
goldenOrganisationUnit.setDisplayShortName("KE - HNQIS SF pilot test facility 1");
goldenOrganisationUnit.setExternalAccess(false);
goldenOrganisationUnit.setPath("/FvUGp8I75zV/FhYFWRnrbkd/rP1W74RpNWF/AVqhgx4Ov2F/yp9x1IMVvcL/uJeWnsfj5EN/spT8zFVQsvx/QS7sK8XzdQc");
goldenOrganisationUnit.setFeatureType("NONE");
goldenOrganisationUnit.setOpeningDate("2015-08-06");//2015-08-06T00:00:00.000+0000
goldenOrganisationUnit.setDimensionItem("QS7sK8XzdQc");
goldenOrganisationUnitGroups.add("xdnfH7jiCUp");
goldenOrganisationUnitGroups.add("NAHlpJzIfbi");
goldenDataSets.add("oMlpyyPeJI1");
goldenDataSets.add("oaFG0Z4EFHo");
goldenDataSets.add("lI4BBizJsx0");
}
示例8: testOrganisationUnitDataSets
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
private void testOrganisationUnitDataSets(OrganisationUnit sdkOrganisationUnit) {
for(String organisationUnitDataSetUid: goldenDataSets) {
boolean isInSdk=false;
for (OrganisationUnitDataSet organisationUnitDataSetsSdk : OrganisationUnitExtended.getOrganisationUnitDataSets(sdkOrganisationUnit.getId())) {
if(organisationUnitDataSetsSdk.getDataSetId().equals(organisationUnitDataSetUid))
isInSdk=true;
}
assertTrue(isInSdk);
}
}
示例9: testOrganisationUnitGroups
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
private void testOrganisationUnitGroups(OrganisationUnit sdkOrganisationUnit) {
for(String organisationUnitGroupsUid: goldenOrganisationUnitGroups) {
boolean isInSdk=false;
for (OrganisationUnitGroup organisationUnitGroupsSdk : OrganisationUnitExtended.getOrganisationUnitGroups(sdkOrganisationUnit.getId())) {
if(organisationUnitGroupsSdk.getOrganisationUnitGroupId().equals(organisationUnitGroupsUid))
isInSdk=true;
}
assertTrue(isInSdk);
}
}
示例10: buildOrgUnitHierarchy
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
/**
* Builds the orgunit hierarchy whenever is possible
* @param assignedOrganisationsUnits
* @return
*/
public boolean buildOrgUnitHierarchy(List<OrganisationUnit> assignedOrganisationsUnits) {
for(OrganisationUnit organisationUnit:assignedOrganisationsUnits){
if(!ProgressActivity.PULL_IS_ACTIVE) return false;
OrgUnit appOrgUnit = orgUnitDict.get(organisationUnit.getId());
String parentUID=organisationUnit.getParent();
//FIXME: review this algorithm
if(parentUID==null) {
//path format=/VaXGMQY18R2/TyoXRBeZ12K/TeqzAowss4n/Doa9u6qkSO3/qeENMD3x6y7
//path[0] is ""
//path [1] is the last parent "VaXGMQY18R2"
String path = organisationUnit.getPath();
String[] pathUids = path.split("/");
if (pathUids.length > 2 && !pathUids[1].equals(organisationUnit.getId())) {
for (int i = 2; i < pathUids.length; i++) {
if (pathUids[i].equals(organisationUnit.getId())) {
parentUID = pathUids[i - 1];
Log.d(TAG, organisationUnit.getId() + " parent " + parentUID);
}
}
}
}
//No parent nothing to do
if(parentUID==null){
Log.i(TAG,String.format("%s is a root orgUnit",appOrgUnit.getName()));
continue;
}
//Find parent
OrgUnit parentOrgUnit = orgUnitDict.get(parentUID);
//Due to server permissions parent unit might not be loaded
if(parentOrgUnit==null){
Log.w(TAG,String.format("Cannot find parent orgunit for %s",appOrgUnit.getName()));
continue;
}
appOrgUnit.setOrgUnit(parentOrgUnit.getId_org_unit());
appOrgUnit.save();
}
return true;
}
示例11: OrganisationUnitExtended
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
public OrganisationUnitExtended(OrganisationUnit orgUnit){
this.orgUnit = orgUnit;
}
示例12: getOrgUnit
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
public OrganisationUnit getOrgUnit() {
return orgUnit;
}
示例13: getAllOrganisationUnits
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
public static List<OrganisationUnit> getAllOrganisationUnits() {
return new Select().all().from(OrganisationUnit.class).queryList();
}
示例14: getOrganisationUnit
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
public OrganisationUnit getOrganisationUnit() {
return organisationUnit;
}
开发者ID:dhis2,项目名称:dhis2-android-trackercapture,代码行数:4,代码来源:TrackedEntityInstanceDataEntryFragmentForm.java
示例15: setOrganisationUnit
import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit; //导入依赖的package包/类
public void setOrganisationUnit(OrganisationUnit organisationUnit) {
this.organisationUnit = organisationUnit;
}
开发者ID:dhis2,项目名称:dhis2-android-trackercapture,代码行数:4,代码来源:TrackedEntityInstanceDataEntryFragmentForm.java