Example usage for java.util Hashtable get

List of usage examples for java.util Hashtable get

Introduction

In this page you can find the example usage for java.util Hashtable get.

Prototype

@SuppressWarnings("unchecked")
public synchronized V get(Object key) 

Source Link

Document

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Usage

From source file:edu.ku.brc.specify.tasks.subpane.security.PrefsPermissionEnumerator.java

/**
 * Loads the Prefs and the Default Permissions from XML.
 *///from w  ww  . ja va 2  s .c o  m
protected void loadPrefs() {
    prefOptions = new ArrayList<SecurityOptionIFace>();
    try {
        Element root = XMLHelper.readDOMFromConfigDir("prefs_init.xml"); //$NON-NLS-1$
        if (root != null) {
            Hashtable<String, Hashtable<String, PermissionOptionPersist>> mainHash = BaseTask
                    .readDefaultPermsFromXML("prefsperms.xml");

            Node prefsNode = root.selectSingleNode("/prefs");
            String i18NResourceName = getAttr((Element) prefsNode, "i18nresname", (String) null);
            ResourceBundle resBundle = null;

            if (StringUtils.isNotEmpty(i18NResourceName)) {
                resBundle = UIRegistry.getResourceBundle(i18NResourceName);
            }

            List<?> sections = root.selectNodes("/prefs/section/pref"); //$NON-NLS-1$
            for (Iterator<?> iter = sections.iterator(); iter.hasNext();) {
                org.dom4j.Element pref = (org.dom4j.Element) iter.next();

                String name = getAttr(pref, "name", null);
                String title = getAttr(pref, "title", null);
                String iconName = getAttr(pref, "icon", null);

                if (StringUtils.isNotEmpty(name)) {
                    if (resBundle != null) {
                        try {
                            title = resBundle.getString(title);

                        } catch (MissingResourceException ex) {
                            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                            edu.ku.brc.exceptions.ExceptionTracker.getInstance()
                                    .capture(PrefsPermissionEnumerator.class, ex);
                            //log.error("Couldn't find key["+title+"]"); 
                        }
                    }

                    SecurityOption securityOption = new SecurityOption(name, title, "Prefs", iconName);
                    prefOptions.add(securityOption);

                    if (mainHash != null) {
                        Hashtable<String, PermissionOptionPersist> hash = mainHash.get(name);
                        if (hash != null) {
                            for (PermissionOptionPersist pp : hash.values()) {
                                PermissionIFace defPerm = pp.getDefaultPerms();
                                securityOption.addDefaultPerm(pp.getUserType(), defPerm);
                            }
                        }
                    }
                }
            }
        }
    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(PrefsPermissionEnumerator.class, ex);
        ex.printStackTrace();
    }
}

From source file:com.flexive.tests.browser.AdmContentTest.java

/**
 * searches for a type/*from   w w w  .j a va 2  s  .co m*/
 * @param typeName the name of the type
 * @param param the parameter which to fill in
 */
private void searchForType(String typeName, Hashtable<String, Object> param) {
    fillLUT(typeName);

    String link = CREATE_QUERY_LINK + propertyLUT.get(typeName).get("typeId");

    loadContentPage(link);
    navigateTo(NavigationTab.Structure);
    selectFrame(Frame.NavStructures);

    if (param != null) {
        String id;
        boolean isEditor;
        for (String pName : param.keySet()) {
            selectFrame(Frame.NavStructures);
            fillLUT(pName);
            id = propertyLUT.get(pName).get("propertyId");
            try {
                isEditor = selenium.getEval(WND + ".parent.frames[\"contentFrame\"].isQueryEditor")
                        .equals("true");
            } catch (Throwable t) {
                isEditor = false;
            }
            if (isEditor) {
                try {
                    selenium.getEval(WND + ".parent.frames[\"contentFrame\"].addPropertyQueryNode(" + id + ")");
                } catch (SeleniumException se) {
                    LOG.error(se.getMessage());
                }
            } else {
                link = ADD_PROPERTY_LINK + id;
                loadContentPage(link);
            }
            fillInQuery(pName, param.get(pName));
            //            writeHTMLtoHD("query", LOG);
            //            selenium.type("frm:nodeInput_1_input_", param.get(pName).toString());
        }
    }

    clickAndWait("link=Search");

    // TODO return value ? 
}

From source file:at.ac.tuwien.auto.iotsys.gateway.connectors.knx.KNXDeviceLoaderETSImpl.java

private void parseBuildingView(HierarchicalConfiguration partConfig, Obj parent, Network n,
        ObjectBroker objectBroker, Hashtable<String, EntityImpl> entityById) {
    for (int partsIdx = 0; partsIdx < sizeOfConfiguration(partConfig.getProperty("part.[@id]")); partsIdx++) {
        String partId = partConfig.getString("part(" + partsIdx + ").[@id]");
        String partName = arrayToString(partConfig.getStringArray("part(" + partsIdx + ").[@name]"));
        String partDescription = arrayToString(
                partConfig.getStringArray("part(" + partsIdx + ").[@description]"));
        String partType = partConfig.getString("part(" + partsIdx + ").[@type]");

        PartImpl part = new PartImpl(partId, partName, partDescription, partType);

        // add part to parent part
        if (parent instanceof ViewBuildingImpl)
            ((ViewBuildingImpl) parent).addPart(part);
        else if (parent instanceof PartImpl)
            ((PartImpl) parent).addPart(part);
        else/*from  ww w .  jav a  2 s  . c  o  m*/
            parent.add(part);

        objectBroker.addObj(part, true);

        // add instances to part
        HierarchicalConfiguration concretePart = partConfig.configurationAt("part(" + partsIdx + ")");

        for (int instanceIdx = 0; instanceIdx < sizeOfConfiguration(
                concretePart.getProperty("instance.[@id]")); instanceIdx++) {
            String instanceId = concretePart.getString("instance(" + instanceIdx + ").[@id]");
            Obj instance = part.addInstance(entityById.get(instanceId));
            objectBroker.addObj(instance);
        }

        // recursively add more parts
        parseBuildingView(concretePart, part, n, objectBroker, entityById);

    }
}

From source file:edu.ku.brc.af.ui.forms.BaseBusRules.java

/**
 * @param skipTableNames/*ww  w  .jav a 2 s . c  o m*/
 * @param idColName
 * @param dataClassObj
 * @return
 */
protected String[] gatherTableFieldsForDelete(final String[] skipTableNames, final String idColName,
        final Class<?> dataClassObj)

{
    boolean debug = false;

    int fieldCnt = 0;
    Hashtable<String, Vector<String>> fieldHash = new Hashtable<String, Vector<String>>();
    HashSet<String> skipHash = new HashSet<String>();
    if (skipTableNames != null) {
        for (String name : skipTableNames) {
            skipHash.add(name);
        }
    }

    for (DBTableInfo ti : DBTableIdMgr.getInstance().getTables()) {
        String tblName = ti.getName();
        if (!skipHash.contains(tblName)) {
            if (dataClassObj != null) {
                for (DBRelationshipInfo ri : ti.getRelationships()) {
                    if (ri.getDataClass() == dataClassObj) {
                        String colName = ri.getColName();
                        if (StringUtils.isNotEmpty(colName) /*&& !colName.equals(idColName)*/
                        //I am pretty sure the following condition reproduces the logic in revision prior to 11305,
                        //if skipHash.contains test is removed above.
                        //&& (!skipHash.contains(tblName)  || (skipHash.contains(tblName) && !colName.equals(idColName)))
                        ) {
                            Vector<String> fieldList = fieldHash.get(tblName);
                            if (fieldList == null) {
                                fieldList = new Vector<String>();
                                fieldHash.put(tblName, fieldList);
                            }
                            fieldList.add(ri.getColName());
                            fieldCnt++;
                        }
                    }
                }
            }
        }
    }

    if (debug) {
        System.out.println("Fields to be checked:");
        for (String tableName : fieldHash.keySet()) {
            System.out.println(" Table:" + tableName + " ");
            for (String fName : fieldHash.get(tableName)) {
                System.out.println("   Field:" + fName);
            }
        }
    }

    int inx = 0;
    String[] tableFieldNamePairs = new String[fieldCnt * 2];
    for (String tableName : fieldHash.keySet()) {
        for (String fName : fieldHash.get(tableName)) {
            ///System.out.println("["+tableName+"]["+fName+"]");
            tableFieldNamePairs[inx++] = tableName;
            tableFieldNamePairs[inx++] = fName;
        }
    }
    return tableFieldNamePairs;
}

From source file:com.trsst.server.TrsstAdapter.java

@SuppressWarnings({ "rawtypes" })
protected void fetchEntriesFromStorage(RequestContext context, Feed feed)
        throws FileNotFoundException, IOException {
    // NOTE: occasionally (<1%) jetty and/or abdera give us a servlet
    // request that has a valid query string but returns no parameters;
    // we now just parse the query manually every time just to be safe
    Hashtable params = new Hashtable();
    String uri = context.getUri().toString();
    int i = uri.indexOf('?');
    if (i != -1) {
        params = HttpUtils.parseQueryString(uri.substring(i + 1));
    }/*ww w.ja  v a  2 s.c  om*/
    // System.out.println("fetchEntriesFromStorage: " + params + " : " +
    // uri);

    String searchTerms = params.get("q") == null ? null : ((String[]) params.get("q"))[0];
    Date beginDate = null;

    String verb = params.get("verb") == null ? null : ((String[]) params.get("verb"))[0];

    String[] mentions = (String[]) params.get("mention");
    String[] tags = (String[]) params.get("tag");
    String after = params.get("after") == null ? null : ((String[]) params.get("after"))[0];
    if (after != null) {
        try {
            // try to parse an entry id timestamp
            beginDate = new Date(Long.parseLong(after, 16));
        } catch (NumberFormatException nfe) {
            // try to parse as ISO date
            String begin = after;
            String beginTemplate = "0000-01-01T00:00:00.000Z";
            if (begin.length() < beginTemplate.length()) {
                begin = begin + beginTemplate.substring(begin.length());
            }
            try {
                beginDate = new AtomDate(begin).getDate();
            } catch (IllegalArgumentException e) {
                throw new IllegalArgumentException("Could not parse begin date: " + begin);
            }
        }

    }
    Date endDate = null;
    String before = params.get("before") == null ? null : ((String[]) params.get("before"))[0];
    if (before != null) {
        try {
            // try to parse an entry id timestamp
            endDate = new Date(Long.parseLong(before, 16));
        } catch (NumberFormatException nfe) {
            // try to parse as ISO date
            String end = before;
            String endTemplate = "9999-12-31T23:59:59.999Z";
            if (end.length() < endTemplate.length()) {
                end = end + endTemplate.substring(end.length());
            }
            try {
                endDate = new AtomDate(end).getDate();
            } catch (IllegalArgumentException e) {
                throw new IllegalArgumentException("Could not parse end date: " + end);
            }
        }
    }

    // note: "default" to getPageSize was actually max page size
    int length = ProviderHelper.getPageSize(context, "count", 99);
    String _count = params.get("count") == null ? null : ((String[]) params.get("count"))[0];
    if (_count != null) {
        try {
            int newLength = Integer.parseInt(_count);
            if (length != newLength) {
                // BUG in abdera?
                log.error("Abdera returning no count from valid count parameter: " + context.getUri());
            }
            length = newLength;
        } catch (NumberFormatException exc) {
            log.trace("Unrecognized count parameter: " + _count);
        }
    }
    // int offset = ProviderHelper.getOffset(context, "page", length);
    String _page = params.get("page") == null ? null : ((String[]) params.get("page"))[0];
    int page = (_page != null) ? Integer.parseInt(_page) : 0;
    int begin = page * length;
    int total = 0;
    if (length > 0) {
        total = addEntriesFromStorage(feed, begin, length, beginDate, endDate, searchTerms, mentions, tags,
                verb);
    } else {
        total = countEntriesFromStorage(beginDate, endDate, searchTerms, mentions, tags, verb);
    }

    if (feed.getEntries().size() > length) {
        log.error("Returned count exceeded limit: " + feed.getEntries().size() + " : " + length + " : "
                + context.getUri());
    }

    addPagingLinks(context, feed, page, length, total, searchTerms, before, after, mentions, tags, verb);

    // ARGH:
    // because having links appear after entries is invalid
    // we have to remove and then reinsert each entry.
    // would have expected Feed.addLink to insert before entries.
    List<Entry> entries = feed.getEntries();
    for (Entry entry : entries) {
        entry.discard();
    }
    for (Entry entry : entries) {
        feed.addEntry(entry);
    }
}

From source file:edu.ku.brc.specify.tasks.ExpressSearchTask.java

/**
 * Traverses the individual result record ids and maps them into the result tables.
 * @param config//from  ww  w .  j  av a  2s  .com
 * @param tableId
 * @param searchTerm
 * @param resultSet
 * @param id
 * @param joinIdToTableInfoHash
 * @param resultsForJoinsHash the related results table
 */
protected void collectResults(final SearchConfig config, final String tableId, final String searchTerm,
        final ResultSet resultSet, final Integer id,
        final Hashtable<String, List<ExpressResultsTableInfo>> joinIdToTableInfoHash,
        final Hashtable<String, QueryForIdResultsSQL> resultsForJoinsHash) {
    try {
        Integer recId;
        if (resultSet != null) {
            recId = resultSet.getInt(1);
        } else {
            recId = id;
        }

        //System.out.println("id "+id+"  "+recId);

        //log.debug("Find any Joins for TableID ["+tblInfo.getTableId()+"]");

        // Start by getting the List of next round of 'view' queries 
        // Before getting here we have constructed list of the queries that will need to be run
        // when we get a hit from the current table against one of the joins in the view query
        // 
        List<ExpressResultsTableInfo> list = joinIdToTableInfoHash.get(tableId);
        if (list != null) {
            // Now loop through each of the view queries
            for (ExpressResultsTableInfo erti : list) {
                //log.debug("Not Active: "+erti.getId()+"  "+erti.getTitle()+"  "+config.isActiveForRelatedQueryId(erti.getId()));
                if (!config.isActiveForRelatedQueryId(erti.getId())) {
                    continue;
                }

                //log.debug("Id: "+erti.getId()+"  "+erti.getTitle()+"  "+erti.getTableInfo().getPermissions().canView());
                //SecurityMgr.dumpPermissions(erti.getTableInfo().getTitle(), erti.getTableInfo().getPermissions().getOptions());
                if (AppContextMgr.isSecurityOn()) {
                    if (!erti.getTableInfo().getPermissions().canView()) {
                        continue;
                    }

                    boolean hasUnviewableCol = false;
                    for (ERTICaptionInfo capInfo : erti.getCaptionInfo()) {
                        DBFieldInfo fldInfo = capInfo.getFieldInfo();
                        if (fldInfo != null) {
                            if (!fldInfo.getTableInfo().getPermissions().canView()) {
                                hasUnviewableCol = true;
                                break;
                            }

                        } else if (capInfo.getAggClass() != null) {
                            DBTableInfo aggTblInfo = DBTableIdMgr.getInstance()
                                    .getByShortClassName(capInfo.getAggClass().getSimpleName());
                            if (aggTblInfo != null && !aggTblInfo.getPermissions().canAdd()) {
                                hasUnviewableCol = true;
                                break;
                            }
                        } else {
                            log.error("*********** NO FIELD: " + capInfo.getColName());
                        }
                    }
                    if (hasUnviewableCol) {
                        continue;
                    }
                }

                QueryForIdResultsSQL results = resultsForJoinsHash.get(erti.getId());
                if (results == null) {
                    Integer joinColTableId = null;
                    ERTIJoinColInfo joinCols[] = erti.getJoins();
                    if (joinCols != null) {
                        for (ERTIJoinColInfo jci : joinCols) {
                            if (tableId.equals(jci.getJoinTableId())) {
                                joinColTableId = jci.getJoinTableIdAsInt();
                                //log.debug("CHK: "+jci.getTableInfo().getTitle()+"  "+jci.getTableInfo().getPermissions().canView());
                                if (AppContextMgr.isSecurityOn()
                                        && !jci.getTableInfo().getPermissions().canView()) {
                                    continue;
                                }
                                break;
                            }
                        }
                    }
                    if (joinColTableId == null) {
                        throw new RuntimeException("Shouldn't have got here!");
                    }
                    Integer displayOrder = SearchConfigService.getInstance().getSearchConfig()
                            .getOrderForRelatedQueryId(erti.getId());
                    //log.debug("ExpressSearchResults erti.getId()["+erti.getId()+"] joinColTableId["+joinColTableId+"] displayOrder["+displayOrder+"]");
                    results = new QueryForIdResultsSQL(erti.getId(), joinColTableId, erti, displayOrder,
                            searchTerm);
                    resultsForJoinsHash.put(erti.getId(), results);
                }

                if (doingDebug) {
                    log.debug("*** Adding recId[" + recId + "] to erti[" + erti.getId() + "] ");
                }
                results.add(recId);
            }
        }
    } catch (SQLException ex) {
        edu.ku.brc.af.core.UsageTracker.incrSQLUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ExpressSearchTask.class, ex);
        ex.printStackTrace();
    }
}

From source file:at.ac.tuwien.auto.iotsys.gateway.connectors.knx.KNXDeviceLoaderETSImpl.java

private void parseDomainView(HierarchicalConfiguration domainConfig, Obj parent, Network n,
        ObjectBroker objectBroker, Hashtable<String, EntityImpl> entityById,
        Hashtable<String, DatapointImpl> datapointById) {
    for (int domainIdx = 0; domainIdx < sizeOfConfiguration(
            domainConfig.getProperty("domain.[@id]")); domainIdx++) {
        String domainId = domainConfig.getString("domain(" + domainIdx + ").[@id]");
        String domainName = arrayToString(domainConfig.getStringArray("domain(" + domainIdx + ").[@name]"));
        String domainDescription = arrayToString(
                domainConfig.getStringArray("domain(" + domainIdx + ").[@description]"));

        DomainImpl domain = new DomainImpl(domainId, domainName, domainDescription);

        // add part to parent part
        if (parent instanceof ViewDomainsImpl)
            ((ViewDomainsImpl) parent).addDomain(domain);
        else if (parent instanceof DomainImpl)
            ((DomainImpl) parent).addDomain(domain);
        else//from ww w .j  a  v  a  2s  .c o  m
            parent.add(domain);

        objectBroker.addObj(domain, true);

        // add instances to part
        HierarchicalConfiguration concreteDomain = domainConfig.configurationAt("domain(" + domainIdx + ")");

        for (int instanceIdx = 0; instanceIdx < sizeOfConfiguration(
                concreteDomain.getProperty("instance.[@id]")); instanceIdx++) {
            String instanceId = concreteDomain.getString("instance(" + instanceIdx + ").[@id]");
            Obj addInstance = domain.addInstance(entityById.get(instanceId));
            objectBroker.addObj(addInstance, true);
        }

        // recursively add more domains
        parseDomainView(concreteDomain, domain, n, objectBroker, entityById, datapointById);
    }
}

From source file:edu.ku.brc.specify.tools.StrLocalizerApp.java

/**
 * @param src//from  ww  w .  j  av  a 2 s. c o  m
 * @param dst
 */
private void mergeToDst(final StrLocaleFile src, final StrLocaleFile dst) {
    Hashtable<String, StrLocaleEntry> dstHash = dst.getItemHash();

    Vector<StrLocaleEntry> srcItems = src.getItems();
    Vector<StrLocaleEntry> dstItems = dst.getItems();

    dstItems.clear();

    for (StrLocaleEntry srcEntry : srcItems) {
        String key = srcEntry.getKey();
        if (key == null || key.equals("#")) {
            dstItems.add(srcEntry);
        } else {
            StrLocaleEntry dstEntry = dstHash.get(key);
            if (dstEntry != null) {
                dstEntry.setDstStr(srcEntry.getDstStr());
                //dstEntry.setSrcStr(srcEntry.getDstStr());
                dstItems.add(dstEntry);
            } else {
                dstItems.add(srcEntry);
            }
        }
    }
}

From source file:hu.sztaki.lpds.pgportal.portlets.workflow.EasyWorkflowPortlet.java

/**
 * Save enduser parameters/*from  ww  w .  jav a 2 s. co  m*/
 */
public void doSaveEWorkflowParams(ActionRequest request, ActionResponse response) throws PortletException {
    try {
        String workflow = request.getParameter("workflow");
        //findinWF = new Hashtable();
        //  Vector eparam = getEConfParam(request.getRemoteUser(), workflow);//easy parameterek
        //  PortalCacheService.getInstance().getUser(request.getRemoteUser()).getConfiguringEParams();
        //findinWF = new Hashtable();
        //            System.out.println("NEW EASY PARAMS: ");
        Hashtable wfhash = new Hashtable();
        for (int i = 0; i < PortalCacheService.getInstance().getUser(request.getRemoteUser())
                .getConfiguringEParams().size(); i++) {
            String nv = " ";
            if (request.getParameter("eparam_" + i) != null) {
                nv = request.getParameter("eparam_" + i).replace('\\', '/');
            }
            ((Hashtable) PortalCacheService.getInstance().getUser(request.getRemoteUser())
                    .getConfiguringEParams().get(i)).put("newvalue", nv);
            //                System.out.println("param: " + i + " [" + PortalCacheService.getInstance().getUser(request.getRemoteUser()).getConfiguringEParams().get(i) + "]");
            if (wfhash.get(((Hashtable) PortalCacheService.getInstance().getUser(request.getRemoteUser())
                    .getConfiguringEParams().get(i)).get("wfID")) == null) {//meg nincs ilyen wfID
                Hashtable wfh = new Hashtable();
                wfh.put("" + i, (Hashtable) PortalCacheService.getInstance().getUser(request.getRemoteUser())
                        .getConfiguringEParams().get(i));
                wfhash.put(((Hashtable) PortalCacheService.getInstance().getUser(request.getRemoteUser())
                        .getConfiguringEParams().get(i)).get("wfID"), wfh);
            } else {
                ((Hashtable) wfhash.get(((Hashtable) PortalCacheService.getInstance()
                        .getUser(request.getRemoteUser()).getConfiguringEParams().get(i)).get("wfID")))
                                .put("" + i, (Hashtable) PortalCacheService.getInstance()
                                        .getUser(request.getRemoteUser()).getConfiguringEParams().get(i));
            }
        }
        //            System.out.println("WFre bobntott hasban(wf) hasbn(params i) hash(values) PARAMS: " + wfhash);

        Enumeration keys = wfhash.keys();
        while (keys.hasMoreElements()) {//WF-ek bejarasa
            String wfID = (String) keys.nextElement();

            Hashtable hsh = new Hashtable();
            hsh.put("url", PortalCacheService.getInstance().getUser(request.getRemoteUser()).getWorkflow(wfID)
                    .getWfsID());
            ServiceType st = InformationBase.getI().getService("wfs", "portal", hsh, new Vector());

            PortalWfsClient pc = (PortalWfsClient) Class.forName(st.getClientObject()).newInstance();
            pc.setServiceURL(st.getServiceUrl());
            pc.setServiceID(st.getServiceID());
            ComDataBean tmp = new ComDataBean();
            tmp.setPortalID(PropertyLoader.getInstance().getProperty("service.url"));
            tmp.setUserID(request.getRemoteUser());
            tmp.setWorkflowID(wfID);
            Vector wfconfigdt = pc.getWorkflowConfigData(tmp);
            //                System.out.println("WF letoltve:" + wfID);
            Enumeration keysp = ((Hashtable) wfhash.get(wfID)).keys();
            while (keysp.hasMoreElements()) {//EParameterek bejarasa
                String eparamID = (String) keysp.nextElement();
                Hashtable ep = (Hashtable) ((Hashtable) wfhash.get(wfID)).get(eparamID);
                //                    System.out.println("    Eparam:" + eparamID + " values ep[" + ep + "]");
                for (int i = 0; i < wfconfigdt.size(); i++) {
                    // replace special characters...
                    String jobtxt = new String(((JobPropertyBean) wfconfigdt.get(i)).getTxt());
                    ((JobPropertyBean) wfconfigdt.get(i)).setTxt(replaceTextS(jobtxt));
                    if (("" + ((JobPropertyBean) wfconfigdt.get(i)).getId()).equals(ep.get("jobID"))) {//job id
                        //                            System.out.println("    Eparamjobidfound:" + ep.get("jobID"));
                        if (ep.get("type").equals("iport")) {
                            ((JobPropertyBean) wfconfigdt.get(i)).getInput("" + ep.get("typeID")).getData()
                                    .put(ep.get("name"), ep.get("newvalue"));
                        } else if (ep.get("type").equals("oport")) {
                            ((JobPropertyBean) wfconfigdt.get(i)).getOutput("" + ep.get("typeID")).getData()
                                    .put(ep.get("name"), ep.get("newvalue"));
                        } else {//exe
                            ((JobPropertyBean) wfconfigdt.get(i)).addExe((String) ep.get("name"),
                                    (String) ep.get("newvalue"));
                        }
                        i = wfconfigdt.size();//kilep
                    }
                }

            }
            //save
            pc.setWorkflowConfigData(tmp, wfconfigdt);
            System.out.println("EWF saved:" + wfID);
        }

        //do not delete EINSTANCE
        //            WorkflowData wData = PortalCacheService.getInstance().getUser(request.getRemoteUser()).getWorkflow(workflow);
        //            if (wData.getEinstanceID() != null) {
        ////                System.out.println("EINSTANCE exists, delete... :" + wData.getEinstanceID());
        //                RealWorkflowUtils.getInstance().deleteWorkflowInstance(request.getRemoteUser(), workflow, "" + wData.getEinstanceID());
        //            }
        //
        // send configure ID to storage begin
        //
        boolean retUploadFiles = true;
        try {
            String storageID = PortalCacheService.getInstance().getUser(request.getRemoteUser())
                    .getWorkflow(workflow).getStorageID();
            String confID = request.getParameter("confIDparam");
            // System.out.println("confID request getParameter : " + confID);
            //
            Hashtable hshsto = new Hashtable();
            hshsto.put("url", storageID);
            ServiceType sts = InformationBase.getI().getService("storage", "portal", hshsto, new Vector());
            //
            PortalStorageClient ps = (PortalStorageClient) Class.forName(sts.getClientObject()).newInstance();
            ps.setServiceURL(storageID);
            ps.setServiceID(sts.getServiceID());
            UploadWorkflowBean uwb = new UploadWorkflowBean();
            uwb.setConfID(confID);
            retUploadFiles = ps.uploadWorkflowFiles(uwb);
            if (!retUploadFiles) {
                // res.put("msg", "workflow.config.files.notuploaded");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        //
        // send configure ID to storage end
        //
    } catch (Exception e) {
        request.setAttribute("msg", "workflow.easy.saved.error");
        e.printStackTrace();
    }
    request.setAttribute("jsp", mainjsp);
    request.setAttribute("msg", "workflow.easy.saved");
}

From source file:edu.ku.brc.specify.tools.StrLocalizerApp.java

/**
 * @param src/*from w w  w.j  a  v a 2s.  c  om*/
 * @param dst
 */
private void mergeToSrc(final StrLocaleFile src, final StrLocaleFile dst) {
    Hashtable<String, StrLocaleEntry> dstHash = dst.getItemHash();
    /*for (String k : dstHash.keySet())
    {
    System.out.println("["+k+"] ");
    }
    System.out.println("["+(dstHash.get("TOP5") != null)+"]["+(dstHash.get("username") != null)+"]");
    */

    int cnt = 0;
    for (StrLocaleEntry srcEntry : src.getItems()) {
        if (srcEntry.isValue()) {
            StrLocaleEntry dstEntry = dstHash.get(srcEntry.getKey());
            if (dstEntry != null) {
                //System.out.println("dst["+dst.getItemHash().get(srcEntry.getKey()).getSrcStr()+"]["+srcEntry.getSrcStr()+"]src");

                // This checks to see if the text from ".orig" file matches the src file
                // if it does it doesn't need to be changed
                if (dst.isSrcSameAsDest(srcEntry.getKey(), srcEntry.getSrcStr())) {
                    if (StringUtils.isEmpty(dstEntry.getSrcStr())
                            || dstEntry.getSrcStr().equals(srcEntry.getSrcStr())) {
                        newKeyList.add(srcEntry.getKey());
                    }
                } else {
                    newKeyList.add(dstEntry.getKey());
                }

                srcEntry.setDstStr(dstEntry.getSrcStr());
                srcEntry.setStatus(dstEntry.getStatus());

            } else {
                srcEntry.setDstStr(srcEntry.getSrcStr());
                dstEntry = new StrLocaleEntry(srcEntry.getKey(), srcEntry.getSrcStr(), null, STATUS.IsNew);
                dstHash.put(srcEntry.getKey(), dstEntry);

                newKeyList.add(srcEntry.getKey());
            }
            cnt++;
        }
    }
    srcFile.clearEditFlags();
    //System.out.println(cnt);

    statusBar.setText(String.format("%d new items.", newKeyList.size()));
}