-- Create table
create table PROJECT_OBJECTS
(
project_id VARCHAR2(50),
object_id VARCHAR2(50),
object_path VARCHAR2(1500)
);
create or replace procedure get_MSTR_Object_Path(p_project_id varchar2)
as
begin
execute immediate 'truncate table PROJECT_OBJECTS';
INSERT INTO PROJECT_OBJECTS (Project_ID, Object_id, OBJECT_PATH)
WITH Parent1 (PROJECT_ID,OBJECT_ID, Parent_ID, object_type, OBJECT_PATH)AS
(
SELECT PROJECT_ID,
OBJECT_ID as OBJECT_ID,
Parent_ID as Parent_ID,
object_type as object_type,
cast(OBJECT_NAME as varchar2(4000)) as OBJECT_NAME
FROM
DSSMDOBJINFO
WHERE PARENT_ID in ( '98FE182C2A10427EACE0CD30B6768258','95C3B713318B43D490EE789BE27D298C')
and PROJECT_ID = p_project_id
UNION ALL
SELECT th.project_id,
TH.OBJECT_ID,
TH.PARENT_ID,
th.object_type,
cast( Parent1.OBJECT_PATH || '\' || TH.OBJECT_NAME as varchar2(4000)) AS Path
FROM
DSSMDOBJINFO TH
JOIN Parent1
ON Parent1.object_ID = TH.PARENT_ID and Parent1.project_id =th.project_id
where Parent1.object_ID = TH.PARENT_ID
and Parent1.project_id =Th.project_id
)
SELECT distinct Parent1.project_id as project_id,Parent1.object_id as object_id,'\Public Objects\'|| OBJECT_PATH as OBJECT_NAME FROM Parent1
where -- object_type in (1,3,12,14,56) and
( Parent1.OBJECT_PATH NOT like '%Regression%' and lower(Parent1.OBJECT_PATH) NOT like '%unused%');
commit;
End;
Friday, October 31, 2014
Wednesday, January 8, 2014
Oracle DB gather schema statics
begin
DBMS_STATS.GATHER_SCHEMA_STATS ('xyz_931', OPTIONS=> 'GATHER AUTO');
DBMS_STATS.GATHER_SCHEMA_STATS ('xyz_931', OPTIONS=> 'GATHER AUTO');
end;
DBMS_STATS.GATHER_SCHEMA_STATS ('xyz_931', OPTIONS=> 'GATHER AUTO');
DBMS_STATS.GATHER_SCHEMA_STATS ('xyz_931', OPTIONS=> 'GATHER AUTO');
end;
Thursday, April 11, 2013
MicroStrategy Web Sdk: Create DBLogin
public WebDBLogin createdblogin(WebObjectSource webObjectSource, String dbLoginName, String schemaName, String password)
{
WebDBLogin dbLogin = null;
String dbLoginId = "";
try
{
if (dbLoginName != "" && schemaName != "")
{
dbLoginId = searchDBLoginID(webObjectSource, dbLoginName);
if (dbLoginId == "")
{
dbLogin = (WebDBLogin) webObjectSource.getNewObject(EnumDSSXMLObjectTypes.DssXmlTypeDBLogin);
dbLogin.setLogin(schemaName);
dbLogin.setPassword(password);
WebFolder folderDBL = (WebFolder) webObjectSource.getObject(webObjectSource.getFolderID(EnumDSSXMLFolderNames.DssXmlFolderNameDBLogins), EnumDSSXMLObjectTypes.DssXmlTypeFolder);
webObjectSource.save(dbLogin, dbLoginName, folderDBL);
System.out.println("DB Login \"" +dbLoginName+ "\"creatd successfully");
}
else
{
dbLogin = (WebDBLogin) webObjectSource.getObject(dbLoginId, EnumDSSXMLObjectTypes.DssXmlTypeDBLogin,true);
System.out.println("DB login: \"" + dbLoginName + "\" already exists.");
dbLogin.setLogin(schemaName);
dbLogin.setPassword(password);
webObjectSource.save(dbLogin);
System.out.println("Modified DB login: \"" + dbLoginName + "\".");
}
}
else
{
MstrObjectList.log.info("Not a valid db login");
}
}
catch (WebObjectsException e)
{
System.out.println(e.getMessage());
}
return dbLogin;
}
{
WebDBLogin dbLogin = null;
String dbLoginId = "";
try
{
if (dbLoginName != "" && schemaName != "")
{
dbLoginId = searchDBLoginID(webObjectSource, dbLoginName);
if (dbLoginId == "")
{
dbLogin = (WebDBLogin) webObjectSource.getNewObject(EnumDSSXMLObjectTypes.DssXmlTypeDBLogin);
dbLogin.setLogin(schemaName);
dbLogin.setPassword(password);
WebFolder folderDBL = (WebFolder) webObjectSource.getObject(webObjectSource.getFolderID(EnumDSSXMLFolderNames.DssXmlFolderNameDBLogins), EnumDSSXMLObjectTypes.DssXmlTypeFolder);
webObjectSource.save(dbLogin, dbLoginName, folderDBL);
System.out.println("DB Login \"" +dbLoginName+ "\"creatd successfully");
}
else
{
dbLogin = (WebDBLogin) webObjectSource.getObject(dbLoginId, EnumDSSXMLObjectTypes.DssXmlTypeDBLogin,true);
System.out.println("DB login: \"" + dbLoginName + "\" already exists.");
dbLogin.setLogin(schemaName);
dbLogin.setPassword(password);
webObjectSource.save(dbLogin);
System.out.println("Modified DB login: \"" + dbLoginName + "\".");
}
}
else
{
MstrObjectList.log.info("Not a valid db login");
}
}
catch (WebObjectsException e)
{
System.out.println(e.getMessage());
}
return dbLogin;
}
Monday, April 8, 2013
MicroStrategy Web SDK Generic Methods: get object Path
public static String getPath(WebObjectSource objectSource, String objectId, int type)
{
String path = "";
WebFolder folder1 = null;
try
{
folder1 = (WebFolder) objectSource.getObject(objectId, EnumDSSXMLObjectTypes.DssXmlTypeFolder);
folder1.populate();
String p = "";
SimpleList list = folder1.getAncestors();
for (int j = 0; j < folder1.getAncestors().size(); j++)
{
p = ((WebObjectInfo) list.item(j)).getName();
if (!p.equals(MstrObjectList.projectName))
{
path = path + "/" + p;
}
}
}
catch (Exception ex)
{
Logger.log.error("Error while fetching the path of folder: " + ex.getMessage());
}
return path;
}
{
String path = "";
WebFolder folder1 = null;
try
{
folder1 = (WebFolder) objectSource.getObject(objectId, EnumDSSXMLObjectTypes.DssXmlTypeFolder);
folder1.populate();
String p = "";
SimpleList list = folder1.getAncestors();
for (int j = 0; j < folder1.getAncestors().size(); j++)
{
p = ((WebObjectInfo) list.item(j)).getName();
if (!p.equals(MstrObjectList.projectName))
{
path = path + "/" + p;
}
}
}
catch (Exception ex)
{
Logger.log.error("Error while fetching the path of folder: " + ex.getMessage());
}
return path;
}
MicroStrategy Web SDK Generic Methods: get object type
public static String getObjectType(int type)
{
String objectType = "";
if (type == 1)
{
objectType = "Filter";
}
else if (type == 2)
{
objectType = "Template";
}
else if (type == 3)
{
objectType = "Report";
}
else if (type == 4)
{
objectType = "Metric";
}
else if (type == 6)
{
objectType = "Auto Stype";
}
else if (type == 8)
{
objectType = "Folder";
}
else if (type == 9)
{
objectType = "Subscripiton Device";
}
else if (type == 10)
{
objectType = "Prompt";
}
else if (type == 12)
{
objectType = "Attribute";
}
else if (type == 13)
{
objectType = "Fact";
}
else if (type == 14)
{
objectType = "Hierarchy";
}
else if (type == 15)
{
objectType = "Table";
}
else if (type == 16)
{
objectType = "Datamart Report";
}
else if (type == 17)
{
objectType = "Fact Group";
}
else if (type == 18)
{
objectType = "Shortcut";
}
else if (type == 34)
{
objectType = "User";
}
else if (type == 41)
{
objectType = "Data Mart";
}
else if (type == 42)
{
objectType = "Function";
}
else if (type == 47)
{
objectType = "Consolidation";
}
else if (type == 56)
{
objectType = "Drill Map";
}
else if (type == 55)
{
objectType = "Document";
}
return objectType;
}
{
String objectType = "";
if (type == 1)
{
objectType = "Filter";
}
else if (type == 2)
{
objectType = "Template";
}
else if (type == 3)
{
objectType = "Report";
}
else if (type == 4)
{
objectType = "Metric";
}
else if (type == 6)
{
objectType = "Auto Stype";
}
else if (type == 8)
{
objectType = "Folder";
}
else if (type == 9)
{
objectType = "Subscripiton Device";
}
else if (type == 10)
{
objectType = "Prompt";
}
else if (type == 12)
{
objectType = "Attribute";
}
else if (type == 13)
{
objectType = "Fact";
}
else if (type == 14)
{
objectType = "Hierarchy";
}
else if (type == 15)
{
objectType = "Table";
}
else if (type == 16)
{
objectType = "Datamart Report";
}
else if (type == 17)
{
objectType = "Fact Group";
}
else if (type == 18)
{
objectType = "Shortcut";
}
else if (type == 34)
{
objectType = "User";
}
else if (type == 41)
{
objectType = "Data Mart";
}
else if (type == 42)
{
objectType = "Function";
}
else if (type == 47)
{
objectType = "Consolidation";
}
else if (type == 56)
{
objectType = "Drill Map";
}
else if (type == 55)
{
objectType = "Document";
}
return objectType;
}
MicroStrategy Command manager scripts
Create User:
CREATE USER "xxx" PASSWORD "" FULLNAME "xxxx" PASSWORDEXP NEVER;
Create Group:
CREATE USER GROUP "xxx_group" IN GROUP "MicroStrategy Groups";
ALTER USER GROUP "xxx_group" GROUP "";
Add User In group:
ADD USER "xxx" TO GROUP "xxx_group";
Create Security Filter:
CREATE SECURITY FILTER "xxxx" IN PROJECT "project" EXPRESSION "category@ID=27";
CREATE USER "xxx" PASSWORD "" FULLNAME "xxxx" PASSWORDEXP NEVER;
Create Group:
CREATE USER GROUP "xxx_group" IN GROUP "MicroStrategy Groups";
ALTER USER GROUP "xxx_group" GROUP "
Add User In group:
ADD USER "xxx" TO GROUP "xxx_group";
Create Security Filter:
CREATE SECURITY FILTER "xxxx" IN PROJECT "project" EXPRESSION "category@ID=27";
MicroStragey Web Sdk create User Group
UserGroupBean userGroup = WebBeanFactory.getInstance().newUserGroupBean();
userGroup.setSessionInfo(MstrSessionManagement.serverSession);
userGroup.InitAsNew();
userGroup.getUserEntityObject().setFullName(groupName);
userGroup.save();
Logger.log.info("User Group \"" + groupName + "\" has been created successfully.");
userGroupID = userGroup.getObjectID();
userGroup.setSessionInfo(MstrSessionManagement.serverSession);
userGroup.InitAsNew();
userGroup.getUserEntityObject().setFullName(groupName);
userGroup.save();
Logger.log.info("User Group \"" + groupName + "\" has been created successfully.");
userGroupID = userGroup.getObjectID();
Subscribe to:
Posts (Atom)