Home
Example: Activities administrative session
The following sample is a typical Activities administrative session. Reference this example to see how various administrative commands are used.
EXAMPLE OF USING ACTIVITIES ADMINISTRATIVE COMMANDS # The following example adds two new members to existing activities. # User manager@company.com will be added to all activities where user # employee1@company.com is a member. This user will be added with "owner" # access to those activities. Next, user employee2@company.com will be # added as a member to all activities that employee1@company.com has access # to, but with "author" access. # Create a member object by using their email and assign the value that is returned # to a variable. wsadmin>employee1=ActivitiesMemberService.fetchMemberByEmail("employee1@company.com") wsadmin>employee2=ActivitiesMemberService.fetchMemberByEmail("employee2@company.com") wsadmin>manager=ActivitiesMemberService.fetchMemberByEmail("manager@company.com") # Call the ActivityService to fetch all activities that employee1 is a member of. wsadmin>activities=ActivityService.fetchActivitiesByMember(employee1) # Call AccessControlService to add 'manager' to all of 'employee1' activities as # new owner wsadmin>AccessControlService.setOwnerAccess(activities,manager) # Call the AccessControlService to add 'employee2' to all of 'employee1' # activities as a new member (with author access). Because the # AccessControl.setMembersAccess command is expecting the second argument # (member to be added) to be a "vector", the first 3 commands convert the value # that is stored in the variable "employee2" from a "Hashtable" # into a "Vector" and stores the new vector in the variable "newMembers". wsadmin>from java.util import Vector wsadmin>newMembers=Vector() wsadmin>newMembers.add(employee2) wsadmin>AccessControlService.setMembersAccess(activities,newMembers) # Export all activities of which a person is a member to location "c:/temp/zips". # Create a member object by using their email and assign it to the variable # "member". wsadmin>member=ActivitiesMemberService.fetchMemberByEmail("employee@company.com") # Call the ActivityService to fetch all of their activities and assign the result # to the variable "activities". wsadmin>activities=ActivityService.fetchActivitiesByMember(member) # Call export to export their activities to the given wsadmin>ArchiveService.exportActivities("c:/temp/zips",activities) # Import all activities from the archives in a # From a previous export, locate the of activity zip files to import, # and type: wsadmin>activitiesToImport=ArchiveService.fetchActivities("c:/temp/zips") # Call the ArchiveService to import the activities. If they already exist in the # system, the activities are overwritten. wsadmin>ArchiveService.importActivities("c:/temp/zips",activitiesToImport) # Create new activities from the previously exported archives in a # From a previous export, locate the of activity zip files to import, # and type: wsadmin>activitiesToImport=ArchiveService.fetchActivities("c:/temp/zips") # Alternatively, if it's preferable not to overwrite existing activities, call # 'createActivities' instead to create copies. Notice, this command will generate # new UUIDs for all the imported activities. wsadmin>ArchiveService.createActivities("c:/temp/zips",activitiesToImport) # Delete an activity and purge it from the system. The following example takes an # activity and deletes it, placing the activity in the Trash view. Next, Trash is # purged of all activities. # Find the activity to delete wsadmin>activity=ActivityService.fetchActivityById("<enter valid activity UUID>") # Convert the variable "activity" from a Hashtable to a Vector because the # ActivityService.deleteActivities command is expecting a Vector as input wsadmin>from java.util import Vector wsadmin>toDelete=Vector() wsadmin>toDelete.add(activity) # Call the ActivityService to delete the activity wsadmin>ActivityService.deleteActivities(toDelete) # Call the TrashCollectionService to get all items in the trash including this activity wsadmin>trash=TrashCollectionService.fetchTrash() # Call the TrashCollectionService to purge all trash items wsadmin>TrashCollectionService.purgeTrash(trash) # Querying the Scheduler # The commands below provide samples of Scheduler commands and responses. wsadmin>Scheduler.listSchedulerNames() array(['local','cluster'],java.lang.String) wsadmin>Scheduler.listJobs("local") array(['30MinStats','DailyStats'],java.lang.String) wsadmin>Scheduler.listJobs("cluster") array(['DatabaseRuntimeStats','TrashAutoPurgeJob',"ActivityAutoCompleteJob"], java.lang.String) wsadmin>Scheduler.getJobDetails("local","30MinStats") {trigger0.nextFireTime=Mon Feb 26 17:30:00 EST 2007, name=30MinStats, trigger0.startTime=Mon Feb 26 17:17:58 EST 2007, trigger0.triggerName=Activities 30 Minute Statistic Collector Trigger}
Running administrative commands