Exemple #1
0
        /**
         * Create ItemMasterForm and ItemRevisionMasterForm
         *
         * @param IMFormName      Name of ItemMasterForm
         * @param IMFormType      Type of ItemMasterForm
         * @param IRMFormName     Name of ItemRevisionMasterForm
         * @param IRMFormType     Type of ItemRevisionMasterForm
         * @param parent          The container object that two
         *                        newly-created forms will be added into.
         * @return ModelObject[]  Array of forms
         *
         * @throws ServiceException         If any partial errors are returned
         */
        public ModelObject[] createForms(String IMFormName, String IMFormType,
                                         String IRMFormName, String IRMFormType,
                                         ModelObject parent, bool saveDB) //throws ServiceException
        {
            //Get the service stub
            DataManagementService dmService = DataManagementService.getService(Session.getConnection());

            FormInfo[] inputs = new FormInfo[2];
            inputs[0]              = new FormInfo();
            inputs[0].ClientId     = "1";
            inputs[0].Description  = "";
            inputs[0].Name         = IMFormName;
            inputs[0].FormType     = IMFormType;
            inputs[0].SaveDB       = saveDB;
            inputs[0].ParentObject = parent;
            inputs[1]              = new FormInfo();
            inputs[1].ClientId     = "2";
            inputs[1].Description  = "";
            inputs[1].Name         = IRMFormName;
            inputs[1].FormType     = IRMFormType;
            inputs[1].SaveDB       = saveDB;
            inputs[1].ParentObject = parent;
            CreateOrUpdateFormsResponse response = dmService.CreateOrUpdateForms(inputs);

            if (response.ServiceData.sizeOfPartialErrors() > 0)
            {
                throw new ServiceException("DataManagementService.createForms returned a partial error.");
            }
            ModelObject[] forms = new ModelObject [inputs.Length];
            for (int i = 0; i < inputs.Length; ++i)
            {
                forms[i] = response.Outputs[i].Form;
            }
            return(forms);
        }