how to get after state name
![]() Now I am writing a server precondition using RTC-SDK. When a source file renamed to the other name, I want to get it new name. For example, a source file Test1.java was named to Test2.java, and then deliver the change to the stream. So In my server deliver precondition trigger, how can I use IChange to get the Test2.java name? I have try below source: //I found RENAME value is 4, but change.kind() get 6, so I assume change.kind()= MODIFIED(2) + RENAME(4) = 6, and // the rename kind will get in the if condition statement.
if (change.kind() == IChange.MODIFIED || change.kind() == (IChange.MODIFIED + IChange.RENAME)) {
String path = toFullPath(item, reports[0].getNameItemPairs())
private String toFullPath(IVersionable versionable, List<INameItemPair> segments) {
question 1: I found whatever I used versionableHandle = change.afterState(); or change.beforeState(), the path always return Test2.java to me, I do not know why. So, How can I get Test3.java name?
question 2: the function toFullPath only can get full path in MODIFIED and DELETED kind. If kind =ADD kind, segments.isEmpty()) will be true, so full path can not be get when ADD kind. So, How can I get Test2 or Test3 full path?
This two question confuse me so long! Please give me some advise.
|
Be the first one to answer this question!
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
For question 2 addition:
for example, path is com.ibm.test.Test2.java
In actual, I can get com.ibm.test.Test2.java when kind = DELETE or MODIFED. But when kind= ADD, I only get Test2.java. So how I can get com.ibm.test.Test2.java when kind = ADD
I have asked the same question here question