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


Java StorageManager.getStorage方法代码示例

本文整理汇总了Java中org.javarosa.core.services.storage.StorageManager.getStorage方法的典型用法代码示例。如果您正苦于以下问题:Java StorageManager.getStorage方法的具体用法?Java StorageManager.getStorage怎么用?Java StorageManager.getStorage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.javarosa.core.services.storage.StorageManager的用法示例。


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

示例1: PeriodicWrapperState

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
/**
 * Creates a wrapper state ready for execution.
 *
 * @param descriptors All of the periodic events defined in the
 * current environment.
 */
public PeriodicWrapperState(PeriodicEvent[] descriptors) {

    now = new Date();

    d = new Hashtable<String, PeriodicEvent>();
    for(PeriodicEvent e : descriptors) {
        d.put(e.getEventKey(), e);
    }

    storage = StorageManager.getStorage(PeriodicEventRecord.STORAGE_KEY);
    toCheck = new Stack<Integer>();
    for(IStorageIterator i = storage.iterate(); i.hasMore(); ) {
        toCheck.addElement(DataUtil.integer(i.nextID()));
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:22,代码来源:PeriodicWrapperState.java

示例2: getLoggedInUser

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的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

示例3: createRmsSubreport

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
private void createRmsSubreport(XmlSerializer o, Vector errors) throws IOException {
    o.startTag(XMLNS, "rms_subreport");

    try {
    String[] utils = StorageManager.listRegisteredUtilities();
    for(int i = 0 ; i < utils.length ; ++ i) {
        //TODO: This is super hacky, revisit it
        Object storage = StorageManager.getStorage(utils[i]);
        if(storage instanceof WrappingStorageUtility) {
            storage = StorageUtilAccessor.getStorage((WrappingStorageUtility)storage);
        }
        if(storage instanceof XmlStatusProvider) {
            XmlStatusProvider util = (XmlStatusProvider)storage;
            try {
                util.getStatusReport(o, XMLNS);
            } catch(StatusReportException sre) {
                logError(errors, sre);
            }
        }
    }
    } finally {

        o.endTag(XMLNS, "rms_subreport");
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:26,代码来源:DeviceReportState.java

示例4: validateHouseholdID

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
public boolean validateHouseholdID (String hhid) {
    IStorageUtilityIndexed cases = (IStorageUtilityIndexed)StorageManager.getStorage(Case.STORAGE_KEY);
    Vector extidIDs = cases.getIDsForValue("external-id", hhid);
    Vector typeIDs = cases.getIDsForValue("case-type", "cc_case_house_visit");

    boolean found = false;
    //for each case with same ext id
    for (int i = 0; i < extidIDs.size(); i++) {
        int caseID = ((Integer)extidIDs.elementAt(i)).intValue();
        //if one of the cases is of the house_visit type, AND it's open, we have a dup
        if (typeIDs.contains(new Integer(caseID))) {
            Case c = (Case)cases.read(caseID);
            if (!c.isClosed()) {
                found = true;
                break;
            }
        }
    }
    return found;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:21,代码来源:HouseholdExistsFuncHandler.java

示例5: writeUserReport

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
private void writeUserReport(XmlSerializer serializer, Vector errors) throws IllegalArgumentException, IllegalStateException, IOException {
    IStorageUtility<User> userStorage = StorageManager.getStorage(User.STORAGE_KEY);
    serializer.startTag(XMLNS, "user_subreport");
    try{
        for(IStorageIterator<User> it = userStorage.iterate(); it.hasMore();) {
            User u = it.nextRecord();
            try {
                writeUser(serializer, errors, u);
            } catch(Exception e) {
                logError(errors, new StatusReportException(e,"user_subreport","Error writing user : " + u.getUsername() + "|" + u.getUniqueId()));
            }
        }
    } finally {
        serializer.endTag(XMLNS, "user_subreport");
    }

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

示例6: memoize

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
private void memoize() {
	if(payload == null) {
		IStorageUtility<FormInstance> instances = (IStorageUtility<FormInstance>) StorageManager.getStorage(FormInstance.STORAGE_KEY);
		try {
			FormInstance tree = instances.read(recordId);
			payload = serializer.createSerializedPayload(tree);
		} catch (IOException e) {
			//Assertion, do not catch!
			e.printStackTrace();
			throw new RuntimeException("ModelReferencePayload failed to retrieve its model from rms [" + e.getMessage() + "]");
		}
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:14,代码来源:ModelReferencePayload.java

示例7: NamespaceRetrievalMethod

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
public NamespaceRetrievalMethod(String namespace) {
    IStorageUtilityIndexed forms = (IStorageUtilityIndexed)StorageManager.getStorage(FormDef.STORAGE_KEY);
    int id;

    Vector IDs = forms.getIDsForValue("XMLNS", namespace);
    if (IDs.size() == 1) {
        id = ((Integer)IDs.elementAt(0)).intValue();
    } else {
        throw new RuntimeException("No form found with namespace [" + namespace + "]");
    }

    load(id);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:14,代码来源:NamespaceRetrievalMethod.java

示例8: formEntrySaved

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
public void formEntrySaved(FormDef form, FormInstance instanceData, boolean formWasCompleted) {
    if(formWasCompleted) {

        form.seal();

        logCompleted(instanceData);

        // This process will take place in three parts, in order to ensure that the server and client don't get
        // out of sync.


        // 1) First we'll ensure that a transport message or other off-line element can be created and
        // saved. This should establish that it will be sent from the device no matter what.

        //First, figure out what the submission action is
        SubmissionProfile profile = CommCareFormEntryState.getSubmissionProfile(form, instanceData);

        // Get the workflow that will be responsible for managing the flow of form sending
        FormTransportWorkflow workflow = getWorkflowFactory(profile);

        //Let the workflow perform its first action
        workflow.preProcessing(instanceData);


        // 2) Next we'll post process the data and manage any local information that should be handled on
        // the local device

        boolean save = postProcess(instanceData);
        if (save) {
            IStorageUtility instances = StorageManager.getStorage(FormInstance.STORAGE_KEY);
            instanceData.setDateSaved(new Date());
            instances.write(instanceData);
            postSaveProcess(instanceData);
        }
        // 3) Actually manage what to do after the data is processed locally
        workflow.postProcessing();
    } else {
        abort();
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:41,代码来源:CommCareFormEntryState.java

示例9: load

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
private void load(int id) {
    IStorageUtility forms = StorageManager.getStorage(FormDef.STORAGE_KEY);
    FormDef theForm = (FormDef)forms.read(id);

    if (theForm != null) {
        this.def = theForm;
    } else {
        String error = "Form loader couldn't retrieve form for ";
        error += " ID = " + id;
        throw new RuntimeException(error);
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:13,代码来源:NamespaceRetrievalMethod.java

示例10: getSavedFormInstance

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
public static FormInstance getSavedFormInstance(int formInstanceId) {
        IStorageUtility forms = StorageManager
                .getStorage(FormInstance.STORAGE_KEY);
        IStorageIterator fi = forms.iterate();
        while (fi.hasMore()) {
            FormInstance f = (FormInstance) fi.nextRecord();
            if (f.getID() == formInstanceId)
            {
                return f;
            }
        }
        return null;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:14,代码来源:JRDemoUtil.java

示例11: getSavedFormList

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
public static OrderedHashtable getSavedFormList() {
    savedFormList = new OrderedHashtable();
    IStorageUtility forms = StorageManager
            .getStorage(FormInstance.STORAGE_KEY);
    IStorageIterator fi = forms.iterate();
    while (fi.hasMore()) {
        FormInstance f = (FormInstance) fi.nextRecord();
        System.out.println("adding saved form: " + f.getID() + " - "
                + f.getName() + " - " + f.getFormId());
        savedFormList.put(new Integer(f.getID()), new SavedFormListItem(f.getName(),f.getFormId(),f.getID()) );
    }
    return savedFormList;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:14,代码来源:JRDemoUtil.java

示例12: getFormList

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
public static OrderedHashtable getFormList() {
    //if (formList == null) { No caching for now
        formList = new OrderedHashtable();
        IStorageUtility forms = StorageManager
                .getStorage(FormDef.STORAGE_KEY);
        IStorageIterator fi = forms.iterate();
        while (fi.hasMore()) {
            FormDef f = (FormDef) fi.nextRecord();
            formList.put(new Integer(f.getID()), f.getTitle());
        }
    //}
    return formList;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:14,代码来源:JRDemoUtil.java

示例13: loadTemplateInstance

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
/**
 * load a template instance fresh from the original FormDef, retrieved from RMS
 * @param formID
 * @return
 */
public static FormInstance loadTemplateInstance (int formID) {
	IStorageUtility forms = StorageManager.getStorage(FormDef.STORAGE_KEY);
	FormDef f = (FormDef)forms.read(formID);
	return (f != null ? f.getMainInstance() : null);
}
 
开发者ID:medic,项目名称:javarosa,代码行数:11,代码来源:CompactInstanceWrapper.java

示例14: PropertyManager

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
/**
 * Constructor for this PropertyManager
 */
public PropertyManager() {
	this.properties = (IStorageUtilityIndexed<? extends Externalizable>)StorageManager.getStorage(STORAGE_KEY);
	rulesList = new ArrayList<IPropertyRules>(0);
}
 
开发者ID:medic,项目名称:javarosa,代码行数:8,代码来源:PropertyManager.java

示例15: ModelRmsRetrievalMethod

import org.javarosa.core.services.storage.StorageManager; //导入方法依赖的package包/类
public ModelRmsRetrievalMethod(int modelId) {
    IStorageUtility instances = StorageManager.getStorage(FormInstance.STORAGE_KEY);
    construct((FormInstance)instances.read(modelId));
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:5,代码来源:ModelRmsRetrievalMethod.java


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