Advertisement
Guest User

SAP BOBI MassChange

a guest
Nov 26th, 2014
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%@ page language="java"%>
  2. <%@ page contentType="text/html; charset=utf-8" %>
  3.  
  4. <%@ page import="com.businessobjects.rebean.wi.ReportEngine" %>
  5. <%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
  6. <%@ page import="com.crystaldecisions.sdk.exception.SDKServerException" %>
  7. <%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>
  8. <%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>
  9. <%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %>
  10. <%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore" %>
  11. <%@ page import="com.crystaldecisions.sdk.occa.security.IUserInfo" %>
  12. <%@ page import="com.crystaldecisions.sdk.occa.infostore.CeSecurityID" %>
  13. <%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObjects" %>
  14. <%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObject" %>
  15. <%@ page import="com.crystaldecisions.sdk.plugin.desktop.server.IServer"%>
  16. <%@ page import="com.crystaldecisions.sdk.plugin.CeKind" %>
  17. <%@ page import="com.crystaldecisions.sdk.occa.enadmin.*" %>
  18. <%@ page import="com.businessobjects.sdk.plugin.desktop.webintelligence.CeWebIntelligenceRightID" %>
  19.  
  20. <%@ page import="java.io.IOException" %>
  21. <%@ page import="java.util.Hashtable" %>
  22. <%@ page import = "com.crystaldecisions.sdk.exception.SDKException,
  23. com.crystaldecisions.sdk.framework.*,
  24. com.crystaldecisions.sdk.occa.infostore.*,
  25. com.crystaldecisions.sdk.occa.report.*,
  26. com.crystaldecisions.sdk.properties.*,
  27. com.crystaldecisions.sdk.plugin.desktop.user.*,
  28. com.crystaldecisions.sdk.plugin.desktop.usergroup.*,
  29. java.util.*"
  30. %>
  31. <%
  32. // User Credentials
  33. //administrator user
  34. String username = "Administrator";
  35. //administrator password
  36. String password = "Admin2008";
  37. //CMS name where you want to make the change
  38. String cmsname  = "CMS:6400";
  39. //type of authentification
  40. String authType = "secEnterprise";
  41.  
  42. IEnterpriseSession enterpriseSession = null;
  43. IInfoStore infoStore;
  44. IInfoObjects boInfoObjects;
  45. // Log on to Enterprise
  46. enterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authType);
  47. infoStore = (IInfoStore)enterpriseSession.getService("", "InfoStore");
  48.  
  49. //this is the query which finds all the users with Copy in the name; it's good to check the script in querybuilder: http://IP:8080/AdminTools/querybuilder/ie.jsp
  50. boInfoObjects = (IInfoObjects)infoStore.query("Select * FROM CI_SYSTEMOBJECTS WHERE SI_Kind='User' AND SI_NAME!= 'Administrator' AND SI_NAME !='Guest' AND SI_NAME like '%- Copy%' ORDER BY SI_ID ASC");
  51. //Loop thru all the users and change their name
  52. for(Iterator boCount = boInfoObjects.iterator() ; boCount.hasNext() ; ) {
  53.   IInfoObject boObject = (IInfoObject)boCount.next();
  54.   // Here is where you would do all the needed work / modifications
  55.   out.println("Current name = " + boObject.getTitle());
  56.   String oldtitle = boObject.getTitle();
  57.   //find the position of - in the name (account name is in the format username - Copy())
  58.   int toPos = oldtitle.indexOf("-");
  59.   //set the new title
  60.   String newtitle = oldtitle.substring(0, toPos);  
  61.   boObject.setTitle(newtitle);  
  62. }
  63. //save the changes
  64. infoStore.commit(boInfoObjects);
  65. out.println("Completed</br>");
  66. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement