Method used to translate a managedobject. This method is used in CompareManagedObject.
344151
def TranslateManagedObject(mObj, xlateOrg, xlateMap):
	
	from UcsBase import UcsUtils, WriteUcsWarning
	from Mos import OrgOrg

	xMO = mObj.Clone()
	xMO.SetHandle(mObj.GetHandle())
	if (xlateOrg != None):
		matchObj = re.match(r'^(org-[\-\.:_a-zA-Z0-9]{1,16}/)*org-[\-\.:_a-zA-Z0-9]{1,16}', xMO.Dn)
		if matchObj:
			if UcsUtils.WordL(xMO.classId) == OrgOrg.ClassId():
				orgMoMeta = UcsUtils.GetUcsPropertyMeta(UcsUtils.WordU(OrgOrg.ClassId()), "Meta")
				if orgMoMeta == None:
					# TODO: Add Warning/Error messages in Logger.
					WriteUcsWarning('[Warning]: Could not translate [%s]' % (xMO.Dn))
					return xMO

				# Check for naming property
				matchObj1 = re.findall(r'(\[[^\]]+\])', orgMoMeta.rn)
				if matchObj1:
					UpdateMoDnAlongWithNamingProperties(xMO, orgMoMeta, xlateOrg)
				else:
					newDn = re.sub("%s" % (matchObj.group(0)), "%s" % (xlateOrg), xMO.Dn)
					# print "Translating", xMO.Dn, " => ", newDn
					xMO.Dn = newDn
			else:
				newDn = re.sub("^%s/" % (matchObj.group(0)), "%s/" % (xlateOrg), xMO.Dn)
				# print "Translating", xMO.Dn, " => ", newDn
				xMO.Dn = newDn

	if (xlateMap != None):
		originalDn = xMO.Dn
		if originalDn in xlateMap:
			xMoMeta = UcsUtils.GetUcsPropertyMeta(UcsUtils.WordU(xMO.classId), "Meta")
			if xMoMeta == None:
				# TODO: Add Warning/Error messages in Logger.
				WriteUcsWarning('[Warning]: Could not translate [%s]' % (originalDn))
				return xMO

			# Check for naming property
			matchObj = re.findall(r'(\[[^\]]+\])', xMoMeta.rn)
			if matchObj:
				UpdateMoDnAlongWithNamingProperties(xMO, xMoMeta, xlateMap[originalDn])
			else:
				# print "Translating", xMO.Dn, " => ", xlateMap[originalDn]
				xMO.Dn = xlateMap[originalDn]
		else:
			originalDn = re.sub(r'[/]*[^/]+$', '', originalDn)
			while (originalDn != None or originalDn == ""):
				if (not (originalDn in xlateMap)):
					originalDn = re.sub(r'[/]*[^/]+$', '', originalDn)
					continue

				newDn = re.sub("^%s/" % (originalDn), "%s/" % (xlateMap[originalDn]), xMO.Dn)
				# print "Translating", xMO.Dn, " => ", newDn
				xMO.Dn = newDn
				break

	return xMO
1024314
def FromManagedObject(self):
		
		import os

		if (isinstance(self.mo, ManagedObject) == True):
			self.classId = self.mo.classId

			if self.mo.getattr('Dn'):
				self.dn = self.mo.getattr('Dn')

			if self.mo.getattr('Rn'):
				self.rn = self.mo.getattr('Rn')
			elif self.dn:
				self.rn = os.path.basename(self.dn)

			for property in UcsUtils.GetUcsPropertyMetaAttributeList(self.mo.classId):
				self.properties[property] = self.mo.getattr(property)

			if len(self.mo.child):
				for ch in self.mo.child:
					if not ch.getattr('Dn'):
						_Dn = self.mo.getattr('Dn') + "/" + ch.getattr('Rn')
						ch.setattr('Dn', _Dn)
					gmo = _GenericMO(mo=ch)
					self.child.append(gmo)
933594
private boolean replaceValues(Locale locale) {

        try {
            SortedProperties localization = getLocalization(locale);
            if (hasDescriptor()) {
                for (Object itemId : m_container.getItemIds()) {
                    Item item = m_container.getItem(itemId);
                    String key = item.getItemProperty(TableProperty.KEY).getValue().toString();
                    Object value = localization.get(key);
                    item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value);
                }
            } else {
                m_container.removeAllItems();
                Set<Object> keyset = m_keyset.getKeySet();
                for (Object key : keyset) {
                    Object itemId = m_container.addItem();
                    Item item = m_container.getItem(itemId);
                    item.getItemProperty(TableProperty.KEY).setValue(key);
                    Object value = localization.get(key);
                    item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value);
                }
                if (m_container.getItemIds().isEmpty()) {
                    m_container.addItem();
                }
            }
            return true;
        } catch (IOException | CmsException e) {
            // The problem should typically be a problem with locking or reading the file containing the translation.
            // This should be reported in the editor, if false is returned here.
            return false;
        }
    }
196422
@SuppressWarnings("static-method")
	protected void translateAnnotationsTo(List<JvmAnnotationReference> annotations, JvmAnnotationTarget target,
			Class<?>... exceptions) {
		final Set<String> excepts = new HashSet<>();
		for (final Class<?> type : exceptions) {
			excepts.add(type.getName());
		}
		final List<JvmAnnotationReference> addition = new ArrayList<>();
		for (final JvmAnnotationReference annotation : Iterables.filter(annotations, an -> {
			if (!ANNOTATION_TRANSLATION_FILTER.apply(an)) {
				return false;
			}
			return !excepts.contains(an.getAnnotation().getIdentifier());
		})) {
			addition.add(annotation);
		}
		target.getAnnotations().addAll(addition);
	}
1108220
public function translateInstance()
    {

        $instance = $this->getCurrentInstance();

        $formContainer = new tao_actions_form_Translate($this->getCurrentClass(), $instance);
        $myForm = $formContainer->getForm();

        if ($this->hasRequestParameter('target_lang')) {

            $targetLang = $this->getRequestParameter('target_lang');

            if(in_array($targetLang, tao_helpers_I18n::getAvailableLangsByUsage($this->getResource(tao_models_classes_LanguageService::INSTANCE_LANGUAGE_USAGE_DATA)))){
                $langElt = $myForm->getElement('translate_lang');
                $langElt->setValue($targetLang);
                $langElt->setAttribute('readonly', 'true');

                $trData = $this->getClassService()->getTranslatedProperties($instance, $targetLang);
                foreach($trData as $key => $value){
                    $element = $myForm->getElement(tao_helpers_Uri::encode($key));
                    if(!is_null($element)){
                        $element->setValue($value);
                    }
                }
            }
        }

        if($myForm->isSubmited()){
            if($myForm->isValid()){

                $values = $myForm->getValues();
                if(isset($values['translate_lang'])){
                    $datalang = $this->getSession()->getDataLanguage();
                    $lang = $values['translate_lang'];

                    $translated = 0;
                    foreach($values as $key => $value){
                        if(preg_match("/^http/", $key)){
                            $value = trim($value);
                            $property = $this->getProperty($key);
                            if(empty($value)){
                                if($datalang != $lang && $lang != ''){
                                    $instance->removePropertyValueByLg($property, $lang);
                                }
                            }
                            else if($instance->editPropertyValueByLg($property, $value, $lang)){
                                $translated++;
                            }
                        }
                    }
                    if($translated > 0){
                        $this->setData('message', __('Translation saved'));
                    }
                }
            }
        }

        $this->setData('myForm', $myForm->render());
        $this->setData('formTitle', __('Translate'));
        $this->setView('form.tpl', 'tao');
    }
70442
static DnsException translateAndThrow(RetryHelperException ex) {
    BaseServiceException.translate(ex);
    throw new DnsException(UNKNOWN_CODE, ex.getMessage(), ex.getCause());
  }
727392
private CouchDBQueryInterpreter onTranslation(Queue clauseQueue, EntityMetadata m)
    {

        CouchDBQueryInterpreter interpreter = new CouchDBQueryInterpreter(getColumns(getKunderaQuery().getResult(), m),
                getMaxResults(), m);
        interpreter.setColumnsToOutput(getColumnsToOutput(m, kunderaQuery));
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());

        EntityType entity = metaModel.entity(m.getEntityClazz());
        if (getKunderaQuery().isAggregated() && !useLuceneOrES)
        {
            return onAggregatedQuery(m, interpreter, getKunderaQuery());
        }
        // If there is no clause present, means we might need to scan complete
        // table.
        /**
         * TODOOOO: Create a sorted set with table name. and add row key as
         * score and value on persist. delete it out as well on delete call.
         */
        for (Object clause : clauseQueue)
        {
            if (clause.getClass().isAssignableFrom(FilterClause.class))
            {
                Object value = ((FilterClause) clause).getValue().get(0);
                String condition = ((FilterClause) clause).getCondition();
                String columnName = ((FilterClause) clause).getProperty();

                int indexOfDot = columnName.indexOf(".");
                if (indexOfDot >= 0)
                {
                    EmbeddableType embeddableType = metaModel.embeddable(m.getIdAttribute().getBindableJavaType());
                    String embeddedeFieldName = columnName.substring(0, indexOfDot);
                    if (embeddedeFieldName.equals(((AbstractAttribute) m.getIdAttribute()).getName()))
                    {
                        interpreter.setQueryOnCompositeKey(true);
                        interpreter.setKeyName(embeddedeFieldName);
                        String colName = columnName.substring(indexOfDot + 1);
                        Attribute attribute = embeddableType.getAttribute(colName);
                        interpreter.setIdQuery(true);
                        interpreter.setKeyValues(
                                colName,
                                PropertyAccessorHelper.fromSourceToTargetClass(attribute.getJavaType(),
                                        value.getClass(), value));
                    }
                    else
                    {
                        log.error("Query on embedded column/any field of embedded column, is not supported in CouchDB");
                        throw new QueryHandlerException(
                                "Query on embedded column/any field of embedded column, is not supported in CouchDB");
                    }
                }
                else
                {
                    Attribute col = entity.getAttribute(m.getFieldName(columnName));
                    interpreter.setKeyValues(columnName,
                            PropertyAccessorHelper.fromSourceToTargetClass(col.getJavaType(), value.getClass(), value));
                    interpreter.setKeyName(columnName);
                    if (columnName.equals(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName()))
                    {
                        interpreter.setIdQuery(true);
                    }

                    if (condition.equals("="))
                    {
                        interpreter.setKeyValue(PropertyAccessorHelper.fromSourceToTargetClass(col.getJavaType(),
                                value.getClass(), value));
                    }
                    else if (condition.equals(">=") || condition.equals(">"))
                    {
                        interpreter.setStartKeyValue(PropertyAccessorHelper.fromSourceToTargetClass(col.getJavaType(),
                                value.getClass(), value));
                    }
                    else if (condition.equals("<="))
                    {
                        interpreter.setEndKeyValue(PropertyAccessorHelper.fromSourceToTargetClass(col.getJavaType(),
                                value.getClass(), value));
                    }
                    else if (condition.equals("<"))
                    {
                        interpreter.setEndKeyValue(PropertyAccessorHelper.fromSourceToTargetClass(col.getJavaType(),
                                value.getClass(), value));
                        interpreter.setIncludeLastKey(false);
                    }
                    else
                    {
                        log.error("Condition:" + condition + " not supported for CouchDB");
                        throw new QueryHandlerException("Condition:" + condition + " not supported for CouchDB");
                    }
                }
            }
            else
            {
                String opr = clause.toString().trim();

                if (interpreter.getOperator() == null)
                {
                    if (opr.equalsIgnoreCase("AND"))
                    {
                        interpreter.setOperator("AND");
                    }
                    else if (opr.equalsIgnoreCase("OR"))
                    {
                        log.error("Condition: OR not supported in CouchDB");
                        throw new QueryHandlerException("Invalid intra clause OR is not supported in CouchDB");
                    }
                    else
                    {
                        log.error("Invalid intra clause:" + opr + " is not supported in CouchDB");
                        throw new QueryHandlerException("Invalid intra clause:" + opr + " not supported for CouchDB");
                    }
                }
                else if (interpreter.getOperator() != null && !interpreter.getOperator().equalsIgnoreCase(opr))
                {
                    log.error("Multiple combination of AND/OR clause not supported in CouchDB");
                    throw new QueryHandlerException("Multiple combination of AND/OR clause not supported in CouchDB");
                }
                // it is a case of "AND", "OR" clause
            }
        }
        return interpreter;
    }
1071631
@Override
    public boolean translate(final int codepoint, final Writer out) throws IOException {
        if (codepoint >= Character.MIN_SURROGATE && codepoint <= Character.MAX_SURROGATE) {
            // It's a surrogate. Write nothing and say we've translated.
            return true;
        }
        // It's not a surrogate. Don't translate it.
        return false;
    }
759278
static DatastoreException translateAndThrow(RetryHelperException ex) {
    BaseServiceException.translate(ex);
    throw new DatastoreException(UNKNOWN_CODE, ex.getMessage(), null, ex.getCause());
  }
400753
function translateResponse(obj){
  for(var k in obj){
    if(obj[k] instanceof Array){
      for(var i=0;i<obj[k].length;i++){
        // just an array of strings
        if(obj[k][i] instanceof Buffer){
          obj[k][i] = obj[k][i].toString()
        } else {
          // and array of objects..
           for(var k1 in obj[k][i]){
            if(obj[k][i][k1] instanceof Buffer){
              obj[k][i][k1] = obj[k][i][k1].toString()
            }
           }
        }
      }
    } else if(obj[k] instanceof Buffer) {
      obj[k] = obj[k].toString()
    } else {
      for(var rk in obj[k]){
        if(obj[k][rk] instanceof Buffer){
          obj[k][rk] = obj[k][rk].toString()
        } else if(obj[k][rk] instanceof Array){
          for(var i=0;i<obj[k][rk].length;i++){
             if(obj[k][rk][i] instanceof Buffer){
               obj[k][rk][i] = obj[k][rk][i].toString()
             } else {
              obj[k][rk][i] = obj[k][rk][i];
             }
          }
        } 
      }
    }
  }
  return obj
}
907770
@Override
    public String getPathTranslated() {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getPathTranslated();
        } finally {
            collaborator.postInvoke();
        }
    }
1096574
@Override
    public <T> Optional<LocalProperty<T>> translate(Function<E, Optional<T>> translator)
    {
        return translator.apply(column)
                .map(translated -> new SortingProperty<>(translated, order));
    }
816559
private OWLPropertyAssertionObject translate(Constant c) {
        if (c instanceof ObjectConstant)
            return translator.translate((ObjectConstant) c);
        else
            return translator.translate((ValueConstant) c);
    }
175381
public void translate(TranslationService translationService) {
    if (translationService == null) {
      description.setValue(descriptionKey.getValue());
      return;
    }

    if (!Strings.isNullOrEmpty(descriptionKey.get())) {
      description.setValue(translationService.translate(descriptionKey.get()));
    }
  }
372306
public String translateUser(String name) {

        if (m_importUserTranslations == null) {
            return name;
        }
        String match = m_importUserTranslations.get(name);
        if (match != null) {
            return match;
        } else {
            return name;
        }
    }
195420
void translate() {
            make.at(pos.getStartPosition());
            JCClassDecl owner = classDef((ClassSymbol)mapVar.owner);

            // synthetic static final int[] $SwitchMap$Color = new int[Color.values().length];
            MethodSymbol valuesMethod = lookupMethod(pos,
                                                     names.values,
                                                     forEnum.type,
                                                     List.nil());
            JCExpression size = make // Color.values().length
                .Select(make.App(make.QualIdent(valuesMethod)),
                        syms.lengthVar);
            JCExpression mapVarInit = make
                .NewArray(make.Type(syms.intType), List.of(size), null)
                .setType(new ArrayType(syms.intType, syms.arrayClass));

            // try { $SwitchMap$Color[red.ordinal()] = 1; } catch (java.lang.NoSuchFieldError ex) {}
            ListBuffer<JCStatement> stmts = new ListBuffer<>();
            Symbol ordinalMethod = lookupMethod(pos,
                                                names.ordinal,
                                                forEnum.type,
                                                List.nil());
            List<JCCatch> catcher = List.<JCCatch>nil()
                .prepend(make.Catch(make.VarDef(new VarSymbol(PARAMETER, names.ex,
                                                              syms.noSuchFieldErrorType,
                                                              syms.noSymbol),
                                                null),
                                    make.Block(0, List.nil())));
            for (Map.Entry<VarSymbol,Integer> e : values.entrySet()) {
                VarSymbol enumerator = e.getKey();
                Integer mappedValue = e.getValue();
                JCExpression assign = make
                    .Assign(make.Indexed(mapVar,
                                         make.App(make.Select(make.QualIdent(enumerator),
                                                              ordinalMethod))),
                            make.Literal(mappedValue))
                    .setType(syms.intType);
                JCStatement exec = make.Exec(assign);
                JCStatement _try = make.Try(make.Block(0, List.of(exec)), catcher, null);
                stmts.append(_try);
            }

            owner.defs = owner.defs
                .prepend(make.Block(STATIC, stmts.toList()))
                .prepend(make.VarDef(mapVar, mapVarInit));
        }
1200412
private void TranslationControl(GVRSceneObject gvrWebViewSceneObjectFinal) {
        GVRScene mainScene = gvrContext.getMainScene();
        GVRCameraRig gvrCameraRig = mainScene.getMainCameraRig();
        initialCameralookAt = gvrCameraRig.getLookAt();

        gvrWebViewSceneObjectFinal.getTransform().getModelMatrix4f().getTranslation(translationObjectTranslationGlobal);
        gvrWebViewSceneObjectFinal.getTransform().getLocalModelMatrix4f().getTranslation(translationObjectTranslationLocal);

        if (gvrTextTranslationObject != null) {
            gvrTextTranslationObject.setTextColor(textColorIsActive);
        }
        webViewTranslation = true;

        for ( int i = 0; i < 3; i++ ) {
            if (i == 2) beginUIClickPos[i] = webPagePlusUIPosition[i] - cubeUIPosition[i];
            else beginUIClickPos[i] = webPagePlusUIPosition[i] + cubeUIPosition[i] + textTranslatePosition[i];
            diffWebPageUIClick[i] = beginUIClickPos[i] - webPagePlusUIPosition[i];
        }

        mOnDrawFrame = new DrawFrame();
        gvrContext.registerDrawFrameListener(mOnDrawFrame);
    }