Package org.aperteworkflow.editor.domain

Examples of org.aperteworkflow.editor.domain.ProcessConfig


        }
    }
   
    public ProcessConfig toObject(String json) {
        if (json == null) {
            return new ProcessConfig();
        }

        try {
            // decode from JSON
            ProcessConfig processConfig = mapper.readValue(json, ProcessConfig.class);

            // decode Base64 encoded fields
            if (processConfig.getComment() != null) {
                byte[] bytes = processConfig.getComment().getBytes();
                processConfig.setComment(new String(Base64.decodeBase64(bytes)));
            }
            if (processConfig.getMessages() != null) {
                for (String langCode : processConfig.getMessages().keySet()) {
                    String msg = processConfig.getMessages().get(langCode);
                    if (msg != null) {
                        byte[] bytes = msg.getBytes(MESSAGES_CHARSET);
                        msg = new String(Base64.decodeBase64(bytes), MESSAGES_CHARSET);
                        processConfig.getMessages().put(langCode, msg);
                    }
                }
            }
            if (processConfig.getDictionary() != null) {
                byte[] codedDictionaryInBytes = processConfig.getDictionary().getBytes();
                processConfig.setDictionary(new String(Base64.decodeBase64(codedDictionaryInBytes)));
            }

            return processConfig;
        } catch (IOException e) {
            throw new RuntimeException("Failed to read ProcessConfig from JSON", e);
View Full Code Here

TOP

Related Classes of org.aperteworkflow.editor.domain.ProcessConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.