Adding or changing copyright text in code files as a precondition upon delivery - automated and transparent to the user
![]()
Mike Shkolnik (980●9●161●143)
| asked Feb 12 '14, 6:08 p.m.
retagged Feb 13 '14, 9:43 a.m. by Sonia Dimitrov (271●5●9)
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. :) |
2 answers
![]()
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 |
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Feb 19 '14, 3:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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. |
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.
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.