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


Java PropertyManager类代码示例

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


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

示例1: checkValueAllowed

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
/** (non-Javadoc)
 *  @see org.javarosa.core.services.properties.IPropertyRules#checkValueAllowed(String, String)
 */
public boolean checkValueAllowed(String propertyName, String potentialValue) {
	if(CURRENT_LOCALE.equals(propertyName)) {
		return Localization.getGlobalLocalizerAdvanced().hasLocale(potentialValue);
	}
	ArrayList<String> prop = rules.get(propertyName);
    if(prop.size() != 0) {
        //Check whether this is a dynamic property
        if(prop.size() == 1 && checkPropertyAllowed(prop.get(0))) {
            // If so, get its list of available values, and see whether the potentival value is acceptable.
            return PropertyManager._().getProperty(prop.get(0)).contains(potentialValue);
        }
        else {
            return rules.get(propertyName).contains(potentialValue);
        }
    }
    else
        return true;
}
 
开发者ID:medic,项目名称:javarosa,代码行数:22,代码来源:JavaRosaPropertyRules.java

示例2: init

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
public void init() {
    if(reviewEnabled) {
        setImage(reviewRecent,"commcare.review.icon");
        reviewRecent = new ChoiceItem(Localization.get("commcare.review"), null, List.IMPLICIT);
        append(reviewRecent);
    }

    //serverSync.setImage(serverImage);

    if (CommCareProperties.TETHER_SYNC.equals(PropertyManager._().getSingularProperty(CommCareProperties.TETHER_MODE))) {
        setImage(serverSync,"server.sync.icon.normal");
        append(serverSync);
        setSync();
    } else if (!CommCareSense.isAutoSendEnabled()) {
        setImage(sendAllUnsent,"send.unsent.icon");
        append(sendAllUnsent);
        setSendUnsent();
    } else {
        setSendUnsent();
        if (isAdmin) {
            addCommand(admForceSend);
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:25,代码来源:CommCareHomeScreen.java

示例3: sendData

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
public void sendData(String messageId) {

        // The message needs to already be on the queue at this point, so we'll actually just trigger sending all unsent (rather than
        // just trying to send the individual form)

        J2MEDisplay.startStateWithLoadingScreen(new SendAllUnsentState () {
            protected SendAllUnsentController getController () {
                return new SendAllUnsentController(new CommCareHQResponder(PropertyManager._().getSingularProperty(JavaRosaPropertyRules.OPENROSA_API_LEVEL)));
            }

            public void done() {
                notifyUnsent();
                goHome();
            }
        });
    }
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:17,代码来源:CommCarePostFormEntryState.java

示例4: restore

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
public void restore() {
    J2MEDisplay.startStateWithLoadingScreen(new CommCareOTARestoreState() {

        public void cancel() {
            J2MEDisplay.startStateWithLoadingScreen(new CommCareFirstStartState());
        }

        public void done(boolean errorsOccurred) {
            PropertyManager._().setProperty(CommCareProperties.IS_FIRST_RUN, CommCareProperties.PROPERTY_NO);
            J2MEDisplay.startStateWithLoadingScreen(new CommCareLoginState());
        }

        public void commitSyncToken(String restoreID) {
            //Will be set on any created users if relevant.
        }

    });
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:19,代码来源:CommCareFirstStartState.java

示例5: getLoggedInUser

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
protected static User getLoggedInUser() {
    IStorageUtilityIndexed users = (IStorageUtilityIndexed)StorageManager.getStorage(User.STORAGE_KEY);


    if(CommCareSense.isAutoLoginEnabled()) {
        User user = (User)users.getRecordForValue(User.META_UID, PropertyManager._().getSingularProperty(CommCareProperties.LOGGED_IN_USER));
        return user;
    }

    IStorageIterator ui = users.iterate();

    User admin = null;
    while (ui.hasMore()) {
        User u = (User)ui.nextRecord();
        if (u.isAdminUser()) {
            admin = u;
        } else {
            return u;
        }
    }
    return admin;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:CommCareLoginState.java

示例6: getController

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
protected LoginController getController () {
    String ver = "CommCare " + CommCareUtil.getVersion(CommCareUtil.VERSION_MED);
    String[] extraText = (CommCareUtil.isTestingMode() ? new String[] {ver, "*** TEST BUILD ***"}
                                          : new String[] {ver});

    String passFormat = PropertyManager._().getSingularProperty(CommCareProperties.PASSWORD_FORMAT);

    return new LoginController(
            Localization.get("login.title"),
            PropertyManager._().getSingularProperty(CommCareProperties.LOGIN_IMAGE),
            extraText, CreateUserController.PASSWORD_FORMAT_ALPHA_NUMERIC.equals(passFormat) ?
                                          CreateUserController.PASSWORD_FORMAT_ALPHA_NUMERIC :
                                          CreateUserController.PASSWORD_FORMAT_NUMERIC,
                                          CommCareUtil.demoEnabled(),
                                          CommCareUtil.loginImagesEnabled());
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:17,代码来源:CommCareLoginState.java

示例7: editUsers

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
public void editUsers() {
    //2012-10-22 - ctsims - Disabling this for now unless you're in completely offline user mode.
    //There's no way to do it without an intermediate authentication otherwise.

    if(CommCareProperties.USER_REG_SKIP.equals(PropertyManager._().getSingularProperty(CommCareProperties.USER_REG_TYPE))) {
        J2MEDisplay.startStateWithLoadingScreen(new CommCareSelectState<User>(new UserEntity(), User.STORAGE_KEY) {

            public void cancel() {
                CommCareUtil.launchHomeState();
            }

            public void entitySelected(int id) {
                User u = (User)StorageManager.getStorage(User.STORAGE_KEY).read(id);
                J2MEDisplay.startStateWithLoadingScreen(new CommCareEditUserState(u,
                        !CommCareProperties.USER_REG_SKIP.equals(PropertyManager._().getSingularProperty(CommCareProperties.USER_REG_TYPE)),
                        PropertyManager._().getSingularProperty(JavaRosaPropertyRules.OPENROSA_API_LEVEL)));
            }
        });
    } else {
        J2MEDisplay.showError("Can't edit users", "User edit is disabled when using a server. Please edit the user online.");
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:23,代码来源:CommCareHomeState.java

示例8: setProperties

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
protected void setProperties() {

        //NOTE: These properties should all be properties which are not expected to
        //be set by the profile, otherwise the profile will need to override the existing property.
        //Put generic fallbacks into postProfile property intiializer below.
        PropertyManager._().addRules(new JavaRosaPropertyRules());
        PropertyManager._().addRules(new CommCareProperties());
        PropertyUtils.initalizeDeviceID();

        PropertyUtils.initializeProperty(CommCareProperties.IS_FIRST_RUN, CommCareProperties.PROPERTY_YES);
        PropertyManager._().setProperty(CommCareProperties.COMMCARE_VERSION, CommCareUtil.getVersion());
        PropertyUtils.initializeProperty(CommCareProperties.DEPLOYMENT_MODE, CommCareProperties.DEPLOY_DEFAULT);

        //NOTE: Don't put any properties here which should be able to be override inside of the app profile. Users
        //should be able to override most properties without forcing.
    }
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:17,代码来源:CommCareContext.java

示例9: postProfilePropertyInit

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
private void postProfilePropertyInit() {
    PropertyUtils.initializeProperty(FormManagerProperties.EXTRA_KEY_FORMAT, FormManagerProperties.EXTRA_KEY_LANGUAGE_CYCLE);
    PropertyUtils.initializeProperty(CommCareProperties.ENTRY_MODE, CommCareProperties.ENTRY_MODE_QUICK);

    PropertyUtils.initializeProperty(CommCareProperties.SEND_STYLE, CommCareProperties.SEND_STYLE_HTTP);
    PropertyUtils.initializeProperty(CommCareProperties.OTA_RESTORE_OFFLINE, "jr://file/commcare_ota_backup_offline.xml");
    PropertyUtils.initializeProperty(CommCareProperties.RESTORE_TOLERANCE, CommCareProperties.REST_TOL_LOOSE);
    PropertyUtils.initializeProperty(CommCareProperties.DEMO_MODE, CommCareProperties.DEMO_ENABLED);
    PropertyUtils.initializeProperty(CommCareProperties.TETHER_MODE, CommCareProperties.TETHER_PUSH_ONLY);
    PropertyUtils.initializeProperty(CommCareProperties.LOGIN_IMAGE, "jr://resource/icon.png");

    PropertyManager._().setProperty(CommCareProperties.COMMCARE_VERSION, CommCareUtil.getVersion());

    PropertyUtils.initializeProperty(CommCareProperties.USER_REG_TYPE, CommCareProperties.USER_REG_REQUIRED);

    PropertyUtils.initializeProperty(CommCareProperties.AUTO_UPDATE_FREQUENCY, CommCareProperties.FREQUENCY_NEVER);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:18,代码来源:CommCareContext.java

示例10: getBypassRef

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
public Reference getBypassRef() {
    try {
        String bypassRef = PropertyManager._().getSingularProperty(CommCareProperties.OTA_RESTORE_OFFLINE);
        if(bypassRef == null || bypassRef == "") {
            return null;
        }

        Reference bypass = ReferenceManager._().DeriveReference(bypassRef);
        if(bypass == null || !bypass.doesBinaryExist()) {
            return null;
        }
        return bypass;
    } catch(Exception e){
        e.printStackTrace();
        //It would be absurdly stupid if we couldn't OTA restore because of an error here
        return null;
    }

}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:20,代码来源:CommCareRestorer.java

示例11: fail

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
protected void fail(Exception e) {
    if(blockForResponse(CommCareStartupInteraction.failSafeText("commcare.fail", "There was an error, and CommCare could not be started. Do you want to see the debug information?"))) {
        if(blockForResponse(e.getMessage() + "\n" + CommCareStartupInteraction.failSafeText("commcare.fail.sendlogs", "Attempt to send logs?"), true)) {
            setMessage("Sending...");
            DeviceReportState logSubmit = new DeviceReportState(LogReportUtils.REPORT_FORMAT_FULL) {

                public String getDestURL() {
                    String url = PropertyManager._().getSingularProperty(LogPropertyRules.LOG_SUBMIT_URL);
                    if(url == null) {
                        url = CommCareContext._().getSubmitURL();
                    }
                    return url;
                }

                public void done() {
                    // TODO Auto-generated method stub
                    blockForResponse("Attempt made", false);
                    listener.onFailure();
                }
            };
            logSubmit.addSubReport(new ResourceTableSubreport(CommCareContext.RetrieveGlobalResourceTable()));
            logSubmit.start();
        }
    }
    listener.onFailure();
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:27,代码来源:CommCareInitializer.java

示例12: checkValueAllowed

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
/**
 * (non-Javadoc)
 *
 * @see org.javarosa.properties.IPropertyRules#checkValueAllowed(String,
 *      String)
 */
public boolean checkValueAllowed(String propertyName, String potentialValue) {
    if (PURGE_FREQ.equals(propertyName)) {
        return (parsePurgeFreq(potentialValue) != -1);
    }

    Vector prop = ((Vector) rules.get(propertyName));
    if (prop.size() != 0) {
        // Check whether this is a dynamic property
        if (prop.size() == 1
                && checkPropertyAllowed((String) prop.elementAt(0))) {
            // If so, get its list of available values, and see whether the
            // potential value is acceptable.
            return ((Vector) PropertyManager._().getProperty((String) prop.elementAt(0))).contains(potentialValue);
        } else {
            return ((Vector) rules.get(propertyName)).contains(potentialValue);
        }
    } else
        return true;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:26,代码来源:CommCareProperties.java

示例13: checkValueAllowed

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
/** (non-Javadoc)
 *  @see org.javarosa.properties.IPropertyRules#checkValueAllowed(String, String)
 */
public boolean checkValueAllowed(String propertyName, String potentialValue) {
    Vector prop = ((Vector)rules.get(propertyName));
    if(prop.size() != 0) {
        //Check whether this is a dynamic property
        if(prop.size() == 1 && checkPropertyAllowed((String)prop.elementAt(0))) {
            // If so, get its list of available values, and see whether the potentival value is acceptable.
            return ((Vector)PropertyManager._().getProperty((String)prop.elementAt(0))).contains(potentialValue);
        }
        else {
            return ((Vector)rules.get(propertyName)).contains(potentialValue);
        }
    }
    else
        return true;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:19,代码来源:FormManagerProperties.java

示例14: populateAdminUser

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
public static void populateAdminUser(MIDlet m) {
    IStorageUtility users = StorageManager.getStorage(User.STORAGE_KEY);

    boolean adminFound = false;
    IStorageIterator ui = users.iterate();
    while (ui.hasMore()) {
        User user = (User)ui.nextRecord();
        if (User.ADMINUSER.equals(user.getUserType())) {
            adminFound = true;
            break;
        }
    }

    // There is no admin user to update, so add the user
    if(!adminFound) {
        //TODO: Test for MIDlet-Jar-RSA-SHA1 or other signing mechanism before allowing the property to be pulled?
        String defaultFromEnvironment = m == null ? null : m.getAppProperty(ADMIN_PW_PROPERTY);

        User admin = new User("admin", defaultFromEnvironment != null ? defaultFromEnvironment : defaultPassword, PropertyUtils.genGUID(25), User.ADMINUSER);
        admin.setUuid(PropertyManager._().getSingularProperty("DeviceID"));

        users.write(admin);
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:25,代码来源:UserUtility.java

示例15: checkValueAllowed

import org.javarosa.core.services.PropertyManager; //导入依赖的package包/类
/**
 * (non-Javadoc)
 *
 * @see org.javarosa.properties.IPropertyRules#checkValueAllowed(String,
 *      String)
 */
public boolean checkValueAllowed(String propertyName, String potentialValue) {
    Vector prop = ((Vector) rules.get(propertyName));
    if (prop.size() != 0) {
        // Check whether this is a dynamic property
        if (prop.size() == 1
                && checkPropertyAllowed((String) prop.elementAt(0))) {
            // If so, get its list of available values, and see whether the
            // potential value is acceptable.
            return ((Vector)PropertyManager._().getProperty(
                            (String) prop.elementAt(0)))
                    .contains(potentialValue);
        } else {
            return ((Vector) rules.get(propertyName))
                    .contains(potentialValue);
        }
    } else
        return true;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:25,代码来源:FeedbackReportProperties.java


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