Mostrando entradas con la etiqueta ssxa. Mostrar todas las entradas
Mostrando entradas con la etiqueta ssxa. Mostrar todas las entradas

10 oct 2013

View SiteStudio Dynamic List on WebCenter Portal application

Last week my coworker Daniel wanted to view the results of a Dynamic List on a WebCenter Portal Content Presenter Template. After a few test we saw that this feature is not suppported.

Under a Content Presenter Template (CPT) you can show any field of the DataFile, simple text, WYSWYG, static list of elements, but seems that the Dynamic List was missing by WebCenter developers ;-)

To solve this issue we created a custom TaskFlow that is capable of listing the elements of a Dynamic List (Element Definition).

First I've created a new Element Definition (ED) of type "Dynamic List", this ED will perform this query:

dExtension <matches> `docx`

This will retrieve all Word documents of the WebCenter Content (WCC).

Next, I've created a Region Definition (RD) with two fields, one of type "Single Text" and another with the DynamicList (ED) just created.


After that, I've created a DataFile based on that Region Definition, this is the resulting XML content:


<wcm:root version="8.0.0.0" xmlns:wcm="http://www.stellent.com/wcm-data/ns/8.0.0">
  <wcm:element name="text">This is a simple text</wcm:element>
</wcm:root>

As you see, there is not track about the ED with the DynamicList, but if you edit that DataFile on WCC interface this is how it looks


So, where is the information of the "Documents" section stored? In the Element Definition called "ED-DYNLIST".

This is the content of the ED file:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<elementDefinition xmlns="http://www.oracle.com/sitestudio/Element/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/sitestudio/Element/ http://www.oracle.com/sitestudio/ss_element_definition.xsd">
    <property value="3" name="type"/>
    <property value="" name="description"/>
    <complexProperty name="flags">
  ...
  ...
    </complexProperty>
    <property value="" name="height"/>
    <complexProperty name="dynlistaddregioncontent">
  ...
  ...
    </complexProperty>
    <dataProperty name="querytext">dExtension <matches> `docx`</dataProperty>
    <property value="dDocTitle" name="sortfield"/>
    <property value="asc" name="sortorder"/>
    <property value="20" name="resultcount"/>
    <property value="false" name="limitscope"/>
    <property value="" name="targetnodeid"/>
</elementDefinition>


As you see the query is stored on <dataProperty> TAG.

Now that we have all the needed information, we can create the TaskFlow that parses the WCC query stored on the ED file, and show the results of that query under a Content Presenter.

Diagram of our TaskFlow


This is how it looks like at the end



Download Links

Documentation

22 ago 2011

SSXA + RIDC en un Servlet

Durante un desarrollo de un sitio web en tecnología SiteStudio for external applications (SSXA en adelante) me vi con la necesidad de utilizar el pool de conexiones RIDC que automáticamente cada aplicación Web SSXA tiene definida. 
En concreto no fuimos capaces de descargar un fichero en su formato "original" ya que la tecnología SSXA sólo parece contemplar la descarga de ficheros en su formato web desde UCM (web rendition). Por ello desarrollamos este servlet que es capaz de conectarse a UCM a través de RIDC y realizar una descarga de un fichero dado su identificador (dDocName).


Os dejo un ejemplo de como se realiza una llamada RIDC desde un servlet aprovechando su configuración de conexiones con UCM.




Ejemplo de RIDC usando un Servlet y SSXA:

private void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
{
if(request.getParameter("file")!=null && request.getParameter("file")!= ""){
try
{
 ClientApplication client = getWcmApplication(this.getServletContext());
 IdcClientFactory idcClientFact = new IdcClientFactory(client.getConfigLoader().getConfiguration().getSystemConfig().getIdcConfig());
 IdcClient m_client = idcClientFact.getClientManager().createClient(idcClientFact.getIdcConfig().getConnectionUrl());
 IdcContext m_userContext = idcClientFact.getGuestContext();

//Ejecución del servicio
DataBinder dataBinder = m_client.createBinder();

dataBinder.putLocal("IdcService", "GET_FILE");
dataBinder.putLocal("dDocName", request.getParameter("file"));
dataBinder.putLocal("RevisionSelectionMethod","LatestReleased");
dataBinder.putLocal("Rendition", "Primary");

 // Ejecuto la petición
 ServiceResponse sRes = m_client.sendRequest(m_userContext, dataBinder);
 String startSplit = "filename=";
 String content = sRes.getHeader(HEADER_CONTENT);
 String fileName = content.substring(content.indexOf(startSplit) + startSplit.length() + 1, content.length() - 1);

 response.setContentType( (sRes.getHeader(HEADER_MIME) != null) ? sRes.getHeader(HEADER_MIME) : "application/octet-stream" );
 response.setContentLength(Integer.parseInt(sRes.getHeader(HEADER_LENGTH)));
 response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"" );


 //
 //  Stream to the requester.
 //
 byte[] bbuf = new byte[512];
 DataInputStream in = new DataInputStream(sRes.getResponseStream());
 int length   = 0;
 while ((in != null) && ((length = in.read(bbuf)) != -1))
 {
 response.getOutputStream().write(bbuf,0,length);
 }


 in.close();
 response.getOutputStream().flush();
 response.getOutputStream().close(); 
}
catch (ApplicationException e) {
logger.error("Error en descarga de contenido",e);
}
catch (Exception e) {
 logger.error("Error en descarga de contenido",e);
}
}
}


public ClientApplication getWcmApplication(ServletContext sc) throws Exception

  return ServletApplicationFactory.createInstance(sc);
}