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


Java User类代码示例

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


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

示例1: wipeDatabase

import org.eyeseetea.malariacare.database.model.User; //导入依赖的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
    );
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:28,代码来源:PopulateDB.java

示例2: onCreate

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    PreferencesState.getInstance().loadsLanguageInActivity();
    requestPermissions();
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    if (User.getLoggedUser() != null && !ProgressActivity.PULL_CANCEL &&  sharedPreferences.getBoolean(getApplicationContext().getResources().getString(R.string.pull_metadata),false)) {
        startActivity(new Intent(LoginActivity.this,
                ((Dhis2Application) getApplication()).getMainActivity()));
        finish();
    }
    ProgressActivity.PULL_CANCEL =false;
    EditText serverText = (EditText) findViewById(org.hisp.dhis.android.sdk.R.id.server_url);
    serverText.setText(R.string.login_info_dhis_default_server_url);
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:17,代码来源:LoginActivity.java

示例3: populateFromAssetsIfRequired

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
/**
 * Utility method to use while developing to avoid a real pull
 */
private void populateFromAssetsIfRequired() {
    //From server -> done
    if(PreferencesState.getInstance().getPullFromServer()) {
        return;
    }

    //Populate locally
    try{
        PullController.getInstance().wipeDatabase();
        User user = new User();
        user.save();
        Session.setUser(user);
        PopulateDB.populateDB(getAssets());
    }catch(Exception ex){
    }
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:20,代码来源:LoginActivity.java

示例4: cleanDB

import org.eyeseetea.malariacare.database.model.User; //导入依赖的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();;*/
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:19,代码来源:MalariaEspressoTest.java

示例5: getMainActivity

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
public Class<? extends Activity> getMainActivity() {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    if (User.getLoggedUser() != null && sharedPreferences.getBoolean(getApplicationContext().getResources().getString(R.string.pull_metadata),false)){
        return new DashboardActivity().getClass();
    }else if(!ProgressActivity.PULL_CANCEL) {
        return PreferencesState.getInstance().getMainActivity();
    }
    else{
        return LoginActivity.class;
    }

}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:13,代码来源:EyeSeeTeaApplication.java

示例6: initUserSessionIfRequired

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
/**
 * In case Session doesn't have the user set, here we set it to the first entry of User table
 */
private void initUserSessionIfRequired(){
    // already a user in session -> done
    if(Session.getUser()!=null){
        return;
    }

    // If we're in dashboard and User is not yet in session we have to put it
    // FIXME: for the moment there will be only one user in the User table, but in the future we will have to think about tagging the logged user in the DB
    User user = User.getLoggedUser();
    Session.setUser(user);
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:15,代码来源:DashboardActivity.java

示例7: getSafeUser

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
/**
 * Returns the name of the username avoiding NPE
 * @return
 */
private String getSafeUser(){
    User user = Session.getUser();
    if(user!=null){
        return user.getName();
    }
    return "";
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:12,代码来源:ConvertToSDKVisitor.java

示例8: getSafeUsername

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
/**
 * Returns the name of the username avoiding NPE
 * @return
 */
private String getSafeUsername(){
    User user = Session.getUser();
    if(user!=null){
        return user.getUsername();
    }
    return "";
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:12,代码来源:ConvertToSDKVisitor.java

示例9: visit

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
/**
 * Turns a sdk userAccount into a User
 * @param sdkUserAccountExtended
 */
@Override
public void visit(UserAccountExtended sdkUserAccountExtended) {
    UserAccount userAccount=sdkUserAccountExtended.getUserAccount();
    User appUser = new User();
    appUser.setUid(userAccount.getUId());
    appUser.setName(userAccount.getName());
    appUser.setUsername(userAccount.getUsername());
    appUser.save();
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:14,代码来源:ConvertFromSDKVisitor.java

示例10: postFinish

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
/**
 * Notifies that the pull is over
 */
private void postFinish() {
    //Fixme maybe it is not the best place to reload the logged user.(Without reload the user after pull, the user had diferent id and application crash).
    User user = User.getLoggedUser();
    Session.setUser(user);
    try {
        Dhis2Application.getEventBus().post(new SyncProgressStatus());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:14,代码来源:PullController.java

示例11: getCurrentUsername

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
public String getCurrentUsername(){
    User user=Session.getUser();
    if(user==null){
        return "";
    }
    String userName=user.getName();
    if(userName==null){
        return "";
    }
    return userName;
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:12,代码来源:ModuleController.java

示例12: mockSurveys

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
public static List<Survey> mockSurveys(int numOrgs, int numPrograms){
    List<OrgUnit> orgUnitList = new Select().all().from(OrgUnit.class).queryList();
    List<Program> programList = Program.list();
    Program program=programList.get(numPrograms);
    User user =getSafeUser();

    for(int i=0;i<numOrgs;i++){
        Survey survey=new Survey(orgUnitList.get(i%numOrgs),program,user);
        survey.save();
    }
    List<Survey> surveys = new Select().from(Survey.class).where(Condition.column(Survey$Table.ID_USER).eq(user.getId_user())).queryList();
    return surveys;
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:14,代码来源:MalariaEspressoTest.java

示例13: migrate

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
@Override
public void migrate(SQLiteDatabase database) {
    addColumn(database, User.class, "username", "string");
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:5,代码来源:Migration9AddUsername.java

示例14: getUser

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
public static User getUser() {
    if(user==null)
        user=User.getLoggedUser();
    return user;
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:6,代码来源:Session.java

示例15: setUser

import org.eyeseetea.malariacare.database.model.User; //导入依赖的package包/类
public static void setUser(User user) {
    Log.d(TAG,"setUser: "+user);
    Session.user = user;
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:5,代码来源:Session.java


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