test_class.declarator: metadata
test_class.modifier: private
test_class.original_string: private Metadata metadata;
test_class.type: Metadata
test_class.var_name: metadata
test_class.declarator: address
test_class.modifier: private
test_class.original_string: private ResourceAddress address;
test_class.type: ResourceAddress
test_class.var_name: address
test_class.declarator: operationFactory
test_class.modifier: private
test_class.original_string: private OperationFactory operationFactory;
test_class.type: OperationFactory
test_class.var_name: operationFactory
test_class.file: core/src/test/java/org/jboss/hal/core/OperationFactoryTest.java
test_class.identifier: OperationFactoryTest
test_case.body: @Test
      public void reset() {
          Composite composite = operationFactory.resetResource(address,
                  Sets.newHashSet("authentication-context", // string w/ alternative
                          "capacity-decrementer-class", // string
                          "capacity-incrementer-properties", // object
                          "class-name", // string(required)
                          "connectable", // boolean(false)
                          "initial-pool-size", // int
                          "max-pool-size", // int(20)
                          "xa-resource-timeout"), // is required by wrap-xa-resource
                  metadata);
          assertUndefine(composite, "capacity-decrementer-class");
          assertUndefine(composite, "capacity-incrementer-properties");
          assertUndefine(composite, "connectable");
          assertUndefine(composite, "max-pool-size");
          assertUndefineNotPresent(composite, "xa-resource-timeout");
      }
test_case.class_method_signature: OperationFactoryTest.reset()
test_case.full_signature: @Test public void reset()
test_case.identifier: reset
test_case.invocations: resetResource newHashSet assertUndefine assertUndefine assertUndefine assertUndefine assertUndefineNotPresent
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void reset()
focal_class.declarator: logger = LoggerFactory.getLogger(OperationFactory.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(OperationFactory.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: nameFn
focal_class.modifier: private final
focal_class.original_string: private final Function<String, String> nameFn;
focal_class.type: Function<String, String>
focal_class.var_name: nameFn
focal_class.file: core/src/main/java/org/jboss/hal/core/OperationFactory.java
focal_class.identifier: OperationFactory
focal_class.class_method_signature: OperationFactory.OperationFactory()
focal_class.full_signature: public  OperationFactory()
focal_class.identifier: OperationFactory
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  OperationFactory()
focal_class.class_method_signature: OperationFactory.OperationFactory(Function<String, String> nameFn)
focal_class.full_signature: public  OperationFactory(Function<String, String> nameFn)
focal_class.identifier: OperationFactory
focal_class.modifiers: public
focal_class.parameters: (Function<String, String> nameFn)
focal_class.signature:  OperationFactory(Function<String, String> nameFn)
focal_class.class_method_signature: OperationFactory.fromChangeSet(ResourceAddress address, Map<String, Object> changeSet,
              Metadata metadata)
focal_class.full_signature: public Composite fromChangeSet(ResourceAddress address, Map<String, Object> changeSet,
              Metadata metadata)
focal_class.identifier: fromChangeSet
focal_class.modifiers: public
focal_class.parameters: (ResourceAddress address, Map<String, Object> changeSet,
              Metadata metadata)
focal_class.return: Composite
focal_class.signature: Composite fromChangeSet(ResourceAddress address, Map<String, Object> changeSet,
              Metadata metadata)
focal_class.class_method_signature: OperationFactory.resetResource(ResourceAddress address, Set<String> attributes,
              Metadata metadata)
focal_class.full_signature:  Composite resetResource(ResourceAddress address, Set<String> attributes,
              Metadata metadata)
focal_class.identifier: resetResource
focal_class.parameters: (ResourceAddress address, Set<String> attributes,
              Metadata metadata)
focal_class.return: Composite
focal_class.signature: Composite resetResource(ResourceAddress address, Set<String> attributes,
              Metadata metadata)
focal_class.class_method_signature: OperationFactory.isNullOrEmpty(Object value)
focal_class.full_signature: private boolean isNullOrEmpty(Object value)
focal_class.identifier: isNullOrEmpty
focal_class.modifiers: private
focal_class.parameters: (Object value)
focal_class.return: boolean
focal_class.signature: boolean isNullOrEmpty(Object value)
focal_class.class_method_signature: OperationFactory.undefineAttribute(ResourceAddress address, String name)
focal_class.full_signature: private Operation undefineAttribute(ResourceAddress address, String name)
focal_class.identifier: undefineAttribute
focal_class.modifiers: private
focal_class.parameters: (ResourceAddress address, String name)
focal_class.return: Operation
focal_class.signature: Operation undefineAttribute(ResourceAddress address, String name)
focal_class.class_method_signature: OperationFactory.writeAttribute(ResourceAddress address, String name, Object value,
              ResourceDescription resourceDescription)
focal_class.full_signature: private Operation writeAttribute(ResourceAddress address, String name, Object value,
              ResourceDescription resourceDescription)
focal_class.identifier: writeAttribute
focal_class.modifiers: private
focal_class.parameters: (ResourceAddress address, String name, Object value,
              ResourceDescription resourceDescription)
focal_class.return: Operation
focal_class.signature: Operation writeAttribute(ResourceAddress address, String name, Object value,
              ResourceDescription resourceDescription)
focal_class.class_method_signature: OperationFactory.attributeName(String name)
focal_class.full_signature: private String attributeName(String name)
focal_class.identifier: attributeName
focal_class.modifiers: private
focal_class.parameters: (String name)
focal_class.return: String
focal_class.signature: String attributeName(String name)
focal_class.class_method_signature: OperationFactory.asValueNode(String name, Object value, ResourceDescription resourceDescription)
focal_class.full_signature: private ModelNode asValueNode(String name, Object value, ResourceDescription resourceDescription)
focal_class.identifier: asValueNode
focal_class.modifiers: private
focal_class.parameters: (String name, Object value, ResourceDescription resourceDescription)
focal_class.return: ModelNode
focal_class.signature: ModelNode asValueNode(String name, Object value, ResourceDescription resourceDescription)
focal_method.body: Composite resetResource(ResourceAddress address, Set<String> attributes,
              Metadata metadata) {
          List<Operation> operations = new ArrayList<>();
          ResourceDescription description = metadata.getDescription();
  
          // collect all attributes from the 'requires' list of this attribute
          // HashMultimap<String, String> requires = HashMultimap.create();
          TreeSet<String> requires = new TreeSet<>();
          ModelNode attributesDescription = description.get(ATTRIBUTES);
          attributes.forEach(attribute -> {
              ModelNode attributeDescription = attributesDescription.get(attribute);
              if (attributeDescription != null && attributeDescription.hasDefined(REQUIRES)) {
                  failSafeList(attributeDescription, REQUIRES).forEach(node -> requires.add(node.asString()));
                          /*.map(ModelNode::asString)
                          .forEach(requiresName -> {
                              requires.add(requiresName);
                          });*/
              }
          });
  
          attributes.stream()
                  .map(attribute -> description.findAttribute(ATTRIBUTES, attribute))
                  .filter(Objects::nonNull)
                  .forEach(property -> {
                      ModelNode attributeDescription = property.getValue();
                      boolean nillable = attributeDescription.hasDefined(NILLABLE) &&
                              attributeDescription.get(NILLABLE).asBoolean();
                      boolean readOnly = attributeDescription.hasDefined(ACCESS_TYPE) &&
                              READ_ONLY.equals(attributeDescription.get(ACCESS_TYPE).asString());
                      boolean alternatives = attributeDescription.hasDefined(ALTERNATIVES) &&
                              !attributeDescription.get(ALTERNATIVES).asList().isEmpty();
                      boolean requiredBy = requires.contains(property.getName());
  
                      if (nillable && !readOnly && !alternatives && !requiredBy) {
                          boolean hasDefault = attributeDescription.hasDefined(DEFAULT);
                          ModelType type = attributeDescription.get(TYPE).asType();
                          switch (type) {
                              case BIG_DECIMAL:
                              case BIG_INTEGER:
                              case BOOLEAN:
                              case BYTES:
                              case DOUBLE:
                              case INT:
                              case LONG:
                                  if (hasDefault) {
                                      operations.add(undefineAttribute(address, attributeName(property.getName())));
                                  }
                                  break;
                              case EXPRESSION:
                              case LIST:
                              case OBJECT:
                              case PROPERTY:
                              case STRING:
                                  operations.add(undefineAttribute(address, attributeName(property.getName())));
                                  break;
                              case TYPE:
                              case UNDEFINED:
                                  break;
                              default:
                                  break;
                          }
                      }
                  });
          return new Composite(operations);
      }
focal_method.class_method_signature: OperationFactory.resetResource(ResourceAddress address, Set<String> attributes,
              Metadata metadata)
focal_method.full_signature:  Composite resetResource(ResourceAddress address, Set<String> attributes,
              Metadata metadata)
focal_method.identifier: resetResource
focal_method.invocations: getDescription get forEach get hasDefined forEach failSafeList add asString forEach filter map stream findAttribute getValue hasDefined asBoolean get hasDefined equals asString get hasDefined isEmpty asList get contains getName hasDefined asType get add undefineAttribute attributeName getName add undefineAttribute attributeName getName
focal_method.parameters: (ResourceAddress address, Set<String> attributes,
              Metadata metadata)
focal_method.return: Composite
focal_method.signature: Composite resetResource(ResourceAddress address, Set<String> attributes,
              Metadata metadata)