ToJSONSubmitResultTransformer$.java 4.44 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.forms.transformer.impl.ToJSONSubmitResultTransformer$$anonfun
 *  com.adobe.forms.transformer.impl.ToJSONSubmitResultTransformer$$anonfun$transformValidationErrors
 *  net.liftweb.json.JsonAST
 *  net.liftweb.json.JsonAST$JArray
 *  net.liftweb.json.JsonAST$JField
 *  net.liftweb.json.JsonAST$JObject
 *  net.liftweb.json.JsonAST$JString
 *  net.liftweb.json.JsonAST$JValue
 *  net.liftweb.json.Printer
 *  net.liftweb.json.Printer$
 *  net.liftweb.json.package
 *  net.liftweb.json.package$
 *  scala.Function1
 *  scala.None
 *  scala.None$
 *  scala.Option
 *  scala.ScalaObject
 *  scala.Some
 *  scala.collection.Seq
 *  scala.collection.generic.CanBuildFrom
 *  scala.collection.immutable.List
 *  scala.collection.immutable.List$
 *  scala.collection.immutable.Nil
 *  scala.collection.immutable.Nil$
 *  scala.runtime.AbstractFunction1
 *  scala.text.Document
 *  scala.xml.Node
 *  scala.xml.NodeSeq
 *  scala.xml.XML
 *  scala.xml.XML$
 */
package com.adobe.forms.transformer.impl;

import com.adobe.forms.transformer.impl.ToJSONSubmitResultTransformer$;
import net.liftweb.json.JsonAST;
import net.liftweb.json.Printer;
import net.liftweb.json.package;
import scala.Function1;
import scala.None;
import scala.Option;
import scala.ScalaObject;
import scala.Some;
import scala.collection.Seq;
import scala.collection.generic.CanBuildFrom;
import scala.collection.immutable.List;
import scala.collection.immutable.Nil;
import scala.runtime.AbstractFunction1;
import scala.text.Document;
import scala.xml.Node;
import scala.xml.NodeSeq;
import scala.xml.XML;

/*
 * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
 */
public final class ToJSONSubmitResultTransformer$
implements ScalaObject {
    public static final ToJSONSubmitResultTransformer$ MODULE$;

    public static {
        new com.adobe.forms.transformer.impl.ToJSONSubmitResultTransformer$();
    }

    public String transform(String mergedFormDom, String procInfo) {
        JsonAST.JField jField = new JsonAST.JField("mergedformdom", (JsonAST.JValue)new JsonAST.JString(mergedFormDom));
        JsonAST.JField jField2 = new JsonAST.JField("validationErrors", (JsonAST.JValue)this.transformValidationErrors(this.validationErrors(procInfo)));
        return Printer..MODULE$.compact(package..MODULE$.render((JsonAST.JValue)new JsonAST.JObject(Nil..MODULE$.$colon$colon((Object)jField2).$colon$colon((Object)jField))));
    }

    public Option<Node> validationErrors(String procInfo) {
        return procInfo != null && procInfo.length() > 0 ? XML..MODULE$.loadString(procInfo).$bslash("validationErrors").headOption() : None..MODULE$;
    }

    public JsonAST.JArray transformValidationErrors(Option<Node> validationErrors) {
        Option<Node> option = validationErrors;
        return option instanceof Some ? new JsonAST.JArray((List)((Node)((Some)option).x()).child().toList().map((Function1)new scala.Serializable(){
            public static final long serialVersionUID;

            public static {
                long l = anonfun.transformValidationErrors.serialVersionUID = 0;
            }

            public final JsonAST.JObject apply(Node message$1) {
                JsonAST.JField jField = new JsonAST.JField("text", (JsonAST.JValue)new JsonAST.JString(message$1.text()));
                return new JsonAST.JObject(((List)List..MODULE$.apply((Seq)scala.Predef$.MODULE$.wrapRefArray((Object[])new String[]{"tid", "sev", "d", "ref"})).map((Function1)new scala.Serializable(this, message$1){
                    public static final long serialVersionUID;
                    private final Node message$1;

                    public static {
                        long l = com.adobe.forms.transformer.impl.ToJSONSubmitResultTransformer$$anonfun$transformValidationErrors$1$$anonfun$apply$1.serialVersionUID = 0;
                    }

                    public final JsonAST.JField apply(String attr) {
                        return new JsonAST.JField(attr, (JsonAST.JValue)new JsonAST.JString(this.message$1.$bslash(new scala.collection.mutable.StringBuilder().append((Object)"@").append((Object)attr).toString()).text()));
                    }
                }, List..MODULE$.canBuildFrom())).$colon$colon((Object)jField));
            }
        }, List..MODULE$.canBuildFrom())) : new JsonAST.JArray((List)Nil..MODULE$);
    }

    private ToJSONSubmitResultTransformer$() {
        MODULE$ = this;
    }
}