Search in sources :

Example 21 with ReadException

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

the class Serialization method reloadCustomizations.

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

Example 22 with ReadException

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

the class YamlDeserializer method reloadPages.

public StaticPages reloadPages(final Path path, final Module target) throws ReadException {
    final StaticPages pages = new StaticPages(target);
    final StaticPagesDeserializer deserializer = new StaticPagesDeserializer(path, pages);
    deserializer.deserialize();
    DataElementUtils.saveQuiet(pages);
    return pages;
}
Also used : StaticPages(com.developmentontheedge.be5.metadata.model.StaticPages) LanguageStaticPages(com.developmentontheedge.be5.metadata.model.LanguageStaticPages)

Example 23 with ReadException

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

the class YamlDeserializer method reloadDaemons.

public Daemons reloadDaemons(final Path path, final Module target) throws ReadException {
    final Daemons daemons = new Daemons(target);
    final DaemonsDeserializer deserializer = new DaemonsDeserializer(path, daemons);
    deserializer.deserialize();
    DataElementUtils.saveQuiet(daemons);
    return daemons;
}
Also used : Daemons(com.developmentontheedge.be5.metadata.model.Daemons)

Example 24 with ReadException

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

the class YamlDeserializer method deserializeConnectionProfile.

/**
 * Parses a connection profile. Doesn't save it to connection profiles
 * collection.
 *
 * @param serialized
 *            Must contain a serialized JSON with a map as a root element.
 *            This map should have only one key, that represents a
 *            connection profile name. The value should contain pairs of connection profile fields.
 * @throws ReadException
 * @throws ClassCastException
 * @see Fields#connectionProfile()
 * @see Fields#connectionProfileRead()
 */
public static BeConnectionProfile deserializeConnectionProfile(final LoadContext loadContext, final String serialized, final Project project) throws ReadException {
    // unsafe
    @SuppressWarnings("unchecked") final LinkedHashMap<String, Object> namedProfile = (LinkedHashMap<String, Object>) new Yaml().load(serialized);
    final String profileName = namedProfile.keySet().iterator().next();
    // unsafe
    @SuppressWarnings("unchecked") final Map<String, Object> serializedProfileBody = (Map<String, Object>) namedProfile.get(profileName);
    final BeConnectionProfile profile = readConnectionProfile(loadContext, profileName, serializedProfileBody, project);
    return profile;
}
Also used : BeConnectionProfile(com.developmentontheedge.be5.metadata.model.BeConnectionProfile) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) Yaml(org.yaml.snakeyaml.Yaml) LinkedHashMap(java.util.LinkedHashMap)

Example 25 with ReadException

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

the class YamlDeserializer method reloadMassChanges.

public MassChanges reloadMassChanges(final Path path, final Module application) throws ReadException {
    final MassChanges massChanges = application.newMassChangeCollection();
    final MassChangesDeserializer massChangesDeserializer = new MassChangesDeserializer(path, massChanges);
    massChangesDeserializer.deserialize();
    DataElementUtils.saveQuiet(massChangesDeserializer.getResult());
    return massChangesDeserializer.getResult();
}
Also used : MassChanges(com.developmentontheedge.be5.metadata.model.MassChanges)

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