repo_name
stringlengths 7
104
| file_path
stringlengths 13
198
| context
stringlengths 67
7.15k
| import_statement
stringlengths 16
4.43k
| code
stringlengths 40
6.98k
| prompt
stringlengths 227
8.27k
| next_line
stringlengths 8
795
|
---|---|---|---|---|---|---|
Stratio/stratio-connector-deep | src/test/java/com/stratio/connector/deep/AerospikeConnectionConfigurationBuilder.java | // Path: src/main/java/com/stratio/connector/deep/configuration/DeepConnectorConstants.java
// public final class DeepConnectorConstants {
// private DeepConnectorConstants(){
//
// }
//
// public static final String HDFS = "hdfs";
// public static final String SPARK_MASTER = "spark.master";
// public static final String SPARK_HOME = "spark.home";
// public static final String SPARK_JARS = "spark.jars";
// public static final String CLUSTER_PREFIX_CONSTANT = "cluster";
// public static final String IMPL_CLASS_SUFIX_CONSTANT = ".implClass";
// public static final String EXTRACTOR_IMPL_CLASS = "extractorImplClass";
// public static final String DEEP_CONNECTOR_JOB_CONSTANT = "DeepConnectorJob";
//
// public static final int DEFAULT_RESULT_SIZE = 10000;
// public static final String PROPERTY_DEFAULT_LIMIT = "DefaultLimit";
// public static final String SPARK_EXECUTOR_MEMORY = "spark.executor.memory";
// public static final String SPARK_DRIVER_MEMORY = "spark.driver.memory";
// public static final String SPARK_TASK_CPUS = "spark.task.cpus";
// public static final String SPARK_DEFAULT_PARALELISM = "spark.default.parallelism";
// public static final String SPARK_CORES_MAX = "spark.cores.max";
// public static final String SPARK_DRIVER_RESULTSIZE = "spark.driver.maxResultSize";
//
//
//
//
// }
| import java.util.HashMap;
import java.util.Map;
import com.stratio.connector.deep.configuration.DeepConnectorConstants;
import com.stratio.crossdata.common.connector.ConnectorClusterConfig;
import com.stratio.crossdata.common.data.ClusterName;
import com.stratio.crossdata.common.data.DataStoreName;
import com.stratio.deep.commons.extractor.utils.ExtractorConstants; | package com.stratio.connector.deep;
public class AerospikeConnectionConfigurationBuilder {
private static final ClusterName CLUSTERNAME_CONSTANT = new ClusterName("aerospike");
private static final String AEROSPIKE_CELL_CLASS = "com.stratio.deep.aerospike.extractor.AerospikeCellExtractor";
public static final String HOST = "10.200.0.58";
public static final String PORT = "3000";
/**
* Create the configuration object to config the connector cluster information
*
* @return Cluster configuration object
*/
public static ConnectorClusterConfig prepareConfiguration() {
Map<String, String> options = new HashMap<>();
options.put(ExtractorConstants.HOST, HOST);
options.put(ExtractorConstants.PORT, PORT);
options.put(ExtractorConstants.INNERCLASS, AEROSPIKE_CELL_CLASS);
Map<String, String> connectorOptions = new HashMap<>(); | // Path: src/main/java/com/stratio/connector/deep/configuration/DeepConnectorConstants.java
// public final class DeepConnectorConstants {
// private DeepConnectorConstants(){
//
// }
//
// public static final String HDFS = "hdfs";
// public static final String SPARK_MASTER = "spark.master";
// public static final String SPARK_HOME = "spark.home";
// public static final String SPARK_JARS = "spark.jars";
// public static final String CLUSTER_PREFIX_CONSTANT = "cluster";
// public static final String IMPL_CLASS_SUFIX_CONSTANT = ".implClass";
// public static final String EXTRACTOR_IMPL_CLASS = "extractorImplClass";
// public static final String DEEP_CONNECTOR_JOB_CONSTANT = "DeepConnectorJob";
//
// public static final int DEFAULT_RESULT_SIZE = 10000;
// public static final String PROPERTY_DEFAULT_LIMIT = "DefaultLimit";
// public static final String SPARK_EXECUTOR_MEMORY = "spark.executor.memory";
// public static final String SPARK_DRIVER_MEMORY = "spark.driver.memory";
// public static final String SPARK_TASK_CPUS = "spark.task.cpus";
// public static final String SPARK_DEFAULT_PARALELISM = "spark.default.parallelism";
// public static final String SPARK_CORES_MAX = "spark.cores.max";
// public static final String SPARK_DRIVER_RESULTSIZE = "spark.driver.maxResultSize";
//
//
//
//
// }
// Path: src/test/java/com/stratio/connector/deep/AerospikeConnectionConfigurationBuilder.java
import java.util.HashMap;
import java.util.Map;
import com.stratio.connector.deep.configuration.DeepConnectorConstants;
import com.stratio.crossdata.common.connector.ConnectorClusterConfig;
import com.stratio.crossdata.common.data.ClusterName;
import com.stratio.crossdata.common.data.DataStoreName;
import com.stratio.deep.commons.extractor.utils.ExtractorConstants;
package com.stratio.connector.deep;
public class AerospikeConnectionConfigurationBuilder {
private static final ClusterName CLUSTERNAME_CONSTANT = new ClusterName("aerospike");
private static final String AEROSPIKE_CELL_CLASS = "com.stratio.deep.aerospike.extractor.AerospikeCellExtractor";
public static final String HOST = "10.200.0.58";
public static final String PORT = "3000";
/**
* Create the configuration object to config the connector cluster information
*
* @return Cluster configuration object
*/
public static ConnectorClusterConfig prepareConfiguration() {
Map<String, String> options = new HashMap<>();
options.put(ExtractorConstants.HOST, HOST);
options.put(ExtractorConstants.PORT, PORT);
options.put(ExtractorConstants.INNERCLASS, AEROSPIKE_CELL_CLASS);
Map<String, String> connectorOptions = new HashMap<>(); | connectorOptions.put(DeepConnectorConstants.PROPERTY_DEFAULT_LIMIT, |
Stratio/stratio-connector-deep | src/main/java/com/stratio/connector/deep/engine/query/functions/LessThan.java | // Path: src/main/java/com/stratio/connector/deep/engine/query/structures/Term.java
// public abstract class Term<T extends Comparable<T>> extends ValueCell<T> implements Comparable<T>,
// Serializable {
//
// /**
// * Class logger.
// */
// private static final Logger LOG = Logger.getLogger(Term.class);
//
// private static final long serialVersionUID = -4258938152892510227L;
// protected Class<? extends Comparable<?>> clazz;
// protected T value;
//
// /**
// * Basic constructor.
// * @param clazz
// * Class of the type that extends Comparable
// * @param value
// * Value of the Term
// */
// public Term(Class<? extends Comparable<?>> clazz, T value) {
// this.clazz = clazz;
// this.value = value;
// }
//
// /**
// * Get the Term Java Class.
// *
// * @return A {@link java.lang.Class}.
// */
// public Class<? extends Comparable<?>> getTermClass() {
// return clazz;
// }
//
// /**
// * Get the term value.
// *
// * @return A {@link java.lang.Object} with the value.
// */
// public T getTermValue() {
// return value;
// }
//
// @Override
// public String getStringValue() {
// return value.toString();
// }
//
// @Override
// public String toString() {
// return value.toString();
// }
//
// /*
// * (non-Javadoc)
// *
// * @see java.lang.Comparable#compareTo(java.lang.Object)
// */
// @Override
// public int compareTo(T o) {
//
// if (!(this.clazz.isInstance(o))) {
//
// try {
// if ((this.clazz).equals(Long.class) && o.getClass().equals(Integer.class)) {
// Long obj = Long.valueOf(o.toString());
// return Long.valueOf(this.getStringValue()).compareTo(obj);
// } else if ((this.clazz).equals(Double.class) && o.getClass().equals(Float.class)) {
// Double obj = Double.valueOf(o.toString());
// return Double.valueOf(this.getStringValue()).compareTo(obj);
// }
// } catch (NumberFormatException | ClassCastException e) {
// LOG.error("Sorry, unable to Cast incompatible types ->" + this.clazz + " & " + o.getClass(), e);
// }
// return this.value.compareTo(o);
// }
// return this.value.compareTo(o);
// }
//
// /**
// * Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those
// * provided by {@link java.util.HashMap}.
// *
// * @return a hash code value for this object.
// * @see Object#equals(Object)
// * @see System#identityHashCode
// */
// @Override
// public int hashCode() {
// return clazz.hashCode() * this.getTermValue().hashCode();
// }
//
// /**
// * Indicates whether some other object is "equal to" this one.
// * <p/>
// * The {@code equals} method implements an equivalence relation on non-null object references:
// *
// * @param obj
// * the reference object with which to compare.
// * @return {@code true} if this object is the same as the obj argument; {@code false} otherwise.
// * @see #hashCode()
// * @see java.util.HashMap
// */
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (!(this.clazz.isInstance(obj))) {
// try {
// if (obj instanceof String) {
// String stringObj = (String) obj;
// return this.getStringValue().equals(stringObj);
// } else if (obj instanceof Float) {
// Float floatObj = (Float) obj;
// return Float.valueOf(this.getStringValue()).equals(floatObj);
// } else if (obj instanceof Integer) {
// Integer integerObj = (Integer) obj;
// return Integer.valueOf(this.getStringValue()).equals(integerObj);
// } else if (obj instanceof Long) {
// Long longObj = (Long) obj;
// return Long.valueOf(this.getStringValue()).equals(longObj);
// }
// } catch (NumberFormatException e) {
// LOG.error("Sorry, unable to Cast incompatible types ->" + this.clazz + " & " + obj.getClass(), e);
// }
// return super.equals(obj);
// }
// return this.value.equals(obj);
// }
// }
| import com.stratio.deep.commons.entity.Cells;
import org.apache.spark.api.java.function.Function;
import com.stratio.connector.deep.engine.query.structures.Term;
import com.stratio.crossdata.common.data.ColumnName; | /*
* Licensed to STRATIO (C) under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. The STRATIO (C) 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 com.stratio.connector.deep.engine.query.functions;
/**
* Class that defines LessThan, Spark function that determines if the value in the given field is less than the provided term.
*/
public class LessThan implements Function<Cells, Boolean> {
private static final long serialVersionUID = 2675616112608139116L;
/**
* Term to be compared.
*/ | // Path: src/main/java/com/stratio/connector/deep/engine/query/structures/Term.java
// public abstract class Term<T extends Comparable<T>> extends ValueCell<T> implements Comparable<T>,
// Serializable {
//
// /**
// * Class logger.
// */
// private static final Logger LOG = Logger.getLogger(Term.class);
//
// private static final long serialVersionUID = -4258938152892510227L;
// protected Class<? extends Comparable<?>> clazz;
// protected T value;
//
// /**
// * Basic constructor.
// * @param clazz
// * Class of the type that extends Comparable
// * @param value
// * Value of the Term
// */
// public Term(Class<? extends Comparable<?>> clazz, T value) {
// this.clazz = clazz;
// this.value = value;
// }
//
// /**
// * Get the Term Java Class.
// *
// * @return A {@link java.lang.Class}.
// */
// public Class<? extends Comparable<?>> getTermClass() {
// return clazz;
// }
//
// /**
// * Get the term value.
// *
// * @return A {@link java.lang.Object} with the value.
// */
// public T getTermValue() {
// return value;
// }
//
// @Override
// public String getStringValue() {
// return value.toString();
// }
//
// @Override
// public String toString() {
// return value.toString();
// }
//
// /*
// * (non-Javadoc)
// *
// * @see java.lang.Comparable#compareTo(java.lang.Object)
// */
// @Override
// public int compareTo(T o) {
//
// if (!(this.clazz.isInstance(o))) {
//
// try {
// if ((this.clazz).equals(Long.class) && o.getClass().equals(Integer.class)) {
// Long obj = Long.valueOf(o.toString());
// return Long.valueOf(this.getStringValue()).compareTo(obj);
// } else if ((this.clazz).equals(Double.class) && o.getClass().equals(Float.class)) {
// Double obj = Double.valueOf(o.toString());
// return Double.valueOf(this.getStringValue()).compareTo(obj);
// }
// } catch (NumberFormatException | ClassCastException e) {
// LOG.error("Sorry, unable to Cast incompatible types ->" + this.clazz + " & " + o.getClass(), e);
// }
// return this.value.compareTo(o);
// }
// return this.value.compareTo(o);
// }
//
// /**
// * Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those
// * provided by {@link java.util.HashMap}.
// *
// * @return a hash code value for this object.
// * @see Object#equals(Object)
// * @see System#identityHashCode
// */
// @Override
// public int hashCode() {
// return clazz.hashCode() * this.getTermValue().hashCode();
// }
//
// /**
// * Indicates whether some other object is "equal to" this one.
// * <p/>
// * The {@code equals} method implements an equivalence relation on non-null object references:
// *
// * @param obj
// * the reference object with which to compare.
// * @return {@code true} if this object is the same as the obj argument; {@code false} otherwise.
// * @see #hashCode()
// * @see java.util.HashMap
// */
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (!(this.clazz.isInstance(obj))) {
// try {
// if (obj instanceof String) {
// String stringObj = (String) obj;
// return this.getStringValue().equals(stringObj);
// } else if (obj instanceof Float) {
// Float floatObj = (Float) obj;
// return Float.valueOf(this.getStringValue()).equals(floatObj);
// } else if (obj instanceof Integer) {
// Integer integerObj = (Integer) obj;
// return Integer.valueOf(this.getStringValue()).equals(integerObj);
// } else if (obj instanceof Long) {
// Long longObj = (Long) obj;
// return Long.valueOf(this.getStringValue()).equals(longObj);
// }
// } catch (NumberFormatException e) {
// LOG.error("Sorry, unable to Cast incompatible types ->" + this.clazz + " & " + obj.getClass(), e);
// }
// return super.equals(obj);
// }
// return this.value.equals(obj);
// }
// }
// Path: src/main/java/com/stratio/connector/deep/engine/query/functions/LessThan.java
import com.stratio.deep.commons.entity.Cells;
import org.apache.spark.api.java.function.Function;
import com.stratio.connector.deep.engine.query.structures.Term;
import com.stratio.crossdata.common.data.ColumnName;
/*
* Licensed to STRATIO (C) under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. The STRATIO (C) 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 com.stratio.connector.deep.engine.query.functions;
/**
* Class that defines LessThan, Spark function that determines if the value in the given field is less than the provided term.
*/
public class LessThan implements Function<Cells, Boolean> {
private static final long serialVersionUID = 2675616112608139116L;
/**
* Term to be compared.
*/ | private final Term<?> term; |
MyCATApache/Mycat-ConfigCenter | server/src/main/java/org/opencloudb/mycat/config/server/controllers/LoggedOutController.java | // Path: server/src/main/java/org/opencloudb/mycat/config/server/util/Constant.java
// public class Constant {
//
// // 斜线
// public static final String SLASH = "/";
//
// // 回车换行
// public static final String CRLF = "\n";
//
// // 等号
// public static final String EQUAL = "=";
//
// // tab
// public static final String TAB = "\t";
//
// // 默认语言
// public static final String LANGUAGE_DEFAULT = "default";
//
// // zk 数据库配置信息路径
// public static final String PATH_DB_CONFIG = "/configuration/dbInstance";
//
// // zk 多语言系统配置信息路径
// public static final String PATH_I18N = "/i18n";
//
// public static final String PAGE_COMMON = "config/configAdminAjax";
//
// public static final String PAGE_DBCONFIG = "config/dbConfig";
//
// public static final String PAGE_DBCONFIG_EDIT = "config/dbConfigEdit";
//
// public static final String PAGE_LOGIN = "login";
//
// public static final String PAGE_LOGOUT = "loggedout";
//
// // 多语言系统_项目列表
// public static final String PAGE_I18N_PROJECT_LIST = "i18n/projectList";
//
// // 多语言系统_项目编辑
// public static final String PAGE_I18N_PROJECT_EDIT = "i18n/projectEdit";
//
// // 多语言系统_属性列表
// public static final String PAGE_I18N_PROPERTY_LIST = "i18n/propertyList";
//
// // 多语言系统_属性编辑
// public static final String PAGE_I18N_PROPERTY_EDIT = "i18n/propertyEdit";
//
// // 多语言系统_编辑新属性
// public static final String PAGE_I18N_PROPERTY_NEW = "i18n/propertyNew";
//
// // 模块节点注释信息
// public static final String PROPERTIES_COMMENTS_PROJNODE = "recorder is language key's detail message. format is\nkey=createTime\tupdateTime\tdescription";
//
// // 语言节点注释信息
// public static final String PROPERTIES_COMMENTS_LANGNODE = "recorder is language key's value. format is\nkey=value";
//
// // 属性检索类型——键
// public static final int PROPERTIES_SEARCH_TYPE_KEY = 0;
//
// // 属性检索类型——值
// public static final int PROPERTIES_SEARCH_TYPE_VALUE = 1;
//
// // 多语言系统_综合显示页
// public static final String PAGE_I18N_PAGE_LIST = "i18n/pageList";
//
// // 多语言系统_page编辑页
// public static final String PAGE_I18N_PAGE_EDIT = "i18n/pageEdit";
//
// // 多语言系统_属性编辑
// public static final String PAGE_I18N_PROPERTY_UPDATE = "i18n/propertyUpdate";
// }
| import org.opencloudb.mycat.config.server.util.Constant;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; | package org.opencloudb.mycat.config.server.controllers;
@Controller
@RequestMapping(value = "/loggedout")
public class LoggedOutController {
@RequestMapping(method = RequestMethod.GET)
public String show(Model model) { | // Path: server/src/main/java/org/opencloudb/mycat/config/server/util/Constant.java
// public class Constant {
//
// // 斜线
// public static final String SLASH = "/";
//
// // 回车换行
// public static final String CRLF = "\n";
//
// // 等号
// public static final String EQUAL = "=";
//
// // tab
// public static final String TAB = "\t";
//
// // 默认语言
// public static final String LANGUAGE_DEFAULT = "default";
//
// // zk 数据库配置信息路径
// public static final String PATH_DB_CONFIG = "/configuration/dbInstance";
//
// // zk 多语言系统配置信息路径
// public static final String PATH_I18N = "/i18n";
//
// public static final String PAGE_COMMON = "config/configAdminAjax";
//
// public static final String PAGE_DBCONFIG = "config/dbConfig";
//
// public static final String PAGE_DBCONFIG_EDIT = "config/dbConfigEdit";
//
// public static final String PAGE_LOGIN = "login";
//
// public static final String PAGE_LOGOUT = "loggedout";
//
// // 多语言系统_项目列表
// public static final String PAGE_I18N_PROJECT_LIST = "i18n/projectList";
//
// // 多语言系统_项目编辑
// public static final String PAGE_I18N_PROJECT_EDIT = "i18n/projectEdit";
//
// // 多语言系统_属性列表
// public static final String PAGE_I18N_PROPERTY_LIST = "i18n/propertyList";
//
// // 多语言系统_属性编辑
// public static final String PAGE_I18N_PROPERTY_EDIT = "i18n/propertyEdit";
//
// // 多语言系统_编辑新属性
// public static final String PAGE_I18N_PROPERTY_NEW = "i18n/propertyNew";
//
// // 模块节点注释信息
// public static final String PROPERTIES_COMMENTS_PROJNODE = "recorder is language key's detail message. format is\nkey=createTime\tupdateTime\tdescription";
//
// // 语言节点注释信息
// public static final String PROPERTIES_COMMENTS_LANGNODE = "recorder is language key's value. format is\nkey=value";
//
// // 属性检索类型——键
// public static final int PROPERTIES_SEARCH_TYPE_KEY = 0;
//
// // 属性检索类型——值
// public static final int PROPERTIES_SEARCH_TYPE_VALUE = 1;
//
// // 多语言系统_综合显示页
// public static final String PAGE_I18N_PAGE_LIST = "i18n/pageList";
//
// // 多语言系统_page编辑页
// public static final String PAGE_I18N_PAGE_EDIT = "i18n/pageEdit";
//
// // 多语言系统_属性编辑
// public static final String PAGE_I18N_PROPERTY_UPDATE = "i18n/propertyUpdate";
// }
// Path: server/src/main/java/org/opencloudb/mycat/config/server/controllers/LoggedOutController.java
import org.opencloudb.mycat.config.server.util.Constant;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
package org.opencloudb.mycat.config.server.controllers;
@Controller
@RequestMapping(value = "/loggedout")
public class LoggedOutController {
@RequestMapping(method = RequestMethod.GET)
public String show(Model model) { | return Constant.PAGE_LOGOUT; |
MyCATApache/Mycat-ConfigCenter | server/src/main/java/org/opencloudb/mycat/config/server/services/ZkBaseService.java | // Path: server/src/main/java/org/opencloudb/mycat/config/server/model/ZkNode.java
// public class ZkNode {
//
// // 节点ID
// private String id;
//
// // 节点名称
// private String name;
//
// // 节点路径
// private String path;
//
// // 节点内容
// private String data;
//
// // 节点状态
// private Stat stat;
//
// // 节点创建时间
// private String ctime;
//
// // 节点修改时间
// private String mtime;
//
// /**
// * @return the id
// */
// public String getId() {
// return id;
// }
//
// /**
// * @param id
// * the id to set
// */
// public void setId(String id) {
// this.id = id;
// }
//
// /**
// * @return the name
// */
// public String getName() {
// return name;
// }
//
// /**
// * @param name
// * the name to set
// */
// public void setName(String name) {
// this.name = name;
// }
//
// /**
// * @return the path
// */
// public String getPath() {
// return path;
// }
//
// /**
// * @param path
// * the path to set
// */
// public void setPath(String path) {
// this.path = path;
// }
//
// /**
// * @return the stat
// */
// public Stat getStat() {
// return stat;
// }
//
// /**
// * @param stat
// * the stat to set
// */
// public void setStat(Stat stat) {
// this.stat = stat;
// }
//
// /**
// * @return the data
// */
// public String getData() {
// return data;
// }
//
// /**
// * @param data
// * the data to set
// */
// public void setData(String data) {
// this.data = data;
// }
//
// /**
// * @return the ctime
// */
// public String getCtime() {
// return ctime;
// }
//
// /**
// * @param ctime
// * the ctime to set
// */
// public void setCtime(String ctime) {
// this.ctime = ctime;
// }
//
// /**
// * @return the mtime
// */
// public String getMtime() {
// return mtime;
// }
//
// /**
// * @param mtime
// * the mtime to set
// */
// public void setMtime(String mtime) {
// this.mtime = mtime;
// }
//
// @Override
// public String toString() {
// return ToStringBuilder.reflectionToString(this);
// }
// }
| import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Stack;
import org.I0Itec.zkclient.ZkClient;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.opencloudb.mycat.config.server.model.ZkNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; | }
zkConfig.load(is);
rootPath = zkConfig.getProperty("zookeeper.rootPath");
String connectString = zkConfig.getProperty("connectString");
int sessionTimeout = Integer.parseInt(zkConfig
.getProperty("sessionTimeout"));
zk = new ZooKeeper(connectString, sessionTimeout, new Watcher() {
// 监控所有被触发的事件
public void process(WatchedEvent event) {
logger.debug("已经触发了" + event.getType() + "事件!");
if (event.getState() == KeeperState.Expired) {
new ZkBaseService();
}
}
});
client = new ZkClient(connectString, sessionTimeout);
} catch (IOException e) {
logger.error("IOException:" + e.getMessage());
}
}
/**
* 取得节点信息
*
* @param path
* @return
* @throws KeeperException
* @throws InterruptedException
*/ | // Path: server/src/main/java/org/opencloudb/mycat/config/server/model/ZkNode.java
// public class ZkNode {
//
// // 节点ID
// private String id;
//
// // 节点名称
// private String name;
//
// // 节点路径
// private String path;
//
// // 节点内容
// private String data;
//
// // 节点状态
// private Stat stat;
//
// // 节点创建时间
// private String ctime;
//
// // 节点修改时间
// private String mtime;
//
// /**
// * @return the id
// */
// public String getId() {
// return id;
// }
//
// /**
// * @param id
// * the id to set
// */
// public void setId(String id) {
// this.id = id;
// }
//
// /**
// * @return the name
// */
// public String getName() {
// return name;
// }
//
// /**
// * @param name
// * the name to set
// */
// public void setName(String name) {
// this.name = name;
// }
//
// /**
// * @return the path
// */
// public String getPath() {
// return path;
// }
//
// /**
// * @param path
// * the path to set
// */
// public void setPath(String path) {
// this.path = path;
// }
//
// /**
// * @return the stat
// */
// public Stat getStat() {
// return stat;
// }
//
// /**
// * @param stat
// * the stat to set
// */
// public void setStat(Stat stat) {
// this.stat = stat;
// }
//
// /**
// * @return the data
// */
// public String getData() {
// return data;
// }
//
// /**
// * @param data
// * the data to set
// */
// public void setData(String data) {
// this.data = data;
// }
//
// /**
// * @return the ctime
// */
// public String getCtime() {
// return ctime;
// }
//
// /**
// * @param ctime
// * the ctime to set
// */
// public void setCtime(String ctime) {
// this.ctime = ctime;
// }
//
// /**
// * @return the mtime
// */
// public String getMtime() {
// return mtime;
// }
//
// /**
// * @param mtime
// * the mtime to set
// */
// public void setMtime(String mtime) {
// this.mtime = mtime;
// }
//
// @Override
// public String toString() {
// return ToStringBuilder.reflectionToString(this);
// }
// }
// Path: server/src/main/java/org/opencloudb/mycat/config/server/services/ZkBaseService.java
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Stack;
import org.I0Itec.zkclient.ZkClient;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.opencloudb.mycat.config.server.model.ZkNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
}
zkConfig.load(is);
rootPath = zkConfig.getProperty("zookeeper.rootPath");
String connectString = zkConfig.getProperty("connectString");
int sessionTimeout = Integer.parseInt(zkConfig
.getProperty("sessionTimeout"));
zk = new ZooKeeper(connectString, sessionTimeout, new Watcher() {
// 监控所有被触发的事件
public void process(WatchedEvent event) {
logger.debug("已经触发了" + event.getType() + "事件!");
if (event.getState() == KeeperState.Expired) {
new ZkBaseService();
}
}
});
client = new ZkClient(connectString, sessionTimeout);
} catch (IOException e) {
logger.error("IOException:" + e.getMessage());
}
}
/**
* 取得节点信息
*
* @param path
* @return
* @throws KeeperException
* @throws InterruptedException
*/ | public ZkNode getZNode(String path) throws KeeperException, |
MyCATApache/Mycat-ConfigCenter | client/src/test/java/org/opencloudb/mycat/config/client/spring/TestCachPropertyConfigurer.java | // Path: client/src/main/java/org/opencloudb/mycat/config/client/IConfig.java
// public interface IConfig {
//
// /**
// * 根据给定的key获取属性值,并返回
// * @param key
// * @return
// */
// public String getProp(String key);
//
// /**
// * 根据给定的key获取属性值,若属性值为null,返回defaultValue
// * @param key
// * @param defaultValue
// * @return
// */
// public String getProp(String key,String defaultValue);
// }
//
// Path: client/src/main/java/org/opencloudb/mycat/config/client/ZooKeeperClient.java
// public class ZooKeeperClient implements IConfig {
//
// private static Logger logger = LoggerFactory.getLogger(ZooKeeperClient.class);
//
// private ZkClient zkClient;
//
// private String path;
//
// private String hosts;
//
// private int timeout;
//
// private DataMonitor monitor = DataMonitor.getInstance(this);
//
// public ZooKeeperClient(String hosts,int timeout,String path) {
// this.hosts = hosts;
// this.timeout = timeout;
// this.path = path;
// if(StringUtils.isEmpty(path) || !path.startsWith(PathUtil.NODE_SEPERATOR)) {
// throw new RuntimeException("路径配置有误");
// }
//
// init();
// }
//
//
// private void init() {
// // 初始化zk客户端
// initZk();
// // 初始化节点信息
// initData(this.path);
// // 初始化监听器
// register(this.path);
// }
//
// private void initZk() {
// zkClient = new ZkClient(this.hosts, this.timeout);
// }
//
// private void initData(String dataPath) {
// logger.info("初始加载数据:" + dataPath);
// ConfigMap map = ConfigMap.getInstance();
//
// if(!exists(dataPath)) {
// zkClient.create(dataPath, "", CreateMode.PERSISTENT);
// }
//
// List<String> childList = zkClient.getChildren(dataPath);
//
// // 若存在子节点,遍历子节点注册监听
// for(String child : childList) {
// String node = PathUtil.concatPath(dataPath, child);
// String value = read(node);
// map.put(node, value == null ? "":value);
// }
// logger.info("加载后的数据:" + ConfigMap.getInstance().getPropsmap());
// }
//
// // 将路径dataPath注册到监听器中
// public void register(String dataPath) {
// logger.info("注册监听:" + dataPath);
//
// if(zkClient == null) {
// initZk();
// }
//
// zkClient.subscribeDataChanges(dataPath, monitor);
//
// zkClient.subscribeChildChanges(dataPath, monitor);
//
// List<String> childList = zkClient.getChildren(dataPath);
//
// // 若存在子节点,遍历子节点注册监听
// for(String child : childList) {
// register(PathUtil.concatPath(dataPath, child));
// }
//
// }
// // 取消节点dataPath的监听
// public void unregister(String dataPath) {
// zkClient.unsubscribeChildChanges(dataPath, monitor);
// zkClient.unsubscribeDataChanges(dataPath, monitor);
// }
// // 判断节点是否存在
// public boolean exists(String dataPath) {
// return zkClient.exists(dataPath);
// }
// // 读取节点内容
// public String read(String dataPath) {
// Object obj = zkClient.readData(dataPath);
// return obj == null ? "" : obj.toString();
// }
//
// @Override
// public String getProp(String key) {
// return getProp(key,null);
// }
//
// @Override
// public String getProp(String key, String defaultValue) {
// String value = ConfigMap.getInstance().getProp(key);
// return value == null ? defaultValue:value;
// }
//
// }
| import org.I0Itec.zkclient.ZkClient;
import org.apache.zookeeper.CreateMode;
import org.junit.Before;
import org.junit.Test;
import org.opencloudb.mycat.config.client.IConfig;
import org.opencloudb.mycat.config.client.ZooKeeperClient; | package org.opencloudb.mycat.config.client.spring;
public class TestCachPropertyConfigurer {
private String hosts = "192.168.198.170:2181";
private int timeout = 30 * 1000;
| // Path: client/src/main/java/org/opencloudb/mycat/config/client/IConfig.java
// public interface IConfig {
//
// /**
// * 根据给定的key获取属性值,并返回
// * @param key
// * @return
// */
// public String getProp(String key);
//
// /**
// * 根据给定的key获取属性值,若属性值为null,返回defaultValue
// * @param key
// * @param defaultValue
// * @return
// */
// public String getProp(String key,String defaultValue);
// }
//
// Path: client/src/main/java/org/opencloudb/mycat/config/client/ZooKeeperClient.java
// public class ZooKeeperClient implements IConfig {
//
// private static Logger logger = LoggerFactory.getLogger(ZooKeeperClient.class);
//
// private ZkClient zkClient;
//
// private String path;
//
// private String hosts;
//
// private int timeout;
//
// private DataMonitor monitor = DataMonitor.getInstance(this);
//
// public ZooKeeperClient(String hosts,int timeout,String path) {
// this.hosts = hosts;
// this.timeout = timeout;
// this.path = path;
// if(StringUtils.isEmpty(path) || !path.startsWith(PathUtil.NODE_SEPERATOR)) {
// throw new RuntimeException("路径配置有误");
// }
//
// init();
// }
//
//
// private void init() {
// // 初始化zk客户端
// initZk();
// // 初始化节点信息
// initData(this.path);
// // 初始化监听器
// register(this.path);
// }
//
// private void initZk() {
// zkClient = new ZkClient(this.hosts, this.timeout);
// }
//
// private void initData(String dataPath) {
// logger.info("初始加载数据:" + dataPath);
// ConfigMap map = ConfigMap.getInstance();
//
// if(!exists(dataPath)) {
// zkClient.create(dataPath, "", CreateMode.PERSISTENT);
// }
//
// List<String> childList = zkClient.getChildren(dataPath);
//
// // 若存在子节点,遍历子节点注册监听
// for(String child : childList) {
// String node = PathUtil.concatPath(dataPath, child);
// String value = read(node);
// map.put(node, value == null ? "":value);
// }
// logger.info("加载后的数据:" + ConfigMap.getInstance().getPropsmap());
// }
//
// // 将路径dataPath注册到监听器中
// public void register(String dataPath) {
// logger.info("注册监听:" + dataPath);
//
// if(zkClient == null) {
// initZk();
// }
//
// zkClient.subscribeDataChanges(dataPath, monitor);
//
// zkClient.subscribeChildChanges(dataPath, monitor);
//
// List<String> childList = zkClient.getChildren(dataPath);
//
// // 若存在子节点,遍历子节点注册监听
// for(String child : childList) {
// register(PathUtil.concatPath(dataPath, child));
// }
//
// }
// // 取消节点dataPath的监听
// public void unregister(String dataPath) {
// zkClient.unsubscribeChildChanges(dataPath, monitor);
// zkClient.unsubscribeDataChanges(dataPath, monitor);
// }
// // 判断节点是否存在
// public boolean exists(String dataPath) {
// return zkClient.exists(dataPath);
// }
// // 读取节点内容
// public String read(String dataPath) {
// Object obj = zkClient.readData(dataPath);
// return obj == null ? "" : obj.toString();
// }
//
// @Override
// public String getProp(String key) {
// return getProp(key,null);
// }
//
// @Override
// public String getProp(String key, String defaultValue) {
// String value = ConfigMap.getInstance().getProp(key);
// return value == null ? defaultValue:value;
// }
//
// }
// Path: client/src/test/java/org/opencloudb/mycat/config/client/spring/TestCachPropertyConfigurer.java
import org.I0Itec.zkclient.ZkClient;
import org.apache.zookeeper.CreateMode;
import org.junit.Before;
import org.junit.Test;
import org.opencloudb.mycat.config.client.IConfig;
import org.opencloudb.mycat.config.client.ZooKeeperClient;
package org.opencloudb.mycat.config.client.spring;
public class TestCachPropertyConfigurer {
private String hosts = "192.168.198.170:2181";
private int timeout = 30 * 1000;
| private IConfig client; |
MyCATApache/Mycat-ConfigCenter | client/src/test/java/org/opencloudb/mycat/config/client/spring/TestCachPropertyConfigurer.java | // Path: client/src/main/java/org/opencloudb/mycat/config/client/IConfig.java
// public interface IConfig {
//
// /**
// * 根据给定的key获取属性值,并返回
// * @param key
// * @return
// */
// public String getProp(String key);
//
// /**
// * 根据给定的key获取属性值,若属性值为null,返回defaultValue
// * @param key
// * @param defaultValue
// * @return
// */
// public String getProp(String key,String defaultValue);
// }
//
// Path: client/src/main/java/org/opencloudb/mycat/config/client/ZooKeeperClient.java
// public class ZooKeeperClient implements IConfig {
//
// private static Logger logger = LoggerFactory.getLogger(ZooKeeperClient.class);
//
// private ZkClient zkClient;
//
// private String path;
//
// private String hosts;
//
// private int timeout;
//
// private DataMonitor monitor = DataMonitor.getInstance(this);
//
// public ZooKeeperClient(String hosts,int timeout,String path) {
// this.hosts = hosts;
// this.timeout = timeout;
// this.path = path;
// if(StringUtils.isEmpty(path) || !path.startsWith(PathUtil.NODE_SEPERATOR)) {
// throw new RuntimeException("路径配置有误");
// }
//
// init();
// }
//
//
// private void init() {
// // 初始化zk客户端
// initZk();
// // 初始化节点信息
// initData(this.path);
// // 初始化监听器
// register(this.path);
// }
//
// private void initZk() {
// zkClient = new ZkClient(this.hosts, this.timeout);
// }
//
// private void initData(String dataPath) {
// logger.info("初始加载数据:" + dataPath);
// ConfigMap map = ConfigMap.getInstance();
//
// if(!exists(dataPath)) {
// zkClient.create(dataPath, "", CreateMode.PERSISTENT);
// }
//
// List<String> childList = zkClient.getChildren(dataPath);
//
// // 若存在子节点,遍历子节点注册监听
// for(String child : childList) {
// String node = PathUtil.concatPath(dataPath, child);
// String value = read(node);
// map.put(node, value == null ? "":value);
// }
// logger.info("加载后的数据:" + ConfigMap.getInstance().getPropsmap());
// }
//
// // 将路径dataPath注册到监听器中
// public void register(String dataPath) {
// logger.info("注册监听:" + dataPath);
//
// if(zkClient == null) {
// initZk();
// }
//
// zkClient.subscribeDataChanges(dataPath, monitor);
//
// zkClient.subscribeChildChanges(dataPath, monitor);
//
// List<String> childList = zkClient.getChildren(dataPath);
//
// // 若存在子节点,遍历子节点注册监听
// for(String child : childList) {
// register(PathUtil.concatPath(dataPath, child));
// }
//
// }
// // 取消节点dataPath的监听
// public void unregister(String dataPath) {
// zkClient.unsubscribeChildChanges(dataPath, monitor);
// zkClient.unsubscribeDataChanges(dataPath, monitor);
// }
// // 判断节点是否存在
// public boolean exists(String dataPath) {
// return zkClient.exists(dataPath);
// }
// // 读取节点内容
// public String read(String dataPath) {
// Object obj = zkClient.readData(dataPath);
// return obj == null ? "" : obj.toString();
// }
//
// @Override
// public String getProp(String key) {
// return getProp(key,null);
// }
//
// @Override
// public String getProp(String key, String defaultValue) {
// String value = ConfigMap.getInstance().getProp(key);
// return value == null ? defaultValue:value;
// }
//
// }
| import org.I0Itec.zkclient.ZkClient;
import org.apache.zookeeper.CreateMode;
import org.junit.Before;
import org.junit.Test;
import org.opencloudb.mycat.config.client.IConfig;
import org.opencloudb.mycat.config.client.ZooKeeperClient; | package org.opencloudb.mycat.config.client.spring;
public class TestCachPropertyConfigurer {
private String hosts = "192.168.198.170:2181";
private int timeout = 30 * 1000;
private IConfig client;
private ZkClient zkClient;
private String path = "/config/testprop";
@Before
public void setUp() { | // Path: client/src/main/java/org/opencloudb/mycat/config/client/IConfig.java
// public interface IConfig {
//
// /**
// * 根据给定的key获取属性值,并返回
// * @param key
// * @return
// */
// public String getProp(String key);
//
// /**
// * 根据给定的key获取属性值,若属性值为null,返回defaultValue
// * @param key
// * @param defaultValue
// * @return
// */
// public String getProp(String key,String defaultValue);
// }
//
// Path: client/src/main/java/org/opencloudb/mycat/config/client/ZooKeeperClient.java
// public class ZooKeeperClient implements IConfig {
//
// private static Logger logger = LoggerFactory.getLogger(ZooKeeperClient.class);
//
// private ZkClient zkClient;
//
// private String path;
//
// private String hosts;
//
// private int timeout;
//
// private DataMonitor monitor = DataMonitor.getInstance(this);
//
// public ZooKeeperClient(String hosts,int timeout,String path) {
// this.hosts = hosts;
// this.timeout = timeout;
// this.path = path;
// if(StringUtils.isEmpty(path) || !path.startsWith(PathUtil.NODE_SEPERATOR)) {
// throw new RuntimeException("路径配置有误");
// }
//
// init();
// }
//
//
// private void init() {
// // 初始化zk客户端
// initZk();
// // 初始化节点信息
// initData(this.path);
// // 初始化监听器
// register(this.path);
// }
//
// private void initZk() {
// zkClient = new ZkClient(this.hosts, this.timeout);
// }
//
// private void initData(String dataPath) {
// logger.info("初始加载数据:" + dataPath);
// ConfigMap map = ConfigMap.getInstance();
//
// if(!exists(dataPath)) {
// zkClient.create(dataPath, "", CreateMode.PERSISTENT);
// }
//
// List<String> childList = zkClient.getChildren(dataPath);
//
// // 若存在子节点,遍历子节点注册监听
// for(String child : childList) {
// String node = PathUtil.concatPath(dataPath, child);
// String value = read(node);
// map.put(node, value == null ? "":value);
// }
// logger.info("加载后的数据:" + ConfigMap.getInstance().getPropsmap());
// }
//
// // 将路径dataPath注册到监听器中
// public void register(String dataPath) {
// logger.info("注册监听:" + dataPath);
//
// if(zkClient == null) {
// initZk();
// }
//
// zkClient.subscribeDataChanges(dataPath, monitor);
//
// zkClient.subscribeChildChanges(dataPath, monitor);
//
// List<String> childList = zkClient.getChildren(dataPath);
//
// // 若存在子节点,遍历子节点注册监听
// for(String child : childList) {
// register(PathUtil.concatPath(dataPath, child));
// }
//
// }
// // 取消节点dataPath的监听
// public void unregister(String dataPath) {
// zkClient.unsubscribeChildChanges(dataPath, monitor);
// zkClient.unsubscribeDataChanges(dataPath, monitor);
// }
// // 判断节点是否存在
// public boolean exists(String dataPath) {
// return zkClient.exists(dataPath);
// }
// // 读取节点内容
// public String read(String dataPath) {
// Object obj = zkClient.readData(dataPath);
// return obj == null ? "" : obj.toString();
// }
//
// @Override
// public String getProp(String key) {
// return getProp(key,null);
// }
//
// @Override
// public String getProp(String key, String defaultValue) {
// String value = ConfigMap.getInstance().getProp(key);
// return value == null ? defaultValue:value;
// }
//
// }
// Path: client/src/test/java/org/opencloudb/mycat/config/client/spring/TestCachPropertyConfigurer.java
import org.I0Itec.zkclient.ZkClient;
import org.apache.zookeeper.CreateMode;
import org.junit.Before;
import org.junit.Test;
import org.opencloudb.mycat.config.client.IConfig;
import org.opencloudb.mycat.config.client.ZooKeeperClient;
package org.opencloudb.mycat.config.client.spring;
public class TestCachPropertyConfigurer {
private String hosts = "192.168.198.170:2181";
private int timeout = 30 * 1000;
private IConfig client;
private ZkClient zkClient;
private String path = "/config/testprop";
@Before
public void setUp() { | client = new ZooKeeperClient(hosts, timeout, path); |
MyCATApache/Mycat-ConfigCenter | server/src/main/java/org/opencloudb/mycat/config/server/services/ZkClientBaseService.java | // Path: server/src/main/java/org/opencloudb/mycat/config/server/model/ZkNode.java
// public class ZkNode {
//
// // 节点ID
// private String id;
//
// // 节点名称
// private String name;
//
// // 节点路径
// private String path;
//
// // 节点内容
// private String data;
//
// // 节点状态
// private Stat stat;
//
// // 节点创建时间
// private String ctime;
//
// // 节点修改时间
// private String mtime;
//
// /**
// * @return the id
// */
// public String getId() {
// return id;
// }
//
// /**
// * @param id
// * the id to set
// */
// public void setId(String id) {
// this.id = id;
// }
//
// /**
// * @return the name
// */
// public String getName() {
// return name;
// }
//
// /**
// * @param name
// * the name to set
// */
// public void setName(String name) {
// this.name = name;
// }
//
// /**
// * @return the path
// */
// public String getPath() {
// return path;
// }
//
// /**
// * @param path
// * the path to set
// */
// public void setPath(String path) {
// this.path = path;
// }
//
// /**
// * @return the stat
// */
// public Stat getStat() {
// return stat;
// }
//
// /**
// * @param stat
// * the stat to set
// */
// public void setStat(Stat stat) {
// this.stat = stat;
// }
//
// /**
// * @return the data
// */
// public String getData() {
// return data;
// }
//
// /**
// * @param data
// * the data to set
// */
// public void setData(String data) {
// this.data = data;
// }
//
// /**
// * @return the ctime
// */
// public String getCtime() {
// return ctime;
// }
//
// /**
// * @param ctime
// * the ctime to set
// */
// public void setCtime(String ctime) {
// this.ctime = ctime;
// }
//
// /**
// * @return the mtime
// */
// public String getMtime() {
// return mtime;
// }
//
// /**
// * @param mtime
// * the mtime to set
// */
// public void setMtime(String mtime) {
// this.mtime = mtime;
// }
//
// @Override
// public String toString() {
// return ToStringBuilder.reflectionToString(this);
// }
// }
| import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Stack;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.opencloudb.mycat.config.server.model.ZkNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; | package org.opencloudb.mycat.config.server.services;
@Service
public class ZkClientBaseService {
private static Logger logger = LoggerFactory.getLogger(ZkClientBaseService.class);
private static ZooKeeper zk;
/**
* 初始化:创建连接
*/
public ZkClientBaseService() {
try {
Properties zkConfig = new Properties();
InputStream is = this.getClass().getClassLoader()
.getResourceAsStream("/zookeeper.properties");
if (is == null) {
throw new RuntimeException(
"XCache config file not found. Please make sure 'zookeeper.properties' is in in your classpath");
}
zkConfig.load(is);
String connectString = zkConfig.getProperty("connectString");
int sessionTimeout = Integer.parseInt(zkConfig
.getProperty("sessionTimeout"));
zk = new ZooKeeper(connectString, sessionTimeout, new Watcher() {
// 监控所有被触发的事件
public void process(WatchedEvent event) {
System.out.println("已经触发了" + event.getType() + "事件!");
if (event.getState() == KeeperState.Expired) {
new ZkClientBaseService();
}
}
});
} catch (Exception e) {
logger.error("zk初始化异常:",e.getMessage());
}
}
/**
* 取得节点信息
*
* @param path
* @return
* @throws KeeperException
* @throws InterruptedException
*/ | // Path: server/src/main/java/org/opencloudb/mycat/config/server/model/ZkNode.java
// public class ZkNode {
//
// // 节点ID
// private String id;
//
// // 节点名称
// private String name;
//
// // 节点路径
// private String path;
//
// // 节点内容
// private String data;
//
// // 节点状态
// private Stat stat;
//
// // 节点创建时间
// private String ctime;
//
// // 节点修改时间
// private String mtime;
//
// /**
// * @return the id
// */
// public String getId() {
// return id;
// }
//
// /**
// * @param id
// * the id to set
// */
// public void setId(String id) {
// this.id = id;
// }
//
// /**
// * @return the name
// */
// public String getName() {
// return name;
// }
//
// /**
// * @param name
// * the name to set
// */
// public void setName(String name) {
// this.name = name;
// }
//
// /**
// * @return the path
// */
// public String getPath() {
// return path;
// }
//
// /**
// * @param path
// * the path to set
// */
// public void setPath(String path) {
// this.path = path;
// }
//
// /**
// * @return the stat
// */
// public Stat getStat() {
// return stat;
// }
//
// /**
// * @param stat
// * the stat to set
// */
// public void setStat(Stat stat) {
// this.stat = stat;
// }
//
// /**
// * @return the data
// */
// public String getData() {
// return data;
// }
//
// /**
// * @param data
// * the data to set
// */
// public void setData(String data) {
// this.data = data;
// }
//
// /**
// * @return the ctime
// */
// public String getCtime() {
// return ctime;
// }
//
// /**
// * @param ctime
// * the ctime to set
// */
// public void setCtime(String ctime) {
// this.ctime = ctime;
// }
//
// /**
// * @return the mtime
// */
// public String getMtime() {
// return mtime;
// }
//
// /**
// * @param mtime
// * the mtime to set
// */
// public void setMtime(String mtime) {
// this.mtime = mtime;
// }
//
// @Override
// public String toString() {
// return ToStringBuilder.reflectionToString(this);
// }
// }
// Path: server/src/main/java/org/opencloudb/mycat/config/server/services/ZkClientBaseService.java
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Stack;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.opencloudb.mycat.config.server.model.ZkNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
package org.opencloudb.mycat.config.server.services;
@Service
public class ZkClientBaseService {
private static Logger logger = LoggerFactory.getLogger(ZkClientBaseService.class);
private static ZooKeeper zk;
/**
* 初始化:创建连接
*/
public ZkClientBaseService() {
try {
Properties zkConfig = new Properties();
InputStream is = this.getClass().getClassLoader()
.getResourceAsStream("/zookeeper.properties");
if (is == null) {
throw new RuntimeException(
"XCache config file not found. Please make sure 'zookeeper.properties' is in in your classpath");
}
zkConfig.load(is);
String connectString = zkConfig.getProperty("connectString");
int sessionTimeout = Integer.parseInt(zkConfig
.getProperty("sessionTimeout"));
zk = new ZooKeeper(connectString, sessionTimeout, new Watcher() {
// 监控所有被触发的事件
public void process(WatchedEvent event) {
System.out.println("已经触发了" + event.getType() + "事件!");
if (event.getState() == KeeperState.Expired) {
new ZkClientBaseService();
}
}
});
} catch (Exception e) {
logger.error("zk初始化异常:",e.getMessage());
}
}
/**
* 取得节点信息
*
* @param path
* @return
* @throws KeeperException
* @throws InterruptedException
*/ | public ZkNode getZNode(String path) throws KeeperException, |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/NandGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
| import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* NAND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class NandGate extends AndGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+NandGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/NandGate.java
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* NAND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class NandGate extends AndGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+NandGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/NandGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
| import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* NAND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class NandGate extends AndGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+NandGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/NandGate.java
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* NAND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class NandGate extends AndGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+NandGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/OrGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
| import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* OR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class OrGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+OrGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/OrGate.java
import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* OR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class OrGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+OrGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/OrGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
| import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* OR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class OrGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+OrGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/OrGate.java
import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* OR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class OrGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+OrGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/OrGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
| import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* OR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class OrGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+OrGate.class.getSimpleName().toLowerCase(); }
public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1);
@Override public void paint(Graphics graphics) {
super.paint(graphics);
paintLabel(graphics, "\u22651");
}
@Override public void calculate() { | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/OrGate.java
import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* OR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class OrGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+OrGate.class.getSimpleName().toLowerCase(); }
public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1);
@Override public void paint(Graphics graphics) {
super.paint(graphics);
paintLabel(graphics, "\u22651");
}
@Override public void calculate() { | for(Contact input:inputs) |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/AndGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
| import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* AND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class AndGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+AndGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/AndGate.java
import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* AND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class AndGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+AndGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/AndGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
| import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* AND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class AndGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+AndGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/AndGate.java
import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* AND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class AndGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+AndGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/AndGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
| import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* AND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class AndGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+AndGate.class.getSimpleName().toLowerCase(); }
public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1);
@Override public void paint(Graphics graphics) {
super.paint(graphics);
paintLabel(graphics, "&");
}
@Override public void calculate() { | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
//
// Path: src/main/java/lc/kra/jds/contacts/Contact.java
// public abstract class Contact implements Cloneable, Paintable, Locatable, Charged, Serializable {
// private static final long serialVersionUID = 1l;
//
// protected static final int CONTACT_SIZE = 4;
//
// protected List<Wire> wires;
//
// public Contact() { wires = new ArrayList<Wire>(); }
// public Contact(Wire wire) throws WireNotConnectable {
// this();
// this.setWire(wire);
// }
//
// public void setWire(Wire wire) throws WireNotConnectable { setWires(wire); }
// public void setWires(Wire... wires) throws WireNotConnectable { this.setWires(Arrays.asList(wires)); }
// public void setWires(List<Wire> wires) throws WireNotConnectable {
// this.wires.clear();
// for(Wire wire:wires)
// addWire(wire);
// }
// public void addWire(Wire wire) throws WireNotConnectable {
// if(!this.wires.contains(wire))
// this.wires.add(wire);
// }
// public Wire getWire() { return !isWired()?null:this.wires.get(0); }
// public List<Wire> getWires() { return this.wires; }
// public boolean isWired() { return countWires()!=0; }
// public int countWires() { return wires.size(); }
// public boolean removeWire(Wire wire) { return this.wires.remove(wire); }
// public void removeWires() { this.wires.clear(); }
//
// public abstract Component getComponent();
//
// @Override public abstract float getVoltage();
// @Override public boolean isCharged() throws ForbiddenVoltageLevel {
// float voltage = Math.abs(getVoltage());
// //everything between below 1 is 0
// return Math.floor(voltage)!=0;
// }
//
// @Override public void paint(Graphics g) {
// try { validateLocation(); }
// catch(LocationOutOfBoundsException e) {
// return; //this location does not exist for this component
// }
// Point location = getLocation();
// g.setColor(Color.BLACK);
// g.fillRect(location.x-CONTACT_SIZE/2, location.y-CONTACT_SIZE/2,
// CONTACT_SIZE, CONTACT_SIZE);
// }
//
// protected abstract void validateLocation() throws LocationOutOfBoundsException;
//
// @Override public Contact clone() throws CloneNotSupportedException {
// Contact clone = (Contact)super.clone();
// clone.wires = new ArrayList<Wire>(); //do not clone wires!
// return clone;
// }
//
// private void writeObject(ObjectOutputStream out) throws IOException {
// List<Wire> wires = this.wires;
// if(Utilities.isCopying()) //do not clone wires!
// this.wires = new ArrayList<Wire>();
// out.defaultWriteObject();
// this.wires = wires;
// }
// }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/AndGate.java
import lc.kra.jds.contacts.Contact;
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* AND-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class AndGate extends AbstractGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+AndGate.class.getSimpleName().toLowerCase(); }
public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1);
@Override public void paint(Graphics graphics) {
super.paint(graphics);
paintLabel(graphics, "&");
}
@Override public void calculate() { | for(Contact input:inputs) |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/contacts/Charged.java | // Path: src/main/java/lc/kra/jds/exceptions/ForbiddenVoltageLevel.java
// public class ForbiddenVoltageLevel extends RuntimeException {
// private static final long serialVersionUID = -1672766943560975795L;
// public ForbiddenVoltageLevel(float voltage) { this(voltage, null); }
// public ForbiddenVoltageLevel(float voltage, float[] level) {
// super(getMessage(voltage, level));
// }
// private static String getMessage(float voltage, float[] level) {
// StringBuilder message = new StringBuilder("The voltage level of "+voltage+" is not permitted in this context.");
// if(level!=null)
// if(level.length<=4) //allowed voltage level
// message.append(" (The allowed voltage level is between ").append(level[0]).append(" and ").append(level[1])
// .append("and between ").append(level[2]).append(" and ").append(level[3])
// .append(')');
// else if(level.length<=2) //forbidden voltage level
// message.append(" (The forbbidden voltage level is between ").append(level[0]).append(" and ").append(level[1])
// .append(')');
// return message.toString();
// }
// }
| import lc.kra.jds.exceptions.ForbiddenVoltageLevel; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.contacts;
public interface Charged {
public float getVoltage();
| // Path: src/main/java/lc/kra/jds/exceptions/ForbiddenVoltageLevel.java
// public class ForbiddenVoltageLevel extends RuntimeException {
// private static final long serialVersionUID = -1672766943560975795L;
// public ForbiddenVoltageLevel(float voltage) { this(voltage, null); }
// public ForbiddenVoltageLevel(float voltage, float[] level) {
// super(getMessage(voltage, level));
// }
// private static String getMessage(float voltage, float[] level) {
// StringBuilder message = new StringBuilder("The voltage level of "+voltage+" is not permitted in this context.");
// if(level!=null)
// if(level.length<=4) //allowed voltage level
// message.append(" (The allowed voltage level is between ").append(level[0]).append(" and ").append(level[1])
// .append("and between ").append(level[2]).append(" and ").append(level[3])
// .append(')');
// else if(level.length<=2) //forbidden voltage level
// message.append(" (The forbbidden voltage level is between ").append(level[0]).append(" and ").append(level[1])
// .append(')');
// return message.toString();
// }
// }
// Path: src/main/java/lc/kra/jds/contacts/Charged.java
import lc.kra.jds.exceptions.ForbiddenVoltageLevel;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.contacts;
public interface Charged {
public float getVoltage();
| public boolean isCharged() throws ForbiddenVoltageLevel; |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/NorGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
| import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* NOR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class NorGate extends OrGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+NorGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/NorGate.java
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* NOR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class NorGate extends OrGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+NorGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/NorGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
| import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* NOR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class NorGate extends OrGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+NorGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/NorGate.java
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* NOR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class NorGate extends OrGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+NorGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/XnorGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
| import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* XNOR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class XnorGate extends XorGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+XnorGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/XnorGate.java
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* XNOR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class XnorGate extends XorGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+XnorGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
kristian/JDigitalSimulator | src/main/java/lc/kra/jds/components/buildin/gate/XnorGate.java | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
| import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType; | /*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* XNOR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class XnorGate extends XorGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+XnorGate.class.getSimpleName().toLowerCase(); } | // Path: src/main/java/lc/kra/jds/Utilities.java
// public static String getTranslation(String key) { return getTranslation(key, TranslationType.TEXT); }
//
// Path: src/main/java/lc/kra/jds/Utilities.java
// public static enum TranslationType { TEXT, ALTERNATIVE, TITLE, EXTERNAL, TOOLTIP, DESCRIPTION; }
// Path: src/main/java/lc/kra/jds/components/buildin/gate/XnorGate.java
import static lc.kra.jds.Utilities.getTranslation;
import java.awt.Graphics;
import lc.kra.jds.Utilities.TranslationType;
/*
* JDigitalSimulator
* Copyright (C) 2017 Kristian Kraljic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package lc.kra.jds.components.buildin.gate;
/**
* XNOR-Gate (build-in component)
* @author Kristian Kraljic ([email protected])
*/
public class XnorGate extends XorGate {
private static final long serialVersionUID = 2l;
private static final String KEY;
static { KEY = "component.gate."+XnorGate.class.getSimpleName().toLowerCase(); } | public static final ComponentAttributes componentAttributes = new ComponentAttributes(KEY, getTranslation(KEY), "group.gate", getTranslation(KEY, TranslationType.DESCRIPTION), "Kristian Kraljic ([email protected])", 1); |
winzillion/FluxJava | demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
| // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
| public StubTodoStore(final IFluxBus inBus) { |
winzillion/FluxJava | demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override | protected <TAction extends IFluxAction> void onAction(TAction inAction) { |
winzillion/FluxJava | demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | if (((TodoAction)inAction).getType() == TODO_LOAD) { |
winzillion/FluxJava | demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | if (((TodoAction)inAction).getType() == TODO_LOAD) { |
winzillion/FluxJava | demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction);
if (((TodoAction)inAction).getType() == TODO_LOAD) {
for (int i = 0; i < (4 + this.mLoadCount); i++) { | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction);
if (((TodoAction)inAction).getType() == TODO_LOAD) {
for (int i = 0; i < (4 + this.mLoadCount); i++) { | Todo todo = new Todo(i); |
winzillion/FluxJava | demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubUserStore.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
| import com.example.fluxjava.rx2.domain.models.User;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
// Path: demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubUserStore.java
import com.example.fluxjava.rx2.domain.models.User;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override | protected <TAction extends IFluxAction> void onAction(TAction inAction) { |
winzillion/FluxJava | demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubUserStore.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
| import com.example.fluxjava.rx2.domain.models.User;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
// Path: demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/stores/StubUserStore.java
import com.example.fluxjava.rx2.domain.models.User;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | super.mList.add(new User("User1")); |
winzillion/FluxJava | demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/StubActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
| import com.example.fluxjava.rx2.domain.models.Todo;
import java.util.ArrayList; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class StubActionHelper extends ActionHelper {
@Override
public Object wrapData(final Object inData) {
Object result = inData;
if (inData instanceof Integer) {
result = new ArrayList<>();
}
if (inData instanceof String) {
result = new ArrayList<>();
} | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
// Path: demo-rx2/src/sharedTest/java/com/example/fluxjava/rx2/domain/StubActionHelper.java
import com.example.fluxjava.rx2.domain.models.Todo;
import java.util.ArrayList;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class StubActionHelper extends ActionHelper {
@Override
public Object wrapData(final Object inData) {
Object result = inData;
if (inData instanceof Integer) {
result = new ArrayList<>();
}
if (inData instanceof String) {
result = new ArrayList<>();
} | if (inData instanceof Todo) { |
winzillion/FluxJava | demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/StubActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
| import com.example.fluxjava.rx.domain.models.Todo;
import java.util.ArrayList; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class StubActionHelper extends ActionHelper {
@Override
public Object wrapData(final Object inData) {
Object result = inData;
if (inData instanceof Integer) {
result = new ArrayList<>();
}
if (inData instanceof String) {
result = new ArrayList<>();
} | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
// Path: demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/StubActionHelper.java
import com.example.fluxjava.rx.domain.models.Todo;
import java.util.ArrayList;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class StubActionHelper extends ActionHelper {
@Override
public Object wrapData(final Object inData) {
Object result = inData;
if (inData instanceof Integer) {
result = new ArrayList<>();
}
if (inData instanceof String) {
result = new ArrayList<>();
} | if (inData instanceof Todo) { |
winzillion/FluxJava | demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubUserStore.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
| import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IFluxBus; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
// Path: demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubUserStore.java
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IFluxBus;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override | public void onAction(UserAction inAction) { |
winzillion/FluxJava | demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubUserStore.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
| import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IFluxBus; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override
public void onAction(UserAction inAction) {
super.onAction(inAction); | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
// Path: demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubUserStore.java
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IFluxBus;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override
public void onAction(UserAction inAction) {
super.onAction(inAction); | super.mList.add(new User("User1")); |
winzillion/FluxJava | demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
| // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
| public StubTodoStore(final IFluxBus inBus) { |
winzillion/FluxJava | demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override | protected <TAction extends IFluxAction> void onAction(TAction inAction) { |
winzillion/FluxJava | demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | if (((TodoAction)inAction).getType() == TODO_LOAD) { |
winzillion/FluxJava | demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | if (((TodoAction)inAction).getType() == TODO_LOAD) { |
winzillion/FluxJava | demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction);
if (((TodoAction)inAction).getType() == TODO_LOAD) {
for (int i = 0; i < (4 + this.mLoadCount); i++) { | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubTodoStore.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction);
if (((TodoAction)inAction).getType() == TODO_LOAD) {
for (int i = 0; i < (4 + this.mLoadCount); i++) { | Todo todo = new Todo(i); |
winzillion/FluxJava | demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) { | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) { | case USER_LOAD: |
winzillion/FluxJava | demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD: | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD: | result = UserAction.class; |
winzillion/FluxJava | demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break; | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break; | case TODO_LOAD: |
winzillion/FluxJava | demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD: | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD: | case TODO_ADD: |
winzillion/FluxJava | demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD: | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD: | case TODO_CLOSE: |
winzillion/FluxJava | demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE: | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE: | result = TodoAction.class; |
winzillion/FluxJava | demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD; | result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE:
result = TodoAction.class;
break;
}
}
return result;
}
@Override
public Object wrapData(final Object inData) {
Object result = inData;
// base on data type to convert data into require form
if (inData instanceof Integer) {
result = this.getRemoteData((int)inData, -1);
}
if (inData instanceof String) {
final String[] command = ((String)inData).split(":");
final int action;
final int position;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
} | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD;
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE:
result = TodoAction.class;
break;
}
}
return result;
}
@Override
public Object wrapData(final Object inData) {
Object result = inData;
// base on data type to convert data into require form
if (inData instanceof Integer) {
result = this.getRemoteData((int)inData, -1);
}
if (inData instanceof String) {
final String[] command = ((String)inData).split(":");
final int action;
final int position;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
} | if (inData instanceof Todo) { |
winzillion/FluxJava | demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD; | action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
}
if (inData instanceof Todo) {
final ArrayList<Todo> todoList = new ArrayList<>();
this.updateRemoteTodo();
todoList.add((Todo)inData);
result = todoList;
}
return result;
}
private Object getRemoteData(final int inAction, final int inPosition) {
Object result = null;
switch (inAction) {
case USER_LOAD:
result = this.getRemoteUser();
break;
case TODO_LOAD:
result = this.getRemoteTodo(inPosition);
break;
}
return result;
}
| // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/ActionHelper.java
import com.example.fluxjava.rx.domain.actions.TodoAction;
import com.example.fluxjava.rx.domain.actions.UserAction;
import com.example.fluxjava.rx.domain.models.Todo;
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.rx.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx.domain.Constants.USER_LOAD;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
}
if (inData instanceof Todo) {
final ArrayList<Todo> todoList = new ArrayList<>();
this.updateRemoteTodo();
todoList.add((Todo)inData);
result = todoList;
}
return result;
}
private Object getRemoteData(final int inAction, final int inPosition) {
Object result = null;
switch (inAction) {
case USER_LOAD:
result = this.getRemoteUser();
break;
case TODO_LOAD:
result = this.getRemoteTodo(inPosition);
break;
}
return result;
}
| private ArrayList<User> getRemoteUser() { |
winzillion/FluxJava | demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) { | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) { | case USER_LOAD: |
winzillion/FluxJava | demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD: | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD: | result = UserAction.class; |
winzillion/FluxJava | demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break; | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break; | case TODO_LOAD: |
winzillion/FluxJava | demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD: | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD: | case TODO_ADD: |
winzillion/FluxJava | demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD: | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD: | case TODO_CLOSE: |
winzillion/FluxJava | demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE: | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE: | result = TodoAction.class; |
winzillion/FluxJava | demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD; | result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE:
result = TodoAction.class;
break;
}
}
return result;
}
@Override
public Object wrapData(final Object inData) {
Object result = inData;
// base on data type to convert data into require form
if (inData instanceof Integer) {
result = this.getRemoteData((int)inData, -1);
}
if (inData instanceof String) {
final String[] command = ((String)inData).split(":");
final int action;
final int position;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
} | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD;
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE:
result = TodoAction.class;
break;
}
}
return result;
}
@Override
public Object wrapData(final Object inData) {
Object result = inData;
// base on data type to convert data into require form
if (inData instanceof Integer) {
result = this.getRemoteData((int)inData, -1);
}
if (inData instanceof String) {
final String[] command = ((String)inData).split(":");
final int action;
final int position;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
} | if (inData instanceof Todo) { |
winzillion/FluxJava | demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD; | action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
}
if (inData instanceof Todo) {
final ArrayList<Todo> todoList = new ArrayList<>();
this.updateRemoteTodo();
todoList.add((Todo)inData);
result = todoList;
}
return result;
}
private Object getRemoteData(final int inAction, final int inPosition) {
Object result = null;
switch (inAction) {
case USER_LOAD:
result = this.getRemoteUser();
break;
case TODO_LOAD:
result = this.getRemoteTodo(inPosition);
break;
}
return result;
}
| // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/ActionHelper.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.actions.UserAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import com.example.fluxjava.eventbus.domain.models.User;
import io.wzcodes.fluxjava.IActionHelper;
import java.util.ArrayList;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_ADD;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.eventbus.domain.Constants.USER_LOAD;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
}
if (inData instanceof Todo) {
final ArrayList<Todo> todoList = new ArrayList<>();
this.updateRemoteTodo();
todoList.add((Todo)inData);
result = todoList;
}
return result;
}
private Object getRemoteData(final int inAction, final int inPosition) {
Object result = null;
switch (inAction) {
case USER_LOAD:
result = this.getRemoteUser();
break;
case TODO_LOAD:
result = this.getRemoteTodo(inPosition);
break;
}
return result;
}
| private ArrayList<User> getRemoteUser() { |
winzillion/FluxJava | demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubTodoStore.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
| // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubTodoStore.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
| public StubTodoStore(final IFluxBus inBus) { |
winzillion/FluxJava | demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubTodoStore.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubTodoStore.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override | public void onAction(TodoAction inAction) { |
winzillion/FluxJava | demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubTodoStore.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
public void onAction(TodoAction inAction) {
super.onAction(inAction); | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubTodoStore.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
public void onAction(TodoAction inAction) {
super.onAction(inAction); | if (inAction.getType() == TODO_LOAD) { |
winzillion/FluxJava | demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubTodoStore.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
| import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
public void onAction(TodoAction inAction) {
super.onAction(inAction);
if (inAction.getType() == TODO_LOAD) {
for (int i = 0; i < (4 + this.mLoadCount); i++) { | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
//
// Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
// Path: demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/stores/StubTodoStore.java
import com.example.fluxjava.eventbus.domain.actions.TodoAction;
import com.example.fluxjava.eventbus.domain.models.Todo;
import io.wzcodes.fluxjava.IFluxBus;
import static com.example.fluxjava.eventbus.domain.Constants.TODO_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain.stores;
public class StubTodoStore extends TodoStore {
private int mLoadCount = 0;
public StubTodoStore(final IFluxBus inBus) {
super(inBus);
}
@Override
public void onAction(TodoAction inAction) {
super.onAction(inAction);
if (inAction.getType() == TODO_LOAD) {
for (int i = 0; i < (4 + this.mLoadCount); i++) { | Todo todo = new Todo(i); |
winzillion/FluxJava | demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) { | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) { | case USER_LOAD: |
winzillion/FluxJava | demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD: | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD: | result = UserAction.class; |
winzillion/FluxJava | demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break; | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break; | case TODO_LOAD: |
winzillion/FluxJava | demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD: | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD: | case TODO_ADD: |
winzillion/FluxJava | demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD: | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD: | case TODO_CLOSE: |
winzillion/FluxJava | demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE: | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx2.domain;
public class ActionHelper implements IActionHelper {
@Override
public Class<?> getActionClass(final Object inActionTypeId) {
Class<?> result = null;
if (inActionTypeId instanceof Integer) {
final int typeId = (int)inActionTypeId;
// return action type by pre-define id
switch (typeId) {
case USER_LOAD:
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE: | result = TodoAction.class; |
winzillion/FluxJava | demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD; | result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE:
result = TodoAction.class;
break;
}
}
return result;
}
@Override
public Object wrapData(final Object inData) {
Object result = inData;
// base on data type to convert data into require form
if (inData instanceof Integer) {
result = this.getRemoteData((int)inData, -1);
}
if (inData instanceof String) {
final String[] command = ((String)inData).split(":");
final int action;
final int position;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
} | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD;
result = UserAction.class;
break;
case TODO_LOAD:
case TODO_ADD:
case TODO_CLOSE:
result = TodoAction.class;
break;
}
}
return result;
}
@Override
public Object wrapData(final Object inData) {
Object result = inData;
// base on data type to convert data into require form
if (inData instanceof Integer) {
result = this.getRemoteData((int)inData, -1);
}
if (inData instanceof String) {
final String[] command = ((String)inData).split(":");
final int action;
final int position;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
} | if (inData instanceof Todo) { |
winzillion/FluxJava | demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java | // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
| import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD; | action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
}
if (inData instanceof Todo) {
final ArrayList<Todo> todoList = new ArrayList<>();
this.updateRemoteTodo();
todoList.add((Todo)inData);
result = todoList;
}
return result;
}
private Object getRemoteData(final int inAction, final int inPosition) {
Object result = null;
switch (inAction) {
case USER_LOAD:
result = this.getRemoteUser();
break;
case TODO_LOAD:
result = this.getRemoteTodo(inPosition);
break;
}
return result;
}
| // Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/TodoAction.java
// public class TodoAction extends FluxAction<Integer, List<Todo>> {
//
// public TodoAction(final Integer inType, final List<Todo> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/actions/UserAction.java
// public class UserAction extends FluxAction<Integer, List<User>> {
//
// public UserAction(final Integer inType, final List<User> inData) {
// super(inType, inData);
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IActionHelper.java
// public interface IActionHelper {
//
// /**
// * Get a type of Action from type identity.
// *
// * @param inActionTypeId The type identity of Action.
// * @since 2016/7/5
// */
// Class<?> getActionClass(final Object inActionTypeId);
//
// /**
// * Wrap the data format from display to storage.
// *
// * @param inData The data need to be wrapped.
// * @since 2016/7/5
// */
// Object wrapData(final Object inData);
//
// }
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_ADD = DATA_TODO + 2;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_CLOSE = DATA_TODO + 3;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int TODO_LOAD = DATA_TODO + 1;
//
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/Constants.java
// public static final int USER_LOAD = DATA_USER + 1;
// Path: demo-rx2/src/main/java/com/example/fluxjava/rx2/domain/ActionHelper.java
import com.example.fluxjava.rx2.domain.actions.TodoAction;
import com.example.fluxjava.rx2.domain.actions.UserAction;
import com.example.fluxjava.rx2.domain.models.Todo;
import com.example.fluxjava.rx2.domain.models.User;
import java.util.ArrayList;
import io.wzcodes.fluxjava.IActionHelper;
import static com.example.fluxjava.rx2.domain.Constants.TODO_ADD;
import static com.example.fluxjava.rx2.domain.Constants.TODO_CLOSE;
import static com.example.fluxjava.rx2.domain.Constants.TODO_LOAD;
import static com.example.fluxjava.rx2.domain.Constants.USER_LOAD;
action = Integer.valueOf(command[0]);
position = Integer.valueOf(command[1]);
result = this.getRemoteData(action, position);
}
if (inData instanceof Todo) {
final ArrayList<Todo> todoList = new ArrayList<>();
this.updateRemoteTodo();
todoList.add((Todo)inData);
result = todoList;
}
return result;
}
private Object getRemoteData(final int inAction, final int inPosition) {
Object result = null;
switch (inAction) {
case USER_LOAD:
result = this.getRemoteUser();
break;
case TODO_LOAD:
result = this.getRemoteTodo(inPosition);
break;
}
return result;
}
| private ArrayList<User> getRemoteUser() { |
winzillion/FluxJava | demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/StubActionHelper.java | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
| import com.example.fluxjava.eventbus.domain.models.Todo;
import java.util.ArrayList; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class StubActionHelper extends ActionHelper {
@Override
public Object wrapData(final Object inData) {
Object result = inData;
if (inData instanceof Integer) {
result = new ArrayList<>();
}
if (inData instanceof String) {
result = new ArrayList<>();
} | // Path: demo-eventbus/src/main/java/com/example/fluxjava/eventbus/domain/models/Todo.java
// public class Todo {
//
// public int id;
// public String title;
// public String dueDate;
// public String memo;
// public boolean closed;
//
// public Todo() {}
//
// public Todo(final int inId) {
// id = inId;
// }
//
// public Todo(final Todo inClone) {
// this.id = inClone.id;
// this.title = inClone.title;
// this.dueDate = inClone.dueDate;
// this.memo = inClone.memo;
// this.closed = inClone.closed;
// }
//
// }
// Path: demo-eventbus/src/sharedTest/java/com/example/fluxjava/eventbus/domain/StubActionHelper.java
import com.example.fluxjava.eventbus.domain.models.Todo;
import java.util.ArrayList;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.eventbus.domain;
public class StubActionHelper extends ActionHelper {
@Override
public Object wrapData(final Object inData) {
Object result = inData;
if (inData instanceof Integer) {
result = new ArrayList<>();
}
if (inData instanceof String) {
result = new ArrayList<>();
} | if (inData instanceof Todo) { |
winzillion/FluxJava | demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubUserStore.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
| import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
// Path: demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubUserStore.java
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override | protected <TAction extends IFluxAction> void onAction(TAction inAction) { |
winzillion/FluxJava | demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubUserStore.java | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
| import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus; | /*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | // Path: demo-rx/src/main/java/com/example/fluxjava/rx/domain/models/User.java
// public class User {
//
// public String name;
//
// public User() {}
//
// public User(final String inName) {
// name = inName;
// }
//
// public User(final User inClone) {
// this.name = inClone.name;
// }
//
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxAction.java
// public interface IFluxAction {
// }
//
// Path: fluxjava/src/main/java/io/wzcodes/fluxjava/IFluxBus.java
// public interface IFluxBus {
//
// /**
// * Register to bus.
// *
// * @param inSubscriber The subscriber to add into bus.
// * @since 2016/7/5
// */
// void register(final Object inSubscriber);
//
// /**
// * Unregister from bus.
// *
// * @param inSubscriber The subscriber remove from bus.
// * @since 2016/7/5
// */
// void unregister(final Object inSubscriber);
//
// /**
// * Send a message to all subscribers.
// *
// * @param inEvent The message need to be sent.
// * @since 2016/7/5
// */
// void post(final Object inEvent);
//
// }
// Path: demo-rx/src/sharedTest/java/com/example/fluxjava/rx/domain/stores/StubUserStore.java
import com.example.fluxjava.rx.domain.models.User;
import io.wzcodes.fluxjava.IFluxAction;
import io.wzcodes.fluxjava.IFluxBus;
/*
* Copyright (C) 2016 Bugs will find a way (https://wznote.blogspot.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.
*/
package com.example.fluxjava.rx.domain.stores;
public class StubUserStore extends UserStore {
public StubUserStore(IFluxBus inBus) {
super(inBus);
}
@Override
protected <TAction extends IFluxAction> void onAction(TAction inAction) {
super.onAction(inAction); | super.mList.add(new User("User1")); |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionActivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.serialization.messages;
/**
* A request to activate a subscription for a specified user and product
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionActivateRequest extends SubscriptionRequest {
private Integer numberOfLicenses;
@Override | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionActivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.serialization.messages;
/**
* A request to activate a subscription for a specified user and product
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionActivateRequest extends SubscriptionRequest {
private Integer numberOfLicenses;
@Override | public SubscriptionActivateRequest setOperation(InstantAccessOperationValue operationValue) { |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v3/servlets/InstantAccessServletTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/signature/Request.java
// public enum Method {
// POST,
// GET
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
| import java.util.Vector;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.signature.*;
import com.amazon.dtasdk.signature.Request.Method;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import junit.framework.Assert;
import org.easymock.EasyMock;
import org.junit.Test;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* Test class for InstantAccessServlet.
*/
public class InstantAccessServletTest {
private static final String RESPONSE = "OK";
private class InstantAccessServletImpl extends InstantAccessServlet {
private final CredentialStore store;
public InstantAccessServletImpl(CredentialStore store) {
this.store = store;
}
@Override
public CredentialStore getCredentialStore() {
return store;
}
@Override | // Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/signature/Request.java
// public enum Method {
// POST,
// GET
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v3/servlets/InstantAccessServletTest.java
import java.util.Vector;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.signature.*;
import com.amazon.dtasdk.signature.Request.Method;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import junit.framework.Assert;
import org.easymock.EasyMock;
import org.junit.Test;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* Test class for InstantAccessServlet.
*/
public class InstantAccessServletTest {
private static final String RESPONSE = "OK";
private class InstantAccessServletImpl extends InstantAccessServlet {
private final CredentialStore store;
public InstantAccessServletImpl(CredentialStore store) {
this.store = store;
}
@Override
public CredentialStore getCredentialStore() {
return store;
}
@Override | public InstantAccessResponse<?> processOperation(InstantAccessOperationValue instantAccessOperationValue, |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v3/servlets/InstantAccessServletTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/signature/Request.java
// public enum Method {
// POST,
// GET
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
| import java.util.Vector;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.signature.*;
import com.amazon.dtasdk.signature.Request.Method;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import junit.framework.Assert;
import org.easymock.EasyMock;
import org.junit.Test;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* Test class for InstantAccessServlet.
*/
public class InstantAccessServletTest {
private static final String RESPONSE = "OK";
private class InstantAccessServletImpl extends InstantAccessServlet {
private final CredentialStore store;
public InstantAccessServletImpl(CredentialStore store) {
this.store = store;
}
@Override
public CredentialStore getCredentialStore() {
return store;
}
@Override | // Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/signature/Request.java
// public enum Method {
// POST,
// GET
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v3/servlets/InstantAccessServletTest.java
import java.util.Vector;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.signature.*;
import com.amazon.dtasdk.signature.Request.Method;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import junit.framework.Assert;
import org.easymock.EasyMock;
import org.junit.Test;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* Test class for InstantAccessServlet.
*/
public class InstantAccessServletTest {
private static final String RESPONSE = "OK";
private class InstantAccessServletImpl extends InstantAccessServlet {
private final CredentialStore store;
public InstantAccessServletImpl(CredentialStore store) {
this.store = store;
}
@Override
public CredentialStore getCredentialStore() {
return store;
}
@Override | public InstantAccessResponse<?> processOperation(InstantAccessOperationValue instantAccessOperationValue, |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v3/servlets/InstantAccessServletTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/signature/Request.java
// public enum Method {
// POST,
// GET
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
| import java.util.Vector;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.signature.*;
import com.amazon.dtasdk.signature.Request.Method;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import junit.framework.Assert;
import org.easymock.EasyMock;
import org.junit.Test;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* Test class for InstantAccessServlet.
*/
public class InstantAccessServletTest {
private static final String RESPONSE = "OK";
private class InstantAccessServletImpl extends InstantAccessServlet {
private final CredentialStore store;
public InstantAccessServletImpl(CredentialStore store) {
this.store = store;
}
@Override
public CredentialStore getCredentialStore() {
return store;
}
@Override
public InstantAccessResponse<?> processOperation(InstantAccessOperationValue instantAccessOperationValue, | // Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/signature/Request.java
// public enum Method {
// POST,
// GET
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v3/servlets/InstantAccessServletTest.java
import java.util.Vector;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.signature.*;
import com.amazon.dtasdk.signature.Request.Method;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import junit.framework.Assert;
import org.easymock.EasyMock;
import org.junit.Test;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* Test class for InstantAccessServlet.
*/
public class InstantAccessServletTest {
private static final String RESPONSE = "OK";
private class InstantAccessServletImpl extends InstantAccessServlet {
private final CredentialStore store;
public InstantAccessServletImpl(CredentialStore store) {
this.store = store;
}
@Override
public CredentialStore getCredentialStore() {
return store;
}
@Override
public InstantAccessResponse<?> processOperation(InstantAccessOperationValue instantAccessOperationValue, | String requestBody) throws SerializationException { |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v3/servlets/InstantAccessServletTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/signature/Request.java
// public enum Method {
// POST,
// GET
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
| import java.util.Vector;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.signature.*;
import com.amazon.dtasdk.signature.Request.Method;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import junit.framework.Assert;
import org.easymock.EasyMock;
import org.junit.Test;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException; | EasyMock.verify(request, response);
}
@Test
public void testDoPostEmptyCredentialStore() throws SigningException, IOException {
HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
HttpServletResponse response = EasyMock.createMock(HttpServletResponse.class);
Credential credential = new Credential("SECRETKEY", "KEYID");
InstantAccessServlet servlet = new InstantAccessServletImpl(new CredentialStore());
// @formatter:off
String bodyContent = "{}";
// @formatter:on
mockRequest(request, bodyContent, credential);
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
EasyMock.replay(request, response);
servlet.doPost(request, response);
EasyMock.verify(request, response);
}
protected void mockRequest(HttpServletRequest request, final String bodyContent, Credential credential)
throws IOException, SigningException {
Signer signer = new Signer(); | // Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/signature/Request.java
// public enum Method {
// POST,
// GET
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v3/servlets/InstantAccessServletTest.java
import java.util.Vector;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.signature.*;
import com.amazon.dtasdk.signature.Request.Method;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import junit.framework.Assert;
import org.easymock.EasyMock;
import org.junit.Test;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
EasyMock.verify(request, response);
}
@Test
public void testDoPostEmptyCredentialStore() throws SigningException, IOException {
HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
HttpServletResponse response = EasyMock.createMock(HttpServletResponse.class);
Credential credential = new Credential("SECRETKEY", "KEYID");
InstantAccessServlet servlet = new InstantAccessServletImpl(new CredentialStore());
// @formatter:off
String bodyContent = "{}";
// @formatter:on
mockRequest(request, bodyContent, credential);
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
EasyMock.replay(request, response);
servlet.doPost(request, response);
EasyMock.verify(request, response);
}
protected void mockRequest(HttpServletRequest request, final String bodyContent, Credential credential)
throws IOException, SigningException {
Signer signer = new Signer(); | final Request req = new Request("https://amazon.com:8443/", Method.POST, "application/json"); |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionDeactivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
| // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionDeactivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
| protected SubscriptionReasonValue reason; |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionDeactivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
protected SubscriptionReasonValue reason; | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionDeactivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
protected SubscriptionReasonValue reason; | protected SubscriptionPeriodValue period; |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionDeactivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
protected SubscriptionReasonValue reason;
protected SubscriptionPeriodValue period;
@Override | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionDeactivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
protected SubscriptionReasonValue reason;
protected SubscriptionPeriodValue period;
@Override | public SubscriptionDeactivateRequest setOperation(InstantAccessOperationValue operationValue) { |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/servlets/AccountLinkingServlet.java | // Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableResponse.java
// public class GetUserIdSerializableResponse extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableResponse {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableResponse;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import com.amazon.dtasdk.serializer.SerializationException; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* <p>
* This abstract servlet can be extended to implement the V3 Account Linking section of Instant Access API.
* </p>
*
* <p>
* When extending this servlet, you must implement the abstract method {@link #getUserId( GetUserIdSerializableRequest )},
* it is the method for returning a user id based on the parameters in order to link accounts.
* </p>
*
* <p>
* You must also implement the abstract method {@link #getCredentialStore()}. This method must provide a valid credential
* store that will be used to verify the message authenticity.
* </p>
*
*/
public abstract class AccountLinkingServlet extends InstantAccessServlet {
/**
* Process the request and returns the user id
*
* @param request
* the request relative to the get user id operation
*
* @return a GetUserIdSerializableResponse object
*/
public abstract GetUserIdSerializableResponse getUserId(GetUserIdSerializableRequest request);
@Override | // Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableResponse.java
// public class GetUserIdSerializableResponse extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableResponse {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/servlets/AccountLinkingServlet.java
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableResponse;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import com.amazon.dtasdk.serializer.SerializationException;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* <p>
* This abstract servlet can be extended to implement the V3 Account Linking section of Instant Access API.
* </p>
*
* <p>
* When extending this servlet, you must implement the abstract method {@link #getUserId( GetUserIdSerializableRequest )},
* it is the method for returning a user id based on the parameters in order to link accounts.
* </p>
*
* <p>
* You must also implement the abstract method {@link #getCredentialStore()}. This method must provide a valid credential
* store that will be used to verify the message authenticity.
* </p>
*
*/
public abstract class AccountLinkingServlet extends InstantAccessServlet {
/**
* Process the request and returns the user id
*
* @param request
* the request relative to the get user id operation
*
* @return a GetUserIdSerializableResponse object
*/
public abstract GetUserIdSerializableResponse getUserId(GetUserIdSerializableRequest request);
@Override | public InstantAccessResponse<?> processOperation(InstantAccessOperationValue operation, String requestBody) |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/servlets/AccountLinkingServlet.java | // Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableResponse.java
// public class GetUserIdSerializableResponse extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableResponse {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableResponse;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import com.amazon.dtasdk.serializer.SerializationException; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* <p>
* This abstract servlet can be extended to implement the V3 Account Linking section of Instant Access API.
* </p>
*
* <p>
* When extending this servlet, you must implement the abstract method {@link #getUserId( GetUserIdSerializableRequest )},
* it is the method for returning a user id based on the parameters in order to link accounts.
* </p>
*
* <p>
* You must also implement the abstract method {@link #getCredentialStore()}. This method must provide a valid credential
* store that will be used to verify the message authenticity.
* </p>
*
*/
public abstract class AccountLinkingServlet extends InstantAccessServlet {
/**
* Process the request and returns the user id
*
* @param request
* the request relative to the get user id operation
*
* @return a GetUserIdSerializableResponse object
*/
public abstract GetUserIdSerializableResponse getUserId(GetUserIdSerializableRequest request);
@Override | // Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableResponse.java
// public class GetUserIdSerializableResponse extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableResponse {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/servlets/AccountLinkingServlet.java
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableResponse;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import com.amazon.dtasdk.serializer.SerializationException;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* <p>
* This abstract servlet can be extended to implement the V3 Account Linking section of Instant Access API.
* </p>
*
* <p>
* When extending this servlet, you must implement the abstract method {@link #getUserId( GetUserIdSerializableRequest )},
* it is the method for returning a user id based on the parameters in order to link accounts.
* </p>
*
* <p>
* You must also implement the abstract method {@link #getCredentialStore()}. This method must provide a valid credential
* store that will be used to verify the message authenticity.
* </p>
*
*/
public abstract class AccountLinkingServlet extends InstantAccessServlet {
/**
* Process the request and returns the user id
*
* @param request
* the request relative to the get user id operation
*
* @return a GetUserIdSerializableResponse object
*/
public abstract GetUserIdSerializableResponse getUserId(GetUserIdSerializableRequest request);
@Override | public InstantAccessResponse<?> processOperation(InstantAccessOperationValue operation, String requestBody) |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/servlets/AccountLinkingServlet.java | // Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableResponse.java
// public class GetUserIdSerializableResponse extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableResponse {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableResponse;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import com.amazon.dtasdk.serializer.SerializationException; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* <p>
* This abstract servlet can be extended to implement the V3 Account Linking section of Instant Access API.
* </p>
*
* <p>
* When extending this servlet, you must implement the abstract method {@link #getUserId( GetUserIdSerializableRequest )},
* it is the method for returning a user id based on the parameters in order to link accounts.
* </p>
*
* <p>
* You must also implement the abstract method {@link #getCredentialStore()}. This method must provide a valid credential
* store that will be used to verify the message authenticity.
* </p>
*
*/
public abstract class AccountLinkingServlet extends InstantAccessServlet {
/**
* Process the request and returns the user id
*
* @param request
* the request relative to the get user id operation
*
* @return a GetUserIdSerializableResponse object
*/
public abstract GetUserIdSerializableResponse getUserId(GetUserIdSerializableRequest request);
@Override
public InstantAccessResponse<?> processOperation(InstantAccessOperationValue operation, String requestBody) | // Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableResponse.java
// public class GetUserIdSerializableResponse extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableResponse {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/servlets/AccountLinkingServlet.java
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableResponse;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import com.amazon.dtasdk.serializer.SerializationException;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* <p>
* This abstract servlet can be extended to implement the V3 Account Linking section of Instant Access API.
* </p>
*
* <p>
* When extending this servlet, you must implement the abstract method {@link #getUserId( GetUserIdSerializableRequest )},
* it is the method for returning a user id based on the parameters in order to link accounts.
* </p>
*
* <p>
* You must also implement the abstract method {@link #getCredentialStore()}. This method must provide a valid credential
* store that will be used to verify the message authenticity.
* </p>
*
*/
public abstract class AccountLinkingServlet extends InstantAccessServlet {
/**
* Process the request and returns the user id
*
* @param request
* the request relative to the get user id operation
*
* @return a GetUserIdSerializableResponse object
*/
public abstract GetUserIdSerializableResponse getUserId(GetUserIdSerializableRequest request);
@Override
public InstantAccessResponse<?> processOperation(InstantAccessOperationValue operation, String requestBody) | throws SerializationException { |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessRequestTest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessRequestTest { | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessRequestTest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessRequestTest { | private JacksonSerializer serializer = new JacksonSerializer(); |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessRequestTest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessRequestTest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test | public void testSerialize() throws SerializationException { |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessRequestTest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test
public void testSerialize() throws SerializationException {
GetUserIdSerializableRequest request = new GetUserIdSerializableRequest(); | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessRequestTest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test
public void testSerialize() throws SerializationException {
GetUserIdSerializableRequest request = new GetUserIdSerializableRequest(); | request.setOperation(InstantAccessOperationValue.GETUSERID); |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v3/messages/InstantAccessRequestTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
| import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.messages;
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v3/messages/InstantAccessRequestTest.java
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.messages;
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test | public void testSerialize() throws SerializationException { |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v3/messages/InstantAccessRequestTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
| import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.messages;
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test
public void testSerialize() throws SerializationException { | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v3/messages/InstantAccessRequestTest.java
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.messages;
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test
public void testSerialize() throws SerializationException { | GetUserIdSerializableRequest request = new GetUserIdSerializableRequest(); |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v3/messages/InstantAccessRequestTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
| import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.messages;
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test
public void testSerialize() throws SerializationException {
GetUserIdSerializableRequest request = new GetUserIdSerializableRequest(); | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/GetUserIdSerializableRequest.java
// public class GetUserIdSerializableRequest extends com.amazon.dtasdk.v2.serialization.messages.GetUserIdSerializableRequest {
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v3/messages/InstantAccessRequestTest.java
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.v3.serialization.messages.GetUserIdSerializableRequest;
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.messages;
public class InstantAccessRequestTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test
public void testSerialize() throws SerializationException {
GetUserIdSerializableRequest request = new GetUserIdSerializableRequest(); | request.setOperation(InstantAccessOperationValue.GETUSERID); |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionUpdateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | package com.amazon.dtasdk.v3.serialization.messages;
public class SubscriptionUpdateRequest extends SubscriptionRequest {
private Integer numberOfLicenses;
private Boolean removeAllUnassignedLicenses;
@Override | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/serialization/messages/SubscriptionUpdateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
package com.amazon.dtasdk.v3.serialization.messages;
public class SubscriptionUpdateRequest extends SubscriptionRequest {
private Integer numberOfLicenses;
private Boolean removeAllUnassignedLicenses;
@Override | public SubscriptionUpdateRequest setOperation(InstantAccessOperationValue operationValue) { |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/RevokePurchaseRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public class InstantAccessRequest {
// protected InstantAccessOperationValue operation;
//
// public InstantAccessOperationValue getOperation() {
// return operation;
// }
//
// public InstantAccessRequest setOperation(InstantAccessOperationValue operation) {
// this.operation = operation;
// return this;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((operation == null) ? 0 : operation.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;
// }
// InstantAccessRequest other = (InstantAccessRequest) obj;
// if (operation == null) {
// if (other.operation != null) {
// return false;
// }
// } else if (!operation.equals(other.operation)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("operation", operation).toString();
// }
//
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* Serializable FulfillPurchaseRequest object to pass to developer used to revoke a purchase
*/
public class RevokePurchaseRequest extends InstantAccessRequest {
private String purchaseToken;
private String userId;
private String productId;
private String reason;
@Override | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public class InstantAccessRequest {
// protected InstantAccessOperationValue operation;
//
// public InstantAccessOperationValue getOperation() {
// return operation;
// }
//
// public InstantAccessRequest setOperation(InstantAccessOperationValue operation) {
// this.operation = operation;
// return this;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((operation == null) ? 0 : operation.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;
// }
// InstantAccessRequest other = (InstantAccessRequest) obj;
// if (operation == null) {
// if (other.operation != null) {
// return false;
// }
// } else if (!operation.equals(other.operation)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("operation", operation).toString();
// }
//
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/RevokePurchaseRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* Serializable FulfillPurchaseRequest object to pass to developer used to revoke a purchase
*/
public class RevokePurchaseRequest extends InstantAccessRequest {
private String purchaseToken;
private String userId;
private String productId;
private String reason;
@Override | public RevokePurchaseRequest setOperation(InstantAccessOperationValue operation) { |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionDeactivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
* This deactivate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionDeactivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
* This deactivate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) | public class SubscriptionDeactivateRequest extends SubscriptionRequest { |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionDeactivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
* This deactivate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
| // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionDeactivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
* This deactivate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
| protected SubscriptionReasonValue reason; |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionDeactivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
* This deactivate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
protected SubscriptionReasonValue reason; | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionDeactivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
* This deactivate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
protected SubscriptionReasonValue reason; | protected SubscriptionPeriodValue period; |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionDeactivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
* This deactivate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
protected SubscriptionReasonValue reason;
protected SubscriptionPeriodValue period;
@Override | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionPeriodValue.java
// public enum SubscriptionPeriodValue {
// FREE_TRIAL,
// GRACE_PERIOD,
// NOT_STARTED,
// REGULAR;
//
// @JsonCreator
// public static SubscriptionPeriodValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionReasonValue.java
// public enum SubscriptionReasonValue {
// NOT_RENEWED,
// USER_REQUEST,
// CUSTOMER_SERVICE_REQUEST,
// PAYMENT_PROBLEM,
// TESTING,
// UNABLE_TO_FULFILL,
// REASSIGN;
//
// @JsonCreator
// public static SubscriptionReasonValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionDeactivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionPeriodValue;
import com.amazon.dtasdk.base.SubscriptionReasonValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to deactivate a subscription.
* Includes the reason for deactivation and the period in which it was deactivated.
* This deactivate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionDeactivateRequest extends SubscriptionRequest {
protected SubscriptionReasonValue reason;
protected SubscriptionPeriodValue period;
@Override | public SubscriptionDeactivateRequest setOperation(InstantAccessOperationValue operationValue) { |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionActivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to activate a subscription for a specified user and product
* This activate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionActivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to activate a subscription for a specified user and product
* This activate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) | public class SubscriptionActivateRequest extends SubscriptionRequest { |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionActivateRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to activate a subscription for a specified user and product
* This activate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionActivateRequest extends SubscriptionRequest {
protected String productId;
protected String userId;
protected Integer numberOfSubscriptionsInGroup;
protected String subscriptionGroupId;
@Override | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class SubscriptionRequest extends InstantAccessRequest {
//
// protected String subscriptionId;
//
// protected String productId;
//
// protected String userId;
//
// public String getSubscriptionId() {
// return subscriptionId;
// }
//
// public SubscriptionRequest setSubscriptionId(String subscriptionId) {
// this.subscriptionId = subscriptionId;
// return this;
// }
//
// public String getProductId() {
// return productId;
// }
//
// public SubscriptionRequest setProductId(String productId) {
// this.productId = productId;
// return this;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public SubscriptionRequest setUserId(String userId) {
// this.userId = userId;
// return this;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
//
// final SubscriptionRequest that = (SubscriptionRequest) o;
//
// if (subscriptionId != null ? !subscriptionId.equals(that.subscriptionId) : that.subscriptionId != null)
// return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = super.hashCode();
// result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
// return result;
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/SubscriptionActivateRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.SubscriptionRequest;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* A request to activate a subscription for a specified user and product
* This activate request is on the deprecation path, please do not use it.
*/
@Deprecated
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SubscriptionActivateRequest extends SubscriptionRequest {
protected String productId;
protected String userId;
protected Integer numberOfSubscriptionsInGroup;
protected String subscriptionGroupId;
@Override | public SubscriptionActivateRequest setOperation(InstantAccessOperationValue operationValue) { |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessResponseTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessResponseTest { | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessResponseTest.java
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessResponseTest { | private JacksonSerializer serializer = new JacksonSerializer(); |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessResponseTest.java | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessResponseTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test | // Path: src/main/java/com/amazon/dtasdk/serializer/JacksonSerializer.java
// public class JacksonSerializer {
// private static final Log log = LogFactory.getLog(JacksonSerializer.class);
//
// private ObjectMapper objectMapper;
//
// public JacksonSerializer() {
// objectMapper = new ObjectMapper();
// }
//
// public <T> String encode(T serialObject) throws SerializationException {
// log.info(String.format("Serializing object [%s]", serialObject));
//
// StringWriter writer = new StringWriter();
//
// try {
// objectMapper.writeValue(writer, serialObject);
// } catch (Exception e) {
// String error = "Unable to serialize object to string";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
//
// return writer.toString();
// }
//
// public <T> T decode(String jsonString, Class<T> pojoClass) throws SerializationException {
// try {
// return objectMapper.readValue(jsonString, pojoClass);
// } catch (Exception e) {
// String error = "Unable to deserialize string into object";
// log.error(error, e);
// throw new SerializationException(error, e);
// }
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/test/java/com/amazon/dtasdk/v2/serialization/messages/InstantAccessResponseTest.java
import com.amazon.dtasdk.serializer.JacksonSerializer;
import com.amazon.dtasdk.serializer.SerializationException;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
@Deprecated
public class InstantAccessResponseTest {
private JacksonSerializer serializer = new JacksonSerializer();
@Test | public void testSerialize() throws SerializationException { |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/serializer/JacksonSerializerTest.java | // Path: src/test/java/com/amazon/dtasdk/serializer/TestJson.java
// public static class Name {
// private String first, last;
//
// public String getFirst() {
// return first;
// }
//
// public String getLast() {
// return last;
// }
//
// public void setFirst(String first) {
// this.first = first;
// }
//
// public void setLast(String last) {
// this.last = last;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((first == null) ? 0 : first.hashCode());
// result = prime * result + ((last == null) ? 0 : last.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;
// }
// Name other = (Name) obj;
// if (first == null) {
// if (other.first != null) {
// return false;
// }
// } else if (!first.equals(other.first)) {
// return false;
// }
// if (last == null) {
// if (other.last != null) {
// return false;
// }
// } else if (!last.equals(other.last)) {
// return false;
// }
// return true;
// }
// }
| import com.amazon.dtasdk.serializer.TestJson.Name;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import junit.framework.Assert;
import org.junit.Test;
import java.util.LinkedList;
import java.util.List; | /*
* Copyright 2017-2021 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.amazon.dtasdk.serializer;
public class JacksonSerializerTest {
private static final String jsonString = "{\"value\":\"theValue\","
+ "\"names\":[{\"first\":\"Joe\",\"last\":\"Sixpack\"}," + "{\"first\":\"Bill\",\"last\":\"Fourpack\"}]}";
private static final JacksonSerializer serializer = new JacksonSerializer();
@Test
public void testDecode() throws Exception {
TestJson dtgObject = serializer.decode(jsonString, TestJson.class);
Assert.assertEquals(TestJson.class, dtgObject.getClass());
TestJson testJson = dtgObject;
Assert.assertEquals("Joe", testJson.getNames().get(0).getFirst());
Assert.assertEquals("Sixpack", testJson.getNames().get(0).getLast());
Assert.assertEquals("Bill", testJson.getNames().get(1).getFirst());
Assert.assertEquals("Fourpack", testJson.getNames().get(1).getLast());
Assert.assertEquals("theValue", testJson.getValue());
}
@Test
public void testEncode() throws Exception {
String encodedJson = encodeObject(getTestObject());
ObjectMapper mapper = new ObjectMapper();
JsonNode expected = mapper.readTree(jsonString);
JsonNode actual = mapper.readTree(encodedJson);
Assert.assertEquals(expected, actual);
}
private TestJson getTestObject() throws Exception {
TestJson testJson = new TestJson(); | // Path: src/test/java/com/amazon/dtasdk/serializer/TestJson.java
// public static class Name {
// private String first, last;
//
// public String getFirst() {
// return first;
// }
//
// public String getLast() {
// return last;
// }
//
// public void setFirst(String first) {
// this.first = first;
// }
//
// public void setLast(String last) {
// this.last = last;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((first == null) ? 0 : first.hashCode());
// result = prime * result + ((last == null) ? 0 : last.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;
// }
// Name other = (Name) obj;
// if (first == null) {
// if (other.first != null) {
// return false;
// }
// } else if (!first.equals(other.first)) {
// return false;
// }
// if (last == null) {
// if (other.last != null) {
// return false;
// }
// } else if (!last.equals(other.last)) {
// return false;
// }
// return true;
// }
// }
// Path: src/test/java/com/amazon/dtasdk/serializer/JacksonSerializerTest.java
import com.amazon.dtasdk.serializer.TestJson.Name;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import junit.framework.Assert;
import org.junit.Test;
import java.util.LinkedList;
import java.util.List;
/*
* Copyright 2017-2021 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.amazon.dtasdk.serializer;
public class JacksonSerializerTest {
private static final String jsonString = "{\"value\":\"theValue\","
+ "\"names\":[{\"first\":\"Joe\",\"last\":\"Sixpack\"}," + "{\"first\":\"Bill\",\"last\":\"Fourpack\"}]}";
private static final JacksonSerializer serializer = new JacksonSerializer();
@Test
public void testDecode() throws Exception {
TestJson dtgObject = serializer.decode(jsonString, TestJson.class);
Assert.assertEquals(TestJson.class, dtgObject.getClass());
TestJson testJson = dtgObject;
Assert.assertEquals("Joe", testJson.getNames().get(0).getFirst());
Assert.assertEquals("Sixpack", testJson.getNames().get(0).getLast());
Assert.assertEquals("Bill", testJson.getNames().get(1).getFirst());
Assert.assertEquals("Fourpack", testJson.getNames().get(1).getLast());
Assert.assertEquals("theValue", testJson.getValue());
}
@Test
public void testEncode() throws Exception {
String encodedJson = encodeObject(getTestObject());
ObjectMapper mapper = new ObjectMapper();
JsonNode expected = mapper.readTree(jsonString);
JsonNode actual = mapper.readTree(encodedJson);
Assert.assertEquals(expected, actual);
}
private TestJson getTestObject() throws Exception {
TestJson testJson = new TestJson(); | Name name = new Name(); |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/GetUserIdSerializableRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public class InstantAccessRequest {
// protected InstantAccessOperationValue operation;
//
// public InstantAccessOperationValue getOperation() {
// return operation;
// }
//
// public InstantAccessRequest setOperation(InstantAccessOperationValue operation) {
// this.operation = operation;
// return this;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((operation == null) ? 0 : operation.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;
// }
// InstantAccessRequest other = (InstantAccessRequest) obj;
// if (operation == null) {
// if (other.operation != null) {
// return false;
// }
// } else if (!operation.equals(other.operation)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("operation", operation).toString();
// }
//
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* Serializable GetUserId object to pass to developer
*/
public class GetUserIdSerializableRequest extends InstantAccessRequest {
private String infoField1;
private String infoField2;
private String infoField3;
@Override | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public class InstantAccessRequest {
// protected InstantAccessOperationValue operation;
//
// public InstantAccessOperationValue getOperation() {
// return operation;
// }
//
// public InstantAccessRequest setOperation(InstantAccessOperationValue operation) {
// this.operation = operation;
// return this;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((operation == null) ? 0 : operation.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;
// }
// InstantAccessRequest other = (InstantAccessRequest) obj;
// if (operation == null) {
// if (other.operation != null) {
// return false;
// }
// } else if (!operation.equals(other.operation)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("operation", operation).toString();
// }
//
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/GetUserIdSerializableRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* Serializable GetUserId object to pass to developer
*/
public class GetUserIdSerializableRequest extends InstantAccessRequest {
private String infoField1;
private String infoField2;
private String infoField3;
@Override | public GetUserIdSerializableRequest setOperation(InstantAccessOperationValue operation) { |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v2/serialization/messages/FulfillPurchaseRequest.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public class InstantAccessRequest {
// protected InstantAccessOperationValue operation;
//
// public InstantAccessOperationValue getOperation() {
// return operation;
// }
//
// public InstantAccessRequest setOperation(InstantAccessOperationValue operation) {
// this.operation = operation;
// return this;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((operation == null) ? 0 : operation.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;
// }
// InstantAccessRequest other = (InstantAccessRequest) obj;
// if (operation == null) {
// if (other.operation != null) {
// return false;
// }
// } else if (!operation.equals(other.operation)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("operation", operation).toString();
// }
//
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* Serializable FulfillPurchaseRequest object to pass to developer used to fulfill a purchase
*/
public class FulfillPurchaseRequest extends InstantAccessRequest {
private String purchaseToken;
private String userId;
private String productId;
private String reason;
@Override | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessRequest.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public class InstantAccessRequest {
// protected InstantAccessOperationValue operation;
//
// public InstantAccessOperationValue getOperation() {
// return operation;
// }
//
// public InstantAccessRequest setOperation(InstantAccessOperationValue operation) {
// this.operation = operation;
// return this;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((operation == null) ? 0 : operation.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;
// }
// InstantAccessRequest other = (InstantAccessRequest) obj;
// if (operation == null) {
// if (other.operation != null) {
// return false;
// }
// } else if (!operation.equals(other.operation)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("operation", operation).toString();
// }
//
// }
// Path: src/main/java/com/amazon/dtasdk/v2/serialization/messages/FulfillPurchaseRequest.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v2.serialization.messages;
/**
* Serializable FulfillPurchaseRequest object to pass to developer used to fulfill a purchase
*/
public class FulfillPurchaseRequest extends InstantAccessRequest {
private String purchaseToken;
private String userId;
private String productId;
private String reason;
@Override | public FulfillPurchaseRequest setOperation(InstantAccessOperationValue operation) { |
amzn/amazon-instant-access-sdk-java | src/main/java/com/amazon/dtasdk/v3/servlets/PurchaseServlet.java | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionResponse.java
// public class SubscriptionResponse extends InstantAccessResponse<SubscriptionResponseValue> {
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import com.amazon.dtasdk.base.SubscriptionResponse;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.v3.serialization.messages.*; | /*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* <p>
* This abstract servlet can be extended to implement the V3 Purchase/Subscription section of Instant Access API.
* </p>
* <p>
* <p>
* When extending this servlet, you must implement the abstract methods relative to the four operations present in the
* API. {@link #fulfillPurchase( FulfillPurchaseRequest )} is the method responsible for fulfilling a purchase, {@link
* #revokePurchase( RevokePurchaseRequest )} is the method responsible for revoking a purchase, {@link
* #processSubscriptionActivate( SubscriptionActivateRequest )} is the method responsible for activating a subscription,
* {@link #processSubscriptionDeactivate( SubscriptionDeactivateRequest )} is the method responsible for deactivating a
* subscription, {@link #processSubscriptionUpdate( SubscriptionUpdateRequest )} is the method responsible for updating a
* subscription and {@link #processSubscriptionGet( SubscriptionGetRequest )} is the method responsible for getting a
* subscription
* </p>
* <p>
* <p>
* You must also implement the abstract method {@link #getCredentialStore()}. This method must provide a valid credential
* store that will be used to verify the message authenticity.
* </p>
*/
public abstract class PurchaseServlet extends InstantAccessServlet {
/**
* Process the fulfill purchase request and return the response to whether or not the request succeeded.
*
* @param request the request relative to the fulfill purchase
* @return a FulfillPurchaseResponse object
*/
public abstract FulfillPurchaseResponse fulfillPurchase(FulfillPurchaseRequest request);
/**
* Process the revoke purchase request and return the response to whether or not the request succeeded.
*
* @param request the request relative to the revoke purchase
* @return a RevokePurchaseResponse object
*/
public abstract RevokePurchaseResponse revokePurchase(RevokePurchaseRequest request);
/**
* Process a subscription activation based on the request and returns the response to whether or not the request
* succeeded.
*
* @param request the request object with information about the subscription
* @return a SubscriptionResponse object
*/ | // Path: src/main/java/com/amazon/dtasdk/base/InstantAccessOperationValue.java
// public enum InstantAccessOperationValue {
// PURCHASE("Purchase"),
// REVOKE("Revoke"),
// GETUSERID("GetUserId"),
// SUBSCRIPTIONGET("SubscriptionGet"),
// SUBSCRIPTIONACTIVATE("SubscriptionActivate"),
// SUBSCRIPTIONDEACTIVATE("SubscriptionDeactivate"),
// SUBSCRIPTIONUPDATE("SubscriptionUpdate");
//
// private String apiName;
//
// /**
// * @param apiName
// * The string representation of the operation according to the API
// */
// InstantAccessOperationValue(String apiName) {
// this.apiName = apiName;
// }
//
// @JsonValue
// public String toJson() {
// return apiName;
// }
//
// @JsonCreator
// public static InstantAccessOperationValue fromJson(String text) {
// // ignore the case when deserializing
// return valueOf(text.toUpperCase());
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/InstantAccessResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
// public abstract class InstantAccessResponse<R extends Serializable> {
// protected R response;
//
// public R getResponse() {
// return response;
// }
//
// public void setResponse(R response) {
// this.response = response;
// }
//
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((response == null) ? 0 : response.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;
// }
// InstantAccessResponse other = (InstantAccessResponse) obj;
// if (response == null) {
// if (other.response != null) {
// return false;
// }
// } else if (!response.equals(other.response)) {
// return false;
// }
// return true;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("response", response).toString();
// }
// }
//
// Path: src/main/java/com/amazon/dtasdk/base/SubscriptionResponse.java
// public class SubscriptionResponse extends InstantAccessResponse<SubscriptionResponseValue> {
// }
//
// Path: src/main/java/com/amazon/dtasdk/serializer/SerializationException.java
// public class SerializationException extends Exception {
// private static final long serialVersionUID = -3095196341869438153L;
//
// public SerializationException(String message) {
// super(message);
// }
//
// public SerializationException(Throwable cause) {
// super(cause);
// }
//
// public SerializationException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/main/java/com/amazon/dtasdk/v3/servlets/PurchaseServlet.java
import com.amazon.dtasdk.base.InstantAccessOperationValue;
import com.amazon.dtasdk.base.InstantAccessResponse;
import com.amazon.dtasdk.base.SubscriptionResponse;
import com.amazon.dtasdk.serializer.SerializationException;
import com.amazon.dtasdk.v3.serialization.messages.*;
/*
* Copyright 2017-2021 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.amazon.dtasdk.v3.servlets;
/**
* <p>
* This abstract servlet can be extended to implement the V3 Purchase/Subscription section of Instant Access API.
* </p>
* <p>
* <p>
* When extending this servlet, you must implement the abstract methods relative to the four operations present in the
* API. {@link #fulfillPurchase( FulfillPurchaseRequest )} is the method responsible for fulfilling a purchase, {@link
* #revokePurchase( RevokePurchaseRequest )} is the method responsible for revoking a purchase, {@link
* #processSubscriptionActivate( SubscriptionActivateRequest )} is the method responsible for activating a subscription,
* {@link #processSubscriptionDeactivate( SubscriptionDeactivateRequest )} is the method responsible for deactivating a
* subscription, {@link #processSubscriptionUpdate( SubscriptionUpdateRequest )} is the method responsible for updating a
* subscription and {@link #processSubscriptionGet( SubscriptionGetRequest )} is the method responsible for getting a
* subscription
* </p>
* <p>
* <p>
* You must also implement the abstract method {@link #getCredentialStore()}. This method must provide a valid credential
* store that will be used to verify the message authenticity.
* </p>
*/
public abstract class PurchaseServlet extends InstantAccessServlet {
/**
* Process the fulfill purchase request and return the response to whether or not the request succeeded.
*
* @param request the request relative to the fulfill purchase
* @return a FulfillPurchaseResponse object
*/
public abstract FulfillPurchaseResponse fulfillPurchase(FulfillPurchaseRequest request);
/**
* Process the revoke purchase request and return the response to whether or not the request succeeded.
*
* @param request the request relative to the revoke purchase
* @return a RevokePurchaseResponse object
*/
public abstract RevokePurchaseResponse revokePurchase(RevokePurchaseRequest request);
/**
* Process a subscription activation based on the request and returns the response to whether or not the request
* succeeded.
*
* @param request the request object with information about the subscription
* @return a SubscriptionResponse object
*/ | public abstract SubscriptionResponse processSubscriptionActivate(SubscriptionActivateRequest request); |
amzn/amazon-instant-access-sdk-java | src/test/java/com/amazon/dtasdk/signature/SignerTest.java | // Path: src/main/java/com/amazon/dtasdk/utils/Clock.java
// public class Clock {
// public Date now() {
// return new Date();
// }
// }
| import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.junit.Test;
import com.amazon.dtasdk.utils.Clock; | /*
* Copyright 2017-2021 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.amazon.dtasdk.signature;
public class SignerTest {
public static final String AUTHORIZATION_HEADER = "Authorization";
public static final String X_AMZ_DATE_HEADER = "x-amz-date";
// By design several of these first tests only verify that signatures calculate to an externally verified signature.
// The more interesting and robust tests are the round trip ones.
@Test
public void validSignature() throws SigningException { | // Path: src/main/java/com/amazon/dtasdk/utils/Clock.java
// public class Clock {
// public Date now() {
// return new Date();
// }
// }
// Path: src/test/java/com/amazon/dtasdk/signature/SignerTest.java
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.junit.Test;
import com.amazon.dtasdk.utils.Clock;
/*
* Copyright 2017-2021 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.amazon.dtasdk.signature;
public class SignerTest {
public static final String AUTHORIZATION_HEADER = "Authorization";
public static final String X_AMZ_DATE_HEADER = "x-amz-date";
// By design several of these first tests only verify that signatures calculate to an externally verified signature.
// The more interesting and robust tests are the round trip ones.
@Test
public void validSignature() throws SigningException { | Clock clock = createMock(Clock.class); |
osiefart/wicket-christmas | src/main/java/com/senacor/wicket/async/christmas/widgets/train/TrainMessageAsyncModel.java | // Path: src/main/java/com/senacor/wicket/async/christmas/widgets/api/message/IMessageSource.java
// public interface IMessageSource<T> {
//
// T getMessage();
//
// T getMessageSync();
//
// Boolean isLoading();
//
// Boolean hasNext();
//
// void loadNext();
// }
//
// Path: src/main/java/com/senacor/wicket/async/christmas/widgets/api/model/AbstractAsyncModel.java
// public abstract class AbstractAsyncModel<T> extends AbstractReadOnlyModel<T> implements IAsyncModel<T> {
//
// private transient T lastMessage = null;
//
// @Override
// public T getObject() {
// T ret = getMessageSource().getMessage();
// if (ret == null) {
// getMessageSource().loadNext();
// ret = lastMessage;
// } else {
// lastMessage = ret;
// }
// return ret;
// }
//
// @Override
// public Boolean isLoading() {
// return getMessageSource().isLoading();
// }
//
// @Override
// public void startLoading() {
// getMessageSource().loadNext();
// }
//
// @Override
// public Boolean hasNext() {
// return getMessageSource().hasNext();
// }
//
// public abstract IMessageSource<T> getMessageSource();
// }
//
// Path: src/main/java/com/senacor/wicket/async/christmas/widgets/train/message/ZugmonitorMessageSource.java
// @Service
// @Scope("prototype")
// public class ZugmonitorMessageSource extends MessageSource<String> {
//
// @Autowired
// @Qualifier("zugmonitorMessageLoader")
// private IMessageLoader<String> messageLoader;
//
// @Override
// public IMessageLoader<String> getMessageLoader() {
// return messageLoader;
// }
// }
| import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import com.senacor.wicket.async.christmas.widgets.api.message.IMessageSource;
import com.senacor.wicket.async.christmas.widgets.api.model.AbstractAsyncModel;
import com.senacor.wicket.async.christmas.widgets.train.message.ZugmonitorMessageSource; | package com.senacor.wicket.async.christmas.widgets.train;
@Configurable
public class TrainMessageAsyncModel extends AbstractAsyncModel<String> {
@Autowired | // Path: src/main/java/com/senacor/wicket/async/christmas/widgets/api/message/IMessageSource.java
// public interface IMessageSource<T> {
//
// T getMessage();
//
// T getMessageSync();
//
// Boolean isLoading();
//
// Boolean hasNext();
//
// void loadNext();
// }
//
// Path: src/main/java/com/senacor/wicket/async/christmas/widgets/api/model/AbstractAsyncModel.java
// public abstract class AbstractAsyncModel<T> extends AbstractReadOnlyModel<T> implements IAsyncModel<T> {
//
// private transient T lastMessage = null;
//
// @Override
// public T getObject() {
// T ret = getMessageSource().getMessage();
// if (ret == null) {
// getMessageSource().loadNext();
// ret = lastMessage;
// } else {
// lastMessage = ret;
// }
// return ret;
// }
//
// @Override
// public Boolean isLoading() {
// return getMessageSource().isLoading();
// }
//
// @Override
// public void startLoading() {
// getMessageSource().loadNext();
// }
//
// @Override
// public Boolean hasNext() {
// return getMessageSource().hasNext();
// }
//
// public abstract IMessageSource<T> getMessageSource();
// }
//
// Path: src/main/java/com/senacor/wicket/async/christmas/widgets/train/message/ZugmonitorMessageSource.java
// @Service
// @Scope("prototype")
// public class ZugmonitorMessageSource extends MessageSource<String> {
//
// @Autowired
// @Qualifier("zugmonitorMessageLoader")
// private IMessageLoader<String> messageLoader;
//
// @Override
// public IMessageLoader<String> getMessageLoader() {
// return messageLoader;
// }
// }
// Path: src/main/java/com/senacor/wicket/async/christmas/widgets/train/TrainMessageAsyncModel.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import com.senacor.wicket.async.christmas.widgets.api.message.IMessageSource;
import com.senacor.wicket.async.christmas.widgets.api.model.AbstractAsyncModel;
import com.senacor.wicket.async.christmas.widgets.train.message.ZugmonitorMessageSource;
package com.senacor.wicket.async.christmas.widgets.train;
@Configurable
public class TrainMessageAsyncModel extends AbstractAsyncModel<String> {
@Autowired | private transient ZugmonitorMessageSource messageSource; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.