Write and read attributes in a single request

@param values  the values to write
@param clIdent the client ID
@return the read results
12889
@Override
    public AttributeValue_4[] write_read_attributes_4(final AttributeValue_4[] values, final ClntIdent clIdent)
            throws MultiDevFailed, DevFailed {
        MDC.setContextMap(contextMap);
        xlogger.entry();
        checkInitialization();

        final String[] names = new String[values.length];
        for (int i = 0; i < names.length; i++) {
            names[i] = values[i].name;
        }
        deviceMonitoring.startRequest("write_read_attributes_4 " + Arrays.toString(names), clIdent);
        clientIdentity.set(clIdent);
        AttributeValue_4[] val = null;
        if (!name.equalsIgnoreCase(getAdminDeviceName())) {
            clientLocking.checkClientLocking(clIdent, names);
        }
        final Object lock = deviceLock.getAttributeLock();
        try {
            synchronized (lock != null ? lock : new Object()) {
                val = writeRead(values);
            }
        } catch (final Exception e) {
            deviceMonitoring.addError();
            if (e instanceof DevFailed) {
                throw (DevFailed) e;
            } else {
                // with CORBA, the stack trace is not visible by the client if
                // not inserted in DevFailed.
                throw DevFailedUtils.newDevFailed(e);
            }
        }
        xlogger.exit();
        return val;
    }
1206912
public ProcessorGraphForkJoinTask createTask(@Nonnull final Values values) {
        StringBuilder missingAttributes = new StringBuilder();
        final Multimap<String, Processor> requiredAttributes = getAllRequiredAttributes();
        for (String attribute: requiredAttributes.keySet()) {
            if (!values.containsKey(attribute)) {
                missingAttributes.append("\n\t* ").append(attribute).append(" <- ")
                        .append(requiredAttributes.get(attribute));
            }
        }

        if (missingAttributes.length() > 0) {
            throw new IllegalArgumentException("It has been found that one or more required attributes are " +
                                                       "missing from the values object:" + missingAttributes +
                                                       "\n");
        }

        return new ProcessorGraphForkJoinTask(values);
    }
1202228
@SafeVarargs
    public static <T> LinkedList<T> getLinkedList(T... values) {
        return new LinkedList<T>() {{addAll(Arrays.asList(values));}};
    }
514149
@Override
    public void setAttribute(String name, List<String> values) {
        for (LocalAccountPersonAttributeImpl attribute : attributes) {
            if (name.equals(attribute.getName())) {
                attribute.setValues(values);
                return;
            }
        }

        attributes.add(new LocalAccountPersonAttributeImpl(name, values));
    }
1148386
public CQLSSTableWriter rawAddRow(ByteBuffer... values)
    throws InvalidRequestException, IOException
    {
        return rawAddRow(Arrays.asList(values));
    }
324104
public static String[] encodeString(String[] values) {
    if (values == null) {
      return null;
    }
    String[] encodedValues = new String[values.length];
    for (int i = 0; i < values.length; i++) {
      encodedValues[i] = encodeString(values[i]);
    }
    return encodedValues;
  }
684473
public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy) throws PersistenceBrokerException
    {
        return getKeyValues(cld, objectOrProxy, true);
    }
1062339
public Client createWithValues(Object... varValues) {
        serviceFactory.setBus(getBus());
        checkResources(false);
        ClassResourceInfo cri = null;
        try {
            Endpoint ep = createEndpoint();
            if (getServiceClass() != null) {
                for (ClassResourceInfo info : serviceFactory.getClassResourceInfo()) {
                    if (info.getServiceClass().isAssignableFrom(getServiceClass())
                        || getServiceClass().isAssignableFrom(info.getServiceClass())) {
                        cri = info;
                        break;
                    }
                }
                if (cri == null) {
                    // can not happen in the reality
                    throw new RuntimeException("Service class " + getServiceClass().getName()
                                               + " is not recognized");
                }
            } else {
                cri = serviceFactory.getClassResourceInfo().get(0);
            }

            boolean isRoot = cri.getURITemplate() != null;
            ClientProxyImpl proxyImpl = null;
            ClientState actualState = getActualState();
            proxyImpl = createClientProxy(cri, isRoot, actualState, varValues);
            initClient(proxyImpl, ep, actualState == null);

            final Class<?> serviceClass = cri.getServiceClass();
            ClassLoader theLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {

                @Override
                public ClassLoader run() {
                    return proxyLoader == null ? serviceClass.getClassLoader() : proxyLoader;
                }
            });
            Class<?>[] ifaces = new Class[]{Client.class, InvocationHandlerAware.class, cri.getServiceClass()};
            Client actualClient = (Client)ProxyHelper.getProxy(theLoader, ifaces, proxyImpl);
            proxyImpl.setProxyClient(actualClient);
            notifyLifecycleManager(actualClient);
            this.getServiceFactory().sendEvent(FactoryBeanListener.Event.CLIENT_CREATED, actualClient, ep);
            return actualClient;
        } catch (IllegalArgumentException ex) {
            String message = ex.getLocalizedMessage();
            if (cri != null) {
                String expected = cri.getServiceClass().getSimpleName();
                if ((expected + " is not an interface").equals(message)) {
                    message += "; make sure CGLIB is on the classpath";
                }
            }
            LOG.severe(ex.getClass().getName() + " : " + message);
            throw ex;
        } catch (Exception ex) {
            LOG.severe(ex.getClass().getName() + " : " + ex.getLocalizedMessage());
            throw new RuntimeException(ex);
        }

    }
1033468
public void print(String[][] values) throws IOException {
    if (values == null || values.length == 0) {
      csvPrinter.println();
    } else {
      for (String[] value : values) {
        csvPrinter.printRecords((Object) value);
      }
    }
    csvPrinter.flush();
  }
492800
public JSONNavi<T> add(Object... values) {
		array();
		if (failure)
			return this;
		List<Object> list = a(current);
		for (Object o : values)
			list.add(o);
		return this;
	}
1006418
public WebFragmentDescriptor description(String ... values)
   {
      if (values != null)
      {
         for(String name: values)
         {
            model.createChild("description").text(name);
         }
      }
      return this;
   }
713953
@Override
    public List<Object> getAttributeValues(final String name) {
        final List<Object> values = this.attributes.get(name);
        if (values == null) {
            return null;
        }

        return values;
    }
157434
public ImmutableList<Optional<SimpleArticle>> readDataOpt(String... names) {
    return readDataOpt(ImmutableList.copyOf(names));
  }
1040298
public void setHeaderValues(String name,String[] values)
    {
        _fields.put(name,Arrays.asList(values));
    }
1183618
public DeviceAttribute[] read_attribute(final DeviceProxy deviceProxy, final String[] attributeNames)
	    throws DevFailed {
	DeviceAttribute[] attr;

	build_connection(deviceProxy);

	// Read attributes on device server
	AttributeValue[] attributeValues = new AttributeValue[0];
	AttributeValue_3[] attributeValues_3 = new AttributeValue_3[0];
	AttributeValue_4[] attributeValues_4 = new AttributeValue_4[0];
	AttributeValue_5[] attributeValues_5 = new AttributeValue_5[0];
	if (deviceProxy.url.protocol == TANGO) {
	    // try 2 times for reconnection if requested
	    boolean done = false;
	    final int retries = deviceProxy.transparent_reconnection ? 2 : 1;
	    for (int i = 0; i < retries && !done; i++) {
            try {
                if (deviceProxy.device_5 != null) {
                    attributeValues_5 = deviceProxy.device_5.read_attributes_5(
                            attributeNames, deviceProxy.dev_src,
                            DevLockManager.getInstance().getClntIdent());
                }
                else if (deviceProxy.device_4 != null) {
                    attributeValues_4 = deviceProxy.device_4.read_attributes_4(
                            attributeNames, deviceProxy.dev_src,
                            DevLockManager.getInstance().getClntIdent());
                }
                else if (deviceProxy.device_3 != null) {
                    attributeValues_3 = deviceProxy.device_3.read_attributes_3(
                            attributeNames, deviceProxy.dev_src);
                }
                else if (deviceProxy.device_2 != null) {
                    attributeValues = deviceProxy.device_2.read_attributes_2(
                            attributeNames, deviceProxy.dev_src);
                }
                else {
                    attributeValues = deviceProxy.device.read_attributes(attributeNames);
                }
                done = true;
            } catch (final DevFailed e) {
                // Except.print_exception(e);
                final StringBuilder sb = new StringBuilder(attributeNames[0]);
                for (int j = 1; j < attributeNames.length; j++) {
                    sb.append(", ").append(attributeNames[j]);
                }
                Except.throw_connection_failed(e, "TangoApi_CANNOT_READ_ATTRIBUTE",
                    "Cannot read attribute(s):   " + sb.toString(),
                        deviceProxy.getFull_class_name() + ".read_attribute()");
            } catch (final Exception e) {
                manageExceptionReconnection(deviceProxy,
                        retries, i, e, this.getClass() + ".read_attribute");
            }
	    }
	    // Build a Device Attribute Object
	    // Depends on Device_impl version
	    if (deviceProxy.device_5 != null) {
            attr = new DeviceAttribute[attributeValues_5.length];
            for (int i = 0; i < attributeValues_5.length; i++) {
                attr[i] = new DeviceAttribute(attributeValues_5[i]);
            }
	    } else if (deviceProxy.device_4 != null) {
            attr = new DeviceAttribute[attributeValues_4.length];
            for (int i = 0; i < attributeValues_4.length; i++) {
                attr[i] = new DeviceAttribute(attributeValues_4[i]);
            }
	    } else if (deviceProxy.device_3 != null) {
            attr = new DeviceAttribute[attributeValues_3.length];
            for (int i = 0; i < attributeValues_3.length; i++) {
                attr[i] = new DeviceAttribute(attributeValues_3[i]);
            }
	    } else {
            attr = new DeviceAttribute[attributeValues.length];
            for (int i = 0; i < attributeValues.length; i++) {
                attr[i] = new DeviceAttribute(attributeValues[i]);
            }
	    }
	} else {
	    attr = deviceProxy.taco_device.read_attribute(attributeNames);
	}
	return attr;
    }
610366
public static CmsEntityAttribute createSimpleAttribute(String name, List<String> values) {

        CmsEntityAttribute result = new CmsEntityAttribute();
        result.m_name = name;
        result.m_simpleValues = Collections.unmodifiableList(values);
        return result;
    }
476855
public VarDefBuilder values( VarValueDef... values)
    {
    for( VarValueDef value : values)
      {
      varDef_.addValue( value);
      }
    return this;
    }