Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

On delivery of changeset, how to retrieve component list under a stream via changeset?

Hi Ralph,

Kindly help on how to retrieve list of components under a specific stream from a ChangeSet..[on server side]

Thanks in advance.

1

0 votes


Accepted answer

Permanent link
Mind your tagging, this is likely "extending" and not administration.

In an SCM delivery advisor like https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/

The following approaches can be done, as far as I can tell from looking at com.ibm.team.filesystem.service.internal.process.StreamComponentsPermissionAdvisor.class - the class that I found by looking at references of the extension point in said advisor.

Get the components from the destination stream - all components referenced by the stream
		Object operationData = operation.getOperationData();
		if (!(operationData instanceof DeliverOperationData)) {
			return;
		}

		DeliverOperationData data = (DeliverOperationData) operationData;
		IWorkspace destination = data.getDestWorkspace();
		IScmService scmService = this.getScmService();
		IComponentHandle[] componentHandles = scmService
				.getComponentsForWorkspace(destination, null);
		IComponent[] components = (IComponent[]) this
				.getRepositoryItemServiceForScm().fetchItems(componentHandles,
						IRepositoryItemService.COMPLETE);


Get the components from the delivered change sets - not all, but only the ones we deliver to
		Object operationData = operation.getOperationData();
		if (!(operationData instanceof DeliverOperationData)) {
			return;
		}

		DeliverOperationData data = (DeliverOperationData) operationData;
		
		List changeSets = data.getChangeSetHandles();
		IRepositoryItemService itemService = getService(IRepositoryItemService.class);
		IChangeSetHandle[] changeSetHandles = changeSets
				.toArray(new IChangeSetHandle[changeSets.size()]);
		IItem[] items = itemService.fetchItems(changeSetHandles,
				IRepositoryItemService.COMPLETE);
		Collection componentList = new ArrayList();
		HashMap componentHandlesList = new HashMap();
		for (IItem item : items) {
			IChangeSet changeSet = (IChangeSet) item;
			IComponentHandle component = changeSet.getComponent();
			componentList.add(component);
		}



Sudaraazhi Arivalagan selected this answer as the correct answer

0 votes

Comments

Hi Ralph,

I was wondering how to get this from last two days.

Grateful to you !! for a favor

I am sure caring about Tagging from next time.

Thanks again.

Please keep in mind that I did not test the code, there might be things to check.

Ok Sure. Thanks.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937
× 1,202

Question asked: Jul 15 '15, 1:35 a.m.

Question was seen: 3,306 times

Last updated: Jul 15 '15, 5:04 a.m.

Confirmation Cancel Confirm