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


Java Entry类代码示例

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


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

示例1: getEntriesForCommand

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * @param commandId          the current command id
 * @param currentSessionData all of the datums already on the stack
 * @return A list of all of the form entry actions that are possible with the given commandId
 * and the given list of already-collected datums
 */
private Vector<Entry> getEntriesForCommand(String commandId,
                                           OrderedHashtable<String, String> currentSessionData) {
    for (Suite s : platform.getInstalledSuites()) {
        for (Menu m : s.getMenus()) {
            // We need to see if everything in this menu can be matched
            if (commandId.equals(m.getId())) {
                return getEntriesFromMenu(m, currentSessionData);
            }
        }

        if (s.getEntries().containsKey(commandId)) {
            Vector<Entry> entries = new Vector<Entry>();
            entries.addElement(s.getEntries().get(commandId));
            return entries;
        }
    }

    return new Vector<Entry>();
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:26,代码来源:CommCareSession.java

示例2: getEntriesFromMenu

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * Get all entries that correspond to commands listed in the menu provided.
 * Excludes entries whose data requirements aren't met by the 'currentSessionData'
 */
private Vector<Entry> getEntriesFromMenu(Menu menu,
                                         OrderedHashtable<String, String> currentSessionData) {
    Vector<Entry> entries = new Vector<Entry>();
    Hashtable<String, Entry> map = platform.getMenuMap();
    //We're in a menu we have a set of requirements which
    //need to be fulfilled
    for (String cmd : menu.getCommandIds()) {
        Entry e = map.get(cmd);
        if (e == null) {
            throw new RuntimeException("No entry found for menu command [" + cmd + "]");
        }
        if (entryRequirementsSatsified(e, currentSessionData)) {
            entries.addElement(e);
        }
    }
    return entries;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:22,代码来源:CommCareSession.java

示例3: getNeededData

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * Based on the current state of the session, determine what information is needed next to
 * proceed
 *
 * @return One of the session SessionFrame.STATE_* strings, or null if
 * the session does not need anything else to proceed
 */
public String getNeededData(EvaluationContext evalContext) {
    if (currentCmd == null) {
        return SessionFrame.STATE_COMMAND_ID;
    }

    Vector<Entry> entries = getEntriesForCommand(currentCmd, collectedDatums);
    String needDatum = getDataNeededByAllEntries(entries);

    if (needDatum != null) {
        return needDatum;
    } else if (entries.size() == 1
            && entries.elementAt(0) instanceof SyncEntry
            && ((SyncEntry)entries.elementAt(0)).getSyncPost().isRelevant(evalContext)) {
        return SessionFrame.STATE_SYNC_REQUEST;
    } else if (entries.size() > 1 || !entries.elementAt(0).getCommandId().equals(currentCmd)) {
        //the only other thing we can need is a form command. If there's
        //still more than one applicable entry, we need to keep going
        return SessionFrame.STATE_COMMAND_ID;
    } else {
        return null;
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:30,代码来源:CommCareSession.java

示例4: getForm

import org.commcare.suite.model.Entry; //导入依赖的package包/类
public String getForm() {
    if (this.currentXmlns != null) {
        return this.currentXmlns;
    }
    String command = getCommand();
    if (command == null) {
        return null;
    }

    Entry e = platform.getMenuMap().get(command);
    if (e.isView() || e.isSync()) {
        return null;
    } else {
        return ((FormEntry)e).getXFormNamespace();
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:17,代码来源:CommCareSession.java

示例5: getEvaluationContext

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * Retrieve an evaluation context in which to evaluate expressions in the context of a given
 * command in the installed app
 *
 * @param iif the instance initializer for the current platform
 * @return Evaluation context for a command in the installed app
 */
public EvaluationContext getEvaluationContext(InstanceInitializationFactory iif, String command) {
    if (command == null) {
        return new EvaluationContext(null);
    }
    Entry entry = getEntriesForCommand(command).elementAt(0);

    Hashtable<String, DataInstance> instancesInScope = entry.getInstances();

    for (Enumeration en = instancesInScope.keys(); en.hasMoreElements(); ) {
        String key = (String)en.nextElement();
        instancesInScope.put(key, instancesInScope.get(key).initialize(iif, key));
    }
    addInstancesFromFrame(instancesInScope);

    return new EvaluationContext(null, instancesInScope);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:24,代码来源:CommCareSession.java

示例6: launchRemoteSync

import org.commcare.suite.model.Entry; //导入依赖的package包/类
private void launchRemoteSync(AndroidSessionWrapper asw) {
    String command = asw.getSession().getCommand();
    Entry commandEntry = CommCareApplication.instance().getCommCarePlatform().getEntry(command);
    if (commandEntry instanceof RemoteRequestEntry) {
        PostRequest postRequest = ((RemoteRequestEntry)commandEntry).getPostRequest();
        Intent i = new Intent(getApplicationContext(), PostRequestActivity.class);
        i.putExtra(PostRequestActivity.URL_KEY, postRequest.getUrl());
        i.putExtra(PostRequestActivity.PARAMS_KEY,
                new HashMap<>(postRequest.getEvaluatedParams(asw.getEvaluationContext())));

        startActivityForResult(i, MAKE_REMOTE_POST);
    } else {
        // expected a sync entry; clear session and show vague 'session error' message to user
        clearSessionAndExit(asw, true);
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:17,代码来源:HomeScreenBaseActivity.java

示例7: IncompleteFormListAdapter

import org.commcare.suite.model.Entry; //导入依赖的package包/类
public IncompleteFormListAdapter(Context context,
                                 AndroidCommCarePlatform platform,
                                 FormRecordLoaderTask loader) {
    this.context = context;
    this.filter = null;
    this.loader = loader;

    loader.addListener(this);

    // create a mapping from form definition IDs to their entry point text
    for (Suite s : platform.getInstalledSuites()) {
        for (Enumeration en = s.getEntries().elements(); en.hasMoreElements(); ) {
            Entry entry = (Entry) en.nextElement();
            if (!(entry.isView() || entry.isRemoteRequest())) {
                String namespace = ((FormEntry)entry).getXFormNamespace();
                //Some of our old definitions for views still come in as entries with dead
                //namespaces for now, so check. Can clean up when FormEntry's enforce a
                //namespace invariant
                if(namespace != null) {
                    names.put(namespace, entry.getText());
                }
            }
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:26,代码来源:IncompleteFormListAdapter.java

示例8: getEntriesForCommand

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * @param commandId          the current command id
 * @param currentSessionData all of the datums already on the stack
 * @return A list of all of the form entry actions that are possible with the given commandId
 * and the given list of already-collected datums
 */
private Vector<Entry> getEntriesForCommand(String commandId,
                                           OrderedHashtable<String, String> currentSessionData) {
    Vector<Entry> entries = new Vector<>();
    if (commandId == null) {
        return entries;
    }
    for (Suite s : platform.getInstalledSuites()) {
        List<Menu> menusWithId = s.getMenusWithId(commandId);
        if (menusWithId != null) {
            for (Menu menu : menusWithId) {
                entries.addAll(getEntriesFromMenu(menu, currentSessionData));
            }
        }

        if (s.getEntries().containsKey(commandId)) {
            entries.addElement(s.getEntries().get(commandId));
        }
    }

    return entries;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:28,代码来源:CommCareSession.java

示例9: getEntriesFromMenu

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * Get all entries that correspond to commands listed in the menu provided.
 * Excludes entries whose data requirements aren't met by the 'currentSessionData'
 */
private Vector<Entry> getEntriesFromMenu(Menu menu,
                                         OrderedHashtable<String, String> currentSessionData) {
    Vector<Entry> entries = new Vector<>();
    Hashtable<String, Entry> map = platform.getMenuMap();
    //We're in a menu we have a set of requirements which
    //need to be fulfilled
    for (String cmd : menu.getCommandIds()) {
        Entry e = map.get(cmd);
        if (e == null) {
            throw new RuntimeException("No entry found for menu command [" + cmd + "]");
        }
        if (entryRequirementsSatsified(e, currentSessionData)) {
            entries.addElement(e);
        }
    }
    return entries;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:22,代码来源:CommCareSession.java

示例10: getNeededData

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * Based on the current state of the session, determine what information is needed next to
 * proceed
 *
 * @return One of the session SessionFrame.STATE_* strings, or null if
 * the session does not need anything else to proceed
 */
public String getNeededData(EvaluationContext evalContext) {
    if (currentCmd == null) {
        return SessionFrame.STATE_COMMAND_ID;
    }

    Vector<Entry> entries = getEntriesForCommand(currentCmd, collectedDatums);
    String needDatum = getDataNeededByAllEntries(entries);

    if (needDatum != null) {
        return needDatum;
    } else if (entries.isEmpty()) {
        throw new RuntimeException("Collected datums don't match required datums for entries at command " + currentCmd);
    } else if (entries.size() == 1
            && entries.elementAt(0) instanceof RemoteRequestEntry
            && ((RemoteRequestEntry)entries.elementAt(0)).getPostRequest().isRelevant(evalContext)) {
        return SessionFrame.STATE_SYNC_REQUEST;
    } else if (entries.size() > 1 || !entries.elementAt(0).getCommandId().equals(currentCmd)) {
        //the only other thing we can need is a form command. If there's
        //still more than one applicable entry, we need to keep going
        return SessionFrame.STATE_COMMAND_ID;
    } else {
        return null;
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:32,代码来源:CommCareSession.java

示例11: guessUnknownType

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * When StackFrameSteps are parsed, those that are "datum" operations will be marked as type
 * "unknown". When we encounter a StackFrameStep of unknown type at runtime, we need to
 * determine whether it should be interpreted as STATE_DATUM_COMPUTED, STATE_COMMAND_ID,
 * or STATE_DATUM_VAL This primarily affects the behavior of stepBack().
 *
 * The logic being employed is: If there is a previous step on the stack whose entries would
 * have added this command, interpret it as a command. If there is an EntityDatum that
 * was have added this as an entity selection, interpret this as a datum_val. O
 * Otherwise, interpret it as a computed datum.
 */
private String guessUnknownType(StackFrameStep popped) {
    String poppedId = popped.getId();
    for (StackFrameStep stackFrameStep : frame.getSteps()) {
        String commandId = stackFrameStep.getId();
        Vector<Entry> entries = getEntriesForCommand(commandId);
        for (Entry entry : entries) {
            String childCommand = entry.getCommandId();
            if (childCommand.equals(poppedId)) {
                return SessionFrame.STATE_COMMAND_ID;
            }
            Vector<SessionDatum> data = entry.getSessionDataReqs();
            for (SessionDatum datum : data) {
                if (datum instanceof EntityDatum &&
                        datum.getDataId().equals(poppedId)) {
                    return SessionFrame.STATE_DATUM_VAL;
                }
            }
        }
    }
    return SessionFrame.STATE_DATUM_COMPUTED;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:33,代码来源:CommCareSession.java

示例12: getForm

import org.commcare.suite.model.Entry; //导入依赖的package包/类
public String getForm() {
    if (this.currentXmlns != null) {
        return this.currentXmlns;
    }
    String command = getCommand();
    if (command == null) {
        return null;
    }

    Entry e = platform.getMenuMap().get(command);
    if (e.isView() || e.isRemoteRequest()) {
        return null;
    } else {
        return ((FormEntry)e).getXFormNamespace();
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:17,代码来源:CommCareSession.java

示例13: getEvaluationContext

import org.commcare.suite.model.Entry; //导入依赖的package包/类
/**
 * Retrieve an evaluation context in which to evaluate expressions in the context of a given
 * command in the installed app
 *
 * @param iif the instance initializer for the current platform
 * @return Evaluation context for a command in the installed app
 */
public EvaluationContext getEvaluationContext(InstanceInitializationFactory iif,
                                              String command,
                                              Set<String> instancesToInclude) {
    if (command == null) {
        return new EvaluationContext(null);
    }
    Vector<Entry> entries = getEntriesForCommand(command);

    if(entries.size() == 0) {
        return new EvaluationContext(null);
    }

    Entry entry = entries.elementAt(0);

    Hashtable<String, DataInstance> instancesInScope = entry.getInstances(instancesToInclude);

    for (Enumeration en = instancesInScope.keys(); en.hasMoreElements(); ) {
        String key = (String)en.nextElement();
        instancesInScope.put(key, instancesInScope.get(key).initialize(iif, key));
    }
    addInstancesFromFrame(instancesInScope, iif);

    return new EvaluationContext(null, instancesInScope);
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:32,代码来源:CommCareSession.java

示例14: handleInputAndUpdateSession

import org.commcare.suite.model.Entry; //导入依赖的package包/类
@Override
public boolean handleInputAndUpdateSession(CommCareSession session, String input) {
    try {
        int i = Integer.parseInt(input);
        String commandId;
        MenuDisplayable menuDisplayable = mChoices[i];
        if (menuDisplayable instanceof Entry) {
            commandId = ((Entry)menuDisplayable).getCommandId();
        } else {
            commandId = ((Menu)mChoices[i]).getId();
        }
        session.setCommand(commandId);
        return false;
    } catch (NumberFormatException e) {
        //This will result in things just executing again, which is fine.
    }
    return true;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:19,代码来源:MenuScreen.java

示例15: RecentFormEntity

import org.commcare.suite.model.Entry; //导入依赖的package包/类
public RecentFormEntity(Vector<Suite> suites) {
    names = new Hashtable<String,Text>();
    for(Suite s : suites) {
        for(Enumeration en = s.getEntries().elements(); en.hasMoreElements() ;) {
            Entry entry = (Entry)en.nextElement();
            if(!entry.isView()) {
                names.put(((FormEntry)entry).getXFormNamespace(),entry.getText());
            }
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:12,代码来源:RecentFormEntity.java


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