Sitemap

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/

Sunday, February 14, 2016

Monday, January 18, 2016

Java: WSDL to JAR

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>weatherForecast</groupId>
   <artifactId>sample-ws-client</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>WeatherForecast Service</name>
   <packaging>jar</packaging>
   <properties>
      <cxf.version>3.0.4</cxf.version>
   </properties>
   <build>
      <!-- maven compiler plug-ins -->
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
               <source>1.7</source>
               <target>1.7</target>
            </configuration>
         </plugin>
         <!-- maven wsdl2java plug-ins -->
         <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>${cxf.version}</version>
            <executions>
               <execution>
                  <id>generate-sources</id>
                  <phase>generate-sources</phase>
                  <configuration>
                     <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                     <wsdlOptions>
                        <wsdlOption>
                           <wsdl>http://www.webservicex.net/WeatherForecast.asmx?WSDL</wsdl>
                        </wsdlOption>
                     </wsdlOptions>
                  </configuration>
                  <goals>
                     <goal>wsdl2java</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
   <dependencies>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-frontend-jaxws</artifactId>
         <version>${cxf.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-transports-http</artifactId>
         <version>${cxf.version}</version>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.12</version>
      </dependency>
   </dependencies>
</project>


mvn package