Search in sources :

Example 6 with YamlDeserializer

use of com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer 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 7 with YamlDeserializer

use of com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer 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 8 with YamlDeserializer

use of com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer 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 9 with YamlDeserializer

use of com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer 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)

Example 10 with YamlDeserializer

use of com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer in project be5 by DevelopmentOnTheEdge.

the class Serialization method reloadEntity.

public static Entity reloadEntity(final Entity oldEntity) throws ReadException {
    checkProject(oldEntity.getProject());
    turnOffAutomaticSerialization();
    try {
        return new YamlDeserializer(new LoadContext()).reloadEntity(oldEntity);
    } finally {
        turnOnAutomaticSerialization();
    }
}
Also used : YamlDeserializer(com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)

Aggregations

YamlDeserializer (com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)10 ReadException (com.developmentontheedge.be5.metadata.exception.ReadException)3 ProjectLoadException (com.developmentontheedge.be5.metadata.exception.ProjectLoadException)1 BeConnectionProfile (com.developmentontheedge.be5.metadata.model.BeConnectionProfile)1 Entity (com.developmentontheedge.be5.metadata.model.Entity)1 Query (com.developmentontheedge.be5.metadata.model.Query)1