public ActivityType unmarshall(JsonUnmarshallerContext context) throws Exception {
    ActivityType activityType = new ActivityType();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();
    if (token == VALUE_NULL) return null;

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("name", targetDepth)) {
          context.nextToken();
          activityType.setName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("version", targetDepth)) {
          context.nextToken();
          activityType.setVersion(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }

      token = context.nextToken();
    }

    return activityType;
  }
示例#2
0
 @Nullable
 @Override
 public String apply(@Nullable final ActivityType activityType) {
   return activityType == null
       ? null
       : SimpleWorkflowMetadatas.toDisplayName().apply(activityType.getDomain());
 }
示例#3
0
 @Nullable
 @Override
 public ActivityTypeDetail apply(@Nullable final ActivityType activityType) {
   return activityType == null
       ? null
       : new ActivityTypeDetail()
           .withConfiguration(
               new ActivityTypeConfiguration()
                   .withDefaultTaskList(
                       new TaskList().withName(activityType.getDefaultTaskList()))
                   .withDefaultTaskHeartbeatTimeout(
                       timeout(activityType.getDefaultTaskHeartbeatTimeout()))
                   .withDefaultTaskScheduleToCloseTimeout(
                       timeout(activityType.getDefaultTaskScheduleToCloseTimeout()))
                   .withDefaultTaskScheduleToStartTimeout(
                       timeout(activityType.getDefaultTaskScheduleToStartTimeout()))
                   .withDefaultTaskStartToCloseTimeout(
                       timeout(activityType.getDefaultTaskStartToCloseTimeout())))
           .withTypeInfo(TypeMappers.transform(activityType, ActivityTypeInfo.class));
 }
示例#4
0
 @Nullable
 @Override
 public ActivityTypeInfo apply(@Nullable final ActivityType activityType) {
   return activityType == null
       ? null
       : new ActivityTypeInfo()
           .withActivityType(
               new com.eucalyptus.simpleworkflow.common.model.ActivityType()
                   .withName(activityType.getDisplayName())
                   .withVersion(activityType.getActivityVersion()))
           .withDescription(activityType.getDescription())
           .withCreationDate(activityType.getCreationTimestamp())
           .withDeprecationDate(activityType.getDeprecationTimestamp())
           .withStatus(Objects.toString(activityType.getState(), null));
 }
 public ActivityType getType() {
   return ActivityType.valueOf(getUserActivityType().name());
 }
 public void setType(ActivityType activityType) {
   setUserActivityType(uclm.esi.cardroid.data.zerocice.ActivityType.valueOf(activityType.name()));
 }
示例#7
0
 public static ActivityType parse(final String typeString) {
   final ActivityType[] aTypes = ActivityType.values();
   for (final ActivityType aType : aTypes)
     if (aType.type.equalsIgnoreCase(typeString)) return aType;
   return null;
 }
示例#8
0
 @Nullable
 @Override
 public String apply(@Nullable final ActivityType activityType) {
   return activityType == null ? null : Objects.toString(activityType.getState(), null);
 }
  @Test
  public void testCrossModelLanePerformer() throws Exception {
    providerModel = modelService.findModel(PROVIDER_MODEL_ID);
    providerModel2 = modelService.findModel(PROVIDER_MODEL_ID2);

    consumerModel = modelService.findModel(CONSUMER_MODEL_ID);

    InputStream requestInput =
        getClass().getResourceAsStream("../../service/rest/requests/createRolesForProvider.txt");
    InputStreamReader requestStream = new InputStreamReader(requestInput);
    replay(requestStream, "createRolesForProvider", false);

    requestInput =
        getClass().getResourceAsStream("../../service/rest/requests/createRolesForProvider2.txt");
    requestStream = new InputStreamReader(requestInput);
    replay(requestStream, "createRolesForProvider2", false);

    requestInput =
        getClass().getResourceAsStream("../../service/rest/requests/prepareMultiModelConsumer.txt");
    requestStream = new InputStreamReader(requestInput);
    replay(requestStream, "prepareMultiModelConsumer", false);

    RoleType role2 = null;
    RoleType role1 = null;
    for (RoleType role : consumerModel.getRole()) {
      if (role.getId().equals("Role2")) {
        role2 = role;
      }
      if (role.getId().equals("Role1")) {
        role1 = role;
      }
    }

    assertThat(role2, is(nullValue()));
    assertThat(role1, is(not(nullValue())));
    assertThat(role1.eIsProxy(), is(false));

    EList<ProcessDefinitionType> processDefinitions = consumerModel.getProcessDefinition();
    ProcessDefinitionType processDefinition = processDefinitions.get(0);
    assertThat(processDefinition, is(not(nullValue())));
    EList<ActivityType> activities = processDefinition.getActivity();
    ActivityType activity = activities.get(0);
    assertThat(activity, is(not(nullValue())));
    IModelParticipant performer = activity.getPerformer();
    assertThat(performer, is(not(nullValue())));
    assertEquals(performer, role1);

    EList<ExternalPackage> externalPackage =
        consumerModel.getExternalPackages().getExternalPackage();
    assertThat(externalPackage.size(), is(0));

    saveModel();

    List<AttributeType> attributes = consumerModel.getAttribute();
    for (AttributeType attribute : attributes) {
      String attributeName = attribute.getName();
      assertThat(attributeName, not(containsString("carnot:connection:")));
    }

    // saveReplayModel("C:/tmp");
  }