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:de.suse.swamp.core.util.BugzillaTools.java

public void fetchBugzillaInfo(Dataset dataset, int bugid) throws Exception {
    ArrayList excludeFields = new ArrayList();
    if (dataset != null && !dataset.containsDatabit("description")) {
        excludeFields.add("long_desc");
    }/*from  w ww .ja v a2  s.  c o m*/

    Hashtable bug = getBugData(bugid, excludeFields);
    // only store if a dataset is provided
    if (dataset != null) {
        for (Iterator it = dataset.getDatabits().iterator(); it.hasNext();) {
            Databit bit = (Databit) it.next();
            String bitName = bit.getName();
            if (bitName.equals("people")) {
                if (bit.setValue(((SWAMPHashSet) bug.get("people")).toString(", "), SWAMPUser.SYSTEMUSERNAME)) {
                    Logger.LOG("Bugzilla copy: " + bitName + "=" + bug.get(bitName), log);
                }
            } else if (bitName.equals("delta_time") && bug.containsKey("delta")) {
                DateFormat df1 = new SimpleDateFormat(dateDatabit.dateFormat);
                bit.setValue(df1.format((Date) bug.get("delta")), SWAMPUser.SYSTEMUSERNAME);
            } else if (bug.containsKey(bitName)) {
                if (bit.setValue((String) bug.get(bitName), SWAMPUser.SYSTEMUSERNAME)) {
                    Logger.DEBUG("Bugzilla copy: " + bitName + "=" + bug.get(bitName), log);
                }
            }
        }
    }
}

From source file:com.hybris.mobile.adapter.FormAdapter.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//from  w ww . j  a  v a 2  s  .co  m
public View getView(final int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.form_row, parent, false);

    LinearLayout lnr = (LinearLayout) rowView.findViewById(R.id.linear_layout_form);
    final Hashtable<String, Object> obj = (Hashtable<String, Object>) objects.get(position);

    String className = "com.hybris.mobile.view." + obj.get("cellIdentifier").toString();
    Object someObj = null;
    try {
        Class cell;

        cell = Class.forName(className);

        Constructor constructor = cell.getConstructor(new Class[] { Context.class });
        someObj = constructor.newInstance(this.context);
    } catch (Exception e) {
        LoggingUtils.e(LOG_TAG, "Error loading class \"" + className + "\". " + e.getLocalizedMessage(),
                Hybris.getAppContext());
    }
    /*
     * Text Cell
     */

    if (someObj != null && someObj instanceof HYFormTextEntryCell) {

        final HYFormTextEntryCell textCell = (HYFormTextEntryCell) someObj;

        if (isLastEditText(position)) {
            textCell.setImeDone(this);
        }

        lnr.addView(textCell);

        textCell.setId(position);
        if (obj.containsKey("inputType")) {
            Integer val = mInputTypes.get(obj.get("inputType").toString());
            textCell.setContentInputType(val);
        }
        if (obj.containsKey("value")) {
            textCell.setContentText(obj.get("value").toString());
        }

        if (obj.containsKey("keyboardType")
                && StringUtils.equals(obj.get("keyboardType").toString(), "UIKeyboardTypeEmailAddress")) {
            textCell.setContentInputType(mInputTypes.get("textEmailAddress"));
        }

        textCell.addContentChangedListener(new TextWatcher() {
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void afterTextChanged(Editable s) {
                obj.put("value", s.toString());
                notifyFormDataChangedListner();
            }
        });
        textCell.setOnFocusChangeListener(new OnFocusChangeListener() {

            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (!hasFocus) {
                    textCell.setTextColor(context.getResources().getColor(R.color.textMedium));
                    if (!fieldIsValid(position)) {
                        setIsValid(false);
                        textCell.showMessage(true);
                    } else {
                        textCell.showMessage(false);
                    }
                    showInvalidField();
                    validateAllFields();
                } else {
                    textCell.setTextColor(context.getResources().getColor(R.color.textHighlighted));
                    setCurrentFocusIndex(position);
                }
            }
        });

        textCell.setContentTitle(obj.get("title").toString());
        if (obj.containsKey("error")) {
            textCell.setMessage(obj.get("error").toString());
        }

        if (obj.containsKey("showerror")) {
            Boolean showerror = Boolean.parseBoolean(obj.get("showerror").toString());
            textCell.showMessage(showerror);
        } else {
            textCell.showMessage(false);
        }

        if (currentFocusIndex == position) {
            textCell.setFocus();
        }
    }
    /*
     * Secure Text Cell
     */

    else if (someObj instanceof HYFormSecureTextEntryCell) {
        final HYFormSecureTextEntryCell secureTextCell = (HYFormSecureTextEntryCell) someObj;

        if (isLastEditText(position)) {
            secureTextCell.setImeDone(this);
        }
        lnr.addView(secureTextCell);

        secureTextCell.setId(position);
        if (obj.containsKey("value")) {
            secureTextCell.setContentText(obj.get("value").toString());
        }
        if (obj.containsKey("inputType")) {
            Integer val = mInputTypes.get(obj.get("inputType").toString());
            secureTextCell.setContentInputType(val);
        }
        secureTextCell.addContentChangedListener(new TextWatcher() {
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void afterTextChanged(Editable s) {
                obj.put("value", s.toString());
                notifyFormDataChangedListner();
            }

        });
        secureTextCell.setOnFocusChangeListener(new OnFocusChangeListener() {

            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (!hasFocus) {
                    if (!fieldIsValid(position)) {
                        setIsValid(false);
                        secureTextCell.showMessage(true);
                    } else {
                        secureTextCell.showMessage(false);
                    }
                    showInvalidField();
                    validateAllFields();
                } else {
                    setCurrentFocusIndex(position);
                }
            }
        });

        secureTextCell.setContentTitle(obj.get("title").toString());
        if (obj.containsKey("error")) {
            secureTextCell.setMessage(obj.get("error").toString());
        }

        if (obj.containsKey("showerror")) {
            Boolean showerror = Boolean.parseBoolean(obj.get("showerror").toString());
            secureTextCell.showMessage(showerror);
        } else {
            secureTextCell.showMessage(false);
        }

        if (currentFocusIndex == position) {
            secureTextCell.setFocus();
        }
    } else if (someObj instanceof HYFormTextSelectionCell) {

        setIsValid(fieldIsValid(position));

        HYFormTextSelectionCell selectionTextCell = (HYFormTextSelectionCell) someObj;
        lnr.addView(selectionTextCell);

        if (StringUtils.isNotBlank((String) obj.get("value"))) {
            StringBuilder b = new StringBuilder(obj.get("value").toString());
            selectionTextCell.setSpinnerText(b.replace(0, 1, b.substring(0, 1).toUpperCase()).toString());
        } else {
            selectionTextCell.setSpinnerText(obj.get("title").toString());
        }
    } else if (someObj instanceof HYFormTextSelectionCell2) {
        HYFormTextSelectionCell2 selectionTextCell = (HYFormTextSelectionCell2) someObj;
        lnr.addView(selectionTextCell);
        selectionTextCell.init(obj);
    } else if (someObj instanceof HYFormSwitchCell) {
        HYFormSwitchCell checkBox = (HYFormSwitchCell) someObj;
        lnr.addView(checkBox);
        checkBox.setCheckboxText(obj.get("title").toString());
        if (StringUtils.isNotBlank((String) obj.get("value"))) {
            checkBox.setCheckboxChecked(Boolean.parseBoolean((String) obj.get("value")));
        }

        checkBox.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                HYFormSwitchCell chk = (HYFormSwitchCell) v;
                chk.toggleCheckbox();
                obj.put("value", String.valueOf(chk.isCheckboxChecked()));
                notifyFormDataChangedListner();
            }
        });
    } else if (someObj instanceof HYFormSubmitButton) {
        HYFormSubmitButton btnCell = (HYFormSubmitButton) someObj;
        lnr.addView(btnCell);
        btnCell.setButtonText(obj.get("title").toString());
        btnCell.setOnButtonClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                submit();
            }
        });
    }

    return rowView;
}

From source file:adams.flow.control.TimedSubProcess.java

/**
 * Restores the state of the actor before the variables got updated.
 *
 * @param state   the backup of the state to restore from
 *///from w w  w  .j av a2  s.c om
@Override
protected void restoreState(Hashtable<String, Object> state) {
    super.restoreState(state);

    if (state.containsKey(BACKUP_CALLABLEACTOR)) {
        m_CallableActor = (Actor) state.get(BACKUP_CALLABLEACTOR);
        state.remove(BACKUP_CALLABLEACTOR);
    }

    if (state.containsKey(BACKUP_CONFIGURED)) {
        m_Configured = (Boolean) state.get(BACKUP_CONFIGURED);
        state.remove(BACKUP_CONFIGURED);
    }
}

From source file:com.alfaariss.oa.authentication.remote.AbstractRemoteMethod.java

/**
 * Converts a <code>Hashtable</code> containing message parameters to a message <code>String</code>.
 *
 * @param htMessage The message parameters.
 * @return The message as String./*from ww  w. jav a  2  s . c  o  m*/
 * @throws OAException if conversion fails.
 */
protected String convertHashtable(Hashtable<String, String> htMessage) throws OAException {
    StringBuffer sbResult = new StringBuffer();
    try {
        Enumeration<String> enumKeys = htMessage.keys();
        while (enumKeys.hasMoreElements()) {
            String sKey = enumKeys.nextElement();
            String sValue = htMessage.get(sKey);
            if (sKey != null && sValue != null) {
                if (sbResult.length() > 0)
                    sbResult.append("&");

                sbResult.append(sKey);
                sbResult.append("=");
                sbResult.append(URLEncoder.encode(sValue, CHARSET));
            }
        }
    } catch (Exception e) {
        _logger.fatal("Internal error during conversion of message: " + htMessage, e);
        throw new OAException(SystemErrors.ERROR_INTERNAL);
    }
    return sbResult.toString();
}

From source file:com.web.messaging.MessagingClassConstruct.java

/**
 * This method parses the messagingclass.xml which is obtained after undeploying the War file and metadata which is constructed in removed from the messaingclassMap 
 * @param messagedigester//w w  w  . j av  a  2s  .  c o m
 * @param configFile
 * @param messagingClassMap
 * @throws FileNotFoundException
 * @throws IOException
 * @throws SAXException
 */
public void removeMessagingClass(Digester messagedigester, File configFile, Hashtable messagingClassMap)
        throws FileNotFoundException, IOException, SAXException {
    try {
        MessagingClasses messagingClasses = (MessagingClasses) messagedigester
                .parse(new InputSource(new FileInputStream(configFile)));
        for (MessagingClass messagingclass : messagingClasses.messagingClasses) {
            if (messagingclass.getMessagetype().equals("RandomQueue")) {
                ConcurrentHashMap randomqueuemap = (ConcurrentHashMap) messagingClassMap.get("RandomQueue");
                //System.out.println("MessageElemName="+messagingclass.getMessageelemname().trim()+"Random Queue Map"+randomqueuemap);
                if (randomqueuemap != null) {
                    CopyOnWriteArrayList queueclassList = (CopyOnWriteArrayList) randomqueuemap
                            .get(messagingclass.getMessageelemname().trim());
                    if (queueclassList != null) {
                        for (int count = 0; count < queueclassList.size(); count++) {
                            MessagingClass messagingClassTmp = (MessagingClass) queueclassList.get(count);
                            //System.out.println(messagingClassTmp);
                            //System.out.println(messagingClassTmp.getMessageelemname()+" "+messagingclass.getMessageelemname() );
                            //System.out.println(messagingClassTmp.getMessagetype()+" "+messagingclass.getMessagetype() );
                            //System.out.println(messagingClassTmp.getMessagingclass()+" "+messagingclass.getMessagingclass() );
                            if (messagingClassTmp.getMessageelemname().trim()
                                    .equals(messagingclass.getMessageelemname().trim())
                                    && messagingClassTmp.getMessagetype().trim()
                                            .equals(messagingclass.getMessagetype().trim())
                                    && messagingClassTmp.getMessagingclass().trim()
                                            .equals(messagingclass.getMessagingclass().trim())) {
                                queueclassList.remove(messagingClassTmp);
                            }
                            //System.out.println(count);
                            //System.out.println("MessageElemName="+messagingClassTmp);
                        }
                    }
                }
            } else if (messagingclass.getMessagetype().equals("RoundRobinQueue")) {
                ConcurrentHashMap roundrobinqueuemap = (ConcurrentHashMap) messagingClassMap
                        .get("RoundRobinQueue");
                //System.out.println("RoundRobinQueueMap"+roundrobinqueuemap);
                if (roundrobinqueuemap != null) {
                    CopyOnWriteArrayList queueclassList = (CopyOnWriteArrayList) roundrobinqueuemap
                            .get(messagingclass.getMessageelemname().trim());
                    if (queueclassList != null) {
                        for (int count = 0; count < queueclassList.size(); count++) {
                            MessagingClass messagingClassTmp = (MessagingClass) queueclassList.get(count);
                            if (messagingClassTmp.getMessageelemname()
                                    .equals(messagingclass.getMessageelemname())
                                    && messagingClassTmp.getMessagetype()
                                            .equals(messagingclass.getMessagetype())
                                    && messagingClassTmp.getMessagingclass()
                                            .equals(messagingclass.getMessagingclass())) {
                                queueclassList.remove(messagingClassTmp);
                            }

                        }
                    }
                }
                //System.out.println("End RoundRobinQueueMap"+roundrobinqueuemap);
            } else if (messagingclass.getMessagetype().equals("Topic")) {
                ConcurrentHashMap topicmap = (ConcurrentHashMap) messagingClassMap.get("Topic");
                //System.out.println("TopicMap"+topicmap);
                if (topicmap != null) {
                    CopyOnWriteArrayList topicclassList = (CopyOnWriteArrayList) topicmap
                            .get(messagingclass.getMessageelemname().trim());
                    if (topicclassList != null) {
                        for (int count = 0; count < topicclassList.size(); count++) {
                            MessagingClass messagingClassTmp = (MessagingClass) topicclassList.get(count);
                            if (messagingClassTmp.getMessageelemname()
                                    .equals(messagingclass.getMessageelemname())
                                    && messagingClassTmp.getMessagetype()
                                            .equals(messagingclass.getMessagetype())
                                    && messagingClassTmp.getMessagingclass()
                                            .equals(messagingclass.getMessagingclass())) {
                                topicclassList.remove(messagingClassTmp);
                            }
                        }
                    }
                }
                //System.out.println("End TopicMap"+topicmap);
            }
        }
    } catch (Exception ex) {
        //ex.printStackTrace();
    }
    //System.out.println(messagingClassMap);
}

From source file:hk.hku.cecid.edi.as2.admin.listener.PartnershipPageletAdaptor.java

/**
 * @param request// w  w  w .ja  va2 s .c  om
 * @throws DAOException
 * @throws IOException
 */
private void updatePartnership(Hashtable ht, HttpServletRequest request, PropertyTree dom)
        throws DAOException, IOException {

    // get the parameters
    String requestAction = (String) ht.get("request_action");
    String partnershipId = (String) ht.get("partnership_id");
    String subject = (String) ht.get("subject");
    String recipientAddress = (String) ht.get("recipient_address");
    boolean isHostnameVerified = new Boolean((String) ht.get("is_hostname_verified")).booleanValue();
    String receiptAddress = (String) ht.get("receipt_address");
    boolean isSyncReply = new Boolean((String) ht.get("is_sync_reply")).booleanValue();
    boolean isReceiptRequested = new Boolean((String) ht.get("is_receipt_requested")).booleanValue();
    boolean isOutboundSignRequired = new Boolean((String) ht.get("is_outbound_sign_required")).booleanValue();
    boolean isOutboundEncryptRequired = new Boolean((String) ht.get("is_outbound_encrypt_required"))
            .booleanValue();
    boolean isOutboundCompressRequired = new Boolean((String) ht.get("is_outbound_compress_required"))
            .booleanValue();
    boolean isReceiptSignRequired = new Boolean((String) ht.get("is_receipt_sign_required")).booleanValue();
    boolean isInboundSignRequired = new Boolean((String) ht.get("is_inbound_sign_required")).booleanValue();
    boolean isInbouhndEncryptRequired = new Boolean((String) ht.get("is_inbound_encrypt_required"))
            .booleanValue();
    String signAlgorithm = (String) ht.get("sign_algorithm");
    String encryptAlgorithm = (String) ht.get("encrypt_algorithm");
    String micAlgorithm = (String) ht.get("mic_algorithm");
    String as2From = (String) ht.get("as2_from");
    String as2To = (String) ht.get("as2_to");
    String retries = (String) ht.get("retries");
    String retryInterval = (String) ht.get("retry_interval");
    boolean isDisabled = new Boolean((String) ht.get("disabled")).booleanValue();
    boolean hasEncryptCert = ht.get("encrypt_cert") != null;
    InputStream encryptCertInputStream = null;
    if (hasEncryptCert) {
        encryptCertInputStream = (InputStream) ht.get("encrypt_cert");
    }
    boolean hasRemoveEncryptCert = false;
    if (ht.get("encrypt_cert_remove") != null) {
        if (((String) ht.get("encrypt_cert_remove")).equalsIgnoreCase("on")) {
            hasRemoveEncryptCert = true;
        }
    }
    boolean hasVerifyCert = ht.get("verify_cert") != null;
    InputStream verifyCertInputStream = null;
    if (hasVerifyCert) {
        verifyCertInputStream = (InputStream) ht.get("verify_cert");
    }
    boolean hasRemoveVerifyCert = false;
    if (ht.get("verify_cert_remove") != null) {
        if (((String) ht.get("verify_cert_remove")).equalsIgnoreCase("on")) {
            hasRemoveVerifyCert = true;
        }
    }

    if ("add".equalsIgnoreCase(requestAction) || "update".equalsIgnoreCase(requestAction)
            || "delete".equalsIgnoreCase(requestAction)) {

        // validate and set to dao
        PartnershipDAO partnershipDAO = (PartnershipDAO) AS2PlusProcessor.getInstance().getDAOFactory()
                .createDAO(PartnershipDAO.class);
        PartnershipDVO partnershipDAOData = (PartnershipDVO) partnershipDAO.createDVO();

        partnershipDAOData.setPartnershipId(partnershipId);
        if ("update".equalsIgnoreCase(requestAction)) {
            partnershipDAO.retrieve(partnershipDAOData);
        }
        partnershipDAOData.setAs2From(as2From);
        partnershipDAOData.setAs2To(as2To);
        partnershipDAOData.setSubject(subject);
        partnershipDAOData.setRecipientAddress(recipientAddress);
        partnershipDAOData.setIsHostnameVerified(isHostnameVerified);
        partnershipDAOData.setReceiptAddress(receiptAddress);
        partnershipDAOData.setIsSyncReply(isSyncReply);
        partnershipDAOData.setIsReceiptRequired(isReceiptRequested);
        partnershipDAOData.setIsOutboundSignRequired(isOutboundSignRequired);
        partnershipDAOData.setIsOutboundEncryptRequired(isOutboundEncryptRequired);
        partnershipDAOData.setIsOutboundCompressRequired(isOutboundCompressRequired);
        partnershipDAOData.setIsReceiptSignRequired(isReceiptSignRequired);
        partnershipDAOData.setIsInboundSignRequired(isInboundSignRequired);
        partnershipDAOData.setIsInboundEncryptRequired(isInbouhndEncryptRequired);
        partnershipDAOData.setSignAlgorithm(signAlgorithm);
        partnershipDAOData.setEncryptAlgorithm(encryptAlgorithm);
        partnershipDAOData.setMicAlgorithm(micAlgorithm);
        partnershipDAOData.setIsDisabled(isDisabled);
        partnershipDAOData.setRetries(StringUtilities.parseInt(retries));
        partnershipDAOData.setRetryInterval(StringUtilities.parseInt(retryInterval));

        if ("add".equalsIgnoreCase(requestAction)) {
            getPartnership(partnershipDAOData, dom, "add_partnership/");
        }

        if (partnershipId.equals("")) {
            request.setAttribute(ATTR_MESSAGE, "Partnership ID cannot be empty");
            return;
        }
        if (as2From.equals("")) {
            request.setAttribute(ATTR_MESSAGE, "AS2 From cannot be empty");
            return;
        }
        if (as2To.equals("")) {
            request.setAttribute(ATTR_MESSAGE, "AS2 To cannot be empty");
            return;
        }
        if (as2From.length() > 100) {
            request.setAttribute(ATTR_MESSAGE, "AS2 From cannot be longer than 100 characters.");
            return;
        }
        if (as2To.length() > 100) {
            request.setAttribute(ATTR_MESSAGE, "AS2 To cannot be longer than 100 characters.");
            return;
        }

        if (partnershipDAOData.getRetries() == Integer.MIN_VALUE) {
            request.setAttribute(ATTR_MESSAGE, "Retries must be integer");
            return;
        }
        if (partnershipDAOData.getRetryInterval() == Integer.MIN_VALUE) {
            request.setAttribute(ATTR_MESSAGE, "Retry Interval must be integer");
            return;
        }

        // encrypt cert
        if (hasRemoveEncryptCert) {
            partnershipDAOData.setEncryptCert(null);
        }
        if (hasEncryptCert) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                IOHandler.pipe(encryptCertInputStream, baos);
                CertificateFactory.getInstance("X.509")
                        .generateCertificate(new ByteArrayInputStream(baos.toByteArray()));
                partnershipDAOData.setEncryptCert(baos.toByteArray());
            } catch (Exception e) {
                request.setAttribute(ATTR_MESSAGE, "Uploaded encrypt cert is not an X.509 cert");
                return;
            }
        }
        // verify cert
        if (hasRemoveVerifyCert) {
            partnershipDAOData.setVerifyCert(null);
        }
        if (hasVerifyCert) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                IOHandler.pipe(verifyCertInputStream, baos);
                CertificateFactory.getInstance("X.509")
                        .generateCertificate(new ByteArrayInputStream(baos.toByteArray()));
                partnershipDAOData.setVerifyCert(baos.toByteArray());
            } catch (Exception e) {
                request.setAttribute(ATTR_MESSAGE, "Uploaded verify cert is not an X.509 cert");
                return;
            }
        }

        // check partnership conflict
        if (!partnershipDAOData.isDisabled()) {
            Iterator allConflictDAOData = partnershipDAO
                    .findPartnershipsByPartyID(partnershipDAOData.getAS2From(), partnershipDAOData.getAs2To())
                    .iterator();
            while (allConflictDAOData.hasNext()) {
                PartnershipDVO conflictDAOData = (PartnershipDVO) allConflictDAOData.next();
                if (conflictDAOData != null
                        && !conflictDAOData.getPartnershipId().equals(partnershipDAOData.getPartnershipId())
                        && !conflictDAOData.isDisabled()) {
                    request.setAttribute(ATTR_MESSAGE, "Partnership '" + conflictDAOData.getPartnershipId()
                            + "' with same From/To party IDs has already been enabled");
                    return;
                }
            }
        }

        // dao action
        if ("add".equalsIgnoreCase(requestAction)) {

            partnershipDAO.create(partnershipDAOData);
            request.setAttribute(ATTR_MESSAGE, "Partnership added successfully");
            dom.removeProperty("/partnerships/add_partnership");
            dom.setProperty("/partnerships/add_partnership", "");
        }
        if ("update".equalsIgnoreCase(requestAction)) {
            partnershipDAO.persist(partnershipDAOData);
            request.setAttribute(ATTR_MESSAGE, "Partnership updated successfully");
        }
        if ("delete".equalsIgnoreCase(requestAction)) {
            partnershipDAO.remove(partnershipDAOData);
            request.setAttribute(ATTR_MESSAGE, "Partnership deleted successfully");
        }
    }
}

From source file:com.app.messaging.MessagingClassConstruct.java

/**
 * This method parses the messagingclass.xml which is obtained after undeploying the War file and metadata which is constructed in removed from the messaingclassMap 
 * @param messagedigester/*  ww w  .  jav a 2 s .c o m*/
 * @param configFile
 * @param messagingClassMap
 * @throws FileNotFoundException
 * @throws IOException
 * @throws SAXException
 */
public void removeMessagingClass(Digester messagedigester, File configFile, Hashtable messagingClassMap)
        throws FileNotFoundException, IOException, SAXException {
    try {
        MessagingClasses messagingClasses = (MessagingClasses) messagedigester
                .parse(new InputSource(new FileInputStream(configFile)));
        for (MessagingClass messagingclass : messagingClasses.messagingClasses) {
            if (messagingclass.getMessagetype().equals("RandomQueue")) {
                ConcurrentHashMap randomqueuemap = (ConcurrentHashMap) messagingClassMap.get("RandomQueue");
                //System.out.println("MessageElemName="+messagingclass.getMessageelemname().trim()+"Random Queue Map"+randomqueuemap);
                if (randomqueuemap != null) {
                    CopyOnWriteArrayList queueclassList = (CopyOnWriteArrayList) randomqueuemap
                            .get(messagingclass.getMessageelemname().trim());
                    if (queueclassList != null) {
                        for (int count = 0; count < queueclassList.size(); count++) {
                            MessagingClass messagingClassTmp = (MessagingClass) queueclassList.get(count);
                            //System.out.println(messagingClassTmp);
                            //System.out.println(messagingClassTmp.getMessageelemname()+" "+messagingclass.getMessageelemname() );
                            //System.out.println(messagingClassTmp.getMessagetype()+" "+messagingclass.getMessagetype() );
                            //System.out.println(messagingClassTmp.getMessagingclass()+" "+messagingclass.getMessagingclass() );
                            if (messagingClassTmp.getMessageelemname().trim()
                                    .equals(messagingclass.getMessageelemname().trim())
                                    && messagingClassTmp.getMessagetype().trim()
                                            .equals(messagingclass.getMessagetype().trim())
                                    && messagingClassTmp.getMessagingclass().trim()
                                            .equals(messagingclass.getMessagingclass().trim())) {
                                queueclassList.remove(messagingClassTmp);
                            }
                            //System.out.println(count);
                            //System.out.println("MessageElemName="+messagingClassTmp);
                        }
                    }
                }
            } else if (messagingclass.getMessagetype().equals("RoundRobinQueue")) {
                ConcurrentHashMap roundrobinqueuemap = (ConcurrentHashMap) messagingClassMap
                        .get("RoundRobinQueue");
                //System.out.println("RoundRobinQueueMap"+roundrobinqueuemap);
                if (roundrobinqueuemap != null) {
                    CopyOnWriteArrayList queueclassList = (CopyOnWriteArrayList) roundrobinqueuemap
                            .get(messagingclass.getMessageelemname().trim());
                    if (queueclassList != null) {
                        for (int count = 0; count < queueclassList.size(); count++) {
                            MessagingClass messagingClassTmp = (MessagingClass) queueclassList.get(count);
                            if (messagingClassTmp.getMessageelemname()
                                    .equals(messagingclass.getMessageelemname())
                                    && messagingClassTmp.getMessagetype()
                                            .equals(messagingclass.getMessagetype())
                                    && messagingClassTmp.getMessagingclass()
                                            .equals(messagingclass.getMessagingclass())) {
                                queueclassList.remove(messagingClassTmp);
                            }

                        }
                    }
                }
                //System.out.println("End RoundRobinQueueMap"+roundrobinqueuemap);
            } else if (messagingclass.getMessagetype().equals("Topic")) {
                ConcurrentHashMap topicmap = (ConcurrentHashMap) messagingClassMap.get("Topic");
                //System.out.println("TopicMap"+topicmap);
                if (topicmap != null) {
                    CopyOnWriteArrayList topicclassList = (CopyOnWriteArrayList) topicmap
                            .get(messagingclass.getMessageelemname().trim());
                    if (topicclassList != null) {
                        for (int count = 0; count < topicclassList.size(); count++) {
                            MessagingClass messagingClassTmp = (MessagingClass) topicclassList.get(count);
                            if (messagingClassTmp.getMessageelemname()
                                    .equals(messagingclass.getMessageelemname())
                                    && messagingClassTmp.getMessagetype()
                                            .equals(messagingclass.getMessagetype())
                                    && messagingClassTmp.getMessagingclass()
                                            .equals(messagingclass.getMessagingclass())) {
                                topicclassList.remove(messagingClassTmp);
                            }
                        }
                    }
                }
                //System.out.println("End TopicMap"+topicmap);
            }
        }
    } catch (Exception ex) {
        log.error("Error occurred in constructing messaging classes", ex);
        //ex.printStackTrace();
    }
    //System.out.println(messagingClassMap);
}

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

/**
 * @param enableRules// w ww  .ja  v  a2 s  . c om
 * @return
 */
protected String createEnableRulesXML(final Hashtable<String, String> enableRules) {
    if (enableRules.keySet().size() > 0) {
        StringBuilder sb = new StringBuilder("<enableRules>");
        for (String key : enableRules.keySet()) {
            sb.append("<rule id=\"");
            sb.append(key);
            sb.append("\"><![CDATA[");
            sb.append(enableRules.get(key));
            sb.append("]]></rule>");
        }
        sb.append("</enableRules>");
        return sb.toString();
    }
    return null;
}

From source file:com.fiorano.openesb.application.aps.OutPortInst.java

protected void populate(FioranoStaxParser parser) throws XMLStreamException, FioranoException {
    if (parser.markCursor(APSConstants.OUTPORT_INST)) {
        // Get Attributes if needs to accessed later. This MUST be done before accessing any data of element.
        Hashtable attributes = parser.getAttributes();
        m_bIsSyncRequestType = XMLUtils/*  w  ww.  j a v  a 2  s .c o m*/
                .getStringAsBoolean((String) attributes.get(APSConstants.IS_SYNC_REQUEST_TYPE));//XMLDmiUtil.getAttributeAsBoolean(port, "isSyncRequestType");
        m_bisDisabled = XMLUtils.getStringAsBoolean((String) attributes.get(APSConstants.IS_DISABLED));//XMLDmiUtil.getAttributeAsBoolean(port, "isSyncRequestType");
        while (parser.nextElement()) {
            String nodeName = parser.getLocalName();
            if (nodeName.equalsIgnoreCase("Name")) {
                m_strPortName = parser.getText();//XMLUtils.getNodeValueAsString(child).toUpperCase();

            }

            else if (nodeName.equalsIgnoreCase("Description")) {
                m_strDscription = parser.getText();//XMLUtils.getNodeValueAsString(child);

            }

            else if (nodeName.equalsIgnoreCase("StandardXSD")) {
                if ("ON_EXCEPTION".equals(m_strPortName))
                    m_strXSD = CommonSchemas.ERROR_XSD;
            }

            else if (nodeName.equalsIgnoreCase(PortInstConstants.PORT_XSD)) {
                m_strXSD = parser.getCData();//XMLUtils.getNodeValueAsString(child);

            }

            else if (nodeName.equalsIgnoreCase(PortInstConstants.PORT_XSDREF)) {
                m_strXSDRef = parser.getText();//XMLUtils.getNodeValueAsString(child);

            }

            else if (nodeName.equalsIgnoreCase("SetContextXSL")) {
                m_strContextXSL = parser.getCData();//XMLUtils.getNodeValueAsString(child);

            }

            else if (nodeName.equalsIgnoreCase("SetContextInfo")) {
                m_strContextInfo = parser.getCData();//XMLUtils.getNodeValueAsString(child);

            } else if (nodeName.equalsIgnoreCase("SetTransformationType")) {
                m_transformerType = parser.getText();//XMLUtils.getNodeValueAsString(child);

            } else if (nodeName.equalsIgnoreCase("JavaClass")) {
                m_strJavaClass = parser.getText();//XMLUtils.getNodeValueAsString(child);

            }

            else if (nodeName.equalsIgnoreCase("Param")) {
                Param paramDmi = new Param();

                paramDmi.setFieldValues(parser);
                addParam(paramDmi);
            }
        }
        if (attributes != null) {
            attributes.clear();
            attributes = null;
        }

    }
    validate();
}

From source file:jp.co.rakuten.rakutenvideoplayer.base.BaseActivity.java

public String getItemIdVideo(Hashtable<String, String> hashtable) {
    String item = "";
    Enumeration<String> names;
    names = hashtable.keys();/*  w  w w. j a  v a2s . c o m*/
    while (names.hasMoreElements()) {
        String key = (String) names.nextElement();
        DLog.i("DATABASE", key + ": " + hashtable.get(key));
        // Update value need
        if (key.equals("video_id"))
            item = hashtable.get(key);

    }
    return item;

}