Wednesday, November 27, 2013

RTC Java API - Get list of projectAreas

import java.util.List;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;

import com.ibm.team.process.client.IProcessItemService;
import com.ibm.team.process.common.IProjectArea;
import com.ibm.team.repository.client.ILoginHandler2;
import com.ibm.team.repository.client.ILoginInfo2;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.client.login.UsernameAndPasswordLoginInfo;
import com.ibm.team.repository.common.TeamRepositoryException;

public class ProjectAreas {

public static void main(String[] args) {
IProgressMonitor monitor = new NullProgressMonitor();
final String userId = "username";
final String password = "password";
String repoUri = "https://RTCSERVER/jazz";

TeamPlatform.startup();
try {
// Login to the repository using the provided credentials
ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(repoUri);
repo.registerLoginHandler(new ILoginHandler2() {
@Override
public ILoginInfo2 challenge(ITeamRepository repo) {
return new UsernameAndPasswordLoginInfo(userId, password);
}
});
repo.login(monitor);

IProcessItemService connect = (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);
List p = connect.findAllProjectAreas(null, monitor);

repo.logout();
} catch (TeamRepositoryException e) {
/* Handle repository exceptions such as login problems here. */
} finally {
TeamPlatform.shutdown();
}

}

}

Tuesday, July 16, 2013

IBatis log all SQL queries

Use the following log4j configuration to print all the queries getting executed by IBatis

log4j.rootLogger=INFO, CA
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.SQL Map.engine.impl.SQL MapClientDelegate=DEBUG
 
log4j.logger.com.ibatis=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=INFO

Friday, July 12, 2013

RTC Rest API

Setup

Use a REST client, add headers as mentioned along the requests.

Get Root services

https://[RTCSERVER]/jazz/rootservices

Get a list of projects on the RTC server

https://[RTCSERVER]/jazz/oslc/workitems/catalog

Workitems

Fetch list of all workitems for a project, without details.

Headers
Accept: application/xml
OSLC-Core-Version: 2.0

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems


Fetch list of all workitems for a project, with all details.

Headers
Accept: application/xml

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems

Fetch all workitems for a project, specify the attributes that should be returned by the API, select

Headers
Accept: application/xml
OSLC-Core-Version: 2.0

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems?oslc.select=dcterms:identifier,dcterms:title,dcterms:description,dcterms:type,dcterms:contributor,rtc_ext:com.ibm.team.apt.attribute.complexity,rtc_ext:groomed,rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent,rtc_cm:plannedFor,oslc_cmx:priority,rtc_cm:state,oslc_cmx:project,rtc_cm:filedAgainst,rtc_ext:release_ticket_ID&oslc.pageSize=100

RTC 4.x and above API throttles the data to 50 records by default and a max of 100.
If you don't use OSLC-Core-Version header then the API won't recognize the where clause.

Fetch workitems by type and iteration

https://[RTCSERVER]/jazz/oslc/contexts/[PROJECT_UUID]/workitems?oslc.where=rtc_cm:type in ["com.ibm.team.apt.workItemType.story","task"] and rtc_cm:plannedFor="[ITERATION_UUID]"&oslc.select=dcterms:identifier,dcterms:title,dcterms:description,dcterms:type,dcterms:contributor,rtc_ext:com.ibm.team.apt.attribute.complexity,rtc_ext:groomed,rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent,rtc_cm:plannedFor,oslc_cmx:priority,rtc_cm:state,oslc_cmx:project,rtc_cm:filedAgainst,rtc_ext:release_ticket_ID,dcterms:created,oslc_cm:closeDate&oslc.pageSize=100

Project Area > Workflow (States, Action, etc.) details

https://[RTCSERVER]/jazz/service/com.ibm.team.workitem.service.process.internal.rest.IWorkItemConfigRestService/workflows?projectAreaItemId=[PROJECT_UUID]

Fetch Actions:

https://[RTCSERVER]/jazz/oslc/workflows/[PROJECT_UUID]/actions?type=com.ibm.team.apt.workItemType.story&oslc_cm.properties=dc%3Aidentifier%2Crtc_cm%3AresultState%2Cdc%3Atitle

Reportable API


Get details of a sign-off workitem using Reportable API 
https://[RTCSERVER]/jazz/rpt/repository/workitem?fields=workitem/workItem[id=[WORITEMID]]/(projectArea/name|target/name|tags|id|summary|priority/name|owner/name|creationDate|resolutionDate|type/(id|name)|state/name|approvals/(stateIdentifier|approver/(userId|name)|stateDate)|approvalDescriptors/(id|typeIdentifier|name|cumulativeStateIdentifier|dueDate))

Java Questions

  1. Java
    1. How does exception handling in Java work, tell me about the different types of exceptions in Java.
    2. What is Polymorphism ?
    3. What is hashcode ?
    4. How are hashcode and equals related ?
    5. How do threads communicate ?
    6. Write a code to iterate through a map and print its values.
    7. You have data that needs to be displayed on a webpage, exported to PDF and exported to XLS, how would you go about the implementation.
    8. What are generics ?
    9. What is the difference between protected and default scope ?
    10. How would you create a servlet ?
    11. What are filters used for?
    12. How do we take the thread dump?
  2. Java-script
    1. What is a JQuery selector ?
    2. Among the frameworks like Angular/extJs, etc which one do you prefer to use in a new project and why ?
    3. Do you know about closures in Javascript ?
  3. Database
    1. Tell me any area where you feel MySQL is better than Oracle ?
  4. General
    1. Tell me about your best career achievement.


Friday, July 5, 2013

Learning Oracle - Basics

Create a new user:
CREATE USER amit
    IDENTIFIED BY abcdef
    DEFAULT TABLESPACE users
 
Grant the new user permissions so that he can login to database:
 Grant create session to amit;
 
create table student(
    name varchar(20), 
    rollno number primary key,
    dateofbirth date,
    standard number
);

create table subject(
    id number primary key,
    title varchar(20)
);

create table student_marks(
    subject_id references subject,
    student_id references student,
    marks number
);

insert into student values ('Amit Kumar', 1, TO_DATE('18-JAN-1980'), 10);
insert into student values ('Charu Kush', 2, TO_DATE('01-APR-1982'), 10);

insert into subject values (1, 'Maths');
insert into subject values (2, 'Science');

insert into student_marks values (1, 1, 45);
insert into student_marks values (2, 1, 55);

insert into student_marks values (1, 2, 55);
insert into student_marks values (2, 2, 65);
 



Places to play Badminton in Boston


Where to play ?

The first thing to try is to register at "Boston Badminton" meetup.com group, this meetup helps quickly get in touch with Badminton enthusiasts.
Some of the nice places that I have discovered are:

  • Westborough - You need a car to get here and is like 45 mins drive from Boston, but the best courts in this area.
  • Malden - I will add the exact address of the location, but there is a nice place to play badminton in Malden.
  • China Town YMCA - (Close to Tuffts Medical) The have badminton, 3 courts, only one of them has lines.
  • Boston University - This is with Meetup.com


Where to get racket and shuttlecocks ?

  • Westborough has everything you need.
  • Online : www.badmintonexpress.com