Writing a simple administration application
A simple administration application typically involves a create operation for one of the following BIRT iHub objects:
*User
*Folder
*UserGroup
To perform an administration operation that acts on an existing object in the volume, such as a select, update, or delete operation, you must apply a search condition to the operation. To perform an administration operation that contains a set of administration operations requests, submit the request as a batch or transaction.
The following application derives from the code in the BIRT iHub Integration Technology example applications for the Microsoft .NET client. The application class, AcCreateUser, logs in to a volume as Administrator and creates a user. AcCreateUser performs the following tasks:
*Instantiates a CreateUser object and prepares a create user operation
CreateUser l_createUser = new CreateUser( );
l_createUser.IgnoreDup = true;
l_createUser.IgnoreDupSpecified = true;
*Instantiates a User object, setting the username, password, and home folder
l_createUser.User = new User( );
l_createUser.User.Name = l_UserName;
l_createUser.User.Password = l_password;
l_createUser.User.HomeFolder = l_homeFolder;
User is a complex data type that represents user attributes.
*Sets additional view preference, notification, e-mail, and job priority options in the User object
l_createUser.User.ViewPreference = UserViewPreference.DHTML;
l_createUser.User.ViewPreferenceSpecified = true;
l_createUser.User.SendNoticeForSuccess = true;
l_createUser.User.SendNoticeForSuccessSpecified = true;
l_createUser.User.SendNoticeForFailure = true;
l_createUser.User.SendNoticeForFailureSpecified = true;
l_createUser.User.SendEmailForSuccess = true;
l_createUser.User.SendEmailForSuccessSpecified = true;
l_createUser.User.SendEmailForFailure = true;
l_createUser.User.SendEmailForFailureSpecified = true;
l_createUser.User.EmailAddress = (l_createUserName + "@" + "localhost");
l_createUser.User.MaxJobPriority = 1000;
l_createUser.User.MaxJobPrioritySpecified = true;
*Instantiates an AdminOperation object and assigns the reference to the CreateUser object to it
AdminOperation l_createUserOpt = new AdminOperation( );
l_createUserOpt.Item = l_createUser;
*Assembles the create user request in an AdminOperation array
AdminOperation[ ] l_adminRequest = new AdminOperation[1];
l_adminRequest[0] = l_createUserOpt;
*Makes an administrate request using the proxy, passing in the reference to the AdminOperation array
try {
l_proxy.administrate(l_adminRequest);
}
catch(SoapException e) {
PrintExceptionDetails(e);
return;
}