Sitemap

Tuesday, January 24, 2017

Utility for taking backup of AEM contents

This utility is in the form of a unix shell script. The script will take the backup of AEM contents present in production author instance, create a zip file of it, download it and keep it in a particular location as defined in the script. Once the process is completed, an email will be sent to users to let them know the status of the job, whether the process was a success or resulted in an error. To automate this entire process, a cronjob can be set up which needs to be scheduled.

The technical document and the script are attached in a zip file. Check the downloads section for the zip file.

Friday, August 5, 2016

UCM: GET_SEARCH_RESULTS iterating resultset

package com.company;

import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.protocol.ServiceResponse;

import java.util.List;

/**
 * Created by Sonal_Chaudhary on 8/4/2016.
 */
public class ExtractEmailIDs {
    public static void main(String[] args) {
        int startIndex = 1;
        int pageNumber = 1;
        int totalRows = 20;
        IdcClientManager manager = new IdcClientManager();
        try {
            IdcClient idcClient = manager.createClient("idc://143.127.54.171:4444");
            IdcContext userContext = new IdcContext("sysadmin");

            boolean stillLoop = true;
            while (stillLoop) {
                DataBinder dataBinder = idcClient.createBinder();
                dataBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
                dataBinder.putLocal("QueryText", "dSecurityGroup <contains> `Partner`  <AND>  xLanguage <contains> `4`  <AND>  xCountries <contains> `1`");
                dataBinder.putLocal("SearchQueryFormat", "Universal");
                dataBinder.putLocal("StartRow", Integer.toString(startIndex));
                dataBinder.putLocal("ResultCount",  Integer.toString(totalRows));
                dataBinder.putLocal("PageNumber",  Integer.toString(pageNumber));
                dataBinder.putLocal("TotalRows",  Integer.toString(totalRows));

                ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
                DataBinder responseData = response.getResponseAsBinder();
                DataResultSet resultSet = responseData.getResultSet("SearchResults");

                if (resultSet != null && resultSet.getRows() != null) {
                    List<DataObject> dataObjects = resultSet.getRows();
                    if (dataObjects.size() == totalRows) {
                        startIndex += totalRows;
                        pageNumber++;
                    } else {
                        stillLoop = false;
                    }
                    for (DataObject dataObject : dataObjects) {
                        System.out.println(dataObject.get("dID") + "," + dataObject.get("dDocName") + "," + dataObject.get("dExtension"));
                    }
                }
            }
        } catch (IdcClientException ice) {
            ice.printStackTrace();
        }
    }
}

Saturday, July 16, 2016

Java: Arrays

package com.company;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * Created by Sonal_Chaudhary on 7/16/2016.
 */
public class TestScoreAverage {
    public static void main(String[] args) {
        final int NUMBER_OF_STUDENTS = 3;

        /**
         * The first statement declares a variable called numbers of the array type, with each element of type int. The
         * second statement allocates contiguous memory for holding 10 integers and assigns the memory address of the first
         * element to the variable numbers. The declaration and allocation can be done in the same statement like below:
         * int[] marks = new int[NUMBER_OF_STUDENTS];
         * Array literals provide a shorter and more readable syntax while initializing an array like below:
         * int[] marks = {15, 2, 9, 200, 18};
         */
        int[] marks;
        marks = new int[NUMBER_OF_STUDENTS];

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


            for (int i = 0; i < NUMBER_OF_STUDENTS; i++) {
                System.out.print("Enter marks for student #" + (i + 1) + ": ");
                String str = reader.readLine();
                marks[i] = Integer.parseInt(str);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        //The clone method copies all the elements of the array into a new array
        int[] marksCopy = marks.clone();

        int total = 0;

        /**
         * The for-each construct is very useful if you want to traverse all the elements of the array. Specifically,
         * it allows you to iterate over collections and arrays without using iterators or index variables. The for-each
         * has certain restrictions. It can be used for accessing the array elements but not for modifying them.
         * The 'm' specifies the type of variable and its name.
         * for (int m : marks) {
         *      System.out.println (m);
         * }
         */
        for (int m : marksCopy) {
            total += m;
        }

        System.out.println("Average Marks " + (float) total / NUMBER_OF_STUDENTS);
        System.out.println(Arrays.toString(marksCopy)); //To print the contents of an array
    }
}


Wednesday, May 11, 2016

AEM Sightly

Templates
http://adobeaemclub.com/guide-for-working-with-templates-and-call-in-sightly-aem-6-1/

data-sly-repeat / data-sly-list / sly / URL manipulation
http://www.accunitysoft.com/tag/data-sly-repeat/

Wednesday, April 20, 2016

UCM: Important Doc IDs

Doc ID 1558212.1: Remote Intradoc Client (RIDC) Master Note for Sample Code

Doc ID 1603523.1: How to Setup and Test Webcenter Content 11g IPM AXF Managed Attachments

Doc ID 1606687.1: How to Setup EBS 12.1.x / 12.2.x Forms with Webcenter Content 11g AXF Managed Attachments

Doc ID 1636056.1: How Do You Search for Content Where The Title Contains an Ampersand (&) Character?

Doc ID 1902002.1: Master Note : How to Use Profiles and Rules to Achieve Custom Requirements on Webcenter Content Server

Doc ID 1927793.1: How to Setup EBS 12.1.3 / 12.2.x OAF with Webcenter Content 11g AXF Managed Attachments






Listing tables where a column is being used


SELECT * FROM ALL_TAB_COLUMNS WHERE COLUMN_NAME LIKE '%DDOCNAME%';

Monday, April 4, 2016

Get Portable 8 Java

http://www.davismol.net/2014/08/31/installing-the-jdk-on-a-windows-machine-without-administrator-privileges/