Hi All,
As per the requirement, I have to remane the name of the XML file which is under the KM repository Userhome/personaldocuments based on the user logon information.
I have created a Repository service for the same and following is the code for the same. The service is working, but only for the first entry in the XML form. Second onwards, the file does not get remaned to the preferred one.
Request you to throw some light as what is wrong or missing in the code, so that I can follow the right approach. Many thanks in advance.
// Code snippet is here//
//Starts here//
com.sap.security.api.IUser epUser;
epUser = UMFactory.getAuthenticator().getLoggedInUser();
String EntID = epUser.getUniqueName();
IResourceContext resContext = null;
try {
resContext = ResourceFactory.getInstance().getServiceContext("cmadmin_service");
} catch (ResourceException e1) {
e1.printStackTrace();
}
RID rid = RID.getRID("/userhome""/"EntID+"/Personal Documents");
IResource resource = null;
try {
resource = (ResourceFactory.getInstance().getResource(rid, resContext));
} catch (ResourceException e2) {
e2.printStackTrace();
}
ICollection collection = (ICollection)resource;
IResourceList resourseList = null;
try {
resourseList = collection.getChildren();
} catch (AccessDeniedException e3) {
e3.printStackTrace();
} catch (ResourceException e3) {
e3.printStackTrace();
}
for(int i=0;i<resourseList.size();i++){
IResource res_new = resourseList.get(i);
try {
res_new.rename("Address_new.xml");
} catch (NotSupportedException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
} catch (ResourceException e) {
e.printStackTrace();
}
}
}
}
//Code ends here//
Regards
DK
Edited by: DIPENDRA MOHANTY on Jun 5, 2009 5:20 PM