Skip to content

Instantly share code, notes, and snippets.

View aakash14goplani's full-sized avatar
🎯
Focusing

Aakash Goplani aakash14goplani

🎯
Focusing
View GitHub Profile

Demo Code

Template that is assigned to Collection asset and render all its fields

  1. Create a collection asset.
  2. Assign Collection assets with Query assets.
  3. Create a template to assign to collection asset with the code below.
  4. This code loads the collection asset and from that asset it fetches the list of query assets
  5. If the query is written using database option, it will fetch the query and execute it else will call the targer element to execute the query.

GENERAL STEPS TO FOLLOW:

  1. Load the flex asset (using assetset tags)
  2. Get the value of imagefile attribute in list (using assetset:getattributevalues tag)
  3. Retrieve information using blobservice tags
<%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld"
%><%@ taglib prefix="asset" uri="futuretense_cs/asset.tld"
%><%@ taglib prefix="assetset" uri="futuretense_cs/assetset.tld"
@aakash14goplani
aakash14goplani / GenerateXML.md
Last active July 1, 2017 20:25
Create XML structure / Raw String data of asset details fetched from Asset Read API

What does this code do?

  1. Fetch all the details of asset using ics:sql.
  2. Create XML structure using DocumentBuilderFactory and populate it with asset details from #1
  3. Print an XML tree having all the asset details
<%@page import="org.apache.commons.lang.StringEscapeUtils"%>
<%@page import="javax.xml.transform.stream.StreamResult"%>
<%@page import="java.io.StringWriter"%>
<%@page import="javax.xml.transform.dom.DOMSource"%>

Code that Queries the Search Index

<%@page import="org.joda.time.DateTime"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.List"%>
<%@page import="com.fatwire.cs.core.search.data.IndexData"%>
<%@page import="java.util.Collections"%>
<%@page import="com.fatwire.cs.core.search.data.ResultRow"%>
@aakash14goplani
aakash14goplani / LucenceSearchHome.md
Last active July 1, 2017 20:22
Lucence Search Home
@aakash14goplani
aakash14goplani / markdown.md
Last active June 24, 2017 16:13
Markdown in Gist

This is H1

This is H2

This is H3

Italics 1 Italics 2

Unordered List

  • Item 1
  • Item 2
@aakash14goplani
aakash14goplani / AssetLoad.md
Last active June 25, 2017 14:21
Asset Load

asset:load is used to load basic assets and complex assets like Page, Collection, Query etc.

GENERAL STEPS TO FOLLOW:

  1. Load the basic asset (using asset:load tag)
  2. Scatter the loaded basic asset (using asset:scatter tag) OR get the loaded basic asset (using asset:get tag)
  3. Retrieve information after scattering the asset via prefix:attributename (using ics:getvar tag)

CASE 1

If you know asset type(c) and asset id (cid). This is basically used to retrieve information from the basic asset usually to render on page.

assetset is used to load flex assets.

GENERAL STEPS TO FOLLOW:

  1. Load the flex asset (using assetset:setasset tag)
  2. Use assetset:getmultiplevalues or assetset:getattributevalues to retrieve information after the flex asset is loaded.
  3. Fetch attributes (looping through list using ics:listloop tag) In the following cases it is assumed that we know c and cid.

CASE 1:

Retrieving flex attributes using assetset:getattributevalues tag

@aakash14goplani
aakash14goplani / AttributeEditor.md
Last active September 5, 2017 14:15
Attribute Editor

An attribute editor specifies how data is entered for an attribute when that attribute is displayed on a New or Edit form for a flex asset or a flex parent asset in the WebCenter Sites interface on the management system. WCS, by default, defines attribute editors for each data type and used when there is no specific Attribute editor defined against the Attribute.

While carrying out asset modelling, it is good to define kind of attribute editor against each attribute. Right attribute editors could enhance the content authoring experience a great extend. Few examples to expand on the point:

  • An attribute store email address: We mostly will define data type as String and will leave it to default attribute editor. But if we could define a new Attribute editor which does all the validations for email address, it will benefit both content authors as well as developers. Content authors will not be allowed to enter wrong content and developers do not need to worry of extra checks in the template
  • An att
@aakash14goplani
aakash14goplani / ExampleListLoop.md
Created June 26, 2017 09:09
Example of looping list

Demo Code

<%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld"
%><%@ taglib prefix="ics" uri="futuretense_cs/ics.tld"
%><%@ taglib prefix="render" uri="futuretense_cs/render.tld"
%><%@ page import="COM.FutureTense.Interfaces.*"
%><% 
/******************************************************************************************************************************
   *    Element Name        :  List