Convert CloseOrderReferenceRequest to name value pairs
553397
private function _convertCloseOrderReference($request) {
        
        $parameters = array();
        $parameters['Action'] = 'CloseOrderReference';
        if ($request->isSetSellerId()) {
            $parameters['SellerId'] =  $request->getSellerId();
        }
        if ($request->isSetAmazonOrderReferenceId()) {
            $parameters['AmazonOrderReferenceId'] =  $request->getAmazonOrderReferenceId();
        }
        if ($request->isSetClosureReason()) {
            $parameters['ClosureReason'] =  $request->getClosureReason();
        }

        return $parameters;
    }
5057
function handleFindRefs (refsResp) {
            if (!refsResp || !refsResp.references || !refsResp.references.refs) {
                return;
            }

            var inlineWidget = EditorManager.getFocusedInlineWidget(),
                editor = EditorManager.getActiveEditor(),
                refs = refsResp.references.refs,
                type = refsResp.references.type;

            //In case of inline widget if some references are outside widget's text range then don't allow for rename
            if (inlineWidget) {
                var isInTextRange  = !refs.find(function(item) {
                    return (item.start.line < inlineWidget._startLine || item.end.line > inlineWidget._endLine);
                });
                
                if (!isInTextRange) {
                    editor.displayErrorMessageAtCursor(Strings.ERROR_RENAME_QUICKEDIT);
                    return;
                }
            }

            var currentPosition = editor.posFromIndex(refsResp.offset),
                refsArray = refs;
            if (type !== "local") {
                refsArray = refs.filter(function (element) {
                    return isInSameFile(element, refsResp);
                });
            }

            // Finding the Primary Reference in Array
            var primaryRef = refsArray.find(function (element) {
                return ((element.start.line === currentPosition.line || element.end.line === currentPosition.line)
                        && currentPosition.ch <= element.end.ch && currentPosition.ch >= element.start.ch);
            });
            // Setting the primary flag of Primary Refence to true
            primaryRef.primary = true;

            editor.setSelections(refsArray);
        }
360091
private function _convertSetOrderReferenceDetails($request) {
        
        $parameters = array();
        $parameters['Action'] = 'SetOrderReferenceDetails';
        if ($request->isSetSellerId()) {
            $parameters['SellerId'] =  $request->getSellerId();
        }
        if ($request->isSetAmazonOrderReferenceId()) {
            $parameters['AmazonOrderReferenceId'] =  $request->getAmazonOrderReferenceId();
        }
        if ($request->isSetOrderReferenceAttributes()) {
            $orderReferenceAttributes = $request->getOrderReferenceAttributes();
            if ($orderReferenceAttributes->isSetOrderTotal()) {
                $orderTotal = $orderReferenceAttributes->getOrderTotal();
                if ($orderTotal->isSetCurrencyCode()) {
                    $parameters['OrderReferenceAttributes' . '.' . 'OrderTotal' . '.' . 'CurrencyCode'] =  $orderTotal->getCurrencyCode();
                }
                if ($orderTotal->isSetAmount()) {
                    $parameters['OrderReferenceAttributes' . '.' . 'OrderTotal' . '.' . 'Amount'] =  $orderTotal->getAmount();
                }
            }
            if ($orderReferenceAttributes->isSetPlatformId()) {
                $parameters['OrderReferenceAttributes' . '.' . 'PlatformId'] =  $orderReferenceAttributes->getPlatformId();
            }
            if ($orderReferenceAttributes->isSetSellerNote()) {
                $parameters['OrderReferenceAttributes' . '.' . 'SellerNote'] =  $orderReferenceAttributes->getSellerNote();
            }
            if ($orderReferenceAttributes->isSetSellerOrderAttributes()) {
                $sellerOrderAttributes = $orderReferenceAttributes->getSellerOrderAttributes();
                if ($sellerOrderAttributes->isSetSellerOrderId()) {
                    $parameters['OrderReferenceAttributes' . '.' . 'SellerOrderAttributes' . '.' . 'SellerOrderId'] =  $sellerOrderAttributes->getSellerOrderId();
                }
                if ($sellerOrderAttributes->isSetStoreName()) {
                    $parameters['OrderReferenceAttributes' . '.' . 'SellerOrderAttributes' . '.' . 'StoreName'] =  $sellerOrderAttributes->getStoreName();
                }
                if ($sellerOrderAttributes->isSetOrderItemCategories()) {
                    $orderItemCategories = $sellerOrderAttributes->getOrderItemCategories();
                    foreach  ($orderItemCategories->getOrderItemCategory() as $orderItemCategoryIndex => $orderItemCategory) {
                        $parameters['OrderReferenceAttributes' . '.' . 'SellerOrderAttributes' . '.' . 'OrderItemCategories' . '.' . 'OrderItemCategory' . '.'  . ($orderItemCategoryIndex + 1)] =  $orderItemCategory;
                    }
                }
                if ($sellerOrderAttributes->isSetCustomInformation()) {
                    $parameters['OrderReferenceAttributes' . '.' . 'SellerOrderAttributes' . '.' . 'CustomInformation'] =  $sellerOrderAttributes->getCustomInformation();
                }
            }
        }

        return $parameters;
    }
898196
protected NameID encodeNameIdBasedOnNameFormat(final RequestAbstractType authnRequest,
                                                   final Object assertion,
                                                   final String nameFormat,
                                                   final SamlRegisteredService service,
                                                   final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) {
        try {
            if (authnRequest instanceof AttributeQuery) {
                val query = AttributeQuery.class.cast(authnRequest);
                val nameID = query.getSubject().getNameID();
                nameID.detach();
                LOGGER.debug("Choosing NameID format [{}] with value [{}] for attribute query", nameID.getFormat(), nameID.getValue());
                return nameID;
            }

            val attribute = prepareNameIdAttribute(assertion, nameFormat, adaptor);
            val encoder = prepareNameIdEncoder(authnRequest, nameFormat, attribute, service, adaptor);
            LOGGER.debug("Encoding NameID based on [{}]", nameFormat);
            var nameId = encoder.encode(attribute);
            LOGGER.debug("Final NameID encoded with format [{}] has value [{}]", nameId.getFormat(), nameId.getValue());
            return nameId;
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }
208262
private String getCollectionName(String data) throws LoaderException {
        String collection;
        switch (data) {
            case "genome_info":
                collection = "genome_info";
                break;
            case "genome_sequence":
                collection = "genome_sequence";
                break;
            case "gene":
                collection = "gene";
                break;
            case "variation":
                collection = "variation";
                break;
            case "svs":
                collection = "variation";
                break;
            case "cadd":
                collection = "variation_functional_score";
                break;
            case "regulatory_region":
                collection = "regulatory_region";
                break;
            case "protein":
                collection = "protein";
                break;
            case "protein_protein_interaction":
                collection = "protein_protein_interaction";
                break;
            case "protein_functional_prediction":
                collection = "protein_functional_prediction";
                break;
            case "conservation":
                collection = "conservation";
                break;
            case "cosmic":
                clinicalVariantSource = "cosmic";
                collection = "clinical";
                break;
            case "clinvar":
                clinicalVariantSource = "clinvar";
                collection = "clinical";
                break;
            case "gwas":
                clinicalVariantSource = "gwas";
                collection = "clinical";
                break;
            case "clinical":
                collection = "clinical";
                break;
            case "clinical_variants":
                collection = CLINICAL_VARIANTS_COLLECTION;
                break;
            case "metadata":
                collection = "metadata";
                break;
            case "repeats":
                collection = "repeats";
                break;
            default:
                throw new LoaderException("Unknown data to load: '" + data + "'");
        }

        return collection;
    }
886535
public static String fromNamedReference(CharSequence s) {
        if (s == null) {
            return null;
        }
        final Integer code = SPECIALS.get(s.toString());
        if (code != null) {
            return "&#" + code + ";";
        }
        return null;
    }
1343681
@SuppressWarnings("static-method")
	public String findStringValue(JvmAnnotationReference reference) {
		assert reference != null;
		for (final JvmAnnotationValue value : reference.getValues()) {
			if (value instanceof JvmStringAnnotationValue) {
				for (final String strValue : ((JvmStringAnnotationValue) value).getValues()) {
					if (strValue != null) {
						return strValue;
					}
				}
			}
		}
		return null;
	}
655364
private Deferred<IncomingDataPoint> resolveNames(final IncomingDataPoint dp) {
    // If the caller gave us a metric and tags, save some time by NOT hitting
    // our UID tables or storage.
    if (metric != null) {
      dp.setMetric(metric);
      dp.setTags((HashMap<String, String>)tags);
      return Deferred.fromResult(dp);
    }
    
    class TagsCB implements Callback<IncomingDataPoint, HashMap<String, String>> {
      public IncomingDataPoint call(final HashMap<String, String> tags) 
        throws Exception {
        dp.setTags(tags);
        return dp;
      }
      @Override
      public String toString() {
        return "Tags resolution CB";
      }
    }
    
    class MetricCB implements Callback<Deferred<IncomingDataPoint>, String> {
      public Deferred<IncomingDataPoint> call(final String name) 
          throws Exception {
        dp.setMetric(name);
        final List<byte[]> tags = UniqueId.getTagPairsFromTSUID(tsuid);
        return Tags.resolveIdsAsync(tsdb, tags).addCallback(new TagsCB());
      }
      @Override
      public String toString() {
        return "Metric resolution CB";
      }
    }
    
    final byte[] metric_uid = Arrays.copyOfRange(tsuid, 0, TSDB.metrics_width());     
    return tsdb.getUidName(UniqueIdType.METRIC, metric_uid)
        .addCallbackDeferring(new MetricCB());
  }
161292
private void setRequestArgsForReadAttr(final Request request, final String[] names,
            final DevSource src, final ClntIdent ident, final TypeCode return_type) {
        Any any;
        any = request.add_in_arg();
        DevVarStringArrayHelper.insert(any, names);

        // Add source if any
        if (src != null) {
            any = request.add_in_arg();
            DevSourceHelper.insert(any, src);
        }
        if (ident != null) {
            any = request.add_in_arg();
            ClntIdentHelper.insert(any, ident);
        }
        request.set_return_type(return_type);
        request.exceptions().add(DevFailedHelper.type());
    }
103765
protected void parseFunctionReference(I_CmsXmlContentLocation node) {

        String name = node.getSubValue(N_NAME).asString(m_cms);
        CmsUUID functionId = node.getSubValue(N_FUNCTION).asId(m_cms);
        CmsUUID functionDefaultPageId = null;
        I_CmsXmlContentValueLocation defaultPageValue = node.getSubValue(N_FUNCTION_DEFAULT_PAGE);
        if (defaultPageValue != null) {
            functionDefaultPageId = defaultPageValue.asId(m_cms);
        }
        I_CmsXmlContentValueLocation orderNode = node.getSubValue(N_ORDER);
        int order = I_CmsConfigurationObject.DEFAULT_ORDER;
        if (orderNode != null) {
            String orderStr = orderNode.asString(m_cms);
            try {
                order = Integer.parseInt(orderStr);
            } catch (NumberFormatException e) {
                // noop
            }
        }
        m_functionReferences.add(new CmsFunctionReference(name, functionId, functionDefaultPageId, order));
    }
896107
public List<String> getReferenceNames() {
        ArrayList<String> names = new ArrayList<>(references.keySet());
        Collections.sort(names);
        return names;
    }
1092133
@Override
    public Object callWithNamedValues(PageContext pc, Key key, Struct args) throws PageException {
	// first check variables
	Object o = shadow.get(key);
	if (o instanceof UDFPlus) {
	    return ((UDFPlus) o).callWithNamedValues(pc, key, args, false);
	}

	Member m = component.getMember(access, key, false, false);
	if (m != null) {
	    if (m instanceof UDFPlus) return ((UDFPlus) m).callWithNamedValues(pc, key, args, false);
	    return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct");
	    // throw ComponentUtil.notFunction(component, key, m.getValue(),access);
	}
	return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct");
	// throw ComponentUtil.notFunction(component, key, null,access);
    }
406411
Reference<T> lookupReference(String name, boolean isLongName) {
    if (isLongName) {
      for (Reference<T> r : referenceMap.values()) {
        if (r.longName.equals(name)) {
          return r;
        }
      }
      return null;
    }
    return referenceMap.get(name);
  }
600163
@SuppressWarnings("unused")
	public static <T> String getRequestPayload(Request<T> request) {
		Class<?> referenceClazz = request.getClass();
		List<Field> fields = ClassUtil.getAnnotatedFields(referenceClazz, Body.class);
		List<String> objects = new LinkedList<String>();
		for (Field field : fields) {
			Body body = field.getAnnotation(Body.class);

			String asString = ClassUtil.getValueOf(field, request, referenceClazz, String.class);
			return (asString != null ? asString : "");
			// what if there are more bodies?!
		}
		return EMPTY;
	}
27472
def makename2refdct(commdct):
    """"""
    refdct = {}
    for comm in commdct: # commdct is a list of dict
        try:
            idfobj = comm[0]['idfobj'].upper()
            field1 = comm[1]
            if 'Name' in field1['field']:
                references = field1['reference']
                refdct[idfobj] = references
        except (KeyError, IndexError) as e:
            continue # not the expected pattern for reference
    return refdct
1274972
private int fetchNameForNamedGroup(int startCode, boolean ref) {
        int src = p;
        value = 0;

        int isNum = 0;
        int sign = 1;

        int endCode = nameEndCodePoint(startCode);
        int pnumHead = p;
        int nameEnd = stop;

        String err = null;
        if (!left()) {
            newValueException(EMPTY_GROUP_NAME);
        } else {
            fetch();
            if (c == endCode) newValueException(EMPTY_GROUP_NAME);
            if (enc.isDigit(c)) {
                if (ref) {
                    isNum = 1;
                } else {
                    err = INVALID_GROUP_NAME;
                    // isNum = 0;
                }
            } else if (c == '-') {
                if (ref) {
                    isNum = 2;
                    sign = -1;
                    pnumHead = p;
                } else {
                    err = INVALID_GROUP_NAME;
                    // isNum = 0;
                }
            }
        }

        if (err == null) {
            while (left()) {
                nameEnd = p;
                fetch();
                if (c == endCode || c == ')') {
                    if (isNum == 2) {
                        err = INVALID_GROUP_NAME;
                        return fetchNameTeardown(src, endCode, nameEnd, err);
                    }
                    break;
                }

                if (isNum != 0) {
                    if (enc.isDigit(c)) {
                        isNum = 1;
                    } else {
                        if (!enc.isWord(c)) {
                            err = INVALID_CHAR_IN_GROUP_NAME;
                        } else {
                            err = INVALID_GROUP_NAME;
                        }
                        return fetchNameTeardown(src, endCode, nameEnd, err);
                    }
                }
            }

            if (c != endCode) {
                err = INVALID_GROUP_NAME;
                nameEnd = stop;
                return fetchNameErr(src, nameEnd, err);
            }

            int backNum = 0;
            if (isNum != 0) {
                mark();
                p = pnumHead;
                backNum = scanUnsignedNumber();
                restore();
                if (backNum < 0) {
                    newValueException(TOO_BIG_NUMBER);
                } else if (backNum == 0) {
                    newValueException(INVALID_GROUP_NAME, src, nameEnd);
                }
                backNum *= sign;
            }
            value = nameEnd;
            return backNum;
        } else {
            return fetchNameTeardown(src, endCode, nameEnd, err);
        }
    }
1047330
public static String getReferencePropertyOriginalName(final String refPropertyName) {
        final int i = refPropertyName.lastIndexOf(REFERENCE_PROPERTY_SUFFIX);
        return i < 0 ? refPropertyName : refPropertyName.substring(0, i);
    }