AEM as a Cloud Service Tutorials -> Create Content Analyzer | AEM Community Blog Seeding | Community
Skip to main content
kautuk_sahni
Community Manager
Community Manager
September 6, 2021

AEM as a Cloud Service Tutorials -> Create Content Analyzer | AEM Community Blog Seeding

  • September 6, 2021
  • 0 replies
  • 324 views

BlogImage.jpg

AEM as a Cloud Service Tutorials -> Create Content Analyzer by Adobe Docs

Abstract

The details of this form parameter are available here.

The sample code listed below generates the JSON fragment for all Office 365 document types.


package com.aemforms.doccloud.core.impl;

import com.google.gson.JsonObject;

public class GetContentAnalyser {
public static String getContentAnalyserRequest(String fileName)
{
JsonObject outerWrapper = new JsonObject();


JsonObject documentIn = new JsonObject();
documentIn.addProperty("cpf:location", "InputFile0");

if(fileName.endsWith(".pptx"))
{
documentIn.addProperty("dc:format","application/vnd.openxmlformats-officedocument.presentationml.presentation");
}

if(fileName.endsWith(".docx"))
{

documentIn.addProperty("dc:format","application/vnd.openxmlformats-officedocument.wordprocessingml.document");
}
if(fileName.endsWith(".xlsx"))
{
documentIn.addProperty("dc:format","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
}
if(fileName.endsWith(".xml"))
{
documentIn.addProperty("dc:format","text/plain");
}
if(fileName.endsWith(".jpg"))
{
documentIn.addProperty("dc:format","image/jpeg");
}

JsonObject cpfinputs = new JsonObject();
cpfinputs.add("documentIn", documentIn);


//documentInWrapper.add("documentIn",documentIn);
JsonObject cpfengine = new JsonObject();
cpfengine.addProperty("repo:assetId", "urn:aaid:cpf:Service-1538ece812254acaac2a07799503a430");

JsonObject documentOut = new JsonObject();

documentOut.addProperty("cpf:location", "multipartLabelOut");
documentOut.addProperty("dc:format", "application/pdf");
JsonObject documentOutWrapper = new JsonObject();
documentOutWrapper.add("documentOut",documentOut);

outerWrapper.add("cpf:inputs",cpfinputs);
outerWrapper.add("cpf:engine", cpfengine);
outerWrapper.add("cpf:outputs", documentOutWrapper);
System.out.println("The content Analyser is "+outerWrapper.toString());

return outerWrapper.toString();





}

}

Read Full Blog

AEM as a Cloud Service Tutorials -> Create Content Analyzer

Q&A

Please use this thread to ask the related questions.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.