text
stringlengths
7
1.01M
package com.sangupta.reread.utils; import java.io.StringReader; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Set; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.sangupta.jerry.util.AssertUtils; import com.sangupta.jerry.util.DateUtils; import com.sangupta.jerry.util.HashUtils; import com.sangupta.jerry.util.UriUtils; import com.sangupta.reread.entity.ParsedFeed; import com.sangupta.reread.entity.Post; import com.sangupta.reread.entity.PostAuthor; import com.sun.syndication.feed.module.DCModuleImpl; import com.sun.syndication.feed.synd.SyndContentImpl; import com.sun.syndication.feed.synd.SyndEnclosure; import com.sun.syndication.feed.synd.SyndEntry; import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.feed.synd.SyndLink; import com.sun.syndication.feed.synd.SyndPersonImpl; import com.sun.syndication.io.FeedException; import com.sun.syndication.io.SyndFeedInput; /** * Utility class to help parse a feed contents. * * @author sangupta * */ public class FeedParser { /** * My logger */ private static final Logger LOGGER = LoggerFactory.getLogger(FeedParser.class); /** * Valid image types */ private static final Set<String> VALID_IMAGE_TYPES = Set.of("image/png", "image/gif", "image/jpg", "image/jpeg"); /** * Parse a given feed whose contents are provided. Ignore entries older than the latest * post ID provided. * * @param masterFeedID the feedID represented in system * * @param feedContents the feed contents in proper encoding * * @param latestPostID most recent post ID that was crawled, if available * * @return a {@link ParsedFeed} instance consisting of all details */ public static ParsedFeed parse(String masterFeedID, String feedContents, String latestPostID) { try { return parseInternal(masterFeedID, feedContents, latestPostID); } catch (RuntimeException e) { LOGGER.error("Unable to parse contents for feedID: " + masterFeedID, e); return null; } } protected static ParsedFeed parseInternal(String masterFeedID, String feedContents, String latestPostID) { SyndFeed feed = extractSyndFeed(masterFeedID, feedContents); if (feed == null) { LOGGER.error("Feed object is null for contents: {}", feedContents); return null; } if (AssertUtils.isEmpty(feed.getEntries())) { LOGGER.debug("no entry in feed"); return null; } // start parsing the entire thing now final long start = System.currentTimeMillis(); ParsedFeed parsedFeed = getParsedFeed(masterFeedID, feed, latestPostID); final List<Post> entries = parsedFeed.posts; if (AssertUtils.isNotEmpty(entries)) { Collections.sort(entries); } // check and add post title, if not present for (Post post : parsedFeed.posts) { if (AssertUtils.isEmpty(post.title)) { post.title = parsedFeed.feedTitle; } } final long end = System.currentTimeMillis(); LOGGER.debug("Feed {} parsed in {}ms", masterFeedID, (end - start)); return parsedFeed; } @SuppressWarnings("deprecation") protected static SyndFeed extractSyndFeed(String masterFeedID, String feedContents) { if (AssertUtils.isEmpty(feedContents)) { return null; } SyndFeed feed = null; StringReader reader = new StringReader(feedContents); // this makes sure that we can read feeds with BOM int prolog = feedContents.indexOf("<?xml"); if (prolog > 0 && prolog < 3) { try { for (int index = 0; index < prolog; index++) { reader.read(); } } catch (Exception e) { // eat up } } SyndFeedInput input = new SyndFeedInput(); input.setXmlHealerOn(true); try { feed = input.build(reader); } catch (IllegalArgumentException e) { // this may happen if the feed is an RDF feed int index = feedContents.indexOf("rdf:RDF"); if (index == -1) { LOGGER.error("Unable to read feed from feed contents: {}", feedContents, e); return null; } // the feeds is an RDF feed // let's add a line about the missing header // so as to give another shot at parsing // let's inject the namespace of xmlns="http://purl.org/rss/1.0/" StringBuilder builder = new StringBuilder(feedContents); builder.insert(index + 7, " xmlns=\"http://purl.org/rss/1.0/\" "); feedContents = builder.toString(); // now that NS has been injected // try and parse again try { IOUtils.closeQuietly(reader); reader = new StringReader(feedContents); feed = input.build(reader); } catch (IllegalArgumentException e1) { LOGGER.error("Unable to read feed from feed contents: " + feedContents, e1); } catch (FeedException e1) { LOGGER.error("Unable to read feed from feed contents: {} for masterFeedID: {} due to error {}", feedContents, masterFeedID, e1.getMessage()); } } catch (FeedException e) { LOGGER.error("Unable to read feed from feed contents: {} for masterFeedID: {} due to error {}", feedContents, masterFeedID, e.getMessage()); } finally { IOUtils.closeQuietly(reader); } return feed; } @SuppressWarnings("unchecked") protected static ParsedFeed getParsedFeed(final String masterFeedID, final SyndFeed feed, String latestPostID) { final ParsedFeed parsedFeed = new ParsedFeed(); parsedFeed.feedTitle = feed.getTitle(); parsedFeed.siteUrl = feed.getLink(); List<SyndLink> links = feed.getLinks(); parsedFeed.nextUrl = extractLink(links, "next"); List<SyndEntry> entries = feed.getEntries(); final String baseUrl = UriUtils.getBaseUrl(feed.getLink()); Post post = null; long timeDifference = System.currentTimeMillis(); for (SyndEntry entry : entries) { try { post = extractParsedFeedEntry(entry, baseUrl, timeDifference); timeDifference = timeDifference - 10; } catch (Exception e) { LOGGER.error("Unable to extract entry from feed contents", e); } // add to the list of entries if (post != null) { post.masterFeedID = masterFeedID; // compute has for the post post.hash = HashUtils.getMD5Hex(post.content); if(post.uniqueID != null && post.uniqueID.equalsIgnoreCase(latestPostID)) { // we got a unique match break; } if(latestPostID != null && latestPostID.startsWith("hash:") && post.hash.equals(latestPostID.substring(5))) { // we match via hash break; } // post has never been seen before - pick it up parsedFeed.posts.add(post); } } return parsedFeed; } @SuppressWarnings("unchecked") protected static Post extractParsedFeedEntry(SyndEntry entry, final String baseURL, final long timeDifference) { Post post = new Post(); // get the author if (AssertUtils.isNotEmpty(entry.getAuthors())) { SyndPersonImpl personImpl = (SyndPersonImpl) entry.getAuthors().get(0); if (personImpl != null) { post.author = new PostAuthor(); post.author.name = personImpl.getName(); post.author.uri = personImpl.getUri(); } } // extract the content String content = null; if (AssertUtils.isNotEmpty(entry.getContents())) { content = ((SyndContentImpl) entry.getContents().get(0)).getValue(); } else { // wordpress stores content in description too if (entry.getDescription() != null) { content = entry.getDescription().getValue(); } } // check if there is an image specified as an enclosure if (AssertUtils.isNotEmpty(entry.getEnclosures())) { List<SyndEnclosure> encls = entry.getEnclosures(); for (SyndEnclosure encl : encls) { if (isImageType(encl.getType())) { post.enclosureURL = encl.getUrl(); break; } } } // title of the post if (entry.getTitle() != null) { post.title = entry.getTitle().trim(); } else { post.title = entry.getTitle(); } post.baseUrl = baseURL; post.content = content; post.link = entry.getLink(); post.uniqueID = entry.getUri(); // updated date Date updatedDate = entry.getUpdatedDate(); if (updatedDate == null) { // wordpress returns the value in modules // the first module being an implementation of DCModuleImpl if (entry.getModules() != null) { DCModuleImpl module = (DCModuleImpl) entry.getModules().get(0); if (module.getDate() != null) { updatedDate = module.getDate(); } } } // if we still cannot find the date, let's choose the current date // of crawl - atleast we will have something to display if (updatedDate != null) { // check if we are in future // and that too offset by a large amount if (updatedDate.getTime() - System.currentTimeMillis() > DateUtils.FIFTEEN_MINUTES) { updatedDate = null; } } if (updatedDate == null) { // the time difference of roughly 10 millis is added updatedDate = new Date(timeDifference); } post.updated = updatedDate.getTime(); return post; } /** * Is given image type a valid image type. * * @param type * @return */ protected static boolean isImageType(String type) { return VALID_IMAGE_TYPES.contains(type); } protected static String extractLink(List<SyndLink> links, String linkRel) { if (links == null || links.isEmpty()) { return null; } for (SyndLink link : links) { if (linkRel.equalsIgnoreCase(link.getRel())) { return link.getHref(); } } return null; } }
/* * Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com> */ package play.libs.concurrent; import akka.actor.ActorSystem; import scala.concurrent.ExecutionContext; import scala.concurrent.ExecutionContextExecutor; /** * Provides a custom execution context from an Akka dispatcher. * * Subclass this to create your own custom execution context, using * the full path to the Akka dispatcher. * * <pre> * {@code * class MyCustomExecutionContext extends CustomExecutionContext { * // Dependency inject the actorsystem from elsewhere * public MyCustomExecutionContext(ActorSystem actorSystem) { * super(actorSystem, "full.path.to.my-custom-executor"); * } * } * } * </pre> * * Then use your custom execution context where you have blocking * operations that require processing outside of Play's main rendering * thread. * * @see <a href="http://doc.akka.io/docs/akka/2.5/java/dispatchers.html">Dispatchers</a> * @see <a href="https://www.playframework.com/documentation/latest/ThreadPools">Thread Pools</a> */ public abstract class CustomExecutionContext implements ExecutionContextExecutor { private final ExecutionContext executionContext; public CustomExecutionContext(ActorSystem actorSystem, String name) { this.executionContext = actorSystem.dispatchers().lookup(name); } @Override public ExecutionContext prepare() { return executionContext.prepare(); } @Override public void execute(Runnable command) { executionContext.execute(command); } @Override public void reportFailure(Throwable cause) { executionContext.reportFailure(cause); } }
package com.appleframework.jms.kafka; import org.apache.log4j.Logger; import com.appleframework.jms.kafka.consumer.BytesMessageConsumer; public class KafkaMessageConsumer extends BytesMessageConsumer { private static Logger logger = Logger.getLogger(KafkaMessageConsumer.class.getName()); @Override public void processMessage(byte[] message) { try { String object = new String(message); logger.error(object.toString()); } catch (Exception e) { // TODO: handle exception } } }
/* * Copyright (c) 2019 Im2be <https://github.com/Im2be> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package net.runelite.client.plugins.cerberus.domain; import lombok.Getter; import lombok.RequiredArgsConstructor; @Getter @RequiredArgsConstructor public class CerberusAttack { private final int tick; private final Cerberus.Attack attack; }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.math3.optim.nonlinear.scalar.noderiv; import java.util.Comparator; import org.apache.commons.math3.optim.PointValuePair; import org.apache.commons.math3.analysis.MultivariateFunction; /** * This class implements the Nelder-Mead simplex algorithm. * * @since 3.0 */ public class NelderMeadSimplex extends AbstractSimplex { /** Default value for {@link #rho}: {@value}. */ private static final double DEFAULT_RHO = 1; /** Default value for {@link #khi}: {@value}. */ private static final double DEFAULT_KHI = 2; /** Default value for {@link #gamma}: {@value}. */ private static final double DEFAULT_GAMMA = 0.5; /** Default value for {@link #sigma}: {@value}. */ private static final double DEFAULT_SIGMA = 0.5; /** Reflection coefficient. */ private final double rho; /** Expansion coefficient. */ private final double khi; /** Contraction coefficient. */ private final double gamma; /** Shrinkage coefficient. */ private final double sigma; /** * Build a Nelder-Mead simplex with default coefficients. * The default coefficients are 1.0 for rho, 2.0 for khi and 0.5 * for both gamma and sigma. * * @param n Dimension of the simplex. */ public NelderMeadSimplex(final int n) { this(n, 1d); } /** * Build a Nelder-Mead simplex with default coefficients. * The default coefficients are 1.0 for rho, 2.0 for khi and 0.5 * for both gamma and sigma. * * @param n Dimension of the simplex. * @param sideLength Length of the sides of the default (hypercube) * simplex. See {@link AbstractSimplex#AbstractSimplex(int,double)}. */ public NelderMeadSimplex(final int n, double sideLength) { this(n, sideLength, DEFAULT_RHO, DEFAULT_KHI, DEFAULT_GAMMA, DEFAULT_SIGMA); } /** * Build a Nelder-Mead simplex with specified coefficients. * * @param n Dimension of the simplex. See * {@link AbstractSimplex#AbstractSimplex(int,double)}. * @param sideLength Length of the sides of the default (hypercube) * simplex. See {@link AbstractSimplex#AbstractSimplex(int,double)}. * @param rho Reflection coefficient. * @param khi Expansion coefficient. * @param gamma Contraction coefficient. * @param sigma Shrinkage coefficient. */ public NelderMeadSimplex(final int n, double sideLength, final double rho, final double khi, final double gamma, final double sigma) { super(n, sideLength); this.rho = rho; this.khi = khi; this.gamma = gamma; this.sigma = sigma; } /** * Build a Nelder-Mead simplex with specified coefficients. * * @param n Dimension of the simplex. See * {@link AbstractSimplex#AbstractSimplex(int)}. * @param rho Reflection coefficient. * @param khi Expansion coefficient. * @param gamma Contraction coefficient. * @param sigma Shrinkage coefficient. */ public NelderMeadSimplex(final int n, final double rho, final double khi, final double gamma, final double sigma) { this(n, 1d, rho, khi, gamma, sigma); } /** * Build a Nelder-Mead simplex with default coefficients. * The default coefficients are 1.0 for rho, 2.0 for khi and 0.5 * for both gamma and sigma. * * @param steps Steps along the canonical axes representing box edges. * They may be negative but not zero. See */ public NelderMeadSimplex(final double[] steps) { this(steps, DEFAULT_RHO, DEFAULT_KHI, DEFAULT_GAMMA, DEFAULT_SIGMA); } /** * Build a Nelder-Mead simplex with specified coefficients. * * @param steps Steps along the canonical axes representing box edges. * They may be negative but not zero. See * {@link AbstractSimplex#AbstractSimplex(double[])}. * @param rho Reflection coefficient. * @param khi Expansion coefficient. * @param gamma Contraction coefficient. * @param sigma Shrinkage coefficient. * @throws IllegalArgumentException if one of the steps is zero. */ public NelderMeadSimplex(final double[] steps, final double rho, final double khi, final double gamma, final double sigma) { super(steps); this.rho = rho; this.khi = khi; this.gamma = gamma; this.sigma = sigma; } /** * Build a Nelder-Mead simplex with default coefficients. * The default coefficients are 1.0 for rho, 2.0 for khi and 0.5 * for both gamma and sigma. * * @param referenceSimplex Reference simplex. See * {@link AbstractSimplex#AbstractSimplex(double[][])}. */ public NelderMeadSimplex(final double[][] referenceSimplex) { this(referenceSimplex, DEFAULT_RHO, DEFAULT_KHI, DEFAULT_GAMMA, DEFAULT_SIGMA); } /** * Build a Nelder-Mead simplex with specified coefficients. * * @param referenceSimplex Reference simplex. See * {@link AbstractSimplex#AbstractSimplex(double[][])}. * @param rho Reflection coefficient. * @param khi Expansion coefficient. * @param gamma Contraction coefficient. * @param sigma Shrinkage coefficient. * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException * if the reference simplex does not contain at least one point. * @throws org.apache.commons.math3.exception.DimensionMismatchException * if there is a dimension mismatch in the reference simplex. */ public NelderMeadSimplex(final double[][] referenceSimplex, final double rho, final double khi, final double gamma, final double sigma) { super(referenceSimplex); this.rho = rho; this.khi = khi; this.gamma = gamma; this.sigma = sigma; } /** {@inheritDoc} */ @Override public void iterate(final MultivariateFunction evaluationFunction, final Comparator<PointValuePair> comparator) { // The simplex has n + 1 points if dimension is n. final int n = getDimension(); // Interesting values. final PointValuePair best = getPoint(0); final PointValuePair secondBest = getPoint(n - 1); final PointValuePair worst = getPoint(n); final double[] xWorst = worst.getPointRef(); // Compute the centroid of the best vertices (dismissing the worst // point at index n). final double[] centroid = new double[n]; for (int i = 0; i < n; i++) { final double[] x = getPoint(i).getPointRef(); for (int j = 0; j < n; j++) { centroid[j] += x[j]; } } final double scaling = 1.0 / n; for (int j = 0; j < n; j++) { centroid[j] *= scaling; } // compute the reflection point final double[] xR = new double[n]; for (int j = 0; j < n; j++) { xR[j] = centroid[j] + rho * (centroid[j] - xWorst[j]); } final PointValuePair reflected = new PointValuePair(xR, evaluationFunction.value(xR), false); if (comparator.compare(best, reflected) <= 0 && comparator.compare(reflected, secondBest) < 0) { // Accept the reflected point. replaceWorstPoint(reflected, comparator); } else if (comparator.compare(reflected, best) < 0) { // Compute the expansion point. final double[] xE = new double[n]; for (int j = 0; j < n; j++) { xE[j] = centroid[j] + khi * (xR[j] - centroid[j]); } final PointValuePair expanded = new PointValuePair(xE, evaluationFunction.value(xE), false); if (comparator.compare(expanded, reflected) < 0) { // Accept the expansion point. replaceWorstPoint(expanded, comparator); } else { // Accept the reflected point. replaceWorstPoint(reflected, comparator); } } else { if (comparator.compare(reflected, worst) < 0) { // Perform an outside contraction. final double[] xC = new double[n]; for (int j = 0; j < n; j++) { xC[j] = centroid[j] + gamma * (xR[j] - centroid[j]); } final PointValuePair outContracted = new PointValuePair(xC, evaluationFunction.value(xC), false); if (comparator.compare(outContracted, reflected) <= 0) { // Accept the contraction point. replaceWorstPoint(outContracted, comparator); return; } } else { // Perform an inside contraction. final double[] xC = new double[n]; for (int j = 0; j < n; j++) { xC[j] = centroid[j] - gamma * (centroid[j] - xWorst[j]); } final PointValuePair inContracted = new PointValuePair(xC, evaluationFunction.value(xC), false); if (comparator.compare(inContracted, worst) < 0) { // Accept the contraction point. replaceWorstPoint(inContracted, comparator); return; } } // Perform a shrink. final double[] xSmallest = getPoint(0).getPointRef(); for (int i = 1; i <= n; i++) { final double[] x = getPoint(i).getPoint(); for (int j = 0; j < n; j++) { x[j] = xSmallest[j] + sigma * (x[j] - xSmallest[j]); } setPoint(i, new PointValuePair(x, Double.NaN, false)); } evaluate(evaluationFunction, comparator); } } }
package com.rayo.storage.riak; import java.util.Collection; import org.codehaus.jackson.annotate.JsonCreator; import org.codehaus.jackson.annotate.JsonIgnore; import org.codehaus.jackson.annotate.JsonProperty; import com.basho.riak.client.RiakLink; import com.basho.riak.client.convert.RiakKey; import com.basho.riak.client.convert.RiakLinks; import com.rayo.server.storage.model.GatewayMixer; public class RiakMixer { @RiakKey private String name; @JsonProperty private String rayoNode; @RiakLinks private transient Collection<RiakLink> callLinks; public RiakMixer(GatewayMixer call) { this.name = call.getName(); this.rayoNode = call.getNodeJid(); } @JsonCreator public RiakMixer(@JsonProperty("name") String name) { this.name = name; } @JsonIgnore public GatewayMixer getGatewayMixer() { GatewayMixer mixer = new GatewayMixer(name, rayoNode); if (callLinks != null) { for (RiakLink link: callLinks) { mixer.addCall(link.getKey()); } } return mixer; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRayoNode() { return rayoNode; } public void setRayoNode(String rayoNode) { this.rayoNode = rayoNode; } public void addCall(String callId) { callLinks.add(new RiakLink("calls", callId, "calls")); } public void removeCall(String callId) { callLinks.remove(new RiakLink("calls", callId, "calls")); } public Collection<RiakLink> getCallLinks() { return callLinks; } public void setCallLinks(Collection<RiakLink> callLinks) { this.callLinks = callLinks; } }
package com.stylefeng.guns.generator; import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.InjectionConfig; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; import com.baomidou.mybatisplus.generator.config.GlobalConfig; import com.baomidou.mybatisplus.generator.config.PackageConfig; import com.baomidou.mybatisplus.generator.config.StrategyConfig; import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert; import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; import com.baomidou.mybatisplus.generator.config.rules.DbType; import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; import org.junit.Test; import java.util.HashMap; import java.util.Map; /** * 实体生成 * * @author fengshuonan * @date 2017-08-23 12:15 */ public class EntityGenerator { @Test public void entityGenerator() { AutoGenerator mpg = new AutoGenerator(); // 全局配置 GlobalConfig gc = new GlobalConfig(); gc.setOutputDir("C:\\Users\\lwz\\Desktop\\guns\\guns-user\\src\\main\\java");//这里写你自己的java目录 gc.setFileOverride(true);//是否覆盖 gc.setActiveRecord(true); gc.setEnableCache(false);// XML 二级缓存 gc.setBaseResultMap(true);// XML ResultMap gc.setBaseColumnList(false);// XML columList gc.setAuthor("stylefeng"); mpg.setGlobalConfig(gc); // 数据源配置 DataSourceConfig dsc = new DataSourceConfig(); dsc.setDbType(DbType.MYSQL); dsc.setTypeConvert(new MySqlTypeConvert() { // 自定义数据库表字段类型转换【可选】 @Override public DbColumnType processTypeConvert(String fieldType) { return super.processTypeConvert(fieldType); } }); dsc.setDriverName("com.mysql.jdbc.Driver"); dsc.setUsername("root"); dsc.setPassword("123456"); dsc.setUrl("jdbc:mysql://127.0.0.1:3306/guns?characterEncoding=utf8&serverTimezone=UTC"); mpg.setDataSource(dsc); // 策略配置 StrategyConfig strategy = new StrategyConfig(); //strategy.setTablePrefix(new String[]{"_"});// 此处可以修改为您的表前缀 strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略 strategy.setInclude(new String[]{"mooc_user_t"}); mpg.setStrategy(strategy); // 包配置 PackageConfig pc = new PackageConfig(); pc.setParent(null); pc.setEntity("com.stylefeng.guns.rest.persistence.model"); pc.setMapper("com.stylefeng.guns.rest.persistence.dao"); pc.setXml("com.stylefeng.guns.rest.persistence.dao.mapping"); pc.setService("TTT"); //本项目没用,生成之后删掉 pc.setServiceImpl("TTT"); //本项目没用,生成之后删掉 pc.setController("TTT"); //本项目没用,生成之后删掉 mpg.setPackageInfo(pc); // 注入自定义配置,可以在 VM 中使用 cfg.abc 设置的值 InjectionConfig cfg = new InjectionConfig() { @Override public void initMap() { Map<String, Object> map = new HashMap<>(); map.put("abc", this.getConfig().getGlobalConfig().getAuthor() + "-mp"); this.setMap(map); } }; mpg.setCfg(cfg); // 执行生成 mpg.execute(); // 打印注入设置 System.err.println(mpg.getCfg().getMap().get("abc")); } }
/* * Copyright 2012-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.devtools.remote.server; import org.springframework.http.server.ServerHttpRequest; /** * Provides access control for a {@link Dispatcher}. * * @author Phillip Webb * @since 1.3.0 */ public interface AccessManager { /** * {@link AccessManager} that permits all requests. */ public static final AccessManager PERMIT_ALL = new AccessManager() { @Override public boolean isAllowed(ServerHttpRequest request) { return true; } }; /** * Determine if the specific request is allowed to be handled by the * {@link Dispatcher}. * @param request the request to check * @return {@code true} if access is allowed. */ boolean isAllowed(ServerHttpRequest request); }
package org.firstinspires.ftc.teamcode.subsystems; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DcMotorSimple; import com.qualcomm.robotcore.util.Range; public class FlyWheels { DcMotor flyWheelLeft; DcMotor flyWheelRight; public FlyWheels(DcMotor flyWheelLeft, DcMotor flyWheelRight) { this.flyWheelLeft = flyWheelLeft; this.flyWheelRight = flyWheelRight; flyWheelLeft.setDirection(DcMotor.Direction.FORWARD); flyWheelLeft.setDirection(DcMotor.Direction.FORWARD); } public void setPower(double power) { power = Range.clip(power, -1, 1); flyWheelRight.setPower(power); flyWheelLeft.setPower(power); } public void stop() { flyWheelLeft.setPower(0.0); flyWheelRight.setPower(0.0); } }
/* * Copyright 2009-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ibatis.submitted.lazyload_proxyfactory_comparison; public class UserWithGetXxxWithInterface implements Owned<Group> { private Integer id; private String name; private Group owner; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public Group getOwner() { return owner; } @Override public void setOwner(Group owner) { this.owner = owner; } public Object getXxx() { return null; } }
package com.gmail.ianlim224.slotmachine.holder; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; public class SelectionHolder implements InventoryHolder{ @Override public Inventory getInventory() { return null; } }
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ package org.elasticsearch.xpack.rollup; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.core.XPackFeatureSet; import org.elasticsearch.xpack.core.XPackSettings; import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse; import org.elasticsearch.xpack.core.rollup.RollupFeatureSetUsage; import org.junit.Before; import java.io.IOException; import java.util.concurrent.ExecutionException; import static org.hamcrest.core.Is.is; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class RollupInfoTransportActionTests extends ESTestCase { private XPackLicenseState licenseState; @Before public void init() { licenseState = mock(XPackLicenseState.class); } public void testAvailable() { RollupInfoTransportAction featureSet = new RollupInfoTransportAction( mock(TransportService.class), mock(ActionFilters.class), Settings.EMPTY, licenseState); boolean available = randomBoolean(); when(licenseState.isAllowed(XPackLicenseState.Feature.ROLLUP)).thenReturn(available); assertThat(featureSet.available(), is(available)); } public void testEnabledSetting() { boolean enabled = randomBoolean(); Settings.Builder settings = Settings.builder(); settings.put("xpack.rollup.enabled", enabled); RollupInfoTransportAction featureSet = new RollupInfoTransportAction( mock(TransportService.class), mock(ActionFilters.class), settings.build(), licenseState); assertThat(featureSet.enabled(), is(enabled)); assertSettingDeprecationsAndWarnings(new Setting<?>[] { XPackSettings.ROLLUP_ENABLED } ); } public void testEnabledDefault() { RollupInfoTransportAction featureSet = new RollupInfoTransportAction( mock(TransportService.class), mock(ActionFilters.class), Settings.EMPTY, licenseState); assertThat(featureSet.enabled(), is(true)); } public void testUsage() throws ExecutionException, InterruptedException, IOException { var usageAction = new RollupUsageTransportAction(mock(TransportService.class), null, null, mock(ActionFilters.class), null, Settings.EMPTY, licenseState); PlainActionFuture<XPackUsageFeatureResponse> future = new PlainActionFuture<>(); usageAction.masterOperation(null, null, null, future); XPackFeatureSet.Usage rollupUsage = future.get().getUsage(); BytesStreamOutput out = new BytesStreamOutput(); rollupUsage.writeTo(out); XPackFeatureSet.Usage serializedUsage = new RollupFeatureSetUsage(out.bytes().streamInput()); assertThat(rollupUsage.name(), is(serializedUsage.name())); assertThat(rollupUsage.enabled(), is(serializedUsage.enabled())); } }
package com.vladmihalcea.hibernate.type.range; import java.io.Serializable; import java.math.BigDecimal; import java.time.*; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeParseException; import java.time.temporal.ChronoField; import java.util.Objects; import java.util.function.Function; /** * Represents the range/interval with two bounds. Abstraction follows the semantics of the mathematical interval. The * range can be unbounded or open from the left or/and unbounded from the right. The range supports half-open or closed * bounds on both sides. * * <p> * The class has some very simple methods for usability. For example {@link Range#contains(Comparable)} method can tell user whether * this range contains argument or not. The {@link Range#contains(Range)} helps to find out whether this range fully * enclosing argument or not. * <p> * For more details about how to use it, * check out <a href="https://vladmihalcea.com/map-postgresql-range-column-type-jpa-hibernate/">this article</a> * on <a href="https://vladmihalcea.com/">vladmihalcea.com</a>. * * @author Edgar Asatryan * @author Vlad Mihalcea */ public final class Range<T extends Comparable> implements Serializable { public static final int LOWER_INCLUSIVE = 1 << 1; public static final int LOWER_EXCLUSIVE = 1 << 2; public static final int UPPER_INCLUSIVE = 1 << 3; public static final int UPPER_EXCLUSIVE = 1 << 4; public static final int LOWER_INFINITE = (1 << 5) | LOWER_EXCLUSIVE; public static final int UPPER_INFINITE = (1 << 6) | UPPER_EXCLUSIVE; public static final String EMPTY = "empty"; public static final String INFINITY = "infinity"; private static final DateTimeFormatter LOCAL_DATE_TIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss[.SSSSSS]"); private static final DateTimeFormatter ZONE_DATE_TIME = new DateTimeFormatterBuilder() .appendPattern("yyyy-MM-dd HH:mm:ss") .optionalStart() .appendPattern(".") .appendFraction(ChronoField.NANO_OF_SECOND, 1, 6, false) .optionalEnd() .appendPattern("X") .toFormatter(); private final T lower; private final T upper; private final int mask; private final Class<T> clazz; private Range(T lower, T upper, int mask, Class<T> clazz) { this.lower = lower; this.upper = upper; this.mask = mask; this.clazz = clazz; if (isBounded() && lower.compareTo(upper) > 0) { throw new IllegalArgumentException("The lower bound is greater then upper!"); } } /** * Creates the closed range with provided bounds. * <p> * The mathematical equivalent will be: * <pre>{@code * [a, b] = {x | a <= x <= b} * }</pre>. * * @param lower The lower bound, never null. * @param upper The upper bound, never null. * @param <T> The type of bounds. * * @return The closed range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> closed(T lower, T upper) { Objects.requireNonNull(lower); Objects.requireNonNull(upper); return new Range<>(lower, upper, LOWER_INCLUSIVE | UPPER_INCLUSIVE, (Class<T>) lower.getClass()); } /** * Creates the open range with provided bounds. * <p> * The mathematical equivalent will be: * <pre>{@code * (a, b) = {x | a < x < b} * }</pre> * * @param lower The lower bound, never null. * @param upper The upper bound, never null. * @param <T> The type of bounds. * * @return The range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> open(T lower, T upper) { Objects.requireNonNull(lower); Objects.requireNonNull(upper); return new Range<>(lower, upper, LOWER_EXCLUSIVE | UPPER_EXCLUSIVE, (Class<T>) lower.getClass()); } /** * Creates the left-open, right-closed range with provided bounds. * <p> * The mathematical equivalent will be: * <pre>{@code * (a, b] = {x | a < x <= b} * }</pre> * * @param lower The lower bound, never null. * @param upper The upper bound, never null. * @param <T> The type of bounds. * * @return The range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> openClosed(T lower, T upper) { Objects.requireNonNull(lower); Objects.requireNonNull(upper); return new Range<>(lower, upper, LOWER_EXCLUSIVE | UPPER_INCLUSIVE, (Class<T>) lower.getClass()); } /** * Creates the left-closed, right-open range with provided bounds. * <p> * The mathematical equivalent will be: * <pre>{@code * [a, b) = {x | a <= x < b} * }</pre> * * @param lower The lower bound, never null. * @param upper The upper bound, never null. * @param <T> The type of bounds. * * @return The range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> closedOpen(T lower, T upper) { Objects.requireNonNull(lower); Objects.requireNonNull(upper); return new Range<>(lower, upper, LOWER_INCLUSIVE | UPPER_EXCLUSIVE, (Class<T>) lower.getClass()); } /** * Creates the left-bounded, left-open and right-unbounded range with provided lower bound. * <p> * The mathematical equivalent will be: * <pre>{@code * (a, +∞) = {x | x > a} * }</pre> * * @param lower The lower bound, never null. * @param <T> The type of bounds. * * @return The range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> openInfinite(T lower) { Objects.requireNonNull(lower); return new Range<>(lower, null, LOWER_EXCLUSIVE | UPPER_INFINITE, (Class<T>) lower.getClass()); } /** * Creates the left-bounded, left-closed and right-unbounded range with provided lower bound. * <p> * The mathematical equivalent will be: * <pre>{@code * [a, +∞) = {x | x >= a} * }</pre> * * @param lower The lower bound, never null. * @param <T> The type of bounds. * * @return The range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> closedInfinite(T lower) { Objects.requireNonNull(lower); return new Range(lower, null, LOWER_INCLUSIVE | UPPER_INFINITE, lower.getClass()); } /** * Creates the left-unbounded, right-bounded and right-open range with provided upper bound. * <p> * The mathematical equivalent will be: * <pre>{@code * (-∞, b) = {x | x < b} * }</pre> * * @param upper The upper bound, never null. * @param <T> The type of bounds. * * @return The range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> infiniteOpen(T upper) { Objects.requireNonNull(upper); return new Range<>(null, upper, UPPER_EXCLUSIVE | LOWER_INFINITE, (Class<T>) upper.getClass()); } /** * Creates the left-unbounded, right-bounded and right-closed range with provided upper bound. * <p> * The mathematical equivalent will be: * <pre>{@code * (-∞, b] = {x | x =< b} * }</pre> * * @param upper The upper bound, never null. * @param <T> The type of bounds. * * @return The range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> infiniteClosed(T upper) { Objects.requireNonNull(upper); return new Range<>(null, upper, UPPER_INCLUSIVE | LOWER_INFINITE, (Class<T>) upper.getClass()); } /** * Creates the unbounded at both ends range with provided upper bound. * <p> * The mathematical equivalent will be: * <pre>{@code * (-∞, +∞) = ℝ * }</pre> * * @param cls The range class, never null. * @param <T> The type of bounds. * * @return The infinite range. */ @SuppressWarnings("unchecked") public static <T extends Comparable<?>> Range<T> infinite(Class<T> cls) { return new Range<>(null, null, LOWER_INFINITE | UPPER_INFINITE, cls); } @SuppressWarnings("unchecked") public static <T extends Comparable> Range<T> ofString(String str, Function<String, T> converter, Class<T> clazz) { if(str.equals(EMPTY)) { return emptyRange(clazz); } int mask = str.charAt(0) == '[' ? LOWER_INCLUSIVE : LOWER_EXCLUSIVE; mask |= str.charAt(str.length() - 1) == ']' ? UPPER_INCLUSIVE : UPPER_EXCLUSIVE; int delim = str.indexOf(','); if (delim == -1) { throw new IllegalArgumentException("Cannot find comma character"); } String lowerStr = str.substring(1, delim); String upperStr = str.substring(delim + 1, str.length() - 1); if (lowerStr.length() == 0 || lowerStr.endsWith(INFINITY)) { mask |= LOWER_INFINITE; } if (upperStr.length() == 0 || upperStr.endsWith(INFINITY)) { mask |= UPPER_INFINITE; } T lower = null; T upper = null; if ((mask & LOWER_INFINITE) != LOWER_INFINITE) { lower = converter.apply(lowerStr); } if ((mask & UPPER_INFINITE) != UPPER_INFINITE) { upper = converter.apply(upperStr); } return new Range<>(lower, upper, mask, clazz); } /** * Creates the {@code BigDecimal} range from provided string: * <pre>{@code * Range<BigDecimal> closed = Range.bigDecimalRange("[0.1,1.1]"); * Range<BigDecimal> halfOpen = Range.bigDecimalRange("(0.1,1.1]"); * Range<BigDecimal> open = Range.bigDecimalRange("(0.1,1.1)"); * Range<BigDecimal> leftUnbounded = Range.bigDecimalRange("(,1.1)"); * }</pre> * * @param range The range string, for example {@literal "[5.5,7.8]"}. * * @return The range of {@code BigDecimal}s. * * @throws NumberFormatException when one of the bounds are invalid. */ public static Range<BigDecimal> bigDecimalRange(String range) { return ofString(range, BigDecimal::new, BigDecimal.class); } /** * Creates the {@code Integer} range from provided string: * <pre>{@code * Range<Integer> closed = Range.integerRange("[1,5]"); * Range<Integer> halfOpen = Range.integerRange("(-1,1]"); * Range<Integer> open = Range.integerRange("(1,2)"); * Range<Integer> leftUnbounded = Range.integerRange("(,10)"); * Range<Integer> unbounded = Range.integerRange("(,)"); * }</pre> * * @param range The range string, for example {@literal "[5,7]"}. * * @return The range of {@code Integer}s. * * @throws NumberFormatException when one of the bounds are invalid. */ public static Range<Integer> integerRange(String range) { return ofString(range, Integer::parseInt, Integer.class); } /** * Creates the {@code Long} range from provided string: * <pre>{@code * Range<Long> closed = Range.longRange("[1,5]"); * Range<Long> halfOpen = Range.longRange("(-1,1]"); * Range<Long> open = Range.longRange("(1,2)"); * Range<Long> leftUnbounded = Range.longRange("(,10)"); * Range<Long> unbounded = Range.longRange("(,)"); * }</pre> * * @param range The range string, for example {@literal "[5,7]"}. * * @return The range of {@code Long}s. * * @throws NumberFormatException when one of the bounds are invalid. */ public static Range<Long> longRange(String range) { return ofString(range, Long::parseLong, Long.class); } /** * Creates the {@code LocalDateTime} range from provided string: * <pre>{@code * Range<LocalDateTime> closed = Range.localDateTimeRange("[2014-04-28 16:00:49,2015-04-28 16:00:49]"); * Range<LocalDateTime> quoted = Range.localDateTimeRange("[\"2014-04-28 16:00:49\",\"2015-04-28 16:00:49\"]"); * Range<LocalDateTime> iso = Range.localDateTimeRange("[\"2014-04-28T16:00:49.2358\",\"2015-04-28T16:00:49\"]"); * }</pre> * <p> * The valid formats for bounds are: * <ul> * <li>yyyy-MM-dd HH:mm:ss[.SSSSSS]</li> * <li>yyyy-MM-dd'T'HH:mm:ss[.SSSSSS]</li> * </ul> * * @param range The range string, for example {@literal "[2014-04-28 16:00:49,2015-04-28 16:00:49]"}. * * @return The range of {@code LocalDateTime}s. * * @throws DateTimeParseException when one of the bounds are invalid. */ public static Range<LocalDateTime> localDateTimeRange(String range) { return ofString(range, parseLocalDateTime().compose(unquote()), LocalDateTime.class); } /** * Creates the {@code LocalDate} range from provided string: * <pre>{@code * Range<LocalDate> closed = Range.localDateRange("[2014-04-28,2015-04-289]"); * Range<LocalDate> quoted = Range.localDateRange("[\"2014-04-28\",\"2015-04-28\"]"); * Range<LocalDate> iso = Range.localDateRange("[\"2014-04-28\",\"2015-04-28\"]"); * }</pre> * <p> * The valid formats for bounds are: * <ul> * <li>yyyy-MM-dd</li> * <li>yyyy-MM-dd</li> * </ul> * * @param range The range string, for example {@literal "[2014-04-28,2015-04-28]"}. * * @return The range of {@code LocalDate}s. * * @throws DateTimeParseException when one of the bounds are invalid. */ public static Range<LocalDate> localDateRange(String range) { Function<String, LocalDate> parseLocalDate = LocalDate::parse; return ofString(range, parseLocalDate.compose(unquote()), LocalDate.class); } /** * Creates the {@code ZonedDateTime} range from provided string: * <pre>{@code * Range<ZonedDateTime> closed = Range.zonedDateTimeRange("[2007-12-03T10:15:30+01:00\",\"2008-12-03T10:15:30+01:00]"); * Range<ZonedDateTime> quoted = Range.zonedDateTimeRange("[\"2007-12-03T10:15:30+01:00\",\"2008-12-03T10:15:30+01:00\"]"); * Range<ZonedDateTime> iso = Range.zonedDateTimeRange("[2011-12-03T10:15:30+01:00[Europe/Paris], 2012-12-03T10:15:30+01:00[Europe/Paris]]"); * }</pre> * <p> * The valid formats for bounds are: * <ul> * <li>yyyy-MM-dd HH:mm:ss[.SSSSSS]X</li> * <li>yyyy-MM-dd'T'HH:mm:ss[.SSSSSS]X</li> * </ul> * * @param rangeStr The range string, for example {@literal "[2011-12-03T10:15:30+01:00,2012-12-03T10:15:30+01:00]"}. * * @return The range of {@code ZonedDateTime}s. * * @throws DateTimeParseException when one of the bounds are invalid. * @throws IllegalArgumentException when bounds time zones are different. */ public static Range<ZonedDateTime> zonedDateTimeRange(String rangeStr) { Range<ZonedDateTime> range = ofString(rangeStr, parseZonedDateTime().compose(unquote()), ZonedDateTime.class); if (range.hasLowerBound() && range.hasUpperBound()) { ZoneId lowerZone = range.lower().getZone(); ZoneId upperZone = range.upper().getZone(); if (!lowerZone.equals(upperZone)) { Duration lowerDst = ZoneId.systemDefault().getRules().getDaylightSavings(range.lower().toInstant()); Duration upperDst = ZoneId.systemDefault().getRules().getDaylightSavings(range.upper().toInstant()); long dstSeconds = upperDst.minus(lowerDst).getSeconds(); if(dstSeconds < 0 ) { dstSeconds *= -1; } long zoneDriftSeconds = ((ZoneOffset) lowerZone).getTotalSeconds() - ((ZoneOffset) upperZone).getTotalSeconds(); if (zoneDriftSeconds < 0) { zoneDriftSeconds *= -1; } if (dstSeconds != zoneDriftSeconds) { throw new IllegalArgumentException("The upper and lower bounds must be in same time zone!"); } } } return range; } private static Function<String, LocalDateTime> parseLocalDateTime() { return s -> { try { return LocalDateTime.parse(s, LOCAL_DATE_TIME); } catch (DateTimeParseException e) { return LocalDateTime.parse(s); } }; } private static Function<String, ZonedDateTime> parseZonedDateTime() { return s -> { try { return ZonedDateTime.parse(s, ZONE_DATE_TIME); } catch (DateTimeParseException e) { return ZonedDateTime.parse(s); } }; } private static Function<String, String> unquote() { return s -> { if (s.charAt(0) == '\"' && s.charAt(s.length() - 1) == '\"') { return s.substring(1, s.length() - 1); } return s; }; } private boolean isBounded() { return !hasMask(LOWER_INFINITE) && !hasMask(UPPER_INFINITE); } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Range)) return false; Range<?> range = (Range<?>) o; return mask == range.mask && Objects.equals(lower, range.lower) && Objects.equals(upper, range.upper) && Objects.equals(clazz, range.clazz); } @Override public int hashCode() { return Objects.hash(lower, upper, mask, clazz); } @Override public String toString() { return "Range{" + "lower=" + lower + ", upper=" + upper + ", mask=" + mask + ", clazz=" + clazz + '}'; } public boolean hasMask(int flag) { return (mask & flag) == flag; } public boolean isLowerBoundClosed() { return hasLowerBound() && hasMask(LOWER_INCLUSIVE); } public boolean isUpperBoundClosed() { return hasUpperBound() && hasMask(UPPER_INCLUSIVE); } public boolean hasLowerBound() { return !hasMask(LOWER_INFINITE); } public boolean hasUpperBound() { return !hasMask(UPPER_INFINITE); } /** * Returns the lower bound of this range. If {@code null} is returned then this range is left-unbounded. * * @return The lower bound. */ public T lower() { return lower; } /** * Returns the upper bound of this range. If {@code null} is returned then this range is right-unbounded. * * @return The upper bound. */ public T upper() { return upper; } /** * Determines whether this range contains this point or not. * <p> * For example: * <pre>{@code * assertTrue(integerRange("[1,2]").contains(1)) * assertTrue(integerRange("[1,2]").contains(2)) * assertTrue(integerRange("[-1,1]").contains(0)) * assertTrue(infinity(Integer.class).contains(Integer.MAX_VALUE)) * assertTrue(infinity(Integer.class).contains(Integer.MIN_VALUE)) * * assertFalse(integerRange("(1,2]").contains(1)) * assertFalse(integerRange("(1,2]").contains(3)) * assertFalse(integerRange("[-1,1]").contains(0)) * }</pre> * * @param point The point to check. * * @return Whether {@code point} in this range or not. */ @SuppressWarnings("unchecked") public boolean contains(T point) { boolean l = hasLowerBound(); boolean u = hasUpperBound(); if (l && u) { boolean inLower = hasMask(LOWER_INCLUSIVE) ? lower.compareTo(point) <= 0 : lower.compareTo(point) < 0; boolean inUpper = hasMask(UPPER_INCLUSIVE) ? upper.compareTo(point) >= 0 : upper.compareTo(point) > 0; return inLower && inUpper; } else if (l) { return hasMask(LOWER_INCLUSIVE) ? lower.compareTo(point) <= 0 : lower.compareTo(point) < 0; } else if (u) { return hasMask(UPPER_INCLUSIVE) ? upper.compareTo(point) >= 0 : upper.compareTo(point) > 0; } // INFINITY return true; } /** * Determines whether this range contains this point or not. * <p> * For example: * <pre>{@code * assertTrue(integerRange("[-2,2]").contains(integerRange("[-1,1]"))) * assertTrue(integerRange("(,)").contains(integerRange("(,)")) * * assertFalse(integerRange("[-2,2)").contains(integerRange("[-1,2]"))) * assertFalse(integerRange("(-2,2]").contains(1)) * }</pre> * * @param range The range to check. * * @return Whether {@code range} in this range or not. */ public boolean contains(Range<T> range) { return (!range.hasLowerBound() || contains(range.lower)) && (!range.hasUpperBound() || contains(range.upper)); } public String asString() { StringBuilder sb = new StringBuilder(); sb.append(hasMask(LOWER_INCLUSIVE) ? '[' : '(') .append(hasLowerBound() ? boundToString().apply(lower) : "") .append(",") .append(hasUpperBound() ? boundToString().apply(upper) : "") .append(hasMask(UPPER_INCLUSIVE) ? ']' : ')'); return sb.toString(); } private Function<T, String> boundToString() { return t -> { if (clazz.equals(ZonedDateTime.class)) { return ZONE_DATE_TIME.format((ZonedDateTime) t); } return t.toString(); }; } Class<T> getClazz() { return clazz; } public static <R extends Comparable<R>> Range<R> emptyRange(Class<R> clazz) { return new Range<R>( null, null, LOWER_INFINITE|UPPER_INFINITE, clazz ); } }
package com.manage.common.core.core.controller.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.manage.common.core.annotation.Log; import com.manage.common.core.constant.HttpStatus; import com.manage.common.core.core.controller.AbstractController; import com.manage.common.core.core.controller.IController; import com.manage.common.core.core.domain.AjaxResult; import com.manage.common.core.core.page.PageDomain; import com.manage.common.core.core.page.TableDataInfo; import com.manage.common.core.core.page.TableSupport; import com.manage.common.core.core.domain.IEntity; import com.manage.common.core.core.service.IService; import com.manage.common.core.enums.BusinessType; import com.manage.common.core.utils.DateUtils; import com.manage.common.core.utils.Helper; import com.manage.common.core.utils.StringUtils; import com.manage.common.core.utils.poi.ExcelUtil; import com.manage.common.core.utils.sql.SqlUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.util.Assert; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; import java.beans.PropertyEditorSupport; import java.util.Date; import java.util.List; /** * BaseController * * @author zhong.h * @date 2019/11/1 */ public abstract class BaseController<T extends IEntity, K> extends AbstractController implements IController<T, K> { protected abstract IService<T, K> getService(); private Class<T> persistentClass; @Autowired protected Environment env; public Class<?> getPersistentClass() { return this.persistentClass; } public BaseController() { this.persistentClass = (Class<T>) Helper.getSuperClassGenricType(getClass(), 0); Assert.notNull(persistentClass); } /** * 查询列表 */ @PreAuthorize("@ss.hasPermi('com:manage:list')") @GetMapping("/list") public TableDataInfo list(T entity) { startPage(); List<T> list = getService().selectList(entity); return getDataTable(list); } /** * 导出列表 */ @PreAuthorize("@ss.hasPermi('com:manage:export')") @Log(title = "导出数据", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(T entity) { List<T> list = getService().selectList(entity); ExcelUtil<T> util = new ExcelUtil<T>(persistentClass); return util.exportExcel(list, "discount"); } /** * 获取详细信息 */ @PreAuthorize("@ss.hasPermi('com:manage:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(getService().selectById(id)); } /** * 新增 */ @PreAuthorize("@ss.hasPermi('com:manage:add')") @Log(title = "新增数据", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody T entity) { return toAjax(getService().insert(entity)); } /** * 修改折扣 */ @PreAuthorize("@ss.hasPermi('com:manage:edit')") @Log(title = "修改数据", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody T entity) { return toAjax(getService().update(entity)); } /** * 删除 */ @PreAuthorize("@ss.hasPermi('com:manage:remove')") @Log(title = "批量删除", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(getService().deleteByIds(ids)); } }
package com.denizenscript.denizen.nms.v1_15.impl.network.packets; import com.denizenscript.denizen.nms.interfaces.packets.PacketOutSpawnEntity; import com.denizenscript.denizencore.utilities.ReflectionHelper; import net.minecraft.server.v1_15_R1.*; import java.util.UUID; public class PacketOutSpawnEntityImpl implements PacketOutSpawnEntity { private Packet internal; private int entityId; private UUID entityUuid; public PacketOutSpawnEntityImpl(EntityPlayer player, Packet internal) { this.internal = internal; Integer integer = ReflectionHelper.getFieldValue(internal.getClass(), "a", internal); entityId = integer != null ? integer : -1; if (!(internal instanceof PacketPlayOutSpawnEntityExperienceOrb)) { entityUuid = ReflectionHelper.getFieldValue(internal.getClass(), "b", internal); } else { Entity entity = player.world.getEntity(entityId); entityUuid = entity != null ? entity.getUniqueID() : null; } } @Override public int getEntityId() { return entityId; } @Override public UUID getEntityUuid() { return entityUuid; } }
public void enviaEmail(String smtpHost, String from, String to, String assunto, String conteudo, AnexoTO[] arquivos, String assinatura) throws Exception { Properties props = System.getProperties(); props.put("mail.smtp.host", smtpHost); props.put("mail.smtp.port", "25"); props.put("mail.smtp.auth", "false"); props.put("mail.mime.charset", "ISO-8859-1"); Session session = Session.getDefaultInstance(props, null); session.setDebug(true); MimeMessage message = new MimeMessage(session); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z Z"); message.addHeader("date-time", sdf.format(new Date())); message.setContentLanguage(new String[] { "pr_BR" }); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject(assunto, "ISO-8859-1"); Multipart multipart = new MimeMultipart(); BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.addHeader("Content-Type: text/html;", "charset=\"iso-8859-1\""); messageBodyPart.setContent(conteudo, "text/html"); multipart.addBodyPart(messageBodyPart); DataSource source; message.setContent(multipart); Transport.send(message); }
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.elasticloadbalancingv2.model.transform; import java.util.ArrayList; import javax.xml.stream.events.XMLEvent; import javax.annotation.Generated; import com.amazonaws.services.elasticloadbalancingv2.model.*; import com.amazonaws.transform.Unmarshaller; import com.amazonaws.transform.StaxUnmarshallerContext; import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*; /** * AvailabilityZone StAX Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AvailabilityZoneStaxUnmarshaller implements Unmarshaller<AvailabilityZone, StaxUnmarshallerContext> { public AvailabilityZone unmarshall(StaxUnmarshallerContext context) throws Exception { AvailabilityZone availabilityZone = new AvailabilityZone(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return availabilityZone; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("ZoneName", targetDepth)) { availabilityZone.setZoneName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("SubnetId", targetDepth)) { availabilityZone.setSubnetId(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("LoadBalancerAddresses", targetDepth)) { availabilityZone.withLoadBalancerAddresses(new ArrayList<LoadBalancerAddress>()); continue; } if (context.testExpression("LoadBalancerAddresses/member", targetDepth)) { availabilityZone.withLoadBalancerAddresses(LoadBalancerAddressStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return availabilityZone; } } } } private static AvailabilityZoneStaxUnmarshaller instance; public static AvailabilityZoneStaxUnmarshaller getInstance() { if (instance == null) instance = new AvailabilityZoneStaxUnmarshaller(); return instance; } }
package ru.stqa.pft.addressbook.appmanager; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import ru.stqa.pft.addressbook.model.GroupData; import ru.stqa.pft.addressbook.model.Groups; import java.util.ArrayList; import java.util.List; public class GroupHelper extends HelperBase { public GroupHelper(WebDriver wd) { super(wd); } public void returnToGroupPage() { click(By.linkText("group page")); } public void submitGroupCreation() { click(By.name("submit")); } public void fillGroupForm(GroupData groupData) { type(By.name("group_name"), groupData.getName()); type(By.name("group_header"), groupData.getHeader()); type(By.name("group_footer"), groupData.getFooter()); } public void initGroupCreation() { click(By.name("new")); } public void deleteSelectedGroups() { click(By.xpath("(//input[@name='delete'])[2]")); } public void selectGroup(int index) { wd.findElements(By.name("selected[]")).get(index).click(); } public void selectGroupById(int id) { wd.findElement(By.cssSelector("input[value='" + id + "']")).click(); } public void initGroupModification() { click(By.name("edit")); } public void submitGroupModification() { click(By.name("update")); } public void create(GroupData group) { initGroupCreation(); fillGroupForm(group); submitGroupCreation(); groupCash = null; returnToGroupPage(); } public void modify(GroupData group) { selectGroupById(group.getId()); initGroupModification(); fillGroupForm(group); submitGroupModification(); groupCash = null; returnToGroupPage(); } public void delete(int index) { selectGroup(index); deleteSelectedGroups(); returnToGroupPage(); } public void delete(GroupData group) { selectGroupById(group.getId()); deleteSelectedGroups(); groupCash = null; returnToGroupPage(); } public boolean isThereAGroup() { return isElementPresent(By.name("selected[]")); } public int count() { return wd.findElements(By.name("selected[]")).size(); } public List<GroupData> list() { List<GroupData> groups = new ArrayList<GroupData>(); List<WebElement> elements = wd.findElements(By.cssSelector("span.group")); for (WebElement element : elements) { String name = element.getText(); int id = Integer.parseInt(element.findElement(By.tagName("input")).getAttribute("value")); groups.add(new GroupData().withId(id).withName(name)); } return groups; } private Groups groupCash = null; public Groups all() { if(groupCash != null) { return new Groups(groupCash); } groupCash = new Groups(); List<WebElement> elements = wd.findElements(By.cssSelector("span.group")); for (WebElement element : elements) { String name = element.getText(); int id = Integer.parseInt(element.findElement(By.tagName("input")).getAttribute("value")); groupCash.add(new GroupData().withId(id).withName(name)); } return new Groups(groupCash); } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.cobi.kgg.business.simu; import java.util.ArrayList; import java.util.List; import org.openide.util.Exceptions; import org.rosuda.REngine.REXPMismatchException; import org.rosuda.REngine.REngineException; import org.rosuda.REngine.Rserve.RConnection; import org.rosuda.REngine.Rserve.RserveException; /** * * @author JiangLi */ public class SKAT { RConnection rcon; int intParallel; public SKAT() throws RserveException { this.rcon = new RConnection(); this.rcon.eval("pack=\"SKAT\"; if (!require(pack,character.only = TRUE)) { install.packages(pack,dep=TRUE,repos='http://cran.us.r-project.org');if(!require(pack,character.only = TRUE)) stop(\"Package not found\")}"); this.rcon.eval("pack=\"snow\"; if (!require(pack,character.only = TRUE)) { install.packages(pack,dep=TRUE,repos='http://cran.us.r-project.org');if(!require(pack,character.only = TRUE)) stop(\"Package not found\")}"); this.rcon.eval("library(SKAT)"); this.rcon.eval("library(snow)"); } public double getPValue(int[][] Z, int[] y) throws REngineException, REXPMismatchException, InterruptedException { int[] intDim = new int[2]; intDim[0] = Z.length; intDim[1] = Z[0].length; int[] intVector = new int[intDim[0] * intDim[1]]; for (int i = 0; i < intDim[0]; i++) { for (int j = 0; j < intDim[1]; j++) { intVector[i * intDim[1] + j] = Z[i][j]; } } rcon.assign("numVector", intVector); //rcon.assign("numDim", intDim); rcon.eval("Z<-matrix(numVector,nrow=" + intDim[0] + ",ncol=" + intDim[1] + ",byrow=T)"); rcon.assign("y", y); rcon.eval("obj<-SKAT_Null_Model(y ~ 1, out_type=\"D\")"); double p = rcon.eval("SKAT(Z, obj, kernel = \"linear.weighted\")$p.value").asDouble();//This step will cost a lot of time. return p; } public int[] getPhenotype(int intCase, int intControl) { int[] intPhenotype = new int[intCase + intControl]; for (int i = 0; i < intCase; i++) { intPhenotype[i] = 1; } for (int i = 0; i < intControl; i++) { intPhenotype[intCase + i] = 0; } return intPhenotype; } public int[][] getGenotype(List<Individual> lstIndividual) { int row = lstIndividual.size(); int col = lstIndividual.get(0).markerGtySet.paternalChrom.size(); int[][] Z = new int[row][col]; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { Individual item = lstIndividual.get(i); int intM = item.markerGtySet.maternalChrom.getQuick(j) ? 1 : 0; int intF = item.markerGtySet.paternalChrom.getQuick(j) ? 1 : 0; Z[i][j] = intM + intF; } } return Z; } ArrayList<Double> getPValueParallel(ArrayList<ArrayList<int[][]>> altSKATs, int intParallel,int intStudy) throws REngineException, REXPMismatchException { if(intParallel!=this.intParallel & intParallel==1){ this.closeRServe(); this.startRServe(intParallel); } if(intParallel!=this.intParallel){ this.closeRServe(); this.startRServe(intParallel); } ArrayList<Double> altResult=new ArrayList(); for(int j=0;j<intStudy;j++){ ArrayList<int[][]> altZ=new ArrayList(); for(int i=0;i<intParallel;i++) altZ.add(altSKATs.get(i).get(j)); double[] dblResult=this.getPValue(altZ);//Time-consuming part. for(int i=0;i<intParallel;i++) altResult.add(dblResult[i]); } return altResult; } double[] getPValue(ArrayList<int[][]> altZ) throws REngineException, REXPMismatchException { double[] dblResult=null; try { rcon.voidEval("lstZ<-list()"); for(int k=0;k<altZ.size();k++){ int[][] Z=altZ.get(k); int[] intDim = new int[2]; intDim[0] = Z.length; intDim[1] = Z[0].length; int[] intVector = new int[intDim[0] * intDim[1]]; for (int i = 0; i < intDim[0]; i++) for (int j = 0; j < intDim[1]; j++) intVector[i * intDim[1] + j] = Z[i][j]; rcon.assign("numVector", intVector); rcon.voidEval("lstZ[["+(k+1)+"]]<-matrix(numVector,nrow=" + intDim[0] + ",ncol=" + intDim[1] + ",byrow=T)"); } rcon.voidEval("lstResult<-parLapply(cl,lstZ,SKAT,obj)"); //rcon.assign(".temp", "lstResult<-parLapply(cl,lstZ,SKAT,obj)"); //REXP r=rcon.parseAndEval("try(eval(parse(text=.temp)),silent=T)"); //if (r.inherits("try-error")) System.err.println("Error: "+r.toString()); dblResult=rcon.eval("sapply(lstResult,fun<-function(x){x$p.value})").asDoubles(); } catch (RserveException ex) { ex.printStackTrace(); } return dblResult; } public void setPhenotype(int intCase, int intControl) { try { int[] intPhenotype=this.getPhenotype(intCase, intControl); rcon.assign("y", intPhenotype); rcon.voidEval("obj<-SKAT_Null_Model(y ~ 1, out_type=\"D\")"); } catch (REngineException ex) { Exceptions.printStackTrace(ex); } } public void closeRServe(){ try { this.intParallel=0; rcon.voidEval("stopCluster(cl)"); } catch (RserveException ex) { Exceptions.printStackTrace(ex); } } public void startRServe(int intParallel){ try { this.intParallel=intParallel; rcon.voidEval("cl<-makeCluster("+intParallel+")"); } catch (RserveException ex) { Exceptions.printStackTrace(ex); } } }
/* * * Copyright (c) 2021 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // THIS FILE IS GENERATED BY ZAP package chip.devicecontroller; import chip.clusterinfo.CommandParameterInfo; import chip.clusterinfo.InteractionInfo; import chip.devicecontroller.ChipClusters.DefaultClusterCallback; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; public class ClusterWriteMapping { public Map<String, Map<String, InteractionInfo>> getWriteAttributeMap() { Map<String, Map<String, InteractionInfo>> writeAttributeMap = new HashMap<>(); Map<String, InteractionInfo> writeAccessControlInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("accessControl", writeAccessControlInteractionInfo); Map<String, InteractionInfo> writeAccountLoginInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("accountLogin", writeAccountLoginInteractionInfo); Map<String, InteractionInfo> writeAdministratorCommissioningInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put( "administratorCommissioning", writeAdministratorCommissioningInteractionInfo); Map<String, InteractionInfo> writeApplicationBasicInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("applicationBasic", writeApplicationBasicInteractionInfo); Map<String, InteractionInfo> writeApplicationLauncherInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("applicationLauncher", writeApplicationLauncherInteractionInfo); Map<String, InteractionInfo> writeAudioOutputInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("audioOutput", writeAudioOutputInteractionInfo); Map<String, InteractionInfo> writeBarrierControlInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("barrierControl", writeBarrierControlInteractionInfo); Map<String, InteractionInfo> writeBasicInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeBasicNodeLabelCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo basicnodeLabelCommandParameterInfo = new CommandParameterInfo("value", String.class); writeBasicNodeLabelCommandParams.put("value", basicnodeLabelCommandParameterInfo); InteractionInfo writeBasicNodeLabelAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.BasicCluster) cluster) .writeNodeLabelAttribute( (DefaultClusterCallback) callback, (String) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeBasicNodeLabelCommandParams); writeBasicInteractionInfo.put( "writeNodeLabelAttribute", writeBasicNodeLabelAttributeInteractionInfo); Map<String, CommandParameterInfo> writeBasicLocationCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo basiclocationCommandParameterInfo = new CommandParameterInfo("value", String.class); writeBasicLocationCommandParams.put("value", basiclocationCommandParameterInfo); InteractionInfo writeBasicLocationAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.BasicCluster) cluster) .writeLocationAttribute( (DefaultClusterCallback) callback, (String) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeBasicLocationCommandParams); writeBasicInteractionInfo.put( "writeLocationAttribute", writeBasicLocationAttributeInteractionInfo); Map<String, CommandParameterInfo> writeBasicLocalConfigDisabledCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo basiclocalConfigDisabledCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeBasicLocalConfigDisabledCommandParams.put( "value", basiclocalConfigDisabledCommandParameterInfo); InteractionInfo writeBasicLocalConfigDisabledAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.BasicCluster) cluster) .writeLocalConfigDisabledAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeBasicLocalConfigDisabledCommandParams); writeBasicInteractionInfo.put( "writeLocalConfigDisabledAttribute", writeBasicLocalConfigDisabledAttributeInteractionInfo); writeAttributeMap.put("basic", writeBasicInteractionInfo); Map<String, InteractionInfo> writeBinaryInputBasicInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeBinaryInputBasicOutOfServiceCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo binaryInputBasicoutOfServiceCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeBinaryInputBasicOutOfServiceCommandParams.put( "value", binaryInputBasicoutOfServiceCommandParameterInfo); InteractionInfo writeBinaryInputBasicOutOfServiceAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.BinaryInputBasicCluster) cluster) .writeOutOfServiceAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeBinaryInputBasicOutOfServiceCommandParams); writeBinaryInputBasicInteractionInfo.put( "writeOutOfServiceAttribute", writeBinaryInputBasicOutOfServiceAttributeInteractionInfo); Map<String, CommandParameterInfo> writeBinaryInputBasicPresentValueCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo binaryInputBasicpresentValueCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeBinaryInputBasicPresentValueCommandParams.put( "value", binaryInputBasicpresentValueCommandParameterInfo); InteractionInfo writeBinaryInputBasicPresentValueAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.BinaryInputBasicCluster) cluster) .writePresentValueAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeBinaryInputBasicPresentValueCommandParams); writeBinaryInputBasicInteractionInfo.put( "writePresentValueAttribute", writeBinaryInputBasicPresentValueAttributeInteractionInfo); writeAttributeMap.put("binaryInputBasic", writeBinaryInputBasicInteractionInfo); Map<String, InteractionInfo> writeBindingInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("binding", writeBindingInteractionInfo); Map<String, InteractionInfo> writeBooleanStateInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("booleanState", writeBooleanStateInteractionInfo); Map<String, InteractionInfo> writeBridgedActionsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("bridgedActions", writeBridgedActionsInteractionInfo); Map<String, InteractionInfo> writeBridgedDeviceBasicInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("bridgedDeviceBasic", writeBridgedDeviceBasicInteractionInfo); Map<String, InteractionInfo> writeColorControlInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeColorControlColorControlOptionsCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorControlOptionsCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorControlOptionsCommandParams.put( "value", colorControlcolorControlOptionsCommandParameterInfo); InteractionInfo writeColorControlColorControlOptionsAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorControlOptionsAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorControlOptionsCommandParams); writeColorControlInteractionInfo.put( "writeColorControlOptionsAttribute", writeColorControlColorControlOptionsAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlWhitePointXCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlwhitePointXCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlWhitePointXCommandParams.put( "value", colorControlwhitePointXCommandParameterInfo); InteractionInfo writeColorControlWhitePointXAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeWhitePointXAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlWhitePointXCommandParams); writeColorControlInteractionInfo.put( "writeWhitePointXAttribute", writeColorControlWhitePointXAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlWhitePointYCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlwhitePointYCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlWhitePointYCommandParams.put( "value", colorControlwhitePointYCommandParameterInfo); InteractionInfo writeColorControlWhitePointYAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeWhitePointYAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlWhitePointYCommandParams); writeColorControlInteractionInfo.put( "writeWhitePointYAttribute", writeColorControlWhitePointYAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointRXCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointRXCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointRXCommandParams.put( "value", colorControlcolorPointRXCommandParameterInfo); InteractionInfo writeColorControlColorPointRXAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointRXAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointRXCommandParams); writeColorControlInteractionInfo.put( "writeColorPointRXAttribute", writeColorControlColorPointRXAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointRYCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointRYCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointRYCommandParams.put( "value", colorControlcolorPointRYCommandParameterInfo); InteractionInfo writeColorControlColorPointRYAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointRYAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointRYCommandParams); writeColorControlInteractionInfo.put( "writeColorPointRYAttribute", writeColorControlColorPointRYAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointRIntensityCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointRIntensityCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointRIntensityCommandParams.put( "value", colorControlcolorPointRIntensityCommandParameterInfo); InteractionInfo writeColorControlColorPointRIntensityAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointRIntensityAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointRIntensityCommandParams); writeColorControlInteractionInfo.put( "writeColorPointRIntensityAttribute", writeColorControlColorPointRIntensityAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointGXCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointGXCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointGXCommandParams.put( "value", colorControlcolorPointGXCommandParameterInfo); InteractionInfo writeColorControlColorPointGXAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointGXAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointGXCommandParams); writeColorControlInteractionInfo.put( "writeColorPointGXAttribute", writeColorControlColorPointGXAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointGYCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointGYCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointGYCommandParams.put( "value", colorControlcolorPointGYCommandParameterInfo); InteractionInfo writeColorControlColorPointGYAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointGYAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointGYCommandParams); writeColorControlInteractionInfo.put( "writeColorPointGYAttribute", writeColorControlColorPointGYAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointGIntensityCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointGIntensityCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointGIntensityCommandParams.put( "value", colorControlcolorPointGIntensityCommandParameterInfo); InteractionInfo writeColorControlColorPointGIntensityAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointGIntensityAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointGIntensityCommandParams); writeColorControlInteractionInfo.put( "writeColorPointGIntensityAttribute", writeColorControlColorPointGIntensityAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointBXCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointBXCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointBXCommandParams.put( "value", colorControlcolorPointBXCommandParameterInfo); InteractionInfo writeColorControlColorPointBXAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointBXAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointBXCommandParams); writeColorControlInteractionInfo.put( "writeColorPointBXAttribute", writeColorControlColorPointBXAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointBYCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointBYCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointBYCommandParams.put( "value", colorControlcolorPointBYCommandParameterInfo); InteractionInfo writeColorControlColorPointBYAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointBYAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointBYCommandParams); writeColorControlInteractionInfo.put( "writeColorPointBYAttribute", writeColorControlColorPointBYAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlColorPointBIntensityCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlcolorPointBIntensityCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlColorPointBIntensityCommandParams.put( "value", colorControlcolorPointBIntensityCommandParameterInfo); InteractionInfo writeColorControlColorPointBIntensityAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeColorPointBIntensityAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlColorPointBIntensityCommandParams); writeColorControlInteractionInfo.put( "writeColorPointBIntensityAttribute", writeColorControlColorPointBIntensityAttributeInteractionInfo); Map<String, CommandParameterInfo> writeColorControlStartUpColorTemperatureMiredsCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo colorControlstartUpColorTemperatureMiredsCommandParameterInfo = new CommandParameterInfo("value", int.class); writeColorControlStartUpColorTemperatureMiredsCommandParams.put( "value", colorControlstartUpColorTemperatureMiredsCommandParameterInfo); InteractionInfo writeColorControlStartUpColorTemperatureMiredsAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ColorControlCluster) cluster) .writeStartUpColorTemperatureMiredsAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeColorControlStartUpColorTemperatureMiredsCommandParams); writeColorControlInteractionInfo.put( "writeStartUpColorTemperatureMiredsAttribute", writeColorControlStartUpColorTemperatureMiredsAttributeInteractionInfo); writeAttributeMap.put("colorControl", writeColorControlInteractionInfo); Map<String, InteractionInfo> writeContentLauncherInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("contentLauncher", writeContentLauncherInteractionInfo); Map<String, InteractionInfo> writeDescriptorInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("descriptor", writeDescriptorInteractionInfo); Map<String, InteractionInfo> writeDiagnosticLogsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("diagnosticLogs", writeDiagnosticLogsInteractionInfo); Map<String, InteractionInfo> writeDoorLockInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeDoorLockLanguageCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo doorLocklanguageCommandParameterInfo = new CommandParameterInfo("value", String.class); writeDoorLockLanguageCommandParams.put("value", doorLocklanguageCommandParameterInfo); InteractionInfo writeDoorLockLanguageAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .writeLanguageAttribute( (DefaultClusterCallback) callback, (String) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeDoorLockLanguageCommandParams); writeDoorLockInteractionInfo.put( "writeLanguageAttribute", writeDoorLockLanguageAttributeInteractionInfo); Map<String, CommandParameterInfo> writeDoorLockAutoRelockTimeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo doorLockautoRelockTimeCommandParameterInfo = new CommandParameterInfo("value", long.class); writeDoorLockAutoRelockTimeCommandParams.put( "value", doorLockautoRelockTimeCommandParameterInfo); InteractionInfo writeDoorLockAutoRelockTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .writeAutoRelockTimeAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeDoorLockAutoRelockTimeCommandParams); writeDoorLockInteractionInfo.put( "writeAutoRelockTimeAttribute", writeDoorLockAutoRelockTimeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeDoorLockSoundVolumeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo doorLocksoundVolumeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeDoorLockSoundVolumeCommandParams.put("value", doorLocksoundVolumeCommandParameterInfo); InteractionInfo writeDoorLockSoundVolumeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .writeSoundVolumeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeDoorLockSoundVolumeCommandParams); writeDoorLockInteractionInfo.put( "writeSoundVolumeAttribute", writeDoorLockSoundVolumeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeDoorLockOperatingModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo doorLockoperatingModeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeDoorLockOperatingModeCommandParams.put("value", doorLockoperatingModeCommandParameterInfo); InteractionInfo writeDoorLockOperatingModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .writeOperatingModeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeDoorLockOperatingModeCommandParams); writeDoorLockInteractionInfo.put( "writeOperatingModeAttribute", writeDoorLockOperatingModeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeDoorLockEnableOneTouchLockingCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo doorLockenableOneTouchLockingCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeDoorLockEnableOneTouchLockingCommandParams.put( "value", doorLockenableOneTouchLockingCommandParameterInfo); InteractionInfo writeDoorLockEnableOneTouchLockingAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .writeEnableOneTouchLockingAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeDoorLockEnableOneTouchLockingCommandParams); writeDoorLockInteractionInfo.put( "writeEnableOneTouchLockingAttribute", writeDoorLockEnableOneTouchLockingAttributeInteractionInfo); Map<String, CommandParameterInfo> writeDoorLockEnablePrivacyModeButtonCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo doorLockenablePrivacyModeButtonCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeDoorLockEnablePrivacyModeButtonCommandParams.put( "value", doorLockenablePrivacyModeButtonCommandParameterInfo); InteractionInfo writeDoorLockEnablePrivacyModeButtonAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .writeEnablePrivacyModeButtonAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeDoorLockEnablePrivacyModeButtonCommandParams); writeDoorLockInteractionInfo.put( "writeEnablePrivacyModeButtonAttribute", writeDoorLockEnablePrivacyModeButtonAttributeInteractionInfo); Map<String, CommandParameterInfo> writeDoorLockWrongCodeEntryLimitCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo doorLockwrongCodeEntryLimitCommandParameterInfo = new CommandParameterInfo("value", int.class); writeDoorLockWrongCodeEntryLimitCommandParams.put( "value", doorLockwrongCodeEntryLimitCommandParameterInfo); InteractionInfo writeDoorLockWrongCodeEntryLimitAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.DoorLockCluster) cluster) .writeWrongCodeEntryLimitAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeDoorLockWrongCodeEntryLimitCommandParams); writeDoorLockInteractionInfo.put( "writeWrongCodeEntryLimitAttribute", writeDoorLockWrongCodeEntryLimitAttributeInteractionInfo); writeAttributeMap.put("doorLock", writeDoorLockInteractionInfo); Map<String, InteractionInfo> writeElectricalMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("electricalMeasurement", writeElectricalMeasurementInteractionInfo); Map<String, InteractionInfo> writeEthernetNetworkDiagnosticsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put( "ethernetNetworkDiagnostics", writeEthernetNetworkDiagnosticsInteractionInfo); Map<String, InteractionInfo> writeFixedLabelInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("fixedLabel", writeFixedLabelInteractionInfo); Map<String, InteractionInfo> writeFlowMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("flowMeasurement", writeFlowMeasurementInteractionInfo); Map<String, InteractionInfo> writeGeneralCommissioningInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeGeneralCommissioningBreadcrumbCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo generalCommissioningbreadcrumbCommandParameterInfo = new CommandParameterInfo("value", long.class); writeGeneralCommissioningBreadcrumbCommandParams.put( "value", generalCommissioningbreadcrumbCommandParameterInfo); InteractionInfo writeGeneralCommissioningBreadcrumbAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.GeneralCommissioningCluster) cluster) .writeBreadcrumbAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeGeneralCommissioningBreadcrumbCommandParams); writeGeneralCommissioningInteractionInfo.put( "writeBreadcrumbAttribute", writeGeneralCommissioningBreadcrumbAttributeInteractionInfo); writeAttributeMap.put("generalCommissioning", writeGeneralCommissioningInteractionInfo); Map<String, InteractionInfo> writeGeneralDiagnosticsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("generalDiagnostics", writeGeneralDiagnosticsInteractionInfo); Map<String, InteractionInfo> writeGroupKeyManagementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("groupKeyManagement", writeGroupKeyManagementInteractionInfo); Map<String, InteractionInfo> writeGroupsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("groups", writeGroupsInteractionInfo); Map<String, InteractionInfo> writeIdentifyInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeIdentifyIdentifyTimeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo identifyidentifyTimeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeIdentifyIdentifyTimeCommandParams.put("value", identifyidentifyTimeCommandParameterInfo); InteractionInfo writeIdentifyIdentifyTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.IdentifyCluster) cluster) .writeIdentifyTimeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeIdentifyIdentifyTimeCommandParams); writeIdentifyInteractionInfo.put( "writeIdentifyTimeAttribute", writeIdentifyIdentifyTimeAttributeInteractionInfo); writeAttributeMap.put("identify", writeIdentifyInteractionInfo); Map<String, InteractionInfo> writeIlluminanceMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("illuminanceMeasurement", writeIlluminanceMeasurementInteractionInfo); Map<String, InteractionInfo> writeKeypadInputInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("keypadInput", writeKeypadInputInteractionInfo); Map<String, InteractionInfo> writeLevelControlInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeLevelControlOptionsCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo levelControloptionsCommandParameterInfo = new CommandParameterInfo("value", int.class); writeLevelControlOptionsCommandParams.put("value", levelControloptionsCommandParameterInfo); InteractionInfo writeLevelControlOptionsAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) .writeOptionsAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeLevelControlOptionsCommandParams); writeLevelControlInteractionInfo.put( "writeOptionsAttribute", writeLevelControlOptionsAttributeInteractionInfo); Map<String, CommandParameterInfo> writeLevelControlOnOffTransitionTimeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo levelControlonOffTransitionTimeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeLevelControlOnOffTransitionTimeCommandParams.put( "value", levelControlonOffTransitionTimeCommandParameterInfo); InteractionInfo writeLevelControlOnOffTransitionTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) .writeOnOffTransitionTimeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeLevelControlOnOffTransitionTimeCommandParams); writeLevelControlInteractionInfo.put( "writeOnOffTransitionTimeAttribute", writeLevelControlOnOffTransitionTimeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeLevelControlOnLevelCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo levelControlonLevelCommandParameterInfo = new CommandParameterInfo("value", int.class); writeLevelControlOnLevelCommandParams.put("value", levelControlonLevelCommandParameterInfo); InteractionInfo writeLevelControlOnLevelAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) .writeOnLevelAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeLevelControlOnLevelCommandParams); writeLevelControlInteractionInfo.put( "writeOnLevelAttribute", writeLevelControlOnLevelAttributeInteractionInfo); Map<String, CommandParameterInfo> writeLevelControlOnTransitionTimeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo levelControlonTransitionTimeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeLevelControlOnTransitionTimeCommandParams.put( "value", levelControlonTransitionTimeCommandParameterInfo); InteractionInfo writeLevelControlOnTransitionTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) .writeOnTransitionTimeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeLevelControlOnTransitionTimeCommandParams); writeLevelControlInteractionInfo.put( "writeOnTransitionTimeAttribute", writeLevelControlOnTransitionTimeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeLevelControlOffTransitionTimeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo levelControloffTransitionTimeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeLevelControlOffTransitionTimeCommandParams.put( "value", levelControloffTransitionTimeCommandParameterInfo); InteractionInfo writeLevelControlOffTransitionTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) .writeOffTransitionTimeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeLevelControlOffTransitionTimeCommandParams); writeLevelControlInteractionInfo.put( "writeOffTransitionTimeAttribute", writeLevelControlOffTransitionTimeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeLevelControlDefaultMoveRateCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo levelControldefaultMoveRateCommandParameterInfo = new CommandParameterInfo("value", int.class); writeLevelControlDefaultMoveRateCommandParams.put( "value", levelControldefaultMoveRateCommandParameterInfo); InteractionInfo writeLevelControlDefaultMoveRateAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) .writeDefaultMoveRateAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeLevelControlDefaultMoveRateCommandParams); writeLevelControlInteractionInfo.put( "writeDefaultMoveRateAttribute", writeLevelControlDefaultMoveRateAttributeInteractionInfo); Map<String, CommandParameterInfo> writeLevelControlStartUpCurrentLevelCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo levelControlstartUpCurrentLevelCommandParameterInfo = new CommandParameterInfo("value", int.class); writeLevelControlStartUpCurrentLevelCommandParams.put( "value", levelControlstartUpCurrentLevelCommandParameterInfo); InteractionInfo writeLevelControlStartUpCurrentLevelAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) .writeStartUpCurrentLevelAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeLevelControlStartUpCurrentLevelCommandParams); writeLevelControlInteractionInfo.put( "writeStartUpCurrentLevelAttribute", writeLevelControlStartUpCurrentLevelAttributeInteractionInfo); writeAttributeMap.put("levelControl", writeLevelControlInteractionInfo); Map<String, InteractionInfo> writeLowPowerInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("lowPower", writeLowPowerInteractionInfo); Map<String, InteractionInfo> writeMediaInputInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("mediaInput", writeMediaInputInteractionInfo); Map<String, InteractionInfo> writeMediaPlaybackInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("mediaPlayback", writeMediaPlaybackInteractionInfo); Map<String, InteractionInfo> writeModeSelectInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeModeSelectOnModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo modeSelectonModeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeModeSelectOnModeCommandParams.put("value", modeSelectonModeCommandParameterInfo); InteractionInfo writeModeSelectOnModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ModeSelectCluster) cluster) .writeOnModeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeModeSelectOnModeCommandParams); writeModeSelectInteractionInfo.put( "writeOnModeAttribute", writeModeSelectOnModeAttributeInteractionInfo); writeAttributeMap.put("modeSelect", writeModeSelectInteractionInfo); Map<String, InteractionInfo> writeNetworkCommissioningInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("networkCommissioning", writeNetworkCommissioningInteractionInfo); Map<String, InteractionInfo> writeOtaSoftwareUpdateProviderInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put( "otaSoftwareUpdateProvider", writeOtaSoftwareUpdateProviderInteractionInfo); Map<String, InteractionInfo> writeOtaSoftwareUpdateRequestorInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeOtaSoftwareUpdateRequestorDefaultOtaProviderCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo otaSoftwareUpdateRequestordefaultOtaProviderCommandParameterInfo = new CommandParameterInfo("value", byte[].class); writeOtaSoftwareUpdateRequestorDefaultOtaProviderCommandParams.put( "value", otaSoftwareUpdateRequestordefaultOtaProviderCommandParameterInfo); InteractionInfo writeOtaSoftwareUpdateRequestorDefaultOtaProviderAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.OtaSoftwareUpdateRequestorCluster) cluster) .writeDefaultOtaProviderAttribute( (DefaultClusterCallback) callback, (byte[]) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeOtaSoftwareUpdateRequestorDefaultOtaProviderCommandParams); writeOtaSoftwareUpdateRequestorInteractionInfo.put( "writeDefaultOtaProviderAttribute", writeOtaSoftwareUpdateRequestorDefaultOtaProviderAttributeInteractionInfo); writeAttributeMap.put( "otaSoftwareUpdateRequestor", writeOtaSoftwareUpdateRequestorInteractionInfo); Map<String, InteractionInfo> writeOccupancySensingInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("occupancySensing", writeOccupancySensingInteractionInfo); Map<String, InteractionInfo> writeOnOffInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeOnOffOnTimeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo onOffonTimeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeOnOffOnTimeCommandParams.put("value", onOffonTimeCommandParameterInfo); InteractionInfo writeOnOffOnTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.OnOffCluster) cluster) .writeOnTimeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeOnOffOnTimeCommandParams); writeOnOffInteractionInfo.put("writeOnTimeAttribute", writeOnOffOnTimeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeOnOffOffWaitTimeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo onOffoffWaitTimeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeOnOffOffWaitTimeCommandParams.put("value", onOffoffWaitTimeCommandParameterInfo); InteractionInfo writeOnOffOffWaitTimeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.OnOffCluster) cluster) .writeOffWaitTimeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeOnOffOffWaitTimeCommandParams); writeOnOffInteractionInfo.put( "writeOffWaitTimeAttribute", writeOnOffOffWaitTimeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeOnOffStartUpOnOffCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo onOffstartUpOnOffCommandParameterInfo = new CommandParameterInfo("value", int.class); writeOnOffStartUpOnOffCommandParams.put("value", onOffstartUpOnOffCommandParameterInfo); InteractionInfo writeOnOffStartUpOnOffAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.OnOffCluster) cluster) .writeStartUpOnOffAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeOnOffStartUpOnOffCommandParams); writeOnOffInteractionInfo.put( "writeStartUpOnOffAttribute", writeOnOffStartUpOnOffAttributeInteractionInfo); writeAttributeMap.put("onOff", writeOnOffInteractionInfo); Map<String, InteractionInfo> writeOnOffSwitchConfigurationInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeOnOffSwitchConfigurationSwitchActionsCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo onOffSwitchConfigurationswitchActionsCommandParameterInfo = new CommandParameterInfo("value", int.class); writeOnOffSwitchConfigurationSwitchActionsCommandParams.put( "value", onOffSwitchConfigurationswitchActionsCommandParameterInfo); InteractionInfo writeOnOffSwitchConfigurationSwitchActionsAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.OnOffSwitchConfigurationCluster) cluster) .writeSwitchActionsAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeOnOffSwitchConfigurationSwitchActionsCommandParams); writeOnOffSwitchConfigurationInteractionInfo.put( "writeSwitchActionsAttribute", writeOnOffSwitchConfigurationSwitchActionsAttributeInteractionInfo); writeAttributeMap.put("onOffSwitchConfiguration", writeOnOffSwitchConfigurationInteractionInfo); Map<String, InteractionInfo> writeOperationalCredentialsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("operationalCredentials", writeOperationalCredentialsInteractionInfo); Map<String, InteractionInfo> writePowerSourceInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("powerSource", writePowerSourceInteractionInfo); Map<String, InteractionInfo> writePowerSourceConfigurationInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("powerSourceConfiguration", writePowerSourceConfigurationInteractionInfo); Map<String, InteractionInfo> writePressureMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("pressureMeasurement", writePressureMeasurementInteractionInfo); Map<String, InteractionInfo> writePumpConfigurationAndControlInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writePumpConfigurationAndControlLifetimeRunningHoursCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo pumpConfigurationAndControllifetimeRunningHoursCommandParameterInfo = new CommandParameterInfo("value", long.class); writePumpConfigurationAndControlLifetimeRunningHoursCommandParams.put( "value", pumpConfigurationAndControllifetimeRunningHoursCommandParameterInfo); InteractionInfo writePumpConfigurationAndControlLifetimeRunningHoursAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.PumpConfigurationAndControlCluster) cluster) .writeLifetimeRunningHoursAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writePumpConfigurationAndControlLifetimeRunningHoursCommandParams); writePumpConfigurationAndControlInteractionInfo.put( "writeLifetimeRunningHoursAttribute", writePumpConfigurationAndControlLifetimeRunningHoursAttributeInteractionInfo); Map<String, CommandParameterInfo> writePumpConfigurationAndControlLifetimeEnergyConsumedCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo pumpConfigurationAndControllifetimeEnergyConsumedCommandParameterInfo = new CommandParameterInfo("value", long.class); writePumpConfigurationAndControlLifetimeEnergyConsumedCommandParams.put( "value", pumpConfigurationAndControllifetimeEnergyConsumedCommandParameterInfo); InteractionInfo writePumpConfigurationAndControlLifetimeEnergyConsumedAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.PumpConfigurationAndControlCluster) cluster) .writeLifetimeEnergyConsumedAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writePumpConfigurationAndControlLifetimeEnergyConsumedCommandParams); writePumpConfigurationAndControlInteractionInfo.put( "writeLifetimeEnergyConsumedAttribute", writePumpConfigurationAndControlLifetimeEnergyConsumedAttributeInteractionInfo); Map<String, CommandParameterInfo> writePumpConfigurationAndControlOperationModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo pumpConfigurationAndControloperationModeCommandParameterInfo = new CommandParameterInfo("value", int.class); writePumpConfigurationAndControlOperationModeCommandParams.put( "value", pumpConfigurationAndControloperationModeCommandParameterInfo); InteractionInfo writePumpConfigurationAndControlOperationModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.PumpConfigurationAndControlCluster) cluster) .writeOperationModeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writePumpConfigurationAndControlOperationModeCommandParams); writePumpConfigurationAndControlInteractionInfo.put( "writeOperationModeAttribute", writePumpConfigurationAndControlOperationModeAttributeInteractionInfo); Map<String, CommandParameterInfo> writePumpConfigurationAndControlControlModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo pumpConfigurationAndControlcontrolModeCommandParameterInfo = new CommandParameterInfo("value", int.class); writePumpConfigurationAndControlControlModeCommandParams.put( "value", pumpConfigurationAndControlcontrolModeCommandParameterInfo); InteractionInfo writePumpConfigurationAndControlControlModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.PumpConfigurationAndControlCluster) cluster) .writeControlModeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writePumpConfigurationAndControlControlModeCommandParams); writePumpConfigurationAndControlInteractionInfo.put( "writeControlModeAttribute", writePumpConfigurationAndControlControlModeAttributeInteractionInfo); writeAttributeMap.put( "pumpConfigurationAndControl", writePumpConfigurationAndControlInteractionInfo); Map<String, InteractionInfo> writeRelativeHumidityMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put( "relativeHumidityMeasurement", writeRelativeHumidityMeasurementInteractionInfo); Map<String, InteractionInfo> writeScenesInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("scenes", writeScenesInteractionInfo); Map<String, InteractionInfo> writeSoftwareDiagnosticsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("softwareDiagnostics", writeSoftwareDiagnosticsInteractionInfo); Map<String, InteractionInfo> writeSwitchInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("switch", writeSwitchInteractionInfo); Map<String, InteractionInfo> writeTvChannelInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("tvChannel", writeTvChannelInteractionInfo); Map<String, InteractionInfo> writeTargetNavigatorInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("targetNavigator", writeTargetNavigatorInteractionInfo); Map<String, InteractionInfo> writeTemperatureMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("temperatureMeasurement", writeTemperatureMeasurementInteractionInfo); Map<String, InteractionInfo> writeTestClusterInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeTestClusterBooleanCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterbooleanCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeTestClusterBooleanCommandParams.put("value", testClusterbooleanCommandParameterInfo); InteractionInfo writeTestClusterBooleanAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeBooleanAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterBooleanCommandParams); writeTestClusterInteractionInfo.put( "writeBooleanAttribute", writeTestClusterBooleanAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterBitmap8CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterbitmap8CommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterBitmap8CommandParams.put("value", testClusterbitmap8CommandParameterInfo); InteractionInfo writeTestClusterBitmap8AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeBitmap8Attribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterBitmap8CommandParams); writeTestClusterInteractionInfo.put( "writeBitmap8Attribute", writeTestClusterBitmap8AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterBitmap16CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterbitmap16CommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterBitmap16CommandParams.put("value", testClusterbitmap16CommandParameterInfo); InteractionInfo writeTestClusterBitmap16AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeBitmap16Attribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterBitmap16CommandParams); writeTestClusterInteractionInfo.put( "writeBitmap16Attribute", writeTestClusterBitmap16AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterBitmap32CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterbitmap32CommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterBitmap32CommandParams.put("value", testClusterbitmap32CommandParameterInfo); InteractionInfo writeTestClusterBitmap32AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeBitmap32Attribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterBitmap32CommandParams); writeTestClusterInteractionInfo.put( "writeBitmap32Attribute", writeTestClusterBitmap32AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterBitmap64CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterbitmap64CommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterBitmap64CommandParams.put("value", testClusterbitmap64CommandParameterInfo); InteractionInfo writeTestClusterBitmap64AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeBitmap64Attribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterBitmap64CommandParams); writeTestClusterInteractionInfo.put( "writeBitmap64Attribute", writeTestClusterBitmap64AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt8uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint8uCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterInt8uCommandParams.put("value", testClusterint8uCommandParameterInfo); InteractionInfo writeTestClusterInt8uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt8uAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt8uCommandParams); writeTestClusterInteractionInfo.put( "writeInt8uAttribute", writeTestClusterInt8uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt16uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint16uCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterInt16uCommandParams.put("value", testClusterint16uCommandParameterInfo); InteractionInfo writeTestClusterInt16uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt16uAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt16uCommandParams); writeTestClusterInteractionInfo.put( "writeInt16uAttribute", writeTestClusterInt16uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt24uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint24uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt24uCommandParams.put("value", testClusterint24uCommandParameterInfo); InteractionInfo writeTestClusterInt24uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt24uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt24uCommandParams); writeTestClusterInteractionInfo.put( "writeInt24uAttribute", writeTestClusterInt24uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt32uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint32uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt32uCommandParams.put("value", testClusterint32uCommandParameterInfo); InteractionInfo writeTestClusterInt32uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt32uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt32uCommandParams); writeTestClusterInteractionInfo.put( "writeInt32uAttribute", writeTestClusterInt32uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt40uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint40uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt40uCommandParams.put("value", testClusterint40uCommandParameterInfo); InteractionInfo writeTestClusterInt40uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt40uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt40uCommandParams); writeTestClusterInteractionInfo.put( "writeInt40uAttribute", writeTestClusterInt40uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt48uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint48uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt48uCommandParams.put("value", testClusterint48uCommandParameterInfo); InteractionInfo writeTestClusterInt48uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt48uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt48uCommandParams); writeTestClusterInteractionInfo.put( "writeInt48uAttribute", writeTestClusterInt48uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt56uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint56uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt56uCommandParams.put("value", testClusterint56uCommandParameterInfo); InteractionInfo writeTestClusterInt56uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt56uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt56uCommandParams); writeTestClusterInteractionInfo.put( "writeInt56uAttribute", writeTestClusterInt56uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt64uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint64uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt64uCommandParams.put("value", testClusterint64uCommandParameterInfo); InteractionInfo writeTestClusterInt64uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt64uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt64uCommandParams); writeTestClusterInteractionInfo.put( "writeInt64uAttribute", writeTestClusterInt64uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt8sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint8sCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterInt8sCommandParams.put("value", testClusterint8sCommandParameterInfo); InteractionInfo writeTestClusterInt8sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt8sAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt8sCommandParams); writeTestClusterInteractionInfo.put( "writeInt8sAttribute", writeTestClusterInt8sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt16sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint16sCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterInt16sCommandParams.put("value", testClusterint16sCommandParameterInfo); InteractionInfo writeTestClusterInt16sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt16sAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt16sCommandParams); writeTestClusterInteractionInfo.put( "writeInt16sAttribute", writeTestClusterInt16sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt24sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint24sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt24sCommandParams.put("value", testClusterint24sCommandParameterInfo); InteractionInfo writeTestClusterInt24sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt24sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt24sCommandParams); writeTestClusterInteractionInfo.put( "writeInt24sAttribute", writeTestClusterInt24sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt32sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint32sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt32sCommandParams.put("value", testClusterint32sCommandParameterInfo); InteractionInfo writeTestClusterInt32sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt32sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt32sCommandParams); writeTestClusterInteractionInfo.put( "writeInt32sAttribute", writeTestClusterInt32sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt40sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint40sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt40sCommandParams.put("value", testClusterint40sCommandParameterInfo); InteractionInfo writeTestClusterInt40sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt40sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt40sCommandParams); writeTestClusterInteractionInfo.put( "writeInt40sAttribute", writeTestClusterInt40sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt48sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint48sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt48sCommandParams.put("value", testClusterint48sCommandParameterInfo); InteractionInfo writeTestClusterInt48sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt48sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt48sCommandParams); writeTestClusterInteractionInfo.put( "writeInt48sAttribute", writeTestClusterInt48sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt56sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint56sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt56sCommandParams.put("value", testClusterint56sCommandParameterInfo); InteractionInfo writeTestClusterInt56sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt56sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt56sCommandParams); writeTestClusterInteractionInfo.put( "writeInt56sAttribute", writeTestClusterInt56sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterInt64sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterint64sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterInt64sCommandParams.put("value", testClusterint64sCommandParameterInfo); InteractionInfo writeTestClusterInt64sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeInt64sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterInt64sCommandParams); writeTestClusterInteractionInfo.put( "writeInt64sAttribute", writeTestClusterInt64sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterEnum8CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterenum8CommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterEnum8CommandParams.put("value", testClusterenum8CommandParameterInfo); InteractionInfo writeTestClusterEnum8AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeEnum8Attribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterEnum8CommandParams); writeTestClusterInteractionInfo.put( "writeEnum8Attribute", writeTestClusterEnum8AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterEnum16CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterenum16CommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterEnum16CommandParams.put("value", testClusterenum16CommandParameterInfo); InteractionInfo writeTestClusterEnum16AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeEnum16Attribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterEnum16CommandParams); writeTestClusterInteractionInfo.put( "writeEnum16Attribute", writeTestClusterEnum16AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterFloatSingleCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterfloatSingleCommandParameterInfo = new CommandParameterInfo("value", float.class); writeTestClusterFloatSingleCommandParams.put( "value", testClusterfloatSingleCommandParameterInfo); InteractionInfo writeTestClusterFloatSingleAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeFloatSingleAttribute( (DefaultClusterCallback) callback, (Float) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterFloatSingleCommandParams); writeTestClusterInteractionInfo.put( "writeFloatSingleAttribute", writeTestClusterFloatSingleAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterFloatDoubleCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterfloatDoubleCommandParameterInfo = new CommandParameterInfo("value", double.class); writeTestClusterFloatDoubleCommandParams.put( "value", testClusterfloatDoubleCommandParameterInfo); InteractionInfo writeTestClusterFloatDoubleAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeFloatDoubleAttribute( (DefaultClusterCallback) callback, (Double) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterFloatDoubleCommandParams); writeTestClusterInteractionInfo.put( "writeFloatDoubleAttribute", writeTestClusterFloatDoubleAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterOctetStringCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusteroctetStringCommandParameterInfo = new CommandParameterInfo("value", byte[].class); writeTestClusterOctetStringCommandParams.put( "value", testClusteroctetStringCommandParameterInfo); InteractionInfo writeTestClusterOctetStringAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeOctetStringAttribute( (DefaultClusterCallback) callback, (byte[]) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterOctetStringCommandParams); writeTestClusterInteractionInfo.put( "writeOctetStringAttribute", writeTestClusterOctetStringAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterLongOctetStringCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterlongOctetStringCommandParameterInfo = new CommandParameterInfo("value", byte[].class); writeTestClusterLongOctetStringCommandParams.put( "value", testClusterlongOctetStringCommandParameterInfo); InteractionInfo writeTestClusterLongOctetStringAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeLongOctetStringAttribute( (DefaultClusterCallback) callback, (byte[]) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterLongOctetStringCommandParams); writeTestClusterInteractionInfo.put( "writeLongOctetStringAttribute", writeTestClusterLongOctetStringAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterCharStringCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClustercharStringCommandParameterInfo = new CommandParameterInfo("value", String.class); writeTestClusterCharStringCommandParams.put("value", testClustercharStringCommandParameterInfo); InteractionInfo writeTestClusterCharStringAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeCharStringAttribute( (DefaultClusterCallback) callback, (String) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterCharStringCommandParams); writeTestClusterInteractionInfo.put( "writeCharStringAttribute", writeTestClusterCharStringAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterLongCharStringCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterlongCharStringCommandParameterInfo = new CommandParameterInfo("value", String.class); writeTestClusterLongCharStringCommandParams.put( "value", testClusterlongCharStringCommandParameterInfo); InteractionInfo writeTestClusterLongCharStringAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeLongCharStringAttribute( (DefaultClusterCallback) callback, (String) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterLongCharStringCommandParams); writeTestClusterInteractionInfo.put( "writeLongCharStringAttribute", writeTestClusterLongCharStringAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterEpochUsCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterepochUsCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterEpochUsCommandParams.put("value", testClusterepochUsCommandParameterInfo); InteractionInfo writeTestClusterEpochUsAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeEpochUsAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterEpochUsCommandParams); writeTestClusterInteractionInfo.put( "writeEpochUsAttribute", writeTestClusterEpochUsAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterEpochSCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterepochSCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterEpochSCommandParams.put("value", testClusterepochSCommandParameterInfo); InteractionInfo writeTestClusterEpochSAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeEpochSAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterEpochSCommandParams); writeTestClusterInteractionInfo.put( "writeEpochSAttribute", writeTestClusterEpochSAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterVendorIdCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClustervendorIdCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterVendorIdCommandParams.put("value", testClustervendorIdCommandParameterInfo); InteractionInfo writeTestClusterVendorIdAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeVendorIdAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterVendorIdCommandParams); writeTestClusterInteractionInfo.put( "writeVendorIdAttribute", writeTestClusterVendorIdAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterEnumAttrCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterenumAttrCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterEnumAttrCommandParams.put("value", testClusterenumAttrCommandParameterInfo); InteractionInfo writeTestClusterEnumAttrAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeEnumAttrAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterEnumAttrCommandParams); writeTestClusterInteractionInfo.put( "writeEnumAttrAttribute", writeTestClusterEnumAttrAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterRangeRestrictedInt8uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterrangeRestrictedInt8uCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterRangeRestrictedInt8uCommandParams.put( "value", testClusterrangeRestrictedInt8uCommandParameterInfo); InteractionInfo writeTestClusterRangeRestrictedInt8uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeRangeRestrictedInt8uAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterRangeRestrictedInt8uCommandParams); writeTestClusterInteractionInfo.put( "writeRangeRestrictedInt8uAttribute", writeTestClusterRangeRestrictedInt8uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterRangeRestrictedInt8sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterrangeRestrictedInt8sCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterRangeRestrictedInt8sCommandParams.put( "value", testClusterrangeRestrictedInt8sCommandParameterInfo); InteractionInfo writeTestClusterRangeRestrictedInt8sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeRangeRestrictedInt8sAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterRangeRestrictedInt8sCommandParams); writeTestClusterInteractionInfo.put( "writeRangeRestrictedInt8sAttribute", writeTestClusterRangeRestrictedInt8sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterRangeRestrictedInt16uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterrangeRestrictedInt16uCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterRangeRestrictedInt16uCommandParams.put( "value", testClusterrangeRestrictedInt16uCommandParameterInfo); InteractionInfo writeTestClusterRangeRestrictedInt16uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeRangeRestrictedInt16uAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterRangeRestrictedInt16uCommandParams); writeTestClusterInteractionInfo.put( "writeRangeRestrictedInt16uAttribute", writeTestClusterRangeRestrictedInt16uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterRangeRestrictedInt16sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterrangeRestrictedInt16sCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterRangeRestrictedInt16sCommandParams.put( "value", testClusterrangeRestrictedInt16sCommandParameterInfo); InteractionInfo writeTestClusterRangeRestrictedInt16sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeRangeRestrictedInt16sAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterRangeRestrictedInt16sCommandParams); writeTestClusterInteractionInfo.put( "writeRangeRestrictedInt16sAttribute", writeTestClusterRangeRestrictedInt16sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterTimedWriteBooleanCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClustertimedWriteBooleanCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeTestClusterTimedWriteBooleanCommandParams.put( "value", testClustertimedWriteBooleanCommandParameterInfo); InteractionInfo writeTestClusterTimedWriteBooleanAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeTimedWriteBooleanAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterTimedWriteBooleanCommandParams); writeTestClusterInteractionInfo.put( "writeTimedWriteBooleanAttribute", writeTestClusterTimedWriteBooleanAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterUnsupportedCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusterunsupportedCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeTestClusterUnsupportedCommandParams.put( "value", testClusterunsupportedCommandParameterInfo); InteractionInfo writeTestClusterUnsupportedAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeUnsupportedAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterUnsupportedCommandParams); writeTestClusterInteractionInfo.put( "writeUnsupportedAttribute", writeTestClusterUnsupportedAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableBooleanCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableBooleanCommandParameterInfo = new CommandParameterInfo("value", boolean.class); writeTestClusterNullableBooleanCommandParams.put( "value", testClusternullableBooleanCommandParameterInfo); InteractionInfo writeTestClusterNullableBooleanAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableBooleanAttribute( (DefaultClusterCallback) callback, (Boolean) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableBooleanCommandParams); writeTestClusterInteractionInfo.put( "writeNullableBooleanAttribute", writeTestClusterNullableBooleanAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableBitmap8CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableBitmap8CommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableBitmap8CommandParams.put( "value", testClusternullableBitmap8CommandParameterInfo); InteractionInfo writeTestClusterNullableBitmap8AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableBitmap8Attribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableBitmap8CommandParams); writeTestClusterInteractionInfo.put( "writeNullableBitmap8Attribute", writeTestClusterNullableBitmap8AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableBitmap16CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableBitmap16CommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableBitmap16CommandParams.put( "value", testClusternullableBitmap16CommandParameterInfo); InteractionInfo writeTestClusterNullableBitmap16AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableBitmap16Attribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableBitmap16CommandParams); writeTestClusterInteractionInfo.put( "writeNullableBitmap16Attribute", writeTestClusterNullableBitmap16AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableBitmap32CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableBitmap32CommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableBitmap32CommandParams.put( "value", testClusternullableBitmap32CommandParameterInfo); InteractionInfo writeTestClusterNullableBitmap32AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableBitmap32Attribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableBitmap32CommandParams); writeTestClusterInteractionInfo.put( "writeNullableBitmap32Attribute", writeTestClusterNullableBitmap32AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableBitmap64CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableBitmap64CommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableBitmap64CommandParams.put( "value", testClusternullableBitmap64CommandParameterInfo); InteractionInfo writeTestClusterNullableBitmap64AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableBitmap64Attribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableBitmap64CommandParams); writeTestClusterInteractionInfo.put( "writeNullableBitmap64Attribute", writeTestClusterNullableBitmap64AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt8uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt8uCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableInt8uCommandParams.put( "value", testClusternullableInt8uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt8uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt8uAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt8uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt8uAttribute", writeTestClusterNullableInt8uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt16uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt16uCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableInt16uCommandParams.put( "value", testClusternullableInt16uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt16uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt16uAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt16uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt16uAttribute", writeTestClusterNullableInt16uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt24uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt24uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt24uCommandParams.put( "value", testClusternullableInt24uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt24uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt24uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt24uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt24uAttribute", writeTestClusterNullableInt24uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt32uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt32uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt32uCommandParams.put( "value", testClusternullableInt32uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt32uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt32uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt32uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt32uAttribute", writeTestClusterNullableInt32uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt40uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt40uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt40uCommandParams.put( "value", testClusternullableInt40uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt40uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt40uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt40uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt40uAttribute", writeTestClusterNullableInt40uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt48uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt48uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt48uCommandParams.put( "value", testClusternullableInt48uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt48uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt48uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt48uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt48uAttribute", writeTestClusterNullableInt48uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt56uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt56uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt56uCommandParams.put( "value", testClusternullableInt56uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt56uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt56uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt56uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt56uAttribute", writeTestClusterNullableInt56uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt64uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt64uCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt64uCommandParams.put( "value", testClusternullableInt64uCommandParameterInfo); InteractionInfo writeTestClusterNullableInt64uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt64uAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt64uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt64uAttribute", writeTestClusterNullableInt64uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt8sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt8sCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableInt8sCommandParams.put( "value", testClusternullableInt8sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt8sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt8sAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt8sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt8sAttribute", writeTestClusterNullableInt8sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt16sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt16sCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableInt16sCommandParams.put( "value", testClusternullableInt16sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt16sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt16sAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt16sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt16sAttribute", writeTestClusterNullableInt16sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt24sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt24sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt24sCommandParams.put( "value", testClusternullableInt24sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt24sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt24sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt24sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt24sAttribute", writeTestClusterNullableInt24sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt32sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt32sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt32sCommandParams.put( "value", testClusternullableInt32sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt32sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt32sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt32sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt32sAttribute", writeTestClusterNullableInt32sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt40sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt40sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt40sCommandParams.put( "value", testClusternullableInt40sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt40sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt40sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt40sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt40sAttribute", writeTestClusterNullableInt40sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt48sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt48sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt48sCommandParams.put( "value", testClusternullableInt48sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt48sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt48sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt48sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt48sAttribute", writeTestClusterNullableInt48sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt56sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt56sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt56sCommandParams.put( "value", testClusternullableInt56sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt56sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt56sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt56sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt56sAttribute", writeTestClusterNullableInt56sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableInt64sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableInt64sCommandParameterInfo = new CommandParameterInfo("value", long.class); writeTestClusterNullableInt64sCommandParams.put( "value", testClusternullableInt64sCommandParameterInfo); InteractionInfo writeTestClusterNullableInt64sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableInt64sAttribute( (DefaultClusterCallback) callback, (Long) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableInt64sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableInt64sAttribute", writeTestClusterNullableInt64sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableEnum8CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableEnum8CommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableEnum8CommandParams.put( "value", testClusternullableEnum8CommandParameterInfo); InteractionInfo writeTestClusterNullableEnum8AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableEnum8Attribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableEnum8CommandParams); writeTestClusterInteractionInfo.put( "writeNullableEnum8Attribute", writeTestClusterNullableEnum8AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableEnum16CommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableEnum16CommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableEnum16CommandParams.put( "value", testClusternullableEnum16CommandParameterInfo); InteractionInfo writeTestClusterNullableEnum16AttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableEnum16Attribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableEnum16CommandParams); writeTestClusterInteractionInfo.put( "writeNullableEnum16Attribute", writeTestClusterNullableEnum16AttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableFloatSingleCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableFloatSingleCommandParameterInfo = new CommandParameterInfo("value", float.class); writeTestClusterNullableFloatSingleCommandParams.put( "value", testClusternullableFloatSingleCommandParameterInfo); InteractionInfo writeTestClusterNullableFloatSingleAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableFloatSingleAttribute( (DefaultClusterCallback) callback, (Float) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableFloatSingleCommandParams); writeTestClusterInteractionInfo.put( "writeNullableFloatSingleAttribute", writeTestClusterNullableFloatSingleAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableFloatDoubleCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableFloatDoubleCommandParameterInfo = new CommandParameterInfo("value", double.class); writeTestClusterNullableFloatDoubleCommandParams.put( "value", testClusternullableFloatDoubleCommandParameterInfo); InteractionInfo writeTestClusterNullableFloatDoubleAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableFloatDoubleAttribute( (DefaultClusterCallback) callback, (Double) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableFloatDoubleCommandParams); writeTestClusterInteractionInfo.put( "writeNullableFloatDoubleAttribute", writeTestClusterNullableFloatDoubleAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableOctetStringCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableOctetStringCommandParameterInfo = new CommandParameterInfo("value", byte[].class); writeTestClusterNullableOctetStringCommandParams.put( "value", testClusternullableOctetStringCommandParameterInfo); InteractionInfo writeTestClusterNullableOctetStringAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableOctetStringAttribute( (DefaultClusterCallback) callback, (byte[]) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableOctetStringCommandParams); writeTestClusterInteractionInfo.put( "writeNullableOctetStringAttribute", writeTestClusterNullableOctetStringAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableCharStringCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableCharStringCommandParameterInfo = new CommandParameterInfo("value", String.class); writeTestClusterNullableCharStringCommandParams.put( "value", testClusternullableCharStringCommandParameterInfo); InteractionInfo writeTestClusterNullableCharStringAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableCharStringAttribute( (DefaultClusterCallback) callback, (String) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableCharStringCommandParams); writeTestClusterInteractionInfo.put( "writeNullableCharStringAttribute", writeTestClusterNullableCharStringAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableEnumAttrCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableEnumAttrCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableEnumAttrCommandParams.put( "value", testClusternullableEnumAttrCommandParameterInfo); InteractionInfo writeTestClusterNullableEnumAttrAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableEnumAttrAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableEnumAttrCommandParams); writeTestClusterInteractionInfo.put( "writeNullableEnumAttrAttribute", writeTestClusterNullableEnumAttrAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableRangeRestrictedInt8uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableRangeRestrictedInt8uCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableRangeRestrictedInt8uCommandParams.put( "value", testClusternullableRangeRestrictedInt8uCommandParameterInfo); InteractionInfo writeTestClusterNullableRangeRestrictedInt8uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableRangeRestrictedInt8uAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableRangeRestrictedInt8uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableRangeRestrictedInt8uAttribute", writeTestClusterNullableRangeRestrictedInt8uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableRangeRestrictedInt8sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableRangeRestrictedInt8sCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableRangeRestrictedInt8sCommandParams.put( "value", testClusternullableRangeRestrictedInt8sCommandParameterInfo); InteractionInfo writeTestClusterNullableRangeRestrictedInt8sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableRangeRestrictedInt8sAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableRangeRestrictedInt8sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableRangeRestrictedInt8sAttribute", writeTestClusterNullableRangeRestrictedInt8sAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableRangeRestrictedInt16uCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableRangeRestrictedInt16uCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableRangeRestrictedInt16uCommandParams.put( "value", testClusternullableRangeRestrictedInt16uCommandParameterInfo); InteractionInfo writeTestClusterNullableRangeRestrictedInt16uAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableRangeRestrictedInt16uAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableRangeRestrictedInt16uCommandParams); writeTestClusterInteractionInfo.put( "writeNullableRangeRestrictedInt16uAttribute", writeTestClusterNullableRangeRestrictedInt16uAttributeInteractionInfo); Map<String, CommandParameterInfo> writeTestClusterNullableRangeRestrictedInt16sCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo testClusternullableRangeRestrictedInt16sCommandParameterInfo = new CommandParameterInfo("value", int.class); writeTestClusterNullableRangeRestrictedInt16sCommandParams.put( "value", testClusternullableRangeRestrictedInt16sCommandParameterInfo); InteractionInfo writeTestClusterNullableRangeRestrictedInt16sAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .writeNullableRangeRestrictedInt16sAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeTestClusterNullableRangeRestrictedInt16sCommandParams); writeTestClusterInteractionInfo.put( "writeNullableRangeRestrictedInt16sAttribute", writeTestClusterNullableRangeRestrictedInt16sAttributeInteractionInfo); writeAttributeMap.put("testCluster", writeTestClusterInteractionInfo); Map<String, InteractionInfo> writeThermostatInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeThermostatOccupiedCoolingSetpointCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatoccupiedCoolingSetpointCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatOccupiedCoolingSetpointCommandParams.put( "value", thermostatoccupiedCoolingSetpointCommandParameterInfo); InteractionInfo writeThermostatOccupiedCoolingSetpointAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeOccupiedCoolingSetpointAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatOccupiedCoolingSetpointCommandParams); writeThermostatInteractionInfo.put( "writeOccupiedCoolingSetpointAttribute", writeThermostatOccupiedCoolingSetpointAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatOccupiedHeatingSetpointCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatoccupiedHeatingSetpointCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatOccupiedHeatingSetpointCommandParams.put( "value", thermostatoccupiedHeatingSetpointCommandParameterInfo); InteractionInfo writeThermostatOccupiedHeatingSetpointAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeOccupiedHeatingSetpointAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatOccupiedHeatingSetpointCommandParams); writeThermostatInteractionInfo.put( "writeOccupiedHeatingSetpointAttribute", writeThermostatOccupiedHeatingSetpointAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatMinHeatSetpointLimitCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatminHeatSetpointLimitCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatMinHeatSetpointLimitCommandParams.put( "value", thermostatminHeatSetpointLimitCommandParameterInfo); InteractionInfo writeThermostatMinHeatSetpointLimitAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeMinHeatSetpointLimitAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatMinHeatSetpointLimitCommandParams); writeThermostatInteractionInfo.put( "writeMinHeatSetpointLimitAttribute", writeThermostatMinHeatSetpointLimitAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatMaxHeatSetpointLimitCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatmaxHeatSetpointLimitCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatMaxHeatSetpointLimitCommandParams.put( "value", thermostatmaxHeatSetpointLimitCommandParameterInfo); InteractionInfo writeThermostatMaxHeatSetpointLimitAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeMaxHeatSetpointLimitAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatMaxHeatSetpointLimitCommandParams); writeThermostatInteractionInfo.put( "writeMaxHeatSetpointLimitAttribute", writeThermostatMaxHeatSetpointLimitAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatMinCoolSetpointLimitCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatminCoolSetpointLimitCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatMinCoolSetpointLimitCommandParams.put( "value", thermostatminCoolSetpointLimitCommandParameterInfo); InteractionInfo writeThermostatMinCoolSetpointLimitAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeMinCoolSetpointLimitAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatMinCoolSetpointLimitCommandParams); writeThermostatInteractionInfo.put( "writeMinCoolSetpointLimitAttribute", writeThermostatMinCoolSetpointLimitAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatMaxCoolSetpointLimitCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatmaxCoolSetpointLimitCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatMaxCoolSetpointLimitCommandParams.put( "value", thermostatmaxCoolSetpointLimitCommandParameterInfo); InteractionInfo writeThermostatMaxCoolSetpointLimitAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeMaxCoolSetpointLimitAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatMaxCoolSetpointLimitCommandParams); writeThermostatInteractionInfo.put( "writeMaxCoolSetpointLimitAttribute", writeThermostatMaxCoolSetpointLimitAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatMinSetpointDeadBandCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatminSetpointDeadBandCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatMinSetpointDeadBandCommandParams.put( "value", thermostatminSetpointDeadBandCommandParameterInfo); InteractionInfo writeThermostatMinSetpointDeadBandAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeMinSetpointDeadBandAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatMinSetpointDeadBandCommandParams); writeThermostatInteractionInfo.put( "writeMinSetpointDeadBandAttribute", writeThermostatMinSetpointDeadBandAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatControlSequenceOfOperationCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatcontrolSequenceOfOperationCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatControlSequenceOfOperationCommandParams.put( "value", thermostatcontrolSequenceOfOperationCommandParameterInfo); InteractionInfo writeThermostatControlSequenceOfOperationAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeControlSequenceOfOperationAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatControlSequenceOfOperationCommandParams); writeThermostatInteractionInfo.put( "writeControlSequenceOfOperationAttribute", writeThermostatControlSequenceOfOperationAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatSystemModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatsystemModeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatSystemModeCommandParams.put("value", thermostatsystemModeCommandParameterInfo); InteractionInfo writeThermostatSystemModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatCluster) cluster) .writeSystemModeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatSystemModeCommandParams); writeThermostatInteractionInfo.put( "writeSystemModeAttribute", writeThermostatSystemModeAttributeInteractionInfo); writeAttributeMap.put("thermostat", writeThermostatInteractionInfo); Map<String, InteractionInfo> writeThermostatUserInterfaceConfigurationInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeThermostatUserInterfaceConfigurationTemperatureDisplayModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatUserInterfaceConfigurationtemperatureDisplayModeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatUserInterfaceConfigurationTemperatureDisplayModeCommandParams.put( "value", thermostatUserInterfaceConfigurationtemperatureDisplayModeCommandParameterInfo); InteractionInfo writeThermostatUserInterfaceConfigurationTemperatureDisplayModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatUserInterfaceConfigurationCluster) cluster) .writeTemperatureDisplayModeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatUserInterfaceConfigurationTemperatureDisplayModeCommandParams); writeThermostatUserInterfaceConfigurationInteractionInfo.put( "writeTemperatureDisplayModeAttribute", writeThermostatUserInterfaceConfigurationTemperatureDisplayModeAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatUserInterfaceConfigurationKeypadLockoutCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatUserInterfaceConfigurationkeypadLockoutCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatUserInterfaceConfigurationKeypadLockoutCommandParams.put( "value", thermostatUserInterfaceConfigurationkeypadLockoutCommandParameterInfo); InteractionInfo writeThermostatUserInterfaceConfigurationKeypadLockoutAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatUserInterfaceConfigurationCluster) cluster) .writeKeypadLockoutAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatUserInterfaceConfigurationKeypadLockoutCommandParams); writeThermostatUserInterfaceConfigurationInteractionInfo.put( "writeKeypadLockoutAttribute", writeThermostatUserInterfaceConfigurationKeypadLockoutAttributeInteractionInfo); Map<String, CommandParameterInfo> writeThermostatUserInterfaceConfigurationScheduleProgrammingVisibilityCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo thermostatUserInterfaceConfigurationscheduleProgrammingVisibilityCommandParameterInfo = new CommandParameterInfo("value", int.class); writeThermostatUserInterfaceConfigurationScheduleProgrammingVisibilityCommandParams.put( "value", thermostatUserInterfaceConfigurationscheduleProgrammingVisibilityCommandParameterInfo); InteractionInfo writeThermostatUserInterfaceConfigurationScheduleProgrammingVisibilityAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ThermostatUserInterfaceConfigurationCluster) cluster) .writeScheduleProgrammingVisibilityAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeThermostatUserInterfaceConfigurationScheduleProgrammingVisibilityCommandParams); writeThermostatUserInterfaceConfigurationInteractionInfo.put( "writeScheduleProgrammingVisibilityAttribute", writeThermostatUserInterfaceConfigurationScheduleProgrammingVisibilityAttributeInteractionInfo); writeAttributeMap.put( "thermostatUserInterfaceConfiguration", writeThermostatUserInterfaceConfigurationInteractionInfo); Map<String, InteractionInfo> writeThreadNetworkDiagnosticsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("threadNetworkDiagnostics", writeThreadNetworkDiagnosticsInteractionInfo); Map<String, InteractionInfo> writeWakeOnLanInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("wakeOnLan", writeWakeOnLanInteractionInfo); Map<String, InteractionInfo> writeWiFiNetworkDiagnosticsInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("wiFiNetworkDiagnostics", writeWiFiNetworkDiagnosticsInteractionInfo); Map<String, InteractionInfo> writeWindowCoveringInteractionInfo = new LinkedHashMap<>(); Map<String, CommandParameterInfo> writeWindowCoveringModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); CommandParameterInfo windowCoveringmodeCommandParameterInfo = new CommandParameterInfo("value", int.class); writeWindowCoveringModeCommandParams.put("value", windowCoveringmodeCommandParameterInfo); InteractionInfo writeWindowCoveringModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.WindowCoveringCluster) cluster) .writeModeAttribute( (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); }, () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), writeWindowCoveringModeCommandParams); writeWindowCoveringInteractionInfo.put( "writeModeAttribute", writeWindowCoveringModeAttributeInteractionInfo); writeAttributeMap.put("windowCovering", writeWindowCoveringInteractionInfo); return writeAttributeMap; } }
public class ModelDuck extends Duck { public ModelDuck () { flyBehavior = new FlyNoWay (); quackBehavior = new Quack (); } public void display () { System.out.println ( "I'm a model duck"); } }
package com.slack.api.app_backend.dialogs.response; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @Builder @AllArgsConstructor @NoArgsConstructor public class Option { private String label; private String value; }
package com.udbac.versionpublish.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.udbac.versionpublish.entity.Version; import com.udbac.versionpublish.service.VersionService; import com.udbac.versionpublish.util.ResponseData; /** * * @author dundun.wang * @date 2019/10/11 */ @Controller @RequestMapping("/version") public class VersionController { @Autowired private VersionService versionService; /** * * @param version * @param token * @return {@link ResponseData} */ @RequestMapping("/createVersion") @ResponseBody public ResponseData insertVersion(@RequestBody Version version, @RequestHeader String token) { ResponseData responseData = versionService.insertVersion(version, token); return responseData; } /** * * @param version * @param token * @return {@link ResponseData} */ @ResponseBody @RequestMapping("/deleteVersion") public ResponseData deleteVersion(@RequestBody Version version, @RequestHeader String token) { ResponseData responseData = versionService.deleteVersion(version, token); return responseData; } /** * * @param version * @param token * @return {@link ResponseData} */ @ResponseBody @RequestMapping("/updateVersion") public ResponseData updateVersion(@RequestBody Version version, @RequestHeader String token) { ResponseData responseData = versionService.updateVersion(version, token); return responseData; } /** * 分页查找 * @param page * @return {@link ResponseData} */ @ResponseBody @RequestMapping("/findPage") public ResponseData findPagination(@PageableDefault(page = 0, size = 10, sort = { "versionDate" }) Pageable page) { ResponseData responseData = versionService.findPagination(page); return responseData; } /** * 上传文件 * @param file * @param version * @return */ @ResponseBody @PostMapping("/upload") public ResponseData handleFileUpload(@RequestPart MultipartFile file, String version) { ResponseData responseData = versionService.uploadFile(file, version); return responseData; } }
package com.megvii.zhimasdk.b.a.h; public class a { static { if (!a.class.desiredAssertionStatus()) {} for (boolean bool = true;; bool = false) { a = bool; return; } } public static byte[] a(byte[] paramArrayOfByte, int paramInt) { return a(paramArrayOfByte, 0, paramArrayOfByte.length, paramInt); } public static byte[] a(byte[] paramArrayOfByte, int paramInt1, int paramInt2, int paramInt3) { b localb = new b(paramInt3, new byte[paramInt2 * 3 / 4]); if (!localb.a(paramArrayOfByte, paramInt1, paramInt2, true)) { throw new IllegalArgumentException("bad base-64"); } if (localb.b == localb.a.length) { return localb.a; } paramArrayOfByte = new byte[localb.b]; System.arraycopy(localb.a, 0, paramArrayOfByte, 0, localb.b); return paramArrayOfByte; } public static byte[] b(byte[] paramArrayOfByte, int paramInt) { return b(paramArrayOfByte, 0, paramArrayOfByte.length, paramInt); } public static byte[] b(byte[] paramArrayOfByte, int paramInt1, int paramInt2, int paramInt3) { c localc = new c(paramInt3, null); int i = paramInt2 / 3 * 4; int j; if (localc.d) { paramInt3 = i; if (paramInt2 % 3 > 0) { paramInt3 = i + 4; } i = paramInt3; if (localc.e) { i = paramInt3; if (paramInt2 > 0) { j = (paramInt2 - 1) / 57; if (!localc.f) { break label186; } } } } label186: for (i = 2;; i = 1) { i = paramInt3 + i * (j + 1); localc.a = new byte[i]; localc.a(paramArrayOfByte, paramInt1, paramInt2, true); if ((a) || (localc.b == i)) { break label192; } throw new AssertionError(); paramInt3 = i; switch (paramInt2 % 3) { case 0: default: paramInt3 = i; break; case 1: paramInt3 = i + 2; break; case 2: paramInt3 = i + 3; break; } } label192: return localc.a; } static abstract class a { public byte[] a; public int b; } static class b extends a.a { private static final int[] c = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; private static final int[] d = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; private int e; private int f; private final int[] g; public b(int paramInt, byte[] paramArrayOfByte) { this.a = paramArrayOfByte; if ((paramInt & 0x8) == 0) {} for (paramArrayOfByte = c;; paramArrayOfByte = d) { this.g = paramArrayOfByte; this.e = 0; this.f = 0; return; } } public boolean a(byte[] paramArrayOfByte, int paramInt1, int paramInt2, boolean paramBoolean) { if (this.e == 6) { return false; } int i2 = paramInt2 + paramInt1; int j = this.e; paramInt2 = this.f; int i = 0; byte[] arrayOfByte = this.a; int[] arrayOfInt = this.g; int k; int m; int i1; if (paramInt1 < i2) { k = i; m = paramInt2; i1 = paramInt1; if (j == 0) { int n = paramInt1; for (paramInt1 = paramInt2; n + 4 <= i2; paramInt1 = paramInt2) { paramInt2 = arrayOfInt[(paramArrayOfByte[n] & 0xFF)] << 18 | arrayOfInt[(paramArrayOfByte[(n + 1)] & 0xFF)] << 12 | arrayOfInt[(paramArrayOfByte[(n + 2)] & 0xFF)] << 6 | arrayOfInt[(paramArrayOfByte[(n + 3)] & 0xFF)]; paramInt1 = paramInt2; if (paramInt2 < 0) { break; } arrayOfByte[(i + 2)] = ((byte)paramInt2); arrayOfByte[(i + 1)] = ((byte)(paramInt2 >> 8)); arrayOfByte[i] = ((byte)(paramInt2 >> 16)); i += 3; n += 4; } k = i; m = paramInt1; i1 = n; if (n >= i2) { paramInt2 = paramInt1; } } } for (;;) { if (!paramBoolean) { this.e = j; this.f = paramInt2; this.b = i; return true; paramInt2 = arrayOfInt[(paramArrayOfByte[i1] & 0xFF)]; switch (j) { } label292: label577: do { do { paramInt1 = j; paramInt2 = m; i = k; for (;;) { j = paramInt1; paramInt1 = i1 + 1; break; if (paramInt2 >= 0) { paramInt1 = j + 1; i = k; } else { if (paramInt2 == -1) { break label292; } this.e = 6; return false; if (paramInt2 >= 0) { paramInt2 = m << 6 | paramInt2; paramInt1 = j + 1; i = k; } else { if (paramInt2 == -1) { break label292; } this.e = 6; return false; if (paramInt2 >= 0) { paramInt2 = m << 6 | paramInt2; paramInt1 = j + 1; i = k; } else if (paramInt2 == -2) { arrayOfByte[k] = ((byte)(m >> 4)); paramInt1 = 4; i = k + 1; paramInt2 = m; } else { if (paramInt2 == -1) { break label292; } this.e = 6; return false; if (paramInt2 >= 0) { paramInt2 = m << 6 | paramInt2; arrayOfByte[(k + 2)] = ((byte)paramInt2); arrayOfByte[(k + 1)] = ((byte)(paramInt2 >> 8)); arrayOfByte[k] = ((byte)(paramInt2 >> 16)); i = k + 3; paramInt1 = 0; } else if (paramInt2 == -2) { arrayOfByte[(k + 1)] = ((byte)(m >> 2)); arrayOfByte[k] = ((byte)(m >> 10)); i = k + 2; paramInt1 = 5; paramInt2 = m; } else { if (paramInt2 == -1) { break label292; } this.e = 6; return false; if (paramInt2 != -2) { break label577; } paramInt1 = j + 1; i = k; paramInt2 = m; } } } } } } while (paramInt2 == -1); this.e = 6; return false; } while (paramInt2 == -1); this.e = 6; return false; } paramInt1 = i; switch (j) { default: paramInt1 = i; case 0: case 1: case 2: case 3: for (;;) { this.e = j; this.b = paramInt1; return true; this.e = 6; return false; arrayOfByte[i] = ((byte)(paramInt2 >> 4)); paramInt1 = i + 1; continue; k = i + 1; arrayOfByte[i] = ((byte)(paramInt2 >> 10)); paramInt1 = k + 1; arrayOfByte[k] = ((byte)(paramInt2 >> 2)); } } this.e = 6; return false; } } } static class c extends a.a { private static final byte[] h; private static final byte[] i; int c; public final boolean d; public final boolean e; public final boolean f; private final byte[] j; private int k; private final byte[] l; static { if (!a.class.desiredAssertionStatus()) {} for (boolean bool = true;; bool = false) { g = bool; h = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47 }; i = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95 }; return; } } public c(int paramInt, byte[] paramArrayOfByte) { this.a = paramArrayOfByte; boolean bool1; if ((paramInt & 0x1) == 0) { bool1 = true; this.d = bool1; if ((paramInt & 0x2) != 0) { break label101; } bool1 = true; label33: this.e = bool1; if ((paramInt & 0x4) == 0) { break label106; } bool1 = bool2; label47: this.f = bool1; if ((paramInt & 0x8) != 0) { break label111; } paramArrayOfByte = h; label63: this.l = paramArrayOfByte; this.j = new byte[2]; this.c = 0; if (!this.e) { break label118; } } label101: label106: label111: label118: for (paramInt = 19;; paramInt = -1) { this.k = paramInt; return; bool1 = false; break; bool1 = false; break label33; bool1 = false; break label47; paramArrayOfByte = i; break label63; } } public boolean a(byte[] paramArrayOfByte, int paramInt1, int paramInt2, boolean paramBoolean) { byte[] arrayOfByte1 = this.l; byte[] arrayOfByte2 = this.a; int m = 0; int i2 = this.k; int i4 = paramInt2 + paramInt1; int i1 = -1; label62: int n; switch (this.c) { default: paramInt2 = paramInt1; paramInt1 = i2; n = paramInt2; if (i1 != -1) { arrayOfByte2[0] = arrayOfByte1[(i1 >> 18 & 0x3F)]; arrayOfByte2[1] = arrayOfByte1[(i1 >> 12 & 0x3F)]; arrayOfByte2[2] = arrayOfByte1[(i1 >> 6 & 0x3F)]; m = 4; arrayOfByte2[3] = arrayOfByte1[(i1 & 0x3F)]; i1 = i2 - 1; paramInt1 = i1; n = paramInt2; if (i1 == 0) { if (!this.f) { break label1226; } paramInt1 = 5; arrayOfByte2[4] = 13; } } break; } for (;;) { arrayOfByte2[paramInt1] = 10; n = 19; paramInt1 += 1; for (;;) { label180: if (paramInt2 + 3 <= i4) { m = (paramArrayOfByte[paramInt2] & 0xFF) << 16 | (paramArrayOfByte[(paramInt2 + 1)] & 0xFF) << 8 | paramArrayOfByte[(paramInt2 + 2)] & 0xFF; arrayOfByte2[paramInt1] = arrayOfByte1[(m >> 18 & 0x3F)]; arrayOfByte2[(paramInt1 + 1)] = arrayOfByte1[(m >> 12 & 0x3F)]; arrayOfByte2[(paramInt1 + 2)] = arrayOfByte1[(m >> 6 & 0x3F)]; arrayOfByte2[(paramInt1 + 3)] = arrayOfByte1[(m & 0x3F)]; paramInt2 += 3; i1 = paramInt1 + 4; i2 = n - 1; paramInt1 = i2; m = i1; n = paramInt2; if (i2 != 0) { break label1210; } if (!this.f) { break label1204; } paramInt1 = i1 + 1; arrayOfByte2[i1] = 13; } for (;;) { arrayOfByte2[paramInt1] = 10; n = 19; paramInt1 += 1; break label180; paramInt2 = paramInt1; break label62; if (paramInt1 + 2 > i4) { break; } n = this.j[0]; paramInt2 = paramInt1 + 1; i1 = (n & 0xFF) << 16 | (paramArrayOfByte[paramInt1] & 0xFF) << 8 | paramArrayOfByte[paramInt2] & 0xFF; this.c = 0; paramInt2 += 1; break label62; if (paramInt1 + 1 > i4) { break; } n = this.j[0]; i1 = this.j[1]; paramInt2 = paramInt1 + 1; i1 = (n & 0xFF) << 16 | (i1 & 0xFF) << 8 | paramArrayOfByte[paramInt1] & 0xFF; this.c = 0; break label62; label742: int i3; if (paramBoolean) { if (paramInt2 - this.c == i4 - 1) { if (this.c > 0) { paramArrayOfByte = this.j; m = 1; i1 = paramArrayOfByte[0]; } for (;;) { i1 = (i1 & 0xFF) << 4; this.c -= m; i2 = paramInt1 + 1; arrayOfByte2[paramInt1] = arrayOfByte1[(i1 >> 6 & 0x3F)]; m = i2 + 1; arrayOfByte2[i2] = arrayOfByte1[(i1 & 0x3F)]; paramInt1 = m; if (this.d) { i1 = m + 1; arrayOfByte2[m] = 61; paramInt1 = i1 + 1; arrayOfByte2[i1] = 61; } m = paramInt1; if (this.e) { m = paramInt1; if (this.f) { arrayOfByte2[paramInt1] = 13; m = paramInt1 + 1; } arrayOfByte2[m] = 10; m += 1; } i1 = paramInt2; if ((g) || (this.c == 0)) { break; } throw new AssertionError(); i1 = paramArrayOfByte[paramInt2]; paramInt2 += 1; m = 0; } } if (paramInt2 - this.c == i4 - 2) { if (this.c > 1) { byte[] arrayOfByte3 = this.j; i2 = 1; i1 = arrayOfByte3[0]; m = paramInt2; paramInt2 = i2; if (this.c <= 0) { break label946; } i2 = this.j[paramInt2]; i3 = paramInt2 + 1; paramInt2 = m; m = i3; label769: i1 = (i2 & 0xFF) << 2 | (i1 & 0xFF) << 10; this.c -= m; m = paramInt1 + 1; arrayOfByte2[paramInt1] = arrayOfByte1[(i1 >> 12 & 0x3F)]; i2 = m + 1; arrayOfByte2[m] = arrayOfByte1[(i1 >> 6 & 0x3F)]; paramInt1 = i2 + 1; arrayOfByte2[i2] = arrayOfByte1[(i1 & 0x3F)]; if (!this.d) { break label1201; } m = paramInt1 + 1; arrayOfByte2[paramInt1] = 61; paramInt1 = m; } } } label946: label1123: label1201: for (;;) { m = paramInt1; if (this.e) { m = paramInt1; if (this.f) { arrayOfByte2[paramInt1] = 13; m = paramInt1 + 1; } arrayOfByte2[m] = 10; m += 1; } i1 = paramInt2; break; i1 = paramArrayOfByte[paramInt2]; m = paramInt2 + 1; paramInt2 = 0; break label742; i2 = paramArrayOfByte[m]; i3 = m + 1; m = paramInt2; paramInt2 = i3; break label769; i1 = paramInt2; m = paramInt1; if (!this.e) { break; } i1 = paramInt2; m = paramInt1; if (paramInt1 <= 0) { break; } i1 = paramInt2; m = paramInt1; if (n == 19) { break; } if (this.f) { m = paramInt1 + 1; arrayOfByte2[paramInt1] = 13; paramInt1 = m; } for (;;) { m = paramInt1 + 1; arrayOfByte2[paramInt1] = 10; i1 = paramInt2; break; i2 = m; if (!g) { i2 = m; if (i1 != i4) { throw new AssertionError(); if (paramInt2 != i4 - 1) { break label1123; } arrayOfByte1 = this.j; m = this.c; this.c = (m + 1); arrayOfByte1[m] = paramArrayOfByte[paramInt2]; i2 = paramInt1; } } for (;;) { this.b = i2; this.k = n; return true; i2 = paramInt1; if (paramInt2 == i4 - 2) { arrayOfByte1 = this.j; m = this.c; this.c = (m + 1); arrayOfByte1[m] = paramArrayOfByte[paramInt2]; arrayOfByte1 = this.j; m = this.c; this.c = (m + 1); arrayOfByte1[m] = paramArrayOfByte[(paramInt2 + 1)]; i2 = paramInt1; } } } } label1204: paramInt1 = i1; } label1210: i1 = paramInt1; paramInt1 = m; paramInt2 = n; n = i1; } label1226: paramInt1 = 4; } } } } /* Location: /Users/gaoht/Downloads/zirom/classes2-dex2jar.jar!/com/megvii/zhimasdk/b/a/h/a.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
package com.tom.cpm.shared.definition; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import com.tom.cpm.shared.io.IOHelper; public class Link { protected String loader; protected String path; public Link(IOHelper in) throws IOException { int pathLen = in.read(); byte[] path = new byte[pathLen]; in.readFully(path); String[] sp = new String(path).split(":"); loader = sp[0]; this.path = sp[1]; } public Link(String loader, String path) { this.loader = loader; this.path = path; } public Link(String fullPath) { String[] sp = fullPath.split(":", 2); this.loader = sp[0]; this.path = sp[1]; } public void write(IOHelper dout) throws IOException { byte[] path = (loader + ":" + this.path).getBytes(); dout.write(path.length); dout.write(path); } @Override public String toString() { return loader + ":" + this.path; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((loader == null) ? 0 : loader.hashCode()); result = prime * result + ((path == null) ? 0 : path.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Link other = (Link) obj; if (loader == null) { if (other.loader != null) return false; } else if (!loader.equals(other.loader)) return false; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; return true; } public static class ResolvedLink { private byte[] data; private IOException error; public ResolvedLink(IOException error) { this.error = error; } public ResolvedLink(byte[] data) { this.data = data; } public InputStream getData() throws IOException { if(error != null)throw error; return new ByteArrayInputStream(data); } } }
/** * Copyright 2015-2017 Red Hat, Inc, and individual contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wildfly.swarm.ee.runtime; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Instance; import javax.inject.Inject; import org.wildfly.swarm.config.MessagingActiveMQ; import org.wildfly.swarm.config.ee.DefaultBindingsService; import org.wildfly.swarm.ee.EEFraction; import org.wildfly.swarm.spi.api.Customizer; import org.wildfly.swarm.spi.runtime.annotations.Pre; /** * @author Bob McWhirter */ @Pre @ApplicationScoped public class DefaultBindingCustomizer implements Customizer { @Inject private Instance<MessagingActiveMQ> messaging; @Inject private EEFraction fraction; @Override public void customize() { if (!this.messaging.isUnsatisfied()) { if (this.fraction.subresources().defaultBindingsService() == null) { this.fraction.defaultBindingsService(new DefaultBindingsService()); } if (this.fraction.subresources().defaultBindingsService().jmsConnectionFactory() == null) { this.fraction.subresources().defaultBindingsService() .jmsConnectionFactory("java:jboss/DefaultJMSConnectionFactory"); } } } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.kylin.stream.coordinator.coordinate; import org.apache.kylin.shaded.com.google.common.collect.Lists; import org.apache.curator.test.TestingServer; import org.apache.kylin.common.KylinConfig; import org.apache.kylin.common.util.LocalFileMetadataTestCase; import org.apache.kylin.common.util.ZKUtil; import org.apache.kylin.cube.CubeInstance; import org.apache.kylin.cube.CubeManager; import org.apache.kylin.cube.CubeSegment; import org.apache.kylin.engine.mr.CubingJob; import org.apache.kylin.job.execution.ExecutableManager; import org.apache.kylin.job.execution.ExecutableState; import org.apache.kylin.metadata.model.SegmentRange; import org.apache.kylin.metadata.model.SegmentStatusEnum; import org.apache.kylin.metadata.model.Segments; import org.apache.kylin.stream.coordinator.StreamMetadataStore; import org.apache.kylin.stream.coordinator.StreamMetadataStoreFactory; import org.apache.kylin.stream.coordinator.StreamingUtils; import org.apache.kylin.stream.coordinator.ZookeeperStreamMetadataStore; import org.apache.kylin.stream.core.model.CubeAssignment; import org.apache.kylin.stream.core.model.Node; import org.apache.kylin.stream.core.model.ReplicaSet; import org.apache.kylin.stream.core.model.SegmentBuildState; import org.apache.kylin.stream.core.source.Partition; import org.apache.kylin.stream.source.kafka.KafkaPosition; import org.apache.kylin.stream.source.kafka.KafkaPositionHandler; import org.junit.After; import org.junit.Assume; import org.junit.Before; import org.mockito.Matchers; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Make create stub easier. */ public class StreamingTestBase extends LocalFileMetadataTestCase { private static final Logger logger = LoggerFactory.getLogger(StreamingTestBase.class); private static final int port = 12181; private static final int retryTimes = 10; private String connectStr; /** * mock zookeeper server for streaming metadata */ TestingServer testingServer; /** * Real StreamMetadataStore based on fake zookeeper server */ StreamMetadataStore metadataStore; @Before public void init() { logger.debug("Start zk and prepare meatdata."); staticCreateTestMetadata(); int realPort = port; for (int i = 0; i <= retryTimes; i++) { try { testingServer = new TestingServer(realPort, false); testingServer.start(); } catch (Exception e) { // maybe caused by port occupy logger.error("Failed start zookeeper server at " + realPort, e); realPort++; continue; } break; } Assume.assumeTrue(realPort - port < retryTimes); connectStr = "localhost:" + realPort; System.setProperty("kylin.env.zookeeper-connect-string", connectStr); metadataStore = StreamMetadataStoreFactory.getZKStreamMetaDataStore(); initZookeeperMetadataStore(); } @After public void tearDown() throws Exception { logger.debug("Tear down server."); ZKUtil.cleanZkPath(StreamingUtils.STREAM_ZK_ROOT); ((ZookeeperStreamMetadataStore) metadataStore).close(); testingServer.stop(); System.clearProperty("kylin.env.zookeeper-connect-string"); } // ================================================================================ // ================================ Init Metadata ================================= // replica set info ReplicaSet rs1 = new ReplicaSet(); ReplicaSet rs2 = new ReplicaSet(); ReplicaSet rs3 = new ReplicaSet(); ReplicaSet rs4 = new ReplicaSet(); // receiver info Node n1 = new Node("Node-1", 1000); Node n2 = new Node("Node-2", 1000); Node n3 = new Node("Node-3", 1000); Node n4 = new Node("Node-4", 1000); Node n5 = new Node("Node-5", 1000); Node n6 = new Node("Node-6", 1000); Node n7 = new Node("Node-7", 1000); Node n8 = new Node("Node-8", 1000); // cube info String cubeName1 = "MockRealtimeCube_1"; String cubeName2 = "MockRealtimeCube_2"; String cubeName3 = "MockRealtimeCube_3"; String cubeName4 = "MockRealtimeCube_4"; // cube segment info String segment1 = "20190601120000_20190601130000"; String segment2 = "20190601130000_20190601140000"; // topic partition info Partition p1 = new Partition(1); Partition p2 = new Partition(2); Partition p3 = new Partition(3); Partition p4 = new Partition(4); Partition p5 = new Partition(5); Partition p6 = new Partition(6); String mockBuildJob1 = "mock_job_00001"; String mockBuildJob2 = "mock_job_00002"; String mockBuildJob3 = "mock_job_00003"; String mockBuildJob4 = "mock_job_00004"; private void initZookeeperMetadataStore() { // add receiver metadataStore.addReceiver(n1); metadataStore.addReceiver(n2); metadataStore.addReceiver(n3); metadataStore.addReceiver(n4); metadataStore.addReceiver(n5); metadataStore.addReceiver(n6); metadataStore.addReceiver(n7); metadataStore.addReceiver(n8); // add replica set and allocate receivers to replica set rs1.addNode(n1); rs1.addNode(n2); rs2.addNode(n3); rs2.addNode(n4); rs3.addNode(n5); rs3.addNode(n6); rs4.addNode(n7); rs4.addNode(n8); int rsId; rsId = metadataStore.createReplicaSet(rs1); rs1.setReplicaSetID(rsId); rsId = metadataStore.createReplicaSet(rs2); rs2.setReplicaSetID(rsId); rsId = metadataStore.createReplicaSet(rs3); rs3.setReplicaSetID(rsId); rsId = metadataStore.createReplicaSet(rs4); rs4.setReplicaSetID(rsId); createCubeMetadata(cubeName1, mockBuildJob1, true); createCubeMetadata(cubeName2, mockBuildJob2, false); createCubeMetadata(cubeName3, mockBuildJob3, true); createCubeMetadata(cubeName4, mockBuildJob4, true); } public void createCubeMetadata(String cubeName, String jobID, boolean addSegmentBuildState) { // add assignment for cube Map<Integer, List<Partition>> preAssignMap = new HashMap<>(); preAssignMap.put(rs1.getReplicaSetID(), Lists.newArrayList(p1, p2)); preAssignMap.put(rs2.getReplicaSetID(), Lists.newArrayList(p3, p4)); preAssignMap.put(rs3.getReplicaSetID(), Lists.newArrayList(p5, p6)); CubeAssignment originalAssignment = new CubeAssignment(cubeName, preAssignMap); metadataStore.saveNewCubeAssignment(originalAssignment); // add remote checkpoint for segment1 // check StreamingServer#sendSegmentsToFullBuild KafkaPositionHandler kafkaPositionHandler = new KafkaPositionHandler(); Map<Integer, Long> positionMap = new HashMap<>(); positionMap.put(p1.getPartitionId(), 10001L); positionMap.put(p2.getPartitionId(), 10002L); String positionStr = kafkaPositionHandler.serializePosition(new KafkaPosition(positionMap)); metadataStore.saveSourceCheckpoint(cubeName, segment1, rs1.getReplicaSetID(), positionStr); positionMap.clear(); positionMap.put(p3.getPartitionId(), 10003L); positionMap.put(p4.getPartitionId(), 10004L); positionStr = kafkaPositionHandler.serializePosition(new KafkaPosition(positionMap)); metadataStore.saveSourceCheckpoint(cubeName, segment1, rs2.getReplicaSetID(), positionStr); positionMap.clear(); positionMap.put(p5.getPartitionId(), 10005L); positionMap.put(p6.getPartitionId(), 10006L); positionStr = kafkaPositionHandler.serializePosition(new KafkaPosition(positionMap)); metadataStore.saveSourceCheckpoint(cubeName, segment1, rs3.getReplicaSetID(), positionStr); positionMap.clear(); positionMap.put(p1.getPartitionId(), 20001L); positionMap.put(p2.getPartitionId(), 20002L); positionStr = kafkaPositionHandler.serializePosition(new KafkaPosition(positionMap)); metadataStore.saveSourceCheckpoint(cubeName, segment2, rs1.getReplicaSetID(), positionStr); // notify by replica set data has been uploaded metadataStore.addCompleteReplicaSetForSegmentBuild(cubeName, segment1, rs1.getReplicaSetID()); metadataStore.addCompleteReplicaSetForSegmentBuild(cubeName, segment1, rs2.getReplicaSetID()); metadataStore.addCompleteReplicaSetForSegmentBuild(cubeName, segment1, rs3.getReplicaSetID()); metadataStore.addCompleteReplicaSetForSegmentBuild(cubeName, segment2, rs1.getReplicaSetID()); if (addSegmentBuildState) { // update segment build job info SegmentBuildState.BuildState buildState = new SegmentBuildState.BuildState(); buildState.setBuildStartTime(System.currentTimeMillis() - 30 * 60 * 1000);// submit 30 minutes ago buildState.setJobId(jobID); buildState.setState(SegmentBuildState.BuildState.State.BUILDING); metadataStore.updateSegmentBuildState(cubeName, segment1, buildState); } } // ================================================================================ // ============================= Prepare stub object ============================== CubingJob stubCubingJob(ExecutableState state) { CubingJob job = mock(CubingJob.class); when(job.getStatus()).thenReturn(state); return job; } ReceiverClusterManager stubReceiverClusterManager(StreamingCoordinator coordinator) { ReceiverClusterManager clusterManager = mock(ReceiverClusterManager.class); when(clusterManager.getCoordinator()).thenReturn(coordinator); return clusterManager; } KylinConfig stubKylinConfig() { KylinConfig kylinConfig = mock(KylinConfig.class); when(kylinConfig.getMaxBuildingSegments()).thenReturn(10); when(kylinConfig.getStreamingAssigner()).thenReturn("DefaultAssigner"); // ZK part when(kylinConfig.getZKBaseSleepTimeMs()).thenReturn(5000); when(kylinConfig.getZKMaxRetries()).thenReturn(3); when(kylinConfig.getZookeeperConnectString()).thenReturn(connectStr); return kylinConfig; } StreamingCoordinator stubStreamingCoordinator(KylinConfig config, CubeManager cubeManager, ExecutableManager executableManager) { StreamingCoordinator coordinator = mock(StreamingCoordinator.class); when(coordinator.getConfig()).thenReturn(config); when(coordinator.getCubeManager()).thenReturn(cubeManager); when(coordinator.getExecutableManager()).thenReturn(executableManager); when(coordinator.getStreamMetadataStore()).thenReturn(metadataStore); return coordinator; } ExecutableManager stubExecutableManager(Map<String, CubingJob> cubingJobMap) { ExecutableManager executableManager = mock(ExecutableManager.class); for (Map.Entry<String, CubingJob> entry : cubingJobMap.entrySet()) { when(executableManager.getJob(eq(entry.getKey()))).thenReturn(entry.getValue()); } return executableManager; } CubeManager stubCubeManager(CubeInstance cubeInstance, boolean promotedNewSegmentFailed) { CubeManager cubeManager = mock(CubeManager.class); try { when(cubeManager.getCube(anyString())).thenReturn(cubeInstance); if (promotedNewSegmentFailed) { doThrow(RuntimeException.class).when(cubeManager).promoteNewlyBuiltSegments(any(CubeInstance.class), any(CubeSegment.class)); } else { doNothing().when(cubeManager).promoteNewlyBuiltSegments(any(CubeInstance.class), any(CubeSegment.class)); } doNothing().when(cubeManager).promoteNewlyBuiltSegments(any(CubeInstance.class), any(CubeSegment.class)); } catch (IOException ioe) { // a ugly workaroud for mock method with declaration of throwing checked exception } return cubeManager; } CubeInstance stubCubeInstance(CubeSegment cubSegment) { CubeInstance cubeInstance = mock(CubeInstance.class); CubeSegment readySegment = stubCubSegment(SegmentStatusEnum.READY, 0L, 1L); when(cubeInstance.latestCopyForWrite()).thenReturn(cubeInstance); @SuppressWarnings("unchecked") Segments<CubeSegment> segmentSegments = mock(Segments.class, RETURNS_DEEP_STUBS); Segments<CubeSegment> optimizedSegments = mock(Segments.class, RETURNS_DEEP_STUBS); when(segmentSegments.size()).thenReturn(1); when(cubeInstance.getBuildingSegments()).thenReturn(segmentSegments); when(cubeInstance.getName()).thenReturn(cubeName1); when(cubeInstance.getSegment(anyString(), Matchers.any())).thenReturn(cubSegment); when(optimizedSegments.size()).thenReturn(0); when(cubeInstance.getLatestReadySegment()).thenReturn(readySegment); when(cubeInstance.getSegments(SegmentStatusEnum.READY_PENDING)).thenReturn(optimizedSegments); when(cubeInstance.getSegments(SegmentStatusEnum.NEW)).thenReturn(segmentSegments); return cubeInstance; } CubeSegment stubCubSegment(SegmentStatusEnum statusEnum, long leftRange, long rightRange) { CubeSegment cubeSegment = mock(CubeSegment.class); when(cubeSegment.getTSRange()).thenReturn(new SegmentRange.TSRange(leftRange, rightRange)); when(cubeSegment.getStatus()).thenReturn(statusEnum); return cubeSegment; } }
/* * Copyright 2021 ALE International * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons * to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.ale.o2g.internal.util; import java.util.ArrayList; import java.util.EventListener; import java.util.HashMap; import java.util.List; import java.util.Map; /** * * */ public class EventListenersMap { private Map<Class<? extends EventListener>, List<EventListener>> mapEventListeners = new HashMap<Class<? extends EventListener>, List<EventListener>>(); public void add(Class<? extends EventListener> type, EventListener eventListener) { if (!mapEventListeners.containsKey(type)) { mapEventListeners.put(type, new ArrayList<EventListener>()); } mapEventListeners.get(type).add(eventListener); } public List<EventListener> getListeners(Class<? extends EventListener> type) { if (mapEventListeners.containsKey(type)) { return mapEventListeners.get(type); } else { return null; } } }
package com.salesmanager.shop.store.controller.system; import com.salesmanager.core.business.exception.ServiceException; import com.salesmanager.core.business.services.system.MerchantConfigurationService; import com.salesmanager.core.model.merchant.MerchantStore; import com.salesmanager.core.model.reference.language.Language; import com.salesmanager.core.model.system.MerchantConfig; import com.salesmanager.core.model.system.MerchantConfiguration; import com.salesmanager.shop.constants.Constants; import com.salesmanager.shop.model.system.Configs; import com.salesmanager.shop.store.api.exception.ServiceRuntimeException; import java.util.Optional; import javax.inject.Inject; import org.springframework.stereotype.Service; import static com.salesmanager.shop.constants.Constants.KEY_FACEBOOK_PAGE_URL; import static com.salesmanager.shop.constants.Constants.KEY_GOOGLE_ANALYTICS_URL; import static com.salesmanager.shop.constants.Constants.KEY_INSTAGRAM_URL; import static com.salesmanager.shop.constants.Constants.KEY_PINTEREST_PAGE_URL; @Service public class MerchantConfigurationFacadeImpl implements MerchantConfigurationFacade { @Inject private MerchantConfigurationService merchantConfigurationService; @Override public Configs getMerchantConfig(MerchantStore merchantStore, Language language) { MerchantConfig configs = getMerchantConfig(merchantStore); Configs readableConfig = new Configs(); readableConfig.setAllowOnlinePurchase(configs.isAllowPurchaseItems()); readableConfig.setDisplaySearchBox(configs.isDisplaySearchBox()); readableConfig.setDisplayContactUs(configs.isDisplayContactUs()); Optional<String> facebookConfigValue = getConfigValue(KEY_FACEBOOK_PAGE_URL, merchantStore); facebookConfigValue.ifPresent(readableConfig::setFacebook); Optional<String> googleConfigValue = getConfigValue(KEY_GOOGLE_ANALYTICS_URL, merchantStore); googleConfigValue.ifPresent(readableConfig::setGa); Optional<String> instagramConfigValue = getConfigValue(KEY_INSTAGRAM_URL, merchantStore); instagramConfigValue.ifPresent(readableConfig::setInstagram); Optional<String> pinterestConfigValue = getConfigValue(KEY_PINTEREST_PAGE_URL, merchantStore); pinterestConfigValue.ifPresent(readableConfig::setPinterest); return readableConfig; } private MerchantConfig getMerchantConfig(MerchantStore merchantStore) { try{ return merchantConfigurationService.getMerchantConfig(merchantStore); } catch (ServiceException e){ throw new ServiceRuntimeException(e); } } private Optional<String> getConfigValue(String keyContant, MerchantStore merchantStore) { return getMerchantConfiguration(keyContant, merchantStore) .map(MerchantConfiguration::getValue); } private Optional<MerchantConfiguration> getMerchantConfiguration(String key, MerchantStore merchantStore) { try{ return Optional.ofNullable(merchantConfigurationService.getMerchantConfiguration(key, merchantStore)); } catch (ServiceException e) { throw new ServiceRuntimeException(e); } } }
/* * Copyright (C) 2011 University of Washington * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package org.odk.collect.android.utilities; import android.content.SharedPreferences; import android.net.Uri; import android.preference.PreferenceManager; import android.text.format.DateFormat; import android.util.Log; import org.kxml2.io.KXmlParser; import org.kxml2.kdom.Document; import org.odk.collect.android.BuildConfig; import org.odk.collect.android.R; import org.odk.collect.android.application.Collect; import org.odk.collect.android.preferences.PreferenceKeys; import org.opendatakit.httpclientandroidlib.Header; import org.opendatakit.httpclientandroidlib.HttpEntity; import org.opendatakit.httpclientandroidlib.HttpHost; import org.opendatakit.httpclientandroidlib.HttpRequest; import org.opendatakit.httpclientandroidlib.HttpResponse; import org.opendatakit.httpclientandroidlib.HttpStatus; import org.opendatakit.httpclientandroidlib.auth.AuthScope; import org.opendatakit.httpclientandroidlib.auth.Credentials; import org.opendatakit.httpclientandroidlib.auth.UsernamePasswordCredentials; import org.opendatakit.httpclientandroidlib.client.AuthCache; import org.opendatakit.httpclientandroidlib.client.CredentialsProvider; import org.opendatakit.httpclientandroidlib.client.HttpClient; import org.opendatakit.httpclientandroidlib.client.config.AuthSchemes; import org.opendatakit.httpclientandroidlib.client.config.CookieSpecs; import org.opendatakit.httpclientandroidlib.client.config.RequestConfig; import org.opendatakit.httpclientandroidlib.client.methods.HttpGet; import org.opendatakit.httpclientandroidlib.client.methods.HttpHead; import org.opendatakit.httpclientandroidlib.client.methods.HttpPost; import org.opendatakit.httpclientandroidlib.client.protocol.HttpClientContext; import org.opendatakit.httpclientandroidlib.config.SocketConfig; import org.opendatakit.httpclientandroidlib.impl.auth.BasicScheme; import org.opendatakit.httpclientandroidlib.impl.client.BasicAuthCache; import org.opendatakit.httpclientandroidlib.impl.client.CloseableHttpClient; import org.opendatakit.httpclientandroidlib.impl.client.HttpClientBuilder; import org.opendatakit.httpclientandroidlib.protocol.HttpContext; import org.xmlpull.v1.XmlPullParser; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.Locale; import java.util.TimeZone; import java.util.zip.GZIPInputStream; /** * Common utility methods for managing the credentials associated with the * request context and constructing http context, client and request with the * proper parameters and OpenRosa headers. * * @author mitchellsundt@gmail.com */ public final class WebUtils { public static final String t = "WebUtils"; private static final String USER_AGENT_HEADER = "User-Agent"; public static final String OPEN_ROSA_VERSION_HEADER = "X-OpenRosa-Version"; public static final String OPEN_ROSA_VERSION = "1.0"; private static final String DATE_HEADER = "Date"; public static final String HTTP_CONTENT_TYPE_TEXT_XML = "text/xml"; public static final int CONNECTION_TIMEOUT = 30000; public static final String ACCEPT_ENCODING_HEADER = "Accept-Encoding"; public static final String GZIP_CONTENT_ENCODING = "gzip"; public static final List<AuthScope> buildAuthScopes(String host) { List<AuthScope> asList = new ArrayList<AuthScope>(); AuthScope a; // allow digest auth on any port... a = new AuthScope(host, -1, null, AuthSchemes.DIGEST); asList.add(a); // and allow basic auth on the standard TLS/SSL ports... a = new AuthScope(host, 443, null, AuthSchemes.BASIC); asList.add(a); a = new AuthScope(host, 8443, null, AuthSchemes.BASIC); asList.add(a); return asList; } public static final void clearAllCredentials() { CredentialsProvider credsProvider = Collect.getInstance() .getCredentialsProvider(); Log.i(t, "clearAllCredentials"); credsProvider.clear(); } public static final boolean hasCredentials(String userEmail, String host) { CredentialsProvider credsProvider = Collect.getInstance() .getCredentialsProvider(); List<AuthScope> asList = buildAuthScopes(host); boolean hasCreds = true; for (AuthScope a : asList) { Credentials c = credsProvider.getCredentials(a); if (c == null) { hasCreds = false; continue; } } return hasCreds; } /** * Remove all credentials for accessing the specified host. */ public static final void clearHostCredentials(String host) { CredentialsProvider credsProvider = Collect.getInstance() .getCredentialsProvider(); Log.i(t, "clearHostCredentials: " + host); List<AuthScope> asList = buildAuthScopes(host); for (AuthScope a : asList) { credsProvider.setCredentials(a, null); } } /** * Remove all credentials for accessing the specified host and, if the * username is not null or blank then add a (username, password) credential * for accessing this host. */ public static final void addCredentials(String username, String password, String host) { // to ensure that this is the only authentication available for this // host... clearHostCredentials(host); if (username != null && username.trim().length() != 0) { Log.i(t, "adding credential for host: " + host + " username:" + username); Credentials c = new UsernamePasswordCredentials(username, password); addCredentials(c, host); } } private static final void addCredentials(Credentials c, String host) { CredentialsProvider credsProvider = Collect.getInstance() .getCredentialsProvider(); List<AuthScope> asList = buildAuthScopes(host); for (AuthScope a : asList) { credsProvider.setCredentials(a, c); } } public static final void enablePreemptiveBasicAuth( HttpContext localContext, String host) { AuthCache ac = (AuthCache) localContext .getAttribute(HttpClientContext.AUTH_CACHE); HttpHost h = new HttpHost(host); if (ac == null) { ac = new BasicAuthCache(); localContext.setAttribute(HttpClientContext.AUTH_CACHE, ac); } List<AuthScope> asList = buildAuthScopes(host); for (AuthScope a : asList) { if (a.getScheme().equalsIgnoreCase(AuthSchemes.BASIC)) { ac.put(h, new BasicScheme()); } } } private static final void setCollectHeaders(HttpRequest req) { String userAgent = String.format("%s %s/%s", System.getProperty("http.agent"), BuildConfig.APPLICATION_ID, BuildConfig.VERSION_NAME); req.setHeader(USER_AGENT_HEADER, userAgent); } private static final void setOpenRosaHeaders(HttpRequest req) { req.setHeader(OPEN_ROSA_VERSION_HEADER, OPEN_ROSA_VERSION); GregorianCalendar g = new GregorianCalendar(TimeZone.getTimeZone("GMT")); g.setTime(new Date()); req.setHeader(DATE_HEADER, DateFormat.format("E, dd MMM yyyy hh:mm:ss zz", g).toString()); } public static final HttpHead createOpenRosaHttpHead(Uri u) { HttpHead req = new HttpHead(URI.create(u.toString())); setCollectHeaders(req); setOpenRosaHeaders(req); return req; } public static final HttpGet createOpenRosaHttpGet(URI uri) { HttpGet req = new HttpGet(); setCollectHeaders(req); setOpenRosaHeaders(req); setGoogleHeaders(req); req.setURI(uri); return req; } public static final void setGoogleHeaders(HttpRequest req) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences( Collect.getInstance().getApplicationContext()); String protocol = settings.getString(PreferenceKeys.KEY_PROTOCOL, Collect.getInstance().getString(R.string.protocol_odk_default)); // TODO: this doesn't exist.... // if ( protocol.equals(PreferencesActivity.PROTOCOL_GOOGLE) ) { // String auth = settings.getString(PreferencesActivity.KEY_AUTH, ""); // if ((auth != null) && (auth.length() > 0)) { // req.setHeader("Authorization", "GoogleLogin auth=" + auth); // } // } } public static final HttpPost createOpenRosaHttpPost(Uri u) { HttpPost req = new HttpPost(URI.create(u.toString())); setCollectHeaders(req); setOpenRosaHeaders(req); setGoogleHeaders(req); return req; } /** * Create an httpClient with connection timeouts and other parameters set. * Save and reuse the connection manager across invocations (this is what * requires synchronized access). * * @return HttpClient properly configured. */ public static final synchronized HttpClient createHttpClient(int timeout) { // configure connection SocketConfig socketConfig = SocketConfig.copy(SocketConfig.DEFAULT).setSoTimeout( 2 * timeout) .build(); // if possible, bias toward digest auth (may not be in 4.0 beta 2) List<String> targetPreferredAuthSchemes = new ArrayList<String>(); targetPreferredAuthSchemes.add(AuthSchemes.DIGEST); targetPreferredAuthSchemes.add(AuthSchemes.BASIC); RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT) .setConnectTimeout(timeout) // support authenticating .setAuthenticationEnabled(true) // support redirecting to handle http: => https: transition .setRedirectsEnabled(true) .setMaxRedirects(1) .setCircularRedirectsAllowed(true) .setTargetPreferredAuthSchemes(targetPreferredAuthSchemes) .setCookieSpec(CookieSpecs.DEFAULT) .build(); CloseableHttpClient httpClient = HttpClientBuilder.create() .setDefaultSocketConfig(socketConfig) .setDefaultRequestConfig(requestConfig) .build(); return httpClient; } /** * Utility to ensure that the entity stream of a response is drained of * bytes. */ public static final void discardEntityBytes(HttpResponse response) { // may be a server that does not handle HttpEntity entity = response.getEntity(); if (entity != null) { try { // have to read the stream in order to reuse the connection InputStream is = response.getEntity().getContent(); // read to end of stream... final long count = 1024L; while (is.skip(count) == count) { ; } is.close(); } catch (IOException e) { } catch (Exception e) { } } } /** * Common method for returning a parsed xml document given a url and the * http context and client objects involved in the web connection. */ public static DocumentFetchResult getXmlDocument(String urlString, HttpContext localContext, HttpClient httpclient) { URI u = null; try { URL url = new URL(urlString); u = url.toURI(); } catch (Exception e) { return new DocumentFetchResult(e.getLocalizedMessage() // + app.getString(R.string.while_accessing) + urlString); + ("while accessing") + urlString, 0); } if (u.getHost() == null) { return new DocumentFetchResult("Invalid server URL (no hostname): " + urlString, 0); } // if https then enable preemptive basic auth... if (u.getScheme().equals("https")) { enablePreemptiveBasicAuth(localContext, u.getHost()); } // set up request... HttpGet req = WebUtils.createOpenRosaHttpGet(u); req.addHeader(WebUtils.ACCEPT_ENCODING_HEADER, WebUtils.GZIP_CONTENT_ENCODING); HttpResponse response = null; try { response = httpclient.execute(req, localContext); int statusCode = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); if (statusCode != HttpStatus.SC_OK) { WebUtils.discardEntityBytes(response); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { // clear the cookies -- should not be necessary? Collect.getInstance().getCookieStore().clear(); } String webError = response.getStatusLine().getReasonPhrase() + " (" + statusCode + ")"; return new DocumentFetchResult(u.toString() + " responded with: " + webError, statusCode); } if (entity == null) { String error = "No entity body returned from: " + u.toString(); Log.e(t, error); return new DocumentFetchResult(error, 0); } if (!entity.getContentType().getValue().toLowerCase(Locale.ENGLISH) .contains(WebUtils.HTTP_CONTENT_TYPE_TEXT_XML)) { WebUtils.discardEntityBytes(response); String error = "ContentType: " + entity.getContentType().getValue() + " returned from: " + u.toString() + " is not text/xml. This is often caused a network proxy. Do you need " + "to login to your network?"; Log.e(t, error); return new DocumentFetchResult(error, 0); } // parse response Document doc = null; try { InputStream is = null; InputStreamReader isr = null; try { is = entity.getContent(); Header contentEncoding = entity.getContentEncoding(); if (contentEncoding != null && contentEncoding.getValue().equalsIgnoreCase( WebUtils.GZIP_CONTENT_ENCODING)) { is = new GZIPInputStream(is); } isr = new InputStreamReader(is, "UTF-8"); doc = new Document(); KXmlParser parser = new KXmlParser(); parser.setInput(isr); parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); doc.parse(parser); isr.close(); isr = null; } finally { if (isr != null) { try { // ensure stream is consumed... final long count = 1024L; while (isr.skip(count) == count) { ; } } catch (Exception e) { // no-op } try { isr.close(); } catch (Exception e) { // no-op } } if (is != null) { try { is.close(); } catch (Exception e) { // no-op } } } } catch (Exception e) { String error = "Parsing failed with " + e.getMessage() + "while accessing " + u.toString(); Log.e(t, error); return new DocumentFetchResult(error, 0); } boolean isOR = false; Header[] fields = response .getHeaders(WebUtils.OPEN_ROSA_VERSION_HEADER); if (fields != null && fields.length >= 1) { isOR = true; boolean versionMatch = false; boolean first = true; StringBuilder b = new StringBuilder(); for (Header h : fields) { if (WebUtils.OPEN_ROSA_VERSION.equals(h.getValue())) { versionMatch = true; break; } if (!first) { b.append("; "); } first = false; b.append(h.getValue()); } if (!versionMatch) { Log.w(t, WebUtils.OPEN_ROSA_VERSION_HEADER + " unrecognized version(s): " + b.toString()); } } return new DocumentFetchResult(doc, isOR); } catch (Exception e) { String cause; Throwable c = e; while (c.getCause() != null) { c = c.getCause(); } cause = c.toString(); String error = "Error: " + cause + " while accessing " + u.toString(); Log.w(t, error); return new DocumentFetchResult(error, 0); } } }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.dromara.hmily.core.service; import org.dromara.hmily.core.context.HmilyTransactionContext; import org.aspectj.lang.ProceedingJoinPoint; /** * HmilyTransactionHandler. * @author xiaoyu */ @FunctionalInterface public interface HmilyTransactionHandler { /** * aop handler. * * @param point point * @param hmilyTransactionContext transaction context * @return Object * @throws Throwable e */ Object handler(ProceedingJoinPoint point, HmilyTransactionContext hmilyTransactionContext) throws Throwable; }
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2018.11.25 at 06:26:25 PM EST // package com.github.aks8m.schemas.docbook; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRefs; import javax.xml.bind.annotation.XmlID; import javax.xml.bind.annotation.XmlIDREF; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;choice maxOccurs="unbounded" minOccurs="0"> * &lt;element ref="{http://docbook.org/ns/docbook}inlinemediaobject"/> * &lt;element ref="{http://docbook.org/ns/docbook}remark"/> * &lt;element ref="{http://docbook.org/ns/docbook}superscript"/> * &lt;element ref="{http://docbook.org/ns/docbook}subscript"/> * &lt;element ref="{http://docbook.org/ns/docbook}xref"/> * &lt;element ref="{http://docbook.org/ns/docbook}link"/> * &lt;element ref="{http://docbook.org/ns/docbook}olink"/> * &lt;element ref="{http://docbook.org/ns/docbook}anchor"/> * &lt;element ref="{http://docbook.org/ns/docbook}biblioref"/> * &lt;element ref="{http://docbook.org/ns/docbook}alt"/> * &lt;element ref="{http://docbook.org/ns/docbook}annotation"/> * &lt;element ref="{http://docbook.org/ns/docbook}indexterm"/> * &lt;element ref="{http://docbook.org/ns/docbook}abbrev"/> * &lt;element ref="{http://docbook.org/ns/docbook}acronym"/> * &lt;element ref="{http://docbook.org/ns/docbook}date"/> * &lt;element ref="{http://docbook.org/ns/docbook}emphasis"/> * &lt;element ref="{http://docbook.org/ns/docbook}footnote"/> * &lt;element ref="{http://docbook.org/ns/docbook}footnoteref"/> * &lt;element ref="{http://docbook.org/ns/docbook}foreignphrase"/> * &lt;element ref="{http://docbook.org/ns/docbook}phrase"/> * &lt;element ref="{http://docbook.org/ns/docbook}quote"/> * &lt;element ref="{http://docbook.org/ns/docbook}wordasword"/> * &lt;element ref="{http://docbook.org/ns/docbook}firstterm"/> * &lt;element ref="{http://docbook.org/ns/docbook}glossterm"/> * &lt;element ref="{http://docbook.org/ns/docbook}coref"/> * &lt;element ref="{http://docbook.org/ns/docbook}trademark"/> * &lt;element ref="{http://docbook.org/ns/docbook}productnumber"/> * &lt;element ref="{http://docbook.org/ns/docbook}productname"/> * &lt;element ref="{http://docbook.org/ns/docbook}database"/> * &lt;element ref="{http://docbook.org/ns/docbook}application"/> * &lt;element ref="{http://docbook.org/ns/docbook}hardware"/> * &lt;element ref="{http://docbook.org/ns/docbook}citation"/> * &lt;element ref="{http://docbook.org/ns/docbook}citerefentry"/> * &lt;element ref="{http://docbook.org/ns/docbook}citetitle"/> * &lt;element ref="{http://docbook.org/ns/docbook}citebiblioid"/> * &lt;element ref="{http://docbook.org/ns/docbook}author"/> * &lt;element ref="{http://docbook.org/ns/docbook}person"/> * &lt;element ref="{http://docbook.org/ns/docbook}personname"/> * &lt;element ref="{http://docbook.org/ns/docbook}org"/> * &lt;element ref="{http://docbook.org/ns/docbook}orgname"/> * &lt;element ref="{http://docbook.org/ns/docbook}editor"/> * &lt;element ref="{http://docbook.org/ns/docbook}jobtitle"/> * &lt;element ref="{http://docbook.org/ns/docbook}replaceable"/> * &lt;element ref="{http://docbook.org/ns/docbook}package"/> * &lt;element ref="{http://docbook.org/ns/docbook}parameter"/> * &lt;element ref="{http://docbook.org/ns/docbook}termdef"/> * &lt;element ref="{http://docbook.org/ns/docbook}nonterminal"/> * &lt;element ref="{http://docbook.org/ns/docbook}systemitem"/> * &lt;element ref="{http://docbook.org/ns/docbook}option"/> * &lt;element ref="{http://docbook.org/ns/docbook}optional"/> * &lt;element ref="{http://docbook.org/ns/docbook}property"/> * &lt;element ref="{http://docbook.org/ns/docbook}inlineequation"/> * &lt;element ref="{http://docbook.org/ns/docbook}tag"/> * &lt;element ref="{http://docbook.org/ns/docbook}markup"/> * &lt;element ref="{http://docbook.org/ns/docbook}token"/> * &lt;element ref="{http://docbook.org/ns/docbook}symbol"/> * &lt;element ref="{http://docbook.org/ns/docbook}literal"/> * &lt;element ref="{http://docbook.org/ns/docbook}code"/> * &lt;element ref="{http://docbook.org/ns/docbook}constant"/> * &lt;element ref="{http://docbook.org/ns/docbook}email"/> * &lt;element ref="{http://docbook.org/ns/docbook}uri"/> * &lt;element ref="{http://docbook.org/ns/docbook}guiicon"/> * &lt;element ref="{http://docbook.org/ns/docbook}guibutton"/> * &lt;element ref="{http://docbook.org/ns/docbook}guimenuitem"/> * &lt;element ref="{http://docbook.org/ns/docbook}guimenu"/> * &lt;element ref="{http://docbook.org/ns/docbook}guisubmenu"/> * &lt;element ref="{http://docbook.org/ns/docbook}guilabel"/> * &lt;element ref="{http://docbook.org/ns/docbook}menuchoice"/> * &lt;element ref="{http://docbook.org/ns/docbook}mousebutton"/> * &lt;element ref="{http://docbook.org/ns/docbook}keycombo"/> * &lt;element ref="{http://docbook.org/ns/docbook}keycap"/> * &lt;element ref="{http://docbook.org/ns/docbook}keycode"/> * &lt;element ref="{http://docbook.org/ns/docbook}keysym"/> * &lt;element ref="{http://docbook.org/ns/docbook}shortcut"/> * &lt;element ref="{http://docbook.org/ns/docbook}accel"/> * &lt;element ref="{http://docbook.org/ns/docbook}prompt"/> * &lt;element ref="{http://docbook.org/ns/docbook}envar"/> * &lt;element ref="{http://docbook.org/ns/docbook}filename"/> * &lt;element ref="{http://docbook.org/ns/docbook}command"/> * &lt;element ref="{http://docbook.org/ns/docbook}computeroutput"/> * &lt;element ref="{http://docbook.org/ns/docbook}userinput"/> * &lt;element ref="{http://docbook.org/ns/docbook}function"/> * &lt;element ref="{http://docbook.org/ns/docbook}varname"/> * &lt;element ref="{http://docbook.org/ns/docbook}returnvalue"/> * &lt;element ref="{http://docbook.org/ns/docbook}type"/> * &lt;element ref="{http://docbook.org/ns/docbook}classname"/> * &lt;element ref="{http://docbook.org/ns/docbook}exceptionname"/> * &lt;element ref="{http://docbook.org/ns/docbook}interfacename"/> * &lt;element ref="{http://docbook.org/ns/docbook}methodname"/> * &lt;element ref="{http://docbook.org/ns/docbook}modifier"/> * &lt;element ref="{http://docbook.org/ns/docbook}initializer"/> * &lt;element ref="{http://docbook.org/ns/docbook}ooclass"/> * &lt;element ref="{http://docbook.org/ns/docbook}ooexception"/> * &lt;element ref="{http://docbook.org/ns/docbook}oointerface"/> * &lt;element ref="{http://docbook.org/ns/docbook}errorcode"/> * &lt;element ref="{http://docbook.org/ns/docbook}errortext"/> * &lt;element ref="{http://docbook.org/ns/docbook}errorname"/> * &lt;element ref="{http://docbook.org/ns/docbook}errortype"/> * &lt;/choice> * &lt;attGroup ref="{http://docbook.org/ns/docbook}db.common.attributes"/> * &lt;attGroup ref="{http://docbook.org/ns/docbook}db.common.linking.attributes"/> * &lt;attribute name="role" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) @XmlRootElement(name = "refname") public class Refname { @XmlElementRefs({ @XmlElementRef(name = "email", namespace = "http://docbook.org/ns/docbook", type = Email.class, required = false), @XmlElementRef(name = "prompt", namespace = "http://docbook.org/ns/docbook", type = Prompt.class, required = false), @XmlElementRef(name = "olink", namespace = "http://docbook.org/ns/docbook", type = Olink.class, required = false), @XmlElementRef(name = "classname", namespace = "http://docbook.org/ns/docbook", type = Classname.class, required = false), @XmlElementRef(name = "editor", namespace = "http://docbook.org/ns/docbook", type = Editor.class, required = false), @XmlElementRef(name = "phrase", namespace = "http://docbook.org/ns/docbook", type = Phrase.class, required = false), @XmlElementRef(name = "person", namespace = "http://docbook.org/ns/docbook", type = Person.class, required = false), @XmlElementRef(name = "methodname", namespace = "http://docbook.org/ns/docbook", type = Methodname.class, required = false), @XmlElementRef(name = "guiicon", namespace = "http://docbook.org/ns/docbook", type = Guiicon.class, required = false), @XmlElementRef(name = "errorname", namespace = "http://docbook.org/ns/docbook", type = Errorname.class, required = false), @XmlElementRef(name = "tag", namespace = "http://docbook.org/ns/docbook", type = Tag.class, required = false), @XmlElementRef(name = "jobtitle", namespace = "http://docbook.org/ns/docbook", type = Jobtitle.class, required = false), @XmlElementRef(name = "trademark", namespace = "http://docbook.org/ns/docbook", type = Trademark.class, required = false), @XmlElementRef(name = "replaceable", namespace = "http://docbook.org/ns/docbook", type = Replaceable.class, required = false), @XmlElementRef(name = "returnvalue", namespace = "http://docbook.org/ns/docbook", type = Returnvalue.class, required = false), @XmlElementRef(name = "package", namespace = "http://docbook.org/ns/docbook", type = Package.class, required = false), @XmlElementRef(name = "inlinemediaobject", namespace = "http://docbook.org/ns/docbook", type = Inlinemediaobject.class, required = false), @XmlElementRef(name = "constant", namespace = "http://docbook.org/ns/docbook", type = Constant.class, required = false), @XmlElementRef(name = "interfacename", namespace = "http://docbook.org/ns/docbook", type = Interfacename.class, required = false), @XmlElementRef(name = "citation", namespace = "http://docbook.org/ns/docbook", type = Citation.class, required = false), @XmlElementRef(name = "errortype", namespace = "http://docbook.org/ns/docbook", type = Errortype.class, required = false), @XmlElementRef(name = "firstterm", namespace = "http://docbook.org/ns/docbook", type = Firstterm.class, required = false), @XmlElementRef(name = "indexterm", namespace = "http://docbook.org/ns/docbook", type = Indexterm.class, required = false), @XmlElementRef(name = "envar", namespace = "http://docbook.org/ns/docbook", type = Envar.class, required = false), @XmlElementRef(name = "foreignphrase", namespace = "http://docbook.org/ns/docbook", type = Foreignphrase.class, required = false), @XmlElementRef(name = "coref", namespace = "http://docbook.org/ns/docbook", type = Coref.class, required = false), @XmlElementRef(name = "footnote", namespace = "http://docbook.org/ns/docbook", type = Footnote.class, required = false), @XmlElementRef(name = "hardware", namespace = "http://docbook.org/ns/docbook", type = Hardware.class, required = false), @XmlElementRef(name = "citerefentry", namespace = "http://docbook.org/ns/docbook", type = Citerefentry.class, required = false), @XmlElementRef(name = "subscript", namespace = "http://docbook.org/ns/docbook", type = Subscript.class, required = false), @XmlElementRef(name = "ooclass", namespace = "http://docbook.org/ns/docbook", type = Ooclass.class, required = false), @XmlElementRef(name = "citebiblioid", namespace = "http://docbook.org/ns/docbook", type = Citebiblioid.class, required = false), @XmlElementRef(name = "userinput", namespace = "http://docbook.org/ns/docbook", type = Userinput.class, required = false), @XmlElementRef(name = "emphasis", namespace = "http://docbook.org/ns/docbook", type = Emphasis.class, required = false), @XmlElementRef(name = "database", namespace = "http://docbook.org/ns/docbook", type = Database.class, required = false), @XmlElementRef(name = "menuchoice", namespace = "http://docbook.org/ns/docbook", type = Menuchoice.class, required = false), @XmlElementRef(name = "alt", namespace = "http://docbook.org/ns/docbook", type = Alt.class, required = false), @XmlElementRef(name = "optional", namespace = "http://docbook.org/ns/docbook", type = Optional.class, required = false), @XmlElementRef(name = "varname", namespace = "http://docbook.org/ns/docbook", type = Varname.class, required = false), @XmlElementRef(name = "link", namespace = "http://docbook.org/ns/docbook", type = Link.class, required = false), @XmlElementRef(name = "author", namespace = "http://docbook.org/ns/docbook", type = Author.class, required = false), @XmlElementRef(name = "errortext", namespace = "http://docbook.org/ns/docbook", type = Errortext.class, required = false), @XmlElementRef(name = "productnumber", namespace = "http://docbook.org/ns/docbook", type = Productnumber.class, required = false), @XmlElementRef(name = "accel", namespace = "http://docbook.org/ns/docbook", type = Accel.class, required = false), @XmlElementRef(name = "initializer", namespace = "http://docbook.org/ns/docbook", type = Initializer.class, required = false), @XmlElementRef(name = "markup", namespace = "http://docbook.org/ns/docbook", type = Markup.class, required = false), @XmlElementRef(name = "glossterm", namespace = "http://docbook.org/ns/docbook", type = Glossterm.class, required = false), @XmlElementRef(name = "token", namespace = "http://docbook.org/ns/docbook", type = Token.class, required = false), @XmlElementRef(name = "termdef", namespace = "http://docbook.org/ns/docbook", type = Termdef.class, required = false), @XmlElementRef(name = "exceptionname", namespace = "http://docbook.org/ns/docbook", type = Exceptionname.class, required = false), @XmlElementRef(name = "org", namespace = "http://docbook.org/ns/docbook", type = Org.class, required = false), @XmlElementRef(name = "orgname", namespace = "http://docbook.org/ns/docbook", type = Orgname.class, required = false), @XmlElementRef(name = "function", namespace = "http://docbook.org/ns/docbook", type = Function.class, required = false), @XmlElementRef(name = "keycode", namespace = "http://docbook.org/ns/docbook", type = Keycode.class, required = false), @XmlElementRef(name = "mousebutton", namespace = "http://docbook.org/ns/docbook", type = Mousebutton.class, required = false), @XmlElementRef(name = "keycombo", namespace = "http://docbook.org/ns/docbook", type = Keycombo.class, required = false), @XmlElementRef(name = "guimenu", namespace = "http://docbook.org/ns/docbook", type = Guimenu.class, required = false), @XmlElementRef(name = "property", namespace = "http://docbook.org/ns/docbook", type = Property.class, required = false), @XmlElementRef(name = "type", namespace = "http://docbook.org/ns/docbook", type = Type.class, required = false), @XmlElementRef(name = "abbrev", namespace = "http://docbook.org/ns/docbook", type = Abbrev.class, required = false), @XmlElementRef(name = "productname", namespace = "http://docbook.org/ns/docbook", type = Productname.class, required = false), @XmlElementRef(name = "computeroutput", namespace = "http://docbook.org/ns/docbook", type = Computeroutput.class, required = false), @XmlElementRef(name = "acronym", namespace = "http://docbook.org/ns/docbook", type = Acronym.class, required = false), @XmlElementRef(name = "parameter", namespace = "http://docbook.org/ns/docbook", type = Parameter.class, required = false), @XmlElementRef(name = "date", namespace = "http://docbook.org/ns/docbook", type = Date.class, required = false), @XmlElementRef(name = "ooexception", namespace = "http://docbook.org/ns/docbook", type = Ooexception.class, required = false), @XmlElementRef(name = "biblioref", namespace = "http://docbook.org/ns/docbook", type = Biblioref.class, required = false), @XmlElementRef(name = "guisubmenu", namespace = "http://docbook.org/ns/docbook", type = Guisubmenu.class, required = false), @XmlElementRef(name = "keysym", namespace = "http://docbook.org/ns/docbook", type = Keysym.class, required = false), @XmlElementRef(name = "option", namespace = "http://docbook.org/ns/docbook", type = Option.class, required = false), @XmlElementRef(name = "literal", namespace = "http://docbook.org/ns/docbook", type = Literal.class, required = false), @XmlElementRef(name = "anchor", namespace = "http://docbook.org/ns/docbook", type = Anchor.class, required = false), @XmlElementRef(name = "personname", namespace = "http://docbook.org/ns/docbook", type = Personname.class, required = false), @XmlElementRef(name = "uri", namespace = "http://docbook.org/ns/docbook", type = Uri.class, required = false), @XmlElementRef(name = "errorcode", namespace = "http://docbook.org/ns/docbook", type = Errorcode.class, required = false), @XmlElementRef(name = "wordasword", namespace = "http://docbook.org/ns/docbook", type = Wordasword.class, required = false), @XmlElementRef(name = "remark", namespace = "http://docbook.org/ns/docbook", type = Remark.class, required = false), @XmlElementRef(name = "xref", namespace = "http://docbook.org/ns/docbook", type = Xref.class, required = false), @XmlElementRef(name = "command", namespace = "http://docbook.org/ns/docbook", type = Command.class, required = false), @XmlElementRef(name = "filename", namespace = "http://docbook.org/ns/docbook", type = Filename.class, required = false), @XmlElementRef(name = "superscript", namespace = "http://docbook.org/ns/docbook", type = Superscript.class, required = false), @XmlElementRef(name = "quote", namespace = "http://docbook.org/ns/docbook", type = Quote.class, required = false), @XmlElementRef(name = "nonterminal", namespace = "http://docbook.org/ns/docbook", type = Nonterminal.class, required = false), @XmlElementRef(name = "code", namespace = "http://docbook.org/ns/docbook", type = Code.class, required = false), @XmlElementRef(name = "inlineequation", namespace = "http://docbook.org/ns/docbook", type = Inlineequation.class, required = false), @XmlElementRef(name = "keycap", namespace = "http://docbook.org/ns/docbook", type = Keycap.class, required = false), @XmlElementRef(name = "symbol", namespace = "http://docbook.org/ns/docbook", type = Symbol.class, required = false), @XmlElementRef(name = "systemitem", namespace = "http://docbook.org/ns/docbook", type = Systemitem.class, required = false), @XmlElementRef(name = "guimenuitem", namespace = "http://docbook.org/ns/docbook", type = Guimenuitem.class, required = false), @XmlElementRef(name = "guibutton", namespace = "http://docbook.org/ns/docbook", type = Guibutton.class, required = false), @XmlElementRef(name = "shortcut", namespace = "http://docbook.org/ns/docbook", type = Shortcut.class, required = false), @XmlElementRef(name = "citetitle", namespace = "http://docbook.org/ns/docbook", type = Citetitle.class, required = false), @XmlElementRef(name = "modifier", namespace = "http://docbook.org/ns/docbook", type = Modifier.class, required = false), @XmlElementRef(name = "guilabel", namespace = "http://docbook.org/ns/docbook", type = Guilabel.class, required = false), @XmlElementRef(name = "oointerface", namespace = "http://docbook.org/ns/docbook", type = Oointerface.class, required = false), @XmlElementRef(name = "footnoteref", namespace = "http://docbook.org/ns/docbook", type = Footnoteref.class, required = false), @XmlElementRef(name = "annotation", namespace = "http://docbook.org/ns/docbook", type = Annotation.class, required = false), @XmlElementRef(name = "application", namespace = "http://docbook.org/ns/docbook", type = Application.class, required = false) }) @XmlMixed protected List<Object> content; @XmlAttribute(name = "role") @XmlSchemaType(name = "anySimpleType") protected String role; @XmlAttribute(name = "id", namespace = "http://www.w3.org/XML/1998/namespace") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String id; @XmlAttribute(name = "version") @XmlSchemaType(name = "anySimpleType") protected String commonVersion; @XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace") @XmlSchemaType(name = "anySimpleType") protected String xmlLang; @XmlAttribute(name = "base", namespace = "http://www.w3.org/XML/1998/namespace") @XmlSchemaType(name = "anySimpleType") protected String base; @XmlAttribute(name = "remap") @XmlSchemaType(name = "anySimpleType") protected String remap; @XmlAttribute(name = "xreflabel") @XmlSchemaType(name = "anySimpleType") protected String xreflabel; @XmlAttribute(name = "revisionflag") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String revisionflag; @XmlAttribute(name = "dir") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String dir; @XmlAttribute(name = "arch") @XmlSchemaType(name = "anySimpleType") protected String arch; @XmlAttribute(name = "audience") @XmlSchemaType(name = "anySimpleType") protected String audience; @XmlAttribute(name = "condition") @XmlSchemaType(name = "anySimpleType") protected String condition; @XmlAttribute(name = "conformance") @XmlSchemaType(name = "anySimpleType") protected String conformance; @XmlAttribute(name = "os") @XmlSchemaType(name = "anySimpleType") protected String os; @XmlAttribute(name = "revision") @XmlSchemaType(name = "anySimpleType") protected String commonRevision; @XmlAttribute(name = "security") @XmlSchemaType(name = "anySimpleType") protected String security; @XmlAttribute(name = "userlevel") @XmlSchemaType(name = "anySimpleType") protected String userlevel; @XmlAttribute(name = "vendor") @XmlSchemaType(name = "anySimpleType") protected String vendor; @XmlAttribute(name = "wordsize") @XmlSchemaType(name = "anySimpleType") protected String wordsize; @XmlAttribute(name = "annotations") @XmlSchemaType(name = "anySimpleType") protected String annotations; @XmlAttribute(name = "linkend") @XmlIDREF @XmlSchemaType(name = "IDREF") protected Object linkend; @XmlAttribute(name = "href", namespace = "http://www.w3.org/1999/xlink") @XmlSchemaType(name = "anySimpleType") protected String href; @XmlAttribute(name = "type", namespace = "http://www.w3.org/1999/xlink") @XmlSchemaType(name = "anySimpleType") protected String xlinkType; @XmlAttribute(name = "role", namespace = "http://www.w3.org/1999/xlink") @XmlSchemaType(name = "anySimpleType") protected String xlinkRole; @XmlAttribute(name = "arcrole", namespace = "http://www.w3.org/1999/xlink") @XmlSchemaType(name = "anySimpleType") protected String arcrole; @XmlAttribute(name = "title", namespace = "http://www.w3.org/1999/xlink") @XmlSchemaType(name = "anySimpleType") protected String xlinkTitle; @XmlAttribute(name = "show", namespace = "http://www.w3.org/1999/xlink") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String show; @XmlAttribute(name = "actuate", namespace = "http://www.w3.org/1999/xlink") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String actuate; /** * Gets the value of the content property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the content property. * * <p> * For example, to add a new item, do as follows: * <pre> * getContent().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Email } * {@link Prompt } * {@link Olink } * {@link Classname } * {@link Editor } * {@link Phrase } * {@link Person } * {@link Methodname } * {@link Guiicon } * {@link Errorname } * {@link Tag } * {@link Jobtitle } * {@link Trademark } * {@link Replaceable } * {@link Returnvalue } * {@link Package } * {@link Inlinemediaobject } * {@link Constant } * {@link Interfacename } * {@link Citation } * {@link Errortype } * {@link Firstterm } * {@link Indexterm } * {@link Envar } * {@link Foreignphrase } * {@link Coref } * {@link Footnote } * {@link Hardware } * {@link Citerefentry } * {@link Subscript } * {@link Ooclass } * {@link Citebiblioid } * {@link Userinput } * {@link Emphasis } * {@link Database } * {@link Menuchoice } * {@link Alt } * {@link Optional } * {@link Varname } * {@link Link } * {@link Author } * {@link Errortext } * {@link Productnumber } * {@link Accel } * {@link Initializer } * {@link Markup } * {@link Glossterm } * {@link Token } * {@link Termdef } * {@link Exceptionname } * {@link Org } * {@link Orgname } * {@link Function } * {@link Keycode } * {@link Mousebutton } * {@link Keycombo } * {@link String } * {@link Guimenu } * {@link Property } * {@link Type } * {@link Abbrev } * {@link Productname } * {@link Computeroutput } * {@link Acronym } * {@link Parameter } * {@link Date } * {@link Ooexception } * {@link Biblioref } * {@link Guisubmenu } * {@link Keysym } * {@link Option } * {@link Literal } * {@link Anchor } * {@link Personname } * {@link Uri } * {@link Errorcode } * {@link Wordasword } * {@link Remark } * {@link Xref } * {@link Command } * {@link Filename } * {@link Superscript } * {@link Quote } * {@link Nonterminal } * {@link Code } * {@link Inlineequation } * {@link Keycap } * {@link Symbol } * {@link Systemitem } * {@link Guimenuitem } * {@link Guibutton } * {@link Shortcut } * {@link Citetitle } * {@link Modifier } * {@link Guilabel } * {@link Oointerface } * {@link Footnoteref } * {@link Annotation } * {@link Application } * * */ public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; } /** * Gets the value of the role property. * * @return * possible object is * {@link String } * */ public String getRole() { return role; } /** * Sets the value of the role property. * * @param value * allowed object is * {@link String } * */ public void setRole(String value) { this.role = value; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } /** * Gets the value of the commonVersion property. * * @return * possible object is * {@link String } * */ public String getCommonVersion() { return commonVersion; } /** * Sets the value of the commonVersion property. * * @param value * allowed object is * {@link String } * */ public void setCommonVersion(String value) { this.commonVersion = value; } /** * Gets the value of the xmlLang property. * * @return * possible object is * {@link String } * */ public String getXmlLang() { return xmlLang; } /** * Sets the value of the xmlLang property. * * @param value * allowed object is * {@link String } * */ public void setXmlLang(String value) { this.xmlLang = value; } /** * Gets the value of the base property. * * @return * possible object is * {@link String } * */ public String getBase() { return base; } /** * Sets the value of the base property. * * @param value * allowed object is * {@link String } * */ public void setBase(String value) { this.base = value; } /** * Gets the value of the remap property. * * @return * possible object is * {@link String } * */ public String getRemap() { return remap; } /** * Sets the value of the remap property. * * @param value * allowed object is * {@link String } * */ public void setRemap(String value) { this.remap = value; } /** * Gets the value of the xreflabel property. * * @return * possible object is * {@link String } * */ public String getXreflabel() { return xreflabel; } /** * Sets the value of the xreflabel property. * * @param value * allowed object is * {@link String } * */ public void setXreflabel(String value) { this.xreflabel = value; } /** * Gets the value of the revisionflag property. * * @return * possible object is * {@link String } * */ public String getRevisionflag() { return revisionflag; } /** * Sets the value of the revisionflag property. * * @param value * allowed object is * {@link String } * */ public void setRevisionflag(String value) { this.revisionflag = value; } /** * Gets the value of the dir property. * * @return * possible object is * {@link String } * */ public String getDir() { return dir; } /** * Sets the value of the dir property. * * @param value * allowed object is * {@link String } * */ public void setDir(String value) { this.dir = value; } /** * Gets the value of the arch property. * * @return * possible object is * {@link String } * */ public String getArch() { return arch; } /** * Sets the value of the arch property. * * @param value * allowed object is * {@link String } * */ public void setArch(String value) { this.arch = value; } /** * Gets the value of the audience property. * * @return * possible object is * {@link String } * */ public String getAudience() { return audience; } /** * Sets the value of the audience property. * * @param value * allowed object is * {@link String } * */ public void setAudience(String value) { this.audience = value; } /** * Gets the value of the condition property. * * @return * possible object is * {@link String } * */ public String getCondition() { return condition; } /** * Sets the value of the condition property. * * @param value * allowed object is * {@link String } * */ public void setCondition(String value) { this.condition = value; } /** * Gets the value of the conformance property. * * @return * possible object is * {@link String } * */ public String getConformance() { return conformance; } /** * Sets the value of the conformance property. * * @param value * allowed object is * {@link String } * */ public void setConformance(String value) { this.conformance = value; } /** * Gets the value of the os property. * * @return * possible object is * {@link String } * */ public String getOs() { return os; } /** * Sets the value of the os property. * * @param value * allowed object is * {@link String } * */ public void setOs(String value) { this.os = value; } /** * Gets the value of the commonRevision property. * * @return * possible object is * {@link String } * */ public String getCommonRevision() { return commonRevision; } /** * Sets the value of the commonRevision property. * * @param value * allowed object is * {@link String } * */ public void setCommonRevision(String value) { this.commonRevision = value; } /** * Gets the value of the security property. * * @return * possible object is * {@link String } * */ public String getSecurity() { return security; } /** * Sets the value of the security property. * * @param value * allowed object is * {@link String } * */ public void setSecurity(String value) { this.security = value; } /** * Gets the value of the userlevel property. * * @return * possible object is * {@link String } * */ public String getUserlevel() { return userlevel; } /** * Sets the value of the userlevel property. * * @param value * allowed object is * {@link String } * */ public void setUserlevel(String value) { this.userlevel = value; } /** * Gets the value of the vendor property. * * @return * possible object is * {@link String } * */ public String getVendor() { return vendor; } /** * Sets the value of the vendor property. * * @param value * allowed object is * {@link String } * */ public void setVendor(String value) { this.vendor = value; } /** * Gets the value of the wordsize property. * * @return * possible object is * {@link String } * */ public String getWordsize() { return wordsize; } /** * Sets the value of the wordsize property. * * @param value * allowed object is * {@link String } * */ public void setWordsize(String value) { this.wordsize = value; } /** * Gets the value of the annotations property. * * @return * possible object is * {@link String } * */ public String getAnnotations() { return annotations; } /** * Sets the value of the annotations property. * * @param value * allowed object is * {@link String } * */ public void setAnnotations(String value) { this.annotations = value; } /** * Gets the value of the linkend property. * * @return * possible object is * {@link Object } * */ public Object getLinkend() { return linkend; } /** * Sets the value of the linkend property. * * @param value * allowed object is * {@link Object } * */ public void setLinkend(Object value) { this.linkend = value; } /** * Gets the value of the href property. * * @return * possible object is * {@link String } * */ public String getHref() { return href; } /** * Sets the value of the href property. * * @param value * allowed object is * {@link String } * */ public void setHref(String value) { this.href = value; } /** * Gets the value of the xlinkType property. * * @return * possible object is * {@link String } * */ public String getXlinkType() { return xlinkType; } /** * Sets the value of the xlinkType property. * * @param value * allowed object is * {@link String } * */ public void setXlinkType(String value) { this.xlinkType = value; } /** * Gets the value of the xlinkRole property. * * @return * possible object is * {@link String } * */ public String getXlinkRole() { return xlinkRole; } /** * Sets the value of the xlinkRole property. * * @param value * allowed object is * {@link String } * */ public void setXlinkRole(String value) { this.xlinkRole = value; } /** * Gets the value of the arcrole property. * * @return * possible object is * {@link String } * */ public String getArcrole() { return arcrole; } /** * Sets the value of the arcrole property. * * @param value * allowed object is * {@link String } * */ public void setArcrole(String value) { this.arcrole = value; } /** * Gets the value of the xlinkTitle property. * * @return * possible object is * {@link String } * */ public String getXlinkTitle() { return xlinkTitle; } /** * Sets the value of the xlinkTitle property. * * @param value * allowed object is * {@link String } * */ public void setXlinkTitle(String value) { this.xlinkTitle = value; } /** * Gets the value of the show property. * * @return * possible object is * {@link String } * */ public String getShow() { return show; } /** * Sets the value of the show property. * * @param value * allowed object is * {@link String } * */ public void setShow(String value) { this.show = value; } /** * Gets the value of the actuate property. * * @return * possible object is * {@link String } * */ public String getActuate() { return actuate; } /** * Sets the value of the actuate property. * * @param value * allowed object is * {@link String } * */ public void setActuate(String value) { this.actuate = value; } }
package doublyEndedQueue; public class MyDeque<E> { Node<E> head, tail; public void addToHead(E data) { Node<E> toAdd = new Node<>(data); if(head == null) { head = tail = toAdd; return; } head.next = toAdd; toAdd.prev = head; head = toAdd; } public E removeLast() { if(head == null) { return null; } Node<E> toRemove = tail; tail = tail.next; if(tail== null) { head = null; } return toRemove.data; } public static class Node<E>{ E data; Node<E> next, prev; public Node(E data) { this.data = data; this.next = this.prev = null; } } }
package org.opensha.commons.mapping.gmt; import static org.junit.Assert.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import javax.imageio.ImageIO; import org.junit.BeforeClass; import org.junit.Test; import org.opensha.commons.data.xyz.ArbDiscrGeoDataSet; import org.opensha.commons.data.xyz.ArbDiscrXYZ_DataSet; import org.opensha.commons.data.xyz.GeoDataSet; import org.opensha.commons.exceptions.GMT_MapException; public class TestGMT_MapGenerator { private static GMT_MapGenerator gmt; private static GeoDataSet xyz; public static GeoDataSet generateTestData() { ArbDiscrGeoDataSet xyz = new ArbDiscrGeoDataSet(true); int y = 0; for (double lat=33.5; lat<=35; lat+=0.1) { int x = 0; for (double lon=-119; lon<=-117; lon+=0.1) { xyz.set(lat, lon, x + y); x++; } y++; } System.out.println("Num points: " + xyz.size()); System.out.println("X Range: " + xyz.getMinX() + " => " + xyz.getMaxX()); System.out.println("Y Range: " + xyz.getMinY() + " => " + xyz.getMaxY()); System.out.println("Z Range: " + xyz.getMinZ() + " => " + xyz.getMaxZ()); return xyz; } @BeforeClass public static void setUp() throws Exception { gmt = new GMT_MapGenerator(); xyz = generateTestData(); } @Test public void testGetGMTMapSpecification() { GMT_Map map = gmt.getGMTMapSpecification(xyz); assertNotNull(map); } }
package lang.compiler.ast.lvalues; import lang.compiler.visitors.AstVisitor; public class Identifier extends AbstractLvalue { private String name; public Identifier(int line, int column, String name) { super(line, column); this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String getLabel() { return "identifier"; } @Override public String toKey(AstVisitor v) { return name; } @Override public Object accept(AstVisitor v) { return v.visitIdentifier(this); } @Override public Identifier getIdentifier() { return this; } @Override public String toString() { return name; } }
/******************************************************************************* * ============LICENSE_START======================================================= * pcims * ================================================================================ * Copyright (C) 2018 Wipro Limited. * ============================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= ******************************************************************************/ package com.wipro.www.pcims.dmaap; import com.att.nsa.apiClient.http.HttpException; import com.att.nsa.cambria.client.CambriaClient; import com.att.nsa.cambria.client.CambriaClientBuilders; import com.att.nsa.cambria.client.CambriaClientBuilders.ConsumerBuilder; import com.att.nsa.cambria.client.CambriaClientBuilders.TopicManagerBuilder; import com.att.nsa.cambria.client.CambriaConsumer; import com.att.nsa.cambria.client.CambriaTopicManager; import com.wipro.www.pcims.Configuration; import com.wipro.www.pcims.NewNotification; import com.wipro.www.pcims.Topic; import com.wipro.www.pcims.dao.DmaapNotificationsRepository; import com.wipro.www.pcims.entity.DmaapNotifications; import java.io.IOException; import java.net.MalformedURLException; import java.security.GeneralSecurityException; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class DmaapClient { @Autowired private DmaapNotificationsRepository dmaapNotificationsRepository; private Configuration configuration; private static Logger log = LoggerFactory.getLogger(DmaapClient.class); private static final String CONSUMER = "CONSUMER"; private static final String PRODUCER = "PRODUCER"; private static final String DESCRIPTION = "api keys for OOF PCI use case"; private static final int PARTITION_COUNT = 1; private static final int REPLICATION_COUNT = 1; private NewNotification newNotification; private CambriaTopicManager topicManager; public class NotificationCallback { DmaapClient dmaapClient; public NotificationCallback(DmaapClient dmaapClient) { this.dmaapClient = dmaapClient; } public void activateCallBack(String msg) { handleNotification(msg); } private void handleNotification(String msg) { DmaapNotifications dmaapNotification = new DmaapNotifications(); dmaapNotification.setNotification(msg); if (log.isDebugEnabled()) { log.debug(dmaapNotification.toString()); } dmaapNotificationsRepository.save(dmaapNotification); newNotification.setNewNotif(true); } } /** * init dmaap client. */ public void initClient(NewNotification newNotification) { log.debug("initializing client"); configuration = Configuration.getInstance(); if (log.isDebugEnabled()) { log.debug(configuration.toString()); } this.newNotification = newNotification; createAndConfigureTopics(); startClient(); } /** * create and configures topics. */ private void createAndConfigureTopics() { try { topicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(configuration.getServers()) .authenticatedBy(configuration.getManagerApiKey(), configuration.getManagerSecretKey())); } catch (GeneralSecurityException | IOException e) { log.debug("exception during creating topic", e); } List<Topic> topics = configuration.getTopics(); for (Topic topic : topics) { Set<String> topicsInDmaap = getAllTopicsFromDmaap(); createTopic(topic, topicsInDmaap); subscribeToTopic(topic.getName(), topic.getProducer(), PRODUCER); subscribeToTopic(topic.getName(), topic.getConsumer(), CONSUMER); } topicManager.close(); } /** * create topic. */ private void createTopic(Topic topic, Set<String> topicsInDmaap) { if (topicsInDmaap.contains(topic.getName())) { log.debug("topic exists in dmaap"); } else { try { topicManager.createTopic(topic.getName(), DESCRIPTION, PARTITION_COUNT, REPLICATION_COUNT); } catch (HttpException | IOException e) { log.debug("error while creating topic: {}", e); } } } /** * get all topics from dmaap. */ private Set<String> getAllTopicsFromDmaap() { Set<String> topics = new HashSet<>(); try { topics = topicManager.getTopics(); } catch (IOException e) { log.debug("IOException while fetching topics"); } return topics; } /** * start dmaap client. */ private synchronized void startClient() { ScheduledExecutorService executorPool; CambriaConsumer cambriaConsumer = null; try { cambriaConsumer = new ConsumerBuilder() .authenticatedBy(configuration.getPcimsApiKey(), configuration.getPcimsSecretKey()) .knownAs(configuration.getCg(), configuration.getCid()).onTopic(configuration.getSdnrTopic()) .usingHosts(configuration.getServers()).withSocketTimeout(configuration.getPollingTimeout() * 1000) .build(); // create notification consumers for SNDR and policy NotificationConsumer notificationConsumer = new NotificationConsumer(cambriaConsumer, new NotificationCallback(this)); // start notification consumer threads executorPool = Executors.newScheduledThreadPool(10); executorPool.scheduleAtFixedRate(notificationConsumer, 0, configuration.getPollingInterval(), TimeUnit.SECONDS); } catch (MalformedURLException | GeneralSecurityException e) { log.debug("exception during starting client", e); } } /** * subscribe to topic. */ private void subscribeToTopic(String topicName, String subscriberApiKey, String subscriberType) { if (subscriberType.equals(PRODUCER)) { try { topicManager.allowProducer(topicName, subscriberApiKey); } catch (HttpException | IOException e) { log.debug("error while subscribing to a topic: {}", e); } } else if (subscriberType.equals(CONSUMER)) { try { topicManager.allowConsumer(topicName, subscriberApiKey); } catch (HttpException | IOException e) { log.debug("error while subscribing to a topic: {}", e); } } } @SuppressWarnings("unchecked") private static <T extends CambriaClient> T buildCambriaClient( CambriaClientBuilders.AbstractAuthenticatedManagerBuilder<? extends CambriaClient> client) throws MalformedURLException, GeneralSecurityException { return (T) client.build(); } }
package com.github.slamdev.morrigna.toolset.integration; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javax.enterprise.context.Dependent; import java.io.IOException; import java.net.URL; import static java.lang.Character.toLowerCase; @Dependent public class FXMLTypedLoader { public <T extends Parent> T load(Controller<T> controller) { FXMLLoader loader = new FXMLLoader(); loader.setLocation(getFxmlUrl(controller.getClass())); loader.setController(controller); try { return loader.load(); } catch (IOException e) { throw new IllegalStateException(e); } } private URL getFxmlUrl(Class<?> type) { String template = "/fxml/%s/%s.fxml"; String packageDir = type.getPackage().getName().replaceAll("\\.", "/"); String fileName = toLowerFirst(type.getSimpleName()).replace("Controller", ""); return type.getResource(String.format(template, packageDir, fileName)); } private String toLowerFirst(String string) { return toLowerCase(string.charAt(0)) + string.substring(1); } }
package com.codework.game.util; public enum GameState { start, have_up, have_down, have_stay, hit_stay, hit, end }
package ltd.fyeco.soms.domain.constant; /** * 分页默认参数 * * @author tianxin * */ public class CPage { /** * 当前页码 */ public static final Integer PAGE_1 = 1; /** * 总页数 */ public static final Integer PAGES_1 = 1; /** * 每页记录条数 */ public static final Integer PERPAGE_10 = 10; }
package com.atguigu.gulimall.coupon.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.math.BigDecimal; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * 商品满减信息 * * @author blank * @email wangzhiyun@gmail.com * @date 2020-08-18 21:58:59 */ @Data @TableName("sms_sku_full_reduction") public class SkuFullReductionEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private Long id; /** * spu_id */ private Long skuId; /** * 满多少 */ private BigDecimal fullPrice; /** * 减多少 */ private BigDecimal reducePrice; /** * 是否参与其他优惠 */ private Integer addOther; }
/* * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package flash.css; import flash.util.Trace; import flex2.compiler.util.CompilerMessage.CompilerError; import flex2.compiler.util.ThreadLocalToolkit; import org.apache.flex.forks.batik.css.parser.CSSLexicalUnit; import org.w3c.css.sac.LexicalUnit; /** * This class represents a descriptor/property within a CSS rule * declaration. * * @author Peter Farland * @author Paul Reilly */ public class Descriptor { private String name; private LexicalUnit value; private int lineNumber; private String path; public Descriptor(String name, LexicalUnit lexicalUnit, String path) { this.name = name; this.value = lexicalUnit; assert path != null; this.path = path; if (lexicalUnit instanceof CSSLexicalUnit) { lineNumber = ((CSSLexicalUnit) lexicalUnit).getLineNumber(); } } /** * Converts one of the sixteen colors defined in * http://www.w3.org/TR/REC-html40/types.html#h-6.5 to the * 0x000000 format. */ public static String convertColorName(String color) { if (color.length() != 0) { switch (color.charAt(0)) { case 'b': case 'B': if (color.equalsIgnoreCase("black")) { return "0x000000"; } if (color.equalsIgnoreCase("blue")) { return "0x0000FF"; } break; case 'g': case 'G': if (color.equalsIgnoreCase("green")) { return "0x008000"; } if (color.equalsIgnoreCase("gray")) { return "0x808080"; } break; case 's': case 'S': if (color.equalsIgnoreCase("silver")) { return "0xC0C0C0"; } break; case 'l': case 'L': if (color.equalsIgnoreCase("lime")) { return "0x00FF00"; } break; case 'o': case 'O': if (color.equalsIgnoreCase("olive")) { return "0x808000"; } break; case 'w': case 'W': if (color.equalsIgnoreCase("white")) { return "0xFFFFFF"; } break; case 'y': case 'Y': if (color.equalsIgnoreCase("yellow")) { return "0xFFFF00"; } break; case 'm': case 'M': if (color.equalsIgnoreCase("maroon")) { return "0x800000"; } if (color.equalsIgnoreCase("magenta")) { // nonstandard color used by appmodel. See mx.styles.StyleManager.colorNames[] return "0xFF00FF"; } break; case 'n': case 'N': if (color.equalsIgnoreCase("navy")) { return "0x000080"; } break; case 'r': case 'R': if (color.equalsIgnoreCase("red")) { return "0xFF0000"; } break; case 'p': case 'P': if (color.equalsIgnoreCase("purple")) { return "0x800080"; } break; case 't': case 'T': if (color.equalsIgnoreCase("teal")) { return "0x008080"; } break; case 'f': case 'F': if (color.equalsIgnoreCase("fuchsia")) { return "0xFF00FF"; } break; case 'a': case 'A': if (color.equalsIgnoreCase("aqua")) { return "0x00FFFF"; } break; case 'c': case 'C': if (color.equalsIgnoreCase("cyan")) { // nonstandard color used by appmodel. See mx.styles.StyleManager.colorNames[] return "0x00FFFF"; } break; case 'h': case 'H': // // IMPORTANT: Theme colors must be updated in the following places: // 1). In _global.style (near the top of Defaults.as) // 2). In function setThemeStyle (near the bottom of Defaults.as) // 3). In StyleManager colorNames (in the middle of StyleManager.as) // 4). In the Flex compiler CSS parser (in \src\java\macromedia\css\Descriptor.java) // if (color.equalsIgnoreCase("haloGreen")) { // nonstandard color used by appmodel. See mx.styles.StyleManager.colorNames[] return "0x80FF4D"; } if (color.equalsIgnoreCase("haloBlue")) { // nonstandard color used by appmodel. See mx.styles.StyleManager.colorNames[] return "0x009DFF"; } if (color.equalsIgnoreCase("haloOrange")) { // nonstandard color used by appmodel. See mx.styles.StyleManager.colorNames[] return "0xFFB600"; } if (color.equalsIgnoreCase("haloSilver")) { // nonstandard color used by appmodel. See mx.styles.StyleManager.colorNames[] return "0xAECAD9"; } break; } } return null; } public String getName() { return name; } public LexicalUnit getValue() { return value; } public String getIdentAsString() { StringBuilder sb = new StringBuilder(); LexicalUnit lexicalUnit = value; while (lexicalUnit != null) { try { switch(lexicalUnit.getLexicalUnitType()) { case LexicalUnit.SAC_IDENT: sb.append(lexicalUnit.getStringValue()); break; case LexicalUnit.SAC_OPERATOR_COMMA: sb.append(','); break; case LexicalUnit.SAC_INTEGER: sb.append(lexicalUnit.getIntegerValue()); break; default: sb.append(lexicalUnit.getStringValue()); break; } } catch(IllegalStateException ise) { UnparsableCSS unparsableCSS = new UnparsableCSS(); unparsableCSS.path = path; unparsableCSS.line = lineNumber; ThreadLocalToolkit.log(unparsableCSS); } lexicalUnit = lexicalUnit.getNextLexicalUnit(); } return sb.toString(); } public String getColorAsString() throws CompilerError { return getColorAsString(name, value); } private static String getColorAsString(String name, LexicalUnit lexicalUnit) throws CompilerError { String color; short type = lexicalUnit.getLexicalUnitType(); switch(type) { case LexicalUnit.SAC_IDENT: { color = convertColorName( lexicalUnit.getStringValue() ); if (color == null) { throw new ColorNotSupported(lexicalUnit.getStringValue()); } break; } case LexicalUnit.SAC_RGBCOLOR: { StringBuilder stringBuffer = new StringBuilder("0x"); LexicalUnit parameter = lexicalUnit.getParameters(); while (parameter != null) { int digit; switch(parameter.getLexicalUnitType()) { case LexicalUnit.SAC_INTEGER: { digit = parameter.getIntegerValue(); stringBuffer.append(Character.forDigit((digit >> 4) & 15, 16)); stringBuffer.append(Character.forDigit(digit & 15, 16)); break; } case LexicalUnit.SAC_PERCENTAGE: { digit = ((new Float(parameter.getFloatValue())).intValue() * 255) / 100; stringBuffer.append(Character.forDigit((digit >> 4) & 15, 16)); stringBuffer.append(Character.forDigit(digit & 15, 16)); break; } } parameter = parameter.getNextLexicalUnit(); } color = stringBuffer.toString(); break; } default: { if (Trace.css) { Trace.trace("Descriptor.getColorAsString: type = " + type); } throw new ValueNotSupported(name); } } return color; } public String getLengthAsString() throws CompilerError { return getLengthAsString(name, value); } private static String getLengthAsString(String name, LexicalUnit lexicalUnit) throws CompilerError { float length; short type = lexicalUnit.getLexicalUnitType(); switch(type) { case LexicalUnit.SAC_CENTIMETER: { length = (lexicalUnit.getFloatValue() * 72) / 2.54F; break; } case LexicalUnit.SAC_MILLIMETER: { length = ((lexicalUnit.getFloatValue() * 72) / 10) / 2.54F; break; } case LexicalUnit.SAC_INCH: { length = lexicalUnit.getFloatValue() * 72; break; } case LexicalUnit.SAC_PICA: { length = lexicalUnit.getFloatValue() * 12; break; } case LexicalUnit.SAC_PIXEL: { length = lexicalUnit.getFloatValue(); break; } case LexicalUnit.SAC_POINT: { length = lexicalUnit.getFloatValue(); break; } case LexicalUnit.SAC_IDENT: { String absoluteSize = lexicalUnit.getStringValue(); if ( absoluteSize.equalsIgnoreCase("xx-small") ) { length = 7; // (12 / 1.2 / 1.2 / 1.2) } else if ( absoluteSize.equalsIgnoreCase("x-small") ) { length = 8; // (12 / 1.2 / 1.2) } else if ( absoluteSize.equalsIgnoreCase("small") ) { length = 10; // (12 / 1.2) } else if ( absoluteSize.equalsIgnoreCase("medium") ) { length = 12; } else if ( absoluteSize.equalsIgnoreCase("large") ) { length = 14; // (12 * 1.2) } else if ( absoluteSize.equalsIgnoreCase("x-large") ) { length = 17; // (12 * 1.2 * 1.2) } else if ( absoluteSize.equalsIgnoreCase("xx-large") ) { length = 21; // (12 * 1.2 * 1.2 * 1.2) } else { throw new ValueNotSupported(name); } break; } default: { if (Trace.css) { Trace.trace("Descriptor.getLengthAsString: type = " + type); } throw new ValueNotSupported(name); } } return Integer.toString(((new Float(length)).intValue())); } public int getLineNumber() { return lineNumber; } private static String getListAsString(String name, LexicalUnit value) throws CompilerError { return getListAsString(name, value, true); } private static String getListAsString(String name, LexicalUnit value, boolean quoteIdentifier) throws CompilerError { StringBuilder stringBuffer = new StringBuilder(); LexicalUnit current = value; while (current != null) { stringBuffer.append( getLexicalUnitAsString(name, current, quoteIdentifier) ); LexicalUnit next = current.getNextLexicalUnit(); if (next != null) { if (next.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_COMMA) { current = next.getNextLexicalUnit(); stringBuffer.append(", "); } else if (next.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_SLASH) { current = next.getNextLexicalUnit(); stringBuffer.append(" = "); } else { throw new InvalidFormat(); } } else { current = null; } } return stringBuffer.toString(); } public String getPath() { return path; } public String getTimeAsString() throws CompilerError { return getTimeAsString(name, value); } private static String getTimeAsString(String name, LexicalUnit lexicalUnit) throws CompilerError { float time; short type = lexicalUnit.getLexicalUnitType(); switch(type) { case LexicalUnit.SAC_MILLISECOND: { time = lexicalUnit.getFloatValue(); break; } case LexicalUnit.SAC_SECOND: { time = lexicalUnit.getFloatValue() * 60; break; } default: { if (Trace.css) { Trace.trace("Descriptor.getTimeAsString: type = " + type); } throw new ValueNotSupported(name); } } return Integer.toString(((new Float(time)).intValue())); } /** * This method should be used to get the string value of a * Descriptor, when the format isn't already known. */ public String getValueAsString() throws CompilerError { String valueString; LexicalUnit next = value.getNextLexicalUnit(); if ((next != null) && (next.getLexicalUnitType() == LexicalUnit.SAC_OPERATOR_COMMA)) { valueString = ("[" + getListAsString(name, value) + "]"); } else { valueString = getLexicalUnitAsString(name, value); } return valueString; } private static String getLexicalUnitAsString(String name, LexicalUnit lexicalUnit) throws CompilerError { return getLexicalUnitAsString(name, lexicalUnit, true); } private static String getLexicalUnitAsString(String name, LexicalUnit lexicalUnit, boolean quoteIdentifier) throws CompilerError { String result; short type = lexicalUnit.getLexicalUnitType(); switch(type) { case LexicalUnit.SAC_MILLISECOND: case LexicalUnit.SAC_SECOND: { result = getTimeAsString(name, lexicalUnit); break; } case LexicalUnit.SAC_CENTIMETER: case LexicalUnit.SAC_MILLIMETER: case LexicalUnit.SAC_INCH: case LexicalUnit.SAC_PICA: case LexicalUnit.SAC_POINT: case LexicalUnit.SAC_PIXEL: { result = getLengthAsString(name, lexicalUnit); break; } case LexicalUnit.SAC_RGBCOLOR: { result = getColorAsString(name, lexicalUnit); break; } case LexicalUnit.SAC_INTEGER: { result = Integer.toString( lexicalUnit.getIntegerValue() ); break; } case LexicalUnit.SAC_REAL: { result = Float.toString( lexicalUnit.getFloatValue() ); break; } case LexicalUnit.SAC_STRING_VALUE: case LexicalUnit.SAC_URI: { result = "\"" + lexicalUnit.getStringValue().replace('\"', '\'') + "\""; break; } case LexicalUnit.SAC_IDENT: { // This could be a color, absolute size, or just a // plain identifier, so try each in that order. try { result = getColorAsString(name, lexicalUnit); } catch (CompilerError compilerError) { try { result = getLengthAsString(name, lexicalUnit); } catch (CompilerError compilerError2) { String stringValue = lexicalUnit.getStringValue(); if (stringValue.equalsIgnoreCase(Boolean.FALSE.toString()) || stringValue.equalsIgnoreCase(Boolean.TRUE.toString())) { result = stringValue; } else if (quoteIdentifier) { // preilly: Don't use getIdentAsString() here, see bug 86974. result = "\"" + stringValue.replace('\"', '\'') + "\""; } else { result = stringValue; } } } break; } case LexicalUnit.SAC_FUNCTION: { String functionName = lexicalUnit.getFunctionName(); if (functionName.equals("Embed") || functionName.equals("ClassReference") || functionName.equals("PropertyReference")) { result = functionName + "(" + getListAsString(null, lexicalUnit.getParameters(), false) + ")"; } else { throw new FunctionNotSupported(functionName); } break; } default: { if (Trace.css) { Trace.trace("Descriptor.getLexicalUnitAsString: type = " + type); } throw new ValueNotSupported(name); } } return result; } public static class ColorNotSupported extends CompilerError { private static final long serialVersionUID = -9167022814274170798L; public String color; public ColorNotSupported(String color) { this.color = color; } } public static class InvalidFormat extends CompilerError { private static final long serialVersionUID = 8620593353408269587L; } public static class UnparsableCSS extends CompilerError { private static final long serialVersionUID = -8939846058668804295L; } public static class ValueNotSupported extends CompilerError { private static final long serialVersionUID = 657854378435002555L; public String value; public ValueNotSupported(String value) { this.value = value; } } public static class FunctionNotSupported extends CompilerError { private static final long serialVersionUID = -7607804535214540281L; public String function; public FunctionNotSupported(String function) { this.function = function; } } }
package com.atguigu.netty.buf; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import java.nio.charset.Charset; public class NettyByteBuf02 { public static void main(String[] args) { //创建ByteBuf ByteBuf byteBuf = Unpooled.copiedBuffer("hello,world!", Charset.forName("utf-8")); //使用相关的方法 if(byteBuf.hasArray()) { // true byte[] content = byteBuf.array(); //将 content 转成字符串 System.out.println(new String(content, Charset.forName("utf-8"))); System.out.println("byteBuf=" + byteBuf); System.out.println(byteBuf.arrayOffset()); // 0 System.out.println(byteBuf.readerIndex()); // 0 System.out.println(byteBuf.writerIndex()); // 12 System.out.println(byteBuf.capacity()); // 36 //System.out.println(byteBuf.readByte()); // System.out.println(byteBuf.getByte(0)); // 104 int len = byteBuf.readableBytes(); //可读的字节数 12 System.out.println("len=" + len); //使用for取出各个字节 for(int i = 0; i < len; i++) { System.out.println((char) byteBuf.getByte(i)); } //按照某个范围读取 System.out.println(byteBuf.getCharSequence(0, 4, Charset.forName("utf-8"))); System.out.println(byteBuf.getCharSequence(4, 6, Charset.forName("utf-8"))); } } }
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.drds.model.v20190123; import com.aliyuncs.RpcAcsRequest; import com.aliyuncs.http.MethodType; import com.aliyuncs.drds.Endpoint; /** * @author auto create * @version */ public class DescribeInstanceSwitchAzoneRequest extends RpcAcsRequest<DescribeInstanceSwitchAzoneResponse> { private String drdsInstanceId; public DescribeInstanceSwitchAzoneRequest() { super("Drds", "2019-01-23", "DescribeInstanceSwitchAzone", "drds"); setMethod(MethodType.POST); try { com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap); com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType); } catch (Exception e) {} } public String getDrdsInstanceId() { return this.drdsInstanceId; } public void setDrdsInstanceId(String drdsInstanceId) { this.drdsInstanceId = drdsInstanceId; if(drdsInstanceId != null){ putQueryParameter("DrdsInstanceId", drdsInstanceId); } } @Override public Class<DescribeInstanceSwitchAzoneResponse> getResponseClass() { return DescribeInstanceSwitchAzoneResponse.class; } }
/* * * Copyright (c) 2013 - 2020 Lijun Liao * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.xipki.p11proxy.servlet; import org.bouncycastle.asn1.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xipki.security.BadAsn1ObjectException; import org.xipki.security.X509Cert; import org.xipki.security.pkcs11.P11Params; import org.xipki.security.pkcs11.*; import org.xipki.security.pkcs11.P11Params.P11ByteArrayParams; import org.xipki.security.pkcs11.P11Params.P11IVParams; import org.xipki.security.pkcs11.proxy.P11ProxyConstants; import org.xipki.security.pkcs11.proxy.asn1.*; import org.xipki.security.util.KeyUtil; import org.xipki.util.Hex; import org.xipki.util.IoUtil; import org.xipki.util.LogUtil; import org.xipki.util.StringUtil; import java.io.IOException; import java.security.PublicKey; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; /** * The responder of P11Proxy. * * @author Lijun Liao * @since 2.0.0 */ public class P11ProxyResponder { private static final Logger LOG = LoggerFactory.getLogger(P11ProxyResponder.class); private static final String version; private static final Set<Short> actionsRequireNonNullRequest; private static final Set<Short> actionsRequireNullRequest; private final Set<Short> versions; static { Set<Short> actions = new HashSet<>(); actions.add(P11ProxyConstants.ACTION_GET_SERVER_CAPS); actions.add(P11ProxyConstants.ACTION_GET_SLOT_IDS); actionsRequireNullRequest = Collections.unmodifiableSet(actions); actions = new HashSet<>(); actions.add(P11ProxyConstants.ACTION_ADD_CERT); actions.add(P11ProxyConstants.ACTION_GEN_KEYPAIR_DSA); actions.add(P11ProxyConstants.ACTION_GEN_KEYPAIR_EC); actions.add(P11ProxyConstants.ACTION_GEN_KEYPAIR_EC_EDWARDS); actions.add(P11ProxyConstants.ACTION_GEN_KEYPAIR_EC_MONTGOMERY); actions.add(P11ProxyConstants.ACTION_GEN_KEYPAIR_SM2); actions.add(P11ProxyConstants.ACTION_GEN_KEYPAIR_RSA); actions.add(P11ProxyConstants.ACTION_GEN_SECRET_KEY); actions.add(P11ProxyConstants.ACTION_IMPORT_SECRET_KEY); actions.add(P11ProxyConstants.ACTION_GET_CERT); actions.add(P11ProxyConstants.ACTION_GET_CERT_IDS); actions.add(P11ProxyConstants.ACTION_GET_IDENTITY_IDS); actions.add(P11ProxyConstants.ACTION_GET_MECHANISMS); actions.add(P11ProxyConstants.ACTION_GET_PUBLICKEY); actions.add(P11ProxyConstants.ACTION_REMOVE_CERTS); actions.add(P11ProxyConstants.ACTION_REMOVE_IDENTITY); actions.add(P11ProxyConstants.ACTION_REMOVE_OBJECTS); actions.add(P11ProxyConstants.ACTION_SIGN); actions.add(P11ProxyConstants.ACTION_UPDATE_CERT); actions.add(P11ProxyConstants.ACTION_DIGEST_SECRETKEY); actionsRequireNonNullRequest = Collections.unmodifiableSet(actions); String ver; try { ver = StringUtil.toUtf8String( IoUtil.read(P11ProxyResponder.class.getResourceAsStream("/version"))).trim(); } catch (Exception ex) { ver = "UNKNOWN"; } version = ver; } // method static public P11ProxyResponder() { LOG.info("XiPKI PKCS#11 Proxy Responder version {}", version); Set<Short> tmpVersions = new HashSet<>(); tmpVersions.add(P11ProxyConstants.VERSION_V1_0); this.versions = Collections.unmodifiableSet(tmpVersions); } public Set<Short> versions() { return versions; } /** * The request is constructed as follows. * <pre> * 0 - - - 1 - - - 2 - - - 3 - - - 4 - - - 5 - - - 6 - - - 7 - - - 8 * | Version | Transaction ID | Body ... | * | ... Length | Action | Module ID | Content... | * | .Content | &lt;-- 10 + Length (offset). * * </pre> * * @param pool * The pool that holds the P11CryptService. * @param request * The request. * @return response. */ public byte[] processRequest(LocalP11CryptServicePool pool, byte[] request) { int reqLen = request.length; // TransactionID byte[] transactionId = new byte[4]; if (reqLen > 5) { System.arraycopy(request, 2, transactionId, 0, 4); } // Action short action = P11ProxyConstants.ACTION_NOPE; if (reqLen > 11) { action = IoUtil.parseShort(request, 10); } if (reqLen < 14) { LOG.error("response too short"); return getResp(P11ProxyConstants.VERSION_V1_0, transactionId, P11ProxyConstants.RC_BAD_REQUEST, action); } // Version short version = IoUtil.parseShort(request, 0); if (!versions.contains(version)) { LOG.error("unsupported version {}", version); return getResp(P11ProxyConstants.VERSION_V1_0, transactionId, P11ProxyConstants.RC_UNSUPPORTED_VERSION, action); } // Length int reqBodyLen = IoUtil.parseInt(request, 6); if (reqBodyLen + 10 != reqLen) { LOG.error("message length unmatch"); return getResp(version, transactionId, P11ProxyConstants.RC_BAD_REQUEST, action); } short moduleId = IoUtil.parseShort(request, 12); int contentLen = reqLen - 14; byte[] content; if (contentLen == 0) { if (actionsRequireNonNullRequest.contains(action)) { LOG.error("content is not present but is required"); return getResp(version, transactionId, P11ProxyConstants.RC_BAD_REQUEST, action); } content = null; } else { if (actionsRequireNullRequest.contains(action)) { LOG.error("content is present but is not permitted"); return getResp(version, transactionId, P11ProxyConstants.RC_BAD_REQUEST, action); } content = new byte[contentLen]; System.arraycopy(request, 14, content, 0, contentLen); } P11CryptService p11CryptService = pool.getP11CryptService(moduleId); if (p11CryptService == null) { LOG.error("no module {} available", moduleId); return getResp(version, transactionId, P11ProxyConstants.RC_UNKNOWN_MODULE, action); } try { switch (action) { case P11ProxyConstants.ACTION_ADD_CERT: { AddCertParams asn1 = AddCertParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); X509Cert cert = new X509Cert(asn1.getCertificate()); slot.addCert(cert, asn1.getControl()); return getSuccessResp(version, transactionId, action, (byte[]) null); } case P11ProxyConstants.ACTION_DIGEST_SECRETKEY: { DigestSecretKeyTemplate template = DigestSecretKeyTemplate.getInstance(content); long mechanism = template.getMechanism().getMechanism(); P11Identity identity = p11CryptService.getIdentity( template.getSlotId().getValue(), template.getObjectId().getValue()); byte[] hashValue = identity.digestSecretKey(mechanism); ASN1Object obj = new DEROctetString(hashValue); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GEN_KEYPAIR_DSA: { GenDSAKeypairParams asn1 = GenDSAKeypairParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); P11IdentityId identityId = slot.generateDSAKeypair( asn1.getP(), asn1.getQ(), asn1.getG(), asn1.getControl()); ASN1Object obj = new IdentityId(identityId); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GEN_KEYPAIR_EC: { GenECKeypairParams asn1 = GenECKeypairParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); P11IdentityId identityId = slot.generateECKeypair( asn1.getCurveId(), asn1.getControl()); ASN1Object obj = new IdentityId(identityId); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GEN_KEYPAIR_EC_EDWARDS: { GenECEdwardsOrMontgomeryKeypairParams asn1 = GenECEdwardsOrMontgomeryKeypairParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); P11IdentityId identityId = slot.generateECEdwardsKeypair( asn1.getCurveOid(), asn1.getControl()); ASN1Object obj = new IdentityId(identityId); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GEN_KEYPAIR_EC_MONTGOMERY: { GenECEdwardsOrMontgomeryKeypairParams asn1 = GenECEdwardsOrMontgomeryKeypairParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); P11IdentityId identityId = slot.generateECMontgomeryKeypair( asn1.getCurveOid(), asn1.getControl()); ASN1Object obj = new IdentityId(identityId); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GEN_KEYPAIR_RSA: { GenRSAKeypairParams asn1 = GenRSAKeypairParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); P11IdentityId identityId = slot.generateRSAKeypair( asn1.getKeysize(), asn1.getPublicExponent(), asn1.getControl()); ASN1Object obj = new IdentityId(identityId); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GEN_KEYPAIR_SM2: { GenSM2KeypairParams asn1 = GenSM2KeypairParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); P11IdentityId identityId = slot.generateSM2Keypair(asn1.getControl()); ASN1Object obj = new IdentityId(identityId); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GEN_SECRET_KEY: { GenSecretKeyParams asn1 = GenSecretKeyParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); P11IdentityId identityId = slot.generateSecretKey(asn1.getKeyType(), asn1.getKeysize(), asn1.getControl()); ASN1Object obj = new IdentityId(identityId); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GET_CERT: { SlotIdAndObjectId identityId = SlotIdAndObjectId.getInstance(content); P11SlotIdentifier slotId = identityId.getSlotId().getValue(); P11ObjectIdentifier certId = identityId.getObjectId().getValue(); X509Cert cert = p11CryptService.getCert(slotId, certId); if (cert == null) { throw new P11UnknownEntityException(slotId, certId); } return getSuccessResp(version, transactionId, action, cert.getEncoded()); } case P11ProxyConstants.ACTION_GET_CERT_IDS: case P11ProxyConstants.ACTION_GET_PUBLICKEY_IDS: case P11ProxyConstants.ACTION_GET_IDENTITY_IDS: { SlotIdentifier slotId = SlotIdentifier.getInstance(content); P11Slot slot = p11CryptService.getModule().getSlot(slotId.getValue()); Set<P11ObjectIdentifier> objectIds; if (P11ProxyConstants.ACTION_GET_CERT_IDS == action) { objectIds = slot.getCertIds(); } else if (P11ProxyConstants.ACTION_GET_IDENTITY_IDS == action) { objectIds = slot.getIdentityKeyIds(); } else { Set<P11ObjectIdentifier> identityKeyIds = slot.getIdentityKeyIds(); objectIds = new HashSet<>(); for (P11ObjectIdentifier identityKeyId : identityKeyIds) { objectIds.add(slot.getIdentity(identityKeyId).getId().getPublicKeyId()); } } ASN1EncodableVector vec = new ASN1EncodableVector(); for (P11ObjectIdentifier objectId : objectIds) { vec.add(new ObjectIdentifier(objectId)); } ASN1Object obj = new DERSequence(vec); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GET_MECHANISMS: { P11SlotIdentifier slotId = SlotIdentifier.getInstance(content).getValue(); Set<Long> mechs = p11CryptService.getSlot(slotId).getMechanisms(); ASN1EncodableVector vec = new ASN1EncodableVector(); for (Long mech : mechs) { vec.add(new ASN1Integer(mech)); } ASN1Object obj = new DERSequence(vec); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GET_PUBLICKEY: { SlotIdAndObjectId identityId = SlotIdAndObjectId.getInstance(content); P11SlotIdentifier slotId = identityId.getSlotId().getValue(); P11ObjectIdentifier pubKeyId = identityId.getObjectId().getValue(); // find out the keyId PublicKey pubKey = null; P11Slot slot = getSlot(p11CryptService, slotId); Set<P11ObjectIdentifier> identityKeyIds = slot.getIdentityKeyIds(); for (P11ObjectIdentifier identityKeyId : identityKeyIds) { P11Identity identity = slot.getIdentity(identityKeyId); if (pubKeyId.equals(identity.getId().getPublicKeyId())) { pubKey = identity.getPublicKey(); } } if (pubKey == null) { throw new P11UnknownEntityException(slotId, pubKeyId); } ASN1Object obj = KeyUtil.createSubjectPublicKeyInfo(pubKey); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GET_SERVER_CAPS: { boolean readOnly = p11CryptService.getModule().isReadOnly(); ASN1Object obj = new ServerCaps(readOnly, versions); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_GET_SLOT_IDS: { List<P11SlotIdentifier> slotIds = p11CryptService.getModule().getSlotIds(); ASN1EncodableVector vector = new ASN1EncodableVector(); for (P11SlotIdentifier slotId : slotIds) { vector.add(new SlotIdentifier(slotId)); } ASN1Object obj = new DERSequence(vector); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_IMPORT_SECRET_KEY: { ImportSecretKeyParams asn1 = ImportSecretKeyParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); P11ObjectIdentifier keyId = slot.importSecretKey(asn1.getKeyType(), asn1.getKeyValue(), asn1.getControl()); P11IdentityId identityId = new P11IdentityId(asn1.getSlotId(), keyId, null, null); ASN1Object obj = new IdentityId(identityId); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_REMOVE_CERTS: { SlotIdAndObjectId asn1 = SlotIdAndObjectId.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId().getValue()); slot.removeCerts(asn1.getObjectId().getValue()); return getSuccessResp(version, transactionId, action, (byte[])null); } case P11ProxyConstants.ACTION_REMOVE_IDENTITY: { SlotIdAndObjectId asn1 = SlotIdAndObjectId.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId().getValue()); slot.removeIdentityByKeyId(asn1.getObjectId().getValue()); return getSuccessResp(version, transactionId, action, (byte[])null); } case P11ProxyConstants.ACTION_REMOVE_OBJECTS: { RemoveObjectsParams asn1 = RemoveObjectsParams.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId()); int num = slot.removeObjects(asn1.getOjectId(), asn1.getObjectLabel()); ASN1Object obj = new ASN1Integer(num); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_SIGN: { SignTemplate signTemplate = SignTemplate.getInstance(content); long mechanism = signTemplate.getMechanism().getMechanism(); org.xipki.security.pkcs11.proxy.asn1.P11Params asn1Params = signTemplate.getMechanism().getParams(); P11Params params = null; if (asn1Params != null) { switch (asn1Params.getTagNo()) { case org.xipki.security.pkcs11.proxy.asn1.P11Params.TAG_RSA_PKCS_PSS: params = RSAPkcsPssParams.getInstance(asn1Params).getPkcsPssParams(); break; case org.xipki.security.pkcs11.proxy.asn1.P11Params.TAG_OPAQUE: params = new P11ByteArrayParams( ASN1OctetString.getInstance(asn1Params).getOctets()); break; case org.xipki.security.pkcs11.proxy.asn1.P11Params.TAG_IV: params = new P11IVParams(ASN1OctetString.getInstance(asn1Params).getOctets()); break; default: throw new BadAsn1ObjectException( "unknown SignTemplate.params: unknown tag " + asn1Params.getTagNo()); } } byte[] message = signTemplate.getMessage(); P11Identity identity = p11CryptService.getIdentity(signTemplate.getSlotId().getValue(), signTemplate.getObjectId().getValue()); if (identity == null) { return getResp(version, transactionId, P11ProxyConstants.RC_UNKNOWN_ENTITY, action); } byte[] signature = identity.sign(mechanism, params, message); ASN1Object obj = new DEROctetString(signature); return getSuccessResp(version, transactionId, action, obj); } case P11ProxyConstants.ACTION_UPDATE_CERT: { ObjectIdAndCert asn1 = ObjectIdAndCert.getInstance(content); P11Slot slot = getSlot(p11CryptService, asn1.getSlotId().getValue()); slot.updateCertificate(asn1.getObjectId().getValue(), new X509Cert(asn1.getCertificate())); return getSuccessResp(version, transactionId, action, (byte[])null); } default: { LOG.error("unsupported XiPKI action code '{}'", action); return getResp(version, transactionId, P11ProxyConstants.RC_UNSUPPORTED_ACTION, action); } } } catch (BadAsn1ObjectException ex) { LogUtil.error(LOG, ex, "could not process decode requested content (tid=" + Hex.encode(transactionId) + ")"); return getResp(version, transactionId, P11ProxyConstants.RC_BAD_REQUEST, action); } catch (P11TokenException ex) { LogUtil.error(LOG, ex, buildErrorMsg(action, transactionId)); short rc; if (ex instanceof P11UnknownEntityException) { rc = P11ProxyConstants.RC_UNKNOWN_ENTITY; } else if (ex instanceof P11DuplicateEntityException) { rc = P11ProxyConstants.RC_DUPLICATE_ENTITY; } else if (ex instanceof P11UnsupportedMechanismException) { rc = P11ProxyConstants.RC_UNSUPPORTED_MECHANISM; } else { rc = P11ProxyConstants.RC_P11_TOKENERROR; } return getResp(version, transactionId, rc, action); } catch (Throwable th) { LogUtil.error(LOG, th, buildErrorMsg(action, transactionId)); return getResp(version, transactionId, P11ProxyConstants.RC_INTERNAL_ERROR, action); } } // method processRequest private static String buildErrorMsg(short action, byte[] transactionId) { return "could not process action " + P11ProxyConstants.getActionName(action) + " (tid=" + Hex.encode(transactionId) + ")"; } private P11Slot getSlot(P11CryptService p11Service, P11SlotIdentifier slotId) throws P11TokenException { P11Slot slot = p11Service.getModule().getSlot(slotId); if (slot == null) { throw new P11UnknownEntityException(slotId); } return slot; } // method getSlot private static byte[] getResp(short version, byte[] transactionId, short rc, short action) { byte[] resp = new byte[14]; IoUtil.writeShort(version, resp, 0); // version System.arraycopy(transactionId, 0, resp, 2, 4); // transaction Id IoUtil.writeInt(4, resp, 6); // length IoUtil.writeShort(rc, resp, 10); // RC IoUtil.writeShort(action, resp, 12); // action return resp; } // method getResp private static byte[] getSuccessResp(short version, byte[] transactionId, short action, ASN1Object respContent) { byte[] encoded; try { encoded = respContent.getEncoded(); } catch (IOException ex) { LogUtil.error(LOG, ex, "could not encode response ASN1Object"); return getResp(version, transactionId, P11ProxyConstants.RC_INTERNAL_ERROR, action); } return getSuccessResp(version, transactionId, action, encoded); } // method getSuccessResp private static byte[] getSuccessResp(short version, byte[] transactionId, short action, byte[] respContent) { int bodyLen = 4; if (respContent != null) { bodyLen += respContent.length; } byte[] resp = (respContent == null) ? new byte[14] : new byte[10 + bodyLen]; IoUtil.writeShort(version, resp, 0); // version System.arraycopy(transactionId, 0, resp, 2, 4); // transaction Id IoUtil.writeInt(bodyLen, resp, 6); // length IoUtil.writeShort(P11ProxyConstants.RC_SUCCESS, resp, 10); // RC IoUtil.writeShort(action, resp, 12); // action if (respContent != null) { System.arraycopy(respContent, 0, resp, 14, respContent.length); } return resp; } // method getSuccessResp }
package com.company.customeridentificationsystem.security; import com.company.customeridentificationsystem.model.dao.User; import com.company.customeridentificationsystem.model.dao.UserPrincipal; import com.company.customeridentificationsystem.repository.UserRepository; import lombok.RequiredArgsConstructor; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor public class CustomUserDetailsService implements UserDetailsService { private final UserRepository userRepository; @Override public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username) .orElseThrow(() -> new UsernameNotFoundException(username)); return new UserPrincipal(user); } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.iotcentral.implementation; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; import com.azure.core.annotation.PathParam; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.iotcentral.fluent.PrivateLinksClient; import com.azure.resourcemanager.iotcentral.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.iotcentral.models.PrivateLinkResourceListResult; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in PrivateLinksClient. */ public final class PrivateLinksClientImpl implements PrivateLinksClient { /** The proxy service used to perform REST calls. */ private final PrivateLinksService service; /** The service client containing this operation class. */ private final IotCentralClientImpl client; /** * Initializes an instance of PrivateLinksClientImpl. * * @param client the instance of the service client containing this operation class. */ PrivateLinksClientImpl(IotCentralClientImpl client) { this.service = RestProxy.create(PrivateLinksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** * The interface defining all the services for IotCentralClientPrivateLinks to be used by the proxy service to * perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "IotCentralClientPriv") private interface PrivateLinksService { @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps" + "/{resourceName}/privateLinkResources/{groupId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono<Response<PrivateLinkResourceInner>> get( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, @PathParam("groupId") String groupId, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/iotApps" + "/{resourceName}/privateLinkResources") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono<Response<PrivateLinkResourceListResult>> list( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, @HeaderParam("Accept") String accept, Context context); } /** * Get a private link resource of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param groupId The private link resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private link resource of a IoT Central Application along with {@link Response} on successful completion * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<PrivateLinkResourceInner>> getWithResponseAsync( String resourceGroupName, String resourceName, String groupId) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (groupId == null) { return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .get( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, groupId, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get a private link resource of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param groupId The private link resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private link resource of a IoT Central Application along with {@link Response} on successful completion * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<PrivateLinkResourceInner>> getWithResponseAsync( String resourceGroupName, String resourceName, String groupId, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (groupId == null) { return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, groupId, accept, context); } /** * Get a private link resource of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param groupId The private link resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private link resource of a IoT Central Application on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PrivateLinkResourceInner> getAsync(String resourceGroupName, String resourceName, String groupId) { return getWithResponseAsync(resourceGroupName, resourceName, groupId) .flatMap( (Response<PrivateLinkResourceInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * Get a private link resource of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param groupId The private link resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private link resource of a IoT Central Application. */ @ServiceMethod(returns = ReturnType.SINGLE) public PrivateLinkResourceInner get(String resourceGroupName, String resourceName, String groupId) { return getAsync(resourceGroupName, resourceName, groupId).block(); } /** * Get a private link resource of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param groupId The private link resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private link resource of a IoT Central Application along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<PrivateLinkResourceInner> getWithResponse( String resourceGroupName, String resourceName, String groupId, Context context) { return getWithResponseAsync(resourceGroupName, resourceName, groupId, context).block(); } /** * Get all private link resources of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private link resources of a IoT Central Application along with {@link PagedResponse} on successful * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<PrivateLinkResourceInner>> listSinglePageAsync( String resourceGroupName, String resourceName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, accept, context)) .<PagedResponse<PrivateLinkResourceInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get all private link resources of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private link resources of a IoT Central Application along with {@link PagedResponse} on successful * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<PrivateLinkResourceInner>> listSinglePageAsync( String resourceGroupName, String resourceName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .list( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** * Get all private link resources of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private link resources of a IoT Central Application as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<PrivateLinkResourceInner> listAsync(String resourceGroupName, String resourceName) { return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, resourceName)); } /** * Get all private link resources of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private link resources of a IoT Central Application as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<PrivateLinkResourceInner> listAsync( String resourceGroupName, String resourceName, Context context) { return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, resourceName, context)); } /** * Get all private link resources of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private link resources of a IoT Central Application as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<PrivateLinkResourceInner> list(String resourceGroupName, String resourceName) { return new PagedIterable<>(listAsync(resourceGroupName, resourceName)); } /** * Get all private link resources of a IoT Central Application. * * @param resourceGroupName The name of the resource group that contains the IoT Central application. * @param resourceName The ARM resource name of the IoT Central application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all private link resources of a IoT Central Application as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<PrivateLinkResourceInner> list( String resourceGroupName, String resourceName, Context context) { return new PagedIterable<>(listAsync(resourceGroupName, resourceName, context)); } }
package com.kuropatin.zenbooking.repository; import com.kuropatin.zenbooking.exception.ApplicationException; import com.kuropatin.zenbooking.model.Property; import com.kuropatin.zenbooking.model.PropertyType; import com.kuropatin.zenbooking.model.request.PropertySearchCriteria; import com.kuropatin.zenbooking.repository.mapper.PropertyMapper; import com.zaxxer.hikari.HikariDataSource; import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Repository; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Repository @RequiredArgsConstructor public class JdbcSearch implements SearchRepository { private final HikariDataSource hikariDataSource; @AllArgsConstructor private final class QueryAndParams { private final String sql; private final Map<Integer, Object> params; } @Override public List<Property> searchByCriteria(final Long userId, final PropertySearchCriteria searchCriteria) { final List<Property> propertyList = new ArrayList<>(); final QueryAndParams queryAndParams = buildQuery(userId, searchCriteria); final String sql = queryAndParams.sql; final Map<Integer, Object> params = queryAndParams.params; try(final Connection connection = hikariDataSource.getConnection(); final PreparedStatement preparedStatement = connection.prepareStatement(sql) ) { for (final Map.Entry<Integer, Object> entry : params.entrySet()) { preparedStatement.setObject(entry.getKey(), entry.getValue()); } try (final ResultSet resultSet = preparedStatement.executeQuery()) { while (resultSet.next()) { propertyList.add(new PropertyMapper().mapRow(resultSet, resultSet.getRow())); } } return propertyList; } catch (SQLException e) { throw new ApplicationException(e); } } private QueryAndParams buildQuery(final Long userId, final PropertySearchCriteria criteria) { try { final Map<Integer, Object> params = new HashMap<>(); int index = 0; final StringBuilder queryBuilder = new StringBuilder( "SELECT p.* FROM property p " + "WHERE p.is_deleted = false " + "AND p.user_id <> ? " + "AND p.is_available = true " ); params.put(++index, userId); if (StringUtils.isNotBlank(criteria.getAddress())) { queryBuilder.append("AND LOWER(p.address) LIKE LOWER('%' || ? || '%') "); params.put(++index, criteria.getAddress()); } if (StringUtils.isNotBlank(criteria.getType()) && !criteria.getType().equals(PropertyType.NOT_SPECIFIED.toString())) { queryBuilder.append("AND p.type = ? "); params.put(++index, criteria.getType()); } if (criteria.getPriceMin() != null) { queryBuilder.append("AND p.price >= ? "); params.put(++index, criteria.getPriceMin()); } if (criteria.getPriceMax() != null) { queryBuilder.append("AND p.price <= ? "); params.put(++index, criteria.getPriceMax()); } if (criteria.getGuests() != null) { queryBuilder.append("AND p.guests >= ? "); params.put(++index, criteria.getGuests()); } if (criteria.getRooms() != null) { queryBuilder.append("AND p.rooms >= ? "); params.put(++index, criteria.getRooms()); } if (criteria.getBeds() != null) { queryBuilder.append("AND p.beds >= ? "); params.put(++index, criteria.getBeds()); } if (Boolean.TRUE.equals(criteria.getHasKitchen())) { queryBuilder.append("AND p.has_kitchen = ? "); params.put(++index, criteria.getHasKitchen()); } if (Boolean.TRUE.equals(criteria.getHasWasher())) { queryBuilder.append("AND p.has_washer = ? "); params.put(++index, criteria.getHasWasher()); } if (Boolean.TRUE.equals(criteria.getHasTv())) { queryBuilder.append("AND p.has_tv = ? "); params.put(++index, criteria.getHasTv()); } if (Boolean.TRUE.equals(criteria.getHasInternet())) { queryBuilder.append("AND p.has_internet = ? "); params.put(++index, criteria.getHasInternet()); } if (Boolean.TRUE.equals(criteria.getIsPetsAllowed())) { queryBuilder.append("AND p.is_pets_allowed = ? "); params.put(++index, criteria.getIsPetsAllowed()); } queryBuilder.append( "AND p.id NOT IN ( " + "SELECT DISTINCT o.property_id FROM orders o " + "WHERE o.is_cancelled = false " + "AND o.is_finished = false " + "AND (to_date(?, 'yyyy-mm-dd') BETWEEN o.start_date AND o.end_date " + "OR to_date(?, 'yyyy-mm-dd') BETWEEN o.start_date AND o.end_date " + "OR o.start_date BETWEEN to_date(?, 'yyyy-mm-dd') AND to_date(?, 'yyyy-mm-dd') " + "OR o.end_date BETWEEN to_date(?, 'yyyy-mm-dd') AND to_date(?, 'yyyy-mm-dd'))) " + "ORDER BY p.price ASC " + "LIMIT ? OFFSET ?" ); params.put(++index, criteria.getStartDate()); params.put(++index, criteria.getEndDate()); params.put(++index, criteria.getStartDate()); params.put(++index, criteria.getEndDate()); params.put(++index, criteria.getStartDate()); params.put(++index, criteria.getEndDate()); final int perPage = criteria.getPerPage() == null ? 10 : criteria.getPerPage(); final int pageNumber = criteria.getPageNumber() == null ? 1 : criteria.getPageNumber(); params.put(++index, perPage); params.put(++index, (pageNumber - 1) * perPage); return new QueryAndParams(queryBuilder.toString(), params); } catch (Exception e) { throw new ApplicationException(e); } } }
/* * Copyright 2019-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.nativex.hint; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Configure reflection for a given field. * * @see <a href="https://www.graalvm.org/reference-manual/native-image/Reflection/#manual-configuration">Manual configuration of reflection use in native images</a> * @author Andy Clement * @author Sebastien Deleuze */ @Retention(RetentionPolicy.RUNTIME) public @interface FieldHint { /** * The name of the field. * @return the name */ String name(); /** * Allow unsafe access on the related field. * @return {@code true} if allowed * @see <a href="https://www.graalvm.org/reference-manual/native-image/Reflection/#unsafe-accesses">Unsafe accesses</a> */ boolean allowUnsafeAccess() default false; // TODO support allowWrite option when a use case requires it }
package org.gentar.biology.targ_rep.allele; import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; import java.util.ArrayList; import java.util.List; import org.springframework.restdocs.payload.FieldDescriptor; public class AlleleFieldsDescriptors { public static List<FieldDescriptor> getAlleleFieldsDescriptions(String prefix) { List<FieldDescriptor> alleleFieldsDescriptions = new ArrayList<>(); addField(alleleFieldsDescriptions, prefix + "id", "Public identifier for the Allele. READ ONLY"); addField(alleleFieldsDescriptions, prefix + "assembly", "Allele Assembly"); addField(alleleFieldsDescriptions, prefix + "chromosome", "Allele Chromosome"); addField(alleleFieldsDescriptions, prefix + "strand", "Allele Strand"); addField(alleleFieldsDescriptions, prefix + "mgi_accession_id", "MGI Accession id"); addField(alleleFieldsDescriptions, prefix + "cassette", "Allele Cassette"); addField(alleleFieldsDescriptions, prefix + "backbone", "Allele Backbone"); addField(alleleFieldsDescriptions, prefix + "project_design_id", "Allele Project Design Id"); addField(alleleFieldsDescriptions, prefix + "design_type.name", "Allele Design Type Name"); addField(alleleFieldsDescriptions, prefix + "subtype_description", "Allele Subtype Description"); addField(alleleFieldsDescriptions, prefix + "homology_arm_start", "Allele Homology Arm Start"); addField(alleleFieldsDescriptions, prefix + "homology_arm_end", "Allele Homology Arm End"); addField(alleleFieldsDescriptions, prefix + "cassette_start", "Allele Cassette Start"); addField(alleleFieldsDescriptions, prefix + "cassette_end", "Allele Cassette End"); addField(alleleFieldsDescriptions, prefix + "loxp_start", "Allele Loxp Start"); addField(alleleFieldsDescriptions, prefix + "loxp_end", "Allele Loxp End"); addField(alleleFieldsDescriptions, prefix + "cassette_type", "Allele Cassette Type"); addField(alleleFieldsDescriptions, prefix + "floxed_start_exon", "Allele Floxed Star Exon"); addField(alleleFieldsDescriptions, prefix + "floxed_end_exon", "Allele Floxed End Exon"); addField(alleleFieldsDescriptions, prefix + "design_subtype.name", "Allele Design Subtype name"); addField(alleleFieldsDescriptions, prefix + "_links.self.href", "Allele Link"); if (!prefix.equals("")) { addField(alleleFieldsDescriptions, "_links.self.href", "Allele Link"); addField(alleleFieldsDescriptions, "page.size", "Page Size"); addField(alleleFieldsDescriptions, "page.totalElements", "Total Element"); addField(alleleFieldsDescriptions, "page.totalPages", "ToTal Page"); addField(alleleFieldsDescriptions, "page.number", "Page number"); } return alleleFieldsDescriptions; } private static void addField(List<FieldDescriptor> list, String name, String description) { list.add(fieldWithPath(name).description(description).optional()); } }
package com.yiqiniu.easytrans.queue.consumer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.yiqiniu.easytrans.filter.EasyTransFilter; import com.yiqiniu.easytrans.filter.EasyTransFilterChain; import com.yiqiniu.easytrans.filter.EasyTransFilterChainFactory; import com.yiqiniu.easytrans.filter.EasyTransResult; import com.yiqiniu.easytrans.protocol.BusinessIdentifer; import com.yiqiniu.easytrans.protocol.BusinessProvider; import com.yiqiniu.easytrans.protocol.EasyTransRequest; import com.yiqiniu.easytrans.protocol.MessageBusinessProvider; import com.yiqiniu.easytrans.provider.factory.ListableProviderFactory; import com.yiqiniu.easytrans.queue.QueueTopicMapper; import com.yiqiniu.easytrans.util.ReflectUtil; /** * register the message handlers,wire the filters,dispatch handlers */ public class EasyTransMsgInitializer implements EasyTransMsgListener { private ConcurrentHashMap<Class<? extends EasyTransRequest<?, ?>>, EasyTransFilter> mapHandler = new ConcurrentHashMap<Class<? extends EasyTransRequest<?, ?>>, EasyTransFilter>(); private ListableProviderFactory serviceWareHouse; private EasyTransMsgConsumer consumer; private EasyTransFilterChainFactory filterChainFactory; private QueueTopicMapper queueTopicMapper; // private String applicationName; private Logger logger = LoggerFactory.getLogger(this.getClass()); private EasyTransFilter consumeStatusCheckFilter = new EasyTransFilter(){ @Override public EasyTransResult invoke(EasyTransFilterChain filterChain, Map<String, Object> header, EasyTransRequest<?, ?> request) { EasyTransResult result = filterChain.invokeFilterChain(header, request); if(result.getValue() == null && result.getException() == null || result.getException() != null || result.getValue().equals(EasyTransConsumeAction.ReconsumeLater)){ result.setException(new NeedToReconsumeLaterException());//help to roll back in idempotent filter } return result; } }; public EasyTransMsgInitializer(ListableProviderFactory serviceWareHouse, EasyTransMsgConsumer consumer, EasyTransFilterChainFactory filterChainFactory, QueueTopicMapper queueTopicMapper) { super(); this.serviceWareHouse = serviceWareHouse; this.consumer = consumer; this.filterChainFactory = filterChainFactory; this.queueTopicMapper = queueTopicMapper; init(); } private void init(){ HashMap<String,List<String>> map = new HashMap<String, List<String>>(); //do initial Set<Class<?>> transactionTypeSet = serviceWareHouse.getServiceTransactionTypeSet(MessageBusinessProvider.class); for(Class<?> transactionType:transactionTypeSet){ List<Object> serviceMap = serviceWareHouse.getServices(MessageBusinessProvider.class, transactionType); for(Object handler:serviceMap){ BusinessProvider<?> messageHandler = (BusinessProvider<?>) handler; wrapToFilter(messageHandler); Class<? extends EasyTransRequest<?, ?>> clazz = ReflectUtil.getRequestClass(messageHandler); BusinessIdentifer businessIdentifer = ReflectUtil.getBusinessIdentifer(clazz); String[] topicTag = queueTopicMapper.mapToTopicTag(businessIdentifer.appId(), businessIdentifer.busCode()); List<String> list = map.get(topicTag[0]); if(list == null){ list = new ArrayList<String>(); map.put(topicTag[0], list); } list.add(topicTag[1]); } } if(map.size() != 0) { //register listener to queue for(Entry<String, List<String>> e:map.entrySet()){ consumer.subscribe(e.getKey(), e.getValue(), this); } consumer.start(); } } @Override public EasyTransConsumeAction consume(Map<String,Object> header, EasyTransRequest<?, ?> message) { EasyTransFilter easyTransFilter = getFilter(message); BusinessIdentifer businessIdentifer = ReflectUtil.getBusinessIdentifer(message.getClass()); //记不起当时改成applicationName并加上注解的原因了,改成直接从businessIdentifer取。 //已知的一个与之前的区别是,多个服务共享一个数据库的话,不支持多个服务都消费同一个消息,若出现该情况,只有一个服务会成功消费。因为幂等表里暂时并没有按消费者区分幂等记录,后续可调整完善。 // EasyTransFilterChain filterChain = filterChainFactory.getDefaultFilterChain(applicationName/*should use consumer's appId*/, businessIdentifer.busCode(), EasyTransFilterChain.MESSAGE_BUSINESS_FLAG); EasyTransFilterChain filterChain = filterChainFactory.getDefaultFilterChain(businessIdentifer.appId(), businessIdentifer.busCode(), EasyTransFilterChain.MESSAGE_BUSINESS_FLAG); filterChain.addFilter(consumeStatusCheckFilter); filterChain.addFilter(easyTransFilter); EasyTransResult result = filterChain.invokeFilterChain(header,message); EasyTransConsumeAction consumeResult = (EasyTransConsumeAction) result.getValue(); if(consumeResult == null){ result.setValue(EasyTransConsumeAction.ReconsumeLater); } if(result.getException() != null && result.getException().getClass() != NeedToReconsumeLaterException.class){ logger.error("Consume Error!",result.getException()); } return consumeResult; } private EasyTransFilter getFilter(EasyTransRequest<?, ?> message) { return mapHandler.get(message.getClass()); } private void wrapToFilter(final BusinessProvider<?> handler) { Class<? extends EasyTransRequest<?, ?>> requestClass = ReflectUtil.getRequestClass(handler); EasyTransFilter easyTransFilter = new EasyTransFilter() { @Override public EasyTransResult invoke(EasyTransFilterChain filterChain, Map<String, Object> header, EasyTransRequest<?, ?> request) { EasyTransResult easyTransResult = new EasyTransResult(); try { easyTransResult.setValue(((MessageBusinessProvider<?>) handler).consume(request)); if (easyTransResult.getValue() == EasyTransConsumeAction.CommitMessage) { logger.info("EasyTrans message consume Success:" + request); } else { logger.warn("EasyTrans message consume later:" + request); } } catch (Throwable e) { easyTransResult.setException(e); logger.error("EasyTrans message consume Exception Occour:" + request, e); } return easyTransResult; } }; mapHandler.put(requestClass, easyTransFilter); } public static class NeedToReconsumeLaterException extends RuntimeException{ private static final long serialVersionUID = 1L; } }
package pr01_Database.models; public class Ivan extends PeopleImpl { public Ivan(String userName, Long id) { super(userName, id); } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.analytics.synapse.artifacts.models; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** Reference objects for custom activity. */ @Fluent public final class CustomActivityReferenceObject { /* * Linked service references. */ @JsonProperty(value = "linkedServices") private List<LinkedServiceReference> linkedServices; /* * Dataset references. */ @JsonProperty(value = "datasets") private List<DatasetReference> datasets; /** * Get the linkedServices property: Linked service references. * * @return the linkedServices value. */ public List<LinkedServiceReference> getLinkedServices() { return this.linkedServices; } /** * Set the linkedServices property: Linked service references. * * @param linkedServices the linkedServices value to set. * @return the CustomActivityReferenceObject object itself. */ public CustomActivityReferenceObject setLinkedServices(List<LinkedServiceReference> linkedServices) { this.linkedServices = linkedServices; return this; } /** * Get the datasets property: Dataset references. * * @return the datasets value. */ public List<DatasetReference> getDatasets() { return this.datasets; } /** * Set the datasets property: Dataset references. * * @param datasets the datasets value to set. * @return the CustomActivityReferenceObject object itself. */ public CustomActivityReferenceObject setDatasets(List<DatasetReference> datasets) { this.datasets = datasets; return this; } }
/* * Copyright © 2020 Cask Data, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package io.cdap.cdap.runtime.spi.provisioner.dataproc; import io.cdap.cdap.runtime.spi.ProgramRunInfo; import io.cdap.cdap.runtime.spi.RuntimeMonitorType; import io.cdap.cdap.runtime.spi.SparkCompat; import io.cdap.cdap.runtime.spi.provisioner.ProgramRun; import io.cdap.cdap.runtime.spi.provisioner.ProvisionerContext; import io.cdap.cdap.runtime.spi.provisioner.ProvisionerMetrics; import io.cdap.cdap.runtime.spi.ssh.SSHContext; import org.apache.twill.filesystem.LocationFactory; import java.util.HashMap; import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import javax.annotation.Nullable; public class MockProvisionerContext implements ProvisionerContext { private final Map<String, String> properties; private final ProgramRunInfo programRunInfo; public MockProvisionerContext() { this(null); } public MockProvisionerContext(ProgramRunInfo programRunInfo) { this.properties = new HashMap<>(); this.programRunInfo = programRunInfo; } @Override public ProgramRun getProgramRun() { return null; } @Override public ProgramRunInfo getProgramRunInfo() { return programRunInfo; } @Override public Map<String, String> getProperties() { return properties; } public void addProperty(String key, String val) { properties.put(key, val); } public void clearProperties() { properties.clear(); } @Nullable @Override public SSHContext getSSHContext() { return null; } @Override public SparkCompat getSparkCompat() { return null; } @Override public String getCDAPVersion() { return null; } @Override public LocationFactory getLocationFactory() { return null; } @Override public RuntimeMonitorType getRuntimeMonitorType() { return null; } @Override public ProvisionerMetrics getMetrics(Map<String, String> context) { return new ProvisionerMetrics() { @Override public void count(String metricName, int delta) {} @Override public void gauge(String metricName, long value) {} }; } @Override public <T> CompletionStage<T> execute(Callable<T> callable) { CompletableFuture<T> result = new CompletableFuture<>(); try { result.complete(callable.call()); } catch (Exception e) { result.completeExceptionally(e); } return result; } }
package com.cursos.dsmovie.configs; import java.util.Arrays; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private Environment env; @Override protected void configure(HttpSecurity http) throws Exception { if(Arrays.asList(env.getActiveProfiles()).contains("test")) { http.headers().frameOptions().disable(); } http.cors().and().csrf().disable(); http.authorizeRequests().anyRequest().permitAll(); http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); } @Bean CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration().applyPermitDefaultValues(); configuration.setAllowedMethods(Arrays.asList("POST", "GET", "PUT", "DELETE", "OPTIONS")); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); return source; } }
package helios.samples.validator; import static org.junit.Assert.assertEquals; import java.util.function.BiPredicate; import java.util.List; import org.junit.Test; import helios.Helios; import helios.Validator; import helios.ValidatorError; import helios.ValidatorsUtil; public class ValidatorsUtilTest { @Test public void testValidatorShortcut() { List<ValidatorError> errors = Helios.validate("symbol", "y", customValidator()); assertEquals(errors.get(0).key, "isnot.x"); } // tag::validatorCreation[] public Validator<String> customValidator() { BiPredicate<String,String> equalsX = (x,y) -> x.equals(y); return ValidatorsUtil.validator("x", equalsX, "isnot.x"); } // end::validatorCreation[] }
package com.example.chenwa.helloworld; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
package org.vaadin.addons.grid_accessibility_extension.client; import com.vaadin.shared.ui.grid.AbstractGridExtensionState; public class GridAccessibilityExtensionState extends AbstractGridExtensionState { private static final long serialVersionUID = 1L; public String[] headerIds; }
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.mediapackagevod.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.mediapackagevod.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * CmafEncryption JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CmafEncryptionJsonUnmarshaller implements Unmarshaller<CmafEncryption, JsonUnmarshallerContext> { public CmafEncryption unmarshall(JsonUnmarshallerContext context) throws Exception { CmafEncryption cmafEncryption = new CmafEncryption(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); 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("spekeKeyProvider", targetDepth)) { context.nextToken(); cmafEncryption.setSpekeKeyProvider(SpekeKeyProviderJsonUnmarshaller.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 cmafEncryption; } private static CmafEncryptionJsonUnmarshaller instance; public static CmafEncryptionJsonUnmarshaller getInstance() { if (instance == null) instance = new CmafEncryptionJsonUnmarshaller(); return instance; } }
package com.android.launcher3.allapps; import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Color; import android.support.animation.SpringAnimation; import android.support.v4.graphics.ColorUtils; import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.view.MotionEvent; import android.view.View; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.view.inputmethod.InputMethodManager; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Hotseat; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAnimUtils; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; import com.android.launcher3.anim.SpringAnimationHandler; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.GradientView; import com.android.launcher3.touch.SwipeDetector; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.SystemUiController; import com.android.launcher3.util.Themes; import com.android.launcher3.util.TouchController; import com.hdeva.launcher.LeanSettings; import java.lang.reflect.InvocationTargetException; /** * Handles AllApps view transition. * 1) Slides all apps view using direct manipulation * 2) When finger is released, animate to either top or bottom accordingly. * <p/> * Algorithm: * If release velocity > THRES1, snap according to the direction of movement. * If release velocity < THRES1, snap according to either top or bottom depending on whether it's * closer to top or closer to the page indicator. */ public class AllAppsTransitionController implements TouchController, SwipeDetector.Listener, SearchUiManager.OnScrollRangeChangeListener { private static final String TAG = "AllAppsTrans"; private static final boolean DBG = false; private final Interpolator mWorkspaceAccelnterpolator = new AccelerateInterpolator(2f); private final Interpolator mHotseatAccelInterpolator = new AccelerateInterpolator(1.5f); private final Interpolator mDecelInterpolator = new DecelerateInterpolator(3f); private final Interpolator mFastOutSlowInInterpolator = new FastOutSlowInInterpolator(); private final SwipeDetector.ScrollInterpolator mScrollInterpolator = new SwipeDetector.ScrollInterpolator(); private static final float PARALLAX_COEFFICIENT = .125f; private static final int SINGLE_FRAME_MS = 16; private AllAppsContainerView mAppsView; private int mAllAppsBackgroundColor; private Workspace mWorkspace; private Hotseat mHotseat; private int mHotseatBackgroundColor; private AllAppsCaretController mCaretController; private float mStatusBarHeight; private final Launcher mLauncher; private final SwipeDetector mDetector; private final ArgbEvaluator mEvaluator; private final boolean mIsDarkTheme; // Animation in this class is controlled by a single variable {@link mProgress}. // Visually, it represents top y coordinate of the all apps container if multiplied with // {@link mShiftRange}. // When {@link mProgress} is 0, all apps container is pulled up. // When {@link mProgress} is 1, all apps container is pulled down. private float mShiftStart; // [0, mShiftRange] private float mShiftRange; // changes depending on the orientation private float mProgress; // [0, 1], mShiftRange * mProgress = shiftCurrent // Velocity of the container. Unit is in px/ms. private float mContainerVelocity; private static final float DEFAULT_SHIFT_RANGE = 10; private static final float RECATCH_REJECTION_FRACTION = .0875f; private long mAnimationDuration; private AnimatorSet mCurrentAnimation; private boolean mNoIntercept; private boolean mTouchEventStartedOnHotseat; // Used in discovery bounce animation to provide the transition without workspace changing. private boolean mIsTranslateWithoutWorkspace = false; private Animator mDiscoBounceAnimation; private GradientView mGradientView; private SpringAnimation mSearchSpring; private SpringAnimationHandler mSpringAnimationHandler; private int pointerCount; private final static float NOTIFICATION_OPEN_VELOCITY = 2.25f; private final static float NOTIFICATION_CLOSE_VELOCITY = -0.35f; enum NotificationState { Locked, Free, Opened, Closed } private NotificationState mNotificationState; public AllAppsTransitionController(Launcher l) { mLauncher = l; mDetector = new SwipeDetector(l, this, SwipeDetector.VERTICAL); mShiftRange = DEFAULT_SHIFT_RANGE; mProgress = 1f; mEvaluator = new ArgbEvaluator(); mAllAppsBackgroundColor = Themes.getAttrColor(l, android.R.attr.colorPrimary); mIsDarkTheme = Themes.getAttrBoolean(mLauncher, R.attr.isMainColorDark); } @Override public boolean onControllerInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_MOVE) { pointerCount = ev.getPointerCount(); } if (ev.getAction() == MotionEvent.ACTION_DOWN) { mNoIntercept = false; mTouchEventStartedOnHotseat = mLauncher.getDragLayer().isEventOverHotseat(ev); if (!mLauncher.isAllAppsVisible() && mLauncher.getWorkspace().workspaceInModalState()) { mNoIntercept = true; } else if (mLauncher.isAllAppsVisible() && !mAppsView.shouldContainerScroll(ev)) { mNoIntercept = true; } else if (AbstractFloatingView.getTopOpenView(mLauncher) != null) { mNoIntercept = true; } else { // Now figure out which direction scroll events the controller will start // calling the callbacks. int directionsToDetectScroll = 0; boolean ignoreSlopWhenSettling = false; if (mDetector.isIdleState()) { if (mLauncher.isAllAppsVisible()) { directionsToDetectScroll |= SwipeDetector.DIRECTION_NEGATIVE; } else { directionsToDetectScroll |= SwipeDetector.DIRECTION_BOTH; } } else { if (isInDisallowRecatchBottomZone()) { directionsToDetectScroll |= SwipeDetector.DIRECTION_POSITIVE; } else if (isInDisallowRecatchTopZone()) { directionsToDetectScroll |= SwipeDetector.DIRECTION_NEGATIVE; } else { directionsToDetectScroll |= SwipeDetector.DIRECTION_BOTH; ignoreSlopWhenSettling = true; } } mDetector.setDetectableScrollConditions(directionsToDetectScroll, ignoreSlopWhenSettling); } } if (mNoIntercept) { return false; } mDetector.onTouchEvent(ev); if (mDetector.isSettlingState() && (isInDisallowRecatchBottomZone() || isInDisallowRecatchTopZone())) { return false; } return mDetector.isDraggingOrSettling(); } @Override public boolean onControllerTouchEvent(MotionEvent ev) { if (hasSpringAnimationHandler()) { mSpringAnimationHandler.addMovement(ev); } return mDetector.onTouchEvent(ev); } private boolean isInDisallowRecatchTopZone() { return mProgress < RECATCH_REJECTION_FRACTION; } private boolean isInDisallowRecatchBottomZone() { return mProgress > 1 - RECATCH_REJECTION_FRACTION; } @Override public void onDragStart(boolean start) { mCaretController.onDragStart(); cancelAnimation(); mCurrentAnimation = LauncherAnimUtils.createAnimatorSet(); mShiftStart = mAppsView.getTranslationY(); preparePull(start); if (hasSpringAnimationHandler()) { mSpringAnimationHandler.skipToEnd(); } mNotificationState = NotificationState.Free; } @Override public boolean onDrag(float displacement, float velocity) { if (mAppsView == null) { return false; // early termination. } //Locked means do not use any notification code if (mNotificationState != NotificationState.Locked) { if (mProgress < 1f) { //Apps list is being opened, disable notification code mNotificationState = NotificationState.Locked; } else { //Disable code when access to the hidden APIs returns an error if (velocity > NOTIFICATION_OPEN_VELOCITY && (mNotificationState == NotificationState.Free || mNotificationState == NotificationState.Closed)) { if (pointerCount == 1) { if (LeanSettings.isOneFingerDownEnabled(mLauncher)) { mNotificationState = openNotifications() ? NotificationState.Opened : NotificationState.Locked; } } else if (pointerCount == 2) { if (LeanSettings.isTwoFingerDownEnabled(mLauncher)) { mNotificationState = openSettings() ? NotificationState.Opened : NotificationState.Locked; } } } else if (velocity < NOTIFICATION_CLOSE_VELOCITY && mNotificationState == NotificationState.Opened) { mNotificationState = closeNotifications() ? NotificationState.Closed : NotificationState.Locked; } //Don't open all apps when notification shade is being used if (mNotificationState == NotificationState.Opened || mNotificationState == NotificationState.Closed) { return true; } } } mContainerVelocity = velocity; float shift = Math.min(Math.max(0, mShiftStart + displacement), mShiftRange); setProgress(shift / mShiftRange); return true; } @SuppressLint({"WrongConstant", "PrivateApi"}) private boolean openNotifications() { try { Class.forName("android.app.StatusBarManager") .getMethod("expandNotificationsPanel") .invoke(mLauncher.getSystemService("statusbar")); return true; } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { return false; } } @SuppressLint({"WrongConstant", "PrivateApi"}) private boolean closeNotifications() { try { Class.forName("android.app.StatusBarManager") .getMethod("collapsePanels") .invoke(mLauncher.getSystemService("statusbar")); return true; } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { return false; } } @SuppressLint({"WrongConstant", "PrivateApi"}) private boolean openSettings() { try { Class.forName("android.app.StatusBarManager") .getMethod("expandSettingsPanel") .invoke(mLauncher.getSystemService("statusbar")); return true; } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { return false; } } @Override public void onDragEnd(float velocity, boolean fling) { if (mAppsView == null) { return; // early termination. } final int containerType = mTouchEventStartedOnHotseat ? ContainerType.HOTSEAT : ContainerType.WORKSPACE; if (fling && mNotificationState != NotificationState.Opened && mNotificationState != NotificationState.Closed) { if (velocity < 0) { calculateDuration(velocity, mAppsView.getTranslationY()); if (!mLauncher.isAllAppsVisible()) { mLauncher.getUserEventDispatcher().logActionOnContainer( Action.Touch.FLING, Action.Direction.UP, containerType); } mLauncher.showAppsView(true /* animated */, false /* updatePredictedApps */); if (hasSpringAnimationHandler()) { mSpringAnimationHandler.add(mSearchSpring, true /* setDefaultValues */); // The icons are moving upwards, so we go to 0 from 1. (y-axis 1 is below 0.) mSpringAnimationHandler.animateToFinalPosition(0 /* pos */, 1 /* startValue */); } } else { calculateDuration(velocity, Math.abs(mShiftRange - mAppsView.getTranslationY())); mLauncher.showWorkspace(true); } // snap to top or bottom using the release velocity } else { if (mAppsView.getTranslationY() > mShiftRange / 2) { calculateDuration(velocity, Math.abs(mShiftRange - mAppsView.getTranslationY())); mLauncher.showWorkspace(true); } else { calculateDuration(velocity, Math.abs(mAppsView.getTranslationY())); if (!mLauncher.isAllAppsVisible()) { mLauncher.getUserEventDispatcher().logActionOnContainer( Action.Touch.SWIPE, Action.Direction.UP, containerType); } mLauncher.showAppsView(true, /* animated */ false /* updatePredictedApps */); } } } public boolean isTransitioning() { return mDetector.isDraggingOrSettling(); } public boolean isDragging() { return mDetector.isDraggingState(); } /** * @param start {@code true} if start of new drag. */ public void preparePull(boolean start) { if (start) { ((InputMethodManager) mLauncher.getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mLauncher.getAppsView().getWindowToken(), 0); // Initialize values that should not change until #onDragEnd mStatusBarHeight = mLauncher.getDragLayer().getInsets().top; mHotseat.setVisibility(View.VISIBLE); mHotseatBackgroundColor = mHotseat.getBackgroundDrawableColor(); mHotseat.setBackgroundTransparent(true /* transparent */); if (!mLauncher.isAllAppsVisible()) { mLauncher.tryAndUpdatePredictedApps(); mAppsView.setVisibility(View.VISIBLE); if (!FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS) { mAppsView.setRevealDrawableColor(mHotseatBackgroundColor); } } } } private void updateLightStatusBar(float shift) { // Do not modify status bar on landscape as all apps is not full bleed. if (!FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS && mLauncher.getDeviceProfile().isVerticalBarLayout()) { return; } // Use a light system UI (dark icons) if all apps is behind at least half of the status bar. boolean forceChange = FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS ? shift <= mShiftRange / 4 : shift <= mStatusBarHeight / 2; if (forceChange) { mLauncher.getSystemUiController().updateUiState( SystemUiController.UI_STATE_ALL_APPS, !mIsDarkTheme); } else { mLauncher.getSystemUiController().updateUiState( SystemUiController.UI_STATE_ALL_APPS, 0); } } private void updateAllAppsBg(float progress) { // gradient if (mGradientView == null) { mGradientView = (GradientView) mLauncher.findViewById(R.id.gradient_bg); mGradientView.setVisibility(View.VISIBLE); mGradientView.setShiftScrim(!Utilities.ATLEAST_MARSHMALLOW); } mGradientView.setProgress(progress); } /** * @param progress value between 0 and 1, 0 shows all apps and 1 shows workspace */ public void setProgress(float progress) { float shiftPrevious = mProgress * mShiftRange; mProgress = progress; float shiftCurrent = progress * mShiftRange; float workspaceHotseatAlpha = Utilities.boundToRange(progress, 0f, 1f); float alpha = 1 - workspaceHotseatAlpha; float workspaceAlpha = mWorkspaceAccelnterpolator.getInterpolation(workspaceHotseatAlpha); float hotseatAlpha = mHotseatAccelInterpolator.getInterpolation(workspaceHotseatAlpha); int color = (Integer) mEvaluator.evaluate(mDecelInterpolator.getInterpolation(alpha), mHotseatBackgroundColor, mAllAppsBackgroundColor); int bgAlpha = Color.alpha((int) mEvaluator.evaluate(alpha, mHotseatBackgroundColor, mAllAppsBackgroundColor)); if (FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS) { updateAllAppsBg(alpha); } else { mAppsView.setRevealDrawableColor(ColorUtils.setAlphaComponent(color, bgAlpha)); } mAppsView.getContentView().setAlpha(alpha); mAppsView.setTranslationY(shiftCurrent); if (!mLauncher.getDeviceProfile().isVerticalBarLayout()) { mWorkspace.setHotseatTranslationAndAlpha(Workspace.Direction.Y, -mShiftRange + shiftCurrent, hotseatAlpha); } else { mWorkspace.setHotseatTranslationAndAlpha(Workspace.Direction.Y, PARALLAX_COEFFICIENT * (-mShiftRange + shiftCurrent), hotseatAlpha); } if (mIsTranslateWithoutWorkspace) { return; } mWorkspace.setWorkspaceYTranslationAndAlpha( PARALLAX_COEFFICIENT * (-mShiftRange + shiftCurrent), workspaceAlpha); if (!mDetector.isDraggingState()) { mContainerVelocity = mDetector.computeVelocity(shiftCurrent - shiftPrevious, System.currentTimeMillis()); } mCaretController.updateCaret(progress, mContainerVelocity, mDetector.isDraggingState()); updateLightStatusBar(shiftCurrent); } public float getProgress() { return mProgress; } private void calculateDuration(float velocity, float disp) { mAnimationDuration = SwipeDetector.calculateDuration(velocity, disp / mShiftRange); } public boolean animateToAllApps(AnimatorSet animationOut, long duration) { boolean shouldPost = true; if (animationOut == null) { return shouldPost; } Interpolator interpolator; if (mDetector.isIdleState()) { preparePull(true); mAnimationDuration = duration; mShiftStart = mAppsView.getTranslationY(); interpolator = mFastOutSlowInInterpolator; } else { mScrollInterpolator.setVelocityAtZero(Math.abs(mContainerVelocity)); interpolator = mScrollInterpolator; float nextFrameProgress = mProgress + mContainerVelocity * SINGLE_FRAME_MS / mShiftRange; if (nextFrameProgress >= 0f) { mProgress = nextFrameProgress; } shouldPost = false; } ObjectAnimator driftAndAlpha = ObjectAnimator.ofFloat(this, "progress", mProgress, 0f); driftAndAlpha.setDuration(mAnimationDuration); driftAndAlpha.setInterpolator(interpolator); animationOut.play(driftAndAlpha); animationOut.addListener(new AnimatorListenerAdapter() { boolean canceled = false; @Override public void onAnimationCancel(Animator animation) { canceled = true; } @Override public void onAnimationEnd(Animator animation) { if (canceled) { return; } else { finishPullUp(); cleanUpAnimation(); mDetector.finishedScrolling(); } } }); mCurrentAnimation = animationOut; return shouldPost; } public void showDiscoveryBounce() { // cancel existing animation in case user locked and unlocked at a super human speed. cancelDiscoveryAnimation(); // assumption is that this variable is always null mDiscoBounceAnimation = AnimatorInflater.loadAnimator(mLauncher, R.animator.discovery_bounce); mDiscoBounceAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { mIsTranslateWithoutWorkspace = true; preparePull(true); } @Override public void onAnimationEnd(Animator animator) { finishPullDown(); mDiscoBounceAnimation = null; mIsTranslateWithoutWorkspace = false; } }); mDiscoBounceAnimation.setTarget(this); mAppsView.post(new Runnable() { @Override public void run() { if (mDiscoBounceAnimation == null) { return; } mDiscoBounceAnimation.start(); } }); } public boolean animateToWorkspace(AnimatorSet animationOut, long duration) { boolean shouldPost = true; if (animationOut == null) { return shouldPost; } Interpolator interpolator; if (mDetector.isIdleState()) { preparePull(true); mAnimationDuration = duration; mShiftStart = mAppsView.getTranslationY(); interpolator = mFastOutSlowInInterpolator; } else { mScrollInterpolator.setVelocityAtZero(Math.abs(mContainerVelocity)); interpolator = mScrollInterpolator; float nextFrameProgress = mProgress + mContainerVelocity * SINGLE_FRAME_MS / mShiftRange; if (nextFrameProgress <= 1f) { mProgress = nextFrameProgress; } shouldPost = false; } ObjectAnimator driftAndAlpha = ObjectAnimator.ofFloat(this, "progress", mProgress, 1f); driftAndAlpha.setDuration(mAnimationDuration); driftAndAlpha.setInterpolator(interpolator); animationOut.play(driftAndAlpha); animationOut.addListener(new AnimatorListenerAdapter() { boolean canceled = false; @Override public void onAnimationCancel(Animator animation) { canceled = true; } @Override public void onAnimationEnd(Animator animation) { if (canceled) { return; } else { finishPullDown(); cleanUpAnimation(); mDetector.finishedScrolling(); } } }); mCurrentAnimation = animationOut; return shouldPost; } public void finishPullUp() { mHotseat.setVisibility(View.INVISIBLE); if (hasSpringAnimationHandler()) { mSpringAnimationHandler.remove(mSearchSpring); mSpringAnimationHandler.reset(); } setProgress(0f); } public void finishPullDown() { mAppsView.setVisibility(View.INVISIBLE); mHotseat.setBackgroundTransparent(false /* transparent */); mHotseat.setVisibility(View.VISIBLE); mAppsView.reset(); if (hasSpringAnimationHandler()) { mSpringAnimationHandler.reset(); } setProgress(1f); } private void cancelAnimation() { if (mCurrentAnimation != null) { mCurrentAnimation.cancel(); mCurrentAnimation = null; } cancelDiscoveryAnimation(); } public void cancelDiscoveryAnimation() { if (mDiscoBounceAnimation == null) { return; } mDiscoBounceAnimation.cancel(); mDiscoBounceAnimation = null; } private void cleanUpAnimation() { mCurrentAnimation = null; } public void setupViews(AllAppsContainerView appsView, Hotseat hotseat, Workspace workspace) { mAppsView = appsView; mHotseat = hotseat; mWorkspace = workspace; mHotseat.bringToFront(); mCaretController = new AllAppsCaretController( mWorkspace.getPageIndicator().getCaretDrawable(), mLauncher); mAppsView.getSearchUiManager().addOnScrollRangeChangeListener(this); mSpringAnimationHandler = mAppsView.getSpringAnimationHandler(); mSearchSpring = mAppsView.getSearchUiManager().getSpringForFling(); } private boolean hasSpringAnimationHandler() { return FeatureFlags.LAUNCHER3_PHYSICS && mSpringAnimationHandler != null; } @Override public void onScrollRangeChanged(int scrollRange) { mShiftRange = scrollRange; setProgress(mProgress); } }
/* Copyright (C) 2013-2022 TU Dortmund * This file is part of LearnLib, http://www.learnlib.de/. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.learnlib.filter.cache.sul; import de.learnlib.api.SUL; /** * @author frohme */ public class SULDAGCacheTest extends AbstractSULCacheTest { @Override protected SULCache<Character, Integer> getCache(SUL<Character, Integer> delegate) { return SULCaches.createCache(getAlphabet(), delegate); } }
package com.mauriciotogneri.stewie.specs; import com.mauriciotogneri.jsonschema.Definitions; import com.mauriciotogneri.stewie.annotations.EndPoint; import com.mauriciotogneri.stewie.annotations.Parameters; import com.mauriciotogneri.stewie.annotations.Responses; import com.mauriciotogneri.stewie.model.SwaggerEndPoint; import com.mauriciotogneri.stewie.model.SwaggerParameter; import com.mauriciotogneri.stewie.model.SwaggerResponse; import com.mauriciotogneri.stewie.specs.parameters.DataParameter; import com.mauriciotogneri.stewie.specs.parameters.FormParameter; import com.mauriciotogneri.stewie.specs.parameters.HeaderParameter; import com.mauriciotogneri.stewie.specs.parameters.PathParameter; import com.mauriciotogneri.stewie.specs.parameters.UrlParameter; import com.mauriciotogneri.stewie.types.Header; import java.io.File; import java.util.ArrayList; import java.util.List; public class EndPointInfo { private final String parent; private final String name; private final String path; private final String method; private final String description; private final Boolean deprecated; private final HeaderParameter[] headerParameters; private final PathParameter pathParameters; private final UrlParameter urlParameters; private final FormParameter formParameters; private final DataParameter dataParameter; private final Result[] results; public EndPointInfo(String parent, File file) { Class<?> clazz = getClass(file); EndPoint endPoint = clazz.getAnnotation(EndPoint.class); Parameters parameters = clazz.getAnnotation(Parameters.class); Responses responses = clazz.getAnnotation(Responses.class); this.parent = parent; this.name = file.getName().replace(".java", ""); this.path = endPoint.path(); this.method = endPoint.method(); this.description = endPoint.description().isEmpty() ? null : endPoint.description(); this.deprecated = endPoint.deprecated(); if (parameters != null) { this.headerParameters = HeaderParameter.from(parameters.header()); this.pathParameters = new PathParameter(parameters.path()); this.urlParameters = new UrlParameter(parameters.url()); this.formParameters = new FormParameter(parameters.form()); this.dataParameter = new DataParameter(parameters.data()); } else { this.headerParameters = new HeaderParameter[0]; this.pathParameters = new PathParameter(Object.class); this.urlParameters = new UrlParameter(Object.class); this.formParameters = new FormParameter(Object.class); this.dataParameter = new DataParameter(Object.class); } this.results = Result.from(responses.value()); } public String name() { return name; } public String path() { return path; } public String method() { return method; } private Class<?> getClass(File file) { String filePath = file.getAbsolutePath(); String classPath = filePath.substring(filePath.indexOf("/java/") + 6).replace("/", ".").replace(".java", ""); try { return Class.forName(classPath); } catch (ClassNotFoundException e) { throw new RuntimeException(String.format("Class not found: %s", classPath)); } } public SwaggerEndPoint swaggerEndPoint(Definitions definitions) { String[] consumes = consumes(); String[] produces = produces(); List<SwaggerParameter> parameters = parameters(headerParameters, pathParameters, urlParameters, formParameters, dataParameter, definitions); List<SwaggerResponse> responses = new ArrayList<>(); for (Result result : results) { responses.add(new SwaggerResponse(result.code(), result.type(), result.headers(), result.description(), definitions)); } return new SwaggerEndPoint(name, description, deprecated, parent, consumes, produces, parameters, responses); } private String[] consumes() { for (HeaderParameter headerParameter : headerParameters) { if (headerParameter.is(Header.CONTENT_TYPE)) { return headerParameter.defaultValue(); } } return new String[0]; } private String[] produces() { List<String> list = new ArrayList<>(); for (Result result : results) { for (String produces : result.produces()) { if (!list.contains(produces)) { list.add(produces); } } } String[] result = new String[list.size()]; list.toArray(result); return result; } private List<SwaggerParameter> parameters(HeaderParameter[] headerParameters, PathParameter pathParameters, UrlParameter urlParameters, FormParameter formParameters, DataParameter dataParameter, Definitions definitions) { List<SwaggerParameter> parameters = new ArrayList<>(); for (HeaderParameter parameter : headerParameters) { if (!parameter.is(Header.CONTENT_TYPE)) { parameters.add(parameter.swaggerParameter(definitions)); } } parameters.addAll(pathParameters.swaggerParameters(definitions)); parameters.addAll(urlParameters.swaggerParameters(definitions)); parameters.addAll(formParameters.swaggerParameters(definitions)); if (dataParameter.isPresent()) { parameters.add(dataParameter.swaggerParameter(definitions)); } return parameters; } }
package com.example.gulimall.member.dao; import com.example.gulimall.member.entity.MemberCollectSpuEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** * 会员收藏的商品 * * @author slx * @email 905096784@qq.com * @date 2020-10-29 13:42:48 */ @Mapper public interface MemberCollectSpuDao extends BaseMapper<MemberCollectSpuEntity> { }
package com.w3engineers.core.libmeshx.wifid; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.NetworkInfo; import android.net.wifi.p2p.WifiP2pManager; import timber.log.Timber; import static android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION; import static android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION; import static android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION; /** * ============================================================================ * Copyright (C) 2019 W3 Engineers Ltd - All Rights Reserved. * Unauthorized copying of this file, via any medium is strictly prohibited * Proprietary and confidential * <br>---------------------------------------------------------------------------- * <br>Created by: Ahmed Mohmmad Ullah (Azim) on [2019-03-18 at 3:03 PM]. * <br>---------------------------------------------------------------------------- * <br>Project: MeshX. * <br>Code Responsibility: <Purpose of code> * <br>---------------------------------------------------------------------------- * <br>Edited by : * <br>1. <First Editor> on [2019-03-18 at 3:03 PM]. * <br>2. <Second Editor> * <br>---------------------------------------------------------------------------- * <br>Reviewed by : * <br>1. <First Reviewer> on [2019-03-18 at 3:03 PM]. * <br>2. <Second Reviewer> * <br>============================================================================ **/ public class PeerReceiver extends BroadcastReceiver { private P2PStateListener mP2PStateListener; public PeerReceiver(P2PStateListener p2PStateListener) { this.mP2PStateListener = p2PStateListener; } @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Timber.d("Received intent: %s", action); if (mP2PStateListener == null) return; if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) { int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1); mP2PStateListener.onP2PStateChange(state); } else if (WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) { mP2PStateListener.onP2PPeersStateChange(); } else if (WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) { //WifiP2pDevice device = intent.getParcelableExtra(EXTRA_WIFI_P2P_DEVICE); //addText("Local device: " + MyP2PHelper.deviceToString(device)); } else if (WifiP2pManager.WIFI_P2P_DISCOVERY_CHANGED_ACTION.equals(action)) { int state = intent.getIntExtra(WifiP2pManager.EXTRA_DISCOVERY_STATE, WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED); String persTatu = "Discovery state changed to "; if (state == WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED) { persTatu = persTatu + "Stopped."; mP2PStateListener.onP2PPeersDiscoveryStopped(); } else if (state == WifiP2pManager.WIFI_P2P_DISCOVERY_STARTED) { mP2PStateListener.onP2PPeersDiscoveryStarted(); } else { persTatu = persTatu + "unknown " + state; } } else if (WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) { NetworkInfo networkInfo = intent.getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO); if (networkInfo.isConnected()) { mP2PStateListener.onP2PConnected(); } else { mP2PStateListener.onP2PDisconnected(); } } } }
package com.vip.saturn.job.console.utils; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; public class ConsoleThreadFactory implements ThreadFactory { private AtomicInteger threadNumber = new AtomicInteger(1); private boolean isMultiple = true; private String threadName; public ConsoleThreadFactory(String threadName, boolean isMultiple) { this.isMultiple = isMultiple; this.threadName = threadName; } @Override public Thread newThread(Runnable r) { String name = isMultiple ? threadName + "-" + threadNumber.getAndIncrement() : threadName; Thread t = new Thread(r, name); if (t.isDaemon()) { t.setDaemon(false); } if (t.getPriority() != Thread.NORM_PRIORITY) { t.setPriority(Thread.NORM_PRIORITY); } return t; } }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ignite.raft.jraft.conf; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.apache.ignite.raft.jraft.entity.PeerId; import org.apache.ignite.raft.jraft.util.Copiable; import org.apache.ignite.raft.jraft.util.Requires; import org.apache.ignite.raft.jraft.util.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A configuration with a set of peers. */ public class Configuration implements Iterable<PeerId>, Copiable<Configuration> { private static final Logger LOG = LoggerFactory.getLogger(Configuration.class); private static final String LEARNER_POSTFIX = "/learner"; private List<PeerId> peers = new ArrayList<>(); // use LinkedHashSet to keep insertion order. private LinkedHashSet<PeerId> learners = new LinkedHashSet<>(); public Configuration() { super(); } /** * Construct a configuration instance with peers. * * @param conf configuration */ public Configuration(final Iterable<PeerId> conf) { this(conf, null); } /** * Construct a configuration from another conf. * * @param conf configuration */ public Configuration(final Configuration conf) { this(conf.getPeers(), conf.getLearners()); } /** * Construct a Configuration instance with peers and learners. * * @param conf peers configuration * @param learners learners */ public Configuration(final Iterable<PeerId> conf, final Iterable<PeerId> learners) { Requires.requireNonNull(conf, "conf"); for (final PeerId peer : conf) { this.peers.add(peer.copy()); } addLearners(learners); } public void setLearners(final LinkedHashSet<PeerId> learners) { this.learners = learners; } /** * Add a learner peer. * * @param learner learner to add * @return true when add successfully. */ public boolean addLearner(final PeerId learner) { return this.learners.add(learner); } /** * Add learners in batch, returns the added count. * * @param learners learners to add * @return the total added count */ public int addLearners(final Iterable<PeerId> learners) { int ret = 0; if (learners != null) { for (final PeerId peer : learners) { if (this.learners.add(peer.copy())) { ret++; } } } return ret; } /** * Remove a learner peer. * * @param learner learner to remove * @return true when remove successfully. */ public boolean removeLearner(final PeerId learner) { return this.learners.remove(learner); } /** * Retrieve the learners set. * * @return learners */ public LinkedHashSet<PeerId> getLearners() { return this.learners; } /** * Retrieve the learners set copy. * * @return learners */ public List<PeerId> listLearners() { return new ArrayList<>(this.learners); } @Override public Configuration copy() { return new Configuration(this.peers, this.learners); } /** * Returns true when the configuration is valid. * * @return true if the configuration is valid. */ public boolean isValid() { final Set<PeerId> intersection = new HashSet<>(this.peers); intersection.retainAll(this.learners); return !this.peers.isEmpty() && intersection.isEmpty(); } public void reset() { this.peers.clear(); this.learners.clear(); } public boolean isEmpty() { return this.peers.isEmpty(); } /** * Returns the peers total number. * * @return total num of peers */ public int size() { return this.peers.size(); } @Override public Iterator<PeerId> iterator() { return this.peers.iterator(); } public Set<PeerId> getPeerSet() { return new HashSet<>(this.peers); } public List<PeerId> listPeers() { return new ArrayList<>(this.peers); } public List<PeerId> getPeers() { return this.peers; } public void setPeers(final List<PeerId> peers) { this.peers.clear(); for (final PeerId peer : peers) { this.peers.add(peer.copy()); } } public void appendPeers(final Collection<PeerId> set) { this.peers.addAll(set); } public boolean addPeer(final PeerId peer) { return this.peers.add(peer); } public boolean removePeer(final PeerId peer) { return this.peers.remove(peer); } public boolean contains(final PeerId peer) { return this.peers.contains(peer); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((this.learners == null) ? 0 : this.learners.hashCode()); result = prime * result + ((this.peers == null) ? 0 : this.peers.hashCode()); return result; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Configuration other = (Configuration) obj; if (this.learners == null) { if (other.learners != null) { return false; } } else if (!this.learners.equals(other.learners)) { return false; } if (this.peers == null) { return other.peers == null; } else { return this.peers.equals(other.peers); } } @Override public String toString() { final StringBuilder sb = new StringBuilder(); final List<PeerId> peers = listPeers(); int i = 0; int size = peers.size(); for (final PeerId peer : peers) { sb.append(peer); if (i < size - 1 || !this.learners.isEmpty()) { sb.append(","); } i++; } size = this.learners.size(); i = 0; for (final PeerId peer : this.learners) { sb.append(peer).append(LEARNER_POSTFIX); if (i < size - 1) { sb.append(","); } i++; } return sb.toString(); } public boolean parse(final String conf) { if (StringUtils.isBlank(conf)) { return false; } reset(); final String[] peerStrs = StringUtils.split(conf, ','); for (String peerStr : peerStrs) { final PeerId peer = new PeerId(); int index; boolean isLearner = false; if ((index = peerStr.indexOf(LEARNER_POSTFIX)) > 0) { // It's a learner peerStr = peerStr.substring(0, index); isLearner = true; } if (peer.parse(peerStr)) { if (isLearner) { addLearner(peer); } else { addPeer(peer); } } else { LOG.error("Fail to parse peer {} in {}, ignore it.", peerStr, conf); } } return true; } /** * Get the difference between |*this| and |rhs| |included| would be assigned to |*this| - |rhs| |excluded| would be * assigned to |rhs| - |*this| */ public void diff(final Configuration rhs, final Configuration included, final Configuration excluded) { included.peers = new ArrayList<>(this.peers); included.peers.removeAll(rhs.peers); excluded.peers = new ArrayList<>(rhs.peers); excluded.peers.removeAll(this.peers); } }
package server; import communications.Message; import communications.MessageType; import hippodrome.RacingTrack; import hippodrome.actions.Race; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; /** * Racing Track endpoint representation on the server side. * * @author Hugo Fragata * @author Rui Lopes * @since 2.0 * @version 2.0 */ public class RacingTrackProxy implements Server { /** * Creates a Racing Track Proxy instance. * @throws InterruptedException if a communication channel could not be established. */ public RacingTrackProxy() throws InterruptedException { try { racingTrack = RacingTrack.getInstance(); } catch (Exception e) { throw new InterruptedException(); } } /** * Implementation of the {@link Server}'s method to process and answer the requests. * * @param message the message to process and to reply on. * @return the reply message to the {@code message} given as input. * @throws Exception if a unexpected message type is given. */ @Override public Message processAndAnswerRequest(Message message) throws Exception { Message reply = null; ByteArrayOutputStream objectByteArray = new ByteArrayOutputStream(); ObjectOutputStream serializedObject = null; switch (message.getType()) { case RACING_TRACK_GET_RACE: Race race = racingTrack.getRace(); reply = new Message(MessageType.REPLY_RACING_TRACK_GET_RACE, race); break; case RACING_TRACK_GET_WINNER: int winner = racingTrack.getWinner(); reply = new Message(MessageType.REPLY_RACING_TRACK_GET_WINNER, winner); break; case RACING_TRACK_HAS_FINISH_LINE_BEEN_CROSSED: boolean crossed = racingTrack.hasFinishLineBeenCrossed(message.getHorseID()); reply = new Message(MessageType.REPLY_RACING_TRACK_HAS_FINISH_LINE_BEEN_CROSSED, crossed); break; case RACING_TRACK_MAKE_A_MOVE: racingTrack.makeAMove(message.getHorseID()); reply = new Message(MessageType.REPLY_RACING_TRACK_MAKE_A_MOVE); break; case RACING_TRACK_PROCEED_TO_START_LINE: racingTrack.proceedToStartLine(); reply = new Message(MessageType.OK); break; case RACING_TRACK_START_THE_RACE: racingTrack.startTheRace(); reply = new Message(MessageType.OK); break; case RACING_TRACK_SET_RACE: racingTrack.setRace(message.getRace()); reply = new Message(MessageType.OK); break; case RACING_TRACK_SHUTDOWN: reply = new Message(MessageType.OK); break; default: throw new IllegalArgumentException(); } return reply; } /** * A Racing Track instance. */ private final RacingTrack racingTrack; }
/* * Copyright 2019 HERMENEUT Consortium *   * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *   *     http://www.apache.org/licenses/LICENSE-2.0 *   * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package eu.hermeneut.security; import eu.hermeneut.HermeneutApp; import eu.hermeneut.domain.User; import eu.hermeneut.repository.UserRepository; import org.apache.commons.lang3.RandomStringUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import java.util.Locale; import static org.assertj.core.api.Assertions.assertThat; /** * Test class for DomainUserDetailsService. * * @see DomainUserDetailsService */ @RunWith(SpringRunner.class) @SpringBootTest(classes = HermeneutApp.class) @Transactional public class DomainUserDetailsServiceIntTest { private static final String USER_ONE_LOGIN = "test-user-one"; private static final String USER_ONE_EMAIL = "test-user-one@localhost"; private static final String USER_TWO_LOGIN = "test-user-two"; private static final String USER_TWO_EMAIL = "test-user-two@localhost"; private static final String USER_THREE_LOGIN = "test-user-three"; private static final String USER_THREE_EMAIL = "test-user-three@localhost"; @Autowired private UserRepository userRepository; @Autowired private UserDetailsService domainUserDetailsService; private User userOne; private User userTwo; private User userThree; @Before public void init() { userOne = new User(); userOne.setLogin(USER_ONE_LOGIN); userOne.setPassword(RandomStringUtils.random(60)); userOne.setActivated(true); userOne.setEmail(USER_ONE_EMAIL); userOne.setFirstName("userOne"); userOne.setLastName("doe"); userOne.setLangKey("en"); userRepository.save(userOne); userTwo = new User(); userTwo.setLogin(USER_TWO_LOGIN); userTwo.setPassword(RandomStringUtils.random(60)); userTwo.setActivated(true); userTwo.setEmail(USER_TWO_EMAIL); userTwo.setFirstName("userTwo"); userTwo.setLastName("doe"); userTwo.setLangKey("en"); userRepository.save(userTwo); userThree = new User(); userThree.setLogin(USER_THREE_LOGIN); userThree.setPassword(RandomStringUtils.random(60)); userThree.setActivated(false); userThree.setEmail(USER_THREE_EMAIL); userThree.setFirstName("userThree"); userThree.setLastName("doe"); userThree.setLangKey("en"); userRepository.save(userThree); } @Test @Transactional public void assertThatUserCanBeFoundByLogin() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test @Transactional public void assertThatUserCanBeFoundByLoginIgnoreCase() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN.toUpperCase(Locale.ENGLISH)); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test @Transactional public void assertThatUserCanBeFoundByEmail() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); } @Test @Transactional public void assertThatUserCanBeFoundByEmailIgnoreCase() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL.toUpperCase(Locale.ENGLISH)); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); } @Test @Transactional public void assertThatEmailIsPrioritizedOverLogin() { UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_EMAIL.toUpperCase(Locale.ENGLISH)); assertThat(userDetails).isNotNull(); assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); } @Test(expected = UserNotActivatedException.class) @Transactional public void assertThatUserNotActivatedExceptionIsThrownForNotActivatedUsers() { domainUserDetailsService.loadUserByUsername(USER_THREE_LOGIN); } }
package ca.intelliware.ihtsdo.mlds.web.rest; import static org.junit.Assert.assertEquals; import java.net.URI; import java.net.URISyntaxException; import org.junit.Test; import ca.intelliware.ihtsdo.mlds.web.RouteLinkBuilder; public class RouteLinkBuilderTest { RouteLinkBuilder routeLinkBuilder = new RouteLinkBuilder(); @Test public void routeWithNoTokensIsUnmolested() throws URISyntaxException { URI uri = routeLinkBuilder.toURLWithKeyValues("/aRoute/"); assertEquals(new URI("/aRoute/"), uri); } @Test public void simpleTokenIsReplaced() throws URISyntaxException { URI uri = routeLinkBuilder.toURLWithKeyValues("/aRoute/{pathVariable}", "pathVariable", 55); assertEquals(new URI("/aRoute/55"), uri); } @Test public void tokenReplacementIsURLEscaped() throws URISyntaxException { URI uri = routeLinkBuilder.toURLWithKeyValues("/aRoute/{pathVariable}", "pathVariable", "escape?"); assertEquals(new URI("/aRoute/escape%3F"), uri); } }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.ylzl.eden.spring.data.jdbc.datasource.routing; import java.lang.annotation.*; /** * 动态路由数据源 * * @author <a href="mailto:shiyindaxiaojie@gmail.com">gyl</a> * @since 2.4.x */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) @Documented @Inherited public @interface RoutingDataSource { String value(); }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.micromanager.remote; import java.util.HashMap; import java.util.Set; import java.util.concurrent.*; import java.util.function.Consumer; import mmcorej.TaggedImage; import mmcorej.org.json.JSONObject; import org.micromanager.acqj.main.AcqEngMetadata; import org.micromanager.acqj.api.DataSink; import org.micromanager.acqj.main.Acquisition; import org.micromanager.acqj.internal.Engine; import org.micromanager.multiresstorage.MultiResMultipageTiffStorage; import org.micromanager.multiresstorage.MultiresStorageAPI; import org.micromanager.multiresstorage.StorageAPI; import org.micromanager.ndviewer.api.DataSourceInterface; import org.micromanager.ndviewer.api.ViewerInterface; import org.micromanager.ndviewer.main.NDViewer; import org.micromanager.ndviewer.api.ViewerAcquisitionInterface; /** * The class is the glue needed in order for Acquisition engine, viewer, and data storage * to be able to be used together, since they are independent libraries that do not know about one * another. It implements the Acquisition engine API for a {@link DataSink} interface, dispatching acquired images * to viewer and storage as appropriate. It implements viewers {@link DataSourceInterface} interface, so * that images in storage can be passed to the viewer to display. * * @author henrypinkard */ public class RemoteViewerStorageAdapter implements DataSourceInterface, DataSink { private ExecutorService displayCommunicationExecutor_; private volatile ViewerInterface viewer_; private volatile RemoteAcquisition acq_; private volatile MultiresStorageAPI storage_; private CopyOnWriteArrayList<String> channelNames_ = new CopyOnWriteArrayList<String>(); private RemoteStorageMonitor storageMonitor_; private final boolean showViewer_, storeData_, xyTiled_; private final int tileOverlapX_, tileOverlapY_; private String dir_; private String name_; private Integer maxResLevel_; private int savingQueueSize_; /** * * @param showViewer create and show a viewer * @param dataStorageLocation where should data be saved to disk * @param name name for data storage and viewer * @param xyTiled true if using XY tiling/multiresolution features * @param tileOverlapX X pixel overlap between adjacent tiles if using XY tiling/multiresolution * @param tileOverlapY Y pixel overlap between adjacent tiles if using XY tiling/multiresolution * @param maxResLevel The maximum resolution level index if using XY tiling/multiresolution */ public RemoteViewerStorageAdapter(boolean showViewer, String dataStorageLocation, String name, boolean xyTiled, int tileOverlapX, int tileOverlapY, Integer maxResLevel, int savingQueueSize) { showViewer_ = showViewer; storeData_ = dataStorageLocation != null; xyTiled_ = xyTiled; dir_ = dataStorageLocation; name_ = name; tileOverlapX_ = tileOverlapX; tileOverlapY_ = tileOverlapY; maxResLevel_ = maxResLevel; savingQueueSize_ = savingQueueSize; } public void initialize(Acquisition acq, JSONObject summaryMetadata) { acq_ = (RemoteAcquisition) acq; if (storeData_) { if (xyTiled_) { //tiled datasets have a fixed, acquisition-wide image size AcqEngMetadata.setWidth(summaryMetadata, (int) Engine.getCore().getImageWidth()); AcqEngMetadata.setHeight(summaryMetadata, (int) Engine.getCore().getImageHeight()); } storage_ = new MultiResMultipageTiffStorage(dir_, name_, summaryMetadata, tileOverlapX_, tileOverlapY_, xyTiled_, maxResLevel_, savingQueueSize_, //Debug logging function without storage having to directly depend on core acq_.isDebugMode() ? ((Consumer<String>) s -> { Engine.getCore().logMessage(s); }) : null ); name_ = storage_.getUniqueAcqName(); storageMonitor_ = new RemoteStorageMonitor(summaryMetadata, storage_.getDiskLocation()); storage_.addImageWrittenListener(storageMonitor_); } if (showViewer_) { createDisplay(summaryMetadata); } } public RemoteStorageMonitor getStorageMonitor() { return storageMonitor_; } public StorageAPI getStorage() { return storage_; } private void createDisplay(JSONObject summaryMetadata) { //create display displayCommunicationExecutor_ = Executors.newSingleThreadExecutor((Runnable r) -> new Thread(r, "Image viewer communication thread")); viewer_ = new NDViewer(this, (ViewerAcquisitionInterface) acq_, summaryMetadata, AcqEngMetadata.getPixelSizeUm(summaryMetadata), AcqEngMetadata.isRGB(summaryMetadata)); viewer_.setWindowTitle(name_ + (acq_ != null ? (acq_.areEventsFinished()? " (Finished)" : " (Running)") : " (Loaded)")); //add functions so display knows how to parse time and z infomration from image tags viewer_.setReadTimeMetadataFunction((JSONObject tags) -> AcqEngMetadata.getElapsedTimeMs(tags)); viewer_.setReadZMetadataFunction((JSONObject tags) -> AcqEngMetadata.getStageZIntended(tags)); } public void putImage(final TaggedImage taggedImg) { HashMap<String, Integer> axes = AcqEngMetadata.getAxes(taggedImg.tags); final Future added; if (xyTiled_) { //Convert event row/col to image row/col axes.put(AcqEngMetadata.AXES_GRID_COL , AcqEngMetadata.getGridCol(taggedImg.tags)); axes.put(AcqEngMetadata.AXES_GRID_ROW , AcqEngMetadata.getGridRow(taggedImg.tags)); added = storage_.putImageMultiRes(taggedImg, axes, AcqEngMetadata.isRGB(taggedImg.tags), AcqEngMetadata.getHeight(taggedImg.tags), AcqEngMetadata.getWidth(taggedImg.tags)); } else { added = null; storage_.putImage(taggedImg, axes, AcqEngMetadata.isRGB(taggedImg.tags), AcqEngMetadata.getHeight(taggedImg.tags), AcqEngMetadata.getWidth(taggedImg.tags)); } if (showViewer_) { //Check if new viewer to init display settings String channelName = AcqEngMetadata.getChannelName(taggedImg.tags); boolean newChannel = !channelNames_.contains(channelName); if (newChannel) { channelNames_.add(channelName); } //put on different thread to not slow down acquisition displayCommunicationExecutor_.submit(new Runnable() { @Override public void run() { try { if (added != null) { added.get(); //needed to make sure multi res data at higher resolutions kept up to date } } catch (Exception e) { Engine.getCore().logMessage(e.getMessage()); throw new RuntimeException(e); } if (newChannel) { //Insert a preferred color. Make a copy just in case concurrency issues String chName = AcqEngMetadata.getChannelName(taggedImg.tags); // Color c = Color.white; //TODO could add color memory here (or maybe viewer already handles it...) int bitDepth = AcqEngMetadata.getBitDepth(taggedImg.tags); viewer_.setChannelDisplaySettings(chName, null, bitDepth); } HashMap<String, Integer> axes = AcqEngMetadata.getAxes(taggedImg.tags); if (xyTiled_) { //remove this so the viewer doesn't show it axes.remove(AcqEngMetadata.AXES_GRID_ROW); axes.remove(AcqEngMetadata.AXES_GRID_COL); } viewer_.newImageArrived(axes, AcqEngMetadata.getChannelName(taggedImg.tags)); } }); } } ///////// Data source interface for Viewer ////////// @Override public int[] getBounds() { return storage_.getImageBounds(); } @Override public TaggedImage getImageForDisplay(HashMap<String, Integer> axes, int resolutionindex, double xOffset, double yOffset, int imageWidth, int imageHeight) { return storage_.getDisplayImage( axes, resolutionindex, (int) xOffset, (int) yOffset, imageWidth, imageHeight); } @Override public Set<HashMap<String, Integer>> getStoredAxes() { return storage_.getAxesSet(); } @Override public int getMaxResolutionIndex() { return storage_.getNumResLevels() - 1; } @Override public String getDiskLocation() { return dir_; } public void close() { storage_.close(); } ///////////// Data sink interface required by acq eng ///////////// @Override public void finished() { if (storage_ != null) { if (!storage_.isFinished()) { //Get most up to date display settings if (viewer_ != null) { JSONObject displaySettings = viewer_.getDisplaySettingsJSON(); storage_.setDisplaySettings(displaySettings); } storage_.finishedWriting(); } if (!showViewer_) { //If there's no viewer, shutdown of acquisition == shutdown of storage close(); } } if (showViewer_) { viewer_.setWindowTitle(name_ + " (Finished)"); displayCommunicationExecutor_.shutdown(); } } @Override public boolean isFinished() { if (storage_ != null) { return storage_.isFinished(); } return true; } @Override public boolean anythingAcquired() { return acq_.anythingAcquired(); } boolean isXYTiled() { return xyTiled_; } int getOverlapX() { return tileOverlapX_; } int getOverlapY() { return tileOverlapY_; } }
package com.cnpc.framework.filter; import java.io.IOException; import java.util.Set; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import org.apache.shiro.subject.Subject; import org.apache.shiro.util.CollectionUtils; import org.apache.shiro.web.filter.authz.AuthorizationFilter; /* <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> <property name="filters"> <map> <entry key="anyRoles" value-ref="anyRolesAuthorizationFilter" /> </map> </property> <property name="filterChainDefinitions"> <value> /admin = anyRoles[admin1,admin2] /** = anon </value> </property> </bean> */ /** * Filter that allows access if the current user has the roles specified by the mapped value, or denies access * if the user does not have one of the roles specified. * */ public class AnyRolesAuthorizationFilter extends AuthorizationFilter { @SuppressWarnings({"unchecked"}) public boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException { Subject subject = getSubject(request, response); String[] rolesArray = (String[]) mappedValue; if (rolesArray == null || rolesArray.length == 0) { //no roles specified, so nothing to check - allow access. return true; } Set<String> roles = CollectionUtils.asSet(rolesArray); for (String role : roles) { if (subject.hasRole(role)) { return true; } } return false; } }
package com.other.solid.OpenClosePrinciple; public interface Car { void worlInTaxi(); }
/* * Copyright 2017-2018 original authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.micronaut.inject.annotation; import io.micronaut.core.convert.value.ConvertibleValues; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; /** * A type for representation annotation values in order to support {@link java.lang.annotation.Repeatable} annotations. * * @author Graeme Rocher * @since 1.0 */ public class AnnotationValue { private final String annotationName; private final ConvertibleValues<Object> convertibleValues; private final Map<CharSequence, Object> values; /** * @param annotationName The annotation name * @param values The values */ public AnnotationValue(String annotationName, Map<CharSequence, Object> values) { this.annotationName = annotationName.intern(); this.convertibleValues = ConvertibleValues.of(values); this.values = values; } /** * @param annotationName The annotation name */ @SuppressWarnings("unchecked") public AnnotationValue(String annotationName) { this.annotationName = annotationName; this.convertibleValues = ConvertibleValues.EMPTY; this.values = Collections.EMPTY_MAP; } /** * @param annotationName The annotation name * @param convertibleValues The convertible values */ public AnnotationValue(String annotationName, ConvertibleValues<Object> convertibleValues) { this.annotationName = annotationName; this.convertibleValues = convertibleValues; Map<String, Object> existing = convertibleValues.asMap(); this.values = new LinkedHashMap<>(existing.size()); this.values.putAll(existing); } /** * @return The annotation name */ public String getAnnotationName() { return annotationName; } /** * @return The attribute values */ @SuppressWarnings("unchecked") public Map<CharSequence, Object> getValues() { return (Map) convertibleValues.asMap(); } /** * @return The attribute values */ public ConvertibleValues<Object> getConvertibleValues() { return convertibleValues; } @Override public int hashCode() { return AnnotationMetadataSupport.calculateHashCode(values); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!AnnotationValue.class.isInstance(obj)) { return false; } AnnotationValue other = AnnotationValue.class.cast(obj); Map<CharSequence, Object> otherValues = other.values; if (values.size() != otherValues.size()) { return false; } // compare annotation member values for (Map.Entry<CharSequence, Object> member : values.entrySet()) { Object value = member.getValue(); Object otherValue = otherValues.get(member.getKey()); if (!AnnotationMetadataSupport.areEqual(value, otherValue)) { return false; } } return true; } }
package org.springframework.samples.jpetstore.domain.logic; import java.lang.reflect.Method; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.aop.AfterReturningAdvice; import org.springframework.beans.factory.InitializingBean; import org.springframework.mail.MailException; import org.springframework.mail.MailSender; import org.springframework.mail.SimpleMailMessage; import org.springframework.samples.jpetstore.domain.Account; import org.springframework.samples.jpetstore.domain.Order; /** * AOP advice that sends confirmation email after order has been submitted * @author Dmitriy Kopylenko * @version $Id: SendOrderConfirmationEmailAdvice.java,v 1.2 2004/03/19 20:27:43 dkopylenko Exp $ */ public class SendOrderConfirmationEmailAdvice implements AfterReturningAdvice, InitializingBean { private static final String DEFAULT_MAIL_FROM = "jpetstore@springframework.org"; private static final String DEFAULT_SUBJECT = "Thank you for your order!"; private final Log logger = LogFactory.getLog(getClass()); private MailSender mailSender; private String mailFrom = DEFAULT_MAIL_FROM; private String subject = DEFAULT_SUBJECT; public void setMailSender(MailSender mailSender) { this.mailSender = mailSender; } public void setMailFrom(String mailFrom) { this.mailFrom = mailFrom; } public void setSubject(String subject) { this.subject = subject; } public void afterPropertiesSet() throws Exception { if (this.mailSender == null) { throw new IllegalStateException("mailSender is required"); } } public void afterReturning(Object returnValue, Method m, Object[] args, Object target) throws Throwable { Order order = (Order) args[0]; Account account = ((PetStoreFacade) target).getAccount(order.getUsername()); // don't do anything if email address is not set if (account.getEmail() == null || account.getEmail().length() == 0) { return; } StringBuffer text = new StringBuffer(); text.append("Dear ").append(account.getFirstName()).append(' ').append(account.getLastName()); text.append(", thank your for your order from JPetStore. Please note that your order number is "); text.append(order.getOrderId()); SimpleMailMessage mailMessage = new SimpleMailMessage(); mailMessage.setTo(account.getEmail()); mailMessage.setFrom(this.mailFrom); mailMessage.setSubject(this.subject); mailMessage.setText(text.toString()); try { this.mailSender.send(mailMessage); } catch (MailException ex) { // just log it and go on logger.warn("An exception occured when trying to send email", ex); } } }
/******************************************************************************* * Copyright 2016 Johannes Boczek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ package de.sogomn.rat.packet; import java.net.InetAddress; import java.net.UnknownHostException; import de.sogomn.rat.ActiveConnection; public class ComputerInfoPacket extends AbstractPingPongPacket { private String name, hostName, os, osVersion, osArchitecture; private int processors; private long ram; public ComputerInfoPacket() { //... } @Override protected void sendRequest(final ActiveConnection connection) { //... } @Override protected void sendData(final ActiveConnection connection) { connection.writeUtf(name); connection.writeUtf(hostName); connection.writeUtf(os); connection.writeUtf(osVersion); connection.writeUtf(osArchitecture); connection.writeInt(processors); connection.writeLong(ram); } @Override protected void receiveRequest(final ActiveConnection connection) { //... } @Override protected void receiveData(final ActiveConnection connection) { name = connection.readUtf(); hostName = connection.readUtf(); os = connection.readUtf(); osVersion = connection.readUtf(); osArchitecture = connection.readUtf(); processors = connection.readInt(); ram = connection.readLong(); } @Override protected void executeRequest(final ActiveConnection connection) { type = DATA; name = System.getProperty("user.name"); os = System.getProperty("os.name"); osVersion = System.getProperty("os.version"); osArchitecture = System.getProperty("os.arch"); processors = Runtime.getRuntime().availableProcessors(); ram = Runtime.getRuntime().totalMemory(); try { hostName = InetAddress.getLocalHost().getHostName(); } catch (final UnknownHostException ex) { hostName = ""; ex.printStackTrace(); } connection.addPacket(this); } @Override protected void executeData(final ActiveConnection connection) { //... } public String getName() { return name; } public String getHostName() { return hostName; } public String getOs() { return os; } public String getOsVersion() { return osVersion; } public String getOsArchitecture() { return osArchitecture; } public int getProcessors() { return processors; } public long getRam() { return ram; } }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.management; import java.util.Set; import javax.management.ObjectName; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; /** * A unit test to verify mbean registration of multi-instances of a processor */ public class MultiInstanceProcessorTest extends JmxInstrumentationUsingDefaultsTest { @Override protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { from("direct:start").process(exchange -> { // simulate a little processing time Thread.sleep(10); }).to("mock:end").to("mock:end"); } }; } /** * It retrieves a mbean for each "to" processor instance in the query ":type=processor" */ @Override @Test public void testMBeansRegistered() throws Exception { // JMX tests dont work well on AIX CI servers (hangs them) if (isPlatform("aix")) { return; } assertDefaultDomain(); resolveMandatoryEndpoint("mock:end", MockEndpoint.class); Set<ObjectName> s = mbsc.queryNames(new ObjectName(domainName + ":type=endpoints,*"), null); assertEquals(2, s.size(), "Could not find 2 endpoints: " + s); s = mbsc.queryNames(new ObjectName(domainName + ":type=context,*"), null); assertEquals(1, s.size(), "Could not find 1 context: " + s); s = mbsc.queryNames(new ObjectName(domainName + ":type=processors,*"), null); assertEquals(3, s.size(), "Could not find 3 processor: " + s); s = mbsc.queryNames(new ObjectName(domainName + ":type=routes,*"), null); assertEquals(1, s.size(), "Could not find 1 route: " + s); } @Override @Test public void testCounters() throws Exception { // JMX tests dont work well on AIX CI servers (hangs them) if (isPlatform("aix")) { return; } MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:end", MockEndpoint.class); resultEndpoint.expectedBodiesReceived("<hello>world!</hello>", "<hello>world!</hello>"); sendBody("direct:start", "<hello>world!</hello>"); resultEndpoint.assertIsSatisfied(); verifyCounter(mbsc, new ObjectName(domainName + ":type=routes,*")); } }
package com.city.phonemall.cart.exception; /** * @author liuZhongKun * @Description: * @email 1071607950@qq.com * @date 2021-05-30 08:47:33 **/ public class CartExceptionHandler extends RuntimeException { }
package rl.java.course.addressbook.tests; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import rl.java.course.addressbook.model.GroupData; import rl.java.course.addressbook.model.Groups; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; import static org.testng.Assert.assertEquals; public class GroupDeletionTests extends TestBase { @BeforeMethod public void ensurePreconditions() { app.goTo().groupPage(); if (app.group().all().size() == 0) { app.group().create(new GroupData().withName("test1")); } } @Test public void testGroupDeletion() { Groups before = app.db().groups(); GroupData deletedGroup = before.iterator().next(); app.group().delete(deletedGroup); Groups after = app.db().groups(); assertEquals(after.size(), before.size() - 1); assertThat(after, equalTo(before.without(deletedGroup))); } }
package quickcore.core.utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition; import org.springframework.web.servlet.mvc.condition.RequestMethodsRequestCondition; import org.springframework.web.servlet.mvc.method.RequestMappingInfo; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import quickcore.common.constants.CONSTANT_DEFINE; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * 方法工具类 * @author yangxiao * @date 2020-11-28 */ public class SpringUtil { private static final Logger logger = LoggerFactory.getLogger(SpringUtil.class); /** * 获得所有方法的请求信息 * <p> * 获得方法名,类名,接口名列表,类URL,方法URL,请求类型 * </p> * @param applicationContext WebApplicationContext * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>> * @author yangxiao * @date 2020/11/28 18:42 */ public static List<Map<String, Object>> getRequestMappingInfo(WebApplicationContext applicationContext) { List<Map<String, Object>> resultList = new ArrayList<>(); // 定义返回数据 RequestMappingHandlerMapping requestMappingHandlerMapping = applicationContext.getBean(RequestMappingHandlerMapping.class); Map<RequestMappingInfo, HandlerMethod> requestMap = requestMappingHandlerMapping.getHandlerMethods(); for (Map.Entry<RequestMappingInfo, HandlerMethod> requestMappingInfoHandlerMethodEntry : requestMap.entrySet()) { Map<String, Object> curResultMap = new LinkedHashMap<>(); // 获得请求映射信息和对应的处理方法 RequestMappingInfo requestMappingInfo = requestMappingInfoHandlerMethodEntry.getKey(); HandlerMethod handlerMethod = requestMappingInfoHandlerMethodEntry.getValue(); // 获得方法名 curResultMap.put(CONSTANT_DEFINE.KEY_METHOD_NAME, handlerMethod.getMethod().getName()); // 获得方法所在类名 curResultMap.put(CONSTANT_DEFINE.KEY_CLASS_NAME, handlerMethod.getMethod().getDeclaringClass().getName()); // 获得方法所在类声明的接口名 Class<?>[] interfaces = handlerMethod.getMethod().getDeclaringClass().getInterfaces(); List<String> interfaceNameList = new ArrayList<>(); if (interfaces != null) { for (Class<?> c : interfaces) { interfaceNameList.add(c.getName()); } } curResultMap.put(CONSTANT_DEFINE.KEY_INTERFACE_NAME_LIST, interfaceNameList); // 获得方法所在类的@RequestMapping注解 Annotation[] parentAnnotationArray = handlerMethod.getBeanType().getAnnotations(); for (Annotation annotation : parentAnnotationArray) { if (annotation instanceof RequestMapping) { RequestMapping requestMapping = (RequestMapping) annotation; if (requestMapping.value().length > 0) { curResultMap.put(CONSTANT_DEFINE.KEY_CLASS_URL, requestMapping.value()[0]); } } } // 获得方法的URL PatternsRequestCondition patternsRequestCondition = requestMappingInfo.getPatternsCondition(); if (patternsRequestCondition != null) { logger.debug("patternsRequestCondition.getPatterns().size(): " + patternsRequestCondition.getPatterns().size()); for (String url : patternsRequestCondition.getPatterns()) { curResultMap.put(CONSTANT_DEFINE.KEY_METHOD_URL, url); } } // 获得请求类型 RequestMethodsRequestCondition methodsRequestCondition = requestMappingInfo.getMethodsCondition(); for (RequestMethod requestMethod : methodsRequestCondition.getMethods()) { curResultMap.put(CONSTANT_DEFINE.KEY_REQUEST_TYPE, requestMethod.toString()); } resultList.add(curResultMap); } return resultList; } }
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.jdbc.core.namedparam; import org.springframework.jdbc.core.SqlParameterValue; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.StringUtils; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; /** * {@link SqlParameterSource} implementation that holds a given Map of parameters. * * <p>This class is intended for passing in a simple Map of parameter values * to the methods of the {@link NamedParameterJdbcTemplate} class. * * <p>The {@code addValue} methods on this class will make adding several values * easier. The methods return a reference to the {@link MapSqlParameterSource} * itself, so you can chain several method calls together within a single statement. * * @author Thomas Risberg * @author Juergen Hoeller * @see #addValue(String, Object) * @see #addValue(String, Object, int) * @see #registerSqlType * @see NamedParameterJdbcTemplate * @since 2.0 */ public class MapSqlParameterSource extends AbstractSqlParameterSource { private final Map<String, Object> values = new LinkedHashMap<>(); /** * Create an empty MapSqlParameterSource, * with values to be added via {@code addValue}. * * @see #addValue(String, Object) */ public MapSqlParameterSource() { } /** * Create a new MapSqlParameterSource, with one value * comprised of the supplied arguments. * * @param paramName the name of the parameter * @param value the value of the parameter * @see #addValue(String, Object) */ public MapSqlParameterSource(String paramName, @Nullable Object value) { addValue(paramName, value); } /** * Create a new MapSqlParameterSource based on a Map. * * @param values a Map holding existing parameter values (can be {@code null}) */ public MapSqlParameterSource(@Nullable Map<String, ?> values) { addValues(values); } /** * Add a parameter to this parameter source. * * @param paramName the name of the parameter * @param value the value of the parameter * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValue(String paramName, @Nullable Object value) { Assert.notNull(paramName, "Parameter name must not be null"); this.values.put(paramName, value); if (value instanceof SqlParameterValue) { registerSqlType(paramName, ((SqlParameterValue) value).getSqlType()); } return this; } /** * Add a parameter to this parameter source. * * @param paramName the name of the parameter * @param value the value of the parameter * @param sqlType the SQL type of the parameter * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValue(String paramName, @Nullable Object value, int sqlType) { Assert.notNull(paramName, "Parameter name must not be null"); this.values.put(paramName, value); registerSqlType(paramName, sqlType); return this; } /** * Add a parameter to this parameter source. * * @param paramName the name of the parameter * @param value the value of the parameter * @param sqlType the SQL type of the parameter * @param typeName the type name of the parameter * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValue(String paramName, @Nullable Object value, int sqlType, String typeName) { Assert.notNull(paramName, "Parameter name must not be null"); this.values.put(paramName, value); registerSqlType(paramName, sqlType); registerTypeName(paramName, typeName); return this; } /** * Add a Map of parameters to this parameter source. * * @param values a Map holding existing parameter values (can be {@code null}) * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValues(@Nullable Map<String, ?> values) { if (values != null) { values.forEach((key, value) -> { this.values.put(key, value); if (value instanceof SqlParameterValue) { registerSqlType(key, ((SqlParameterValue) value).getSqlType()); } }); } return this; } /** * Expose the current parameter values as read-only Map. */ public Map<String, Object> getValues() { return Collections.unmodifiableMap(this.values); } @Override public boolean hasValue(String paramName) { return this.values.containsKey(paramName); } @Override @Nullable public Object getValue(String paramName) { if (!hasValue(paramName)) { throw new IllegalArgumentException("No value registered for key '" + paramName + "'"); } return this.values.get(paramName); } @Override @Nullable public String[] getParameterNames() { return StringUtils.toStringArray(this.values.keySet()); } }
import java.awt.Color; import java.io.Serializable; public class BarreV3 extends Piece implements Serializable{ /** * */ private static final long serialVersionUID = 7071286017054867712L; /** * */ private byte[][] disposition = { {1,0,0,0,0},{1,0,0,0,0},{1,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}, }; private Color couleur = Color.BLUE; private String nom = "BarreV3"; public BarreV3() { } public byte[][] getDisposition() { return disposition; } public Color getCouleur() { return this.couleur; } public String getNom() { return this.nom; } }
/* * Copyright (c) 2008 Kasper Nielsen. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package packed.internal.invoke; import java.util.Stack; /** * */ final class IntStack { private final Stack<Integer> s = new Stack<>(); IntStack push(int i) { s.add(i); return this; } int size() { return s.size(); } IntStack push(int... is) { for (int i : is) { s.add(i); } return this; } public int[] toArrayAdd0() { int[] result = new int[s.size() + 1]; result[0] = 0; for (int i = 0; i < s.size(); i++) { result[i + 1] = s.get(i); } return result; } public int[] toArray() { int[] result = new int[s.size()]; for (int i = 0; i < s.size(); i++) { result[i] = s.get(i); } return result; } }
package org.openalto.alto.client.wrapper; import javax.ws.rs.core.Response; import org.openalto.alto.client.ALTOResponse; import org.openalto.alto.client.ALTOResponseParser; import org.openalto.alto.common.ALTOMediaType; public class ErrorParser extends ALTOResponseParser { @Override public ALTOResponse parse(Response response) { if (response == null) return null; if (!success(response.getStatusInfo())) { return null; } if (!response.getMediaType().equals(ALTOMediaType.ERROR_TYPE)) { return null; } //TODO Extract more information for subtypes String msg = response.readEntity(String.class); return new ALTOResponseParser.ALTOResponseBase(true, response, msg); } }
/** * Copyright (c) 2016, Anthony Anderson(Illyohs) * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package us.illyohs.sinked.channel; import javax.annotation.Nonnull; import java.util.List; public class Channel { String name; String owner; String prefix; String suffix; String password; boolean isEnabled; boolean hasOwner; boolean isHidden; boolean hasPassword; boolean isNetworked; List<String> invtedUsers; public Channel(@Nonnull String name, @Nonnull String owner, @Nonnull String prefix, @Nonnull String suffix, @Nonnull String password, @Nonnull boolean hasOwner, @Nonnull boolean isEnabled, @Nonnull boolean isHidden, @Nonnull boolean hasPassword, @Nonnull boolean isNetworked) { this.name = name; this.owner = owner; this.prefix = prefix; this.suffix = suffix; this.password = password; this.isEnabled = isEnabled; this.hasOwner = hasOwner; this.hasPassword = hasPassword; this.isNetworked = isNetworked; this.isHidden = isHidden; } public String getName() { return name; } public String getOwner() { return owner; } public String getPrefix() { return prefix; } public String getSuffix() { return suffix; } public String getPassword() { return password; } public boolean isEnabled() { return isEnabled; } public boolean hasOwner() { return hasOwner; } public boolean isNetworked() { return isNetworked; } public boolean hasPassword() { return hasPassword; } public boolean isHidden() { return isHidden; } }
package crc64c5a61f37761d5630; public class MvxJavaContainer extends java.lang.Object implements mono.android.IGCUserPeer { /** @hide */ public static final String __md_methods; static { __md_methods = ""; mono.android.Runtime.register ("MvvmCross.Platform.Droid.MvxJavaContainer, MvvmCross.Platform.Droid", MvxJavaContainer.class, __md_methods); } public MvxJavaContainer () { super (); if (getClass () == MvxJavaContainer.class) mono.android.TypeManager.Activate ("MvvmCross.Platform.Droid.MvxJavaContainer, MvvmCross.Platform.Droid", "", this, new java.lang.Object[] { }); } private java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
package edu.stanford.math.plex4.io; import java.awt.image.BufferedImage; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.List; import com.sun.media.jai.codec.ImageCodec; import com.sun.media.jai.codec.ImageEncoder; /** * This class contains various static functions for reading and writing files of * different types. * * @author Tim Harrington * @author Andrew Tausz * */ public class FileIOUtility { /** * Saves a BufferedImage stream in PNG format. * * @param image the buffered image to save to disk * @param filePath the file to save the image file in * @throws IOException */ public static void saveImage(BufferedImage image, String filePath) throws IOException { BufferedOutputStream out = null; ImageEncoder encoder; try { out = new BufferedOutputStream(new FileOutputStream(filePath)); encoder = ImageCodec.createImageEncoder("PNG", out, null); encoder.encode(image); } catch (IOException e) { throw e; } finally { if (out != null) { out.close(); } } } /** * This function saves a string to a text file. * * @param filePath the path of the file to write to * @param contents a string holding the contents to write * @param append if true, then the file will be appended to * @throws IOException */ public static void writeTextFile(String filePath, String contents, boolean append) throws IOException { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(filePath, append)); writer.write(contents); } catch (IOException e) { e.printStackTrace(); } finally { if (writer != null) { writer.close(); } } } /** * This function reads a CSV file and outputs the values into a Table * object. The format of the file is as follows: [<Title>] [<Heading1, ..., * HeadingN>] <Entry11, ..., Entry1N> <EntryM1, ..., EntryMN> * * The input argument readTitle should be true if and only if the file * contains a title on its first line. The input argument readHeadings * should be true if and only if the file contains the column headings on * the file just before the first data row. * * Columns are assumed to be separated by the specified separator, and rows * are assumed to be separated by a newline. * * @param filename * the filename of the file to read from * @param separator * the separator between columns * @param readTitle * should be true iff the file contains a title * @param readHeadings * should be true iff the file contains the column headings * @return a Table object containing the contents of the file * @throws IOException */ public static Table readCSVFile(String filename, String separator, boolean readTitle, boolean readHeadings) throws IOException { BufferedReader reader = null; String line = null; String[] entries = null; Table table = null; try { reader = new BufferedReader(new FileReader(filename)); table = new Table(); // read the title if necessary if (readTitle) { line = reader.readLine(); table.setTitle(line); } // read the column headings if necessary if (readHeadings) { // get the line containing the column headings line = reader.readLine(); // split the line into the individual headings String[] headings = line.split(separator); // add the headings to the table for (String heading : headings) { table.addColumn(heading.trim()); } } else { // read the first data line line = reader.readLine(); // split the line into the individual tokens entries = line.split(separator); // add generic headings to the table for (int headingIndex = 0; headingIndex < entries.length; headingIndex++) { table.addColumn("Column_" + headingIndex); } // add the data to the table table.addRow(entries, true); } // continue reading the data while ((line = reader.readLine()) != null) { // split the line into the individual tokens entries = line.split(separator); // add the data to the table table.addRow(entries, true); } } catch (IOException e) { e.printStackTrace(); } finally { // close the reader if necessary if (reader != null) { reader.close(); } } // return the created table return table; } public static List<double[]> readNumericCSVFile(String filename, String separator) throws IOException { BufferedReader reader = null; String line = null; String[] entries = null; List<double[]> contents = null; try { reader = new BufferedReader(new FileReader(filename)); contents = new ArrayList<double[]>(); // continue reading the data while ((line = reader.readLine()) != null) { // split the line into the individual tokens entries = line.split(separator); double[] row = new double[entries.length]; for (int j = 0; j < entries.length; j++) { row[j] = Double.parseDouble(entries[j]); } contents.add(row); } } catch (IOException e) { e.printStackTrace(); } finally { // close the reader if necessary if (reader != null) { reader.close(); } } return contents; } /** * Try to save an object for quick reloading later. * * @throws Exception */ public static void serializeObject(Object obj, String destPath) throws IOException { if (obj == null) { throw new IllegalArgumentException("Cannot serialize a null object."); } FileOutputStream f; ObjectOutputStream s = null; try { f = new FileOutputStream(destPath, false); s = new ObjectOutputStream(f); s.writeObject(obj); s.close(); } catch (IOException e) { if (s != null) { s.close(); } e.printStackTrace(); throw e; } } /** * @param inputPath * @return a deserialized object loaded from inputPath * @throws Exception */ public static Object loadObject(String inputPath) throws IOException { Object retval = null; if (!(new File(inputPath)).exists()) { throw new IllegalStateException("Input file (" + inputPath + ") does not exist"); } FileInputStream f; ObjectInputStream o = null; try { f = new FileInputStream(inputPath); o = new ObjectInputStream(f); retval = o.readObject(); o.close(); return retval; } catch (IOException e) { throw e; } catch (ClassNotFoundException e) { throw new IOException(); } finally { if (o != null) { try { o.close(); } catch (IOException e1) { } } } } }
/* * Copyright 2017 * Ubiquitous Knowledge Processing (UKP) Lab * Technische Universität Darmstadt * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.tudarmstadt.ukp.inception.active.learning.sidebar; import org.apache.wicket.model.IModel; import org.apache.wicket.request.resource.PackageResourceReference; import org.apache.wicket.request.resource.ResourceReference; import org.springframework.stereotype.Component; import de.tudarmstadt.ukp.clarin.webanno.api.CasProvider; import de.tudarmstadt.ukp.clarin.webanno.api.annotation.action.AnnotationActionHandler; import de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState; import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.AnnotationPage; import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.sidebar.AnnotationSidebarFactory_ImplBase; import de.tudarmstadt.ukp.clarin.webanno.ui.annotation.sidebar.AnnotationSidebar_ImplBase; @Component("activeLearningSidebar") public class ActiveLearningSidebarFactory extends AnnotationSidebarFactory_ImplBase { private static final ResourceReference ICON = new PackageResourceReference(ActiveLearningSidebarFactory.class, "active_learning.png"); @Override public String getDisplayName() { return "Active Learning"; } @Override public ResourceReference getIcon() { return ICON; } @Override public AnnotationSidebar_ImplBase create(String aId, IModel<AnnotatorState> aModel, AnnotationActionHandler aActionHandler, CasProvider aCasProvider, AnnotationPage aAnnotationPage) { return new ActiveLearningSidebar(aId, aModel, aActionHandler, aCasProvider, aAnnotationPage); } }
/* * Copyright © 2021-present Arcade Data Ltd (info@arcadedata.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-FileCopyrightText: 2021-present Arcade Data Ltd (info@arcadedata.com) * SPDX-License-Identifier: Apache-2.0 */ package com.arcadedb.query.sql.method.misc; import com.arcadedb.database.Document; import com.arcadedb.database.Identifiable; import com.arcadedb.query.sql.executor.CommandContext; /** * @author Johann Sorel (Geomatys) * @author Luca Garulli (l.garulli--(at)--gmail.com) */ public class SQLMethodField extends AbstractSQLMethod { public static final String NAME = "field"; public SQLMethodField() { super(NAME, 1, 1); } @Override public Object execute(final Object iThis, final Identifiable iCurrentRecord, final CommandContext iContext, final Object ioResult, final Object[] iParams) { if (iParams[0] == null) return null; final String field = iParams[0].toString(); if (ioResult instanceof Identifiable) { final Document doc = (Document) ((Identifiable) ioResult).getRecord(); return doc.get(field); } return null; } @Override public boolean evaluateParameters() { return false; } }
package com.clsnull.gulimall.product.service; import com.baomidou.mybatisplus.extension.service.IService; import com.clsnull.common.utils.PageUtils; import com.clsnull.gulimall.product.entity.SpuInfoDescEntity; import java.util.Map; /** * spu信息介绍 * * @author luozhifa * @email 1334084021@qq.com * @date 2021-11-15 23:02:42 */ public interface SpuInfoDescService extends IService<SpuInfoDescEntity> { PageUtils queryPage(Map<String, Object> params); }
package weed3rdb.features; import org.junit.Test; import org.noear.weed.cache.ICacheServiceEx; import org.noear.weed.cache.LocalCache; /** * @author noear 2021/4/2 created */ public class CacheTest2 { ICacheServiceEx cache = new LocalCache(); @Test public void test() throws Exception{ long time1 = cache.getBy(6,"cache_test",(cu)->{ return System.currentTimeMillis(); }); long time2 = cache.getBy(6,"cache_test",(cu)->{ return System.currentTimeMillis(); }); assert time1 == time2; Thread.sleep(1000 * 5); long time3 = cache.getBy(6,"cache_test",(cu)->{ return System.currentTimeMillis(); }); assert time1 == time3; Thread.sleep(1000 * 2); long time4 = cache.getBy(6,"cache_test",(cu)->{ return System.currentTimeMillis(); }); assert time1 != time4; } }
public class Teacher extends Profession { void teach(String name) { } }
package net.minecraft.item; import java.util.List; import javax.annotation.Nullable; import net.minecraft.block.DispenserBlock; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.tags.ItemTags; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class ShieldItem extends Item { public ShieldItem(Item.Properties p_i48470_1_) { super(p_i48470_1_); DispenserBlock.registerBehavior(this, ArmorItem.DISPENSE_ITEM_BEHAVIOR); } public String getDescriptionId(ItemStack p_77667_1_) { return p_77667_1_.getTagElement("BlockEntityTag") != null ? this.getDescriptionId() + '.' + getColor(p_77667_1_).getName() : super.getDescriptionId(p_77667_1_); } @OnlyIn(Dist.CLIENT) public void appendHoverText(ItemStack p_77624_1_, @Nullable World p_77624_2_, List<ITextComponent> p_77624_3_, ITooltipFlag p_77624_4_) { BannerItem.appendHoverTextFromBannerBlockEntityTag(p_77624_1_, p_77624_3_); } public UseAction getUseAnimation(ItemStack p_77661_1_) { return UseAction.BLOCK; } public int getUseDuration(ItemStack p_77626_1_) { return 72000; } public ActionResult<ItemStack> use(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) { ItemStack itemstack = p_77659_2_.getItemInHand(p_77659_3_); p_77659_2_.startUsingItem(p_77659_3_); return ActionResult.consume(itemstack); } public boolean isValidRepairItem(ItemStack p_82789_1_, ItemStack p_82789_2_) { return ItemTags.PLANKS.contains(p_82789_2_.getItem()) || super.isValidRepairItem(p_82789_1_, p_82789_2_); } public static DyeColor getColor(ItemStack p_195979_0_) { return DyeColor.byId(p_195979_0_.getOrCreateTagElement("BlockEntityTag").getInt("Base")); } }
package com.hbird.common.chating.highlight; import com.hbird.common.chating.data.BarData; import com.hbird.common.chating.data.BarLineScatterCandleBubbleData; import com.hbird.common.chating.data.ChartData; import com.hbird.common.chating.data.DataSet; import com.hbird.common.chating.interfaces.dataprovider.BarDataProvider; import com.hbird.common.chating.interfaces.dataprovider.CombinedDataProvider; import com.hbird.common.chating.interfaces.datasets.IDataSet; import java.util.List; /** * Created by Philipp Jahoda on 12/09/15. */ public class CombinedHighlighter extends ChartHighlighter<CombinedDataProvider> implements IHighlighter { /** * bar highlighter for supporting stacked highlighting */ protected BarHighlighter barHighlighter; public CombinedHighlighter(CombinedDataProvider chart, BarDataProvider barChart) { super(chart); // if there is BarData, create a BarHighlighter barHighlighter = barChart.getBarData() == null ? null : new BarHighlighter(barChart); } @Override protected List<Highlight> getHighlightsAtXValue(float xVal, float x, float y) { mHighlightBuffer.clear(); List<BarLineScatterCandleBubbleData> dataObjects = mChart.getCombinedData().getAllData(); for (int i = 0; i < dataObjects.size(); i++) { ChartData dataObject = dataObjects.get(i); // in case of BarData, let the BarHighlighter take over if (barHighlighter != null && dataObject instanceof BarData) { Highlight high = barHighlighter.getHighlight(x, y); if (high != null) { high.setDataIndex(i); mHighlightBuffer.add(high); } } else { for (int j = 0, dataSetCount = dataObject.getDataSetCount(); j < dataSetCount; j++) { IDataSet dataSet = dataObjects.get(i).getDataSetByIndex(j); // don't include datasets that cannot be highlighted if (!dataSet.isHighlightEnabled()) continue; List<Highlight> highs = buildHighlights(dataSet, j, xVal, DataSet.Rounding.CLOSEST); for (Highlight high : highs) { high.setDataIndex(i); mHighlightBuffer.add(high); } } } } return mHighlightBuffer; } // protected Highlight getClosest(float x, float y, Highlight... highs) { // // Highlight closest = null; // float minDistance = Float.MAX_VALUE; // // for (Highlight high : highs) { // // if (high == null) // continue; // // float tempDistance = getDistance(x, y, high.getXPx(), high.getYPx()); // // if (tempDistance < minDistance) { // minDistance = tempDistance; // closest = high; // } // } // // return closest; // } }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.pinot.core.operator.blocks; import java.util.Map; import org.apache.pinot.core.common.Block; import org.apache.pinot.core.common.BlockDocIdSet; import org.apache.pinot.core.common.BlockDocIdValueSet; import org.apache.pinot.core.common.BlockMetadata; import org.apache.pinot.core.common.BlockValSet; import org.apache.pinot.core.common.DataBlockCache; import org.apache.pinot.core.operator.docvalsets.ProjectionBlockValSet; import org.apache.pinot.segment.spi.datasource.DataSource; /** * ProjectionBlock holds a column name to Block Map. * It provides DocIdSetBlock for a given column. */ public class ProjectionBlock implements Block { private final Map<String, DataSource> _dataSourceMap; private final DataBlockCache _dataBlockCache; public ProjectionBlock(Map<String, DataSource> dataSourceMap, DataBlockCache dataBlockCache) { _dataSourceMap = dataSourceMap; _dataBlockCache = dataBlockCache; } public int getNumDocs() { return _dataBlockCache.getNumDocs(); } public BlockValSet getBlockValueSet(String column) { return new ProjectionBlockValSet(_dataBlockCache, column, _dataSourceMap.get(column)); } @Override public BlockDocIdSet getBlockDocIdSet() { throw new UnsupportedOperationException(); } @Override public BlockValSet getBlockValueSet() { throw new UnsupportedOperationException(); } @Override public BlockDocIdValueSet getBlockDocIdValueSet() { throw new UnsupportedOperationException(); } @Override public BlockMetadata getMetadata() { throw new UnsupportedOperationException(); } }
package lintcode; import util.adt.TreeNode; import static util.TreeUtil.createNode; public class BaseBinaryTrase { public static TreeNode create() { TreeNode node1 = createNode(1); TreeNode node2 = createNode(2); TreeNode node3 = createNode(3); node1.right = node2; node2.left = node3; return node1; } }
package br.copy; import java.util.Scanner; import br.Music; import br.Text; import br.Window; public class Stage3 { private Music BGM; private Music TRANS; private Text LOGO; private Window FRAME; private Story STORY; Scanner stdIn = new Scanner(System.in); public Stage3(){ this.BGM = new Music("testBGM.mp3", true); this.LOGO = new Text("sceneIntroLogo", 100); this.TRANS = new Music("sceneStart.mp3", false); } public void start() throws InterruptedException { TRANS.start(); LOGO.start(); Thread.sleep(3*1000); STORY = new Story("FormBandMeetMary"); STORY.start(300); } }
package com.example.mximc.smoney.util.lock; import android.content.Context; import android.view.WindowManager; public class ScreenUtils { @SuppressWarnings("deprecation") public static int[] getScreenDispaly(Context context){ WindowManager wm=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE); int width=wm.getDefaultDisplay().getWidth();//手机屏幕的宽度 int height=wm.getDefaultDisplay().getHeight();//手机屏幕的高度 int result[] = {width,height}; return result; } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package io.druid.guice; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableSet; import com.google.inject.Binder; import com.google.inject.BindingAnnotation; import com.google.inject.Guice; import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.Module; import com.google.inject.TypeLiteral; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.HashSet; import java.util.Properties; import java.util.Set; /** */ public class ConditionalMultibindTest { private static final String ANIMAL_TYPE = "animal.type"; private Properties props; @Before public void setUp() { props = new Properties(); } @Test public void testMultiConditionalBind_cat() { props.setProperty("animal.type", "cat"); Injector injector = Guice.createInjector(new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("cat"), Cat.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("dog"), Dog.class); } }); Set<Animal> animalSet = injector.getInstance(Key.get(new TypeLiteral<Set<Animal>>() { })); Assert.assertEquals(1, animalSet.size()); Assert.assertEquals(animalSet, ImmutableSet.<Animal>of(new Cat())); } @Test public void testMultiConditionalBind_cat_dog() { props.setProperty("animal.type", "pets"); Injector injector = Guice.createInjector(new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Cat.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Dog.class); } }); Set<Animal> animalSet = injector.getInstance(Key.get(new TypeLiteral<Set<Animal>>() { })); Assert.assertEquals(2, animalSet.size()); Assert.assertEquals(animalSet, ImmutableSet.of(new Cat(), new Dog())); } @Test public void testMultiConditionalBind_cat_dog_non_continuous_syntax() { props.setProperty("animal.type", "pets"); Injector injector = Guice.createInjector(new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Cat.class); ConditionalMultibind.create(props, binder, Animal.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Dog.class); } }); Set<Animal> animalSet = injector.getInstance(Key.get(new TypeLiteral<Set<Animal>>() { })); Assert.assertEquals(2, animalSet.size()); Assert.assertEquals(animalSet, ImmutableSet.of(new Cat(), new Dog())); } @Test public void testMultiConditionalBind_multiple_modules() { props.setProperty("animal.type", "pets"); Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Cat.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Dog.class); } }, new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("not_match"), Tiger.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Fish.class); } } ); Set<Animal> animalSet = injector.getInstance(Key.get(new TypeLiteral<Set<Animal>>() { })); Assert.assertEquals(3, animalSet.size()); Assert.assertEquals(animalSet, ImmutableSet.of(new Cat(), new Dog(), new Fish())); } @Test public void testMultiConditionalBind_multiple_modules_with_annotation() { props.setProperty("animal.type", "pets"); Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class, SanDiego.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Cat.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Dog.class); } }, new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class, SanDiego.class) .addBinding(new Bird()) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Tiger.class); ConditionalMultibind.create(props, binder, Animal.class, SanJose.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Fish.class); } } ); Set<Animal> animalSet_1 = injector.getInstance(Key.get(new TypeLiteral<Set<Animal>>() { }, SanDiego.class)); Assert.assertEquals(4, animalSet_1.size()); Assert.assertEquals(animalSet_1, ImmutableSet.of(new Bird(), new Cat(), new Dog(), new Tiger())); Set<Animal> animalSet_2 = injector.getInstance(Key.get(new TypeLiteral<Set<Animal>>() { }, SanJose.class)); Assert.assertEquals(1, animalSet_2.size()); Assert.assertEquals(animalSet_2, ImmutableSet.<Animal>of(new Fish())); } @Test public void testMultiConditionalBind_inject() { props.setProperty("animal.type", "pets"); Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class) .addBinding(Bird.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Cat.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Dog.class); } }, new Module() { @Override public void configure(Binder binder) { ConditionalMultibind.create(props, binder, Animal.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("not_match"), Tiger.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), Fish.class); } } ); PetShotAvails shop = new PetShotAvails(); injector.injectMembers(shop); Assert.assertEquals(4, shop.animals.size()); Assert.assertEquals(shop.animals, ImmutableSet.of(new Bird(), new Cat(), new Dog(), new Fish())); } @Test public void testMultiConditionalBind_typeLiteral() { props.setProperty("animal.type", "pets"); final Set<Animal> set1 = ImmutableSet.of(new Dog(), new Tiger()); final Set<Animal> set2 = ImmutableSet.of(new Cat(), new Fish()); final Set<Animal> set3 = ImmutableSet.of(new Cat()); final Set<Animal> union = new HashSet<>(); union.addAll(set1); union.addAll(set2); final Zoo<Animal> zoo1 = new Zoo<>(set1); final Zoo<Animal> zoo2 = new Zoo<>(); Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { ConditionalMultibind .create(props, binder, new TypeLiteral<Set<Animal>>() {}) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), set1) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), set2); ConditionalMultibind .create(props, binder, new TypeLiteral<Zoo<Animal>>() {}) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), zoo1); } }, new Module() { @Override public void configure(Binder binder) { ConditionalMultibind .create(props, binder, new TypeLiteral<Set<Animal>>() {}) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), set3); ConditionalMultibind .create(props, binder, new TypeLiteral<Set<Animal>>() {}, SanDiego.class) .addConditionBinding(ANIMAL_TYPE, Predicates.equalTo("pets"), union); ConditionalMultibind .create(props, binder, new TypeLiteral<Zoo<Animal>>() {}) .addBinding(new TypeLiteral<Zoo<Animal>>() {}); } } ); Set<Set<Animal>> actualAnimalSet = injector.getInstance(Key.get(new TypeLiteral<Set<Set<Animal>>>() {})); Assert.assertEquals(3, actualAnimalSet.size()); Assert.assertEquals(ImmutableSet.of(set1, set2, set3), actualAnimalSet); actualAnimalSet = injector.getInstance(Key.get(new TypeLiteral<Set<Set<Animal>>>() {}, SanDiego.class)); Assert.assertEquals(1, actualAnimalSet.size()); Assert.assertEquals(ImmutableSet.of(union), actualAnimalSet); final Set<Zoo<Animal>> actualZooSet = injector.getInstance(Key.get(new TypeLiteral<Set<Zoo<Animal>>>() {})); Assert.assertEquals(2, actualZooSet.size()); Assert.assertEquals(ImmutableSet.of(zoo1, zoo2), actualZooSet); } abstract static class Animal { private final String type; Animal(String type) { this.type = type; } @Override public String toString() { return "Animal{" + "type='" + type + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Animal animal = (Animal) o; return type != null ? type.equals(animal.type) : animal.type == null; } @Override public int hashCode() { return type != null ? type.hashCode() : 0; } } static class PetShotAvails { @Inject Set<Animal> animals; } static class Dog extends Animal { Dog() { super("dog"); } } static class Cat extends Animal { Cat() { super("cat"); } } static class Fish extends Animal { Fish() { super("fish"); } } static class Tiger extends Animal { Tiger() { super("tiger"); } } static class Bird extends Animal { Bird() { super("bird"); } } static class Zoo<T> { Set<T> animals; public Zoo() { animals = new HashSet<>(); } public Zoo(Set<T> animals) { this.animals = animals; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Zoo<?> zoo = (Zoo<?>) o; return animals != null ? animals.equals(zoo.animals) : zoo.animals == null; } @Override public int hashCode() { return animals != null ? animals.hashCode() : 0; } @Override public String toString() { return "Zoo{" + "animals=" + animals + '}'; } } @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @BindingAnnotation @interface SanDiego { } @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @BindingAnnotation @interface SanJose { } }
package com.kevin.nexus; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter; import com.sun.jersey.core.util.Base64; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.sonatype.nexus.rest.model.RepositoryTargetResource; import org.sonatype.nexus.rest.model.RepositoryTargetResourceResponse; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; import java.io.IOException; import java.net.URI; import java.util.Arrays; import java.util.logging.Logger; /** * http://localhost:8081/nexus/nexus-core-documentation-plugin/core/docs/index.html * * @author Marcel Birkner */ public class NexusTestClientOriginal { private static Logger log = Logger.getLogger( NexusTestClientOriginal.class.getSimpleName() ); private static String user = "admin"; private static String password = "admin123"; private static String url = "http://localhost:8081/nexus/"; public static void main(String[] args) throws JsonParseException, JsonMappingException, IOException { NexusTestClientOriginal client = new NexusTestClientOriginal(); client.run(); } private void run() throws JsonParseException, JsonMappingException, IOException { WebResource service = getService(); log.info("Check that Nexus is running"); String nexusStatus = service.path("service").path("local").path("status").accept(MediaType.APPLICATION_JSON).get(ClientResponse.class).toString(); log.info(nexusStatus + "\n"); log.info("GET Nexus Version"); String nexusVersion = service.path("service").path("local").path("status").accept(MediaType.APPLICATION_JSON).get(String.class).toString(); log.info(nexusVersion + "\n"); if( ! nexusVersion.contains( "nexus:metadata" ) ) { log.warning("Please install the metadata plugin."); return; } if( ! nexusVersion.contains( "Sonatype Nexus Professional" ) ) { log.warning("Please install Sonatype Nexus Professional."); return; } log.info("Installation seems to be correct.\n"); String targetName = "NewTarget"; log.info("Create Repo Target with name: " + targetName); RepositoryTargetResourceResponse request = new RepositoryTargetResourceResponse(); RepositoryTargetResource data = new RepositoryTargetResource(); data.setContentClass("maven2"); data.setName(targetName); data.setPatterns(Arrays.asList(".*")); request.setData(data); service.path("service").path("local").path("repo_targets").post(request); log.info("Get all repo targets"); String repoTargets = service.path("service").path("local").path("repo_targets") .accept(MediaType.APPLICATION_JSON).get(String.class); log.info( repoTargets ); if( ! repoTargets.contains( targetName ) ) { log.warning("Repo Target was not created successfully"); return; } ObjectMapper mapper = new ObjectMapper(); RepositoryTargets targets = mapper.readValue(repoTargets, RepositoryTargets.class); RepositoryTargetResource[] list = targets.getData(); for (RepositoryTargetResource res : list) { if( res.getName().equalsIgnoreCase( targetName ) ) { log.info("Delete Repo Target with ID " + res.getId() + " Name " + res.getName() ); service.path("service").path("local").path("repo_targets").path(res.getId()).delete(); } } log.info(service.path("service").path("local").path("search").path("m2").path("freeform") .queryParam("p", "commitStage").queryParam("t", "matches").queryParam("v", "success") .accept(MediaType.APPLICATION_JSON).get(String.class).toString()); String artifact = "urn:maven/artifact#de.mb:rest-test:0.0.1::jar"; log.info("Get metadata of artifact " + artifact + ". Only works with Nexus Pro & metadata plugin installed"); String encodedString = new String( Base64.encode(artifact.getBytes())); String metaDataResult = service.path("service").path("local").path("index").path("custom_metadata").path("releases") .path(encodedString).accept(MediaType.APPLICATION_JSON).get(String.class).toString(); log.info(metaDataResult); } private WebResource getService() { ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); client.addFilter(new HTTPBasicAuthFilter(user, password)); return client.resource(getBaseURI()); } private URI getBaseURI() { return UriBuilder.fromUri( url ).build(); } }
package org.herebdragons.graphics.enums; public enum RendererType { JAVA_2D, JAVA_FX, OPEN_GL }