use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class LanguageSelector method getState.
private LanguageSelectorResponse getState(Injector injector) {
Project project = injector.getProject();
List<String> languages = Arrays.stream(project.getLanguages()).map(String::toUpperCase).collect(Collectors.toList());
String selectedLanguage = UserInfoHolder.getLanguage().toUpperCase();
Map<String, String> messages = readMessages(project, selectedLanguage);
return new LanguageSelectorResponse(languages, selectedLanguage, messages);
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class Serialization method load.
/**
* @param root
* @param fuseTemplates whether to fuse templates into entities (useful for modules loading)
* @param loadContext
* @return
* @throws ProjectLoadException
* @see Serialization#canBeLoaded(Path)
*/
public static Project load(final Path root, final boolean fuseTemplates, final LoadContext loadContext) throws ProjectLoadException {
Objects.requireNonNull(root);
turnOffAutomaticSerialization();
try {
return new YamlDeserializer(loadContext == null ? new LoadContext() : loadContext, fuseTemplates).readProject(root);
} catch (final ReadException e) {
throw new ProjectLoadException(root, e);
} finally {
turnOnAutomaticSerialization();
}
}
use of com.developmentontheedge.be5.metadata.model.Project 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;
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class YamlDeserializer method readProjectFileStructure.
private ProjectFileStructure readProjectFileStructure(BaseDeserializer deserializer, final Map<String, Object> serializedPfs, final Project project) {
final ProjectFileStructure pfs = new ProjectFileStructure(project);
deserializer.readFields(pfs, serializedPfs, Fields.projectFileStructure());
return pfs;
}
use of com.developmentontheedge.be5.metadata.model.Project in project be5 by DevelopmentOnTheEdge.
the class YamlDeserializer method reloadSecurityCollection.
public SecurityCollection reloadSecurityCollection(final Path path, final Project project) throws ReadException {
final SecurityCollection security = project.newSecurityCollection();
final SecurityDeserializer securityDeserializer = new SecurityDeserializer(path, security);
securityDeserializer.deserialize();
DataElementUtils.saveQuiet(securityDeserializer.getResult());
return securityDeserializer.getResult();
}
Aggregations