Generates the format restriction objects.<p>
433664
private void generateFormats() {

        m_formats = new LinkedHashMap<String, I_CmsFormatRestriction>();
        for (int i = 0; i < m_formatValues.length; i++) {
            String value = m_formatValues[i].trim();

            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) {
                String label = value;
                String key = value;
                if ((m_formatNames != null)
                    && (m_formatNames.length > i)
                    && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_formatNames[i])) {
                    int pos = m_formatNames[i].indexOf(":");
                    if (pos > 0) {
                        label = m_formatNames[i].substring(pos + 1, m_formatNames[i].length());
                        key = m_formatNames[i].substring(0, pos);
                    } else {
                        label = m_formatNames[i];
                        key = m_formatNames[i];
                    }
                }

                DefaultRestriction restrictionType = null;
                try {
                    restrictionType = DefaultRestriction.valueOf(value);
                } catch (Exception e) {
                    // happens with user defined restriction settings
                }
                if (restrictionType != null) {
                    switch (restrictionType) {
                        case original:
                            m_formats.put(key, new CmsOriginalFormatRestriction(key, label));
                            break;
                        case user:
                            m_userFormatKey = key;
                            m_formats.put(key, new CmsUserFormatRestriction(key, label));
                            break;
                        case free:
                            m_formats.put(key, new CmsFreeFormatRestriction(key, label));
                            break;
                        case small:
                            m_formats.put(key, new CmsImageFormatRestriction(key, label, "200x?"));
                            break;
                        case big:
                            m_formats.put(key, new CmsImageFormatRestriction(key, label, "500x?"));
                            break;
                        default:
                    }
                } else {
                    if (CmsImageFormatRestriction.isValidConfig(value)) {
                        m_formats.put(key, new CmsImageFormatRestriction(key, label, value));
                    }
                }
            }
        }
    }
539455
protected void generateBlockExpressionBuilderImpl() {
		final TypeReference builderInterface = getBlockExpressionBuilderInterface();
		final TypeReference builder = getBlockExpressionBuilderImpl();
		final StringConcatenationClient content = new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation it) {
				it.append("/** Builder of a " + getLanguageName() //$NON-NLS-1$
						+ " XBlockExpression."); //$NON-NLS-1$
				it.newLine();
				it.append(" */"); //$NON-NLS-1$
				it.newLine();
				it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$
				it.newLine();
				it.append("public class "); //$NON-NLS-1$
				it.append(builder.getSimpleName());
				it.append(" extends "); //$NON-NLS-1$
				it.append(getAbstractBuilderImpl());
				it.append(" implements "); //$NON-NLS-1$
				it.append(builderInterface);
				it.append(" {"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append(generateMembers(false, false));
				it.append("}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
			}
		};
		final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(builder, content);
		javaFile.writeTo(getSrcGen());
	}
1178009
@SuppressWarnings("checkstyle:all")
	protected void generateIDocumentationFormatter() {
		final TypeReference formatter = getIDocumentationFormatter();
		StringConcatenationClient content = new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation it) {
				it.append("/** Format a documentation string."); //$NON-NLS-1$
				it.newLine();
				it.append(" */"); //$NON-NLS-1$
				it.newLine();
				it.append("public interface "); //$NON-NLS-1$
				it.append(formatter.getSimpleName());
				it.append(" {"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the characters that must be used as prefix of each line in a multiline comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the prefix."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tString getMultilineCommentLinePrefix();"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the characters that must be used to start a comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the symbols."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tString getMultilineCommentStartSymbols();"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the characters that must be used to end a comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the symbols."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tString getMultilineCommentEndSymbols();"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the string that must be used as prefix of a singleline comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the prefix."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tString getSinglelineCommentPrefix();"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the formatted string that corresponds to the given documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param doc the documentation text. It may be on multiple lines."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the formatted comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tString formatMultilineComment(String doc);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the formatted string that corresponds to the given documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param doc the documentation text. It may be on multiple lines."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param indentation the string to put for indenting the comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the formatted comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tString formatMultilineComment(String doc, String indentation);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the formatted string that corresponds to the given documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param doc the documentation text. It may be on multiple lines."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param appendable the receiver of the formatted string."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tvoid formatMultilineComment(String doc, "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the formatted string that corresponds to the given documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param doc the documentation text. It may be on multiple lines."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param indentation the string to put for indenting the comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param appendable the receiver of the formatted string."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tvoid formatMultilineComment(String doc, String indentation, "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Format the given multiline documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t *"); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param context the formatting context."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param comment the comment to format out."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic void formatMultilineComment("); //$NON-NLS-1$
				it.append(ITextReplacerContext.class);
				it.append(" context, "); //$NON-NLS-1$
				it.append(IComment.class);
				it.append(" comment);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the formatted string that corresponds to the given documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param doc the documentation text. It may be on multiple lines."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the formatted comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tString formatSinglelineComment(String doc);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the formatted string that corresponds to the given documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param doc the documentation text. It may be on multiple lines."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param indentation the string to put for indenting the comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the formatted comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tString formatSinglelineComment(String doc, String indentation);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the formatted string that corresponds to the given documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param doc the documentation text. It may be on multiple lines."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param appendable the receiver of the formatted string."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tvoid formatSinglelineComment(String doc, "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the formatted string that corresponds to the given documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param doc the documentation text. It may be on multiple lines."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param indentation the string to put for indenting the comment."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param appendable the receiver of the formatted string."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tvoid formatSinglelineComment(String doc, String indentation, "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Format the given singleline documentation."); //$NON-NLS-1$
				it.newLine();
				it.append("\t *"); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param context the formatting context."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param comment the comment to format out."); //$NON-NLS-1$
				it.newLine();
				it.append("\t */"); //$NON-NLS-1$
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tvoid formatSinglelineComment("); //$NON-NLS-1$
				it.append(ITextReplacerContext.class);
				it.append(" context, "); //$NON-NLS-1$
				it.append(IComment.class);
				it.append(" comment);"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
			}

		};
		JavaFileAccess createJavaFile = getFileAccessFactory().createJavaFile(formatter, content);
		createJavaFile.writeTo(getSrcGen());
	}
25809
public String getFormat(CmsObject cms) {

        if (m_format == null) {
            if (m_element.element(PARAM_FORMAT) != null) {
                m_format = m_element.element(PARAM_FORMAT).getText();
            }
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_format)) {
                m_format = getParameterValue(cms, PARAM_FORMAT);
            }
        }
        return m_format;
    }
167792
@Override
	public void generateSpecializedPart(SQLiteModelMethod method, TypeSpec.Builder classBuilder, MethodSpec.Builder methodBuilder, Set<JQLProjection> fieldList, boolean mapFields) {
		TypeName returnTypeName = method.getReturnClass();

		//ASSERT: returnType is a supported type
		
		// no column or too many columns
		AssertKripton.assertTrueOrInvalidMethodSignException(fieldList.size() == 1, method, "no way to understand which field is the result for this method");				

		SQLTransform t = SQLTransformer.lookup(returnTypeName);

		methodBuilder.addCode("$T result=", returnTypeName);
		t.generateDefaultValue(methodBuilder);
		methodBuilder.addCode(";\n");

		methodBuilder.addCode("\n");
		// methodBuilder.beginControlFlow("try");
		methodBuilder.beginControlFlow("if (_cursor.moveToFirst())");

		// generate index from columns
		methodBuilder.addCode("\n");

		if (TypeUtility.isNullable(returnTypeName)) {
			methodBuilder.addCode("if (_cursor.isNull(0)) { return null; }\n");
		} else {
			methodBuilder.addCode("if (_cursor.isNull(0)) { return ");
			t.generateDefaultValue(methodBuilder);
			methodBuilder.addCode("; }\n", t);
		}
		methodBuilder.addCode("result=");
		t.generateReadValueFromCursor(methodBuilder, method.getParent(), returnTypeName, "_cursor", "0");
		methodBuilder.addCode(";\n");

		// end cursor
		methodBuilder.endControlFlow();

		methodBuilder.addCode("return result;\n");
		// end method
		methodBuilder.endControlFlow();
	}
161326
protected void _format(SarlCapacity capacity, IFormattableDocument document) {
		formatAnnotations(capacity, document, XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations);
		formatModifiers(capacity, document);

		final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(capacity);

		document.append(regionFor.keyword(this.keywords.getCapacityKeyword()), ONE_SPACE);

		document.surround(regionFor.keyword(this.keywords.getExtendsKeyword()), ONE_SPACE);
		formatCommaSeparatedList(capacity.getExtends(), document);

		formatBody(capacity, document);
	}
93834
public static String generate(String prefix,Object...args){
		if(args == null || args.length == 0)return prefix;
		StringBuilder keyBuilder = new StringBuilder(prefix);
		
		String keyString = null;
		if(args != null && args.length > 0){
			keyBuilder.append(":");
			StringBuilder argsBuilder = new StringBuilder();
			for (int i = 0; i < args.length; i++) {
				if(args[i] == null){
					argsBuilder.append("_null");
				}else if(isSimpleDataType(args[i])){
					argsBuilder.append(args[i].toString());
				}else if(args[i] instanceof Collection){
					argsBuilder.append(args[i].toString().replaceAll("\\s{0,}", ""));
				}else{
					argsBuilder.append(ToStringBuilder.reflectionToString(args[i], ToStringStyle.SHORT_PREFIX_STYLE));
				}
				if(i < args.length - 1)argsBuilder.append("_");
			}
			keyString = argsBuilder.length() > 32 ? md5(argsBuilder) : argsBuilder.toString();
			keyBuilder.append(keyString);
		}
		return keyBuilder.toString();
	}
905991
private String generateReqParams() throws UnsupportedEncodingException {

        String params = "";
        if ((m_parameterMap != null) && !m_parameterMap.isEmpty()) {
            for (Entry<String, String[]> paramEntry : m_parameterMap.entrySet()) {
                if (paramEntry.getValue() != null) {
                    for (int i = 0; i < paramEntry.getValue().length; i++) {
                        params += "&"
                            + paramEntry.getKey()
                            + "="
                            + URLEncoder.encode(paramEntry.getValue()[i], "UTF-8");
                    }
                }
            }
            params = "?" + params.substring(1);
        }
        return params;
    }
823830
protected void generateCharacterEvents(
            IPortletWindowId portletWindowId,
            StartElement event,
            Collection<CharacterEvent> eventBuffer)
            throws XMLStreamException {
        throw new UnsupportedOperationException();
    }
1025223
public List<CmsFormatterBean> getFormatters() {

        CmsFormatterBean mainFormatter = createFormatterBean(m_mainFormat, true);
        List<CmsFormatterBean> formatters = new ArrayList<CmsFormatterBean>();
        formatters.add(mainFormatter);
        for (Format format : m_otherFormats) {
            formatters.add(createFormatterBean(format, false));
        }
        return formatters;
    }
306261
void generateValidationChecks(
            final CtClass ctClass,
            final StringBuilder validationChecksCode,
            final StringBuilder staticInitializerCode,
            final List<String> staticFields) {

        for (final CtField ctField : ctClass.getDeclaredFields()) {
            for (final Object annotationObject : ctField.getAvailableAnnotations()) {
                final Annotation annotation = (Annotation) annotationObject;
                if (ANNOTATIONS.contains(annotation.annotationType())) {
                    final Constraint constraint = annotation.annotationType().getAnnotation(Constraint.class);
                    final Class<? extends AnnotationCheck<? extends Annotation>> checkClass = constraint.checkWith();
                    final String checkType = checkClass.getName();
                    final String checkName = getCheckName(ctField.getName(), checkType);
                    final String fieldName = ctField.getName();

                    // Define the member for the check
                    staticFields.add(generateCheckFieldDeclaration(checkType, checkName));

                    // Define the member for the field context
                    staticFields.add(generateFieldContextDeclaration(ctClass.getName(), checkName, fieldName));

                    // Write the check initializer code
                    staticInitializerCode.append(
                            generateCheckInitializer(
                                    ctClass.getName(),
                                    checkName,
                                    fieldName,
                                    annotation.annotationType().getName()));

                    // Write the validation code
                    validationChecksCode.append(generateValidation(
                            annotation,
                            checkType,
                            checkName,
                            fieldName));
                }
            }
        }
    }
626137
private I_CmsFormatRestriction getMatchingFormat(CmsCroppingParamBean croppingParam, boolean forceByName) {

        I_CmsFormatRestriction result = null;
        if (forceByName && m_formats.containsKey(croppingParam.getFormatName())) {
            result = m_formats.get(croppingParam.getFormatName());
            if (!result.matchesCroppingParam(croppingParam)) {
                result.adjustCroppingParam(croppingParam);
            }
            return result;
        }
        for (I_CmsFormatRestriction format : m_formats.values()) {

            if (format.matchesCroppingParam(croppingParam)) {
                result = format;
                if (format.getName().equals(croppingParam.getFormatName())) {
                    break;
                }
            }
        }
        return result;
    }
288220
private void copyLanguageNodes() {

        CmsObject cms = getCms();
        CmsMultiplexReport report = (CmsMultiplexReport)getReport();
        CmsFile file;
        CmsXmlContent content;
        int totalFiles = m_copyresources.length;
        int processedFiles = 0;
        Locale sourceLocale = CmsLocaleManager.getLocale(m_sourceLanguage);
        Locale targetLocale = CmsLocaleManager.getLocale(m_targetLanguage);

        for (int i = 0; i < m_copyresources.length; i++) {
            processedFiles++;
            report.print(
                org.opencms.report.Messages.get().container(
                    org.opencms.report.Messages.RPT_SUCCESSION_2,
                    new Object[] {String.valueOf(processedFiles), String.valueOf(totalFiles)}),
                I_CmsReport.FORMAT_NOTE);

            report.print(
                Messages.get().container(Messages.RPT_LOCALIZATION_BYPASS_1, new Object[] {m_copyresources[i]}));
            report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));

            try {
                file = cms.readFile(m_copyresources[i]);
                content = CmsXmlContentFactory.unmarshal(cms, file);

                if (!content.hasLocale(sourceLocale)) {
                    report.println(
                        Messages.get().container(
                            Messages.GUI_REPORT_LANGUAGEC0PY_WARN_SOURCELOCALE_MISSING_1,
                            new Object[] {sourceLocale}),
                        I_CmsReport.FORMAT_WARNING);
                    CmsMessageContainer container = Messages.get().container(
                        Messages.GUI_REPORT_LANGUAGEC0PY_WARN_SOURCELOCALE_MISSING_2,
                        new Object[] {m_copyresources[i], sourceLocale});
                    report.addWarning(container);
                } else if (content.hasLocale(targetLocale)) {
                    report.println(
                        Messages.get().container(
                            Messages.GUI_REPORT_LANGUAGEC0PY_WARN_TARGETLOCALE_EXISTS_1,
                            new Object[] {targetLocale}),
                        I_CmsReport.FORMAT_WARNING);
                    CmsMessageContainer container = Messages.get().container(
                        Messages.GUI_REPORT_LANGUAGEC0PY_WARN_TARGETLOCALE_EXISTS_2,
                        new Object[] {m_copyresources[i], targetLocale});
                    report.addWarning(container);
                } else {
                    content.copyLocale(sourceLocale, targetLocale);
                    if (m_delete) {
                        content.removeLocale(sourceLocale);
                    }
                    file.setContents(content.marshal());
                    CmsLock lock = cms.getLock(file);
                    if (lock.isInherited()) {
                        unlockInherited(file.getRootPath());
                        cms.lockResource(m_copyresources[i]);
                    } else {
                        if (lock.isNullLock()) {
                            cms.lockResource(m_copyresources[i]);
                        } else {
                            if (!lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
                                cms.changeLock(m_copyresources[i]);
                            }
                        }
                    }
                    cms.writeFile(file);
                    cms.unlockResource(m_copyresources[i]);
                    report.println(
                        org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                        I_CmsReport.FORMAT_OK);
                }

            } catch (Throwable f) {
                CmsMessageContainer error = Messages.get().container(
                    Messages.GUI_REPORT_LANGUAGEC0PY_ERROR_2,
                    new String[] {m_copyresources[i], CmsException.getStackTraceAsString(f)});

                report.println(
                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
                    I_CmsReport.FORMAT_ERROR);
                // report.println(f);
                report.addError(error);

            }
        }
    }
109436
public Map<Object, String> getTrimToSize() {

        if (m_trimToSize == null) {
            m_trimToSize = CmsCollectionsGenericWrapper.createLazyMap(new CmsTrimToSizeTransformer());
        }
        return m_trimToSize;
    }
349676
private List<FormatterOption> getFormatterOptions(CmsObject cms, CmsResource resource) {

        List<FormatterOption> options = new ArrayList<FormatterOption>();
        Set<String> containerTypes = new HashSet<>();
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_displayContainerTypeConfig)) {
            String types = null;

            if (CmsPropertyDefinition.PROPERTY_TEMPLATE_DISPLAY_TYPES.equals(m_displayContainerTypeConfig)) {
                try {
                    CmsProperty prop = cms.readPropertyObject(
                        resource,
                        CmsPropertyDefinition.PROPERTY_TEMPLATE_DISPLAY_TYPES,
                        true);
                    String propValue = prop.getValue();
                    if (!CmsStringUtil.isEmptyOrWhitespaceOnly(propValue)) {
                        types = propValue;
                    } else {
                        // look up template property
                        try {
                            CmsTemplateLoaderFacade loaderFacade = OpenCms.getResourceManager().getTemplateLoaderFacade(
                                cms,
                                null,
                                resource,
                                CmsPropertyDefinition.PROPERTY_TEMPLATE);
                            CmsResource template = loaderFacade.getLoaderStartResource();
                            if (template != null) {
                                prop = cms.readPropertyObject(
                                    template,
                                    CmsPropertyDefinition.PROPERTY_TEMPLATE_DISPLAY_TYPES,
                                    false);
                                propValue = prop.getValue();
                                if (!CmsStringUtil.isEmptyOrWhitespaceOnly(propValue)) {
                                    types = propValue;
                                }
                            }
                        } catch (Exception ex) {
                            LOG.debug(ex.getMessage(), ex);
                        }
                    }
                } catch (CmsException e) {
                    LOG.warn(e.getLocalizedMessage(), e);
                }
            } else {
                types = m_displayContainerTypeConfig;
            }
            if (types != null) {
                containerTypes.addAll(Arrays.asList(types.split(TYPES_SPLITTER)));
            }
        }
        CmsADEConfigData config = OpenCms.getADEManager().lookupConfiguration(cms, resource.getRootPath());

        if (config != null) {
            Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
            for (I_CmsFormatterBean formatter : config.getDisplayFormatters(cms)) {
                if (!containerTypes.isEmpty()) {
                    if (Sets.intersection(containerTypes, formatter.getContainerTypes()).isEmpty()) {
                        continue;
                    }
                }
                for (String typeName : formatter.getResourceTypeNames()) {
                    String label = formatter.getNiceName(wpLocale)
                        + " ("
                        + CmsWorkplaceMessages.getResourceTypeName(wpLocale, typeName)
                        + ")";
                    options.add(
                        new FormatterOption(
                            typeName + CmsXmlDisplayFormatterValue.SEPARATOR + formatter.getId(),
                            typeName,
                            getDisplayType(formatter),
                            label,
                            formatter.getRank()));
                }
            }
        }
        Collections.sort(options, new FormatterComparator());
        return options;
    }
1221596
@Override
  public @NotNull Set<String> getAllowedComponents(@NotNull String resourcePath, @NotNull ResourceResolver resolver) {
    PageManager pageManager = AdaptTo.notNull(resolver, PageManager.class);
    Page page = pageManager.getContainingPage(resourcePath);
    if (page == null && StringUtils.contains(resourcePath, "/" + JcrConstants.JCR_CONTENT)) {
      // if resource does not exist (e.g. inherited parsys) get page from resource path manually
      page = pageManager.getPage(StringUtils.substringBefore(resourcePath, "/" + JcrConstants.JCR_CONTENT));
    }
    if (page == null) {
      return ImmutableSet.of();
    }
    String relativePath = StringUtils.substringAfter(resourcePath, page.getPath() + "/");
    return getAllowedComponents(page, relativePath, null, resolver);
  }
991900
private CmsDynamicFunctionBean.Format getFunctionFormat() {

        CmsDynamicFunctionBean functionBean = null;
        try {
            CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, m_cms.readFile(m_element.getResource()));
            CmsDynamicFunctionParser parser = new CmsDynamicFunctionParser();
            functionBean = parser.parseFunctionBean(m_cms, content);
        } catch (CmsException e) {
            LOG.debug(e.getLocalizedMessage(), e);
            return null;
        }
        CmsJspStandardContextBean contextBean = CmsJspStandardContextBean.getInstance(m_request);
        String type = contextBean.getContainer().getType();
        String width = contextBean.getContainer().getWidth();
        int widthNum = -1;
        try {
            widthNum = Integer.parseInt(width);
        } catch (NumberFormatException e) {
            LOG.debug(e.getLocalizedMessage(), e);
        }
        return functionBean.getFormatForContainer(m_cms, type, widthNum);
    }