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

Adding or changing copyright text in code files as a precondition upon delivery - automated and transparent to the user

We need to have a copyright notice in all code files. We want this to happen transparent to the user by setting up a precondition that executes upon delivery.

Basically the Code Delivery Precondition needs to apply the following logic (without prompt or any change to the UI):

1. Check if file type is code, based on extension.
2. If yes, check file for existing copyright text.
3. If copyright text exists and year is old, update to current year.
4. If copyright text doesn't exist, add it.
5. If changed, re-save the file.
6. Continue the delivery.

I know how to setup a precondition. What I don't know is how to write or install the extension that does the logic listed above. I assume we need to use the Java API and write this in Java, but I really don't know. I have a Java programmer on hand if needed, but I need to tell them what hooks to use and how to use them. How do I accomplish this? Please don't send me to large generic lists of instructions for extending RTC - I can't follow them without knowing what I can ignore based on the logic listed above. This does not involve any prompts or changes to the UI and instructions I found did not take that into account.

I have seen similar questions asked and I added to other threads but have not gotten an answer, so I am trying my own thread. :)

1 vote

Comments

the source is in plugin com.ibm.team.filesystem.service,
in package com.ibm.team.filesystem.service.internal.process
as file RequiredContentAdvisor

to see the source, open the plugins view,  find this plugin, right click on it, import as source.



2 answers

Permanent link
first this would be a participant not a precondition (advisor)

advisors advise.. not make changes.
IBM breaks their own rule here, but its a start.
in the Team Config, Operations Behavior, Deliver Phase 2 (server), there is a pre-condition called Required Content

'Precondition which requires that files contain specific textual content'
id=com.ibm.team.process.definitions.server.deltaRequiredContent

I don't know how it works, but you could get the source from the plugin and look at it for a starter.  it does almost everything you want.

as for what the structure might look like, have the developer take the extensions workshop. see https://jazz.net/library/article/1000

you would configure it to find out what extension point it supports. least thats what I did to get the info above

0 votes


Permanent link
This would only be possible on deliver. It would need to be a client extension and it would also need to add a potential new change set.

I would suggest to rather try to use the built in capabilities in Eclipse that flag warnings and errors based on certain rules e.g. not having a copyright statement, and use the clean workspace precondition.

If that is not feasible, I would rather suggest to create an advisor that checks the copyrights and prevents delivery so that the user can change the copyright.

0 votes

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,938
× 1,202

Question asked: Feb 12 '14, 6:08 p.m.

Question was seen: 6,851 times

Last updated: Feb 19 '14, 3:03 a.m.

Confirmation Cancel Confirm