Ejemplo n.º 1
0
  private ServiceMethodDefinition buildServiceMethodDefinition(
      ServiceMethodGroup serviceMethodGroup, ServiceMethod serviceMethod) {
    ServiceMethodDefinition definition = new ServiceMethodDefinition();
    definition.setMethodGroup(serviceMethodGroup.value());
    definition.setMethodGroupTitle(serviceMethodGroup.title());
    definition.setTags(serviceMethodGroup.tags());
    definition.setTimeout(serviceMethodGroup.timeout());
    definition.setIgnoreSign(IgnoreSignType.isIgnoreSign(serviceMethodGroup.ignoreSign()));
    definition.setVersion(serviceMethodGroup.version());
    definition.setNeedInSession(
        NeedInSessionType.isNeedInSession(serviceMethodGroup.needInSession()));

    // 如果ServiceMethod所提供的值和ServiceMethodGroup不一样,覆盖之
    definition.setMethod(serviceMethod.value());
    definition.setMethodTitle(serviceMethod.title());

    if (!ServiceMethodDefinition.DEFAULT_GROUP.equals(serviceMethod.group())) {
      definition.setMethodGroup(serviceMethod.group());
    }

    if (!ServiceMethodDefinition.DEFAULT_GROUP_TITLE.equals(serviceMethod.groupTitle())) {
      definition.setMethodGroupTitle(serviceMethod.groupTitle());
    }

    if (serviceMethod.tags() != null && serviceMethod.tags().length > 0) {
      definition.setTags(serviceMethod.tags());
    }

    if (serviceMethod.timeout() != -100) {
      definition.setTimeout(serviceMethod.timeout());
    }

    if (serviceMethod.ignoreSign() != IgnoreSignType.INVALID) {
      definition.setIgnoreSign(IgnoreSignType.isIgnoreSign(serviceMethod.ignoreSign()));
    }

    if (StringUtils.hasText(serviceMethod.version())) {
      definition.setVersion(serviceMethod.version());
    }

    if (serviceMethod.needInSession() != NeedInSessionType.INVALID) {
      definition.setNeedInSession(NeedInSessionType.isNeedInSession(serviceMethod.needInSession()));
    }

    return definition;
  }
Ejemplo n.º 2
0
 private ServiceMethodDefinition buildServiceMethodDefinition(ServiceMethod serviceMethod) {
   ServiceMethodDefinition definition = new ServiceMethodDefinition();
   definition.setMethod(serviceMethod.value());
   definition.setMethodTitle(serviceMethod.title());
   definition.setMethodGroup(serviceMethod.group());
   definition.setMethodGroupTitle(serviceMethod.groupTitle());
   definition.setTags(serviceMethod.tags());
   definition.setTimeout(serviceMethod.timeout());
   definition.setIgnoreSign(IgnoreSignType.isIgnoreSign(serviceMethod.ignoreSign()));
   definition.setVersion(serviceMethod.version());
   definition.setNeedInSession(NeedInSessionType.isNeedInSession(serviceMethod.needInSession()));
   return definition;
 }