on 01-24-2008 5:15 AM
Hi experts,
My requirement is delete the files from the KM itself.I have stored the list of files under the Km in particular folder(path)
I have a following code.
I have table with checkbox and delete button. when ever select the check box(single selection or muliple selection). the file should be deleted from the KM. but does not remove from the table. how can i remove the selected item from the table and how can i refresh the table. please help me its very urgent..
my table structure is
node_accelerator
Acc_check---boolean
Acc_file---string
try {
for (int i = 0; i < wdContext.nodeTable_accelarator().size(); i++) {
if (wdContext.nodeTable_accelarator().getTable_accelaratorElementAt(i).getAcc_check()) {
String a =
wdContext.nodeTable_accelarator().getTable_accelaratorElementAt(i).getAcc_file();
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser =
wdClientUser.getSAPUser();
//create an ep5 user from the retrieved user
IUser ep5User =
WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext resourseContext2 =
new ResourceContext(ep5User);
RID pathRID2 =
RID.getRID(
"/documents/SAPse/Projects/Implementaion/Accelarator/"+ a+ "/");
IResourceFactory resourseFactory2 =
ResourceFactory.getInstance();
IResource collection2 =
resourseFactory2.getResource(
pathRID2,
resourseContext2);
collection2.delete();
}
}
} catch (Exception e) {
wdComponentAPI.getMessageManager().reportSuccess("error in delete");
}
Regards,
P.Manivannan.
Hi experts,
My requirement is delete the files from the KM itself.I have stored the list of files under the Km in particular folder(path)
I have a following code.
I have table with checkbox and delete button. when ever select the check box(single selection or muliple selection). the file should be deleted from the KM. but does not remove from the table. how can i remove the selected item from the table and how can i refresh the table. please help me its very urgent..
my table structure is
node_accelerator
Acc_check---boolean
Acc_file---string
try {
for (int i = 0; i < wdContext.nodeTable_accelarator().size(); i++) {
if (wdContext.nodeTable_accelarator().getTable_accelaratorElementAt(i).getAcc_check()) {
String a =
wdContext.nodeTable_accelarator().getTable_accelaratorElementAt(i).getAcc_file();
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser =
wdClientUser.getSAPUser();
//create an ep5 user from the retrieved user
IUser ep5User =
WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext resourseContext2 =
new ResourceContext(ep5User);
RID pathRID2 =
RID.getRID(
"/documents/SAPse/Projects/Implementaion/Accelarator/"+ a+ "/");
IResourceFactory resourseFactory2 =
ResourceFactory.getInstance();
IResource collection2 =
resourseFactory2.getResource(
pathRID2,
resourseContext2);
collection2.delete();
}
}
} catch (Exception e) {
wdComponentAPI.getMessageManager().reportSuccess("error in delete");
}
Regards,
P.Manivannan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi manivannan,
I think i told u to "fetch the data again for the table" after invalidate :-). Or u can do one more thing. in ur table node get the lead selected element . Then remove that element from the context . wdContext.node<table node>.removeElementAt(lead Selection). in this case no need to use invalidate.
regards
Sumit
Hi manivannan,
For multiple selection u need to do this
1. chane the selectionMode property of the table to multi.
2. implement this code
int leadSelect = wdContext.node<ur node>().getLeadSelection();
int NodeSize = wdContext.node<ur node>().size();
for(int i=0;i<wdContext.node<ur node>().size();i++)
{
if(wdContext.node<ur node>()..isMultiSelected(i) || leadSelect == i)
{
wdContext.node<ur node>()..removeElement(i);
}
}
regards
Sumit
Hi sumit,
I had done all. but its not working....only single selection only working...if i select mutiple selection after clicking the button all the files are removed from km itself. but not removed from front end table. suppose u select 4 values in a table.. the first selection of the row only reomived from the table. other rows are still present in the table.
Regards,
P.Manivannan.
Hi sumit,
int leadSelect = wdContext.nodeTable_check().getLeadSelection();
int NodeSize = wdContext.nodeTable_check().size();
for(int i=0;i<wdContext.nodeTable_check().size();i++)
{
IPrivateChecklist.ITable_checkElement ele = wdContext.nodeTable_check().getTable_checkElementAt(i);
if(wdContext.nodeTable_check().isMultiSelected(i) & leadSelect == i)
{
wdContext.nodeTable_check().removeElement(ele);
}
}
Regards,
P.Manivannan.
Hi sumit,
Structure
table_check
-
checklist_check---boolean
-
checklist_file-----string
int leadSelect = wdContext.nodeTable_check().getLeadSelection();
int NodeSize = wdContext.nodeTable_check().size();
for(int i=0;i<wdContext.nodeTable_check().size();i++)
{
IPrivateChecklist.ITable_checkElement ele = wdContext.nodeTable_check().getTable_checkElementAt(i);
if(wdContext.nodeTable_check().isMultiSelected(i) & leadSelect == i)
{
wdContext.nodeTable_check().removeElement(ele);
}
}
Regards,
P.Manivannan
Hi Sumit,
I got a solution withoutusing removeElemet().
I create a seperate method for delete() for following code
wdContext.nodeTable().invalidate();
try
{
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser =
wdClientUser.getSAPUser();
//create an ep5 user from the retrieved user
IUser ep5User =
WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext resourseContext2 =
new ResourceContext(ep5User);
RID pathRID2 =
RID.getRID(
"/documents/SAPse/Projects/Implementaion/"
+ "/Templates/");
IResourceFactory resourseFactory2 =
ResourceFactory.getInstance();
ICollection collection2 =
(ICollection) resourseFactory2.getResource(pathRID2,resourseContext2);
ICollection collection11 = (ICollection) collection2;
for (IResourceListIterator itr =
collection11.getChildren().listIterator();
itr.hasNext();
) {
IResource res = (IResource) itr.next();
String name = res.getName();
// IPrivateRight.ITableElement contentElem = null;
contentElem =
wdContext.nodeTable().createTableElement();
contentElem.setFile(res.getDisplayName(true)); wdContext.nodeTable().addElement(contentElem);
}
}
catch(Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess("error " +e);
}
NOTE: i used invalidate function in top of the table
I call the delete method in my button event...
Thanks For ur valuable replies
Regards,
P.Manivannan.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.