private ModelNode addDeprecatedInfo(final ModelNode model) { ModelNode deprecated = model.get(ModelDescriptionConstants.DEPRECATED); deprecated.get(ModelDescriptionConstants.SINCE).set(deprecationData.getSince().toString()); deprecated.get(ModelDescriptionConstants.REASON); return deprecated; }
@Override public ModelNode getModelDescription(Locale locale) { ModelNode result = new ModelNode(); final ResourceBundle bundle = descriptionResolver.getResourceBundle(locale); final ResourceBundle attributeBundle = attributeDescriptionResolver.getResourceBundle(locale); result.get(OPERATION_NAME).set(operationName); result .get(DESCRIPTION) .set(descriptionResolver.getOperationDescription(operationName, locale, bundle)); result.get(REQUEST_PROPERTIES).setEmptyObject(); if (parameters != null) { for (AttributeDefinition definition : parameters) { definition.addOperationParameterDescription( result, operationName, attributeDescriptionResolver, locale, attributeBundle); } } final ModelNode reply = result.get(REPLY_PROPERTIES).setEmptyObject(); if (replyType != null && replyType != ModelType.UNDEFINED) { reply.get(TYPE).set(replyType); if (replyType == ModelType.LIST || replyType == ModelType.OBJECT) { if (replyValueType != null && replyValueType != ModelType.OBJECT) { reply.get(VALUE_TYPE).set(replyValueType); } else if (replyValueType != null) { reply .get(VALUE_TYPE) .set(getReplyValueTypeDescription(descriptionResolver, locale, bundle)); } } } if (replyParameters != null && replyParameters.length > 0) { if (replyParameters.length == 1) { AttributeDefinition ad = replyParameters[0]; ModelNode param = ad.getNoTextDescription(true); final String description = attributeDescriptionResolver.getOperationParameterDescription( operationName, ad.getName(), locale, attributeBundle); param.get(ModelDescriptionConstants.DESCRIPTION).set(description); reply.set(param); ModelNode deprecated = ad.addDeprecatedInfo(result); if (deprecated != null) { deprecated .get(ModelDescriptionConstants.REASON) .set( attributeDescriptionResolver.getOperationParameterDeprecatedDescription( operationName, ad.getName(), locale, attributeBundle)); } } else { reply.get(TYPE).set(ModelType.OBJECT); for (AttributeDefinition ad : replyParameters) { final ModelNode param = ad.addOperationParameterDescription( new ModelNode(), operationName, attributeDescriptionResolver, locale, bundle); reply.get(VALUE_TYPE, ad.getName()).set(param); } } } if (!reply.asList().isEmpty()) { final String replyDesc = descriptionResolver.getOperationReplyDescription(operationName, locale, bundle); if (replyDesc != null) { reply.get(DESCRIPTION).set(replyDesc); } } if (deprecationData != null) { ModelNode deprecated = result.get(ModelDescriptionConstants.DEPRECATED); deprecated.get(ModelDescriptionConstants.SINCE).set(deprecationData.getSince().toString()); deprecated .get(ModelDescriptionConstants.REASON) .set( descriptionResolver.getOperationDeprecatedDescription(operationName, locale, bundle)); } return result; }