本文整理汇总了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()));
}
}
示例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;
}
示例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");
}
}
示例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;
}
示例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");
}
}
示例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() + "]");
}
}
}
示例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);
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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));
}