本文整理汇总了Java中org.eyeseetea.malariacare.database.model.Program类的典型用法代码示例。如果您正苦于以下问题:Java Program类的具体用法?Java Program怎么用?Java Program使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Program类属于org.eyeseetea.malariacare.database.model包,在下文中一共展示了Program类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: migrateProgramTable
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
private void migrateProgramTable(SQLiteDatabase database) {
ModelAdapter myAdapter = FlowManager.getModelAdapter(Program.class);
String programTable = "Program";
String programTempTable = "Program_temp";
//Create temporal table
String sql = myAdapter.getCreationQuery();
Log.d("DBMIGRATION", "old table " + sql);
sql = sql.replace(programTable, programTempTable);
Log.d("DBMIGRATION", "create temp table " + sql);
database.execSQL(sql);
//Insert the data in temporal table
String sqlCopy = "INSERT INTO " + programTempTable
+ "(id_program, uid, name, stage_uid) SELECT id_program, uid, name, programStage "
+ "FROM "
+ programTable;
database.execSQL(sqlCopy);
//Replace old table by new table with the new column name.
database.execSQL("DROP TABLE IF EXISTS " + programTable);
database.execSQL("ALTER TABLE " + programTempTable + " RENAME TO " + programTable);
}
示例2: getIndex
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
private int getIndex(Spinner spinner, String myString)
{
int index = 0;
for (int i=0;i<spinner.getCount();i++){
Object objectRow= spinner.getItemAtPosition(i);
String value="";
if(objectRow instanceof Program) {
value= ((Program) objectRow).getName();
}
if(objectRow instanceof OrgUnit) {
value= ((OrgUnit) objectRow).getName();
}
if (value.equalsIgnoreCase(myString)){
index = i;
break;
}
}
return index;
}
示例3: validateForm
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
private boolean validateForm(){
if (!isEverythingFilled()) {
new AlertDialog.Builder( getActivity())
.setTitle( getActivity().getApplicationContext().getString(R.string.dialog_title_missing_selection))
.setMessage( getActivity().getApplicationContext().getString(R.string.dialog_content_missing_selection))
.setPositiveButton(android.R.string.ok, null).create().show();
} else if (!orgUnitHierarchy.getLastSelected().getPrograms().contains((Program) programView.getSelectedItem())) {
new AlertDialog.Builder( getActivity())
.setTitle(getActivity().getApplicationContext().getString(R.string.dialog_title_incorrect_org_unit))
.setMessage(getActivity().getApplicationContext().getString(R.string.dialog_content_incorrect_org_unit))
.setPositiveButton(android.R.string.ok, null).create().show();
} else if (doesSurveyInProgressExist()) {
new AlertDialog.Builder( getActivity())
.setTitle(getActivity().getApplicationContext().getString(R.string.dialog_title_existing_survey))
.setMessage(getActivity().getApplicationContext().getString(R.string.dialog_content_existing_survey))
.setPositiveButton(android.R.string.ok, null).create().show();
} else {
return true;
}
return false;
}
示例4: filterPrograms
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
private List<Program> filterPrograms(OrgUnit selectedOrgUnit) {
List<Program> initProgram= new ArrayList<>();
for(Program orgUnitProgram: selectedOrgUnit.getPrograms()){
for(Program program:allProgramList ){
if(orgUnitProgram!=null && orgUnitProgram.equals(program))
initProgram.add(orgUnitProgram);
}
}
initProgram.add(0, programDefaultOption);
programView = (Spinner) llLayout.findViewById(R.id.program);
programView.setAdapter(new ProgramArrayAdapter( getActivity(), initProgram));
Program lastSelectedProgram= getLastSelectedProgram();
if(lastSelectedProgram!=null){
programView.setSelection(getIndex(programView, lastSelectedProgram.getName()));
}
return initProgram;
}
示例5: reloadSentSurveys
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
public void reloadSentSurveys() {
BaseServiceBundle data= (BaseServiceBundle) Session.popServiceValue(SurveyService.ALL_MONITOR_DATA_ACTION);
if(data!=null) {
surveysForGraphic = (List<Survey>)data.getModelList(Survey.class.getName());
//Remove the bad surveys.
Iterator<Survey> iter = surveysForGraphic.iterator();
while(iter.hasNext()){
Survey survey = iter.next();
if(!survey.hasMainScore()) {
iter.remove();
}
}
programs = (List<Program>)data.getModelList(Program.class.getName());
orgUnits = (List<OrgUnit>)data.getModelList(OrgUnit.class.getName());
reloadSurveys(surveysForGraphic,programs,orgUnits);
}
}
示例6: buildNonExistantCombinations
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
/**
* Builds brand new combinations for those orgunit + program without a planned item
*/
private void buildNonExistantCombinations() {
//Every orgunit
for(OrgUnit orgUnit:OrgUnit.list()){
//Each authorized program
for(Program program:orgUnit.getPrograms()){
String key=getSurveyKey(orgUnit,program);
Survey survey=surveyMap.get(key);
//Already built
if(survey!=null){
continue;
}
//NOT exists
survey=SurveyPlanner.getInstance().buildNext(orgUnit,program);
//Process like any other survey
findRightState(survey);
}
}
}
示例7: wipeDatabase
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
/**
* Deletes all data from the app database
*/
public static void wipeDatabase() {
Delete.tables(
Value.class,
Score.class,
Survey.class,
SurveySchedule.class,
OrgUnit.class,
OrgUnitLevel.class,
OrgUnitProgramRelation.class,
User.class,
QuestionOption.class,
Match.class,
QuestionRelation.class,
Question.class,
CompositeScore.class,
Option.class,
Answer.class,
Header.class,
Tab.class,
Program.class,
ServerMetadata.class,
Media.class
);
}
示例8: reloadSentFragment
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
private void reloadSentFragment() {
BaseServiceBundle sentDashboardBundle = new BaseServiceBundle();
Log.d(TAG,"getAllSentCompletedOrConflictSurveys (Thread:"+Thread.currentThread().getId()+")");
//Select surveys from sql
sentDashboardBundle.addModelList(Survey.class.getName(),Survey.getAllSentCompletedOrConflictSurveys());
sentDashboardBundle.addModelList(OrgUnit.class.getName(),OrgUnit.getAllOrgUnit());
sentDashboardBundle.addModelList(Program.class.getName(),Program.getAllPrograms());
//Since intents does NOT admit NON serializable as values we use Session instead
Session.putServiceValue(RELOAD_SENT_FRAGMENT_ACTION, sentDashboardBundle);
//Returning result to anyone listening
Intent resultIntent= new Intent(RELOAD_SENT_FRAGMENT_ACTION);
LocalBroadcastManager.getInstance(this).sendBroadcast(resultIntent);
}
示例9: getAllMonitorData
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
private void getAllMonitorData() {
Log.d(TAG,"getAllMonitorData (Thread:"+Thread.currentThread().getId()+")");
List<Program> programList=Program.getAllPrograms();
List<Survey> sentSurveys=Survey.getAllSentCompletedOrConflictSurveys();
List<OrgUnit> orgUnits=OrgUnit.list();
BaseServiceBundle monitorMap=new BaseServiceBundle();
monitorMap.addModelList(Survey.class.getName(),sentSurveys);
monitorMap.addModelList(Program.class.getName(),programList);
monitorMap.addModelList(OrgUnit.class.getName(),orgUnits);
//Since intents does NOT admit NON serializable as values we use Session instead
Session.putServiceValue(ALL_MONITOR_DATA_ACTION, monitorMap);
//Returning result to anyone listening
Intent resultIntent= new Intent(ALL_MONITOR_DATA_ACTION);
LocalBroadcastManager.getInstance(this).sendBroadcast(resultIntent);
}
示例10: onProgramSelected
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
public void onProgramSelected(Program program) {
Log.d(TAG, "onProgramSelected");
if (DashboardActivity.dashboardActivity.findViewById(R.id.dashboard_planning_orgunit).getVisibility() == View.VISIBLE) {
//hide plannedFragment layout and show plannedOrgUnitsFragment
orgUnitVisibility(View.GONE);
programVisibility(View.VISIBLE);
if (fragment == null)
fragment = new PlannedFragment();
FragmentTransaction ft = getFragmentTransaction();
ft.replace(R.id.dashboard_planning_init, fragment);
ft.commit();
if(program!=null){
((PlannedFragment)fragment).reloadFilter();
}
}
else
((PlannedFragment)fragment).reloadFilter();
}
示例11: setActionBarTitleForSurvey
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
public static void setActionBarTitleForSurvey(DashboardActivity dashboardActivity,Survey survey){
String title="";
String subtitle="";
int appNameColor = dashboardActivity.getResources().getColor(R.color.appNameColor);
String appNameColorString = String.format("%X", appNameColor).substring(2);
Program program = survey.getProgram();
if(survey.getOrgUnit().getName()!=null) {
title = survey.getOrgUnit().getName();
}
if(program.getName()!=null) {
subtitle = program.getName();
}
if(PreferencesState.getInstance().isVerticalDashboard()) {
setActionbarVerticalSurvey(dashboardActivity,title, subtitle);
}
else{
Spanned spannedTitle = Html.fromHtml(String.format("<font color=\"#%s\"><b>", appNameColorString) + title + "</b></font>");
setActionbarTitle(dashboardActivity,spannedTitle, subtitle);
}
}
示例12: createRealSdkProgram
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
public void createRealSdkProgram(){
//sdk program
goldenSdkProgram =new org.hisp.dhis.android.sdk.persistence.models.Program();
goldenSdkProgram.setName("KE HNQIS Family Planning");
goldenSdkProgram.setDisplayName("KE HNQIS Family Planning");
goldenSdkProgram.setCreated("2015-10-16T13:51:32.264+0000");
goldenSdkProgram.setLastUpdated("2016-02-24T18:02:55.963+0000");
//goldenSdkProgram.setAccess();//{"delete":false,"externalize":false,"manage":true,"read":true,"update":true,"write":true}
goldenSdkProgram.setTrackedEntity(null);
//goldenSdkProgram.setProgramType(new ProgramType("without_registration"));
goldenSdkProgram.setVersion(6);
goldenSdkProgram.setEnrollmentDateLabel(null);
goldenSdkProgram.setDescription(null);
goldenSdkProgram.setOnlyEnrollOnce(false);
goldenSdkProgram.setExtenalAccess(false);
goldenSdkProgram.setDisplayIncidentDate(false);
goldenSdkProgram.setIncidentDateLabel(null);
goldenSdkProgram.setRegistration(false);
goldenSdkProgram.setSelectEnrollmentDatesInFuture(false);
goldenSdkProgram.setDataEntryMethod(false);
goldenSdkProgram.setSingleEvent(false);
goldenSdkProgram.setIgnoreOverdueEvents(false);
goldenSdkProgram.setRelationshipFromA(false);
goldenSdkProgram.setSelectIncidentDatesInFuture(false);
}
示例13: cleanDB
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
public static void cleanDB(){
if(!databaseExists()){
return;
}
// Clean DB
Delete.tables(Question.class, CompositeScore.class, Option.class, Answer.class, Header.class, Tab.class, Program.class, OrgUnit.class, User.class, Value.class, Survey.class);
/*new Delete().from(Question.class).where(Condition.column(Question$Table.ID).isNotNull()).query();
new Delete().from(CompositeScore.class).where(Condition.column(CompositeScore$Table.ID).isNotNull()).query();;
new Delete().from(Option.class).where(Condition.column(Option$Table.ID).isNotNull()).query();;
new Delete().from(Answer.class).where(Condition.column(Answer$Table.ID).isNotNull()).query();;
new Delete().from(Header.class).where(Condition.column(Header$Table.ID).isNotNull()).query();;
new Delete().from(Tab.class).where(Condition.column(Tab$Table.ID).isNotNull()).query();;
new Delete().from(Program.class).where(Condition.column(Program$Table.ID).isNotNull()).query();;
new Delete().from(OrgUnit.class).where(Condition.column(OrgUnit$Table.ID).isNotNull()).query();;
new Delete().from(User.class).where(Condition.column(User$Table.ID).isNotNull()).query();;
new Delete().from(Value.class).where(Condition.column(Value$Table.ID).isNotNull()).query();;
new Delete().from(Survey.class).where(Condition.column(Survey$Table.ID).isNotNull()).query();;*/
}
示例14: onReceive
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "onReceive");
//Listening only intents from this method
if (SurveyService.RELOAD_SENT_FRAGMENT_ACTION.equals(intent.getAction())) {
BaseServiceBundle sentDashboardBundle = (BaseServiceBundle) Session.popServiceValue(SurveyService.RELOAD_SENT_FRAGMENT_ACTION);
orgUnitList = (List<OrgUnit>) sentDashboardBundle.getModelList(OrgUnit.class.getName());
programList = (List<Program>) sentDashboardBundle.getModelList(Program.class.getName());
surveys = (List<Survey>) sentDashboardBundle.getModelList(Survey.class.getName());
reloadSentSurveys(surveys);
if(!PreferencesState.getInstance().isNoneFilter()) {
initFilters();
}
}
}
示例15: reloadFilter
import org.eyeseetea.malariacare.database.model.Program; //导入依赖的package包/类
public void reloadFilter(){
CustomSpinner programSpinner = (CustomSpinner) DashboardActivity.dashboardActivity.findViewById(R.id.dashboard_planning_spinner_program);
Program selectedProgram=(Program) programSpinner.getSelectedItem();
if(selectedProgram!=null) {
loadProgram(selectedProgram);
}
adapter.notifyDataSetChanged();
}