Перейти к публикации

Как создать процесс из java?


Anto-Xa

Рекомендованные сообщения

Необходимо из java формы инициировать создание бизнес-процесса согласования документации. Раньше в версии TCE 8.1 необходимо в метод create отправить имя шаблона процесса (String). В 10 же версии (2005/2007) для этого метода необходим объект шаблона процесса. Как можно получить объект шаблона? Или хотя бы весь список шаблонов процессов?

Ссылка на сообщение
Поделиться на других сайтах
  • 2 недели спустя...


может вот этот кусок кода чем то поможет:

Object localObject;

   

	  int i;

	  IMANComponentTaskTemplate[] arrayOfIMANComponentTaskTemplate = null;

	  localObject = (IMANComponentTaskTemplateType)this.session.getTypeComponent("EPMTaskTemplate");

	  if (localObject != null)

		arrayOfIMANComponentTaskTemplate = ((IMANComponentTaskTemplateType)localObject).extentTaskTemplates(2, 0);

	  if (arrayOfIMANComponentTaskTemplate != null)

		if ((i = arrayOfIMANComponentTaskTemplate.length) >= 1)

		  break label39;

	  return;

	  label39: 

	  String[] arrayOfString = new String[i];

	  for (int j = 0; j < i; ++j)

	  {

		IMANComponentTaskTemplate localIMANComponentTaskTemplate2 = (IMANComponentTaskTemplate)arrayOfIMANComponentTaskTemplate[j];

		IMANComponentTaskTemplate localIMANComponentTaskTemplate1 = localIMANComponentTaskTemplate2.getRoot();

		arrayOfString[j] = localIMANComponentTaskTemplate1.toString();

	  }
Ссылка на сообщение
Поделиться на других сайтах

может вот этот кусок кода чем то поможет:

Object localObject;

   

	  int i;

	  IMANComponentTaskTemplate[] arrayOfIMANComponentTaskTemplate = null;

	  localObject = (IMANComponentTaskTemplateType)this.session.getTypeComponent("EPMTaskTemplate");

	  if (localObject != null)

		arrayOfIMANComponentTaskTemplate = ((IMANComponentTaskTemplateType)localObject).extentTaskTemplates(2, 0);

	  if (arrayOfIMANComponentTaskTemplate != null)

		if ((i = arrayOfIMANComponentTaskTemplate.length) >= 1)

		  break label39;

	  return;

	  label39: 

	  String[] arrayOfString = new String[i];

	  for (int j = 0; j < i; ++j)

	  {

		IMANComponentTaskTemplate localIMANComponentTaskTemplate2 = (IMANComponentTaskTemplate)arrayOfIMANComponentTaskTemplate[j];

		IMANComponentTaskTemplate localIMANComponentTaskTemplate1 = localIMANComponentTaskTemplate2.getRoot();

		arrayOfString[j] = localIMANComponentTaskTemplate1.toString();

	  }
декомпилятор это хорошо)

как вариант:

IMANComponentItemRevision target_item_rev = (IMANComponentItemRevision)target_comp;

IMANComponentTaskTemplateType task_type = (IMANComponentTaskTemplateType)session.getTypeComponent("EPMTaskTemplate");

IMANComponentTaskTemplate task = task_type.find("task_template",0);



int attachmentTypes[] = {1};

IMANComponent process_attachements[] = {target_item_rev};

IMANComponentProcessType process_type = (IMANComponentProcessType)session.getTypeComponent("Job");

IMANComponentProcess process = (IMANComponentProcess)process_type.create(target_item_rev.toString(),"",task,process_attachements,attachmentTypes);
Ссылка на сообщение
Поделиться на других сайтах
lexx174 , одних явадоков по ТС порой мало, вот вместе с декомпилятором и помощью форума уже можно горы свернуть...)
Ссылка на сообщение
Поделиться на других сайтах

lexx174 , одних явадоков по ТС порой мало, вот вместе с декомпилятором и помощью форума уже можно горы свернуть...)

никто не говорит что декомпилятор плохо.в случае с TC это даже нужный в ряде случаев вариант
Ссылка на сообщение
Поделиться на других сайтах
  • 1 месяц спустя...

подскажите, какой смысл в последнем аргументе в task_type.find и process_type.create. что это за типы и откуда брать их значения?

кто знает как изобразить то же самое посредством SOA? судя по изъятию классов из жаводока, сименс намекает именно на это

Изменено пользователем tuzik
Ссылка на сообщение
Поделиться на других сайтах
  • 3 месяца спустя...

А чем вы декомпилируете джава-классы?

У меня декомпилятор показывает только импорты и объявления методов. А что выполняют эти методы, скрывает.

Ссылка на сообщение
Поделиться на других сайтах
  • 4 года спустя...


import com.teamcenter.rac.kernel.TCComponentProcess;

import com.teamcenter.rac.kernel.TCComponentProcessType;

import com.teamcenter.rac.kernel.TCComponentTaskTemplate;

import com.teamcenter.rac.kernel.TCComponentTaskTemplateType;

import com.teamcenter.services.rac.workflow.WorkflowService;

import com.teamcenter.services.rac.workflow._2008_06.Workflow.AttachmentInfo;

private static TCComponentProcess newProcess;

private static Vector<TCComponentItemRevision> occuranceQty;

private static boolean createWorkflow(){

boolean status = false;

newProcess = null;

AbstractAIFApplication app = AIFDesktop.getActiveDesktop().getCurrentApplication();

TCSession session = (TCSession)app.getSession();

try {

TCComponentProcessType processType = (TCComponentProcessType)session.getTypeComponent("Job");

TCComponentTaskTemplateType taskTemplateType = (TCComponentTaskTemplateType)session.getTypeComponent("EPMTaskTemplate");

TCComponent[] itemRevs = (TCComponentItemRevision[]) occuranceQty.toArray(new TCComponentItemRevision[occuranceQty.size()]);

TCComponentTaskTemplate[] tasksTemplate = taskTemplateType.extentReadyTemplates(true);

TCComponentTaskTemplate taskTemplate = null;

for(TCComponentTaskTemplate template : tasksTemplate){

if(template.getStringProperty("object_name").equalsIgnoreCase("TASK TEMPLATE NAME")){

taskTemplate = template;

break;

}

}

if(taskTemplate != null){

int[] paramArrayOfInt = new int [itemRevs.length];

Arrays.fill(paramArrayOfInt, 1);

newProcess = (TCComponentProcess)processType.create("PROCESS NAME", "PROCESS DESC", taskTemplate, itemRevs, paramArrayOfInt);

//добавление объектов в цели

WorkflowService serviceWF = WorkflowService.getService(session);

int count = occuranceQty.size();

int countBomView = 0;

for(TableItem row : table_0.getItems()){

if(row.getText(5).equalsIgnoreCase("<Assy_item_type>")){

countBomView++;

}

}

TCComponent[] items = new TCComponent[count];

TCComponent[] itemMasters = new TCComponent[count];

TCComponent[] itemBomViews = new TCComponent[countBomView];

int[] attachmentType = new int[count];

int[] attachmentTypeBomViews = new int[countBomView];

Arrays.fill(attachmentType, 1);

Arrays.fill(attachmentTypeBomViews, 1);

//не все объекты имеют BOMView (состав)

int j = 0;

for(int i = 0; i < count; i++){

items = occuranceQty.get(i).getItem();

itemMasters = occuranceQty.get(i).getItem().getRelatedComponent("IMAN_master_form");

TCComponent bomView = null;

bomView = occuranceQty.get(i).getItem().getRelatedComponent("bom_view_tags");

if(bomView != null){

itemBomViews[j] = bomView; j++;

}

}

AttachmentInfo attachInfo = new AttachmentInfo();

attachInfo.attachmentType = attachmentType;

attachInfo.attachment = items;

serviceWF.addAttachments(newProcess.getRootTask(), attachInfo); attachInfo.attachment = itemMasters;

serviceWF.addAttachments(newProcess.getRootTask(), attachInfo); attachInfo.attachment = itemBomViews;

attachInfo.attachmentType = attachmentTypeBomViews; serviceWF.addAttachments(newProcess.getRootTask(), attachInfo);

}

} catch (TCException e1) {

e1.printStackTrace();

}

status = (newProcess == null) ? false : true;

return status;

}

Ссылка на сообщение
Поделиться на других сайтах

Присоединяйтесь к обсуждению

Вы можете опубликовать сообщение сейчас, а зарегистрироваться позже. Если у вас есть аккаунт, войдите в него для написания от своего имени.
Примечание: вашему сообщению потребуется утверждение модератора, прежде чем оно станет доступным.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

  • Сейчас на странице   0 пользователей

    Нет пользователей, просматривающих эту страницу.




×
×
  • Создать...