public static PolicyDefinitionBean unmarshallPolicyDefinition(Map<String, Object> source) {
        if (source == null) {
            return null;
        }
        PolicyDefinitionBean bean = new PolicyDefinitionBean();
        bean.setId(asString(source.get("id")));
        bean.setName(asString(source.get("name")));
        bean.setDescription(asString(source.get("description")));
        bean.setForm(asString(source.get("form")));
        bean.setFormType(asEnum(source.get("formType"), PolicyFormType.class));
        bean.setIcon(asString(source.get("icon")));
        bean.setPluginId(asLong(source.get("pluginId")));
        bean.setPolicyImpl(asString(source.get("policyImpl")));
        bean.setDeleted(asBoolean(source.get("deleted")));
        @SuppressWarnings("unchecked")
        List<Map<String, Object>> templates = (List<Map<String, Object>>) source.get("templates");
        if (templates != null && !templates.isEmpty()) {
            bean.setTemplates(new HashSet<>());
            for (Map<String, Object> templateMap : templates) {
                PolicyDefinitionTemplateBean template = new PolicyDefinitionTemplateBean();
                template.setLanguage(asString(templateMap.get("language")));
                template.setTemplate(asString(templateMap.get("template")));
                bean.getTemplates().add(template);
            }
        }
        postMarshall(bean);
        return bean;
    }
public static PolicyDefinitionBean unmarshallPolicyDefinition ( Map < String , Object > source ) { if ( source == null ) { return null ; } PolicyDefinitionBean bean = new PolicyDefinitionBean ( ) ; bean . setId ( asString ( source . get ( "id" ) ) ) ; bean . setName ( asString ( source . get ( "name" ) ) ) ; bean . setDescription ( asString ( source . get ( "description" ) ) ) ; bean . setForm ( asString ( source . get ( "form" ) ) ) ; bean . setFormType ( asEnum ( source . get ( "formType" ) , PolicyFormType . class ) ) ; bean . setIcon ( asString ( source . get ( "icon" ) ) ) ; bean . setPluginId ( asLong ( source . get ( "pluginId" ) ) ) ; bean . setPolicyImpl ( asString ( source . get ( "policyImpl" ) ) ) ; bean . setDeleted ( asBoolean ( source . get ( "deleted" ) ) ) ; @ SuppressWarnings ( "unchecked" ) List < Map < String , Object > > templates = ( List < Map < String , Object > > ) source . get ( "templates" ) ; if ( templates != null && ! templates . isEmpty ( ) ) { bean . setTemplates ( new HashSet < > ( ) ) ; for ( Map < String , Object > templateMap : templates ) { PolicyDefinitionTemplateBean template = new PolicyDefinitionTemplateBean ( ) ; template . setLanguage ( asString ( templateMap . get ( "language" ) ) ) ; template . setTemplate ( asString ( templateMap . get ( "template" ) ) ) ; bean . getTemplates ( ) . add ( template ) ; } } postMarshall ( bean ) ; return bean ; }
Unmarshals the given map source into a bean.
@param source the source
@return the policy definition