Tries to generate the correct metatype properties location according to locale

@param metatypeName
@return a String with the correct metatype properties location
334421
private URL generateMetatypePropertiesName(String metatypeName, String locale) {
        String lookupName;
        if (locale != null && locale.length() > 0) {
            lookupName = metatypeName + LOCALE_SEPARATOR + locale + PROP_EXT;
        } else {
            lookupName = metatypeName + PROP_EXT;
        }

        URL url = bundle.getEntry(lookupName);

        if (url == null) {
            int pos = locale == null ? -1 : locale.lastIndexOf(LOCALE_SEPARATOR);
            if (pos != -1) {
                url = generateMetatypePropertiesName(metatypeName, locale.substring(0, pos));
            }
        }
        return url;
    }
3068
public String getI18nPropertiesString() throws IOException {
    // Load all properties
    Properties i18nProps = new Properties();

    // add entries
    for (Entry<String, String> entry : properties.entrySet()) {
      String key = entry.getKey();
      String escapedKey = validName(key);
      i18nProps.put(escapedKey, entry.getValue());
    }

    try (ByteArrayOutputStream outStream = new ByteArrayOutputStream()) {
      i18nProps.store(outStream, null);
      // Property files are always ISO 8859 encoded
      return outStream.toString(CharEncoding.ISO_8859_1);
    }
  }
757845
public CmsResourceTypeConfig getResourceType(String typeName) {

        for (CmsResourceTypeConfig type : getResourceTypes()) {
            if (typeName.equals(type.getTypeName())) {
                return type;
            }
        }
        return null;
    }
806301
private String getKeyAsString(Object id, EntityMetadata metadata, MetamodelImpl metaModel)
    {
        if (metaModel.isEmbeddable(((AbstractAttribute) metadata.getIdAttribute()).getBindableJavaType()))
        {
            return KunderaCoreUtils.prepareCompositeKey(metadata, id);
        }
        return id.toString();
    }
494871
public Map<String, Map<String, String>> getPropertyLocale() {

        if (m_propertiesLocale == null) {
            m_propertiesLocale = CmsCollectionsGenericWrapper.createLazyMap(
                new CmsLocalePropertyLoaderTransformer(getCmsObject(), this, false));
            // result may still be null
            return (m_propertiesLocale == null) ? Collections.EMPTY_MAP : m_propertiesLocale;
        }
        return m_propertiesLocale;
    }
1223683
String getLocalName() {

        if (!locale_set) {
            setLocale(Locale.getDefault());
        }

        String key = this.getTypeName();

        return BundleHandler.getString(hnd_local_names, key);
    }
713153
@Override
	public String getProperty(final String key) {
		lock.readLock().lock();
		try {
			final boolean useLocalPrefixes = !mixDefaultAndLocalPrefixes && hasLocalPrefixConfigurations();
			final Object object = get(key, useLocalPrefixes);
			if (object instanceof String) {
				return (String) object;
			} else {
				if (object == null) {
					return null;
				}
				throw new IllegalStateException("The value of " + key + " is of type: " + object.getClass().getName());
			}
		} finally {
			lock.readLock().unlock();
		}
	}
1060681
public static String getStringProperty(String name) {
        try {
            if (resourceBundle == null) {
                resourceBundle = ResourceBundle.getBundle(ERRORCODE_FILE,
                        Locale.getDefault(),
                        ErrorCodeConfig.class.getClassLoader());
            }
            String tagValue = resourceBundle.getString(name);
            if (tagValue == null || tagValue.isEmpty()) {
                return DEFAULT_STRING_VALUE;
            }
            return tagValue.trim();
        } catch (Exception ex) {
            LOGGER.error("Get exception in ErrorCodeConfig.getStringProperty, propertyName=" + name + ".");
            return DEFAULT_STRING_VALUE;
        }
    }
1229475
private static String translateSchema(String schemaLocation) {

        if (OpenCms.getRepositoryManager() != null) {
            return OpenCms.getResourceManager().getXsdTranslator().translateResource(schemaLocation);
        }
        return schemaLocation;
    }
1025874
private String getAvailableLocalVariant(String path, String baseName) {

        //First look for a bundle with the locale of the folder..
        try {
            CmsProperty propLoc = m_clonedCms.readPropertyObject(path, CmsPropertyDefinition.PROPERTY_LOCALE, true);
            if (!propLoc.isNullProperty()) {
                if (m_clonedCms.existsResource(path + baseName + "_" + propLoc.getValue())) {
                    return baseName + "_" + propLoc.getValue();
                }
            }
        } catch (CmsException e) {
            LOG.error("Can not read locale property", e);
        }

        //If no bundle was found with the locale of the folder, or the property was not set, search for other locales
        A_CmsUI.get();
        List<String> localVariations = CmsLocaleManager.getLocaleVariants(
            baseName,
            UI.getCurrent().getLocale(),
            false,
            true);

        for (String name : localVariations) {
            if (m_clonedCms.existsResource(path + name)) {
                return name;
            }
        }

        return null;
    }
581916
private String getLocationName( DroolsParaphraseTypes type ) {
        switch ( type ) {
            case PACKAGE :
                return "package";
            case IMPORT :
                return "import";
            case FUNCTION_IMPORT :
                return "function import";
            case ACCUMULATE_IMPORT :
                return "accumulate import";
            case GLOBAL :
                return "global";
            case FUNCTION :
                return "function";
            case QUERY :
                return "query";
            case TEMPLATE :
                return "template";
            case RULE :
                return "rule";
            case RULE_ATTRIBUTE :
                return "rule attribute";
            case PATTERN :
                return "pattern";
            case EVAL :
                return "eval";
            default :
                return "";
        }
    }
301287
protected final MetaProperties getMetaFile(String url) throws UpdateException {
        try {
            final String metaUrl = url.substring(0, url.length() - 7) + "meta";
            final URL u = new URL(metaUrl);
            final Downloader d = new Downloader(settings);
            final String content = d.fetchContent(u, true);
            return new MetaProperties(content);
        } catch (MalformedURLException ex) {
            throw new UpdateException("Meta file url is invalid: " + url, ex);
        } catch (InvalidDataException ex) {
            throw new UpdateException("Meta file content is invalid: " + url, ex);
        } catch (DownloadFailedException ex) {
            throw new UpdateException("Unable to download meta file: " + url, ex);
        }
    }
657185
public boolean containsKey(Object propertyName) {
        if (propertyName instanceof CharSequence) propertyName = propertyName.toString();
        Assert.isInstanceOf(String.class, propertyName, "This map implementation only supports String based keys!");

        String pn = propertyName.toString();
        return !NameUtils.isConfigurational(pn) && metaClass.getMetaProperty(pn) != null;
    }
1032463
public static PropertyResourceBundle getBundle(String baseName, Locale locale) throws UnsupportedEncodingException, IOException{
		InputStream is = UTF8PropertyResourceBundle.class.getResourceAsStream("/"+baseName + "_"+locale.toString()+PROPERTIES_EXT);
		if(is != null){
			return new PropertyResourceBundle(new InputStreamReader(is, "UTF-8"));
		}
		return null;
	}
194060
public MetaProperty getMetaProperty(String name) {
        MetaProperty mp = this.expandoProperties.get(name);
        if (mp != null) return mp;
        return super.getMetaProperty(name);
    }
504857
public String getTypeGenericsSimple() {
        final String type = getType();
        if (type.contains("<")) {
            return type.substring(type.indexOf('<') + 1, type.length() - 1);
        }
        return "";
    }
1203572
public Metadata getMetadata(String typeName) {
        String scope = Metadata.scopeBasedOnType(typeName);
        return this.getMetadata(typeName, scope);
    }