Search in sources :

Example 1 with MDOType

use of com.github._1c_syntax.mdclasses.mdo.support.MDOType in project mdclasses by 1c-syntax.

the class MDOUtils method moduleTypesForMDOTypes.

private Map<MDOType, Set<ModuleType>> moduleTypesForMDOTypes() {
    Map<MDOType, Set<ModuleType>> result = new EnumMap<>(MDOType.class);
    for (MDOType mdoType : MDOType.values()) {
        Set<ModuleType> types = new HashSet<>();
        switch(mdoType) {
            case INTEGRATION_SERVICE:
                types.add(ModuleType.IntegrationServiceModule);
                break;
            case BOT:
                types.add(ModuleType.BotModule);
                break;
            case ACCOUNTING_REGISTER:
            case ACCUMULATION_REGISTER:
            case CALCULATION_REGISTER:
            case INFORMATION_REGISTER:
                types.add(ModuleType.ManagerModule);
                types.add(ModuleType.RecordSetModule);
                break;
            case BUSINESS_PROCESS:
            case CATALOG:
            case CHART_OF_ACCOUNTS:
            case CHART_OF_CALCULATION_TYPES:
            case CHART_OF_CHARACTERISTIC_TYPES:
            case DATA_PROCESSOR:
            case DOCUMENT:
            case EXCHANGE_PLAN:
            case REPORT:
            case TASK:
                types.add(ModuleType.ManagerModule);
                types.add(ModuleType.ObjectModule);
                break;
            case COMMAND_GROUP:
            case COMMON_ATTRIBUTE:
            case COMMON_PICTURE:
            case COMMON_TEMPLATE:
            case DEFINED_TYPE:
            case DOCUMENT_NUMERATOR:
            case EVENT_SUBSCRIPTION:
            case FUNCTIONAL_OPTION:
            case ROLE:
            case SCHEDULED_JOB:
            case SESSION_PARAMETER:
            case STYLE_ITEM:
            case STYLE:
            case SUBSYSTEM:
            case WS_REFERENCE:
            case XDTO_PACKAGE:
                break;
            case COMMON_COMMAND:
            case COMMAND:
                types.add(ModuleType.CommandModule);
                break;
            case COMMON_FORM:
            case FORM:
                types.add(ModuleType.FormModule);
                break;
            case COMMON_MODULE:
                types.add(ModuleType.CommonModule);
                break;
            case CONFIGURATION:
                types.add(ModuleType.ApplicationModule);
                types.add(ModuleType.SessionModule);
                types.add(ModuleType.ExternalConnectionModule);
                types.add(ModuleType.ManagedApplicationModule);
                types.add(ModuleType.OrdinaryApplicationModule);
                break;
            case CONSTANT:
                types.add(ModuleType.ValueManagerModule);
                break;
            case DOCUMENT_JOURNAL:
            case ENUM:
            case FILTER_CRITERION:
            case SETTINGS_STORAGE:
                types.add(ModuleType.ManagerModule);
                break;
            case HTTP_SERVICE:
                types.add(ModuleType.HTTPServiceModule);
                break;
            case SEQUENCE:
                types.add(ModuleType.RecordSetModule);
                break;
            case WEB_SERVICE:
                types.add(ModuleType.WEBServiceModule);
                break;
            default:
        }
        result.put(mdoType, types);
    }
    return result;
}
Also used : ModuleType(com.github._1c_syntax.mdclasses.mdo.support.ModuleType) HashSet(java.util.HashSet) Set(java.util.Set) MDOType(com.github._1c_syntax.mdclasses.mdo.support.MDOType) EnumMap(java.util.EnumMap) HashSet(java.util.HashSet)

Example 2 with MDOType

use of com.github._1c_syntax.mdclasses.mdo.support.MDOType in project mdclasses by 1c-syntax.

the class PairConverter method unmarshal.

@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    if ("languages".equals(reader.getNodeName())) {
        var uuid = reader.getAttribute("uuid");
        var language = (MDLanguage) context.convertAnother(new MDLanguage(), MDLanguage.class);
        language.setUuid(uuid);
        language.setMdoReference(new MDOReference(language));
        return Either.right(language);
    } else if (reader.getValue().contains(".")) {
        // уже лежит имя
        return Either.left(reader.getValue());
    } else {
        var type = MDOType.fromValue(reader.getNodeName());
        return type.map(mdoType -> Either.left(mdoType.getName() + "." + reader.getValue())).orElseGet(() -> Either.left(reader.getNodeName() + "." + reader.getValue()));
    }
}
Also used : MDOReference(com.github._1c_syntax.mdclasses.mdo.support.MDOReference) MDLanguage(com.github._1c_syntax.mdclasses.mdo.MDLanguage)

Aggregations

MDLanguage (com.github._1c_syntax.mdclasses.mdo.MDLanguage)1 MDOReference (com.github._1c_syntax.mdclasses.mdo.support.MDOReference)1 MDOType (com.github._1c_syntax.mdclasses.mdo.support.MDOType)1 ModuleType (com.github._1c_syntax.mdclasses.mdo.support.ModuleType)1 EnumMap (java.util.EnumMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1