Search in sources :

Example 6 with ReadException

use of com.developmentontheedge.be5.metadata.exception.ReadException in project be5 by DevelopmentOnTheEdge.

the class Serialization method reloadLocalization.

public static LanguageLocalizations reloadLocalization(final Path file, final Localizations localizations) throws ReadException {
    checkProject(localizations.getProject());
    turnOffAutomaticSerialization();
    try {
        return new YamlDeserializer(new LoadContext()).reloadLocalization(file, localizations);
    } finally {
        turnOnAutomaticSerialization();
    }
}
Also used : YamlDeserializer(com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)

Example 7 with ReadException

use of com.developmentontheedge.be5.metadata.exception.ReadException in project be5 by DevelopmentOnTheEdge.

the class Serialization method reloadPages.

public static StaticPages reloadPages(final Path file, final Module target) throws ReadException {
    checkProject(target.getProject());
    turnOffAutomaticSerialization();
    try {
        return new YamlDeserializer(new LoadContext()).reloadPages(file, target);
    } finally {
        turnOnAutomaticSerialization();
    }
}
Also used : YamlDeserializer(com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)

Example 8 with ReadException

use of com.developmentontheedge.be5.metadata.exception.ReadException in project be5 by DevelopmentOnTheEdge.

the class YamlDeserializer method readQuery.

public static Query readQuery(final LoadContext loadContext, final String queryName, final Map<String, Object> content, final Entity entity) {
    YamlDeserializer yamlDeserializer = new YamlDeserializer(loadContext);
    yamlDeserializer.setProject(entity.getProject());
    EntityDeserializer entityDeserializer = yamlDeserializer.new EntityDeserializer();
    try {
        return entityDeserializer.readQuery(queryName, content, entity);
    } catch (ReadException e) {
        Query query = new Query(queryName, entity);
        loadContext.addWarning(e.attachElement(query));
        return query;
    }
}
Also used : ReadException(com.developmentontheedge.be5.metadata.exception.ReadException) Query(com.developmentontheedge.be5.metadata.model.Query)

Example 9 with ReadException

use of com.developmentontheedge.be5.metadata.exception.ReadException in project be5 by DevelopmentOnTheEdge.

the class YamlDeserializer method readConnectionProfile.

/**
 * Parses a connection profile. Doesn't save it to connection profiles collection.
 *
 * @param serializedProfileBody just a map of properties
 * @throws ReadException
 */
private static BeConnectionProfile readConnectionProfile(final LoadContext loadContext, final String profileName, final Map<String, Object> serializedProfileBody, final Project project) throws ReadException {
    final YamlDeserializer yamlDeserializer = new YamlDeserializer(loadContext);
    final ConnectionProfilesDeserializer connectionProfilesDeserializer = yamlDeserializer.new ConnectionProfilesDeserializer(project.getConnectionProfiles().getLocalProfiles());
    final BeConnectionProfile connectionProfile = connectionProfilesDeserializer.deserializeConnectionProfile(profileName, serializedProfileBody);
    return connectionProfile;
}
Also used : BeConnectionProfile(com.developmentontheedge.be5.metadata.model.BeConnectionProfile)

Example 10 with ReadException

use of com.developmentontheedge.be5.metadata.exception.ReadException in project be5 by DevelopmentOnTheEdge.

the class YamlDeserializer method readEntity.

public static Entity readEntity(final LoadContext loadContext, final String entityName, final Map<String, Object> content, final Module module) {
    YamlDeserializer yamlDeserializer = new YamlDeserializer(loadContext);
    yamlDeserializer.setProject(module.getProject());
    EntityDeserializer entityDeserializer = yamlDeserializer.new EntityDeserializer();
    try {
        return entityDeserializer.readEntity(entityName, content, module);
    } catch (ReadException e) {
        Entity entity = new Entity(entityName, module, EntityType.TABLE);
        loadContext.addWarning(e.attachElement(entity));
        return entity;
    }
}
Also used : ReadException(com.developmentontheedge.be5.metadata.exception.ReadException) Entity(com.developmentontheedge.be5.metadata.model.Entity)

Aggregations

YamlDeserializer (com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)10 ReadException (com.developmentontheedge.be5.metadata.exception.ReadException)9 Map (java.util.Map)5 IOException (java.io.IOException)4 Entity (com.developmentontheedge.be5.metadata.model.Entity)3 Path (java.nio.file.Path)3 BeConnectionProfile (com.developmentontheedge.be5.metadata.model.BeConnectionProfile)2 BeModelElement (com.developmentontheedge.be5.metadata.model.base.BeModelElement)2 DataElementPath (com.developmentontheedge.be5.metadata.model.base.DataElementPath)2 LinkedHashMap (java.util.LinkedHashMap)2 MarkedYAMLException (org.yaml.snakeyaml.error.MarkedYAMLException)2 YAMLException (org.yaml.snakeyaml.error.YAMLException)2 FreemarkerSqlException (com.developmentontheedge.be5.metadata.exception.FreemarkerSqlException)1 ProcessInterruptedException (com.developmentontheedge.be5.metadata.exception.ProcessInterruptedException)1 ProjectLoadException (com.developmentontheedge.be5.metadata.exception.ProjectLoadException)1 BeConnectionProfiles (com.developmentontheedge.be5.metadata.model.BeConnectionProfiles)1 ColumnDef (com.developmentontheedge.be5.metadata.model.ColumnDef)1 Daemons (com.developmentontheedge.be5.metadata.model.Daemons)1 DataElementUtils (com.developmentontheedge.be5.metadata.model.DataElementUtils)1 DdlElement (com.developmentontheedge.be5.metadata.model.DdlElement)1