It's all about the answers!

Ask a question

Programatically modify Files in a Deliver Operation


Jack Hall (3655) | asked Jul 15 '10, 11:06 a.m.
I am looking to be able to automatically modify files that are being delivered. I have code that runs as a precondition that looks at every file being delivered and makes the changes to the IFiles that are in the ChangeSets.

The problem I am having is getting the changes the precondition makes back in to the deliver.

When I run a test Delivery the precondition fires and makes the changes to the file successfully, however the delivery continues on with the old files instead of the newly modified files. How do I get the changes to make it through to the delivery. The local files do reflect the changes made by the precondition but those changes aren't reflected in the files that are on the server after a deliver is made.

How would I get the changes to stick?

Also this is a Client Side plugin

5 answers



permanent link
Michael Valenta (3.7k3) | answered Jul 16 '10, 8:36 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
The short answer is that you would need to check the changes in to get
them to "stick". However, this may not be possible in the context of a
deliver operation. The RTC team process does a similar things with
copyrights but it works this way. If the copyright is missing from a
file, the team process prevents the deliver and gives the user the
option to add the copyrights by clicking a link in the Team advisor. The
copyright is then added and the user must check in the change and retry
the deliver. This is a bit safer, IMHO, than the way you suggest as the
user has a chance to inspect the changes before they are delivered.

Michael

jackdhall wrote:
I am looking to be able to automatically modify files that are being
delivered. I have code that runs as a precondition that looks at
every file being delivered and makes the changes to the IFiles that
are in the ChangeSets.

The problem I am having is getting the changes the precondition makes
back in to the deliver.

When I run a test Delivery the precondition fires and makes the
changes to the file successfully, however the delivery continues on
with the old files instead of the newly modified files. How do I get
the changes to make it through to the delivery. The local files do
reflect the changes made by the precondition but those changes aren't
reflected in the files that are on the server after a deliver is
made.

How would I get the changes to stick?

permanent link
Jack Hall (3655) | answered Jul 19 '10, 3:25 p.m.
Ok I understand. How would I go about Implementing a QuickFix? I know I need to create my own Resolution Delegate, but after looking at InsertRequiredTextResolutionDelegate.class and RequiredContentAdvisor.class I am still unsure about how to accomplish this.

Thanks, Jack


The short answer is that you would need to check the changes in to get
them to "stick". However, this may not be possible in the context of a
deliver operation. The RTC team process does a similar things with
copyrights but it works this way. If the copyright is missing from a
file, the team process prevents the deliver and gives the user the
option to add the copyrights by clicking a link in the Team advisor. The
copyright is then added and the user must check in the change and retry
the deliver. This is a bit safer, IMHO, than the way you suggest as the
user has a chance to inspect the changes before they are delivered.

Michael

jackdhall wrote:
I am looking to be able to automatically modify files that are being
delivered. I have code that runs as a precondition that looks at
every file being delivered and makes the changes to the IFiles that
are in the ChangeSets.

The problem I am having is getting the changes the precondition makes
back in to the deliver.

When I run a test Delivery the precondition fires and makes the
changes to the file successfully, however the delivery continues on
with the old files instead of the newly modified files. How do I get
the changes to make it through to the delivery. The local files do
reflect the changes made by the precondition but those changes aren't
reflected in the files that are on the server after a deliver is
made.

How would I get the changes to stick?

permanent link
Michael Valenta (3.7k3) | answered Jul 23 '10, 9:26 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Jack,

I don't know much about that area but if you loasd the source code for
RTC, there are some examples of this in the
com.ibm.team.filesystem.ide.ui plug-in. Have a look at the subclasses of
AbstractFileAdvisor.

Michael

jackdhall wrote:
Ok I understand. How would I go about Implementing a QuickFix? I know
I need to create my own Resolution Delegate, but after looking at
InsertRequiredTextResolutionDelegate.class and
RequiredContentAdvisor.class I am still unsure about how to
accomplish this.

Thanks, Jack


Michael Valentawrote:
The short answer is that you would need to check the changes in to
get
them to "stick". However, this may not be possible in the
context of a
deliver operation. The RTC team process does a similar things with
copyrights but it works this way. If the copyright is missing from a

file, the team process prevents the deliver and gives the user the
option to add the copyrights by clicking a link in the Team advisor.
The
copyright is then added and the user must check in the change and
retry
the deliver. This is a bit safer, IMHO, than the way you suggest as
the
user has a chance to inspect the changes before they are delivered.

Michael

jackdhall wrote:
I am looking to be able to automatically modify files that are
being
delivered. I have code that runs as a precondition that looks at
every file being delivered and makes the changes to the IFiles that
are in the ChangeSets.

The problem I am having is getting the changes the precondition
makes
back in to the deliver.

When I run a test Delivery the precondition fires and makes the
changes to the file successfully, however the delivery continues on
with the old files instead of the newly modified files. How do I
get
the changes to make it through to the delivery. The local files do
reflect the changes made by the precondition but those changes
aren't
reflected in the files that are on the server after a deliver is
made.

How would I get the changes to stick?


permanent link
Jack Hall (3655) | answered Aug 04 '10, 3:59 p.m.
Ok I got it working. You need to create a delegate that implements IAdvisorProblemResolutionDelegate. This delegate will be the code that runs when your quickfix is applied. To get your quickfix to be recognized you need to add the following lines to your plugin.xml file:

</extension>

<Add>
<extension>
<advisorProblemResolution>
</advisorProblemResolution>
</extension>


After that when you add your error in your IOperationAdvisor you need to make sure that you set the problemType to be the same thing in you plugin.xml. Such as this,

IAdvisorInfoCollector collector;

IAdvisorInfo info = collector.createProblemInfo(summary, desc, "MyError");
collector.addInfo(info);


If you do that then when your precondition sets up the error then your resolution delegate should show up as a quick fix.

permanent link
K M (38325051) | answered Dec 01 '10, 5:58 p.m.
IVersionableHandle filePathHandle = change.afterState();

you fetch the IVersionable filePath how did you do it?????????

from that I can get

IFileItem file = (IFileItem) filePath.getFullState()
IFileContent fileInfo = file.getContent();

What I really want is the file size.....

Your answer


Register or 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.