예제 #1
0
 public UpdateInTC(String tcUserid, String tcPassword, String tcGroup, String tcServerHost)
 {
     userid     = tcUserid;
     password   = tcPassword;
     group      = tcGroup;
     serverHost = tcServerHost;
     initialize();
     user = login();
     byPassPrivileges();
 }
        private static void getUsers(ModelObject[] objects)
        {
            if (objects == null)
            {
                return;
            }

            DataManagementService dmService    = DataManagementService.getService(Session.getConnection());
            ArrayList             unKnownUsers = new ArrayList();

            for (int i = 0; i < objects.Length; i++)
            {
                if (!(objects[i] is WorkspaceObject))
                {
                    continue;
                }

                WorkspaceObject wo = (WorkspaceObject)objects[i];

                User owner = null;
                try
                {
                    owner = (User)wo.Owning_user;
                    String userName = owner.User_name;
                }
                catch (NotLoadedException /*e*/)
                {
                    if (owner != null)
                    {
                        unKnownUsers.Add(owner);
                    }
                }
            }
            User[] users = new User[unKnownUsers.Count];
            unKnownUsers.CopyTo(users);
            String[] attributes = { "user_name" };


            // *****************************
            // Execute the service operation
            // *****************************
            dmService.GetProperties(users, attributes);
        }
        /**
         * Print some basic information for a list of objects
         *
         * @param objects
         */
        public static void printObjects(ModelObject[] objects)
        {
            if (objects == null)
            {
                return;
            }


            // Ensure that the referenced User objects that we will use below are loaded
            getUsers(objects);

            Console.WriteLine("Name\t\tOwner\t\tLast Modified");
            Console.WriteLine("====\t\t=====\t\t=============");
            for (int i = 0; i < objects.Length; i++)
            {
                if (!(objects[i] is WorkspaceObject))
                {
                    continue;
                }

                WorkspaceObject wo = (WorkspaceObject)objects[i];
                try
                {
                    String   name         = wo.Object_string;
                    User     owner        = (User)wo.Owning_user;
                    DateTime lastModified = wo.Last_mod_date;

                    Console.WriteLine(name + "\t" + owner.User_name + "\t" + lastModified.ToString());
                }
                catch (NotLoadedException e)
                {
                    // Print out a message, and skip to the next item in the folder
                    // Could do a DataManagementService.getProperties call at this point
                    Console.WriteLine(e.Message);
                    Console.WriteLine("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property.");
                }
            }
        }
 public static void InitializeProces()
 {
     initialize();
     user = login();
     byPassPrivileges();
 }