blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b6355f6009b3aca40ecd17f1b6becbe7dd4c3fc5 | 92225460ebca1bb6a594d77b6559b3629b7a94fa | /src/com/kingdee/eas/fdc/sellhouse/app/AbstractSharePropertyControllerBean.java | a319e83ade299ec37d9393dbd258085b15fe6879 | [] | no_license | yangfan0725/sd | 45182d34575381be3bbdd55f3f68854a6900a362 | 39ebad6e2eb76286d551a9e21967f3f5dc4880da | refs/heads/master | 2023-04-29T01:56:43.770005 | 2023-04-24T05:41:13 | 2023-04-24T05:41:13 | 512,073,641 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,971 | java | package com.kingdee.eas.fdc.sellhouse.app;
import javax.ejb.*;
import java.rmi.RemoteException;
import com.kingdee.bos.*;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.rule.RuleExecutor;
import com.kingdee.bos.metadata.MetaDataPK;
//import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.framework.ejb.AbstractEntityControllerBean;
import com.kingdee.bos.framework.ejb.AbstractBizControllerBean;
//import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.service.ServiceContext;
import com.kingdee.bos.service.IServiceContext;
import com.kingdee.eas.framework.Result;
import com.kingdee.eas.framework.LineResult;
import com.kingdee.eas.framework.exception.EASMultiException;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import java.lang.String;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.eas.fdc.sellhouse.SharePropertyInfo;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.fdc.sellhouse.SharePropertyCollection;
import com.kingdee.eas.framework.ObjectBaseCollection;
import com.kingdee.eas.framework.app.DataBaseControllerBean;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.eas.framework.DataBaseCollection;
public abstract class AbstractSharePropertyControllerBean extends DataBaseControllerBean implements SharePropertyController
{
protected AbstractSharePropertyControllerBean()
{
}
protected BOSObjectType getBOSType()
{
return new BOSObjectType("911F17D9");
}
public SharePropertyInfo getSharePropertyInfo(Context ctx, IObjectPK pk) throws BOSException, EASBizException
{
try {
ServiceContext svcCtx = createServiceContext(new MetaDataPK("48085d49-0cc6-49d8-a7db-8687d55c4a01"), new Object[]{ctx, pk});
invokeServiceBefore(svcCtx);
SharePropertyInfo retValue = (SharePropertyInfo)_getValue(ctx, pk);
svcCtx.setMethodReturnValue(retValue);
invokeServiceAfter(svcCtx);
return retValue;
} catch (BOSException ex) {
throw ex;
} catch (EASBizException ex0) {
throw ex0;
} finally {
super.cleanUpServiceState();
}
}
protected IObjectValue _getValue(Context ctx, IObjectPK pk) throws BOSException, EASBizException
{
return super._getValue(ctx, pk);
}
public SharePropertyInfo getSharePropertyInfo(Context ctx, IObjectPK pk, SelectorItemCollection selector) throws BOSException, EASBizException
{
try {
ServiceContext svcCtx = createServiceContext(new MetaDataPK("5a6b196f-3c56-465c-b74d-c454fc5d3aff"), new Object[]{ctx, pk, selector});
invokeServiceBefore(svcCtx);
SharePropertyInfo retValue = (SharePropertyInfo)_getValue(ctx, pk, selector);
svcCtx.setMethodReturnValue(retValue);
invokeServiceAfter(svcCtx);
return retValue;
} catch (BOSException ex) {
throw ex;
} catch (EASBizException ex0) {
throw ex0;
} finally {
super.cleanUpServiceState();
}
}
protected IObjectValue _getValue(Context ctx, IObjectPK pk, SelectorItemCollection selector) throws BOSException, EASBizException
{
return super._getValue(ctx, pk, selector);
}
public SharePropertyInfo getSharePropertyInfo(Context ctx, String oql) throws BOSException, EASBizException
{
try {
ServiceContext svcCtx = createServiceContext(new MetaDataPK("60cf43dc-fc13-4185-bf3b-dd5c1d2cb6cf"), new Object[]{ctx, oql});
invokeServiceBefore(svcCtx);
SharePropertyInfo retValue = (SharePropertyInfo)_getValue(ctx, oql);
svcCtx.setMethodReturnValue(retValue);
invokeServiceAfter(svcCtx);
return retValue;
} catch (BOSException ex) {
throw ex;
} catch (EASBizException ex0) {
throw ex0;
} finally {
super.cleanUpServiceState();
}
}
protected IObjectValue _getValue(Context ctx, String oql) throws BOSException, EASBizException
{
return super._getValue(ctx, oql);
}
public SharePropertyCollection getSharePropertyCollection(Context ctx) throws BOSException
{
try {
ServiceContext svcCtx = createServiceContext(new MetaDataPK("605bc886-f6a3-4cb4-9071-e01baf72a9d1"), new Object[]{ctx});
invokeServiceBefore(svcCtx);
SharePropertyCollection retValue = (SharePropertyCollection)_getCollection(ctx, svcCtx);
svcCtx.setMethodReturnValue(retValue);
invokeServiceAfter(svcCtx);
return retValue;
} catch (BOSException ex) {
throw ex;
} finally {
super.cleanUpServiceState();
}
}
protected IObjectCollection _getCollection(Context ctx, IServiceContext svcCtx) throws BOSException
{
return super._getCollection(ctx, svcCtx);
}
public SharePropertyCollection getSharePropertyCollection(Context ctx, EntityViewInfo view) throws BOSException
{
try {
ServiceContext svcCtx = createServiceContext(new MetaDataPK("28a13862-b4f4-4cc0-8eec-681ac604f8a9"), new Object[]{ctx, view});
invokeServiceBefore(svcCtx);
SharePropertyCollection retValue = (SharePropertyCollection)_getCollection(ctx, svcCtx, view);
svcCtx.setMethodReturnValue(retValue);
invokeServiceAfter(svcCtx);
return retValue;
} catch (BOSException ex) {
throw ex;
} finally {
super.cleanUpServiceState();
}
}
protected IObjectCollection _getCollection(Context ctx, IServiceContext svcCtx, EntityViewInfo view) throws BOSException
{
return super._getCollection(ctx, svcCtx, view);
}
public SharePropertyCollection getSharePropertyCollection(Context ctx, String oql) throws BOSException
{
try {
ServiceContext svcCtx = createServiceContext(new MetaDataPK("f1ebde58-94d9-4e8a-9d7b-370577f55853"), new Object[]{ctx, oql});
invokeServiceBefore(svcCtx);
SharePropertyCollection retValue = (SharePropertyCollection)_getCollection(ctx, svcCtx, oql);
svcCtx.setMethodReturnValue(retValue);
invokeServiceAfter(svcCtx);
return retValue;
} catch (BOSException ex) {
throw ex;
} finally {
super.cleanUpServiceState();
}
}
protected IObjectCollection _getCollection(Context ctx, IServiceContext svcCtx, String oql) throws BOSException
{
return super._getCollection(ctx, svcCtx, oql);
}
public DataBaseCollection getDataBaseCollection (Context ctx) throws BOSException
{
return (DataBaseCollection)(getSharePropertyCollection(ctx).cast(DataBaseCollection.class));
}
public DataBaseCollection getDataBaseCollection (Context ctx, EntityViewInfo view) throws BOSException
{
return (DataBaseCollection)(getSharePropertyCollection(ctx, view).cast(DataBaseCollection.class));
}
public DataBaseCollection getDataBaseCollection (Context ctx, String oql) throws BOSException
{
return (DataBaseCollection)(getSharePropertyCollection(ctx, oql).cast(DataBaseCollection.class));
}
public ObjectBaseCollection getObjectBaseCollection (Context ctx) throws BOSException
{
return (ObjectBaseCollection)(getSharePropertyCollection(ctx).cast(ObjectBaseCollection.class));
}
public ObjectBaseCollection getObjectBaseCollection (Context ctx, EntityViewInfo view) throws BOSException
{
return (ObjectBaseCollection)(getSharePropertyCollection(ctx, view).cast(ObjectBaseCollection.class));
}
public ObjectBaseCollection getObjectBaseCollection (Context ctx, String oql) throws BOSException
{
return (ObjectBaseCollection)(getSharePropertyCollection(ctx, oql).cast(ObjectBaseCollection.class));
}
public CoreBaseCollection getCoreBaseCollection (Context ctx) throws BOSException
{
return (CoreBaseCollection)(getSharePropertyCollection(ctx).cast(CoreBaseCollection.class));
}
public CoreBaseCollection getCoreBaseCollection (Context ctx, EntityViewInfo view) throws BOSException
{
return (CoreBaseCollection)(getSharePropertyCollection(ctx, view).cast(CoreBaseCollection.class));
}
public CoreBaseCollection getCoreBaseCollection (Context ctx, String oql) throws BOSException
{
return (CoreBaseCollection)(getSharePropertyCollection(ctx, oql).cast(CoreBaseCollection.class));
}
} | [
"yfsmile@qq.com"
] | yfsmile@qq.com |
37b92898a4fb260f63d2d47336c13c4ffa5863d2 | 2b9a83446c83b730ece151fc18210176cb425333 | /courses/src/shixi/bean/Analysis.java | b571df35f239e4acef5cfa7db792e6dca31f2ff0 | [] | no_license | danny14159/courses | fb23c98ade729197c877ec6ea4e40a7151e60df0 | 2e7ab122cc2660834f747eefeddbfc11f4486cb7 | refs/heads/master | 2020-04-06T05:03:13.883783 | 2016-06-18T13:58:19 | 2016-06-18T13:58:19 | 57,046,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,353 | java | package shixi.bean;
import java.util.Arrays;
import java.util.Map;
public class Analysis {
public Integer getAt_grade() {
return at_grade;
}
public void setAt_grade(Integer at_grade) {
this.at_grade = at_grade;
}
public Integer getTest_id() {
return test_id;
}
@Override
public String toString() {
return "Analysis [at_grade=" + at_grade + ", test_id=" + test_id
+ ", type=" + type + ", class_id=" + class_id + ", topx="
+ Arrays.toString(topx) + ", lines=" + Arrays.toString(lines)
+ "]";
}
public void setTest_id(Integer test_id) {
this.test_id = test_id;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getClass_id() {
return class_id;
}
public void setClass_id(Integer class_id) {
this.class_id = class_id;
}
public Integer[] getTopx() {
return topx;
}
public void setTopx(Integer[] topx) {
this.topx = topx;
}
public Map<String, Object>[] getLines() {
return lines;
}
public void setLines(Map<String, Object>[] lines) {
this.lines = lines;
}
private Integer at_grade;//年级
private Integer test_id;//考试ID
private String type; //分析结果类型
private Integer class_id; //班级ID
private Integer[] topx; //班级前X名
private Map<String,Object>[] lines; //分数线
}
| [
"lei.deng@newtouch.cn"
] | lei.deng@newtouch.cn |
0708f3809bd01a448e9881bdd2891aea9cdfca92 | 1de7f1d2767ce535610255e7363a969cd9950398 | /dataInterface/src/znet/dataInterface/core/SocketHandle.java | 969e77e0cd37028bbc6ea1f6353cdf7f5e61e8bd | [] | no_license | cao2068959/laws | 1413a755f64b2bf9c3684176da257c8f85f5999a | 33ea285c3fc4496baf117d027b72f4621f69b39a | refs/heads/master | 2020-03-22T21:16:17.308996 | 2018-07-12T06:49:07 | 2018-07-12T06:49:07 | 140,672,873 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 5,256 | java | package znet.dataInterface.core;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.Socket;
import org.apache.commons.lang.ArrayUtils;
import znet.dataInterface.bean.Command;
import znet.dataInterface.bean.MethodResult;
import znet.dataInterface.core.ScanMapping;
import znet.dataInterface.core.Tool;
public class SocketHandle implements Runnable{
private Socket socket;
public SocketHandle(Socket socket) {
this.socket = socket;
}
@Override
public void run() {
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = socket.getInputStream();
outputStream = socket.getOutputStream();
int totalLen = 0;
DataInputStream dis = new DataInputStream(inputStream);
Integer packageLen = 0;
//坐等读取命令长度
while((packageLen = dis.readInt()) !=0){
Integer paramLen = packageLen - 24;
//乱发 慢走不送
if(paramLen < 0 ){
break;
}
Command command = new Command();
//读取操作命令
//byte[] codeBuff =new byte[20];
//dis.read(codeBuff);
byte[] codeBuff = readByte(dis, 20);
String code = new String(codeBuff);
command.setCode(code);
//读取剩下的所有内容
//byte[] paramBuff = new byte[paramLen];
//dis.read(paramBuff);
byte[] paramBuff = readByte(dis, paramLen);
String param = new String(paramBuff,"utf-8");
command.setParam(param);
//执行对应方法
MethodResult methodResult = excCommand(command);
//处理方法返回来的结果
sendProxy(methodResult,outputStream);
}
} catch (EOFException e) {
// TODO Auto-generated catch block
//e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
try {
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
outputStream.close();
} catch (Exception e1) {
e1.printStackTrace();
}
try {
socket.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("客户端离线");
}
}
public static byte[] readByte(DataInputStream dis,Integer len){
byte[] paramBuff = new byte[1024];
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
Integer readNum = 0;
while(readNum < len){
int nextNum = len - readNum;
if(nextNum > 1024){
nextNum = 1024;
}
int n = dis.read(paramBuff,0,nextNum);
readNum = readNum + n;
bos.write(paramBuff, 0, n);
}
return bos.toByteArray();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try {
bos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return paramBuff;
}
/**
* 根据 methodResult 中的结果 判断发送数据,还是错误信息
* @param methodResult
* @param outputStream
*/
public void sendProxy(MethodResult methodResult,OutputStream outputStream){
Boolean isSuccess = methodResult.getSuccess();
String data= null;
if(isSuccess){
data = methodResult.getData();
}else{
data = Tool.getError(methodResult.getDes());
}
if(data != null){
sendData(data,outputStream);
}
}
/**
* 计算总长度,并发送数据
* @param data
* @param outputStream
*/
public void sendData(String data,OutputStream outputStream){
try {
byte[] buffs= data.getBytes("utf-8");
int total = 4 + buffs.length;
byte[] lenBuff = intToBytes(total);
byte[] resultBuff = ArrayUtils.addAll(lenBuff, buffs);
outputStream.write(resultBuff);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 反射执行对应命令
* @param com
* @return
*/
public MethodResult excCommand(Command com){
if(com == null || com.getCode() == null || com.getCode() == ""){
return null;
}
String code = com.getCode();
MethodResult result = ScanMapping.execMethod(code, com);
return result;
}
/**
* 4比特转 int
* @param b
* @return
*/
public static int byteToInt2(byte[] b) {
int mask=0xff;
int temp=0;
int n=0;
for(int i=0;i<b.length;i++){
n<<=8;
temp=b[i]&mask;
n|=temp;
}
return n;
}
/**
* int转成4byte
* @param a
* @return
*/
public static byte[] intToBytes(int a) {
return new byte[] {
(byte) ((a >> 24) & 0xFF),
(byte) ((a >> 16) & 0xFF),
(byte) ((a >> 8) & 0xFF),
(byte) (a & 0xFF)
};
}
}
| [
"704188931@qq.com"
] | 704188931@qq.com |
14705d0dfa599a9739490d5b3cfdfc5bb8e998e7 | 42ddf917e86692cd267fe53b4af36bea04002788 | /common/src/main/java/me/lucko/luckperms/common/commands/impl/log/LogMainCommand.java | 2e5e6e731fa0904ed7d1a983f0b3fbdcb2f9bb59 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Decky1001/LuckPerms | a28fdf86b7d2e12d08e67fbd0d94b0d42bcb22f0 | 984bc5860f729ed667e7291106c0564bd2ae65ae | refs/heads/master | 2021-01-24T20:58:54.167804 | 2018-02-26T17:35:34 | 2018-02-26T17:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,510 | java | /*
* This file is part of LuckPerms, licensed under the MIT License.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.common.commands.impl.log;
import com.google.common.collect.ImmutableList;
import me.lucko.luckperms.common.actionlog.Log;
import me.lucko.luckperms.common.commands.abstraction.Command;
import me.lucko.luckperms.common.commands.abstraction.MainCommand;
import me.lucko.luckperms.common.commands.sender.Sender;
import me.lucko.luckperms.common.locale.CommandSpec;
import me.lucko.luckperms.common.locale.LocaleManager;
import me.lucko.luckperms.common.locale.Message;
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
public class LogMainCommand extends MainCommand<Log, Object> {
private final ReentrantLock lock = new ReentrantLock();
public LogMainCommand(LocaleManager locale) {
super(CommandSpec.LOG.spec(locale), "Log", 1, ImmutableList.<Command<Log, ?>>builder()
.add(new LogRecent(locale))
.add(new LogSearch(locale))
.add(new LogNotify(locale))
.add(new LogUserHistory(locale))
.add(new LogGroupHistory(locale))
.add(new LogTrackHistory(locale))
.build()
);
}
@Override
protected ReentrantLock getLockForTarget(Object target) {
return this.lock; // all commands target the same log, so we share a lock between all "targets"
}
@Override
protected Object parseTarget(String target, LuckPermsPlugin plugin, Sender sender) {
return this;
}
@Override
protected Log getTarget(Object target, LuckPermsPlugin plugin, Sender sender) {
Log log = plugin.getStorage().getLog().join();
if (log == null) {
Message.LOG_LOAD_ERROR.send(sender);
}
return log;
}
@Override
protected void cleanup(Log log, LuckPermsPlugin plugin) {
}
@Override
protected List<String> getTargets(LuckPermsPlugin plugin) {
return null; // only used for tab completion in super, and we override this method
}
@Override
public List<String> tabComplete(LuckPermsPlugin plugin, Sender sender, List<String> args) {
final List<Command<Log, ?>> subs = getChildren().get().stream()
.filter(s -> s.isAuthorized(sender))
.collect(Collectors.toList());
if (args.size() <= 1) {
if (args.isEmpty() || args.get(0).equalsIgnoreCase("")) {
return subs.stream()
.map(m -> m.getName().toLowerCase())
.collect(Collectors.toList());
}
return subs.stream()
.map(m -> m.getName().toLowerCase())
.filter(s -> s.toLowerCase().startsWith(args.get(0).toLowerCase()))
.collect(Collectors.toList());
}
Optional<Command<Log, ?>> o = subs.stream()
.filter(s -> s.getName().equalsIgnoreCase(args.get(0)))
.limit(1)
.findAny();
return o.map(cmd -> cmd.tabComplete(plugin, sender, args.subList(1, args.size()))).orElseGet(Collections::emptyList);
}
}
| [
"git@lucko.me"
] | git@lucko.me |
490f2d75fca51ef2842e4d88754f925a122aae66 | 9b490fb70e6369087f21067638c1349cf8d289c0 | /codechefta/b.java | b4ea70d46940a17b1c93b32cf66f11a5f57b3588 | [] | no_license | saikaushikk/Competitive-Programming | b71139b5fe0c04ba83b1e8e8978f88c07d3e0a4c | bc71490fbc34e037f39d0338713a6d2936ccaff2 | refs/heads/master | 2022-12-29T03:47:03.190395 | 2020-10-12T04:04:08 | 2020-10-12T04:04:08 | 266,067,957 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,171 | java | import java.util.*;
import java.io.*;
class Main{
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int snext() {
if (snumChars == -1)
throw new InputMismatchException();
if (curChar >= snumChars) {
curChar = 0;
try {
snumChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (snumChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = snext();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = snext();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = snext();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = snext();
} while (!isSpaceChar(c));
return res * sgn;
}
public int[] nextIntArray(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
public String readString() {
int c = snext();
while (isSpaceChar(c)) {
c = snext();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = snext();
} while (!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c = snext();
while (isSpaceChar(c))
c = snext();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = snext();
} while (!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void print(Object...objects) {
for (int i = 0; i < objects.length; i++) {
if (i != 0)
writer.print(' ');
writer.print(objects[i]);
}
}
public void printLine(Object...objects) {
print(objects);
writer.println();
}
public void close() {
writer.close();
}
public void flush() {
writer.flush();
}
}
static int gcd(int a, int b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
static int mod = (int)(1e9+7);
public static long pow(long a,long b)
{
long ans = 1;
while(b> 0)
{
if((b & 1)==1){
ans = (ans*a) % mod;
}
a = (a*a) % mod;
b = b>>1;
}
return ans;
}
static List<List<Integer>> adj;
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
int n = in.nextInt(),m = in.nextInt();
adj = new ArrayList<>();
for(int i=0;i<n;i++)
adj.add(new ArrayList<>());
for(int i=0;i<m;i++)
{
int u = in.nextInt()-1,v = in.nextInt()-1;
adj.get(u).add(v);
adj.get(v).add(u);
}
out.flush();
out.close();
}
} | [
"saikaushik333@gmail.com"
] | saikaushik333@gmail.com |
6d8cf4fe532a236217f12bd00391560268cb9353 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /datav-outer-20190402/src/main/java/com/aliyun/datav_outer20190402/models/ListTemplateByIdsResponseBody.java | 4be1650dad86d8c460b9066091808d976888e0a2 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 3,207 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.datav_outer20190402.models;
import com.aliyun.tea.*;
public class ListTemplateByIdsResponseBody extends TeaModel {
@NameInMap("RequestId")
public String requestId;
@NameInMap("Templates")
public java.util.List<ListTemplateByIdsResponseBodyTemplates> templates;
public static ListTemplateByIdsResponseBody build(java.util.Map<String, ?> map) throws Exception {
ListTemplateByIdsResponseBody self = new ListTemplateByIdsResponseBody();
return TeaModel.build(map, self);
}
public ListTemplateByIdsResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public ListTemplateByIdsResponseBody setTemplates(java.util.List<ListTemplateByIdsResponseBodyTemplates> templates) {
this.templates = templates;
return this;
}
public java.util.List<ListTemplateByIdsResponseBodyTemplates> getTemplates() {
return this.templates;
}
public static class ListTemplateByIdsResponseBodyTemplates extends TeaModel {
@NameInMap("WorkspaceId")
public String workspaceId;
@NameInMap("Size")
public String size;
@NameInMap("Name")
public String name;
@NameInMap("Thumbnail")
public String thumbnail;
@NameInMap("Config")
public String config;
@NameInMap("ID")
public String ID;
public static ListTemplateByIdsResponseBodyTemplates build(java.util.Map<String, ?> map) throws Exception {
ListTemplateByIdsResponseBodyTemplates self = new ListTemplateByIdsResponseBodyTemplates();
return TeaModel.build(map, self);
}
public ListTemplateByIdsResponseBodyTemplates setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
return this;
}
public String getWorkspaceId() {
return this.workspaceId;
}
public ListTemplateByIdsResponseBodyTemplates setSize(String size) {
this.size = size;
return this;
}
public String getSize() {
return this.size;
}
public ListTemplateByIdsResponseBodyTemplates setName(String name) {
this.name = name;
return this;
}
public String getName() {
return this.name;
}
public ListTemplateByIdsResponseBodyTemplates setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
return this;
}
public String getThumbnail() {
return this.thumbnail;
}
public ListTemplateByIdsResponseBodyTemplates setConfig(String config) {
this.config = config;
return this;
}
public String getConfig() {
return this.config;
}
public ListTemplateByIdsResponseBodyTemplates setID(String ID) {
this.ID = ID;
return this;
}
public String getID() {
return this.ID;
}
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
7699374f9d808f02a5fece7cb52d88b9c6224a2b | 84e9d24cd3f7c38a7619a52e333947aa0780b726 | /src/main/java/com/aldeir/springProject/services/DBService.java | 0e7bbf993d34fb59eb57515eca62a1c7163fbc71 | [] | no_license | aldeirfrancisco/database_estudos | ee4ffdcd3d870caa7e0c7936c4a10a3042da445a | 1ee2aca5eb41958f4e519a6cf14e1c806a0d835d | refs/heads/master | 2022-12-21T12:29:34.258331 | 2020-09-10T00:27:44 | 2020-09-10T00:27:44 | 286,561,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,123 | java | package com.aldeir.springProject.services;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aldeir.springProject.domain.Categoria;
import com.aldeir.springProject.domain.Cidade;
import com.aldeir.springProject.domain.Cliente;
import com.aldeir.springProject.domain.Endereco;
import com.aldeir.springProject.domain.Estado;
import com.aldeir.springProject.domain.EstadoPagamento;
import com.aldeir.springProject.domain.ItemPedido;
import com.aldeir.springProject.domain.Pagamento;
import com.aldeir.springProject.domain.PagamentoComBoleto;
import com.aldeir.springProject.domain.PagamentoComCartao;
import com.aldeir.springProject.domain.Pedido;
import com.aldeir.springProject.domain.Produto;
import com.aldeir.springProject.domain.enums.TipoCliente;
import com.aldeir.springProject.repositories.CategoriaRepository;
import com.aldeir.springProject.repositories.CidadeRepository;
import com.aldeir.springProject.repositories.ClienteRepository;
import com.aldeir.springProject.repositories.EnderecoRepository;
import com.aldeir.springProject.repositories.EstadoRepository;
import com.aldeir.springProject.repositories.ItemPedidoRepository;
import com.aldeir.springProject.repositories.PagamentoRepository;
import com.aldeir.springProject.repositories.PedidoRepository;
import com.aldeir.springProject.repositories.ProdutoRepository;
@Service
public class DBService {
@Autowired
private CategoriaRepository categoriaRepository;
@Autowired
private ProdutoRepository produtoRepository;
@Autowired
private EstadoRepository estadoRepository;
@Autowired
private CidadeRepository cidadeRepository;
@Autowired
private ClienteRepository clienteRepository;
@Autowired
private EnderecoRepository enderecoRepository;
@Autowired
PedidoRepository pedidoRepository;
@Autowired
PagamentoRepository pagamentoRepository;
@Autowired
ItemPedidoRepository itemPedidoRepository;
public void instantiateTestDatabase() throws ParseException {
Categoria cat = new Categoria(null,"Informatica");
Categoria cat2 = new Categoria(null,"Escritorio");
Categoria cat3 = new Categoria(null,"Cama mesa e banho");
Categoria cat4 = new Categoria(null,"Eletrônico");
Categoria cat5 = new Categoria(null,"Jardinagem");
Categoria cat6 = new Categoria(null,"Decoração");
Categoria cat7 = new Categoria(null,"Perfumaria");
Produto p1 = new Produto(null,"Computador", 2000.00);
Produto p2 = new Produto(null,"Impressora", 800.00);
Produto p3 = new Produto(null,"Mouse", 80.00);
Produto p4 = new Produto(null,"Mesa de escritório", 300.00);
Produto p5 = new Produto(null,"Toalha", 50.00);
Produto p6 = new Produto(null,"Colcha", 200.00);
Produto p7 = new Produto(null,"TV true color", 1200.00);
Produto p8 = new Produto(null,"Roçadeira", 800.00);
Produto p9 = new Produto(null,"Abajour", 100.00);
Produto p10 = new Produto(null,"Pendente", 180.00);
Produto p11 = new Produto(null,"Shampoo", 90.00);
p1.getCategorias().addAll(Arrays.asList(cat,cat4));
p2.getCategorias().addAll(Arrays.asList(cat,cat2,cat4));//associando categoria ao produto
p3.getCategorias().addAll(Arrays.asList(cat,cat4));
p4.getCategorias().addAll(Arrays.asList(cat2));
p5.getCategorias().addAll(Arrays.asList(cat3));
p6.getCategorias().addAll(Arrays.asList(cat3));
p7.getCategorias().addAll(Arrays.asList(cat4));
p8.getCategorias().addAll(Arrays.asList(cat5));
p9.getCategorias().addAll(Arrays.asList(cat6));
p10.getCategorias().addAll(Arrays.asList(cat6));
p11.getCategorias().addAll(Arrays.asList(cat7));
cat.getProdutos().addAll(Arrays.asList(p1,p2,p3)); //associando produtos ao categoria
cat2.getProdutos().addAll(Arrays.asList(p2,p4));
cat3.getProdutos().addAll(Arrays.asList(p5,p6));
cat4.getProdutos().addAll(Arrays.asList(p1,p2, p3, p7));
cat5.getProdutos().addAll(Arrays.asList(p8));
cat6.getProdutos().addAll(Arrays.asList(p9,p10));
cat7.getProdutos().addAll(Arrays.asList(p11));
categoriaRepository.saveAll(Arrays.asList(cat,cat2,cat3,cat4,cat5,cat6,cat7)); //salvando as categorias
produtoRepository.saveAll(Arrays.asList(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11));//salvando os produtos
Estado est1 = new Estado(null, "Minas Gerais");
Estado est2 = new Estado(null, "São Paulo");
Cidade c1= new Cidade(null, "Uberlândia", est1); //associação entre cidade e estado
Cidade c2= new Cidade(null, "São Paulo", est2);
Cidade c3= new Cidade(null, "Campinas", est2);
est1.getCidades().addAll(Arrays.asList(c1));
est2.getCidades().addAll(Arrays.asList(c2,c3));//associação entre estado e cidade
estadoRepository.saveAll(Arrays.asList(est1,est2));
cidadeRepository.saveAll(Arrays.asList(c1,c2,c3));
Cliente cli1 = new Cliente(null,"Maria Silva" ,"maria@gmail.com","36378912377", TipoCliente.PESSOAFISICA);
cli1.getTelefone().addAll(Arrays.asList("27363323","93838393"));
Endereco e1 = new Endereco(null, "Rua Flores", "300", "Apto 303","Jardim","38220834",cli1, c1);
Endereco e2 =new Endereco(null, "AvenidaMatos","105","Sala 800","Centro","38777012", cli1, c2);
cli1.getEnderecos().addAll(Arrays.asList(e1,e2));
clienteRepository.saveAll(Arrays.asList(cli1));
enderecoRepository.saveAll(Arrays.asList(e1,e2));
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
Pedido ped1 = new Pedido(null, sdf.parse("30/09/2017 10:32"),cli1,e1);
Pedido ped2 = new Pedido(null, sdf.parse("25/07/2020 21:37"), cli1,e2);
Pagamento pagt1 = new PagamentoComCartao(null,EstadoPagamento.QUITADO, ped1,6);
ped1.setPagamento(pagt1);
Pagamento pagt2 = new PagamentoComBoleto(null,EstadoPagamento.PENDENTE, ped2,sdf.parse("24/07/2020 22:42"), null);
ped2.setPagamento(pagt2);
cli1.getPedido().addAll(Arrays.asList(ped1,ped2));
pedidoRepository.saveAll(Arrays.asList(ped1,ped2));
pagamentoRepository.saveAll(Arrays.asList(pagt1,pagt2));
ItemPedido ip1 = new ItemPedido(ped1, p1, 0.00, 1, 2000.00);
ItemPedido ip2 = new ItemPedido(ped1, p3, 0.00, 2, 80.00);
ItemPedido ip3 = new ItemPedido(ped2, p2, 100.00, 1, 800.00);
ped1.getItens().addAll(Arrays.asList(ip1,ip2));
ped2.getItens().addAll(Arrays.asList(ip3));
p1.getItens().addAll(Arrays.asList(ip1));
p2.getItens().addAll(Arrays.asList(ip3));
p3.getItens().addAll(Arrays.asList(ip2));
itemPedidoRepository.saveAll(Arrays.asList(ip1,ip2,ip3));
}
}
| [
"dide123francisco@gmail.com"
] | dide123francisco@gmail.com |
1a1fa75ac9f0a519c2cc92fd3c5f2f48d5ec96e2 | 15a06e2f9cb8215087df5c63d61bd2f03c67cc22 | /src/main/java/jp/luxa/lom/mylasta/direction/sponsor/LomCookieResourceProvider.java | 677ba42e82d28499208f2ff12036b0093a9c60b8 | [
"Apache-2.0"
] | permissive | lx-organization-management/lom | a8ad165e969953dffd7da7d69776e2fa168c0438 | 3bf8810b93fa95e9c460d2e246e0bf1d5f317fa1 | refs/heads/master | 2021-04-06T06:24:41.087427 | 2018-03-23T10:30:03 | 2018-03-23T10:30:03 | 124,818,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,508 | java | /*
* Copyright 2015-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 jp.luxa.lom.mylasta.direction.sponsor;
import jp.luxa.lom.mylasta.direction.LomConfig;
import org.lastaflute.core.security.InvertibleCryptographer;
import org.lastaflute.web.servlet.cookie.CookieResourceProvider;
/**
* @author jflute
*/
public class LomCookieResourceProvider implements CookieResourceProvider {
protected final LomConfig config;
protected final InvertibleCryptographer cookieCipher;
public LomCookieResourceProvider(LomConfig config, InvertibleCryptographer cookieCipher) {
this.config = config;
this.cookieCipher = cookieCipher;
}
public String provideDefaultPath() {
return config.getCookieDefaultPath();
}
public Integer provideDefaultExpire() {
return config.getCookieDefaultExpireAsInteger();
}
public InvertibleCryptographer provideCipher() {
return cookieCipher;
}
}
| [
"shogo.kataoka@luxa.co.jp"
] | shogo.kataoka@luxa.co.jp |
88bdce193c22e83eaf08d5342abb4d70d55b7215 | d3e8ca7ff9000566830d55308096c73a87d9c8c7 | /app/src/main/java/com/whoopedu/vrime/data/open_weather_map/WeatherCondition.java | 16e50882155f48dfcc86d4e1d873e6479917f265 | [] | no_license | abdulmedzid/Vrime | 9becce136751031dfb1e7d971b43287570213b7a | b48191ad2727f6b01f51e6b40f0b50b13b60544d | refs/heads/master | 2023-06-03T21:49:49.875667 | 2021-06-18T09:02:16 | 2021-06-18T09:02:16 | 374,735,726 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.whoopedu.vrime.data.open_weather_map;
public class WeatherCondition {
public int id;
public String main;
public String description;
public WeatherCondition(int id,
String main,
String description) {
this.id = id;
this.main = main;
this.description = description;
}
} | [
"abdulmedzidpehlic@gmail.com"
] | abdulmedzidpehlic@gmail.com |
613cf45620f68869614058c49d41b9ebc071cc4a | 6fe34c082d0f1f58ab8d930bfd88e1ccc708ef62 | /aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/AWSServiceCatalogClient.java | 0a5fe7627fcfbd4d51fe95749ba609e6f359b888 | [
"Apache-2.0"
] | permissive | vidyann/aws-sdk-java | 57b717d137f080fe3dd006814e4f40c052559d49 | f30e0b30c3d9a122f0d71b943d5b52f4d78fef51 | refs/heads/master | 2020-04-10T03:57:45.563673 | 2018-12-06T23:17:07 | 2018-12-06T23:17:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257,654 | java | /*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.servicecatalog;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.servicecatalog.AWSServiceCatalogClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.servicecatalog.model.*;
import com.amazonaws.services.servicecatalog.model.transform.*;
/**
* Client for accessing AWS Service Catalog. All service calls made using this client are blocking, and will not return
* until the service call completes.
* <p>
* <fullname>AWS Service Catalog</fullname>
* <p>
* <a href="https://aws.amazon.com/servicecatalog/">AWS Service Catalog</a> enables organizations to create and manage
* catalogs of IT services that are approved for use on AWS. To get the most out of this documentation, you should be
* familiar with the terminology discussed in <a
* href="http://docs.aws.amazon.com/servicecatalog/latest/adminguide/what-is_concepts.html">AWS Service Catalog
* Concepts</a>.
* </p>
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSServiceCatalogClient extends AmazonWebServiceClient implements AWSServiceCatalog {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AWSServiceCatalog.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "servicecatalog";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidParametersException").withModeledClass(
com.amazonaws.services.servicecatalog.model.InvalidParametersException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("OperationNotSupportedException").withModeledClass(
com.amazonaws.services.servicecatalog.model.OperationNotSupportedException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InvalidStateException").withModeledClass(
com.amazonaws.services.servicecatalog.model.InvalidStateException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("DuplicateResourceException").withModeledClass(
com.amazonaws.services.servicecatalog.model.DuplicateResourceException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("LimitExceededException").withModeledClass(
com.amazonaws.services.servicecatalog.model.LimitExceededException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withModeledClass(
com.amazonaws.services.servicecatalog.model.ResourceNotFoundException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("TagOptionNotMigratedException").withModeledClass(
com.amazonaws.services.servicecatalog.model.TagOptionNotMigratedException.class))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceInUseException").withModeledClass(
com.amazonaws.services.servicecatalog.model.ResourceInUseException.class))
.withBaseServiceExceptionClass(com.amazonaws.services.servicecatalog.model.AWSServiceCatalogException.class));
/**
* Constructs a new client to invoke service methods on AWS Service Catalog. A credentials provider chain will be
* used that searches for credentials in this order:
* <ul>
* <li>Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY</li>
* <li>Java System Properties - aws.accessKeyId and aws.secretKey</li>
* <li>Instance profile credentials delivered through the Amazon EC2 metadata service</li>
* </ul>
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @see DefaultAWSCredentialsProviderChain
* @deprecated use {@link AWSServiceCatalogClientBuilder#defaultClient()}
*/
@Deprecated
public AWSServiceCatalogClient() {
this(DefaultAWSCredentialsProviderChain.getInstance(), configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Service Catalog. A credentials provider chain will be
* used that searches for credentials in this order:
* <ul>
* <li>Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY</li>
* <li>Java System Properties - aws.accessKeyId and aws.secretKey</li>
* <li>Instance profile credentials delivered through the Amazon EC2 metadata service</li>
* </ul>
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWS Service Catalog (ex: proxy
* settings, retry counts, etc.).
*
* @see DefaultAWSCredentialsProviderChain
* @deprecated use {@link AWSServiceCatalogClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSServiceCatalogClient(ClientConfiguration clientConfiguration) {
this(DefaultAWSCredentialsProviderChain.getInstance(), clientConfiguration);
}
/**
* Constructs a new client to invoke service methods on AWS Service Catalog using the specified AWS account
* credentials.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @deprecated use {@link AWSServiceCatalogClientBuilder#withCredentials(AWSCredentialsProvider)} for example:
* {@code AWSServiceCatalogClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();}
*/
@Deprecated
public AWSServiceCatalogClient(AWSCredentials awsCredentials) {
this(awsCredentials, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Service Catalog using the specified AWS account
* credentials and client configuration options.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentials
* The AWS credentials (access key ID and secret key) to use when authenticating with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWS Service Catalog (ex: proxy
* settings, retry counts, etc.).
* @deprecated use {@link AWSServiceCatalogClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSServiceCatalogClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSServiceCatalogClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) {
super(clientConfiguration);
this.awsCredentialsProvider = new StaticCredentialsProvider(awsCredentials);
this.advancedConfig = AdvancedConfig.EMPTY;
init();
}
/**
* Constructs a new client to invoke service methods on AWS Service Catalog using the specified AWS account
* credentials provider.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @deprecated use {@link AWSServiceCatalogClientBuilder#withCredentials(AWSCredentialsProvider)}
*/
@Deprecated
public AWSServiceCatalogClient(AWSCredentialsProvider awsCredentialsProvider) {
this(awsCredentialsProvider, configFactory.getConfig());
}
/**
* Constructs a new client to invoke service methods on AWS Service Catalog using the specified AWS account
* credentials provider and client configuration options.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWS Service Catalog (ex: proxy
* settings, retry counts, etc.).
* @deprecated use {@link AWSServiceCatalogClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSServiceCatalogClientBuilder#withClientConfiguration(ClientConfiguration)}
*/
@Deprecated
public AWSServiceCatalogClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration) {
this(awsCredentialsProvider, clientConfiguration, null);
}
/**
* Constructs a new client to invoke service methods on AWS Service Catalog using the specified AWS account
* credentials provider, client configuration options, and request metric collector.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param awsCredentialsProvider
* The AWS credentials provider which will provide credentials to authenticate requests with AWS services.
* @param clientConfiguration
* The client configuration options controlling how this client connects to AWS Service Catalog (ex: proxy
* settings, retry counts, etc.).
* @param requestMetricCollector
* optional request metric collector
* @deprecated use {@link AWSServiceCatalogClientBuilder#withCredentials(AWSCredentialsProvider)} and
* {@link AWSServiceCatalogClientBuilder#withClientConfiguration(ClientConfiguration)} and
* {@link AWSServiceCatalogClientBuilder#withMetricsCollector(RequestMetricCollector)}
*/
@Deprecated
public AWSServiceCatalogClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration,
RequestMetricCollector requestMetricCollector) {
super(clientConfiguration, requestMetricCollector);
this.awsCredentialsProvider = awsCredentialsProvider;
this.advancedConfig = AdvancedConfig.EMPTY;
init();
}
public static AWSServiceCatalogClientBuilder builder() {
return AWSServiceCatalogClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on AWS Service Catalog using the specified parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSServiceCatalogClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on AWS Service Catalog using the specified parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSServiceCatalogClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("servicecatalog.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/servicecatalog/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/servicecatalog/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
* <p>
* Accepts an offer to share the specified portfolio.
* </p>
*
* @param acceptPortfolioShareRequest
* @return Result of the AcceptPortfolioShare operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @sample AWSServiceCatalog.AcceptPortfolioShare
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/AcceptPortfolioShare"
* target="_top">AWS API Documentation</a>
*/
@Override
public AcceptPortfolioShareResult acceptPortfolioShare(AcceptPortfolioShareRequest request) {
request = beforeClientExecution(request);
return executeAcceptPortfolioShare(request);
}
@SdkInternalApi
final AcceptPortfolioShareResult executeAcceptPortfolioShare(AcceptPortfolioShareRequest acceptPortfolioShareRequest) {
ExecutionContext executionContext = createExecutionContext(acceptPortfolioShareRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<AcceptPortfolioShareRequest> request = null;
Response<AcceptPortfolioShareResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AcceptPortfolioShareRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(acceptPortfolioShareRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AcceptPortfolioShare");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<AcceptPortfolioShareResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AcceptPortfolioShareResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Associates the specified principal ARN with the specified portfolio.
* </p>
*
* @param associatePrincipalWithPortfolioRequest
* @return Result of the AssociatePrincipalWithPortfolio operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @sample AWSServiceCatalog.AssociatePrincipalWithPortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/AssociatePrincipalWithPortfolio"
* target="_top">AWS API Documentation</a>
*/
@Override
public AssociatePrincipalWithPortfolioResult associatePrincipalWithPortfolio(AssociatePrincipalWithPortfolioRequest request) {
request = beforeClientExecution(request);
return executeAssociatePrincipalWithPortfolio(request);
}
@SdkInternalApi
final AssociatePrincipalWithPortfolioResult executeAssociatePrincipalWithPortfolio(
AssociatePrincipalWithPortfolioRequest associatePrincipalWithPortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(associatePrincipalWithPortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<AssociatePrincipalWithPortfolioRequest> request = null;
Response<AssociatePrincipalWithPortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AssociatePrincipalWithPortfolioRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(associatePrincipalWithPortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociatePrincipalWithPortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<AssociatePrincipalWithPortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new AssociatePrincipalWithPortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Associates the specified product with the specified portfolio.
* </p>
*
* @param associateProductWithPortfolioRequest
* @return Result of the AssociateProductWithPortfolio operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @sample AWSServiceCatalog.AssociateProductWithPortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/AssociateProductWithPortfolio"
* target="_top">AWS API Documentation</a>
*/
@Override
public AssociateProductWithPortfolioResult associateProductWithPortfolio(AssociateProductWithPortfolioRequest request) {
request = beforeClientExecution(request);
return executeAssociateProductWithPortfolio(request);
}
@SdkInternalApi
final AssociateProductWithPortfolioResult executeAssociateProductWithPortfolio(AssociateProductWithPortfolioRequest associateProductWithPortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(associateProductWithPortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<AssociateProductWithPortfolioRequest> request = null;
Response<AssociateProductWithPortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AssociateProductWithPortfolioRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(associateProductWithPortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateProductWithPortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<AssociateProductWithPortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new AssociateProductWithPortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Associates a self-service action with a provisioning artifact.
* </p>
*
* @param associateServiceActionWithProvisioningArtifactRequest
* @return Result of the AssociateServiceActionWithProvisioningArtifact operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws DuplicateResourceException
* The specified resource is a duplicate.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @sample AWSServiceCatalog.AssociateServiceActionWithProvisioningArtifact
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/AssociateServiceActionWithProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public AssociateServiceActionWithProvisioningArtifactResult associateServiceActionWithProvisioningArtifact(
AssociateServiceActionWithProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeAssociateServiceActionWithProvisioningArtifact(request);
}
@SdkInternalApi
final AssociateServiceActionWithProvisioningArtifactResult executeAssociateServiceActionWithProvisioningArtifact(
AssociateServiceActionWithProvisioningArtifactRequest associateServiceActionWithProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(associateServiceActionWithProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<AssociateServiceActionWithProvisioningArtifactRequest> request = null;
Response<AssociateServiceActionWithProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AssociateServiceActionWithProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(associateServiceActionWithProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateServiceActionWithProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<AssociateServiceActionWithProvisioningArtifactResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new AssociateServiceActionWithProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Associate the specified TagOption with the specified portfolio or product.
* </p>
*
* @param associateTagOptionWithResourceRequest
* @return Result of the AssociateTagOptionWithResource operation returned by the service.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @throws DuplicateResourceException
* The specified resource is a duplicate.
* @throws InvalidStateException
* An attempt was made to modify a resource that is in a state that is not valid. Check your resources to
* ensure that they are in valid states before retrying the operation.
* @sample AWSServiceCatalog.AssociateTagOptionWithResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/AssociateTagOptionWithResource"
* target="_top">AWS API Documentation</a>
*/
@Override
public AssociateTagOptionWithResourceResult associateTagOptionWithResource(AssociateTagOptionWithResourceRequest request) {
request = beforeClientExecution(request);
return executeAssociateTagOptionWithResource(request);
}
@SdkInternalApi
final AssociateTagOptionWithResourceResult executeAssociateTagOptionWithResource(AssociateTagOptionWithResourceRequest associateTagOptionWithResourceRequest) {
ExecutionContext executionContext = createExecutionContext(associateTagOptionWithResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<AssociateTagOptionWithResourceRequest> request = null;
Response<AssociateTagOptionWithResourceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AssociateTagOptionWithResourceRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(associateTagOptionWithResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateTagOptionWithResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<AssociateTagOptionWithResourceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new AssociateTagOptionWithResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Associates multiple self-service actions with provisioning artifacts.
* </p>
*
* @param batchAssociateServiceActionWithProvisioningArtifactRequest
* @return Result of the BatchAssociateServiceActionWithProvisioningArtifact operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.BatchAssociateServiceActionWithProvisioningArtifact
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/BatchAssociateServiceActionWithProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public BatchAssociateServiceActionWithProvisioningArtifactResult batchAssociateServiceActionWithProvisioningArtifact(
BatchAssociateServiceActionWithProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeBatchAssociateServiceActionWithProvisioningArtifact(request);
}
@SdkInternalApi
final BatchAssociateServiceActionWithProvisioningArtifactResult executeBatchAssociateServiceActionWithProvisioningArtifact(
BatchAssociateServiceActionWithProvisioningArtifactRequest batchAssociateServiceActionWithProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(batchAssociateServiceActionWithProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<BatchAssociateServiceActionWithProvisioningArtifactRequest> request = null;
Response<BatchAssociateServiceActionWithProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchAssociateServiceActionWithProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(batchAssociateServiceActionWithProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchAssociateServiceActionWithProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<BatchAssociateServiceActionWithProvisioningArtifactResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new BatchAssociateServiceActionWithProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Disassociates a batch of self-service actions from the specified provisioning artifact.
* </p>
*
* @param batchDisassociateServiceActionFromProvisioningArtifactRequest
* @return Result of the BatchDisassociateServiceActionFromProvisioningArtifact operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.BatchDisassociateServiceActionFromProvisioningArtifact
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/BatchDisassociateServiceActionFromProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public BatchDisassociateServiceActionFromProvisioningArtifactResult batchDisassociateServiceActionFromProvisioningArtifact(
BatchDisassociateServiceActionFromProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeBatchDisassociateServiceActionFromProvisioningArtifact(request);
}
@SdkInternalApi
final BatchDisassociateServiceActionFromProvisioningArtifactResult executeBatchDisassociateServiceActionFromProvisioningArtifact(
BatchDisassociateServiceActionFromProvisioningArtifactRequest batchDisassociateServiceActionFromProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(batchDisassociateServiceActionFromProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<BatchDisassociateServiceActionFromProvisioningArtifactRequest> request = null;
Response<BatchDisassociateServiceActionFromProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchDisassociateServiceActionFromProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(batchDisassociateServiceActionFromProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchDisassociateServiceActionFromProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<BatchDisassociateServiceActionFromProvisioningArtifactResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new BatchDisassociateServiceActionFromProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Copies the specified source product to the specified target product or a new product.
* </p>
* <p>
* You can copy a product to the same account or another account. You can copy a product to the same region or
* another region.
* </p>
* <p>
* This operation is performed asynchronously. To track the progress of the operation, use
* <a>DescribeCopyProductStatus</a>.
* </p>
*
* @param copyProductRequest
* @return Result of the CopyProduct operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.CopyProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CopyProduct" target="_top">AWS API
* Documentation</a>
*/
@Override
public CopyProductResult copyProduct(CopyProductRequest request) {
request = beforeClientExecution(request);
return executeCopyProduct(request);
}
@SdkInternalApi
final CopyProductResult executeCopyProduct(CopyProductRequest copyProductRequest) {
ExecutionContext executionContext = createExecutionContext(copyProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CopyProductRequest> request = null;
Response<CopyProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CopyProductRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(copyProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CopyProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CopyProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CopyProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Creates a constraint.
* </p>
*
* @param createConstraintRequest
* @return Result of the CreateConstraint operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @throws DuplicateResourceException
* The specified resource is a duplicate.
* @sample AWSServiceCatalog.CreateConstraint
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CreateConstraint"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateConstraintResult createConstraint(CreateConstraintRequest request) {
request = beforeClientExecution(request);
return executeCreateConstraint(request);
}
@SdkInternalApi
final CreateConstraintResult executeCreateConstraint(CreateConstraintRequest createConstraintRequest) {
ExecutionContext executionContext = createExecutionContext(createConstraintRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateConstraintRequest> request = null;
Response<CreateConstraintResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateConstraintRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createConstraintRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateConstraint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateConstraintResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateConstraintResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Creates a portfolio.
* </p>
*
* @param createPortfolioRequest
* @return Result of the CreatePortfolio operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @sample AWSServiceCatalog.CreatePortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CreatePortfolio" target="_top">AWS
* API Documentation</a>
*/
@Override
public CreatePortfolioResult createPortfolio(CreatePortfolioRequest request) {
request = beforeClientExecution(request);
return executeCreatePortfolio(request);
}
@SdkInternalApi
final CreatePortfolioResult executeCreatePortfolio(CreatePortfolioRequest createPortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(createPortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreatePortfolioRequest> request = null;
Response<CreatePortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreatePortfolioRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createPortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreatePortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreatePortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreatePortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Shares the specified portfolio with the specified account or organization node. Shares to an organization node
* can only be created by the master account of an Organization. AWSOrganizationsAccess must be enabled in order to
* create a portfolio share to an organization node.
* </p>
*
* @param createPortfolioShareRequest
* @return Result of the CreatePortfolioShare operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws OperationNotSupportedException
* The operation is not supported.
* @sample AWSServiceCatalog.CreatePortfolioShare
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CreatePortfolioShare"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreatePortfolioShareResult createPortfolioShare(CreatePortfolioShareRequest request) {
request = beforeClientExecution(request);
return executeCreatePortfolioShare(request);
}
@SdkInternalApi
final CreatePortfolioShareResult executeCreatePortfolioShare(CreatePortfolioShareRequest createPortfolioShareRequest) {
ExecutionContext executionContext = createExecutionContext(createPortfolioShareRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreatePortfolioShareRequest> request = null;
Response<CreatePortfolioShareResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreatePortfolioShareRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createPortfolioShareRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreatePortfolioShare");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreatePortfolioShareResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreatePortfolioShareResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Creates a product.
* </p>
*
* @param createProductRequest
* @return Result of the CreateProduct operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @sample AWSServiceCatalog.CreateProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CreateProduct" target="_top">AWS
* API Documentation</a>
*/
@Override
public CreateProductResult createProduct(CreateProductRequest request) {
request = beforeClientExecution(request);
return executeCreateProduct(request);
}
@SdkInternalApi
final CreateProductResult executeCreateProduct(CreateProductRequest createProductRequest) {
ExecutionContext executionContext = createExecutionContext(createProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateProductRequest> request = null;
Response<CreateProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateProductRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Creates a plan. A plan includes the list of resources to be created (when provisioning a new product) or modified
* (when updating a provisioned product) when the plan is executed.
* </p>
* <p>
* You can create one plan per provisioned product. To create a plan for an existing provisioned product, the
* product status must be AVAILBLE or TAINTED.
* </p>
* <p>
* To view the resource changes in the change set, use <a>DescribeProvisionedProductPlan</a>. To create or modify
* the provisioned product, use <a>ExecuteProvisionedProductPlan</a>.
* </p>
*
* @param createProvisionedProductPlanRequest
* @return Result of the CreateProvisionedProductPlan operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidStateException
* An attempt was made to modify a resource that is in a state that is not valid. Check your resources to
* ensure that they are in valid states before retrying the operation.
* @sample AWSServiceCatalog.CreateProvisionedProductPlan
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CreateProvisionedProductPlan"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateProvisionedProductPlanResult createProvisionedProductPlan(CreateProvisionedProductPlanRequest request) {
request = beforeClientExecution(request);
return executeCreateProvisionedProductPlan(request);
}
@SdkInternalApi
final CreateProvisionedProductPlanResult executeCreateProvisionedProductPlan(CreateProvisionedProductPlanRequest createProvisionedProductPlanRequest) {
ExecutionContext executionContext = createExecutionContext(createProvisionedProductPlanRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateProvisionedProductPlanRequest> request = null;
Response<CreateProvisionedProductPlanResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateProvisionedProductPlanRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(createProvisionedProductPlanRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateProvisionedProductPlan");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateProvisionedProductPlanResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new CreateProvisionedProductPlanResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Creates a provisioning artifact (also known as a version) for the specified product.
* </p>
* <p>
* You cannot create a provisioning artifact for a product that was shared with you.
* </p>
*
* @param createProvisioningArtifactRequest
* @return Result of the CreateProvisioningArtifact operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @sample AWSServiceCatalog.CreateProvisioningArtifact
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CreateProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateProvisioningArtifactResult createProvisioningArtifact(CreateProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeCreateProvisioningArtifact(request);
}
@SdkInternalApi
final CreateProvisioningArtifactResult executeCreateProvisioningArtifact(CreateProvisioningArtifactRequest createProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(createProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateProvisioningArtifactRequest> request = null;
Response<CreateProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(createProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateProvisioningArtifactResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new CreateProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Creates a self-service action.
* </p>
*
* @param createServiceActionRequest
* @return Result of the CreateServiceAction operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @sample AWSServiceCatalog.CreateServiceAction
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CreateServiceAction"
* target="_top">AWS API Documentation</a>
*/
@Override
public CreateServiceActionResult createServiceAction(CreateServiceActionRequest request) {
request = beforeClientExecution(request);
return executeCreateServiceAction(request);
}
@SdkInternalApi
final CreateServiceActionResult executeCreateServiceAction(CreateServiceActionRequest createServiceActionRequest) {
ExecutionContext executionContext = createExecutionContext(createServiceActionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateServiceActionRequest> request = null;
Response<CreateServiceActionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateServiceActionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createServiceActionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateServiceAction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateServiceActionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateServiceActionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Creates a TagOption.
* </p>
*
* @param createTagOptionRequest
* @return Result of the CreateTagOption operation returned by the service.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @throws DuplicateResourceException
* The specified resource is a duplicate.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @sample AWSServiceCatalog.CreateTagOption
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/CreateTagOption" target="_top">AWS
* API Documentation</a>
*/
@Override
public CreateTagOptionResult createTagOption(CreateTagOptionRequest request) {
request = beforeClientExecution(request);
return executeCreateTagOption(request);
}
@SdkInternalApi
final CreateTagOptionResult executeCreateTagOption(CreateTagOptionRequest createTagOptionRequest) {
ExecutionContext executionContext = createExecutionContext(createTagOptionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<CreateTagOptionRequest> request = null;
Response<CreateTagOptionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateTagOptionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createTagOptionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateTagOption");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<CreateTagOptionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateTagOptionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes the specified constraint.
* </p>
*
* @param deleteConstraintRequest
* @return Result of the DeleteConstraint operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.DeleteConstraint
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DeleteConstraint"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteConstraintResult deleteConstraint(DeleteConstraintRequest request) {
request = beforeClientExecution(request);
return executeDeleteConstraint(request);
}
@SdkInternalApi
final DeleteConstraintResult executeDeleteConstraint(DeleteConstraintRequest deleteConstraintRequest) {
ExecutionContext executionContext = createExecutionContext(deleteConstraintRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteConstraintRequest> request = null;
Response<DeleteConstraintResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteConstraintRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteConstraintRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteConstraint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteConstraintResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteConstraintResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes the specified portfolio.
* </p>
* <p>
* You cannot delete a portfolio if it was shared with you or if it has associated products, users, constraints, or
* shared accounts.
* </p>
*
* @param deletePortfolioRequest
* @return Result of the DeletePortfolio operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceInUseException
* A resource that is currently in use. Ensure that the resource is not in use and retry the operation.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @sample AWSServiceCatalog.DeletePortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DeletePortfolio" target="_top">AWS
* API Documentation</a>
*/
@Override
public DeletePortfolioResult deletePortfolio(DeletePortfolioRequest request) {
request = beforeClientExecution(request);
return executeDeletePortfolio(request);
}
@SdkInternalApi
final DeletePortfolioResult executeDeletePortfolio(DeletePortfolioRequest deletePortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(deletePortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeletePortfolioRequest> request = null;
Response<DeletePortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeletePortfolioRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deletePortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeletePortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeletePortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeletePortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Stops sharing the specified portfolio with the specified account or organization node. Shares to an organization
* node can only be deleted by the master account of an Organization.
* </p>
*
* @param deletePortfolioShareRequest
* @return Result of the DeletePortfolioShare operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws OperationNotSupportedException
* The operation is not supported.
* @sample AWSServiceCatalog.DeletePortfolioShare
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DeletePortfolioShare"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeletePortfolioShareResult deletePortfolioShare(DeletePortfolioShareRequest request) {
request = beforeClientExecution(request);
return executeDeletePortfolioShare(request);
}
@SdkInternalApi
final DeletePortfolioShareResult executeDeletePortfolioShare(DeletePortfolioShareRequest deletePortfolioShareRequest) {
ExecutionContext executionContext = createExecutionContext(deletePortfolioShareRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeletePortfolioShareRequest> request = null;
Response<DeletePortfolioShareResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeletePortfolioShareRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deletePortfolioShareRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeletePortfolioShare");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeletePortfolioShareResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeletePortfolioShareResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes the specified product.
* </p>
* <p>
* You cannot delete a product if it was shared with you or is associated with a portfolio.
* </p>
*
* @param deleteProductRequest
* @return Result of the DeleteProduct operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws ResourceInUseException
* A resource that is currently in use. Ensure that the resource is not in use and retry the operation.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @sample AWSServiceCatalog.DeleteProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DeleteProduct" target="_top">AWS
* API Documentation</a>
*/
@Override
public DeleteProductResult deleteProduct(DeleteProductRequest request) {
request = beforeClientExecution(request);
return executeDeleteProduct(request);
}
@SdkInternalApi
final DeleteProductResult executeDeleteProduct(DeleteProductRequest deleteProductRequest) {
ExecutionContext executionContext = createExecutionContext(deleteProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteProductRequest> request = null;
Response<DeleteProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteProductRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes the specified plan.
* </p>
*
* @param deleteProvisionedProductPlanRequest
* @return Result of the DeleteProvisionedProductPlan operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DeleteProvisionedProductPlan
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DeleteProvisionedProductPlan"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteProvisionedProductPlanResult deleteProvisionedProductPlan(DeleteProvisionedProductPlanRequest request) {
request = beforeClientExecution(request);
return executeDeleteProvisionedProductPlan(request);
}
@SdkInternalApi
final DeleteProvisionedProductPlanResult executeDeleteProvisionedProductPlan(DeleteProvisionedProductPlanRequest deleteProvisionedProductPlanRequest) {
ExecutionContext executionContext = createExecutionContext(deleteProvisionedProductPlanRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteProvisionedProductPlanRequest> request = null;
Response<DeleteProvisionedProductPlanResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteProvisionedProductPlanRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(deleteProvisionedProductPlanRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteProvisionedProductPlan");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteProvisionedProductPlanResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteProvisionedProductPlanResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes the specified provisioning artifact (also known as a version) for the specified product.
* </p>
* <p>
* You cannot delete a provisioning artifact associated with a product that was shared with you. You cannot delete
* the last provisioning artifact for a product, because a product must have at least one provisioning artifact.
* </p>
*
* @param deleteProvisioningArtifactRequest
* @return Result of the DeleteProvisioningArtifact operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws ResourceInUseException
* A resource that is currently in use. Ensure that the resource is not in use and retry the operation.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.DeleteProvisioningArtifact
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DeleteProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteProvisioningArtifactResult deleteProvisioningArtifact(DeleteProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeDeleteProvisioningArtifact(request);
}
@SdkInternalApi
final DeleteProvisioningArtifactResult executeDeleteProvisioningArtifact(DeleteProvisioningArtifactRequest deleteProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(deleteProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteProvisioningArtifactRequest> request = null;
Response<DeleteProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(deleteProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteProvisioningArtifactResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes a self-service action.
* </p>
*
* @param deleteServiceActionRequest
* @return Result of the DeleteServiceAction operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws ResourceInUseException
* A resource that is currently in use. Ensure that the resource is not in use and retry the operation.
* @sample AWSServiceCatalog.DeleteServiceAction
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DeleteServiceAction"
* target="_top">AWS API Documentation</a>
*/
@Override
public DeleteServiceActionResult deleteServiceAction(DeleteServiceActionRequest request) {
request = beforeClientExecution(request);
return executeDeleteServiceAction(request);
}
@SdkInternalApi
final DeleteServiceActionResult executeDeleteServiceAction(DeleteServiceActionRequest deleteServiceActionRequest) {
ExecutionContext executionContext = createExecutionContext(deleteServiceActionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteServiceActionRequest> request = null;
Response<DeleteServiceActionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteServiceActionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteServiceActionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteServiceAction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteServiceActionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteServiceActionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Deletes the specified TagOption.
* </p>
* <p>
* You cannot delete a TagOption if it is associated with a product or portfolio.
* </p>
*
* @param deleteTagOptionRequest
* @return Result of the DeleteTagOption operation returned by the service.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @throws ResourceInUseException
* A resource that is currently in use. Ensure that the resource is not in use and retry the operation.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DeleteTagOption
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DeleteTagOption" target="_top">AWS
* API Documentation</a>
*/
@Override
public DeleteTagOptionResult deleteTagOption(DeleteTagOptionRequest request) {
request = beforeClientExecution(request);
return executeDeleteTagOption(request);
}
@SdkInternalApi
final DeleteTagOptionResult executeDeleteTagOption(DeleteTagOptionRequest deleteTagOptionRequest) {
ExecutionContext executionContext = createExecutionContext(deleteTagOptionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DeleteTagOptionRequest> request = null;
Response<DeleteTagOptionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteTagOptionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteTagOptionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteTagOption");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DeleteTagOptionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteTagOptionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified constraint.
* </p>
*
* @param describeConstraintRequest
* @return Result of the DescribeConstraint operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeConstraint
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeConstraint"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeConstraintResult describeConstraint(DescribeConstraintRequest request) {
request = beforeClientExecution(request);
return executeDescribeConstraint(request);
}
@SdkInternalApi
final DescribeConstraintResult executeDescribeConstraint(DescribeConstraintRequest describeConstraintRequest) {
ExecutionContext executionContext = createExecutionContext(describeConstraintRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeConstraintRequest> request = null;
Response<DescribeConstraintResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeConstraintRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeConstraintRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeConstraint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeConstraintResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeConstraintResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets the status of the specified copy product operation.
* </p>
*
* @param describeCopyProductStatusRequest
* @return Result of the DescribeCopyProductStatus operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeCopyProductStatus
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeCopyProductStatus"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeCopyProductStatusResult describeCopyProductStatus(DescribeCopyProductStatusRequest request) {
request = beforeClientExecution(request);
return executeDescribeCopyProductStatus(request);
}
@SdkInternalApi
final DescribeCopyProductStatusResult executeDescribeCopyProductStatus(DescribeCopyProductStatusRequest describeCopyProductStatusRequest) {
ExecutionContext executionContext = createExecutionContext(describeCopyProductStatusRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeCopyProductStatusRequest> request = null;
Response<DescribeCopyProductStatusResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeCopyProductStatusRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeCopyProductStatusRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeCopyProductStatus");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeCopyProductStatusResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeCopyProductStatusResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified portfolio.
* </p>
*
* @param describePortfolioRequest
* @return Result of the DescribePortfolio operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribePortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribePortfolio"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribePortfolioResult describePortfolio(DescribePortfolioRequest request) {
request = beforeClientExecution(request);
return executeDescribePortfolio(request);
}
@SdkInternalApi
final DescribePortfolioResult executeDescribePortfolio(DescribePortfolioRequest describePortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(describePortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribePortfolioRequest> request = null;
Response<DescribePortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribePortfolioRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describePortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribePortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribePortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribePortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets the status of the specified portfolio share operation. This API can only be called by the master account in
* the organization.
* </p>
*
* @param describePortfolioShareStatusRequest
* @return Result of the DescribePortfolioShareStatus operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws OperationNotSupportedException
* The operation is not supported.
* @sample AWSServiceCatalog.DescribePortfolioShareStatus
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribePortfolioShareStatus"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribePortfolioShareStatusResult describePortfolioShareStatus(DescribePortfolioShareStatusRequest request) {
request = beforeClientExecution(request);
return executeDescribePortfolioShareStatus(request);
}
@SdkInternalApi
final DescribePortfolioShareStatusResult executeDescribePortfolioShareStatus(DescribePortfolioShareStatusRequest describePortfolioShareStatusRequest) {
ExecutionContext executionContext = createExecutionContext(describePortfolioShareStatusRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribePortfolioShareStatusRequest> request = null;
Response<DescribePortfolioShareStatusResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribePortfolioShareStatusRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describePortfolioShareStatusRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribePortfolioShareStatus");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribePortfolioShareStatusResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribePortfolioShareStatusResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified product.
* </p>
*
* @param describeProductRequest
* @return Result of the DescribeProduct operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.DescribeProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeProduct" target="_top">AWS
* API Documentation</a>
*/
@Override
public DescribeProductResult describeProduct(DescribeProductRequest request) {
request = beforeClientExecution(request);
return executeDescribeProduct(request);
}
@SdkInternalApi
final DescribeProductResult executeDescribeProduct(DescribeProductRequest describeProductRequest) {
ExecutionContext executionContext = createExecutionContext(describeProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeProductRequest> request = null;
Response<DescribeProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeProductRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified product. This operation is run with administrator access.
* </p>
*
* @param describeProductAsAdminRequest
* @return Result of the DescribeProductAsAdmin operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeProductAsAdmin
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeProductAsAdmin"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeProductAsAdminResult describeProductAsAdmin(DescribeProductAsAdminRequest request) {
request = beforeClientExecution(request);
return executeDescribeProductAsAdmin(request);
}
@SdkInternalApi
final DescribeProductAsAdminResult executeDescribeProductAsAdmin(DescribeProductAsAdminRequest describeProductAsAdminRequest) {
ExecutionContext executionContext = createExecutionContext(describeProductAsAdminRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeProductAsAdminRequest> request = null;
Response<DescribeProductAsAdminResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeProductAsAdminRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeProductAsAdminRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeProductAsAdmin");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeProductAsAdminResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeProductAsAdminResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified product.
* </p>
*
* @param describeProductViewRequest
* @return Result of the DescribeProductView operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.DescribeProductView
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeProductView"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeProductViewResult describeProductView(DescribeProductViewRequest request) {
request = beforeClientExecution(request);
return executeDescribeProductView(request);
}
@SdkInternalApi
final DescribeProductViewResult executeDescribeProductView(DescribeProductViewRequest describeProductViewRequest) {
ExecutionContext executionContext = createExecutionContext(describeProductViewRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeProductViewRequest> request = null;
Response<DescribeProductViewResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeProductViewRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeProductViewRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeProductView");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeProductViewResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeProductViewResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified provisioned product.
* </p>
*
* @param describeProvisionedProductRequest
* @return Result of the DescribeProvisionedProduct operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeProvisionedProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeProvisionedProduct"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeProvisionedProductResult describeProvisionedProduct(DescribeProvisionedProductRequest request) {
request = beforeClientExecution(request);
return executeDescribeProvisionedProduct(request);
}
@SdkInternalApi
final DescribeProvisionedProductResult executeDescribeProvisionedProduct(DescribeProvisionedProductRequest describeProvisionedProductRequest) {
ExecutionContext executionContext = createExecutionContext(describeProvisionedProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeProvisionedProductRequest> request = null;
Response<DescribeProvisionedProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeProvisionedProductRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeProvisionedProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeProvisionedProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeProvisionedProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeProvisionedProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the resource changes for the specified plan.
* </p>
*
* @param describeProvisionedProductPlanRequest
* @return Result of the DescribeProvisionedProductPlan operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.DescribeProvisionedProductPlan
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeProvisionedProductPlan"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeProvisionedProductPlanResult describeProvisionedProductPlan(DescribeProvisionedProductPlanRequest request) {
request = beforeClientExecution(request);
return executeDescribeProvisionedProductPlan(request);
}
@SdkInternalApi
final DescribeProvisionedProductPlanResult executeDescribeProvisionedProductPlan(DescribeProvisionedProductPlanRequest describeProvisionedProductPlanRequest) {
ExecutionContext executionContext = createExecutionContext(describeProvisionedProductPlanRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeProvisionedProductPlanRequest> request = null;
Response<DescribeProvisionedProductPlanResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeProvisionedProductPlanRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeProvisionedProductPlanRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeProvisionedProductPlan");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeProvisionedProductPlanResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeProvisionedProductPlanResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified provisioning artifact (also known as a version) for the specified product.
* </p>
*
* @param describeProvisioningArtifactRequest
* @return Result of the DescribeProvisioningArtifact operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeProvisioningArtifact
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeProvisioningArtifactResult describeProvisioningArtifact(DescribeProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeDescribeProvisioningArtifact(request);
}
@SdkInternalApi
final DescribeProvisioningArtifactResult executeDescribeProvisioningArtifact(DescribeProvisioningArtifactRequest describeProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(describeProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeProvisioningArtifactRequest> request = null;
Response<DescribeProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeProvisioningArtifactResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the configuration required to provision the specified product using the specified
* provisioning artifact.
* </p>
* <p>
* If the output contains a TagOption key with an empty list of values, there is a TagOption conflict for that key.
* The end user cannot take action to fix the conflict, and launch is not blocked. In subsequent calls to
* <a>ProvisionProduct</a>, do not include conflicted TagOption keys as tags, or this causes the error
* "Parameter validation failed: Missing required parameter in Tags[<i>N</i>]:<i>Value</i>". Tag the provisioned
* product with the value <code>sc-tagoption-conflict-portfolioId-productId</code>.
* </p>
*
* @param describeProvisioningParametersRequest
* @return Result of the DescribeProvisioningParameters operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeProvisioningParameters
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeProvisioningParameters"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeProvisioningParametersResult describeProvisioningParameters(DescribeProvisioningParametersRequest request) {
request = beforeClientExecution(request);
return executeDescribeProvisioningParameters(request);
}
@SdkInternalApi
final DescribeProvisioningParametersResult executeDescribeProvisioningParameters(DescribeProvisioningParametersRequest describeProvisioningParametersRequest) {
ExecutionContext executionContext = createExecutionContext(describeProvisioningParametersRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeProvisioningParametersRequest> request = null;
Response<DescribeProvisioningParametersResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeProvisioningParametersRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(describeProvisioningParametersRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeProvisioningParameters");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeProvisioningParametersResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeProvisioningParametersResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified request operation.
* </p>
* <p>
* Use this operation after calling a request operation (for example, <a>ProvisionProduct</a>,
* <a>TerminateProvisionedProduct</a>, or <a>UpdateProvisionedProduct</a>).
* </p>
*
* @param describeRecordRequest
* @return Result of the DescribeRecord operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeRecord
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeRecord" target="_top">AWS
* API Documentation</a>
*/
@Override
public DescribeRecordResult describeRecord(DescribeRecordRequest request) {
request = beforeClientExecution(request);
return executeDescribeRecord(request);
}
@SdkInternalApi
final DescribeRecordResult executeDescribeRecord(DescribeRecordRequest describeRecordRequest) {
ExecutionContext executionContext = createExecutionContext(describeRecordRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeRecordRequest> request = null;
Response<DescribeRecordResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeRecordRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeRecordRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeRecord");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeRecordResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeRecordResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Describes a self-service action.
* </p>
*
* @param describeServiceActionRequest
* @return Result of the DescribeServiceAction operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeServiceAction
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeServiceAction"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeServiceActionResult describeServiceAction(DescribeServiceActionRequest request) {
request = beforeClientExecution(request);
return executeDescribeServiceAction(request);
}
@SdkInternalApi
final DescribeServiceActionResult executeDescribeServiceAction(DescribeServiceActionRequest describeServiceActionRequest) {
ExecutionContext executionContext = createExecutionContext(describeServiceActionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeServiceActionRequest> request = null;
Response<DescribeServiceActionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeServiceActionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeServiceActionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeServiceAction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeServiceActionResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DescribeServiceActionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the specified TagOption.
* </p>
*
* @param describeTagOptionRequest
* @return Result of the DescribeTagOption operation returned by the service.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DescribeTagOption
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DescribeTagOption"
* target="_top">AWS API Documentation</a>
*/
@Override
public DescribeTagOptionResult describeTagOption(DescribeTagOptionRequest request) {
request = beforeClientExecution(request);
return executeDescribeTagOption(request);
}
@SdkInternalApi
final DescribeTagOptionResult executeDescribeTagOption(DescribeTagOptionRequest describeTagOptionRequest) {
ExecutionContext executionContext = createExecutionContext(describeTagOptionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DescribeTagOptionRequest> request = null;
Response<DescribeTagOptionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DescribeTagOptionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeTagOptionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeTagOption");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DescribeTagOptionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeTagOptionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Disable portfolio sharing through AWS Organizations feature. This feature will not delete your current shares but
* it will prevent you from creating new shares throughout your organization. Current shares will not be in sync
* with your organization structure if it changes after calling this API. This API can only be called by the master
* account in the organization.
* </p>
*
* @param disableAWSOrganizationsAccessRequest
* @return Result of the DisableAWSOrganizationsAccess operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidStateException
* An attempt was made to modify a resource that is in a state that is not valid. Check your resources to
* ensure that they are in valid states before retrying the operation.
* @throws OperationNotSupportedException
* The operation is not supported.
* @sample AWSServiceCatalog.DisableAWSOrganizationsAccess
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DisableAWSOrganizationsAccess"
* target="_top">AWS API Documentation</a>
*/
@Override
public DisableAWSOrganizationsAccessResult disableAWSOrganizationsAccess(DisableAWSOrganizationsAccessRequest request) {
request = beforeClientExecution(request);
return executeDisableAWSOrganizationsAccess(request);
}
@SdkInternalApi
final DisableAWSOrganizationsAccessResult executeDisableAWSOrganizationsAccess(DisableAWSOrganizationsAccessRequest disableAWSOrganizationsAccessRequest) {
ExecutionContext executionContext = createExecutionContext(disableAWSOrganizationsAccessRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DisableAWSOrganizationsAccessRequest> request = null;
Response<DisableAWSOrganizationsAccessResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DisableAWSOrganizationsAccessRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(disableAWSOrganizationsAccessRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisableAWSOrganizationsAccess");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DisableAWSOrganizationsAccessResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DisableAWSOrganizationsAccessResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Disassociates a previously associated principal ARN from a specified portfolio.
* </p>
*
* @param disassociatePrincipalFromPortfolioRequest
* @return Result of the DisassociatePrincipalFromPortfolio operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DisassociatePrincipalFromPortfolio
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DisassociatePrincipalFromPortfolio"
* target="_top">AWS API Documentation</a>
*/
@Override
public DisassociatePrincipalFromPortfolioResult disassociatePrincipalFromPortfolio(DisassociatePrincipalFromPortfolioRequest request) {
request = beforeClientExecution(request);
return executeDisassociatePrincipalFromPortfolio(request);
}
@SdkInternalApi
final DisassociatePrincipalFromPortfolioResult executeDisassociatePrincipalFromPortfolio(
DisassociatePrincipalFromPortfolioRequest disassociatePrincipalFromPortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(disassociatePrincipalFromPortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DisassociatePrincipalFromPortfolioRequest> request = null;
Response<DisassociatePrincipalFromPortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DisassociatePrincipalFromPortfolioRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(disassociatePrincipalFromPortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociatePrincipalFromPortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DisassociatePrincipalFromPortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DisassociatePrincipalFromPortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Disassociates the specified product from the specified portfolio.
* </p>
*
* @param disassociateProductFromPortfolioRequest
* @return Result of the DisassociateProductFromPortfolio operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws ResourceInUseException
* A resource that is currently in use. Ensure that the resource is not in use and retry the operation.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.DisassociateProductFromPortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DisassociateProductFromPortfolio"
* target="_top">AWS API Documentation</a>
*/
@Override
public DisassociateProductFromPortfolioResult disassociateProductFromPortfolio(DisassociateProductFromPortfolioRequest request) {
request = beforeClientExecution(request);
return executeDisassociateProductFromPortfolio(request);
}
@SdkInternalApi
final DisassociateProductFromPortfolioResult executeDisassociateProductFromPortfolio(
DisassociateProductFromPortfolioRequest disassociateProductFromPortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(disassociateProductFromPortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DisassociateProductFromPortfolioRequest> request = null;
Response<DisassociateProductFromPortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DisassociateProductFromPortfolioRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(disassociateProductFromPortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateProductFromPortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DisassociateProductFromPortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DisassociateProductFromPortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Disassociates the specified self-service action association from the specified provisioning artifact.
* </p>
*
* @param disassociateServiceActionFromProvisioningArtifactRequest
* @return Result of the DisassociateServiceActionFromProvisioningArtifact operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DisassociateServiceActionFromProvisioningArtifact
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DisassociateServiceActionFromProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public DisassociateServiceActionFromProvisioningArtifactResult disassociateServiceActionFromProvisioningArtifact(
DisassociateServiceActionFromProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeDisassociateServiceActionFromProvisioningArtifact(request);
}
@SdkInternalApi
final DisassociateServiceActionFromProvisioningArtifactResult executeDisassociateServiceActionFromProvisioningArtifact(
DisassociateServiceActionFromProvisioningArtifactRequest disassociateServiceActionFromProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(disassociateServiceActionFromProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DisassociateServiceActionFromProvisioningArtifactRequest> request = null;
Response<DisassociateServiceActionFromProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DisassociateServiceActionFromProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(disassociateServiceActionFromProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateServiceActionFromProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DisassociateServiceActionFromProvisioningArtifactResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DisassociateServiceActionFromProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Disassociates the specified TagOption from the specified resource.
* </p>
*
* @param disassociateTagOptionFromResourceRequest
* @return Result of the DisassociateTagOptionFromResource operation returned by the service.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.DisassociateTagOptionFromResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/DisassociateTagOptionFromResource"
* target="_top">AWS API Documentation</a>
*/
@Override
public DisassociateTagOptionFromResourceResult disassociateTagOptionFromResource(DisassociateTagOptionFromResourceRequest request) {
request = beforeClientExecution(request);
return executeDisassociateTagOptionFromResource(request);
}
@SdkInternalApi
final DisassociateTagOptionFromResourceResult executeDisassociateTagOptionFromResource(
DisassociateTagOptionFromResourceRequest disassociateTagOptionFromResourceRequest) {
ExecutionContext executionContext = createExecutionContext(disassociateTagOptionFromResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<DisassociateTagOptionFromResourceRequest> request = null;
Response<DisassociateTagOptionFromResourceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DisassociateTagOptionFromResourceRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(disassociateTagOptionFromResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateTagOptionFromResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<DisassociateTagOptionFromResourceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DisassociateTagOptionFromResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Enable portfolio sharing feature through AWS Organizations. This API will allow Service Catalog to receive
* updates on your organization in order to sync your shares with the current structure. This API can only be called
* by the master account in the organization.
* </p>
* <p>
* By calling this API Service Catalog will use FAS credentials to call organizations:EnableAWSServiceAccess so that
* your shares can be in sync with any changes in your AWS Organizations.
* </p>
*
* @param enableAWSOrganizationsAccessRequest
* @return Result of the EnableAWSOrganizationsAccess operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidStateException
* An attempt was made to modify a resource that is in a state that is not valid. Check your resources to
* ensure that they are in valid states before retrying the operation.
* @throws OperationNotSupportedException
* The operation is not supported.
* @sample AWSServiceCatalog.EnableAWSOrganizationsAccess
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/EnableAWSOrganizationsAccess"
* target="_top">AWS API Documentation</a>
*/
@Override
public EnableAWSOrganizationsAccessResult enableAWSOrganizationsAccess(EnableAWSOrganizationsAccessRequest request) {
request = beforeClientExecution(request);
return executeEnableAWSOrganizationsAccess(request);
}
@SdkInternalApi
final EnableAWSOrganizationsAccessResult executeEnableAWSOrganizationsAccess(EnableAWSOrganizationsAccessRequest enableAWSOrganizationsAccessRequest) {
ExecutionContext executionContext = createExecutionContext(enableAWSOrganizationsAccessRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<EnableAWSOrganizationsAccessRequest> request = null;
Response<EnableAWSOrganizationsAccessResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new EnableAWSOrganizationsAccessRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(enableAWSOrganizationsAccessRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "EnableAWSOrganizationsAccess");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<EnableAWSOrganizationsAccessResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new EnableAWSOrganizationsAccessResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Provisions or modifies a product based on the resource changes for the specified plan.
* </p>
*
* @param executeProvisionedProductPlanRequest
* @return Result of the ExecuteProvisionedProductPlan operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidStateException
* An attempt was made to modify a resource that is in a state that is not valid. Check your resources to
* ensure that they are in valid states before retrying the operation.
* @sample AWSServiceCatalog.ExecuteProvisionedProductPlan
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ExecuteProvisionedProductPlan"
* target="_top">AWS API Documentation</a>
*/
@Override
public ExecuteProvisionedProductPlanResult executeProvisionedProductPlan(ExecuteProvisionedProductPlanRequest request) {
request = beforeClientExecution(request);
return executeExecuteProvisionedProductPlan(request);
}
@SdkInternalApi
final ExecuteProvisionedProductPlanResult executeExecuteProvisionedProductPlan(ExecuteProvisionedProductPlanRequest executeProvisionedProductPlanRequest) {
ExecutionContext executionContext = createExecutionContext(executeProvisionedProductPlanRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ExecuteProvisionedProductPlanRequest> request = null;
Response<ExecuteProvisionedProductPlanResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ExecuteProvisionedProductPlanRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(executeProvisionedProductPlanRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ExecuteProvisionedProductPlan");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ExecuteProvisionedProductPlanResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ExecuteProvisionedProductPlanResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Executes a self-service action against a provisioned product.
* </p>
*
* @param executeProvisionedProductServiceActionRequest
* @return Result of the ExecuteProvisionedProductServiceAction operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidStateException
* An attempt was made to modify a resource that is in a state that is not valid. Check your resources to
* ensure that they are in valid states before retrying the operation.
* @sample AWSServiceCatalog.ExecuteProvisionedProductServiceAction
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ExecuteProvisionedProductServiceAction"
* target="_top">AWS API Documentation</a>
*/
@Override
public ExecuteProvisionedProductServiceActionResult executeProvisionedProductServiceAction(ExecuteProvisionedProductServiceActionRequest request) {
request = beforeClientExecution(request);
return executeExecuteProvisionedProductServiceAction(request);
}
@SdkInternalApi
final ExecuteProvisionedProductServiceActionResult executeExecuteProvisionedProductServiceAction(
ExecuteProvisionedProductServiceActionRequest executeProvisionedProductServiceActionRequest) {
ExecutionContext executionContext = createExecutionContext(executeProvisionedProductServiceActionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ExecuteProvisionedProductServiceActionRequest> request = null;
Response<ExecuteProvisionedProductServiceActionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ExecuteProvisionedProductServiceActionRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(executeProvisionedProductServiceActionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ExecuteProvisionedProductServiceAction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ExecuteProvisionedProductServiceActionResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ExecuteProvisionedProductServiceActionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get the Access Status for AWS Organization portfolio share feature. This API can only be called by the master
* account in the organization.
* </p>
*
* @param getAWSOrganizationsAccessStatusRequest
* @return Result of the GetAWSOrganizationsAccessStatus operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws OperationNotSupportedException
* The operation is not supported.
* @sample AWSServiceCatalog.GetAWSOrganizationsAccessStatus
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/GetAWSOrganizationsAccessStatus"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetAWSOrganizationsAccessStatusResult getAWSOrganizationsAccessStatus(GetAWSOrganizationsAccessStatusRequest request) {
request = beforeClientExecution(request);
return executeGetAWSOrganizationsAccessStatus(request);
}
@SdkInternalApi
final GetAWSOrganizationsAccessStatusResult executeGetAWSOrganizationsAccessStatus(
GetAWSOrganizationsAccessStatusRequest getAWSOrganizationsAccessStatusRequest) {
ExecutionContext executionContext = createExecutionContext(getAWSOrganizationsAccessStatusRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetAWSOrganizationsAccessStatusRequest> request = null;
Response<GetAWSOrganizationsAccessStatusResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetAWSOrganizationsAccessStatusRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(getAWSOrganizationsAccessStatusRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAWSOrganizationsAccessStatus");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetAWSOrganizationsAccessStatusResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new GetAWSOrganizationsAccessStatusResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists all portfolios for which sharing was accepted by this account.
* </p>
*
* @param listAcceptedPortfolioSharesRequest
* @return Result of the ListAcceptedPortfolioShares operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws OperationNotSupportedException
* The operation is not supported.
* @sample AWSServiceCatalog.ListAcceptedPortfolioShares
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListAcceptedPortfolioShares"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListAcceptedPortfolioSharesResult listAcceptedPortfolioShares(ListAcceptedPortfolioSharesRequest request) {
request = beforeClientExecution(request);
return executeListAcceptedPortfolioShares(request);
}
@SdkInternalApi
final ListAcceptedPortfolioSharesResult executeListAcceptedPortfolioShares(ListAcceptedPortfolioSharesRequest listAcceptedPortfolioSharesRequest) {
ExecutionContext executionContext = createExecutionContext(listAcceptedPortfolioSharesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListAcceptedPortfolioSharesRequest> request = null;
Response<ListAcceptedPortfolioSharesResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAcceptedPortfolioSharesRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listAcceptedPortfolioSharesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAcceptedPortfolioShares");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListAcceptedPortfolioSharesResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListAcceptedPortfolioSharesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the constraints for the specified portfolio and product.
* </p>
*
* @param listConstraintsForPortfolioRequest
* @return Result of the ListConstraintsForPortfolio operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListConstraintsForPortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListConstraintsForPortfolio"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListConstraintsForPortfolioResult listConstraintsForPortfolio(ListConstraintsForPortfolioRequest request) {
request = beforeClientExecution(request);
return executeListConstraintsForPortfolio(request);
}
@SdkInternalApi
final ListConstraintsForPortfolioResult executeListConstraintsForPortfolio(ListConstraintsForPortfolioRequest listConstraintsForPortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(listConstraintsForPortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListConstraintsForPortfolioRequest> request = null;
Response<ListConstraintsForPortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListConstraintsForPortfolioRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listConstraintsForPortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListConstraintsForPortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListConstraintsForPortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListConstraintsForPortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the paths to the specified product. A path is how the user has access to a specified product, and is
* necessary when provisioning a product. A path also determines the constraints put on the product.
* </p>
*
* @param listLaunchPathsRequest
* @return Result of the ListLaunchPaths operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.ListLaunchPaths
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListLaunchPaths" target="_top">AWS
* API Documentation</a>
*/
@Override
public ListLaunchPathsResult listLaunchPaths(ListLaunchPathsRequest request) {
request = beforeClientExecution(request);
return executeListLaunchPaths(request);
}
@SdkInternalApi
final ListLaunchPathsResult executeListLaunchPaths(ListLaunchPathsRequest listLaunchPathsRequest) {
ExecutionContext executionContext = createExecutionContext(listLaunchPathsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListLaunchPathsRequest> request = null;
Response<ListLaunchPathsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListLaunchPathsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listLaunchPathsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListLaunchPaths");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListLaunchPathsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListLaunchPathsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the organization nodes that have access to the specified portfolio. This API can only be called by the
* master account in the organization.
* </p>
*
* @param listOrganizationPortfolioAccessRequest
* @return Result of the ListOrganizationPortfolioAccess operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws OperationNotSupportedException
* The operation is not supported.
* @sample AWSServiceCatalog.ListOrganizationPortfolioAccess
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListOrganizationPortfolioAccess"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListOrganizationPortfolioAccessResult listOrganizationPortfolioAccess(ListOrganizationPortfolioAccessRequest request) {
request = beforeClientExecution(request);
return executeListOrganizationPortfolioAccess(request);
}
@SdkInternalApi
final ListOrganizationPortfolioAccessResult executeListOrganizationPortfolioAccess(
ListOrganizationPortfolioAccessRequest listOrganizationPortfolioAccessRequest) {
ExecutionContext executionContext = createExecutionContext(listOrganizationPortfolioAccessRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListOrganizationPortfolioAccessRequest> request = null;
Response<ListOrganizationPortfolioAccessResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListOrganizationPortfolioAccessRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listOrganizationPortfolioAccessRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListOrganizationPortfolioAccess");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListOrganizationPortfolioAccessResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListOrganizationPortfolioAccessResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the account IDs that have access to the specified portfolio.
* </p>
*
* @param listPortfolioAccessRequest
* @return Result of the ListPortfolioAccess operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.ListPortfolioAccess
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListPortfolioAccess"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListPortfolioAccessResult listPortfolioAccess(ListPortfolioAccessRequest request) {
request = beforeClientExecution(request);
return executeListPortfolioAccess(request);
}
@SdkInternalApi
final ListPortfolioAccessResult executeListPortfolioAccess(ListPortfolioAccessRequest listPortfolioAccessRequest) {
ExecutionContext executionContext = createExecutionContext(listPortfolioAccessRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListPortfolioAccessRequest> request = null;
Response<ListPortfolioAccessResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPortfolioAccessRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listPortfolioAccessRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPortfolioAccess");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListPortfolioAccessResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListPortfolioAccessResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists all portfolios in the catalog.
* </p>
*
* @param listPortfoliosRequest
* @return Result of the ListPortfolios operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListPortfolios
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListPortfolios" target="_top">AWS
* API Documentation</a>
*/
@Override
public ListPortfoliosResult listPortfolios(ListPortfoliosRequest request) {
request = beforeClientExecution(request);
return executeListPortfolios(request);
}
@SdkInternalApi
final ListPortfoliosResult executeListPortfolios(ListPortfoliosRequest listPortfoliosRequest) {
ExecutionContext executionContext = createExecutionContext(listPortfoliosRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListPortfoliosRequest> request = null;
Response<ListPortfoliosResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPortfoliosRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listPortfoliosRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPortfolios");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListPortfoliosResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListPortfoliosResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists all portfolios that the specified product is associated with.
* </p>
*
* @param listPortfoliosForProductRequest
* @return Result of the ListPortfoliosForProduct operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.ListPortfoliosForProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListPortfoliosForProduct"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListPortfoliosForProductResult listPortfoliosForProduct(ListPortfoliosForProductRequest request) {
request = beforeClientExecution(request);
return executeListPortfoliosForProduct(request);
}
@SdkInternalApi
final ListPortfoliosForProductResult executeListPortfoliosForProduct(ListPortfoliosForProductRequest listPortfoliosForProductRequest) {
ExecutionContext executionContext = createExecutionContext(listPortfoliosForProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListPortfoliosForProductRequest> request = null;
Response<ListPortfoliosForProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPortfoliosForProductRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listPortfoliosForProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPortfoliosForProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListPortfoliosForProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListPortfoliosForProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists all principal ARNs associated with the specified portfolio.
* </p>
*
* @param listPrincipalsForPortfolioRequest
* @return Result of the ListPrincipalsForPortfolio operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListPrincipalsForPortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListPrincipalsForPortfolio"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListPrincipalsForPortfolioResult listPrincipalsForPortfolio(ListPrincipalsForPortfolioRequest request) {
request = beforeClientExecution(request);
return executeListPrincipalsForPortfolio(request);
}
@SdkInternalApi
final ListPrincipalsForPortfolioResult executeListPrincipalsForPortfolio(ListPrincipalsForPortfolioRequest listPrincipalsForPortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(listPrincipalsForPortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListPrincipalsForPortfolioRequest> request = null;
Response<ListPrincipalsForPortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPrincipalsForPortfolioRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listPrincipalsForPortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPrincipalsForPortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListPrincipalsForPortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListPrincipalsForPortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the plans for the specified provisioned product or all plans to which the user has access.
* </p>
*
* @param listProvisionedProductPlansRequest
* @return Result of the ListProvisionedProductPlans operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListProvisionedProductPlans
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListProvisionedProductPlans"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListProvisionedProductPlansResult listProvisionedProductPlans(ListProvisionedProductPlansRequest request) {
request = beforeClientExecution(request);
return executeListProvisionedProductPlans(request);
}
@SdkInternalApi
final ListProvisionedProductPlansResult executeListProvisionedProductPlans(ListProvisionedProductPlansRequest listProvisionedProductPlansRequest) {
ExecutionContext executionContext = createExecutionContext(listProvisionedProductPlansRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListProvisionedProductPlansRequest> request = null;
Response<ListProvisionedProductPlansResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListProvisionedProductPlansRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listProvisionedProductPlansRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListProvisionedProductPlans");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListProvisionedProductPlansResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListProvisionedProductPlansResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists all provisioning artifacts (also known as versions) for the specified product.
* </p>
*
* @param listProvisioningArtifactsRequest
* @return Result of the ListProvisioningArtifacts operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListProvisioningArtifacts
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListProvisioningArtifacts"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListProvisioningArtifactsResult listProvisioningArtifacts(ListProvisioningArtifactsRequest request) {
request = beforeClientExecution(request);
return executeListProvisioningArtifacts(request);
}
@SdkInternalApi
final ListProvisioningArtifactsResult executeListProvisioningArtifacts(ListProvisioningArtifactsRequest listProvisioningArtifactsRequest) {
ExecutionContext executionContext = createExecutionContext(listProvisioningArtifactsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListProvisioningArtifactsRequest> request = null;
Response<ListProvisioningArtifactsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListProvisioningArtifactsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listProvisioningArtifactsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListProvisioningArtifacts");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListProvisioningArtifactsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListProvisioningArtifactsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists all provisioning artifacts (also known as versions) for the specified self-service action.
* </p>
*
* @param listProvisioningArtifactsForServiceActionRequest
* @return Result of the ListProvisioningArtifactsForServiceAction operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListProvisioningArtifactsForServiceAction
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListProvisioningArtifactsForServiceAction"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListProvisioningArtifactsForServiceActionResult listProvisioningArtifactsForServiceAction(ListProvisioningArtifactsForServiceActionRequest request) {
request = beforeClientExecution(request);
return executeListProvisioningArtifactsForServiceAction(request);
}
@SdkInternalApi
final ListProvisioningArtifactsForServiceActionResult executeListProvisioningArtifactsForServiceAction(
ListProvisioningArtifactsForServiceActionRequest listProvisioningArtifactsForServiceActionRequest) {
ExecutionContext executionContext = createExecutionContext(listProvisioningArtifactsForServiceActionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListProvisioningArtifactsForServiceActionRequest> request = null;
Response<ListProvisioningArtifactsForServiceActionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListProvisioningArtifactsForServiceActionRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listProvisioningArtifactsForServiceActionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListProvisioningArtifactsForServiceAction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListProvisioningArtifactsForServiceActionResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListProvisioningArtifactsForServiceActionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the specified requests or all performed requests.
* </p>
*
* @param listRecordHistoryRequest
* @return Result of the ListRecordHistory operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListRecordHistory
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListRecordHistory"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListRecordHistoryResult listRecordHistory(ListRecordHistoryRequest request) {
request = beforeClientExecution(request);
return executeListRecordHistory(request);
}
@SdkInternalApi
final ListRecordHistoryResult executeListRecordHistory(ListRecordHistoryRequest listRecordHistoryRequest) {
ExecutionContext executionContext = createExecutionContext(listRecordHistoryRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListRecordHistoryRequest> request = null;
Response<ListRecordHistoryResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListRecordHistoryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listRecordHistoryRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListRecordHistory");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListRecordHistoryResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListRecordHistoryResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the resources associated with the specified TagOption.
* </p>
*
* @param listResourcesForTagOptionRequest
* @return Result of the ListResourcesForTagOption operation returned by the service.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListResourcesForTagOption
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListResourcesForTagOption"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListResourcesForTagOptionResult listResourcesForTagOption(ListResourcesForTagOptionRequest request) {
request = beforeClientExecution(request);
return executeListResourcesForTagOption(request);
}
@SdkInternalApi
final ListResourcesForTagOptionResult executeListResourcesForTagOption(ListResourcesForTagOptionRequest listResourcesForTagOptionRequest) {
ExecutionContext executionContext = createExecutionContext(listResourcesForTagOptionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListResourcesForTagOptionRequest> request = null;
Response<ListResourcesForTagOptionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListResourcesForTagOptionRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listResourcesForTagOptionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListResourcesForTagOption");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListResourcesForTagOptionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListResourcesForTagOptionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists all self-service actions.
* </p>
*
* @param listServiceActionsRequest
* @return Result of the ListServiceActions operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListServiceActions
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListServiceActions"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListServiceActionsResult listServiceActions(ListServiceActionsRequest request) {
request = beforeClientExecution(request);
return executeListServiceActions(request);
}
@SdkInternalApi
final ListServiceActionsResult executeListServiceActions(ListServiceActionsRequest listServiceActionsRequest) {
ExecutionContext executionContext = createExecutionContext(listServiceActionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListServiceActionsRequest> request = null;
Response<ListServiceActionsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListServiceActionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listServiceActionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListServiceActions");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListServiceActionsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListServiceActionsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Returns a paginated list of self-service actions associated with the specified Product ID and Provisioning
* Artifact ID.
* </p>
*
* @param listServiceActionsForProvisioningArtifactRequest
* @return Result of the ListServiceActionsForProvisioningArtifact operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListServiceActionsForProvisioningArtifact
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListServiceActionsForProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListServiceActionsForProvisioningArtifactResult listServiceActionsForProvisioningArtifact(ListServiceActionsForProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeListServiceActionsForProvisioningArtifact(request);
}
@SdkInternalApi
final ListServiceActionsForProvisioningArtifactResult executeListServiceActionsForProvisioningArtifact(
ListServiceActionsForProvisioningArtifactRequest listServiceActionsForProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(listServiceActionsForProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListServiceActionsForProvisioningArtifactRequest> request = null;
Response<ListServiceActionsForProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListServiceActionsForProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listServiceActionsForProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListServiceActionsForProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListServiceActionsForProvisioningArtifactResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListServiceActionsForProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the specified TagOptions or all TagOptions.
* </p>
*
* @param listTagOptionsRequest
* @return Result of the ListTagOptions operation returned by the service.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ListTagOptions
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ListTagOptions" target="_top">AWS
* API Documentation</a>
*/
@Override
public ListTagOptionsResult listTagOptions(ListTagOptionsRequest request) {
request = beforeClientExecution(request);
return executeListTagOptions(request);
}
@SdkInternalApi
final ListTagOptionsResult executeListTagOptions(ListTagOptionsRequest listTagOptionsRequest) {
ExecutionContext executionContext = createExecutionContext(listTagOptionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTagOptionsRequest> request = null;
Response<ListTagOptionsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagOptionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagOptionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagOptions");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTagOptionsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagOptionsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Provisions the specified product.
* </p>
* <p>
* A provisioned product is a resourced instance of a product. For example, provisioning a product based on a
* CloudFormation template launches a CloudFormation stack and its underlying resources. You can check the status of
* this request using <a>DescribeRecord</a>.
* </p>
* <p>
* If the request contains a tag key with an empty list of values, there is a tag conflict for that key. Do not
* include conflicted keys as tags, or this causes the error
* "Parameter validation failed: Missing required parameter in Tags[<i>N</i>]:<i>Value</i>".
* </p>
*
* @param provisionProductRequest
* @return Result of the ProvisionProduct operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws DuplicateResourceException
* The specified resource is a duplicate.
* @sample AWSServiceCatalog.ProvisionProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ProvisionProduct"
* target="_top">AWS API Documentation</a>
*/
@Override
public ProvisionProductResult provisionProduct(ProvisionProductRequest request) {
request = beforeClientExecution(request);
return executeProvisionProduct(request);
}
@SdkInternalApi
final ProvisionProductResult executeProvisionProduct(ProvisionProductRequest provisionProductRequest) {
ExecutionContext executionContext = createExecutionContext(provisionProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ProvisionProductRequest> request = null;
Response<ProvisionProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ProvisionProductRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(provisionProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ProvisionProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ProvisionProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ProvisionProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Rejects an offer to share the specified portfolio.
* </p>
*
* @param rejectPortfolioShareRequest
* @return Result of the RejectPortfolioShare operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.RejectPortfolioShare
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/RejectPortfolioShare"
* target="_top">AWS API Documentation</a>
*/
@Override
public RejectPortfolioShareResult rejectPortfolioShare(RejectPortfolioShareRequest request) {
request = beforeClientExecution(request);
return executeRejectPortfolioShare(request);
}
@SdkInternalApi
final RejectPortfolioShareResult executeRejectPortfolioShare(RejectPortfolioShareRequest rejectPortfolioShareRequest) {
ExecutionContext executionContext = createExecutionContext(rejectPortfolioShareRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<RejectPortfolioShareRequest> request = null;
Response<RejectPortfolioShareResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new RejectPortfolioShareRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(rejectPortfolioShareRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RejectPortfolioShare");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<RejectPortfolioShareResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RejectPortfolioShareResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists the provisioned products that are available (not terminated).
* </p>
* <p>
* To use additional filtering, see <a>SearchProvisionedProducts</a>.
* </p>
*
* @param scanProvisionedProductsRequest
* @return Result of the ScanProvisionedProducts operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.ScanProvisionedProducts
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/ScanProvisionedProducts"
* target="_top">AWS API Documentation</a>
*/
@Override
public ScanProvisionedProductsResult scanProvisionedProducts(ScanProvisionedProductsRequest request) {
request = beforeClientExecution(request);
return executeScanProvisionedProducts(request);
}
@SdkInternalApi
final ScanProvisionedProductsResult executeScanProvisionedProducts(ScanProvisionedProductsRequest scanProvisionedProductsRequest) {
ExecutionContext executionContext = createExecutionContext(scanProvisionedProductsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ScanProvisionedProductsRequest> request = null;
Response<ScanProvisionedProductsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ScanProvisionedProductsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(scanProvisionedProductsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ScanProvisionedProducts");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ScanProvisionedProductsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ScanProvisionedProductsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the products to which the caller has access.
* </p>
*
* @param searchProductsRequest
* @return Result of the SearchProducts operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.SearchProducts
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/SearchProducts" target="_top">AWS
* API Documentation</a>
*/
@Override
public SearchProductsResult searchProducts(SearchProductsRequest request) {
request = beforeClientExecution(request);
return executeSearchProducts(request);
}
@SdkInternalApi
final SearchProductsResult executeSearchProducts(SearchProductsRequest searchProductsRequest) {
ExecutionContext executionContext = createExecutionContext(searchProductsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<SearchProductsRequest> request = null;
Response<SearchProductsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SearchProductsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(searchProductsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SearchProducts");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<SearchProductsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SearchProductsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the products for the specified portfolio or all products.
* </p>
*
* @param searchProductsAsAdminRequest
* @return Result of the SearchProductsAsAdmin operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.SearchProductsAsAdmin
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/SearchProductsAsAdmin"
* target="_top">AWS API Documentation</a>
*/
@Override
public SearchProductsAsAdminResult searchProductsAsAdmin(SearchProductsAsAdminRequest request) {
request = beforeClientExecution(request);
return executeSearchProductsAsAdmin(request);
}
@SdkInternalApi
final SearchProductsAsAdminResult executeSearchProductsAsAdmin(SearchProductsAsAdminRequest searchProductsAsAdminRequest) {
ExecutionContext executionContext = createExecutionContext(searchProductsAsAdminRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<SearchProductsAsAdminRequest> request = null;
Response<SearchProductsAsAdminResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SearchProductsAsAdminRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(searchProductsAsAdminRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SearchProductsAsAdmin");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<SearchProductsAsAdminResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new SearchProductsAsAdminResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets information about the provisioned products that meet the specified criteria.
* </p>
*
* @param searchProvisionedProductsRequest
* @return Result of the SearchProvisionedProducts operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.SearchProvisionedProducts
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/SearchProvisionedProducts"
* target="_top">AWS API Documentation</a>
*/
@Override
public SearchProvisionedProductsResult searchProvisionedProducts(SearchProvisionedProductsRequest request) {
request = beforeClientExecution(request);
return executeSearchProvisionedProducts(request);
}
@SdkInternalApi
final SearchProvisionedProductsResult executeSearchProvisionedProducts(SearchProvisionedProductsRequest searchProvisionedProductsRequest) {
ExecutionContext executionContext = createExecutionContext(searchProvisionedProductsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<SearchProvisionedProductsRequest> request = null;
Response<SearchProvisionedProductsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new SearchProvisionedProductsRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(searchProvisionedProductsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SearchProvisionedProducts");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<SearchProvisionedProductsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new SearchProvisionedProductsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Terminates the specified provisioned product.
* </p>
* <p>
* This operation does not delete any records associated with the provisioned product.
* </p>
* <p>
* You can check the status of this request using <a>DescribeRecord</a>.
* </p>
*
* @param terminateProvisionedProductRequest
* @return Result of the TerminateProvisionedProduct operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.TerminateProvisionedProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/TerminateProvisionedProduct"
* target="_top">AWS API Documentation</a>
*/
@Override
public TerminateProvisionedProductResult terminateProvisionedProduct(TerminateProvisionedProductRequest request) {
request = beforeClientExecution(request);
return executeTerminateProvisionedProduct(request);
}
@SdkInternalApi
final TerminateProvisionedProductResult executeTerminateProvisionedProduct(TerminateProvisionedProductRequest terminateProvisionedProductRequest) {
ExecutionContext executionContext = createExecutionContext(terminateProvisionedProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<TerminateProvisionedProductRequest> request = null;
Response<TerminateProvisionedProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new TerminateProvisionedProductRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(terminateProvisionedProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TerminateProvisionedProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<TerminateProvisionedProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new TerminateProvisionedProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Updates the specified constraint.
* </p>
*
* @param updateConstraintRequest
* @return Result of the UpdateConstraint operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.UpdateConstraint
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/UpdateConstraint"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateConstraintResult updateConstraint(UpdateConstraintRequest request) {
request = beforeClientExecution(request);
return executeUpdateConstraint(request);
}
@SdkInternalApi
final UpdateConstraintResult executeUpdateConstraint(UpdateConstraintRequest updateConstraintRequest) {
ExecutionContext executionContext = createExecutionContext(updateConstraintRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateConstraintRequest> request = null;
Response<UpdateConstraintResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateConstraintRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateConstraintRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateConstraint");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateConstraintResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateConstraintResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Updates the specified portfolio.
* </p>
* <p>
* You cannot update a product that was shared with you.
* </p>
*
* @param updatePortfolioRequest
* @return Result of the UpdatePortfolio operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws LimitExceededException
* The current limits of the service would have been exceeded by this operation. Decrease your resource use
* or increase your service limits and retry the operation.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @sample AWSServiceCatalog.UpdatePortfolio
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/UpdatePortfolio" target="_top">AWS
* API Documentation</a>
*/
@Override
public UpdatePortfolioResult updatePortfolio(UpdatePortfolioRequest request) {
request = beforeClientExecution(request);
return executeUpdatePortfolio(request);
}
@SdkInternalApi
final UpdatePortfolioResult executeUpdatePortfolio(UpdatePortfolioRequest updatePortfolioRequest) {
ExecutionContext executionContext = createExecutionContext(updatePortfolioRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdatePortfolioRequest> request = null;
Response<UpdatePortfolioResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdatePortfolioRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updatePortfolioRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdatePortfolio");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdatePortfolioResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdatePortfolioResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Updates the specified product.
* </p>
*
* @param updateProductRequest
* @return Result of the UpdateProduct operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @sample AWSServiceCatalog.UpdateProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/UpdateProduct" target="_top">AWS
* API Documentation</a>
*/
@Override
public UpdateProductResult updateProduct(UpdateProductRequest request) {
request = beforeClientExecution(request);
return executeUpdateProduct(request);
}
@SdkInternalApi
final UpdateProductResult executeUpdateProduct(UpdateProductRequest updateProductRequest) {
ExecutionContext executionContext = createExecutionContext(updateProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateProductRequest> request = null;
Response<UpdateProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateProductRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Requests updates to the configuration of the specified provisioned product.
* </p>
* <p>
* If there are tags associated with the object, they cannot be updated or added. Depending on the specific updates
* requested, this operation can update with no interruption, with some interruption, or replace the provisioned
* product entirely.
* </p>
* <p>
* You can check the status of this request using <a>DescribeRecord</a>.
* </p>
*
* @param updateProvisionedProductRequest
* @return Result of the UpdateProvisionedProduct operation returned by the service.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @sample AWSServiceCatalog.UpdateProvisionedProduct
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/UpdateProvisionedProduct"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateProvisionedProductResult updateProvisionedProduct(UpdateProvisionedProductRequest request) {
request = beforeClientExecution(request);
return executeUpdateProvisionedProduct(request);
}
@SdkInternalApi
final UpdateProvisionedProductResult executeUpdateProvisionedProduct(UpdateProvisionedProductRequest updateProvisionedProductRequest) {
ExecutionContext executionContext = createExecutionContext(updateProvisionedProductRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateProvisionedProductRequest> request = null;
Response<UpdateProvisionedProductResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateProvisionedProductRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(updateProvisionedProductRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateProvisionedProduct");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateProvisionedProductResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new UpdateProvisionedProductResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Updates the specified provisioning artifact (also known as a version) for the specified product.
* </p>
* <p>
* You cannot update a provisioning artifact for a product that was shared with you.
* </p>
*
* @param updateProvisioningArtifactRequest
* @return Result of the UpdateProvisioningArtifact operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.UpdateProvisioningArtifact
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/UpdateProvisioningArtifact"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateProvisioningArtifactResult updateProvisioningArtifact(UpdateProvisioningArtifactRequest request) {
request = beforeClientExecution(request);
return executeUpdateProvisioningArtifact(request);
}
@SdkInternalApi
final UpdateProvisioningArtifactResult executeUpdateProvisioningArtifact(UpdateProvisioningArtifactRequest updateProvisioningArtifactRequest) {
ExecutionContext executionContext = createExecutionContext(updateProvisioningArtifactRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateProvisioningArtifactRequest> request = null;
Response<UpdateProvisioningArtifactResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateProvisioningArtifactRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(updateProvisioningArtifactRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateProvisioningArtifact");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateProvisioningArtifactResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new UpdateProvisioningArtifactResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Updates a self-service action.
* </p>
*
* @param updateServiceActionRequest
* @return Result of the UpdateServiceAction operation returned by the service.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.UpdateServiceAction
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/UpdateServiceAction"
* target="_top">AWS API Documentation</a>
*/
@Override
public UpdateServiceActionResult updateServiceAction(UpdateServiceActionRequest request) {
request = beforeClientExecution(request);
return executeUpdateServiceAction(request);
}
@SdkInternalApi
final UpdateServiceActionResult executeUpdateServiceAction(UpdateServiceActionRequest updateServiceActionRequest) {
ExecutionContext executionContext = createExecutionContext(updateServiceActionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateServiceActionRequest> request = null;
Response<UpdateServiceActionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateServiceActionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateServiceActionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateServiceAction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateServiceActionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateServiceActionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Updates the specified TagOption.
* </p>
*
* @param updateTagOptionRequest
* @return Result of the UpdateTagOption operation returned by the service.
* @throws TagOptionNotMigratedException
* An operation requiring TagOptions failed because the TagOptions migration process has not been performed
* for this account. Please use the AWS console to perform the migration process before retrying the
* operation.
* @throws ResourceNotFoundException
* The specified resource was not found.
* @throws DuplicateResourceException
* The specified resource is a duplicate.
* @throws InvalidParametersException
* One or more parameters provided to the operation are not valid.
* @sample AWSServiceCatalog.UpdateTagOption
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/servicecatalog-2015-12-10/UpdateTagOption" target="_top">AWS
* API Documentation</a>
*/
@Override
public UpdateTagOptionResult updateTagOption(UpdateTagOptionRequest request) {
request = beforeClientExecution(request);
return executeUpdateTagOption(request);
}
@SdkInternalApi
final UpdateTagOptionResult executeUpdateTagOption(UpdateTagOptionRequest updateTagOptionRequest) {
ExecutionContext executionContext = createExecutionContext(updateTagOptionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<UpdateTagOptionRequest> request = null;
Response<UpdateTagOptionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateTagOptionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateTagOptionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateTagOption");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<UpdateTagOptionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateTagOptionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
* <p>
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> anonymousInvoke(Request<Y> request,
HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> doInvoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler<AmazonServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
}
| [
""
] | |
53ae497d0a2baebe52da825e20a8002d7b319e55 | 83436380fe01acf30dd154294b3da930e58c5ceb | /BelejanorProject/src/com/belejanor/switcher/bimo/pacs/pacs_007_041/PaymentMethod4Code.java | 005eefafd402cacb5defcd3779f3601b28ba3b35 | [] | no_license | jmptrader/BelejanorSwitch | 83e847ee3dc6a555a40e6347f40af4e106c9054f | ce11d46b5ed52b89d22b5890f1e4fad29730125a | refs/heads/master | 2023-02-07T07:22:42.266465 | 2020-12-27T05:07:15 | 2020-12-27T05:07:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,248 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2018.02.26 at 10:01:11 AM COT
//
package com.belejanor.switcher.bimo.pacs.pacs_007_041;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PaymentMethod4Code.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="PaymentMethod4Code">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="CHK"/>
* <enumeration value="TRF"/>
* <enumeration value="DD"/>
* <enumeration value="TRA"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "PaymentMethod4Code")
@XmlEnum
public enum PaymentMethod4Code {
CHK,
TRF,
DD,
TRA;
public String value() {
return name();
}
public static PaymentMethod4Code fromValue(String v) {
return valueOf(v);
}
}
| [
"jorellana29@gmail.com"
] | jorellana29@gmail.com |
9e938ecb7d0b421f5bc5c9812422fe0c4b488c51 | 1c2f4208d4da12f451f5c7d181aa9526d198392f | /src/main/java/module1/homework/ThirdClass.java | e99cd2c5caf83589d5aab9fddc64e6d4942ef2f5 | [] | no_license | Zakhar23/GoIT | 87041cdbe15e8acb08032dd636969497f41bf25a | aec80bdad05e8ba2b576a4a554f8a0ca30ced848 | refs/heads/master | 2021-01-10T18:09:49.329050 | 2017-03-09T22:20:06 | 2017-03-09T22:20:06 | 71,928,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java |
package module1.homework;
public class ThirdClass {
public static void main(String[] args) {
System.out.println("Мой третий класс на Java");
}
}
| [
"kyrychenko.zakhar@gmail.com"
] | kyrychenko.zakhar@gmail.com |
4635c471a4d0d37e6af468ff638ff792d730aacc | cb460f4f47b3642f3c957b578ba67c2d4b2f2c18 | /apiclient/event/ShopifyEventListResponse.java | ac4831d11d77cd982805c51209b3016cd3a19398 | [] | no_license | jamespharaoh/jpstack-shopify | 1d59d046443cef7a7267a0dd10ef8767f7f7e614 | edf5517151f01f6e101ed81a3ac9a32e1cced26f | refs/heads/master | 2020-12-08T08:59:16.716256 | 2017-08-16T15:04:47 | 2017-08-16T15:04:47 | 99,679,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | package wbs.integrations.shopify.apiclient.event;
import static wbs.utils.collection.CollectionUtils.emptyList;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;
import wbs.framework.data.annotations.DataChildren;
import wbs.framework.data.annotations.DataClass;
import wbs.integrations.shopify.apiclient.ShopifyApiResponse;
@Accessors (fluent = true)
@Data
@DataClass
public
class ShopifyEventListResponse
implements ShopifyApiResponse {
@DataChildren (
childrenElement = "events")
List <ShopifyEventResponse> events =
emptyList ();
}
| [
"james@pharaoh.uk"
] | james@pharaoh.uk |
b170ce9c96ff6e26a8f1ff64cc4f6790fc1dd55d | 8d719f5f4994d110c46ddcf4c9dc86320efc6969 | /src/main/java/com/epam/training/tasks/stoss/connections/ConnectionFactory.java | b611e306963bf6f3f4d0351cdf7a00e61db08975 | [] | no_license | smilique/Stoss | 189ced621f60bfd93835a5d7a6a2b686e09bacd1 | 38ea1f38dedf28931280ff72ffb5ff8c97200263 | refs/heads/main | 2023-06-17T17:54:44.400143 | 2021-07-16T10:15:40 | 2021-07-16T10:15:40 | 349,184,072 | 0 | 0 | null | 2021-07-16T10:15:41 | 2021-03-18T18:49:07 | Java | UTF-8 | Java | false | false | 1,953 | java | package com.epam.training.tasks.stoss.connections;
import com.epam.training.tasks.stoss.loaders.PropertyLoader;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
public class ConnectionFactory {
private final static Logger LOGGER = Logger.getLogger(ConnectionFactory.class);
private final static String DB_PROPERTIES = "/db.properties";
private final static String DRIVER_KEY = "database.driver";
private final static String URL_KEY = "database.url";
private final static String USER_KEY = "database.username";
private final static String PASSWORD_KEY = "database.password";
private String dbDriver;
private String dbUrl;
private String dbUser;
private String dbPassword;
public ConnectionFactory() {
try {
initializeProperties();
} catch (ConnectionException e) {
LOGGER.error(e);
}
}
public Connection create() throws ConnectionException {
try {
Class.forName(dbDriver);
Connection connection = DriverManager.getConnection(dbUrl,dbUser,dbPassword);
return connection;
} catch (ClassNotFoundException | SQLException e) {
LOGGER.error(e);
throw new ConnectionException(e);
}
}
private void initializeProperties() throws ConnectionException{
try {
Properties properties = new PropertyLoader().load(DB_PROPERTIES);
dbDriver = properties.getProperty(DRIVER_KEY);
dbUser = properties.getProperty(USER_KEY);
dbPassword = properties.getProperty(PASSWORD_KEY);
dbUrl = properties.getProperty(URL_KEY);
} catch (IOException e) {
LOGGER.error(e);
throw new ConnectionException(e);
}
}
}
| [
"smile@uvaga.by"
] | smile@uvaga.by |
ffb72993513b0247459e2caa5320faf2fe0abfba | 3ac33b148e9f93fabff8b1ab70eb25a504ae67c9 | /java/ms-framework-model/src/main/java/cn/cloudbed/mylibrary/framework/domain/course/ext/TeachplanExt.java | 6cf7dc444b02054de67e4f42a7c0d27a4a068d2f | [] | no_license | zw3413/mylibrary | 538fd5dbc37dbc4219587d29f1feffede92992b9 | 252614fb6cb1e4260788c0dcda51300497443990 | refs/heads/master | 2023-07-22T06:48:27.489457 | 2023-07-17T12:32:27 | 2023-07-17T12:32:27 | 237,582,379 | 0 | 0 | null | 2023-03-03T20:55:58 | 2020-02-01T08:01:31 | JavaScript | UTF-8 | Java | false | false | 459 | java | package cn.cloudbed.mylibrary.framework.domain.course.ext;
import cn.cloudbed.mylibrary.framework.domain.course.Teachplan;
import lombok.Data;
import lombok.ToString;
/**
* Created by admin on 2018/2/7.
*/
@Data
@ToString
public class TeachplanExt extends Teachplan {
//媒资文件id
private String mediaId;
//媒资文件原始名称
private String mediaFileOriginalName;
//媒资文件访问地址
private String mediaUrl;
}
| [
"guoo999999@126.com"
] | guoo999999@126.com |
47f7f370a88817dec67b3df3b26ea8bc668435f6 | bbba4f226c5ce6aa071054530b8ff66d6553dc42 | /src/us/hexcoder/asm6502/settings/Asm6502ColorSettingsPage.java | c9b4f4c7a0a1a8db570e4cae44d36d849e46a2d3 | [] | no_license | p-a/IntelliJ-6502 | 6a2e685e840b98efe420eeadff835ec41b4088d9 | 3792b625604c7a8b4d7e3a7cb4828006e9e363f9 | refs/heads/master | 2021-01-21T01:17:29.171943 | 2014-06-30T17:11:18 | 2014-06-30T17:11:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,088 | java | package us.hexcoder.asm6502.settings;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.options.colors.AttributesDescriptor;
import com.intellij.openapi.options.colors.ColorDescriptor;
import com.intellij.openapi.options.colors.ColorSettingsPage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import us.hexcoder.asm6502.configuration.Asm6502Icons;
import us.hexcoder.asm6502.highlighter.Asm6502SyntaxHighlighter;
import us.hexcoder.asm6502.highlighter.Asm6502TextAttribute;
import javax.swing.*;
import java.io.*;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.Map;
/**
* User: 67726e
*/
public class Asm6502ColorSettingsPage implements ColorSettingsPage {
private static final String DEMO_URL = "/us/hexcoder/asm6502/resources/demo.6502";
private static final String DEMO_TEXT;
private static final AttributesDescriptor[] DESCRIPTORS;
static {
InputStream inputStream = null;
BufferedReader reader = null;
try {
inputStream = Asm6502ColorSettingsPage.class.getClassLoader().getResourceAsStream(DEMO_URL);
reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
StringBuilder builder = new StringBuilder();
while ((line = reader.readLine()) != null) {
builder.append(line).append(System.getProperty("line.separator"));
}
DEMO_TEXT = builder.toString();
} catch (IOException e) {
throw new RuntimeException("Unable to load 6502 demo text", e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
throw new RuntimeException("Unable to close 6502 demo text input stream", e);
}
}
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
throw new RuntimeException("Unable to close 6502 demo text input stream", e);
}
}
}
EnumSet<Asm6502TextAttribute> textAttributes = EnumSet.allOf(Asm6502TextAttribute.class);
DESCRIPTORS = new AttributesDescriptor[textAttributes.size()];
Iterator<Asm6502TextAttribute> iterator = textAttributes.iterator();
for (int i = 0; iterator.hasNext(); i++) {
Asm6502TextAttribute textAttribute = iterator.next();
DESCRIPTORS[i] = new AttributesDescriptor(textAttribute.getName(), textAttribute.toKey());
}
}
@Nullable
@Override
public Icon getIcon() {
return Asm6502Icons.ICON;
}
@NotNull
@Override
public SyntaxHighlighter getHighlighter() {
return new Asm6502SyntaxHighlighter();
}
@NotNull
@Override
public String getDemoText() {
return DEMO_TEXT;
}
@Nullable
@Override
public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
return null;
}
@NotNull
@Override
public AttributesDescriptor[] getAttributeDescriptors() {
return DESCRIPTORS;
}
@NotNull
@Override
public ColorDescriptor[] getColorDescriptors() {
return ColorDescriptor.EMPTY_ARRAY;
}
@NotNull
@Override
public String getDisplayName() {
return "6502";
}
}
| [
"glenn@hexcoder.us"
] | glenn@hexcoder.us |
bbab9a74efa38095500ddb8ff2ca2121d7798407 | 110d38a6d2ead1dd6ee8ff33ca44cec04fefb764 | /glviewsdk/src/main/java/com/glview/graphics/drawable/ClipDrawable.java | 2ba86a1e8cbc0ddbfcb7d5f16599e0251a14e061 | [] | no_license | whyisandroid/EEEReader | 803e2a17a38380f457777ee953408f438c088ff3 | 0e52589bf2f87f81ef23dd750f5638e459e0376f | refs/heads/master | 2020-12-29T01:54:10.290382 | 2016-08-01T03:16:53 | 2016-08-01T03:16:53 | 41,714,910 | 3 | 1 | null | 2015-10-22T11:46:28 | 2015-09-01T03:30:44 | Java | UTF-8 | Java | false | false | 9,791 | java | /*
* Copyright (C) 2006 The Android Open Source Project
*
* 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.glview.graphics.drawable;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import com.glview.content.GLContext;
import com.glview.graphics.Rect;
import com.glview.hwui.GLCanvas;
import com.glview.view.Gravity;
/**
* A Drawable that clips another Drawable based on this Drawable's current
* level value. You can control how much the child Drawable gets clipped in width
* and height based on the level, as well as a gravity to control where it is
* placed in its overall container. Most often used to implement things like
* progress bars, by increasing the drawable's level with {@link
* android.graphics.drawable.Drawable#setLevel(int) setLevel()}.
* <p class="note"><strong>Note:</strong> The drawable is clipped completely and not visible when
* the level is 0 and fully revealed when the level is 10,000.</p>
*
* <p>It can be defined in an XML file with the <code><clip></code> element. For more
* information, see the guide to <a
* href="{@docRoot}guide/topics/resources/drawable-resource.html">Drawable Resources</a>.</p>
*
* @attr ref android.R.styleable#ClipDrawable_clipOrientation
* @attr ref android.R.styleable#ClipDrawable_gravity
* @attr ref android.R.styleable#ClipDrawable_drawable
*/
public class ClipDrawable extends Drawable implements Drawable.Callback {
private ClipState mClipState;
private final Rect mTmpRect = new Rect();
public static final int HORIZONTAL = 1;
public static final int VERTICAL = 2;
ClipDrawable() {
this(null, null);
}
/**
* @param orientation Bitwise-or of {@link #HORIZONTAL} and/or {@link #VERTICAL}
*/
public ClipDrawable(Drawable drawable, int gravity, int orientation) {
this(null, null);
mClipState.mDrawable = drawable;
mClipState.mGravity = gravity;
mClipState.mOrientation = orientation;
if (drawable != null) {
drawable.setCallback(this);
}
}
@Override
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs)
throws XmlPullParserException, IOException {
super.inflate(r, parser, attrs);
int type;
TypedArray a = obtainAttributes(
r, attrs, com.glview.R.styleable.ClipDrawable);
int orientation = a.getInt(
com.glview.R.styleable.ClipDrawable_clipOrientation,
HORIZONTAL);
int g = a.getInt(com.glview.R.styleable.ClipDrawable_gravity, Gravity.LEFT);
Drawable dr = GLContext.get().getResources().getDrawable(a.getResourceId(com.glview.R.styleable.ClipDrawable_drawable, 0));
a.recycle();
final int outerDepth = parser.getDepth();
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
if (type != XmlPullParser.START_TAG) {
continue;
}
dr = Drawable.createFromXmlInner(r, parser, attrs);
}
if (dr == null) {
throw new IllegalArgumentException("No drawable specified for <clip>");
}
mClipState.mDrawable = dr;
mClipState.mOrientation = orientation;
mClipState.mGravity = g;
dr.setCallback(this);
}
// overrides from Drawable.Callback
@Override
public void invalidateDrawable(Drawable who) {
final Callback callback = getCallback();
if (callback != null) {
callback.invalidateDrawable(this);
}
}
@Override
public void scheduleDrawable(Drawable who, Runnable what, long when) {
final Callback callback = getCallback();
if (callback != null) {
callback.scheduleDrawable(this, what, when);
}
}
@Override
public void unscheduleDrawable(Drawable who, Runnable what) {
final Callback callback = getCallback();
if (callback != null) {
callback.unscheduleDrawable(this, what);
}
}
// overrides from Drawable
@Override
public int getChangingConfigurations() {
return super.getChangingConfigurations()
| mClipState.mChangingConfigurations
| mClipState.mDrawable.getChangingConfigurations();
}
@Override
public boolean getPadding(Rect padding) {
// XXX need to adjust padding!
return mClipState.mDrawable.getPadding(padding);
}
@Override
public boolean setVisible(boolean visible, boolean restart) {
mClipState.mDrawable.setVisible(visible, restart);
return super.setVisible(visible, restart);
}
@Override
public void setAlpha(int alpha) {
mClipState.mDrawable.setAlpha(alpha);
}
@Override
public int getAlpha() {
return mClipState.mDrawable.getAlpha();
}
@Override
public int getOpacity() {
return mClipState.mDrawable.getOpacity();
}
@Override
public boolean isStateful() {
return mClipState.mDrawable.isStateful();
}
@Override
protected boolean onStateChange(int[] state) {
return mClipState.mDrawable.setState(state);
}
@Override
protected boolean onLevelChange(int level) {
mClipState.mDrawable.setLevel(level);
invalidateSelf();
return true;
}
@Override
protected void onBoundsChange(Rect bounds) {
mClipState.mDrawable.setBounds(bounds);
}
@Override
public void draw(GLCanvas canvas) {
if (mClipState.mDrawable.getLevel() == 0) {
return;
}
final Rect r = mTmpRect;
final Rect bounds = getBounds();
int level = getLevel();
int w = bounds.width();
final int iw = 0; //mClipState.mDrawable.getIntrinsicWidth();
if ((mClipState.mOrientation & HORIZONTAL) != 0) {
w -= (w - iw) * (10000 - level) / 10000;
}
int h = bounds.height();
final int ih = 0; //mClipState.mDrawable.getIntrinsicHeight();
if ((mClipState.mOrientation & VERTICAL) != 0) {
h -= (h - ih) * (10000 - level) / 10000;
}
final int layoutDirection = getLayoutDirection();
Gravity.apply(mClipState.mGravity, w, h, bounds, r, layoutDirection);
if (w > 0 && h > 0) {
canvas.save(GLCanvas.SAVE_FLAG_CLIP);
canvas.clipRect(r);
mClipState.mDrawable.draw(canvas);
canvas.restore();
}
}
@Override
public int getIntrinsicWidth() {
return mClipState.mDrawable.getIntrinsicWidth();
}
@Override
public int getIntrinsicHeight() {
return mClipState.mDrawable.getIntrinsicHeight();
}
@Override
public ConstantState getConstantState() {
if (mClipState.canConstantState()) {
mClipState.mChangingConfigurations = getChangingConfigurations();
return mClipState;
}
return null;
}
/** @hide */
@Override
public void setLayoutDirection(int layoutDirection) {
mClipState.mDrawable.setLayoutDirection(layoutDirection);
super.setLayoutDirection(layoutDirection);
}
final static class ClipState extends ConstantState {
Drawable mDrawable;
int mChangingConfigurations;
int mOrientation;
int mGravity;
private boolean mCheckedConstantState;
private boolean mCanConstantState;
ClipState(ClipState orig, ClipDrawable owner, Resources res) {
if (orig != null) {
if (res != null) {
mDrawable = orig.mDrawable.getConstantState().newDrawable(res);
} else {
mDrawable = orig.mDrawable.getConstantState().newDrawable();
}
mDrawable.setCallback(owner);
mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection());
mDrawable.setBounds(orig.mDrawable.getBounds());
mDrawable.setLevel(orig.mDrawable.getLevel());
mOrientation = orig.mOrientation;
mGravity = orig.mGravity;
mCheckedConstantState = mCanConstantState = true;
}
}
@Override
public Drawable newDrawable() {
return new ClipDrawable(this, null);
}
@Override
public Drawable newDrawable(Resources res) {
return new ClipDrawable(this, res);
}
@Override
public int getChangingConfigurations() {
return mChangingConfigurations;
}
boolean canConstantState() {
if (!mCheckedConstantState) {
mCanConstantState = mDrawable.getConstantState() != null;
mCheckedConstantState = true;
}
return mCanConstantState;
}
}
private ClipDrawable(ClipState state, Resources res) {
mClipState = new ClipState(state, this, res);
}
}
| [
"309928507@qq.com"
] | 309928507@qq.com |
7e522a4980af832a2c2f5ef24bab54d50def63a8 | 96dc4ae2214a68825ecfdae25dfbdc2e9e64ef25 | /app/src/main/java/com/raksha/bmsce/blooddonation/storage/SharedPreferenceManager.java | bfa29177b08cb03659f5992a0618d01baa43cd8e | [] | no_license | dishakhanted/BloodDonationApp | ef38077e935f334ae186aae7706d0ae193d6d205 | dd0bf090c00864fe975712ce8fa37e4d737360f9 | refs/heads/master | 2021-11-04T04:25:33.026380 | 2021-10-28T12:37:51 | 2021-10-28T12:37:51 | 253,213,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,636 | java | package com.raksha.bmsce.blooddonation.storage;
import android.content.Context;
import android.content.SharedPreferences;
import com.raksha.bmsce.blooddonation.App;
/**
* Created by riteshksingh on Apr, 2018
*/
public final class SharedPreferenceManager {
private static SharedPreferenceManager INSTANCE;
private final String NAME = "com.udacity.nanodegree.blooddonation";
private SharedPreferences mSharedPreferences;
private SharedPreferenceManager() {
mSharedPreferences =
App.getInstance().getApplicationContext().getSharedPreferences(NAME,
Context.MODE_PRIVATE);
}
public static SharedPreferenceManager getInstance() {
if (INSTANCE == null) {
synchronized (SharedPreferenceManager.class) {
if (INSTANCE == null) {
INSTANCE = new SharedPreferenceManager();
}
}
}
return INSTANCE;
}
public void put(String key, String value) {
mSharedPreferences.edit().putString(key, value).apply();
}
public void put(String key, int value) {
mSharedPreferences.edit().putInt(key, value).apply();
}
public void put(String key, boolean value) {
mSharedPreferences.edit().putBoolean(key, value).apply();
}
public String getString(String key) {
return mSharedPreferences.getString(key, "");
}
public int getInt(String key) {
return mSharedPreferences.getInt(key, -1);
}
public Boolean getBoolean(String key) {
return mSharedPreferences.getBoolean(key, false);
}
}
| [
"disha.khanted@gmail.com"
] | disha.khanted@gmail.com |
37e753d824a4594b15f87a0f7235865df14dd0d7 | 0f925190f06a2ae0fbdcb5525bd9ec5d8ecff227 | /myall/src/main/java/com/example/administrator/myall/view/IGirlView.java | 9c89ee9bd356894af9914cf8d69964eaa1f2a65b | [] | no_license | gggggggg1988/MyAll1 | 65cb6396a0089eafb84af6959e5495eab47d852d | d56ea2d1c7ce579fa38fabb03b531a00919115e9 | refs/heads/master | 2021-01-01T17:30:38.758272 | 2018-09-10T07:46:57 | 2018-09-10T07:46:57 | 98,092,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package com.example.administrator.myall.view;
import java.util.List;
import entity.Data;
/**
* Created by Administrator on 2018/3/25 0025.
*/
public interface IGirlView {
void showLoading();
void showGirls(List<Data> girls);
}
| [
"807117830@qq.com"
] | 807117830@qq.com |
05db4a4fc32c0362e94cdae2e2e509e8510f47a7 | 4a9ffd00cb443d44d61a26b9f68b23ec788ee5e2 | /src/main/java/sample/dao/DocumentDAO.java | 2b2c739507c405de34de6abc020b36ce6f03f974 | [] | no_license | dnschuelter/teste-hibernate | 5e5d7738a6f4ef0b49fe93c659f00a3cddcf63ae | b55a9e1fbffda1beaa57b5d34d1da88db9e40cc3 | refs/heads/master | 2021-01-10T13:01:05.955496 | 2016-03-30T19:23:13 | 2016-03-30T19:23:13 | 54,637,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package sample.dao;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import com.querydsl.jpa.impl.JPAQueryFactory;
import sample.entities.Document;
import sample.entities.QDocument;
@Stateless
public class DocumentDAO {
@PersistenceContext(unitName = "sample-jpa")
protected EntityManager entityManager;
public List<Document> findAll() {
JPAQueryFactory query = new JPAQueryFactory(entityManager);
return query.selectFrom(QDocument.document).fetch();
}
}
| [
"dn.schuelter@gmail.com"
] | dn.schuelter@gmail.com |
4d7f40e3aeba72f9be270867abd5294a80a852ae | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i357.java | a83a092d4736f04f4bbf313107ba16feba9e0dfe | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 67 | java | package number_of_direct_superinterfaces;
public interface i357 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
860620e6b8abb973cca7f3c6e29c986426dd61a8 | 2968a0638621342b5eb25abc2e63903644ef0ee4 | /src/com/TeB/Blocks/Tnt.java | 431ed070eaad05c69e6e77c7019cfa37ff1736d2 | [] | no_license | TeB1996/DungeonGame | 61bf200ac0559a8b2a53e2a193e5ad9aab776d82 | 85ff4cf9a3d275c7d999dc2495cf680e58e6c290 | refs/heads/master | 2020-04-06T06:52:03.456763 | 2013-12-03T07:29:12 | 2013-12-03T07:29:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package com.TeB.Blocks;
import com.TeB.DungeonGame.Explosion;
import com.TeB.DungeonGame.Map;
public class Tnt extends Block{
static boolean blockHasPlaceUse = true;
static boolean backgroundBlock = true;
static boolean i = false;
public void placeUs(int BlockPlacementId){
Map.b.load.setBlockValue(6, BlockPlacementId);
new Explosion(BlockPlacementId);
}
public boolean blockHasPlaceUse() {
return blockHasPlaceUse;
}
public boolean backgroundBlock(){
return backgroundBlock;
}
}
| [
"tom-erik.balestrand@hotmail.com"
] | tom-erik.balestrand@hotmail.com |
75c2a31b08330d6c03569fa61ec3b783f58b069f | 9c4959d56cfb1c38f190e3bb75ce2246d58339e7 | /src/main/java/al/ikubinfo/fjalorth/domain/User.java | e5b025477cb2b66657ed8bf33ed7a8100e8285bf | [] | no_license | goxhaj/fjalorth | 070b067173929815febf0a4dea957c8269d735cf | bbb18d22b9886ec2b23a49b5bc2203278090a0a0 | refs/heads/master | 2020-04-17T03:41:41.290578 | 2019-01-17T09:17:23 | 2019-01-17T09:17:23 | 166,196,294 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,383 | java | package al.ikubinfo.fjalorth.domain;
import org.hibernate.validator.constraints.Length;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import java.util.Set;
@Entity
@Table(name = "user")
public class User extends BaseEntity{
@Column(name = "email")
@Email(message = "*Ju lutem te vendosni emrin te sakte")
@NotEmpty(message = "*Ju lutem te vendosni email")
private String email;
@Column(name = "username")
@Length(min = 5, message = "*Ju lutem te vendosni username")
@NotEmpty(message = "*Please provide your username")
private String username;
@Column(name = "password")
@Length(min = 5, message = "*Passwordi duhet te kete te pakten 5 germa")
@NotEmpty(message = "*Ju lutem te vendosni passwordin")
private String password;
@Column(name = "firstname")
@NotEmpty(message = "*Ju lutem te vendosni emrin")
private String firstname;
@Column(name = "lastname")
@NotEmpty(message = "*Ju lutem te vendosni mbiemrin")
private String lastname;
@Column(name = "active")
private int active;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<Role> roles;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public int getActive() {
return active;
}
public void setActive(int active) {
this.active = active;
}
public Set<Role> getRoles() {
return roles;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
}
| [
"ardi.goxhaj@ikubinfo.al"
] | ardi.goxhaj@ikubinfo.al |
1dea56f09a16295555e66378f78b2f64beb38f2a | dc6236422c15b486cd4718ca1e513af6969fa26f | /app/src/main/java/com/example/shouyu1/User.java | 1210d457f016c67511be7f6828d878867e794d4a | [] | no_license | ChenYuchen20/sign-language-translation | f0e5cd9f5c0099fe21d49ebe7f626718400cc202 | 2082ba871fa256c2dc74675c171c1cddffa858d7 | refs/heads/main | 2023-02-05T08:06:07.919336 | 2020-12-28T07:26:43 | 2020-12-28T07:26:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 614 | java | package com.example.shouyu1;
import java.io.Serializable;
public class User implements Serializable
{
private String id;
private String username;
private String password;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"644238339@qq.com"
] | 644238339@qq.com |
795dba43017dc998e616d2ad7b33c831d9e209cf | e252cb9925fe5e5bae48a5f39dbc452c2537cd5f | /MenuProject/app/src/main/java/com/guette/menuproject/HelpActivityFragment.java | 6e3643dc1f1e2c9b4d564db841c26ac99c4157bd | [] | no_license | Guette/M4SAndroidCourse | 484e3a25fb947c63df20605eb15f0e161f209949 | 0ea1951318cc8ce46934ad966516b07d12c53363 | refs/heads/master | 2021-01-18T18:50:11.306608 | 2016-08-12T10:45:41 | 2016-08-12T10:45:41 | 61,647,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | package com.guette.menuproject;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A placeholder fragment containing a simple view.
*/
public class HelpActivityFragment extends Fragment {
public HelpActivityFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView= inflater.inflate(R.layout.fragment_help, container, false);
return rootView;
}
}
| [
"murge1988@gmail.com"
] | murge1988@gmail.com |
ebd8968ebd4d7e29e33f0ecda74dca37a38791a5 | 6b16c494584fea4b16adffe2047b78ceee05df0c | /tensquare_rabbitmqtest/src/main/java/com/tensquare/rabbitmq/consumer/Consumer3.java | 816f9f2b49c6ff604449214f658aab56b5ea0735 | [] | no_license | qingqing-1/tensquare_parent52 | 73a1a6a2194eb6b67be11599600539d10fbf6955 | 80720fb3b7841b6c1ddb4a849e5a39893af99ea7 | refs/heads/master | 2022-04-08T11:09:44.188488 | 2020-02-17T04:47:42 | 2020-02-17T04:47:42 | 275,351,140 | 2 | 0 | null | 2020-06-27T10:43:12 | 2020-06-27T10:43:12 | null | UTF-8 | Java | false | false | 399 | java | package com.tensquare.rabbitmq.consumer;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Component
@RabbitListener(queues = "danei")
public class Consumer3 {
@RabbitHandler
public void getMsg(String msg){
System.out.println("danei" + msg);
}
}
| [
"13516139951@163.com"
] | 13516139951@163.com |
8a76caf9fdf16ba3d2f4d32352eaf951e17973c3 | 0fa02a3a53ac0f18309803b63616aa705fcf45a0 | /src/main/java/ro/cc/web/rest/errors/EmailAlreadyUsedException.java | 817fd5280d081fad8bc9f9ebcbb87e5cd3391cf9 | [] | no_license | RaduGheorghescu/shop | 7ae7f5cebb749e683327b6bc2fecdd37e67ff58e | d5c5a2c9ede9ba5c0fe84bc809ba775391d38b3e | refs/heads/master | 2020-04-16T11:11:32.998397 | 2019-01-13T16:20:18 | 2019-01-13T16:20:18 | 165,526,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package ro.cc.web.rest.errors;
public class EmailAlreadyUsedException extends BadRequestAlertException {
private static final long serialVersionUID = 1L;
public EmailAlreadyUsedException() {
super(ErrorConstants.EMAIL_ALREADY_USED_TYPE, "Email is already in use!", "userManagement", "emailexists");
}
}
| [
"teodor.tincu@additiv.ch"
] | teodor.tincu@additiv.ch |
55e69a83cee79286477330f9ce166f42f229ee37 | f502a47c9c172af4eb012b91debcb6c76e4f37f2 | /Snake/src/src/com/snake/Controller.java | eddb69d80508bf616baa8ff44b83cd28871b0d72 | [] | no_license | slhczz/gitDown | b2cfb0d3e399fe5b9ce4d779f39bc4ebb1f4a738 | 49723072a9052405003d1b9246de57e5c5e2b191 | refs/heads/master | 2020-03-28T18:44:49.054698 | 2018-09-16T07:57:50 | 2018-09-16T07:57:50 | 148,905,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,062 | java | package src.com.snake;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class Controller extends KeyAdapter implements SnakeListener {
private Snake snake;
private Food food;
private Ground ground;
private GamePanel gamePanel;
// 有参构造
public Controller(Snake snake, Food food, Ground ground, GamePanel gamePanel) {
super();
this.snake = snake;
this.food = food;
this.ground = ground;
this.gamePanel = gamePanel;
}
//键盘监听 控制蛇的上下左右移动
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
switch(e.getKeyCode()){
case KeyEvent.VK_UP:
snake.changeDirection(snake.UP);
break;
case KeyEvent.VK_DOWN:
snake.changeDirection(snake.DOWN);
break;
case KeyEvent.VK_LEFT:
snake.changeDirection(snake.LEFT);
break;
case KeyEvent.VK_RIGHT:
snake.changeDirection(snake.RIGHT);
break;
case KeyEvent.VK_SPACE:
if(!snake.isLife()){
snake.setLife(true);
}else{
snake.setLife(false);
}
break;
}
}
// 蛇吃到食物和蛇撞到墙及蛇碰到身子
@Override
public void snakeMoved(Snake snake) {
if(food.isSnakeEatFood(snake)){
snake.eatFood();
food.newFood(ground.getPoint());
}
if(ground.isSnakeEatRock(snake)){
snake.GameOver("蛇撞墙啦!!");
}
if(snake.isEatBody()){
snake.GameOver("蛇触碰到身体啦!!");
}
gamePanel.display(snake, food, ground);
}
// 开始游戏
public void newGame(){
snake.start();
food.newFood(ground.getPoint());
}
}
| [
"slhczxz@gmail.com"
] | slhczxz@gmail.com |
dbb30482dc93ddff920b5fd6cdbc2d0c39477234 | 4911d61e641b95a014616a04412a48e237a0516c | /src/main/java/akademia/repositories/RoomRepository.java | 1b514b17f47ffad53a1770f4a83bbaafbe99ac73 | [] | no_license | ania533/hotele | 29b3f598462452b05a58bdc38e6865750e743b44 | 751249aabc88f45f5486eb401dbd87752659e614 | refs/heads/master | 2022-01-01T07:15:09.922068 | 2020-04-15T22:16:56 | 2020-04-15T22:16:56 | 252,500,660 | 0 | 0 | null | 2021-12-10T01:36:41 | 2020-04-02T15:55:19 | Java | UTF-8 | Java | false | false | 261 | java | package akademia.repositories;
import akademia.model.dao.Room;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface RoomRepository extends JpaRepository <Room, Long> {
}
| [
"ania.k33@wp.pl"
] | ania.k33@wp.pl |
728d93f5a979699f6c2e441154c79ec2e99edf51 | c2882688b3d1bb00785e745cce06063e5663afc7 | /rest/repository-resource/src/main/java/org/bndly/rest/repository/resources/beans/api/BeanWrapper.java | e01d742e6817cb4da4d802fa166e8eb956733770 | [
"Apache-2.0"
] | permissive | bndly/bndly-commons | e04be01aabcb9e5ff6d15287a3cfa354054a26fe | 6734e6a98f7e253ed225a4f2cce47572c5a969cb | refs/heads/master | 2023-04-03T04:20:47.954354 | 2023-03-17T13:49:57 | 2023-03-17T13:49:57 | 275,222,708 | 1 | 2 | Apache-2.0 | 2023-01-02T21:59:50 | 2020-06-26T18:31:34 | Java | UTF-8 | Java | false | false | 2,148 | java | package org.bndly.rest.repository.resources.beans.api;
/*-
* #%L
* REST Repository Resource
* %%
* Copyright (C) 2013 - 2020 Cybercon GmbH
* %%
* 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.
* #L%
*/
import org.bndly.schema.api.repository.beans.Bean;
import org.bndly.schema.api.repository.beans.BeanResolver;
import java.util.Iterator;
import java.util.Map;
/**
*
* @author cybercon <bndly@cybercon.de>
*/
public abstract class BeanWrapper implements Bean {
private final Bean wrapped;
public BeanWrapper(Bean wrapped) {
if (wrapped == null) {
throw new IllegalArgumentException("wrapped bean can not be null");
}
this.wrapped = wrapped;
}
@Override
public final BeanResolver getBeanResolver() {
return wrapped.getBeanResolver();
}
@Override
public final String getName() {
return wrapped.getName();
}
@Override
public final String getPath() {
return wrapped.getPath();
}
@Override
public final String getBeanType() {
return wrapped.getBeanType();
}
@Override
public Bean getParent() {
return wrapped.getParent();
}
@Override
public final Bean getChild(String name) {
return wrapped.getChild(name);
}
@Override
public final Iterator<Bean> getChildren() {
return wrapped.getChildren();
}
@Override
public final Map<String, Object> getProperties() {
return wrapped.getProperties();
}
@Override
public final Object getProperty(String name) {
return wrapped.getProperty(name);
}
@Override
public final Object get(String name) {
return wrapped.get(name);
}
@Override
public <T> T morphTo(Class<T> type) {
return wrapped.morphTo(type);
}
}
| [
"mika.goeckel@cybercon.de"
] | mika.goeckel@cybercon.de |
b0b8fe81779f269a57ff210be9c5d8e8c2133b6e | 379a959dd7d3d396232df39e18b7311874dce6d0 | /app/src/main/java/com/hut/zero/adapter/MainPagerAdapter.java | 478c72ec5cde2ebc5583015dad435fd89e01bec1 | [
"Apache-2.0"
] | permissive | 374901588/PaperPlane | bb15ac18ac90349205eae23eaf3db68ca2b638e9 | 06cf4b4291203d629ffd9fda72be55394e77bfb8 | refs/heads/master | 2021-01-19T19:55:11.194281 | 2017-05-02T07:05:17 | 2017-05-02T07:05:17 | 88,465,423 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,046 | java | package com.hut.zero.adapter;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.hut.zero.R;
import com.hut.zero.homepage.DoubanMomentFragment;
import com.hut.zero.homepage.GuokeHandpickFragment;
import com.hut.zero.homepage.ZhihuDailyFragment;
/**
* Created by Zero on 2017/4/2.
*/
public class MainPagerAdapter extends FragmentPagerAdapter {
private String[] mTitles;
private ZhihuDailyFragment zhihuDailyFragment;
private GuokeHandpickFragment guokeHandpickFragment;
private DoubanMomentFragment doubanMomentFragment;
public MainPagerAdapter(FragmentManager fm, Context context, ZhihuDailyFragment zhihuDailyFragment, GuokeHandpickFragment guokeHandpickFragment, DoubanMomentFragment doubanMomentFragment) {
super(fm);
mTitles = new String[]{context.getResources().getString(R.string.zhihu_daily),
context.getResources().getString(R.string.guokr_handpick),
context.getResources().getString(R.string.douban_moment)};
this.zhihuDailyFragment=zhihuDailyFragment;
this.doubanMomentFragment=doubanMomentFragment;
this.guokeHandpickFragment=guokeHandpickFragment;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 1:return guokeHandpickFragment;
case 2:return doubanMomentFragment;
default:return zhihuDailyFragment;
}
}
@Override
public int getCount() {
return mTitles.length;
}
@Override
public CharSequence getPageTitle(int position) {
return mTitles[position];
}
public ZhihuDailyFragment getZhihuDailyFragment() {
return zhihuDailyFragment;
}
public GuokeHandpickFragment getGuokeHandpickFragment() {
return guokeHandpickFragment;
}
public DoubanMomentFragment getDoubanMomentFragment() {
return doubanMomentFragment;
}
}
| [
"374901588@qq.com"
] | 374901588@qq.com |
ce7ed40337b66ae88ca615d8f1f9c4d220e18079 | 06a92e5cc361a7af8e67560cb33df00b0d1247b0 | /app/src/main/java/com/parrot/freeflight/receivers/MediaReadyDelegate.java | 17e74758c914970fa6cd04d5bfab98ef5c35a2c8 | [] | no_license | CurlSudoBash/LimeLight | eea0d03dd387d26132d4a4f96fd954c10e4c5b74 | 0ae99f8b03ab229118f6edfcdce3d827c2a75928 | refs/heads/master | 2020-03-31T18:15:21.178507 | 2019-11-30T18:35:21 | 2019-11-30T18:35:21 | 152,451,485 | 12 | 1 | null | 2019-01-31T00:02:59 | 2018-10-10T16:02:04 | C | UTF-8 | Java | false | false | 150 | java | package com.parrot.freeflight.receivers;
import java.io.File;
public interface MediaReadyDelegate
{
public void onMediaReady(File mediaFile);
}
| [
"anish.mukherjee1996@gmail.com"
] | anish.mukherjee1996@gmail.com |
cc77879419d98fece070a129f38e9a6d643d790d | 2d53d6f8d3e0e389bba361813e963514fdef3950 | /Command_injection/CWE78_OS_Command_Injection__getCookies_Servlet_52c.java | 6d3f2ed2a97b4066d14a4039b17e01fc4fb605ff | [] | no_license | apobletts/ml-testing | 6a1b95b995fdfbdd68f87da5f98bd969b0457234 | ee6bb9fe49d9ec074543b7ff715e910110bea939 | refs/heads/master | 2021-05-10T22:55:57.250937 | 2018-01-26T20:50:15 | 2018-01-26T20:50:15 | 118,268,553 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,127 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__getCookies_Servlet_52c.java
Label Definition File: CWE78_OS_Command_Injection.label.xml
Template File: sources-sink-52c.tmpl.java
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: getCookies_Servlet Read data from the first cookie using getCookies()
* GoodSource: A hardcoded string
* Sinks: exec
* BadSink : dynamic command execution with Runtime.getRuntime().exec()
* Flow Variant: 52 Data flow: data passed as an argument from one method to another to another in three different classes in the same package
*
* */
package testcases.CWE78_OS_Command_Injection;
import testcasesupport.*;
import javax.servlet.http.*;
public class CWE78_OS_Command_Injection__getCookies_Servlet_52c
{
public void badSink(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String osCommand;
if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)
{
/* running on Windows */
osCommand = "c:\\WINDOWS\\SYSTEM32\\cmd.exe /c dir ";
}
else
{
/* running on non-Windows */
osCommand = "/bin/ls ";
}
/* PRAETORIAN: command injection */
Process process = Runtime.getRuntime().exec(osCommand + data);
process.waitFor();
}
/* goodG2B() - use goodsource and badsink */
public void goodG2BSink(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String osCommand;
if(System.getProperty("os.name").toLowerCase().indexOf("win") >= 0)
{
/* running on Windows */
osCommand = "c:\\WINDOWS\\SYSTEM32\\cmd.exe /c dir ";
}
else
{
/* running on non-Windows */
osCommand = "/bin/ls ";
}
/* POTENTIAL FLAW: command injection */
Process process = Runtime.getRuntime().exec(osCommand + data);
process.waitFor();
}
}
| [
"anna.pobletts@praetorian.com"
] | anna.pobletts@praetorian.com |
f3bc22c09e04f1f0cb00f816a77d0b8339b9bcc8 | f4a7a24091f4d2b69d452d0b6842eee88e3d1cfc | /app/src/main/java/com/lytech/rainsilk/webviewapp/Shop_1.java | b237445ef6b79e763ca8f8fdf4ef1f1c3b79ea75 | [] | no_license | b150132/bgproject | c11e2591fc3199fcdbc29a09c4af27d8f1baab3c | 540048310bae2e39541cfcfd8b940560abddb0fc | refs/heads/master | 2020-04-06T07:07:58.776349 | 2016-07-28T09:50:07 | 2016-07-28T09:50:07 | 64,383,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,212 | java | package com.lytech.rainsilk.webviewapp;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
/**
* Created by rainsilk on 2016/2/24.
*/
public class Shop_1 extends Activity {
public static final int CONNECTION_TIMEOUT = 30000; //30 second
public static final String SERVER_ADDRESS = "http://lytechly.comxa.com/";
int shopCommodityNum = 6; //店家商品數量
private static final int RESULT_LOAD_IMAGE = 0, RESULT_LOAD_IMAGE1 = 1, RESULT_LOAD_IMAGE2 = 2, RESULT_LOAD_IMAGE3 = 3, RESULT_LOAD_IMAGE4 = 4, RESULT_LOAD_IMAGE5 = 5, RESULT_LOAD_IMAGE6 = 6;
ImageView imgTitle;
ImageView[] imv = new ImageView[shopCommodityNum];
Button upload;
LocalDatabase localDatabase;
int imgupcount = 0;
String[] goods = new String[shopCommodityNum], goodsprice = new String[shopCommodityNum], goodscount = new String[shopCommodityNum];
private EditText[] etxs = new EditText[shopCommodityNum];
private EditText[] etxprices = new EditText[shopCommodityNum];
private EditText[] etxcounts = new EditText[shopCommodityNum];
int[] imvs = {R.id.imv1, R.id.imv2, R.id.imv3, R.id.imv4, R.id.imv5, R.id.imv6};
int[] tvs = {R.id.tv1, R.id.tv2, R.id.tv3, R.id.tv4, R.id.tv5, R.id.tv6};
int[] tvcosts = {R.id.tvcost1, R.id.tvcost2, R.id.tvcost3, R.id.tvcost4, R.id.tvcost5, R.id.tvcost6};
int[] tvcounts = {R.id.tvcount1, R.id.tvcount2, R.id.tvcount3, R.id.tvcount4, R.id.tvcount5, R.id.tvcount6};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.shop_1);
localDatabase = new LocalDatabase(this);
upload = (Button) findViewById(R.id.BUpbutton);
imgTitle = (ImageView) findViewById(R.id.imgTitle);
for (int i = 0; i < shopCommodityNum; i++)
imv[i] = (ImageView) findViewById(imvs[i]);
// imv2 = (ImageView)findViewById(R.id.imv2);
// imv3 = (ImageView)findViewById(R.id.imv3);
// imv4 = (ImageView)findViewById(R.id.imv4);
// imv5 = (ImageView)findViewById(R.id.imv5);
// imv6 = (ImageView)findViewById(R.id.imv6);
for (int i = 0; i < shopCommodityNum; i++)
etxs[i] = (EditText) findViewById(tvs[i]);
// etxs[0] =(EditText)findViewById(R.id.tv1);
// etxs[1] =(EditText)findViewById(R.id.tv2);
// etxs[2] =(EditText)findViewById(R.id.tv3);
// etxs[3] =(EditText)findViewById(R.id.tv4);
// etxs[4] =(EditText)findViewById(R.id.tv5);
// etxs[5] =(EditText)findViewById(R.id.tv6);
for (int i = 0; i < shopCommodityNum; i++) {
etxprices[i] = (EditText) findViewById(tvcosts[i]);
etxcounts[i] = (EditText) findViewById(tvcounts[i]);
}
// etxprices[0] = (EditText)findViewById(R.id.tvcost1);
// etxprices[1] = (EditText)findViewById(R.id.tvcost2);
// etxprices[2] = (EditText)findViewById(R.id.tvcost3);
// etxprices[3] = (EditText)findViewById(R.id.tvcost4);
// etxprices[4] = (EditText)findViewById(R.id.tvcost5);
// etxprices[5] = (EditText)findViewById(R.id.tvcost6);
}
public void onClick(View v) {
if (v.getId() == R.id.btnback) {
finish();
}
if (v.getId() == R.id.BUpbutton) {
upload.setEnabled(false);
Toast.makeText(Shop_1.this, "於提示上傳成功時前請勿移開畫面!!", Toast.LENGTH_LONG).show();
int count1 = 0;
for (EditText etx : etxs) {
goods[count1] = etx.getText().toString();
Log.v("EditText", count1 + "." + goods[count1]);
count1++;
}
int count2 = 0;
for (EditText etxprice : etxprices) {
goodsprice[count2] = etxprice.getText().toString();
Log.v("EditText2", count2 + "." + goodsprice[count2]);
count2++;
}
int count3 = 0;
for (EditText etxcount : etxcounts) {
goodscount[count3] = etxcount.getText().toString();
Log.v("EditText3", count3 + "." + goodscount[count3]);
count3++;
}
Contact contact = localDatabase.getLoggedInUser();
String shopname = contact.getUname();
//prepare image name
String titlestr = shopname + "title";
String onestr = shopname + "one";
String twostr = shopname + "two";
String thrstr = shopname + "three";
String fourstr = shopname + "four";
String fivestr = shopname + "five";
String sixstr = shopname + "six";
Bitmap image = ((BitmapDrawable) imgTitle.getDrawable()).getBitmap();
Bitmap[] bimage = new Bitmap[shopCommodityNum];
for (int j = 0; j < shopCommodityNum; j++)
bimage[j] = ((BitmapDrawable) imv[j].getDrawable()).getBitmap();
// Bitmap image2= ((BitmapDrawable)imv2.getDrawable()).getBitmap();
// Bitmap image3= ((BitmapDrawable)imv3.getDrawable()).getBitmap();
// Bitmap image4= ((BitmapDrawable)imv4.getDrawable()).getBitmap();
// Bitmap image5= ((BitmapDrawable)imv5.getDrawable()).getBitmap();
// Bitmap image6= ((BitmapDrawable)imv6.getDrawable()).getBitmap();
//先記錄商品資料
Commodity commodity;
Context mCtx;
mCtx = Shop_1.this;
String pnamelist[] = {onestr, twostr, thrstr, fourstr, fivestr, sixstr};
for (int k = 0; k < shopCommodityNum; k++) {
commodity = new Commodity(goods[k], Integer.toString(k + 1), shopname, goodsprice[k], goodscount[k], pnamelist[k]);
Log.e("rainsilk", "commodity:" + goods[k] + " " + Integer.toString(k + 1) + " " + shopname + " " + goodsprice[k] + " " + goodscount[k] + " " + pnamelist[k]);
ServerRequests serverRequests = new ServerRequests(mCtx);
serverRequests.storeCommDetailInBackground(commodity, new GetUserCallback() {
@Override
public void done(Contact returnedContact) {
Log.e("rainsilk", "commodity finish");
}
});
}
//上傳圖片
new UploadImage(image, titlestr).execute();
new UploadImage(bimage[0], onestr).execute();
new UploadImage(bimage[1], twostr).execute();
new UploadImage(bimage[2], thrstr).execute();
new UploadImage(bimage[3], fourstr).execute();
new UploadImage(bimage[4], fivestr).execute();
new UploadImage(bimage[5], sixstr).execute();
}
if (v.getId() == R.id.imgTitle) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE);
}
if (v.getId() == R.id.imv1) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE1);
}
if (v.getId() == R.id.imv2) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE2);
}
if (v.getId() == R.id.imv3) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE3);
}
if (v.getId() == R.id.imv4) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE4);
}
if (v.getId() == R.id.imv5) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE5);
}
if (v.getId() == R.id.imv6) {
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE6);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && data != null) {
Uri selectImage = data.getData();
imgTitle.setBackgroundColor(Color.TRANSPARENT); //@android:color/transparent
// imgTitle.setImageURI(selectImage);
String selectedImagePath2 = getPath(selectImage);
imgTitle.setImageBitmap(lessenUriImage(selectedImagePath2));
}
if (requestCode == RESULT_LOAD_IMAGE1 && resultCode == RESULT_OK && data != null) {
Uri selectImage = data.getData();
imv[0].setBackgroundColor(Color.TRANSPARENT); //@android:color/transparent
String selectedImagePath2 = getPath(selectImage);
imv[0].setImageBitmap(lessenUriImage(selectedImagePath2));
}
if (requestCode == RESULT_LOAD_IMAGE2 && resultCode == RESULT_OK && data != null) {
Uri selectImage = data.getData();
imv[1].setBackgroundColor(Color.TRANSPARENT); //@android:color/transparent
String selectedImagePath2 = getPath(selectImage);
imv[1].setImageBitmap(lessenUriImage(selectedImagePath2));
}
if (requestCode == RESULT_LOAD_IMAGE3 && resultCode == RESULT_OK && data != null) {
Uri selectImage = data.getData();
imv[2].setBackgroundColor(Color.TRANSPARENT); //@android:color/transparent
// imv3.setImageURI(selectImage);
String selectedImagePath2 = getPath(selectImage);
imv[2].setImageBitmap(lessenUriImage(selectedImagePath2));
}
if (requestCode == RESULT_LOAD_IMAGE4 && resultCode == RESULT_OK && data != null) {
Uri selectImage = data.getData();
imv[3].setBackgroundColor(Color.TRANSPARENT); //@android:color/transparent
//imv4.setImageURI(selectImage);
String selectedImagePath2 = getPath(selectImage);
imv[3].setImageBitmap(lessenUriImage(selectedImagePath2));
}
if (requestCode == RESULT_LOAD_IMAGE5 && resultCode == RESULT_OK && data != null) {
Uri selectImage = data.getData();
imv[4].setBackgroundColor(Color.TRANSPARENT); //@android:color/transparent
//imv5.setImageURI(selectImage);
String selectedImagePath2 = getPath(selectImage);
imv[4].setImageBitmap(lessenUriImage(selectedImagePath2));
}
if (requestCode == RESULT_LOAD_IMAGE6 && resultCode == RESULT_OK && data != null) {
Uri selectImage = data.getData();
imv[5].setBackgroundColor(Color.TRANSPARENT); //@android:color/transparent
//imv6.setImageURI(selectImage);
String selectedImagePath2 = getPath(selectImage);
imv[5].setImageBitmap(lessenUriImage(selectedImagePath2));
}
}
private class UploadImage extends AsyncTask<Void, Void, Void> {
Bitmap image;
String uname;
public UploadImage(Bitmap image, String uname) {
this.image = image;
this.uname = uname;
Log.e("rainsilkinfo", "UploadImage function");
}
@Override
protected Void doInBackground(Void... params) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
String encodedImage = Base64.encodeToString(byteArrayOutputStream.toByteArray(), Base64.DEFAULT);
ArrayList<NameValuePair> dataToSend = new ArrayList<>();
dataToSend.add(new BasicNameValuePair("uname", uname));
dataToSend.add(new BasicNameValuePair("image", encodedImage));
Log.e("rainsilkinfo", "uname=" + uname);
//Log.e("rainsilkinfo", "encodedImage=" + encodedImage);
HttpParams httpRequestParams = getHttpRequestParams();
HttpClient client = new DefaultHttpClient(httpRequestParams);
HttpPost post = new HttpPost(SERVER_ADDRESS + "SavePicture.php");
try {
post.setEntity(new UrlEncodedFormEntity(dataToSend));
client.execute(post);
Log.e("rainsilkinfo", "save picture...");
} catch (Exception e) {
e.printStackTrace();
Log.e("rainsilkinfo", "save picture error..");
//Toast.makeText(getApplicationContext(), uname+"上傳失敗", Toast.LENGTH_SHORT).show();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
imgupcount++;
if (imgupcount == 7) {
Toast.makeText(getApplicationContext(), "圖片全數上傳成功,離開", Toast.LENGTH_LONG).show();
finish();
} else
Toast.makeText(getApplicationContext(), "圖片上傳中......請稍候", Toast.LENGTH_SHORT).show();
}
}
private HttpParams getHttpRequestParams() {
HttpParams httpRequestParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpRequestParams, 1000 * 30);
HttpConnectionParams.setSoTimeout(httpRequestParams, 1000 * 30);
return httpRequestParams;
}
//圖片Outmemory處理
public String getPath(Uri uri) {
String[] projection = {MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
public final static Bitmap lessenUriImage(String path) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
Bitmap bitmap = BitmapFactory.decodeFile(path, options); //此时返回 bm 为空
options.inJustDecodeBounds = false; //缩放比。由于是固定比例缩放,只用高或者宽其中一个数据进行计算即可
int be = (int) (options.outHeight / (float) 320);
if (be <= 0)
be = 1;
options.inSampleSize = be; //重新读入图片,注意此时已经把 options.inJustDecodeBounds 设回 false 了
bitmap = BitmapFactory.decodeFile(path, options);
int w = bitmap.getWidth();
int h = bitmap.getHeight();
System.out.println(w + " " + h); //after zoom
return bitmap;
}
}
| [
"b150132@yahoo.ocm.tw"
] | b150132@yahoo.ocm.tw |
9b2e2f95b1e9009446ab8a55916bf6925f1b9760 | b85c966ec62dbeac12268a34d5cd5f042f711ec4 | /app/src/main/java/com/linken/yidian/page/NewsPortalActivity.java | ae6beeef756f4eaf9c6d06de7a413da941f7c167 | [] | no_license | led-os/yidian | bd73f50dca82c3df03b860bb8cbd0d34a4bc5895 | 8a7593221c939e323a2783aac8bb1b61c62075b6 | refs/heads/master | 2022-02-14T13:36:02.118175 | 2019-08-31T09:30:29 | 2019-08-31T09:30:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,844 | java | package com.linken.yidian.page;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.Button;
import com.umeng.analytics.MobclickAgent;
import com.linken.newssdk.exportui.NewsPortalFragment;
import com.linken.yidian.R;
/**
* Created by chenyichang on 2018/5/22.
*
* 多tab接入
*/
public class NewsPortalActivity extends FragmentActivity {
private Fragment fragmentNavi;
private Button btnRefresh;
private Button btnScroll2Top;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_portal);
fragmentNavi = new NewsPortalFragment();
getSupportFragmentManager().beginTransaction()
.replace(R.id.portal_container, fragmentNavi)
.commitNowAllowingStateLoss();
btnRefresh = findViewById(R.id.expose_refresh);
btnRefresh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((NewsPortalFragment)fragmentNavi).refreshCurrentChannel();
}
});
btnScroll2Top = findViewById(R.id.expose_scroll2top);
btnScroll2Top.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((NewsPortalFragment)fragmentNavi).scrollToTopPosition();
}
});
}
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
MobclickAgent.onPause(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}
| [
"liuxihui168168@163.com"
] | liuxihui168168@163.com |
3b0f3a43fda99e53f2de65acca9344f49047de5f | 4bbfa242353fe0485fb2a1f75fdd749c7ee05adc | /itable/src/main/java/com/ailk/openbilling/persistence/itable/dao/IBatchDataIndexSub2DaoImpl.java | 7ce2f4dc8eabadc5db7ac78c9dae5ec66379ca9e | [] | no_license | 859162000/infosystem | 88b23a5b386600503ec49b14f3b4da4df7a6d091 | 96d4d50cd9964e713bb95520d6eeb7e4aa32c930 | refs/heads/master | 2021-01-20T04:39:24.383807 | 2017-04-01T10:59:24 | 2017-04-01T10:59:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.ailk.openbilling.persistence.itable.dao;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
public class IBatchDataIndexSub2DaoImpl extends IBatchDataIndexSub2DaoSkeleton implements IBatchDataIndexSub2Dao{
private Log log = LogFactory.getLog(IBatchDataIndexSub2DaoImpl.class);
} | [
"ljyshiqian@126.com"
] | ljyshiqian@126.com |
0b52bc83b6cd703fc0c8f47891ea9d489567a369 | 7f69fa52559d51d782a30a7b69ebff41a3bdb22b | /iTunesFragments/app/src/main/java/com/example/mannu/inclass08/Thirdfrag.java | c225a0755862e8da4412d6c86e764bebea19d54e | [] | no_license | ysmanohar/Android | 6115812d6119b4a0c78d15700fe3886a288778c1 | 8dd1e7b9c0891020a5bf34c495e8eaaa8ecab259 | refs/heads/master | 2021-01-11T08:08:02.266108 | 2019-05-27T21:23:18 | 2019-05-27T21:23:18 | 69,406,523 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,930 | java | package com.example.mannu.inclass08;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
public class Thirdfrag extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
public static MainActivity activity;
public Thirdfrag(MainActivity activity) {
this.activity=activity;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
ImageView pic= (ImageView) getActivity().findViewById(R.id.imageView2);
TextView title= (TextView) getActivity().findViewById(R.id.texttitle);
mListener.onFragmentInteraction(title,pic);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_thirdfrag, container, false);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p/>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(TextView title,ImageView pic);
}
}
| [
"mannu610@gmail.com"
] | mannu610@gmail.com |
9eb6677d6ecf38b0cf717ff35453c655ce41b131 | 8fd764ef3ff45c147d30db2214a3ca8e7a114b20 | /src/main/java/level/ILevel.java | d3fdf667503be304165b849d95405c37c840a12a | [] | no_license | kimoanh29/BombermanGameVSSAD | 224c8366977488803adb9c376f060e512c6f928e | fe1a55a73d7515ca333a985e8c31cb18b7252a73 | refs/heads/main | 2023-01-31T06:25:34.609661 | 2020-12-03T20:50:40 | 2020-12-03T20:50:40 | 318,315,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package main.java.level;
import main.java.exceptions.LoadLevelException;
public interface ILevel {
public void loadLevel(String path) throws LoadLevelException;
}
| [
"noreply@github.com"
] | noreply@github.com |
8978dc6b056fc5f3fec606d0779aaa12c60ff169 | 617cffb27856ea3e65a6b8d294128795ba3a0646 | /src/de/hrw/actor/util/Timer.java | b6a267dc23a9e0dd810d1b9721442aed8ec90076 | [] | no_license | Qlik1234/Greep_2 | 39b19307055e0bb57edd0c9c31e4750f06abae69 | 0dde29c2cc52ed8d9a282724e1b373ea3d6e53c9 | refs/heads/master | 2022-12-08T08:36:04.465263 | 2020-08-29T17:11:51 | 2020-08-29T17:11:51 | 291,313,945 | 0 | 0 | null | 2020-08-29T17:11:52 | 2020-08-29T17:07:40 | Java | UTF-8 | Java | false | false | 1,277 | java | package de.hrw.actor.util;
import de.hrw.actor.TomatoPile;
import de.hrw.world.Earth;
/**
* A timer is a conter that automatically counts up as time goes on. This timer
* also checks whether the map has been completed (either time is up, or all
* tomatoes are gone).
*
* @author M Kolling
* @version 1.0
*/
public class Timer extends Counter {
private static final int GAME_TIME = 120;
private int tick;
public Timer() {
super("Time: ");
tick = 0;
}
/**
* Count time. Notify of 'Game Over' when game time is reached.
*/
public void act() {
tick++;
if (tick == 10) {
increment();
tick = 0;
checkFinish();
}
}
/**
* Check whether this map is finished. This is the case if time is up, or
* all tomatoes are gone.
*/
private void checkFinish() {
if (timeOut() || allTomatoesGone()) {
gameOver();
}
}
/**
* Return true if game time is up.
*/
private boolean timeOut() {
return getValue() >= GAME_TIME;
}
/**
* Return true if there are no tomatoes left in this map.
*/
private boolean allTomatoesGone() {
return getWorld().getObjects(TomatoPile.class).isEmpty();
}
/**
* Notify that the level is over.
*/
private void gameOver() {
((Earth) getWorld()).mapFinished(GAME_TIME - getValue());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
8a8a8d2199e451433c822926539a0adcb40c516c | e47a35d81ba248e7c8989357739a42d69b8cc7a2 | /falcon/falcon-core/src/test/java/com/zhiyi/falcon/core/test/service/DeliveryDataCommunityTest.java | 49fc9ef0ae701bb6a36aeefdb1085df88a941e19 | [] | no_license | noudisan/falcon_sample | 99827a027fcc2064171b63d40e3560c9c8543556 | 1d37960353f5acc0ce857e247780ca5585f11d6d | refs/heads/master | 2021-01-12T18:19:55.725026 | 2016-10-19T14:18:28 | 2016-10-19T14:18:28 | 71,364,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,763 | java | package com.zhiyi.falcon.core.test.service;
import com.zhiyi.common.dto.CommonResult;
import com.zhiyi.falcon.api.dto.DeliveryDataCommunityDto;
import com.zhiyi.falcon.api.dto.DeliveryDataCommunitySearchDto;
import com.zhiyi.falcon.api.enumType.DeliveryStatus;
import com.zhiyi.falcon.api.service.IDeliveryDataCommunityService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:test-applicationContext-core.xml")
public class DeliveryDataCommunityTest {
@Autowired
private IDeliveryDataCommunityService iDeliveryDataCommunityService;
@Test
public void testSave() throws Exception {
DeliveryDataCommunityDto deliveryDataCommunityDto = new DeliveryDataCommunityDto();
deliveryDataCommunityDto.setSectionId(1);
deliveryDataCommunityDto.setCommunityId(5);
deliveryDataCommunityDto.setDeliveryTaskId(5);
deliveryDataCommunityDto.setDeliveryNum(300);
deliveryDataCommunityDto.setDeliveryStatus(DeliveryStatus.TO_DELIVERY);
deliveryDataCommunityDto.setBeginDt(dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
deliveryDataCommunityDto.setDeliveryDt(dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
deliveryDataCommunityDto.setRemark("小区数据5");
iDeliveryDataCommunityService.save(deliveryDataCommunityDto);
}
private DeliveryDataCommunityDto getOne(int communityId){
CommonResult<DeliveryDataCommunityDto> result = iDeliveryDataCommunityService.queryDeliveryData(communityId);
// System.out.println(result);
return result.getData();
}
@Test
public void testQuery() throws Exception {
DeliveryDataCommunityDto deliveryDataCommunityDto = getOne(1);
System.out.println(deliveryDataCommunityDto);
}
@Test
public void testUpdate() throws Exception {
DeliveryDataCommunityDto deliveryDataCommunityDto = getOne(1);
deliveryDataCommunityDto.setRemark("doubi");
iDeliveryDataCommunityService.updateDeliveryData(deliveryDataCommunityDto);
DeliveryDataCommunityDto result = getOne(1);
Assert.assertEquals("doubi", result.getRemark());
}
@Test
public void testSelect(){
DeliveryDataCommunitySearchDto searchDto = new DeliveryDataCommunitySearchDto();
List<DeliveryDataCommunityDto> result = iDeliveryDataCommunityService.search(searchDto);
System.out.println(result);
Assert.assertNotNull(result);
Integer count = iDeliveryDataCommunityService.count(searchDto);
System.out.println(count);
Assert.assertNotNull(count);
}
public static boolean checkNullStr(String str) {
if (null == str || "undefined".equalsIgnoreCase(str)|| "null".equalsIgnoreCase(str) || "".equals(str.trim())) {
return true;
}
return false;
}
public static String dateToString(Date date, String formatString) {
if (checkNullStr(formatString)) {
formatString = "yyyy-MM-dd HH:mm:ss";
}
SimpleDateFormat dd = new SimpleDateFormat(formatString);
String str = "";
if (null != date) {
str = dd.format(date);
}
return str;
}
public static Date stringToDate(String date, String format) {
if (checkNullStr(date)) {
return null;
}
if (checkNullStr(format)) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
return sdf.parse(date);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
}
| [
"zhou_ttaaoo@126.com"
] | zhou_ttaaoo@126.com |
e3d5196602a1bc49ce68489df62a8464c4d36c1d | 41f36669e66c4dba3166ea6dd3bb2ad895b6e9bd | /homework013/app/src/main/java/com/example/homework013/database/UserDBHelper.java | faa7c8ba340821d79a01a4cd9067ef437b3a97ad | [] | no_license | Yan0611/finallyhomework | ba934ed4a7896be7978b96d2736cc49f7e0cf475 | f79843980ef130e357fd388d348c73315d00feeb | refs/heads/main | 2023-02-04T14:47:03.608139 | 2020-12-19T03:49:06 | 2020-12-19T03:49:06 | 322,760,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,459 | java | package com.example.homework013.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.example.homework013.bean.UserInfo;
import java.util.ArrayList;
public class UserDBHelper extends SQLiteOpenHelper {
private static final String TAG = "UserDBHelper"; //Log提示信息
private static final String DB_NAME = "user_reg_login.db"; // 数据库的名称
private static final int DB_VERSION = 1; // 数据库的版本号
private static UserDBHelper mHelper = null; // 数据库帮助器的实例
private SQLiteDatabase mDB = null; // 数据库的实例
public static final String TABLE_NAME = "users"; // 表的名称
private UserDBHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
private UserDBHelper(Context context, int version) {
super(context, DB_NAME, null, version);
}
// 利用单例模式获取数据库帮助器的唯一实例
public static UserDBHelper getInstance(Context context, int version) {
if (version > 0 && mHelper == null) {
mHelper = new UserDBHelper(context, version);
} else if (mHelper == null) {
mHelper = new UserDBHelper(context);
}
return mHelper;
}
// 打开数据库的读连接
public SQLiteDatabase openReadLink() {
if (mDB == null || !mDB.isOpen()) {
mDB = mHelper.getReadableDatabase();
}
return mDB;
}
// 打开数据库的写连接
public SQLiteDatabase openWriteLink() {
if (mDB == null || !mDB.isOpen()) {
mDB = mHelper.getWritableDatabase();
}
return mDB;
}
// 关闭数据库连接
public void closeLink() {
if (mDB != null && mDB.isOpen()) {
mDB.close();
mDB = null;
}
}
// 创建数据库,执行建表语句
public void onCreate(SQLiteDatabase db) {
// 先判断表是否存在,如果存在,先删除后创建
Log.d(TAG, "onCreate");
String drop_sql = "DROP TABLE IF EXISTS " + TABLE_NAME + ";";
Log.d(TAG, "drop_sql:" + drop_sql);
db.execSQL(drop_sql);
// username、password是保留字,不要用于对字段命名
String create_sql = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " ("
+ "_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
+ "name VARCHAR NOT NULL," + "update_time VARCHAR NOT NULL"
+ ",phone VARCHAR" + ",pwd VARCHAR"
+ ");";
Log.d(TAG, "create_sql:" + create_sql);
db.execSQL(create_sql);
}
// 修改数据库,执行表结构变更语句
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
// 根据指定条件删除表记录
public int delete(String condition) {
// 执行删除记录动作,该语句返回删除记录的数目
return mDB.delete(TABLE_NAME, condition, null);
}
// 删除该表的所有记录
public int deleteAll() {
// 执行删除记录动作,该语句返回删除记录的数目
return mDB.delete(TABLE_NAME, "1=1", null);
}
// 往该表添加一条记录
public long insert(UserInfo info) {
ArrayList<UserInfo> infoArray = new ArrayList<UserInfo>();
infoArray.add(info);
return insert(infoArray);
}
// 往该表添加多条记录
public long insert(ArrayList<UserInfo> infoArray) {
long result = -1;
for (int i = 0; i < infoArray.size(); i++) {
UserInfo info = infoArray.get(i);
ArrayList<UserInfo> tempArray = new ArrayList<UserInfo>();
// 如果存在同名记录,则更新记录
// 注意条件语句的等号后面要用单引号括起来
if (info.name != null && info.name.length() > 0) {
String condition = String.format("name='%s'", info.name);
tempArray = query(condition);
if (tempArray.size() > 0) {
update(info, condition);
result = tempArray.get(0).rowid;
continue;
}
}
// 如果存在同样的手机号码,则更新记录
if (info.phone != null && info.phone.length() > 0) {
String condition = String.format("phone='%s'", info.phone);
tempArray = query(condition);
if (tempArray.size() > 0) {
update(info, condition);
result = tempArray.get(0).rowid;
continue;
}
}
// 不存在唯一性重复的记录,则插入新记录
ContentValues cv = new ContentValues();
cv.put("name", info.name);
cv.put("update_time", info.update_time);
cv.put("phone", info.phone);
cv.put("pwd", info.pwd);
// 执行插入记录动作,该语句返回插入记录的行号
result = mDB.insert(TABLE_NAME, "", cv);
// 添加成功后返回行号,失败后返回-1
if (result == -1) {
return result;
}
}
return result;
}
// 根据条件更新指定的表记录
public int update(UserInfo info, String condition) {
ContentValues cv = new ContentValues();
cv.put("name", info.name);
cv.put("update_time", info.update_time);
cv.put("phone", info.phone);
cv.put("pwd", info.pwd);
// 执行更新记录动作,该语句返回记录更新的数目
return mDB.update(TABLE_NAME, cv, condition, null);
}
public int update(UserInfo info) {
// 执行更新记录动作,该语句返回记录更新的数目
return update(info, "rowid=" + info.rowid);
}
// 根据指定条件查询记录,并返回结果数据队列
public ArrayList<UserInfo> query(String condition) {
String sql = String.format("select rowid,_id,name,update_time,phone,pwd from %s where %s;", TABLE_NAME, condition);
Log.d(TAG, "query sql: " + sql);
ArrayList<UserInfo> infoArray = new ArrayList<UserInfo>();
// 执行记录查询动作,该语句返回结果集的游标
Cursor cursor = mDB.rawQuery(sql, null);
Log.d(TAG, "query cursor count:" + cursor.getCount());
// 循环取出游标指向的每条记录
while (cursor.moveToNext()) {
UserInfo info = new UserInfo();
info.rowid = cursor.getLong(1); // 取出长整型数
info.name = cursor.getString(2); // 取出字符串
info.update_time = cursor.getString(3);
info.phone = cursor.getString(4);
info.pwd = cursor.getString(5);
infoArray.add(info);
}
cursor.close(); // 查询完毕,关闭游标
return infoArray;
}
// 根据手机号码查询指定记录
public UserInfo queryByPhone(String phone) {
UserInfo info = null;
ArrayList<UserInfo> infoArray = query(String.format("phone='%s'", phone));
if (infoArray.size() > 0) {
info = infoArray.get(0);
}
return info;
}
}
| [
"574983781@qq.com"
] | 574983781@qq.com |
f36bbf961728b5019e76c69daff9366c82accbb4 | 883b7801d828a0994cae7367a7097000f2d2e06a | /python/experiments/projects/bakdata-conquery/real_error_dataset/1/192/QueryExecutor.java | 0d5f8b5b7ceccc543d27a343bf91e9c5e48fbc4a | [] | no_license | pombredanne/styler | 9c423917619912789289fe2f8982d9c0b331654b | f3d752d2785c2ab76bacbe5793bd8306ac7961a1 | refs/heads/master | 2023-07-08T05:55:18.284539 | 2020-11-06T05:09:47 | 2020-11-06T05:09:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,541 | java | package com.bakdata.conquery.models.query;
import com.bakdata.conquery.models.config.ConqueryConfig;
import com.bakdata.conquery.models.events.BlockManager;
import com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId;
import com.bakdata.conquery.models.query.entity.Entity;
import com.bakdata.conquery.models.query.queryplan.QueryPlan;
import com.bakdata.conquery.models.query.results.EntityResult;
import com.bakdata.conquery.models.query.results.ShardResult;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import lombok.extern.slf4j.Slf4j;
import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Slf4j
public class QueryExecutor implements Closeable {
private final ListeningExecutorService pool;
public QueryExecutor(ConqueryConfig config) {
this.pool = config.getQueries().getExecutionPool().createService("Query Executor %d");
}
public ShardResult execute(QueryPlanContext context, ManagedQuery query) {
query.start();
QueryPlan plan = query.getQuery().createQueryPlan(context);
return execute(
context.getBlockManager(),
new QueryContext(
context.getStorage()
),
query.getId(),
plan,
pool
);
}
public static ShardResult execute(BlockManager blockManager, QueryContext context, ManagedExecutionId queryId, QueryPlan plan, ListeningExecutorService executor) {
Collection<Entity> entries = blockManager.getEntities().values();
if(entries.isEmpty()) {
log.warn("entries for query {} are empty", queryId);
}
ShardResult result = new ShardResult();
result.setQueryId(queryId);
List<ListenableFuture<EntityResult>> futures = plan
.executeOn(context, entries)
.map(executor::submit)
.collect(Collectors.toList());
result.setFuture(Futures.allAsList(futures));
result.getFuture().addListener(result::finish, MoreExecutors.directExecutor());
return result;
}
@Override
public void close() throws IOException {
pool.shutdown();
try {
boolean success = pool.awaitTermination(1, TimeUnit.DAYS);
if (!success && log.isDebugEnabled()) {
log.error("Timeout has elapsed before termination completed for executor {}", pool);
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
| [
"fer.madeiral@gmail.com"
] | fer.madeiral@gmail.com |
c536e4b7cd113075f7739d3b989d587efdabc262 | f0f4d9766eb3db8430b0b73ebfec912e270a4139 | /hometask01/Task2.java | 155d797b710d946f820c234a364e86a00cd1772d | [] | no_license | AliaksandrNiehaj/HTPjd1 | 4478ccfd04697be52e9f52126eb27662f95502ed | 1ca941243a83cc9ae98773652531e0b34248bbd1 | refs/heads/master | 2021-05-04T22:19:50.802583 | 2018-04-20T05:46:20 | 2018-04-20T05:46:20 | 120,028,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,421 | java | package by.htp.jd1.unit1.hometask;
import java.util.Scanner;
import static java.lang.Math.pow;
import static java.lang.Math.log;
public class Task2 {
public static void main(String[] args) {
double a=0, b=0, c=0;
double res;
Scanner sc = new Scanner(System.in);
System.out.println("Введите значение переменной a: ");
while(sc.hasNext()) {
if (sc.hasNextDouble()) {
a = sc.nextDouble();
break;
}
else {
System.out.println("Необходимо ввести числовое значение.");
String s = sc.next();
}
}
System.out.println("Введите значение переменной b: ");
while(sc.hasNext()) {
if (sc.hasNextDouble()) {
b = sc.nextDouble();
break;
}
else {
System.out.println("Необходимо ввести числовое значение.");
String s = sc.next();
}
}
System.out.println("Введите значение переменной c: ");
while(sc.hasNext()) {
if (sc.hasNextDouble()) {
c = sc.nextDouble();
break;
}
else {
System.out.println("Необходимо ввести числовое значение.");
String s = sc.next();
}
}
res = (int)((pow(a,2) - (pow(b,2) - 2*b*c + pow(c,2)) + log(pow(b,2) + 1))*1000);
res = res/1000;
System.out.println("Результат вычисления: " + res);
}
} | [
"noreply@github.com"
] | noreply@github.com |
03d992a222ae21b1d8405e59d12d4dc41861e5b3 | e11c941d7245ef93c66d449822161f60982e8434 | /src/pattern/P21_InterpreterPattern/Client.java | b84b10c7e65a78195b0cec9d1e8cd417c03a9fbe | [] | no_license | qujunyao/DesignPattern | 4670134c2d18db55b80f4c68baa992001c168455 | d8df4f2a72ffd8147e1ebb7f1e401b79eb4dd2bd | refs/heads/master | 2020-03-10T05:54:44.315245 | 2018-09-14T05:53:52 | 2018-09-14T05:53:52 | 129,227,626 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,922 | java | package pattern.P21_InterpreterPattern;
import java.util.Stack;
/**
* 解析模式:场景类(使用较少)
*
* 定义: 是一种按照规定语法进行解析的方案,在现在的项目中使用较少。给定一门语言,定义他的文法的一种表示,并定义一个解析器,
* 该解析器使用该表达式来解析语言中的句子。
*
* 角色:
* 1、Expression:抽象表达式
* 具体的解释任务由各个实现类完成
* 2、TerminalExpression:终结符表达式
* 实现与文法中的元素相关联的解释操作,通常一个解释器模式中只有一个终结符表达式,但有多个实例,对应不同的终结符。
* 3、NonterminalExpression:非终结符表达式
* 文法中的每条规则对应于一个非终结表示。非终结表达式根据逻辑的复杂程度而增加,原则上每个文法规则都对应一个非终结表达式。
* 4、Context:环境角色
* 具体到例子中就是采用HashMap代替。
*
* 优点:
* 解析器是一个简单语法分析工具,它最显著的有点就是扩展性,修改语法规则只要修改相应的非终结表达式就可以了,若扩展语法,则只要增加
* 非终结表达式类就可以了。
*
* 缺点:
* 1、解析器模式会引起类膨胀
* 每个语法都要产生一个非终结表达式,语法规则比较复杂的时候,就可能产生大量的类文件,为维护带来了很大麻烦。
* 2、解析器模式采用递归调用方法
* 每个非终结表达式只关心自己有关的表达式,每个表达式都需要知道最终的结果,必须一层一层的剥离,无论是面向过程语言还是面向对象的语言,
* 递归都是在必要条件下使用的,它导致调试非常复杂。
* 3、效率问题
* 解析器模式由于使用了大量的循环递归,效率是一个不容忽视的问题,特别是一用于解析复杂、冗长的语法时,效率是难以忍受的。
*
* 使用场景
* 1、重复发生的问题。
* 2、一个简单语法需要解析的场景。
*
* 注意事项
* 尽量不要在重要的模块中使用解析器模式,否则维护是一个很大的问题,在项目中,可以使用shell、JRuby、Groovy等脚本语言来代替解析器模式。
*
*
* @author Administrator
*
*/
public class Client {
public static void main(String[] args) {
Context context = new Context();
// 通常定义一个语法容器,容纳一个具体的表达式,通常为ListArrays,Linkedlist,Stack等类型
Stack<Expression> stack = new Stack<>();
// for(;;) {
// 进行语法判断,并产生递归调用
// }
// 产生一个完整的语法树,由各个具体的语法分析进行解析。
Expression exp = stack.pop();
// 具体元素进入场景
exp.Interpreter(context);
}
}
| [
"38315789+qujunyao@users.noreply.github.com"
] | 38315789+qujunyao@users.noreply.github.com |
8486ffa14c3919cb55e4142fa848414d234babb3 | 589dc484b3d26038c15644bdd0a468a5ca1491cd | /Soft-Tech/src/soft/tech/Programador.java | 5396847d61c136383afd30feb1604fdbbc33c1a5 | [
"Apache-2.0"
] | permissive | Dustin2/javaHomeworks | 4cff40e597a9cf0487bd913bc285f07339dd5cc2 | 8cbb00a26d4a9aa117852aede6d38cab308d140a | refs/heads/master | 2020-04-25T23:51:48.667817 | 2019-04-02T03:02:55 | 2019-04-02T03:02:55 | 173,158,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 934 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package soft.tech;
/**
*
* @author PROGRAMAR
*/
public class Programador extends Empleado{
private int lineascodhora;
private String lenguajedom;
Programador(){
}
Programador(String name,String cedula,int edad,boolean casado,double sueldo,String lenguajedom,int lineascod){
super(name,cedula,edad,casado,sueldo);
this.lenguajedom=lenguajedom;
this.lineascodhora=lineascod;
}
public String getlenguaje(){
return lenguajedom;
}
public int gethoras(){
return lineascodhora;
}
public void setlengu(String len){
this.lenguajedom=len;
}
public void sethoras(int lineas){
this.lineascodhora=lineas;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
8a64de81d077cc8ed51e2ac503fb27e02b72398a | ab98ffe95a6ad888b932007d0a3126a0e69e0f13 | /src/main/java/com/example/demo/zip/ZipNio.java | d80d506b6a2fdd562f0f0685121fed5483f187e5 | [] | no_license | wgx88225/demo | d743d27e988786d22026d0793245a15637e9aad4 | 0632f3fbf0361fe89bae32c8e11a90f220040e37 | refs/heads/master | 2023-04-04T22:38:52.187189 | 2022-04-20T06:02:24 | 2022-04-20T06:02:24 | 186,254,029 | 0 | 0 | null | 2023-03-27T22:19:50 | 2019-05-12T12:47:16 | Java | UTF-8 | Java | false | false | 5,274 | java | package com.example.demo.zip;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import org.apache.commons.io.FileUtils;
import java.io.*;
import java.nio.MappedByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.Charset;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* @ClassName ZipTest.java
* @Description
* @Author Vince
* @CreateTime 2021年11月17日 12:42:00
*/
public class ZipNio {
static List<String> fileUrlList = Lists.newArrayList();
static String FILE = "D:\\ziptest\\test9528.zip";
static File ZIP_FILE;
static {
try {
String str = FileUtils.readFileToString(new File("D:\\ziptest\\test.json"), Charset.forName("utf-8"));
fileUrlList = JSONArray.parseArray(str, String.class);
// fileUrlList.add("D:\\ziptest\\测试002.mp4"); // 224M
// fileUrlList.add("D:\\ziptest\\new.zip"); // 23.7M
// fileUrlList.add("D:\\uploadPath\\download\\resource-zip\\广州2服务器_20211117172152140308.zip"); // 23.7M
} catch (IOException e) {
e.printStackTrace();
}
ZIP_FILE = new File(FILE);
if (ZIP_FILE.exists()) ZIP_FILE.delete();
}
public static void main(String[] args) {
// zipFileNoBuffer(); // 23.7M -- 耗时:32597
// zipFileBuffer(); // 23.7M -- 耗时:1553
zipFileChannel(); // 23.7M -- 耗时:911
// zipFileMap(); // 23.7M -- 耗时:10
}
public static void zipFileNoBuffer() {
//开始时间
long beginTime = System.currentTimeMillis();
try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(ZIP_FILE))) {
for (String item : fileUrlList) {
try (InputStream input = new FileInputStream(item)) {
zipOut.putNextEntry(new ZipEntry(item));
int temp = 0;
while ((temp = input.read()) != -1) {
zipOut.write(temp);
}
}
}
//结束时间
long endTime = System.currentTimeMillis();
System.out.println("耗时:" + (endTime - beginTime));
} catch (Exception e) {
e.printStackTrace();
}
}
public static void zipFileBuffer() {
try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(ZIP_FILE));
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(zipOut)) {
//开始时间
long beginTime = System.currentTimeMillis();
for (String item : fileUrlList) {
try (BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(item))) {
zipOut.putNextEntry(new ZipEntry(item));
int temp = 0;
while ((temp = bufferedInputStream.read()) != -1) {
bufferedOutputStream.write(temp);
}
}
}
//结束时间
long endTime = System.currentTimeMillis();
System.out.println("耗时:" + (endTime - beginTime));
} catch (Exception e) {
e.printStackTrace();
}
}
public static void zipFileChannel() {
//开始时间
long beginTime = System.currentTimeMillis();
try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(ZIP_FILE));
WritableByteChannel writableByteChannel = Channels.newChannel(zipOut)) {
for (String item : fileUrlList) {
File file = new File(item);
try (FileChannel fileChannel = new FileInputStream(item).getChannel()) {
zipOut.putNextEntry(new ZipEntry(item));
fileChannel.transferTo(0, file.length(), writableByteChannel);
}
}
//结束时间
long endTime = System.currentTimeMillis();
System.out.println("耗时:" + (endTime - beginTime));
} catch (Exception e) {
e.printStackTrace();
}
}
public static void zipFileMap() {
//开始时间
long beginTime = System.currentTimeMillis();
try (ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(ZIP_FILE));
WritableByteChannel writableByteChannel = Channels.newChannel(zipOut)) {
for (String item : fileUrlList) {
File file = new File(item);
zipOut.putNextEntry(new ZipEntry(item));
//内存中的映射文件
MappedByteBuffer mappedByteBuffer = new RandomAccessFile(item, "r").getChannel()
.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
writableByteChannel.write(mappedByteBuffer);
}
//结束时间
long endTime = System.currentTimeMillis();
System.out.println("耗时:" + (endTime - beginTime));
} catch (Exception e) {
e.printStackTrace();
}
}
} | [
"wengx@ycspace.com"
] | wengx@ycspace.com |
9564c3f65ab2387afbbb17178e53d0295cf1367d | 7e361e102357c45a4e58c934012448affd1e1556 | /DesignPattern/src/top/liumuge/singleton/type1/SingletonTest01.java | 5bea6911780b4eaaa3adeff5750ed0708011761b | [] | no_license | lcopilot/DesignPattern-learn | c01bb0a1c6aa41a6340b5e27fbfe65da9addb001 | c21cfeeefbbe98fb14d0c4ff1b2361c7c94c8c1e | refs/heads/master | 2022-11-25T12:38:29.726146 | 2020-08-04T13:47:39 | 2020-08-04T13:47:39 | 284,993,638 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package top.liumuge.singleton.type1;
/**
* @program: DesignPatterns
* @auther: MuGe
* @date: 2020/7/7
* @time: 9:52
* @description:
*/
public class SingletonTest01 {
public static void main(String[] args) {
// 测试
Singleton instance1 = Singleton.getInstance();
Singleton instance2 = Singleton.getInstance();
Singleton instance3 = Singleton.getInstance();
System.out.println(instance3==instance2); //* true
System.out.println(instance1.hashCode());
System.out.println(instance2.hashCode());
System.out.println(instance3.hashCode());
}
}
//*饿汉式 (静态变量)
class Singleton {
//*1.构造器私有化,外部不能 new
private Singleton() {
}
//*2.本类内部创建对象实例
private final static Singleton instance = new Singleton();
//*3.对外提供一个公有的静态方法,返回实例对象
public static Singleton getInstance() {
return instance;
}
}
| [
"liuxianliangli@foxmail.com"
] | liuxianliangli@foxmail.com |
40ff14671e51fcc6b15b8c8cff4ef3f6a3bdf433 | 0e627913ac4b34b38067b4c8e9d8f2486bc319af | /zuihou-backend/zuihou-admin/src/main/java/com/github/zuihou/admin/ser/Ser.java | e2bd2be760b93acb4d38a225e291417c49fd70d8 | [] | no_license | miraclehjt/zuihou-admin-cloud | 2e4468b56e54f73cbc865cd2077646b55e35c63c | a6552d3f44b1e97b19d2be5d3a666aeedfc6f426 | refs/heads/master | 2021-05-11T06:35:43.200576 | 2018-01-14T16:22:21 | 2018-01-14T16:22:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 480 | java | package com.github.zuihou.admin.ser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @author tyh
* @createTime 2018-01-14 0:05
*/
@Service
@Slf4j
public class Ser {
public String test(){
log.error("info---------------");
log.warn("warn---------------");
log.info("info---------------");
log.debug("debug---------------");
log.trace("trace---------------");
return "--------";
}
}
| [
"244387066@qq.com"
] | 244387066@qq.com |
915f44c7b3e90652bd119dc8abb2e4f3ab9a8ea8 | bf016d3d843999e5be9ddc0db9000f72b3e7941e | /chapter_002/src/main/java/ru/job4j/bank/Bank.java | 3ecf6826a4211cb63951a38b33df8697821b317c | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | vguryanov/job4j | 16adf3e740ce980e22e5f6911a203cea3390d8a9 | 1aedca2f1fc1817e1b69e65cf4b69fb12cc245c0 | refs/heads/master | 2020-03-08T20:14:59.558540 | 2018-08-12T14:35:40 | 2018-08-12T14:35:40 | 128,377,401 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,449 | java | package ru.job4j.bank;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* Created by User2 on 28.04.2018.
*/
public class Bank {
private static String bankInfo;
private Set<User> addedUsers = new HashSet<>();
public Set<User> getAddedUsers() {
return Collections.unmodifiableSet(addedUsers);
}
public boolean addUser(User user) {
return addedUsers.add(user);
}
public String addAccountToUser(String passport) throws IllegalArgumentException {
if (passport == null) {
throw new IllegalArgumentException();
}
return getUserByPassport(passport).addAccount(new Bank.Account());
}
public User getUserByPassport(String passport) throws IllegalArgumentException {
for (User user : addedUsers) {
if (user.getPassport().equals(passport)) {
return user;
}
}
throw new IllegalArgumentException();
}
public boolean transferMoney(String srcPassport, String srcRequisites, String destPassport, String dstRequisites, double amount) {
User source = getUserByPassport(srcPassport);
User dest = getUserByPassport(destPassport);
if (!source.isMoneyAvailableOnAccount(amount, srcRequisites)) {
return false;
}
source.withdrawMoneyFromAccount(amount, srcRequisites);
dest.addMoneyToAccount(amount, dstRequisites);
return true;
}
public void deleteUser(User user) {
user.deleteAccounts();
addedUsers.remove(user);
}
public static class Account {
private double value;
private String requisites;
private static int counter = 0;
private Account() throws IllegalArgumentException {
counter++;
value = 0;
requisites = bankInfo + " " + counter;
}
public double getValue() {
return value;
}
public String getRequisites() {
return requisites;
}
public double getBalance() {
return value;
}
public boolean isMoneyAvailable(double amount) {
return this.value >= amount;
}
public void addMoney(double amount) {
value += amount;
}
public void withdrawMoney(double amount) {
value -= amount;
}
}
}
| [
"37j5k5a@mail.ru"
] | 37j5k5a@mail.ru |
fc6e6486bb983e225869b40a626cdd08a6ac4fea | 970aff41ee5b73341a04c7134533c593de9874ab | /proiect/Layer.java | 74cf91623b0915daa70fe537742ee579c0b6fc9a | [] | no_license | tech-guild/IPT2 | 750ad66891b6ff83f558b11aa79b3841fac193fc | 50deefde14d5195a6d3c89cc30870baa796ac7f3 | refs/heads/master | 2022-04-21T20:38:36.103837 | 2020-04-23T00:14:27 | 2020-04-23T00:14:27 | 258,049,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package proiect;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
public class Layer implements ILayer {
public BufferedImage layerImage;
public Layer() {
layerImage=null;
}
public void LoadLayer(BufferedImage img) {
layerImage = new BufferedImage(img.getWidth(),img.getHeight(),BufferedImage.TYPE_INT_ARGB);
//layerImage.getGraphics().drawImage(layerImage.getScaledInstance(layerImage.getWidth(), layerImage.getHeight(), BufferedImage.SCALE_SMOOTH), 0, 0, null);
for(int row=0; row<layerImage.getWidth(); row++) {
for(int col=0; col<layerImage.getHeight(); col++) {
Color c= new Color(255,255,255,0);
layerImage.setRGB(row,col,c.getRGB());
}
}
}
@Override
public void paintComponent(Graphics g) {
if(layerImage!=null) {
g.drawImage(layerImage,0, 0, null);
}
}
}
| [
"marius.florea98@e-uvt.ro"
] | marius.florea98@e-uvt.ro |
4f6cbf0413909ae045f8d6b08d64eadf35c0f07a | e42a6d11cba0fe3756c052ec588bc1fd34ef44c8 | /schedule/schedule-appengine/src/test/java/com/jasify/schedule/appengine/model/multipass/filter/DayFilterTest.java | 30950aeb77b3f5cfc7c91f9d39bee61b697e381d | [] | no_license | krico/jas | 96ed9bceb04bf904bdad085393367ab7664775dd | 4c33c07d2c63e7962b05af221dec680fb4794f6e | refs/heads/master | 2020-03-30T18:41:51.467678 | 2016-02-08T21:27:12 | 2016-02-08T21:27:12 | 25,744,696 | 1 | 2 | null | 2016-02-08T21:27:13 | 2014-10-25T20:01:46 | Java | UTF-8 | Java | false | false | 755 | java | package com.jasify.schedule.appengine.model.multipass.filter;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;
/**
* @author wszarmach
* @since 17/11/15.
*/
public class DayFilterTest {
@Test
public void testDaysOfWeek() {
DayFilter filter = new DayFilter();
assertTrue(filter.getDaysOfWeek().isEmpty());
List<DayFilter.DayOfWeekEnum> daysOfWeek = new ArrayList<>();
daysOfWeek.add(DayFilter.DayOfWeekEnum.Monday);
daysOfWeek.add(DayFilter.DayOfWeekEnum.Thursday);
filter.setDaysOfWeek(daysOfWeek);
assertEquals(2, filter.getDaysOfWeek().size());
}
}
| [
"wszarmach@wp.pl"
] | wszarmach@wp.pl |
bc916603f8b744ac4f88cfba5e4cf53f564ea4dc | 8ced2d8508be9d0a3b543dbc88af56d6491ace0b | /src/main/java/fi/tfs/liiga/tulos/Henkilo.java | 8a14abf9639afed353bcd8d6b6bdefe85e3dfc72 | [
"MIT"
] | permissive | jajvirta/liiga | 297a1c085b7ca63e51b82218d1150891609d7bbb | 878895b34ec762a04714313f98e3277c2bd2dde2 | refs/heads/master | 2020-05-22T04:04:38.783974 | 2017-04-04T09:35:35 | 2017-04-04T09:35:35 | 53,752,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package fi.tfs.liiga.tulos;
public class Henkilo {
public final long henkiloId;
public final String nimi;
public Henkilo(long henkiloId, String nimi) {
this.henkiloId = henkiloId;
this.nimi = nimi;
}
}
| [
"jarno.virtanen@solita.fi"
] | jarno.virtanen@solita.fi |
a273e37ceeb19c1b66bb9368951554fed9da94fe | d6c7ce87608ded899da9d43d3fca4f0abc518717 | /src/test/java/com/rrps/security/SecurityApplicationTests.java | ad2516b5b5f16ff9cb87e5eb98339e544ea4bc8a | [] | no_license | MohammadHH/spring-security | c7a3806709e027c767b8b422b5d40a45a79b8ccd | 2958414badf217b2d8b9c289db54a0f5ab3fd3bc | refs/heads/main | 2023-02-28T22:58:09.662898 | 2021-02-09T20:23:00 | 2021-02-09T20:23:00 | 336,396,592 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package com.rrps.security;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SecurityApplicationTests {
@Test
void contextLoads() {
}
}
| [
"mohammad19991998dtrb@gmail.com"
] | mohammad19991998dtrb@gmail.com |
f95cbeecc3cb2ea6cf757f563699ea86b4e2cdc6 | 79ad24ec79b2d066a7740bb88bae4d4febf5118b | /SHAPE_TEST.java | 61c3d7ebb57a23a69d2b11b9383d2c33b935a7ea | [] | no_license | JasonXDDD/W2 | e3b1ab20a4cf0b1216789e8511c993ea26a85843 | cfe03ebf80367ccfd032e32c728163087f26994a | refs/heads/master | 2016-08-03T21:16:07.058219 | 2015-03-09T12:18:56 | 2015-03-09T12:18:56 | 31,889,882 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,588 | java | import java.util.Scanner;
/**
* Created by JASON_ on 2015/3/3.
*/
public class SHAPE_TEST {
public static void main(String[] args){
int type = 1;
int height = 0;
int width = 0;
char filled;
Scanner sc;
char flag;
boolean FlagToStop = true;
Shape shape1;
while(FlagToStop){
System.out.println("1.Rectangle");
System.out.println("2.Square");
System.out.println("3.Upper Left Triangle");
System.out.println("4.Upper Right Triangle");
System.out.println("5.Down Left Triangle");
System.out.println("6.Down Right Triangle");
System.out.println("7.Upper Isosceles");
System.out.println("8.Down Isosceles");
System.out.println("9.Right Parallelogram");
System.out.println("10.Left Parallelogram");
System.out.printf("Choose your type: ");
sc = new Scanner(System.in);
type = sc.nextInt();
System.out.printf("Enter the Height: ");
sc = new Scanner(System.in);
height = sc.nextInt();
if(type == 1 || type == 9 || type == 10){
System.out.printf("Enter the Width: ");
sc = new Scanner(System.in);
width = sc.nextInt();
}
System.out.printf("Is it filled(y/n)?? ");
sc = new Scanner(System.in);
filled = sc.next().charAt(0);
System.out.println();
switch (type){
case Shape.Consrectangle:
shape1 = new Rect(height, width, filled);
shape1.show();
break;
case Shape.Conssquare:
shape1 = new Square(height, filled);
shape1.show();
break;
case Shape.Consupperleft:
shape1 = new UpperLeft(height, filled);
shape1.show();
break;
case Shape.Consupperright:
shape1 = new UpperRight(height, filled);
shape1.show();
break;
case Shape.Consdownleft:
shape1 = new DownLeft(height, filled);
shape1.show();
break;
case Shape.Consdownright:
shape1 = new DownRight(height, filled);
shape1.show();
break;
case Shape.Consupperisosceles:
shape1 = new UpperIsosceles(height, filled);
shape1.show();
break;
case Shape.Consdownisosceles:
shape1 = new DownIsosceles(height, filled);
shape1.show();
break;
case Shape.Consrightparallelogram:
shape1 = new Right(height, width, filled);
shape1.show();
break;
case Shape.Consleftparallelogram:
shape1 = new Left(height, width, filled);
shape1.show();
break;
}
System.out.println();
System.out.printf("Next one(y/n)??");
sc = new Scanner(System.in);
flag = sc.next().charAt(0);
if(flag == 'y' || flag == 'Y')
FlagToStop = true;
if(flag == 'n' || flag == 'N')
FlagToStop = false;
}
}
}
| [
"jason841022@yahoo.com.tw"
] | jason841022@yahoo.com.tw |
943d71b464f90dde0e7178ee2a854e8b6ffeb8be | f3f0247abb331da30b1ce7dfdfcb8145f11bf1a3 | /src/test/java/com/iamgique/pokerhand/category/StraightFlushTest.java | e4f0934f71e16854b14afbaaca688ebf58fdcb61 | [] | no_license | iamgique/pokerhand | 133ce7b9c16f029bae40dd3ace43d43ec8a03049 | 996565c071890bee2b4b86adef825cdf09aec119 | refs/heads/master | 2020-07-23T01:10:29.434219 | 2019-09-15T14:03:32 | 2019-09-15T14:03:32 | 207,395,278 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | package com.iamgique.pokerhand.category;
import com.iamgique.pokerhand.model.Card;
import com.iamgique.pokerhand.model.Suit;
import com.iamgique.pokerhand.model.Value;
import junit.framework.Assert;
import org.junit.jupiter.api.Test;
public class StraightFlushTest {
@Test
public void straightFlush_trueWhenCardIsInSequenceAndShareSameSuit() {
StraightFlush straightFlush = new StraightFlush();
Assert.assertTrue(straightFlush.isStraightFlush(new Card(Value._2, Suit.H),
new Card(Value._3, Suit.H),
new Card(Value._4, Suit.H),
new Card(Value._5, Suit.H),
new Card(Value._6, Suit.H)));
}
}
| [
"sakul.montha@scb.co.th"
] | sakul.montha@scb.co.th |
e38a0127e4623d67fdf3ae4f2db8363d57c54e37 | 785ec8b8d94344ddcb687d13acc8fae986a06b4a | /src/Controller/InputManager.java | 7d331265e3ac2f6d77a6dd2c88d8d9b6aa21d07c | [] | no_license | Brushturn/AsteroidCode | 2f9f4a5206b54cd1f5525039fecedcffc19efc2a | 3bacc7221a1fe9bb9cc38a05718ce089a1c6e6b3 | refs/heads/main | 2023-06-01T22:04:26.183112 | 2021-06-18T17:06:42 | 2021-06-18T17:06:42 | 378,216,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,503 | java | package Controller;
import Model.*;
import java.io.*;
import java.util.ArrayList;
import java.util.regex.Pattern;
public class InputManager {
private static int[] ObjCounts = {0,0,0,0,0,0}; //Material, Asteroid, TG, Settler, Robot, Ufo //a legelso sor felsplittelt erekei, melyik obj-bol mennyit kell letrehozni
private static String[] cmd={}; //a reader felsplittelt resz szavai
private static String line; //a reader aktualisan beolvasott sora
private static BufferedReader reader ; //reader
private static ArrayList<String> output = new ArrayList<>(); //a stdoutputnak a lementese ebbe a gyujtemenybe
/**
* A metodus kiuriti a parameterkent kaott ArrayListet
* @param array tetszoleges ArrayList<>
*/
public static void removeObjects(ArrayList<?> array ){
array.clear();
}
/**
* Sajat valtozoba menti a parameterkent kapott Stringet
* @param generateoutput boolean, ami megmondja, hogy az stdout-ot elmentsuk-e egy sajat valtozoba, amit majd kesobb (tesztelesnel) fel tudunk hasznalni
* @param output String, amit kiirt az stdout
*/
public static void write_to_output(boolean generateoutput,String output){
if(generateoutput)
InputManager.GetOutput().add(output);
}
/**
* Gettter az output tagvaltozora
* @return private output struktura
*/
public static ArrayList<String> GetOutput(){
return output;
}
/**
* Kiuriti az output tartalmat
*/
public static void zero(){
InputManager.output.clear();
}
public static ArrayList<String> GenerateOutput(String filename){
InputManager.FromFileInput(filename,true);
ArrayList<String> output_list = new ArrayList<String>();
for(int i=0; i<InputManager.output.size(); i++){
output_list.add(InputManager.output.get(i));
}
return output_list;
}
/**
* A beolvasast es az inicializalast megvalosito metodus
* @param generateoutput boolean, le legyen e mentve a stdout egy sajat valtozoba
*/
public static void InputCore(Boolean generateoutput){
CommandManager cm = new CommandManager();
try {
line=reader.readLine();
cmd=line.split(" ");
for(int i=1; i<7;i++) {
ObjCounts[i - 1] = Integer.parseInt(cmd[i]);
}
for(int i=0; i<ObjCounts[0];i++){ //itt eloszor a materialokat hozzuk letre,
String params = reader.readLine(); //mert a create metodusban nem tudnánk kul típusu objektumot letrehozni, csak materialt
System.out.println(params);
InputManager.createMaterial(params);
}
for(int i=1; i<6;i++){ //itt pedig minden mast, vegigmegyunk az ObjCounts tombon, hogy mibol mennyi kell
InputManager.createObject(i,ObjCounts[i]); //eloszor csak letrehozzuk
for(int j=0; j<ObjCounts[i];j++){
String params=reader.readLine();
System.out.println(params);
InputManager.initObjects(i,params,j); //majd inicializaljuk is
}
}
reader.readLine(); //ures sor beolvasasa, doksi szerint
while(cm.IsRunning()){ //addig amig a bemenetben nem talalja meg a stop-ot
line=reader.readLine();
cm.command(line,generateoutput);
}
/*System.out.println("[Actual output]");
cm.listMaterials(generateoutput); //
cm.listAsteroids(generateoutput);
cm.listTeleportGates(generateoutput);
cm.listCharacters(generateoutput);
//cm.saveMap("savedmap");*/
/*removeObjects(Main.materials); //uritjuk a tarolokat
removeObjects(Main.asteroids);
removeObjects(Main.teleportgates);
removeObjects(Main.settlers);
removeObjects(Main.robots);
removeObjects(Main.ufos);*/
cm.Reset();
// reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* A fajbol valo olvasast es inicializalast valositja meg
* @param filename filename, fajlbol valo olvasashoz (.txt nelkul)
* @param generateoutput boolean, le legyen e mentve a stdout egy sajat valtozoba
*/
public static void FromFileInput(String filename,boolean generateoutput){
try {
File currentfile = InputManager.getFile("Files","Saved" ,filename);
reader = new BufferedReader(new FileReader(currentfile));
InputManager.InputCore(generateoutput); //TODO ezt kell átváltoztatni bool generateoutput-ra, meg paraméterben felvenni
}catch (IOException e){ //TODO és a ParamTest-ben átváltoztatni minden hívást, kiegészíteni false-ra
System.out.println("Input file not found!");
}
}
/**
* A stdin-rol valo olvasast es inicializalast valositja meg
*/
public static void FromUserInput(){
try {
reader = new BufferedReader(new InputStreamReader(System.in));
InputManager.InputCore(false);
}catch (Exception e){
System.out.println("User input: Input file not found!");
}
}
/**
* OPrendszer fuggetlen filebeolvasast valositja meg
* @param dir gyokermappa elso szintjen levo konyvtar
* @param dir2 gyokermappa masodik szintjen levo konyvtar
* @param filename cel file neve
* @return wanted, a kulonbozo parameterkent kapott directorykban talalhato file
* @throws IOException ha a file nem talalhato
*/
public static File getFile (String dir, String dir2, String filename)throws IOException {
File dir_File=new File (dir);
String caononical_path= dir_File.getCanonicalPath();
File dir_File_Input=new File(caononical_path,dir2);
String canonical_path_2=dir_File_Input.getCanonicalPath();
File wanted = new File(canonical_path_2,filename+".txt");
/*BufferedReader read = new BufferedReader(new FileReader(wanted));
System.out.println(read.readLine());*/
return wanted;
}
/**
*
* @param type_of_object Milyen tipusu objektumrol van szo (Material, Asteroid, Settler....)
* @param init_settings Az inicializalashoz szukseges szamfolyam
* @param type Hanyadik objektumrol van szo (Az ArrayList-ekben valo eleresekhez)
*/
public static void initObjects(int type_of_object, String init_settings, int type ){
switch (type_of_object){
case 0:
if(Pattern.matches(Main.materialregex,init_settings)){
createMaterial(init_settings);
}
break;
case 1:
if(Pattern.matches(Main.lonely_empty_asteroid,init_settings)){
createAsteroid1(init_settings,type);
}else if(Pattern.matches(Main.lonely_not_empty_asteroid,init_settings)) {
createAsteroid2(init_settings,type);
}else if(Pattern.matches(Main.not_lonely_empty,init_settings)){
createAsteroid3(init_settings,type);
}else if(Pattern.matches(Main.not_lonely_not_empty_asteroid,init_settings)){
createAsteroid4(init_settings,type);
}
break;
case 2:
if(Pattern.matches(Main.tg_placed_regex,init_settings)){
createTeleportGate1(init_settings,type);
}else if(Pattern.matches(Main.tg_notplaced_regex,init_settings)){
createTeleportGate2(init_settings,type);
}
break;
case 3:
if(Pattern.matches(Main.settler_wom_and_wotg,init_settings)){
createSettler1(init_settings,type);
}else if(Pattern.matches(Main.settler_wm_and_wotg,init_settings)){
createSettler2(init_settings,type);
}else if(Pattern.matches(Main.settler_wom_and_wtg,init_settings)){
createSettler3(init_settings,type);
}else if(Pattern.matches(Main.settler_wm_and_wtg,init_settings)){
createSettler4(init_settings,type);
}
break;
case 4:
if(Pattern.matches(Main.robotregex,init_settings)){
createRobot(init_settings,type);
}
break;
case 5:
if(Pattern.matches(Main.ufo_wm,init_settings)){
createUfo1(init_settings,type);
}else if(Pattern.matches(Main.ufo_wom,init_settings)){
createUfo2(init_settings,type);
}
break;
}
}
/**
* Letrehozza elore az objektumokat, es eltarolja az objektumnak megfelelo ArrayList-ben
* @param type_of_object milyen tipusu objektum (Material, Asteroid, Settler...)
* @param size_of_objects Mennyit kell letrehozni
*/
public static void createObject(int type_of_object, int size_of_objects){
switch (type_of_object){
case 0:
for(int i=0; i<size_of_objects;i++){
Main.materials.add(new Material());
}
break;
case 1:
for(int i=0; i<size_of_objects;i++){
Main.asteroids.add(new Asteroid());
}
break;
case 2:
for(int i=0; i<size_of_objects;i++){
Main.teleportgates.add(new TeleportGate());
}
break;
case 3:
for(int i=0; i<size_of_objects;i++){
Main.settlers.add(new Settler());
}
break;
case 4:
for(int i=0; i<size_of_objects;i++){
Main.robots.add(new Robot());
}
break;
case 5:
for(int i=0; i<size_of_objects;i++){
Main.ufos.add(new UFO());
}
break;
}
}
/**
* Letrehozza a bemeneti params alapján a Materialt, a szukseges fuggosegekkel
* @param material_settings Az inicializalashoz szukseges ertekhalmaz
*/
public static void createMaterial(String material_settings){
String[] input = material_settings.split("\\t");
Material normal = new Material();
RadioactiveMaterial radmat = new RadioactiveMaterial();
SublimableMaterial submat= new SublimableMaterial();
NormalMaterialName normalMaterialName;
RadioactiveMaterialName radioactiveMaterialName;
SublimableMaterialName sublimableMaterialName;
switch (Integer.parseInt(input[0])){
case 0:
Main.materials.add(normal);
normalMaterialName = NormalMaterialName.IRON;
Main.materials.get(Main.materials.size()-1).setName(normalMaterialName);
break;
case 1:
Main.materials.add(normal);
normalMaterialName = NormalMaterialName.COAL;
Main.materials.get(Main.materials.size()-1).setName(normalMaterialName);
break;
case 2:
int c = Integer.parseInt(input[1]);
radioactiveMaterialName = RadioactiveMaterialName.URAN;
radmat.setName(radioactiveMaterialName);
radmat.SetExposure(Integer.parseInt(input[1]));
Main.materials.add(radmat);
//radioactiveMaterialName = RadioactiveMaterialName.URAN;
Main.materials.get(Main.materials.size()-1).setName(RadioactiveMaterialName.URAN);
// (RadioactiveMaterial)(Main.materials.get(Main.materials.size()-1))
break;
case 3:
Main.materials.add(submat);
sublimableMaterialName = SublimableMaterialName.ICEWATER;
Main.materials.get(Main.materials.size()-1).setName(sublimableMaterialName);
break;
}
}
/**
* Letrehozza a bemeneti params alapján az Asteroidot, a szukseges fuggosegekkel, ami illeszkedik a lonely_empty_asteroid regexre
* @param asteroid_settings_type1 Az inicializalashoz szukseges ertekhalmaz
* @param type hanyad objektumrol van szo
*/
public static void createAsteroid1(String asteroid_settings_type1,int type){ //input : szomszédszám = [kötelezően 0], napközel = [0,1], rétegszám = [bármi int], üresség = [kötelezően 0]
//pl : 0 0 25 0
String[] cmd = asteroid_settings_type1.split("\\t");
//Asteroid a =Main.asteroids.get(type);
setCommonAsteroid(Main.asteroids.get(type),Integer.parseInt(cmd[1]),Integer.parseInt(cmd[2]),Integer.parseInt(cmd[3]));
}
/**
* Letrehozza a bemeneti params alapján a Asteroidot, a szukseges fuggosegekkel, ami illeszkedik a lonely_not_empty_asteroid regexre
* @param asteroid_settings_type2 Az inicializalashoz szukseges ertekhalmaz
* @param type hanyad objektumrol van szo
*/
public static void createAsteroid2(String asteroid_settings_type2,int type){ //input : szomszédszám = [kötelezően 0], napközel = [0,1], rétegszám = [bármi int], üresség = [kötelezően 1], nyersi index = [bármi int]
//pl : 0 0 25 1 5
String[] cmd = asteroid_settings_type2.split("\\t");
setCommonAsteroid(Main.asteroids.get(type),Integer.parseInt(cmd[1]),Integer.parseInt(cmd[2]),Integer.parseInt(cmd[3]));
int idx = Integer.parseInt(cmd[4])-1;
Main.asteroids.get(type).SetMaterial(Main.materials.get(idx));
}
/**
* Letrehozza a bemeneti params alapján a Asteroidot, a szukseges fuggosegekkel, ami illeszkedik a not_lonely_empty regexre
* @param asteroid_settings_type3 Az inicializalashoz szukseges ertekhalmaz
* @param type hanyad objektumrol van szo
*/
public static void createAsteroid3(String asteroid_settings_type3,int type){ //input : szomszédszám = [bármi int], szomszéd index[bármi int, (utolsó után nem kell)], napközel = [0,1], rétegszám = [bármi int], üresség = [kötelezően 1], nyersi index = [bármi int]
//pl : 2 1,2 1 5 0
String[] cmd = asteroid_settings_type3.split("\\t");
String[] neighbors={""};
int ize = Integer.parseInt(cmd[0]);
if(ize==1) {
String asd = cmd[1];
neighbors[0] = asd;
}else{
neighbors = cmd[1].split(",");
}
for(int i=0; i<Integer.parseInt(cmd[0]);i++){
Main.asteroids.get(type).AddNeighbour(Main.asteroids.get(Integer.parseInt(neighbors[i])-1));
}
setCommonAsteroid(Main.asteroids.get(type),Integer.parseInt(cmd[2]),Integer.parseInt(cmd[3]),Integer.parseInt(cmd[4]));
}
/**
* Letrehozza a bemeneti params alapján a Asteroidot, a szukseges fuggosegekkel, ami illeszkedik a not_lonely_not_empty_asteroid regexre
* @param asteroid_settings_type4 Az inicializalashoz szukseges ertekhalmaz
* @param type hanyad objektumrol van szo
*/
public static void createAsteroid4(String asteroid_settings_type4,int type){ //input : szomszédszám = [bármi int], szomszéd index[bármi int, (utolsó után nem kell)], napközel = [0,1], rétegszám = [bármi int], üresség = [kötelezően 0]
//pl : 5 5,2,3,4,5 1 5 0
createAsteroid3(asteroid_settings_type4,type);
String[] cmd = asteroid_settings_type4.split("\\t");
Main.asteroids.get(type).SetMaterial(Main.materials.get(Integer.parseInt(cmd[5])-1));
}
/**
* Metodus ami a parameterkent kapott aszteroidanak beallitja a parameterkent kapott naptavolsag, retegszam és uresseg ertekeit
* @param a Melyik aszteroida
* @param sunprox, naptavolsag ertek
* @param layer, retegszam ertek,
* @param empty, uresseg ertek
*/
public static void setCommonAsteroid(Asteroid a, int sunprox, int layer, int empty){
a.SetSunProximityManual(IntToBoolean(sunprox));
a.setLayer(layer);
a.SetEmpty(!IntToBoolean(empty));
}
/**
* Letrehozza a bemeneti params alapján a Teleportkaput, a szukseges fuggosegekkel, ami illeszkedik a tg_placed_regex regexre
* @param tpg_setting_type1 Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createTeleportGate1(String tpg_setting_type1, int actual){
String[] cmd = tpg_setting_type1.split( "\\t");
TeleportGate tg = Main.teleportgates.get(actual);
setCommonTeleportGate(tg,Integer.parseInt(cmd[0]),Integer.parseInt(cmd[1]),Integer.parseInt(cmd[3]),Integer.parseInt(cmd[4]));
tg.setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[2])-1));
Main.asteroids.get(Integer.parseInt(cmd[2])-1).AddNeighbour(tg);
}
/**
* Letrehozza a bemeneti params alapján a Asteroidot, a szukseges fuggosegekkel, ami illeszkedik a tg_notplaced_regex regexre
* @param tpg_settings_type2 Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createTeleportGate2(String tpg_settings_type2,int actual){
String[] cmd = tpg_settings_type2.split( "\\t");
TeleportGate tg = Main.teleportgates.get(actual);
setCommonTeleportGate(tg,Integer.parseInt(cmd[0]),Integer.parseInt(cmd[1]),Integer.parseInt(cmd[2]),Integer.parseInt(cmd[3]));
//Main.asteroids.get(Integer.parseInt(cmd[2])-1).AddNeighbour(tg);
}
/**
* * Metodus ami a parameterkent kapott teleportkapunak beallitja a parameterkent kapott parja, lehelyezett-e aktiv és orult ertekeit
* @param tg, melyik teleportkapurol van szo
* @param pair, parja ertek (index)
* @param placed, lehelyezett-e ertek
* @param active, aktiv-e ertek
* @param craziness_factor, orult-e ertek
*/
public static void setCommonTeleportGate(TeleportGate tg, int pair, int placed, int active, int craziness_factor){
if(pair!=0){
tg.setPair(Main.teleportgates.get(pair-1));
}
tg.setPlaced(IntToBoolean(placed));
tg.setActive(IntToBoolean(active));
tg.setCrazy(IntToBoolean(craziness_factor));
}
/**
* Segedmetodus, amely int ertekbol booleant kepez
* @param integer bemeneti ertek
* @return logikai igaz vagy hamis
*/
public static boolean IntToBoolean(int integer){
return integer==1;
}
/**
* Letrehozza a bemeneti params alapján a Settlert, a szukseges fuggosegekkel, ami illeszkedik a settler_wim_and_wotg regexre
* @param settler_settings_type1 Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createSettler1(String settler_settings_type1, int actual){ //WithOutMaterial and WithOutTG
Settler s = Main.settlers.get(actual);
String[] cmd = settler_settings_type1.split( "\\t");
s.setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[0])-1));
Main.asteroids.get(Integer.parseInt(cmd[0])-1).Accept(s);
Main.ab.settlersAlive += 1; //kiszedve, a teszteléshez szükséges settlerek minimalizálásához
}
/**
* Letrehozza a bemeneti params alapján a Settlert, a szukseges fuggosegekkel, ami illeszkedik a settler_wm_and_wotg regexre
* @param settler_settings_type2 Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createSettler2(String settler_settings_type2, int actual){ //With material and without tg
Settler s = Main.settlers.get(actual);
String[] cmd = settler_settings_type2.split( "\\t");
String[] materials=cmd[2].split(",");
s.setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[0])-1));
Main.asteroids.get(Integer.parseInt(cmd[0])-1).Accept(s);
for(int i=0; i<materials.length;i++){
s.AddMaterial(Main.materials.get(Integer.parseInt(materials[i])-1));
}
Main.ab.settlersAlive += 1; //kiszedve, a teszteléshez szükséges settlerek minimalizálásához
}
/**
* Letrehozza a bemeneti params alapján a Settlert, a szukseges fuggosegekkel, ami illeszkedik a settler_wom_and_wtg regexre
* @param settler_settings_type3 Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createSettler3(String settler_settings_type3, int actual){ //WithOutMaterial and WithTG
Settler s = Main.settlers.get(actual);
String[] cmd = settler_settings_type3.split( "\\t");
String[] tgs=cmd[3].split(",");
s.setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[0])-1));
Main.asteroids.get(Integer.parseInt(cmd[0])-1).Accept(s);
for(int i=0; i<tgs.length;i++){
s.AddGate(Main.teleportgates.get(Integer.parseInt(tgs[i])-1));
}
Main.ab.settlersAlive += 1; //kiszedve, a teszteléshez szükséges settlerek minimalizálásához
}
/**
* Letrehozza a bemeneti params alapján a Settlert, a szukseges fuggosegekkel, ami illeszkedik a settler_wm_and_wtg regexre
* @param settler_settings_type4 Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createSettler4(String settler_settings_type4, int actual){ //wm and wtg
String[] cmd = settler_settings_type4.split( "\\t");
String[] materials=cmd[2].split(",");
String[] tgs=cmd[3].split(",");
Settler s = Main.settlers.get(actual);
s.setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[0])-1));
Main.asteroids.get(Integer.parseInt(cmd[0])-1).Accept(s);
for(int i=0; i<materials.length;i++){
s.AddMaterial(Main.materials.get(Integer.parseInt(materials[i])-1));
}
for(int i=0; i<tgs.length;i++){
s.AddGate(Main.teleportgates.get(Integer.parseInt(tgs[i])-1));
}
Main.ab.settlersAlive += 1; //kiszedve, a teszteléshez szükséges settlerek minimalizálásához
}
/**
* Letrehozza a bemeneti params alapjan a Robotot, a szukseges fuggosegekkel, ami illeszkedik a robotregex regexre
* @param robot_settings Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createRobot(String robot_settings, int actual){
Model.Robot r = Main.robots.get(actual);
String[] cmd=robot_settings.split("\\t");
Main.robots.get(actual).setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[0])-1));
Main.asteroids.get(Integer.parseInt(cmd[0])-1).Accept(r);
}
/**
* Letrehozza a bemeneti params alapjan a Ufot, a szukseges fuggosegekkel, ami illeszkedik a ufo_wm regexre
* @param ufo_settings_type1 Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createUfo1(String ufo_settings_type1,int actual){
UFO u = Main.ufos.get(actual);
String[] cmd=ufo_settings_type1.split("\\t");
Main.ufos.get(actual).setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[0])-1));
Main.asteroids.get(Integer.parseInt(cmd[0])-1).Accept(u);
}
/**
* Letrehozza a bemeneti params alapján a Settlert, a szukseges fuggosegekkel, ami illeszkedik a ufo_wom regexre
* @param ufo_settings_type2 Az inicializalashoz szukseges ertekhalmaz
* @param actual hanyad objektumrol van szo
*/
public static void createUfo2(String ufo_settings_type2, int actual){
String[] cmd=ufo_settings_type2.split("\\t");
UFO u =Main.ufos.get(actual);
u.setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[0])-1));
String[] materials=cmd[2].split(",");
u.setAsteroid(Main.asteroids.get(Integer.parseInt(cmd[0])-1));
for(int i=0; i<materials.length;i++){
u.GetInventory().Add(Main.materials.get(Integer.parseInt(materials[i])-1));
}
}
}
| [
"rikky512@gmail.com"
] | rikky512@gmail.com |
d950da9925ede2ebcb726de3429545e772950b4a | 308cd1f69bf2a99005a34347b78a6f89bf09f1a1 | /Medium/src/main/java/ZigZag_Conversion.java | 67bfa880b8c5bfb339686a33a7fc0ce1f5e61914 | [] | no_license | cainiaobang/leetcodeTest1 | 25faeee5dde122993c822ef04db89423904cf9bc | 0509262276358543ef7c5430c9a76494d0818e27 | refs/heads/master | 2021-05-10T20:39:14.934235 | 2018-01-28T05:29:00 | 2018-01-28T05:29:00 | 118,200,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,122 | java | import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
//将String类型转换成Char数组类型
//本题中利用StringBuilder[] 比使用Map<Integer,StringBuilder> 更合算
public class ZigZag_Conversion {
public String convert(String s, int numRows) {
int length=s.length();
Map<Integer,StringBuilder> map=new HashMap<Integer, StringBuilder>();
for(int i=0;i<numRows;i++){
map.put(i,new StringBuilder(""));
}
for(int i=0;i<length;){
for(int j=0;j<numRows&&i<length;j++,i++){
map.get(j).append(s.charAt(i));
}
for(int k=numRows-2;k>0&&i<length;k--,i++){
map.get(k).append(s.charAt(i));
}
}
StringBuilder result=new StringBuilder("");
for(int i=0;i<numRows;i++){
result.append(map.get(i));
}
return result.toString() ;
}
public static void main(String[] args){
ZigZag_Conversion sb=new ZigZag_Conversion();
String ss="ABCDEFG";
System.out.println(sb.convert(ss,3));
}
}
| [
"lqb_seu@163.com"
] | lqb_seu@163.com |
0f8b2608f50763c4756251e2a285c8b731224595 | 924116fc4dc2bfb48c6d70437a8edd657c2a2cd3 | /src/main/java/com/dyuproject/jetg/parser/code/SegmentCode.java | e60f8b38b0cdcbfe1ac5c80e9eaeafa020a3d9b0 | [
"Apache-2.0"
] | permissive | fbsgen/jetg | 931e91f9369860057025d9054ea80e876c96a441 | 74afa92ab809fe87122658dc689f59b53a8cafb2 | refs/heads/master | 2020-02-26T16:40:03.334200 | 2017-04-08T12:50:52 | 2017-04-08T12:50:52 | 71,431,042 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,066 | java | /**
* jetg
* Copyright 2015-2016 David Yu
*
* Copyright 2010-2014 Guoqiang Chen. All rights reserved.
* Email: subchen@gmail.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.dyuproject.jetg.parser.code;
import com.dyuproject.jetg.parser.support.TypedKlass;
import org.antlr.v4.runtime.ParserRuleContext;
/**
* 用于存储一个表达式节点
*/
public class SegmentCode extends Code {
private final TypedKlass typedKlass; // 支持泛型描述的类型
private final String source; // 翻译成的源代码
private final ParserRuleContext node; // 对应的 ParseTreeNode
public SegmentCode(Class<?> klass, String source, ParserRuleContext node) {
this(TypedKlass.create(klass), source, node, false);
}
public SegmentCode(Class<?> klass, TypedKlass[] typeArgs, String source, ParserRuleContext node) {
this(TypedKlass.create(klass, typeArgs), source, node, false);
}
public SegmentCode(TypedKlass typedKlass, String source, ParserRuleContext node) {
this(typedKlass, source, node, false);
}
public SegmentCode(TypedKlass typedKlass, String source, ParserRuleContext node,
boolean proc) {
this.typedKlass = typedKlass;
this.source = source;
this.node = node;
this.proc = proc;
}
public TypedKlass getTypedKlass() {
return typedKlass;
}
public Class<?> getKlass() {
return typedKlass == null ? null : typedKlass.getKlass();
}
public TypedKlass[] getTypeArgs() {
return typedKlass == null ? TypedKlass.EMPTY_TYPE_ARGS : typedKlass.getTypeArgs();
}
public String getKlassName() {
return typedKlass == null ? null : typedKlass.getSource();
}
public SegmentCode asBoxedSegmentCode() {
Class<?> klass = getKlass();
String newSource = null;
if (klass == null) {
return this;
} else if (Byte.TYPE.equals(klass)) {
newSource = "Byte.valueOf(" + source + ")";
} else if (Short.TYPE.equals(klass)) {
newSource = "Short.valueOf(" + source + ")";
} else if (Integer.TYPE.equals(klass)) {
newSource = "Integer.valueOf(" + source + ")";
} else if (Long.TYPE.equals(klass)) {
newSource = "Long.valueOf(" + source + ")";
} else if (Float.TYPE.equals(klass)) {
newSource = "Float.valueOf(" + source + ")";
} else if (Double.TYPE.equals(klass)) {
newSource = "Double.valueOf(" + source + ")";
} else if (Boolean.TYPE.equals(klass)) {
newSource = "Boolean.valueOf(" + source + ")";
} else if (Character.TYPE.equals(klass)) {
newSource = "Character.valueOf(" + source + ")";
}
if (newSource == null) {
return this;
} else {
return new SegmentCode(typedKlass.asBoxedTypedKlass(), newSource, node);
}
}
public SegmentCode asUnboxedSegmentCode() {
Class<?> klass = getKlass();
String newSource = null;
if (klass == null) {
return this;
} else if (Byte.class.equals(klass)) {
newSource = "(" + source + "==null ? (byte) 0 : " + source + ".byteValue())";
} else if (Short.class.equals(klass)) {
newSource = "(" + source + "==null ? (short) 0 : " + source + ".shortValue())";
} else if (Integer.class.equals(klass)) {
newSource = "(" + source + "==null ? 0 : " + source + ".intValue())";
} else if (Long.class.equals(klass)) {
newSource = "(" + source + "==null ? 0L : " + source + ".longValue())";
} else if (Float.class.equals(klass)) {
newSource = "(" + source + "==null ? 0.0F : " + source + ".floatValue())";
} else if (Double.class.equals(klass)) {
newSource = "(" + source + "==null ? 0.0D : " + source + ".doubleValue())";
} else if (Boolean.class.equals(klass)) {
newSource = "(" + source + "==null ? false : " + source + ".booleanValue())";
} else if (Character.class.equals(klass)) {
newSource = "(" + source + "==null ? '\0' : " + source + ".charValue())";
}
if (newSource == null) {
return this;
} else {
return new SegmentCode(typedKlass.asUnboxedTypedKlass(), newSource, node);
}
}
public ParserRuleContext getNode() {
return node;
}
@Override
public String toString() {
return source;
}
}
| [
"david.yu.ftw@gmail.com"
] | david.yu.ftw@gmail.com |
42b6e87ea5537d66bf627ad9747d3d770fcd0fe1 | b5aeadc53332a5bcf74f0802fa2befa55da05674 | /Factorial/src/com/dbobrov/annotation/factorial/FactorialAnnotationProcessor.java | 0461f2c2a7733c52b4ae13b829b1d81f51ffeed3 | [] | no_license | dvbobrov/JavaHomeworks | 4d65116771a13d010245092aa0279449d458a087 | 9804b26cff3f91f4516d43b97ab3cb0b72b3ecfa | refs/heads/master | 2020-05-17T18:10:11.164122 | 2013-06-16T18:13:34 | 2013-06-16T18:13:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,070 | java | package com.dbobrov.annotation.factorial;
import com.sun.tools.javac.model.JavacElements;
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.TreeMaker;
import com.sun.tools.javac.util.List;
import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import java.util.Set;
@SupportedAnnotationTypes(value = {FactorialAnnotationProcessor.ANNOTATION_NAME})
@SupportedSourceVersion(SourceVersion.RELEASE_6)
public class FactorialAnnotationProcessor extends AbstractProcessor {
public static final String ANNOTATION_NAME = "com.dbobrov.annotation.factorial.Factorial";
private JavacProcessingEnvironment environment;
private TreeMaker maker;
@Override
public SourceVersion getSupportedSourceVersion() {
return environment.getSourceVersion();
}
@Override
public void init(ProcessingEnvironment processingEnvironment) {
super.init(processingEnvironment);
environment = (JavacProcessingEnvironment)processingEnvironment;
maker = TreeMaker.instance(environment.getContext());
}
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnvironment) {
if (annotations == null || annotations.isEmpty()) {
return false;
}
final Elements elements = environment.getElementUtils();
final TypeElement annotation = elements.getTypeElement(ANNOTATION_NAME);
if (annotation != null) {
final Set<? extends Element> decls = roundEnvironment.getElementsAnnotatedWith(annotation);
JavacElements utils = environment.getElementUtils();
for (final Element decl: decls) {
Factorial fact = decl.getAnnotation(Factorial.class);
if (fact != null) {
int val = fact.value();
int factorialValue = 1;
if (val > 0) {
for (int i = 1; i <= val; i++) {
factorialValue *= i;
}
}
JCTree tree = utils.getTree(decl);
if (tree instanceof JCTree.JCMethodDecl) {
List<JCTree.JCStatement> newStatements = List.nil();
JCTree.JCExpression factExpr = maker.Literal(factorialValue);
newStatements = newStatements.append(maker.Return(factExpr));
((JCTree.JCMethodDecl)tree).body.stats = newStatements;
} else if (tree instanceof JCTree.JCVariableDecl) {
JCTree.JCExpression factExpr = maker.Literal(factorialValue);
((JCTree.JCVariableDecl)tree).init = factExpr;
}
}
}
return true;
}
return false;
}
}
| [
"me@dbobrov.com"
] | me@dbobrov.com |
d4ece734571e55110b4985f834e9c476ae4674c6 | 89f8c4d092c2eec681e9fba2bc5659ec285c0f8f | /src/main/java/com/test/ecommercedemo/Repository/UserRepository.java | 5b4844d820cff12e40d041455ff1f3f774dcb440 | [] | no_license | Arunjami/DemoEcommerce | a3b187b98227ef154983a6f61e75e40e12d7bf3c | 3f8d434ffdd16f3ada728526dc4523bc40e6ed88 | refs/heads/master | 2020-08-20T14:01:04.115711 | 2019-10-18T13:21:51 | 2019-10-18T13:21:51 | 216,031,451 | 0 | 0 | null | 2019-10-18T13:34:20 | 2019-10-18T13:34:19 | null | UTF-8 | Java | false | false | 290 | java | package com.test.ecommercedemo.Repository;
import com.test.ecommercedemo.EntityModel.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<User,Integer> {
}
| [
"vinothiniamudha@gmail.com"
] | vinothiniamudha@gmail.com |
f735efa38062dfb873382378a284624727e0bba6 | 2ebae9e39664c2dbcb8fd2667dbdd951f86384c8 | /project-java/src/main/java/com/kimifdw/java/concurrent/ThreadPoolDemo.java | 345e39dc042b2c1f041bd7c51417114ff8072ab3 | [] | no_license | kimifdw/LearnJava | 9e23214b209ac40c9e5d53b4fed73afeea93b608 | 2a1cf5782874094717700015bb558cbbacb2fd85 | refs/heads/master | 2021-01-12T00:57:35.100029 | 2018-05-24T10:07:56 | 2018-05-24T10:07:56 | 78,322,655 | 3 | 0 | null | 2018-05-23T16:26:22 | 2017-01-08T05:06:54 | Java | UTF-8 | Java | false | false | 1,839 | java | package com.kimifdw.java.concurrent;
import java.util.ArrayList;
import java.util.List;
/**
* 线程池实例
*/
public class ThreadPoolDemo {
private BlockingQueueDemo taskQueue = null;
private List<PoolThread> threads = new ArrayList<>();
private boolean isStopped = false;
public ThreadPoolDemo(int noOfThreads, int maxNoOfTasks) {
taskQueue = new BlockingQueueDemo(maxNoOfTasks);
for (int i = 0; i < noOfThreads; i++) {
threads.add(new PoolThread(taskQueue));
}
for (PoolThread thread : threads) {
thread.start();
}
}
public synchronized void execute(Runnable task) {
if (this.isStopped) throw new IllegalStateException("ThreadPool is stopped");
try {
this.taskQueue.enqueue(task);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public synchronized boolean stop() {
this.isStopped = true;
for (PoolThread thread : threads) {
thread.stop();
}
return isStopped;
}
}
/**
* 执行线程
*/
class PoolThread extends Thread {
private BlockingQueueDemo<Runnable> taskQueue = null;
private boolean isStopped = false;
public PoolThread(BlockingQueueDemo<Runnable> queue) {
taskQueue = queue;
}
public void run() {
while (!isStopped()) {
try {
Runnable runnable = (Runnable) taskQueue.take();
runnable.run();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
public synchronized void toStop() {
isStopped = true;
this.interrupt(); // 打断池中线程的dequeue() 调用
}
public synchronized boolean isStopped() {
return isStopped;
}
} | [
"fudongwei@sanjiang365.com"
] | fudongwei@sanjiang365.com |
1570c31390b92bf92f9d1c3e8d9f2c6f9699ac4e | c7007b4c01c841a3474ec69f60d48305516e9e1b | /app/src/main/java/com/smartwifi/bean/ProfileSelectionStaffBean.java | 250c12822eea2ce25ef8fde9c207436739bdc7f5 | [] | no_license | zhangshugen/SmartWifi | 646244bb034555bb8ba049e26ce5c6b391782f6b | 6304b2774959819984ee19ac559d9781f6d0053e | refs/heads/master | 2020-03-23T22:05:35.751541 | 2018-08-20T01:12:19 | 2018-08-20T01:12:19 | 142,152,454 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,991 | java | package com.smartwifi.bean;
import android.databinding.BaseObservable;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
/**
* @Author zhangshurong
* @CreateTime 2018/7/16
* @Describe
*/
public class ProfileSelectionStaffBean extends BaseObservable implements Serializable {
/**
* NW : 000000010423
* NWNAME : 直属机构
* BM : 103
* BMNAME : 湖南省水运管理局
* XJBM : 10302
* XJBMNAME : 水运局办公室
* PX : 11923
* IDENTITY : 13723870808
* XM : 胡建芳
* ZC : null
*/
@SerializedName("NW")
public String NW;
@SerializedName("NWNAME")
public String NWNAME;
@SerializedName("BM")
public String BM;
@SerializedName("BMNAME")
public String BMNAME;
@SerializedName("XJBM")
public String XJBM;
@SerializedName("XJBMNAME")
public String XJBMNAME;
@SerializedName("PX")
public String PX;
@SerializedName("IDENTITY")
public String IDENTITY;
@SerializedName("XM")
public String XM;
@SerializedName("ZC")
public String ZC;
public String getNW() {
return NW == null ? "" : NW;
}
public String getNWNAME() {
return NWNAME == null ? "" : NWNAME;
}
public String getBM() {
return BM == null ? "" : BM;
}
public String getBMNAME() {
return BMNAME == null ? "" : BMNAME;
}
public String getXJBM() {
return XJBM == null ? "" : XJBM;
}
public String getXJBMNAME() {
return XJBMNAME == null ? "" : XJBMNAME;
}
public String getPX() {
return PX == null ? "" : PX;
}
public String getIDENTITY() {
return IDENTITY == null ? "" : IDENTITY;
}
public String getXM() {
return XM == null ? "" : XM;
}
public String getZC() {
return ZC == null ? "" : ZC;
}
}
| [
"hkt"
] | hkt |
b30a6e2c7e52754e03ecdbc1765e94d5c15760d1 | f6831ae7e13c2b218d4c77e5439c0ef7126135e2 | /accession-commons-mongodb/src/test/java/uk/ac/ebi/ampt2d/test/persistence/repository/TestOperationRepository.java | 968d921910b0507b825e557132ad34c057230089 | [
"Apache-2.0"
] | permissive | jorizci/accession-commons | b16830d995d39a684c6824c8d496924b3c4257fc | 0da49cfe200631e5ce47d1209f80ff5fe97bbe40 | refs/heads/master | 2021-01-25T10:06:02.375052 | 2018-06-12T21:59:39 | 2018-06-12T21:59:39 | 123,337,450 | 0 | 0 | Apache-2.0 | 2018-02-28T20:17:03 | 2018-02-28T20:17:03 | null | UTF-8 | Java | false | false | 1,007 | java | /*
*
* Copyright 2018 EMBL - European Bioinformatics Institute
*
* 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 uk.ac.ebi.ampt2d.test.persistence.repository;
import org.springframework.stereotype.Repository;
import uk.ac.ebi.ampt2d.commons.accession.persistence.IHistoryRepository;
import uk.ac.ebi.ampt2d.test.persistence.document.TestOperationDocument;
@Repository
public interface TestOperationRepository extends IHistoryRepository<String, TestOperationDocument, String> {
}
| [
"jorizci@gmail.com"
] | jorizci@gmail.com |
54c27faed2ea58499d4dadbb4d08bde49db14bcb | f5442ce4a67de5f8f774ecd2cef1fc39837b5778 | /algo/strategy/src/main/java/com/cyanspring/strategy/singleinstrument/PriceAnalyzerByMarketSession.java | 3c213de3b49be18bb95d346d828701bbada72f4b | [
"BSD-2-Clause"
] | permissive | czrtrading/czrtrading | f253755325208a42ee3f9f57729ca721036924d5 | 7dfe8a1ac753b6f6b3ce0a53a6faa668dff40919 | refs/heads/master | 2016-09-08T00:38:42.385611 | 2013-03-07T02:07:51 | 2013-03-07T02:07:51 | 8,617,861 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,462 | java | /*******************************************************************************
* Copyright (c) 2011-2012 Cyan Spring Limited
* All rights reserved. This program and the accompanying materials
* are made available under the terms specified by license file attached.
*
* Software distributed under the License is released 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.cyanspring.strategy.singleinstrument;
import java.util.Map;
import com.cyanspring.common.marketsession.MarketSessionType;
import com.cyanspring.common.strategy.PriceInstruction;
public class PriceAnalyzerByMarketSession extends AbstractPriceAnalyzer {
private Map<MarketSessionType, IPriceAnalyzer> handlerMap;
public PriceAnalyzerByMarketSession(Map<MarketSessionType, IPriceAnalyzer> handlerMap) {
this.handlerMap = handlerMap;
}
@Override
protected PriceInstruction calculate(QuantityInstruction qtyInstruction,
SingleInstrumentStrategy strategy) {
IPriceAnalyzer analyzer;
analyzer = handlerMap.get(strategy.getMarketSession());
if (analyzer == null)
analyzer = handlerMap.get(MarketSessionType.DEFAULT);
if (analyzer != null)
return analyzer.analyze(qtyInstruction, strategy);
return null;
}
}
| [
"yc3@princeton.edu"
] | yc3@princeton.edu |
58e561b30ab4a5504dd6ea317f415013ae335561 | a8d46c3480965ebd83a57aa6ab43d141f2743081 | /author/src/main/java/com/mirabellehegnet/authors/JabberActivity.java | 24dc60d1e666f2f799043f2c84a992e6ecb717a1 | [] | no_license | Thomas1002/Authors | 4d118346e7172ee0281997fd2fef1aabfca09172 | 8eabcbdc4febed09292ea4dc103911c131aa80bd | refs/heads/master | 2021-01-25T07:08:47.896511 | 2014-01-25T20:32:29 | 2014-01-25T20:32:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,034 | java | package com.mirabellehegnet.authors;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;
import android.webkit.WebView;
import android.widget.Button;
public class JabberActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jabber);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
}
public void openWikipedia(View view)
{
String url = "http://en.wikipedia.org/wiki/Jabberwocky";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.jabber, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
MediaPlayer mediaPlayer;
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_jabber, container, false);
final WebView webView = (WebView) rootView.findViewById(R.id.wikiWebView);
webView.getSettings().setBuiltInZoomControls(true);
webView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
webView.goBack();
return true;
}
return false;
}
});
Button imageButton = (Button) rootView.findViewById(R.id.imageButton);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
webView.loadUrl("file:///android_asset/jabberwocky.jpg");
}
});
try {
webView.loadUrl("file:///android_asset/jabberwocky.html");
} catch (Exception ex) {
Log.e("Banana", ex.getMessage());
}
return rootView;
}
@Override
public void onResume() {
Log.e("Banana","onResume");
mediaPlayer = MediaPlayer.create(getActivity(), R.raw.riot);
mediaPlayer.setLooping(true);
mediaPlayer.start();
super.onResume();
}
@Override
public void onPause() {
Log.e("Banana","onPause!");
mediaPlayer.stop();
mediaPlayer.release();
super.onPause();
}
}
}
| [
"taprivat@gmail.com"
] | taprivat@gmail.com |
31b413bc243784a52b55ef619af50627b44d21b0 | 395daf0b08ce13f8e7ca77f7bfa754dcae69e518 | /app/src/main/java/sfi/mobile/collection/fragment/TaskFragment.java | 888e15a7291f22244ca051c12defc91cd07092e5 | [] | no_license | widiramadhan/mobile-collection-android | c12f11938a673246e094ef31d53ef653f8a9c3eb | c6e64783409076d7e1c92ac793b2b7581dd6766e | refs/heads/master | 2020-04-28T02:41:17.750967 | 2019-05-14T08:24:38 | 2019-05-14T08:24:38 | 174,908,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,854 | java | package sfi.mobile.collection.fragment;
import android.app.ProgressDialog;
import android.database.Cursor;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import sfi.mobile.collection.R;
import sfi.mobile.collection.adapter.PageTaskAdapter;
import sfi.mobile.collection.helper.DBHelper;
import sfi.mobile.collection.util.HttpsTrustManager;
public class TaskFragment extends Fragment {
private static final String TAG = TaskFragment.class.getSimpleName();
private TabLayout tabLayout;
private ViewPager viewPager;
TextView txtLatitude, txtLongitude;
protected Cursor cursor;
DBHelper dbhelper;
ProgressDialog pDialog;
public TaskFragment() {
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_task, container, false);
tabLayout = (TabLayout)view.findViewById(R.id.tabs);
viewPager = (ViewPager)view.findViewById(R.id.view_pager);
viewPager.setAdapter(new PageTaskAdapter(getChildFragmentManager()));
tabLayout.setupWithViewPager(viewPager);
dbhelper = new DBHelper(getActivity());
/*//cek koneksi
ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
if(info == null){ //jika tidak ada koneksi
}else { //jika ada koneksi
//cek data ada atau tidak
SQLiteDatabase db = dbhelper.getReadableDatabase();
//cursor = db.rawQuery("SELECT * FROM dkhc WHERE nama='" + getIntent().getStringExtra("nama") +"'",null);
cursor = db.rawQuery("SELECT * FROM dkhc WHERE DATE_NOW = 'February 2019'",null);
cursor.moveToFirst();
if(cursor.getCount()>0){ //jika data ada
//cek status perubahan
}else{ //jika data tidak ada
Log.e(TAG, "data tidak ada, lakukan save");
}
}*/
return view;
}
private void checkData(final String contractID){
HttpsTrustManager.allowAllSSL();
pDialog.setCancelable(false);
pDialog.setMessage("Sedang sinkronisasi...");
showDialog();
}
private void showDialog() {
if (!pDialog.isShowing())
pDialog.show();
}
private void hideDialog() {
if (pDialog.isShowing())
pDialog.dismiss();
}
}
| [
"widiyanto.ramadhan@gmail.com"
] | widiyanto.ramadhan@gmail.com |
dd95b210127c4ae1cbea899f594824717c44b085 | 5d4fe11c5f30a7bc9789bfbde0dd2035a69c92b7 | /src/main/java/ua/training/project/model/dao/UserActivityDao.java | 66451542065cd1a5bf0f00a68eee768da4caf317 | [] | no_license | IrynaRadchuk/TimeTracker | 3fa2fecea11efaae8af6ac91f3bc05c31fba920b | a12dbdf15177b16fcb3bbc3bba10ecc2091af098 | refs/heads/master | 2023-05-09T05:40:09.017378 | 2021-06-07T19:37:42 | 2021-06-07T19:37:42 | 368,842,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,557 | java | package ua.training.project.model.dao;
import ua.training.project.model.entity.ActivityStatus;
import java.util.Objects;
/**
* DAO class to manage user activities in database
*
* @author Iryna Radchuk
*/
public class UserActivityDao {
private String activityName;
private ActivityStatus activityStatus;
private String activityUa;
public String getActivityUa() {
return activityUa;
}
public void setActivityUa(String activityUa) {
this.activityUa = activityUa;
}
public String getActivityName() {
return activityName;
}
public void setActivityName(String activityName) {
this.activityName = activityName;
}
public ActivityStatus getActivityStatus() {
return activityStatus;
}
public void setActivityStatus(ActivityStatus activityStatus) {
this.activityStatus = activityStatus;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof UserActivityDao)) return false;
UserActivityDao that = (UserActivityDao) o;
return Objects.equals(activityName, that.activityName) &&
activityStatus == that.activityStatus;
}
@Override
public int hashCode() {
return Objects.hash(activityName, activityStatus);
}
@Override
public String toString() {
return "UserActivityDao{" +
"activityName='" + activityName + '\'' +
", activityStatus=" + activityStatus +
'}';
}
}
| [
"irynrad@gmail.com"
] | irynrad@gmail.com |
9f4970c2e64bd85bfb1376600737a2d2211bdfa7 | a3a37818440993dd85a3fe5e35a717b6192d0526 | /app/src/main/java/am/project/x/base/BaseActivity.java | 9999e6acd5cf2d9c11187e49d360861918719222 | [
"Apache-2.0",
"CC-BY-4.0",
"CC-BY-NC-SA-4.0",
"CC-BY-NC-4.0"
] | permissive | hoanngothanh/ProjectX | ceb24db89d1f511778c19fbc279ecd1ca56d19a2 | cd21ac8c9e13f41fd51cfcd54c121bab3018bec5 | refs/heads/master | 2020-03-30T17:11:08.042280 | 2019-08-28T10:05:39 | 2019-08-28T10:05:39 | 151,444,923 | 0 | 0 | Apache-2.0 | 2019-08-28T17:05:39 | 2018-10-03T16:32:30 | Java | UTF-8 | Java | false | false | 975 | java | /*
* Copyright (C) 2018 AlexMofer
*
* 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 am.project.x.base;
import android.app.Dialog;
import am.project.x.business.common.LoadingDialog;
import am.util.mvp.AMAppCompatActivity;
/**
* 基础Activity
* Created by Alex on 2018/7/23.
*/
public abstract class BaseActivity extends AMAppCompatActivity {
@Override
protected Dialog getLoadingDialog() {
return new LoadingDialog(this);
}
}
| [
"moferalex@gmail.com"
] | moferalex@gmail.com |
5f45e5947afb61eb8177564677fb6adc55f65240 | fd84dc55766b304d4cde053347594381f92dc2c1 | /src/com/ade/restapi/SinaAccountVerify.java | ade6adfb834beb91010f1abdc06d94b23b0fd4e8 | [] | no_license | wenbin1027/soda | 6e81ad5203686b9ccffa7ccc697903cb24ae8054 | a2b579f199e901ce7b297a41bc316764081bb477 | refs/heads/master | 2016-09-08T05:05:49.389514 | 2011-08-02T16:44:40 | 2011-08-02T16:44:40 | 41,466,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.ade.restapi;
import com.ade.parser.Parser;
import com.ade.site.Site;
public class SinaAccountVerify extends AccountVerifyInterface {
private static final String PATH="/account/verify_credentials.json";
public SinaAccountVerify(Parser parser) {
super(parser);
}
@Override
protected String getUrl(Site site) {
return new String(site.getRootUrl()+PATH);
}
}
| [
"wenbin1027@gmail.com"
] | wenbin1027@gmail.com |
080bebfa4bd2810aa022e19fcedce744581c1da3 | 872d994bbf6e5ee6dc4249c16bec87725913e32d | /pagamentoComicao/src/com/br/comicao/Comicao.java | 9b2aa46acabe80ffb1cbd121e7159a454dbb4edc | [] | no_license | Diego2207/pagamentoComicao | 7f8e7e060371db881b460b76c74f42f2877dd306 | 01c6bebb4cb1fe611d17b85a627ec81db1d3be62 | refs/heads/master | 2020-06-10T22:10:06.567986 | 2019-06-25T19:19:42 | 2019-06-25T19:19:42 | 193,767,800 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | package com.br.comicao;
import java.util.Scanner;
public class Comicao {
Scanner entrada = new Scanner(System.in);
System.out.println("digite seu Id : ");
long idVendedor = entrada.nextLong();
System.out.println("digite o código da peça : ");
int codPeça = entrada.nextInt();
System.out.println("digite o preço da peça : ");
int preçoPeça = entrada.nextInt();
System.out.println("informe quantas peças foram vendidas : ");
int peçasVendidas = entrada.nextInt();
double porcentagemPeça = (preçoPeça * 5)/100;
System.out.println("a comissão do vendedor é de : " + porcentagemPeça);
}
Sysout
}
| [
"diego.santos@zup.com.br"
] | diego.santos@zup.com.br |
40a55c01a35241db87a9b52cac330c8449f7b49e | 3108172f8c0ab600d8adef27d3324fc943326d99 | /programare paralela/lab5/src/helpers/Util.java | 6d2ed56c21b2f0c4c51ebc27957df066dff36ac0 | [] | no_license | LeVoMihalcea/UBB-Third-Year | 847222b3d8e0d3375031dfb30883fdcbf3aff8ad | 93379f1605e9ac3839e37921dd24def1ed36fc55 | refs/heads/main | 2023-04-21T19:01:29.766175 | 2021-05-06T08:29:03 | 2021-05-06T08:29:03 | 301,684,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,522 | java | package helpers;
import domain.Polynomial;
import java.util.ArrayList;
import java.util.List;
public class Util {
public static Polynomial shift(Polynomial p, int offset) {
List<Integer> coefficients = new ArrayList<>();
for (int i = 0; i < offset; i++) {
coefficients.add(0);
}
for (int i = 0; i < p.getLength(); i++) {
coefficients.add(p.getCoefficients().get(i));
}
return new Polynomial(coefficients);
}
public static Polynomial subtract(Polynomial p1, Polynomial p2) {
int minDegree = Math.min(p1.getDegree(), p2.getDegree());
int maxDegree = Math.max(p1.getDegree(), p2.getDegree());
List<Integer> coefficients = new ArrayList<>(maxDegree + 1);
//Subtract the 2 polynomials
for (int i = 0; i <= minDegree; i++) {
coefficients.add(p1.getCoefficients().get(i) - p2.getCoefficients().get(i));
}
addRemainingCoefficients(p1, p2, minDegree, maxDegree, coefficients);
//remove coefficients starting from biggest power if coefficient is 0
int i = coefficients.size() - 1;
while (coefficients.get(i) == 0 && i > 0) {
coefficients.remove(i);
i--;
}
return new Polynomial(coefficients);
}
private static void addRemainingCoefficients(Polynomial p1, Polynomial p2, int minDegree, int maxDegree,
List<Integer> coefficients) {
if (minDegree != maxDegree) {
if (maxDegree == p1.getDegree()) {
for (int i = minDegree + 1; i <= maxDegree; i++) {
coefficients.add(p1.getCoefficients().get(i));
}
} else {
for (int i = minDegree + 1; i <= maxDegree; i++) {
coefficients.add(p2.getCoefficients().get(i));
}
}
}
}
public static Polynomial add(Polynomial p1, Polynomial p2) {
int minDegree = Math.min(p1.getDegree(), p2.getDegree());
int maxDegree = Math.max(p1.getDegree(), p2.getDegree());
List<Integer> coefficients = new ArrayList<>(maxDegree + 1);
//Add the 2 polynomials
for (int i = 0; i <= minDegree; i++) {
coefficients.add(p1.getCoefficients().get(i) + p2.getCoefficients().get(i));
}
addRemainingCoefficients(p1, p2, minDegree, maxDegree, coefficients);
return new Polynomial(coefficients);
}
}
| [
"leomi@LEOS-LAPTOP"
] | leomi@LEOS-LAPTOP |
f6c2cd058eb9a357d7d67259b32945bf319c53a1 | c27a9a929fa6646225f94893b31a9143dc5d8eab | /app/src/main/java/com/devashish/erpapp/MyTextView.java | 3c1e438d4fe0f39d2638925559180dc9c11d85b9 | [] | no_license | devashishdk/DealerAppIIY | a3c47fec6a34759ed35d1247bddf4c6f4215dbfb | d6fad0f63cb7b18769c7c45c28c0218553afb761 | refs/heads/master | 2022-03-06T04:35:09.733903 | 2019-09-06T14:45:28 | 2019-09-06T14:45:28 | 190,236,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package com.devashish.erpapp;
import android.content.Context;
import android.graphics.Typeface;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;
public class MyTextView extends AppCompatTextView {
public MyTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MyTextView(Context context) {
super(context);
init();
}
private void init() {
if (!isInEditMode()) {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/font_app.ttf");
setTypeface(tf);
}
}
} | [
"dksanu@gmail.com"
] | dksanu@gmail.com |
908471767e6824996dea843f4595ab89c134c6ad | 473fc28d466ddbe9758ca49c7d4fb42e7d82586e | /app/src/main/java/com/syd/source/aosp/cts/tests/app/src/android/app/cts/ListActivityTest.java | 1cd3cf513906939ecaf478553a64bf8e5c4c98e6 | [] | no_license | lz-purple/Source | a7788070623f2965a8caa3264778f48d17372bab | e2745b756317aac3c7a27a4c10bdfe0921a82a1c | refs/heads/master | 2020-12-23T17:03:12.412572 | 2020-01-31T01:54:37 | 2020-01-31T01:54:37 | 237,205,127 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,027 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* 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 android.app.cts;
import android.app.Instrumentation;
import android.app.ListActivity;
import android.app.stubs.MockListActivity;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.SmallTest;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import junit.framework.Assert;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@SmallTest
public class ListActivityTest extends ActivityInstrumentationTestCase2<MockListActivity> {
private ListActivity mActivity;
public ListActivityTest() {
super(MockListActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
mActivity = getActivity();
}
public void testAdapter() throws Throwable {
final ListAdapter listAdapter = new ArrayAdapter<String>(mActivity,
android.R.layout.simple_list_item_1,
new String[] { "Mercury", "Mars", "Earth", "Venus"});
runTestOnUiThread(new Runnable() {
@Override
public void run() {
mActivity.setListAdapter(listAdapter);
}
});
assertEquals(listAdapter, mActivity.getListAdapter());
assertEquals(listAdapter, mActivity.getListView().getAdapter());
}
public void testSelection() throws Throwable {
final ListAdapter listAdapter = new ArrayAdapter<String>(mActivity,
android.R.layout.simple_list_item_1,
new String[] { "Alpha", "Bravo", "Charlie", "Delta", "Echo"});
runTestOnUiThread(new Runnable() {
@Override
public void run() {
mActivity.setListAdapter(listAdapter);
}
});
assertEquals(0, mActivity.getSelectedItemPosition());
assertEquals(0, mActivity.getSelectedItemId());
runOnMainAndDrawSync(getInstrumentation(), mActivity.getListView(), new Runnable() {
@Override
public void run() {
mActivity.setSelection(2);
}
});
assertEquals(2, mActivity.getSelectedItemPosition());
assertEquals(2, mActivity.getSelectedItemId());
}
public void testItemClick() throws Throwable {
final ListAdapter listAdapter = new ArrayAdapter<String>(mActivity,
android.R.layout.simple_list_item_1,
new String[] { "Froyo", "Gingerbread", "Ice Cream Sandwich" });
runTestOnUiThread(new Runnable() {
@Override
public void run() {
mActivity.setListAdapter(listAdapter);
}
});
final MockListActivity mockListActivity = (MockListActivity) mActivity;
assertFalse(mockListActivity.isOnListItemClickCalled);
runTestOnUiThread(new Runnable() {
@Override
public void run() {
mActivity.getListView().performItemClick(null, 1, 1);
}
});
assertTrue(mockListActivity.isOnListItemClickCalled);
assertEquals(1, mockListActivity.itemClickCallCount);
assertEquals(1, mockListActivity.clickedItemPosition);
}
private static void runOnMainAndDrawSync(Instrumentation instrumentation,
final View view, final Runnable runner) {
final Semaphore token = new Semaphore(0);
instrumentation.runOnMainSync(new Runnable() {
@Override
public void run() {
final ViewTreeObserver observer = view.getViewTreeObserver();
final ViewTreeObserver.OnDrawListener listener =
new ViewTreeObserver.OnDrawListener() {
@Override
public void onDraw() {
view.post(() -> view.getViewTreeObserver().removeOnDrawListener(this));
view.post(() -> token.release());
}
};
observer.addOnDrawListener(listener);
runner.run();
}
});
try {
Assert.assertTrue("Expected draw pass occurred within 5 seconds",
token.tryAcquire(5, TimeUnit.SECONDS));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
| [
"997530783@qq.com"
] | 997530783@qq.com |
9fcd94ef470f2586014c2a3bf73e1bda705e0419 | 0fd71ba59f7d39b0a27920cb1df4f89369e8904d | /app/src/main/java/com/persenlopro/wanandroid/Adapter/MessageAdapter2.java | 55546f872520e5eee3c9050e0621e3f0ed7db535 | [] | no_license | Persenlo/WanAndroid | 6615f5c9aae065471faf56b36e8461f9669690f4 | e8e14154a67307d9f38beef79da0ec20325d45fa | refs/heads/main | 2023-03-14T10:45:57.676155 | 2021-02-27T12:58:09 | 2021-02-27T12:58:09 | 342,763,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,611 | java | package com.persenlopro.wanandroid.Adapter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.persenlopro.wanandroid.BrowserActivity;
import com.persenlopro.wanandroid.Data.Messages;
import com.persenlopro.wanandroid.R;
import java.util.ArrayList;
import java.util.List;
//没Banner的Adapter
public class MessageAdapter2 extends RecyclerView.Adapter<MessageAdapter2.ViewHolder> {
private List<Messages> messagesList;
private Context context;
public MessageAdapter2(List<Messages> messagesList,Context context){
this.messagesList=messagesList;
this.context=context;
}
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item_message,parent,false);
final MessageAdapter2.ViewHolder holder=new MessageAdapter2.ViewHolder(view);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = holder.getAdapterPosition();
Messages messages = messagesList.get(position);
Intent intent=new Intent(context, BrowserActivity.class);
Bundle b=new Bundle();
b.putString("url",messages.getLink());
intent.putExtras(b);
context.startActivity(intent);
}
});
return holder;
}
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Messages messages = messagesList.get(position);
holder.title.setText(messages.getTitle());
holder.shareUser.setText(messages.getShareUser());
holder.niceDate.setText(messages.getNiceDate());
}
public int getItemCount() {
return messagesList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView title;
public TextView shareUser;
public TextView niceDate;
public ViewHolder(@NonNull View itemView) {
super(itemView);
title=(TextView)itemView.findViewById(R.id.message_title);
shareUser=(TextView)itemView.findViewById(R.id.message_shareUser);
niceDate=(TextView)itemView.findViewById(R.id.message_niceDate);
}
}
}
| [
"1140086781@qq.com"
] | 1140086781@qq.com |
44b624fbc15d63aad5ac2ff91c63538ed8af4ef2 | f3cb40ac1abb0c1ec220bae2cb34616424658467 | /Java/oauth/server/src/main/java/cn/netkiller/oauth/server/model/Level.java | a1c75012c356d11c6d9d9ba215abf2243fdef228 | [] | no_license | netkiller/example | 518ac2c182b5489127fed70c53200f91a8f666a0 | 9287318b2572b377a64c13c143ca02e65ac348d1 | refs/heads/master | 2022-05-30T05:25:16.362395 | 2017-11-09T08:21:19 | 2017-11-09T08:21:19 | 12,375,150 | 4 | 4 | null | 2022-05-20T20:53:04 | 2013-08-26T09:05:46 | Java | UTF-8 | Java | false | false | 90 | java | package cn.netkiller.oauth.server.model;
public enum Level {
GOOD, AWESOME, GODLIKE
}
| [
"netkiller@msn.com"
] | netkiller@msn.com |
0b673e426a7edbf1b905cfafbf4080102fee97ca | f07fedd699de485e4918cc0aec7da84bba2341ab | /src/main/java/com/Jahan/Task_Management/helper/UserTaskRelHelper.java | 9b7a79cb4a1c8ef5a1ced16848b51541b2622c04 | [] | no_license | Sawgath/Task_Management | 16008454d6a63c8ffe7949b6146a504c64fd325f | a21a4e4900647e5deec193346e57921ec5aece6e | refs/heads/master | 2021-01-19T12:48:05.989490 | 2017-10-23T15:33:13 | 2017-10-23T15:33:13 | 100,811,542 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package com.Jahan.Task_Management.helper;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.Jahan.Task_Management.helperModel.*;
import com.Jahan.Task_Management.model.*;
import com.Jahan.Task_Management.repo.UserTaskRelRepository;
@Component
public class UserTaskRelHelper {
@Autowired
UserTaskRelRepository UserTaskRelRepositoryT;
public void saveUserTaskRel(UserTaskRelHelperModel aUserTaskRelHelperModel){
if(aUserTaskRelHelperModel.taskId!=0 && aUserTaskRelHelperModel.projectId!=0 && aUserTaskRelHelperModel.userId!=0 && !aUserTaskRelHelperModel.taskStartTime.equals("") && !aUserTaskRelHelperModel.taskEndTime.equals(""))
{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
try {
Date projectStartTime = formatter.parse(aUserTaskRelHelperModel.taskStartTime);
Date projectEndTime = formatter.parse(aUserTaskRelHelperModel.taskEndTime);
/*
* Task constructor parameter
* long parentId, long projectId, String taskName,String taskDescription,String taskGoal, String taskStartTime, String taskEndTime
*/
UserTaskRel aUserTaskRel=new UserTaskRel(aUserTaskRelHelperModel,projectStartTime,projectEndTime);
UserTaskRelRepositoryT.save(aUserTaskRel);
} catch (ParseException e) {
e.printStackTrace();
}
}
}
}
| [
"sawjahan@gmail.com"
] | sawjahan@gmail.com |
36064046442b0a9cef6d2b4e3e8d666ac68a6c81 | 59e4b5aa273e176d4ff7cfab33766ac6091803de | /file-micro-service/src/main/java/br/com/softbank/file/response/ResponseDTO.java | b64a4a8a8fc64144daba9e5f48f7f22faa6d6e6a | [] | no_license | BrunoSoftbank/spring-cloud-micro-services | 0172e7584a66e2f6aaacd16b424e1e7e567193d3 | 3e6c358eb6d103a2d3c2c8c0f7024a51cc1e8084 | refs/heads/master | 2023-08-24T03:50:22.717025 | 2021-10-21T01:51:29 | 2021-10-21T01:51:29 | 372,340,390 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package br.com.softbank.file.response;
import java.util.ArrayList;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseDTO {
private String description;
private List<ErrorDefault> errors = new ArrayList<ErrorDefault>();
public ResponseDTO(String description) {
this.description = description;
}
}
| [
"bruno.softbank@gmail.com"
] | bruno.softbank@gmail.com |
95d86b17e25b06e65ae183d2f5908aac001446d0 | c6f170321afff2b5cee9b0200a4bdd19dca57910 | /Android/PLDroidMediaStreamingDemo/app/src/main/java/com/bytedance/labcv/demo/fragment/MainFragment.java | 079ae2e58f0a6a50562556de38d1318ffd1834c6 | [] | no_license | oopming/PLMediaStreaming-ByteDance | aace2146017b8cbba2d2ea45edc3a5f21f8ed216 | fc1e7e03dba16a3742305a13fc8769fab9482b18 | refs/heads/master | 2022-03-30T22:42:26.414231 | 2019-12-30T02:53:01 | 2019-12-30T02:53:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,067 | java | package com.bytedance.labcv.demo.fragment;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.SwitchCompat;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bytedance.labcv.demo.MainActivity;
import com.bytedance.labcv.demo.PermissionsActivity;
import com.qiniu.pili.droid.streaming.demo.R;
import com.bytedance.labcv.demo.core.CameraRenderView;
import com.bytedance.labcv.demo.core.EffectRenderHelper;
import com.bytedance.labcv.demo.model.CaptureResult;
import com.bytedance.labcv.demo.model.ComposerNode;
import com.bytedance.labcv.demo.utils.BitmapUtils;
import com.bytedance.labcv.demo.utils.CommonUtils;
import com.bytedance.labcv.demo.utils.Config;
import com.bytedance.labcv.demo.utils.ToasUtils;
import com.bytedance.labcv.demo.utils.UserData;
import com.bytedance.labcv.demo.view.VideoButton;
import com.bytedance.labcv.effectsdk.BytedEffectConstants;
import com.bytedance.labcv.effectsdk.library.LogUtils;
import com.bytedance.labcv.effectsdk.library.OrientationSensor;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import static com.bytedance.labcv.demo.contract.StickerContract.TYPE_ANIMOJI;
import static com.bytedance.labcv.demo.contract.StickerContract.TYPE_STICKER;
/**
* Created by QunZhang on 2019-12-20 11:14
*/
public class MainFragment extends Fragment implements EffectRenderHelper.OnEffectListener, View.OnClickListener {
// 标志面板类型,分别是 识别、特效、贴纸
// Logo panel type, respectively is identification, special effects, stickers
public static final String TAG_EFFECT = "effect";
public static final String TAG_STICKER = "sticker";
public static final String TAG_ANIMOJI = "animoji";
public static final int ANIMATOR_DURATION = 400;
private EffectFragment mEffectFragment;
private StickerFragment mStickerFragment;
private StickerFragment mAnimojiFragment;
// 正在处于功能可用状态的面板
// current panel
private MainActivity.OnCloseListener mWorkingFragment;
private TextView mFpsTextView;
// private CameraRenderView mSurfaceView;
private EffectRenderHelper effectRenderHelper;
// private FrameLayout mSurfaceContainer;
private View rootView;
private LinearLayout llFeature;
private LinearLayout llEffect;
private LinearLayout llSticker;
private LinearLayout llAnimoji;
// below UI elements are for debug
public StringBuilder cameraInfo;
public TextView tvInfo;
public TextView tvcameraInfo;
public ImageView mImageView;
private VideoButton vbTakePic;
private SwitchCompat scExclusive;
private boolean mFirstEnter = true;
private String mSavedStickerPath;
private String mSavedAnimojiPath;
private MainActivity.ICheckAvailableCallback mCheckAvailableCallback = new MainActivity.ICheckAvailableCallback() {
@Override
public boolean checkAvailable(int id) {
if (mSavedAnimojiPath != null && !mSavedAnimojiPath.equals("")) {
ToasUtils.show(getString(R.string.tip_close_animoji_first));
return false;
}
if (isExclusive() && id != TYPE_STICKER && mSavedStickerPath != null && !mSavedStickerPath.equals("")) {
ToasUtils.show(getString(R.string.tip_close_sticker_first));
return false;
}
return true;
}
};
private static final int UPDATE_INFO = 1;
// 拍照失败
private static final int CAPTURE_FAIL = 9;
// 拍照成功
private static final int CAPTURE_SUCCESS = 10;
private static final int UPDATE_INFO_INTERVAL = 1000;
private InnerHandler mHandler = new InnerHandler(this);
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, null);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
OrientationSensor.start(getContext());
initViews();
}
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// requestWindowFeature(Window.FEATURE_NO_TITLE);
// getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// OrientationSensor.start(this);
//
// setContentView(R.layout.activity_main);
// checkPermissions();
// initViews();
// }
private void initViews() {
llFeature = getView().findViewById(R.id.ll_feature);
llEffect = getView().findViewById(R.id.ll_effect);
llSticker = getView().findViewById(R.id.ll_sticker);
llAnimoji = getView().findViewById(R.id.ll_animoji);
mImageView = getView().findViewById(R.id.img);
tvInfo = getView().findViewById(R.id.tv_info);
tvcameraInfo = getView().findViewById(R.id.camera_info);
// mSurfaceView = getView().findViewById(R.id.gl_surface);
// effectRenderHelper = mSurfaceView.getEffectRenderHelper();
effectRenderHelper = new EffectRenderHelper(getContext());
effectRenderHelper.setOnEffectListener(this);
// mSurfaceContainer = getView().getView().findViewById(R.id.surface_container);
getView().findViewById(R.id.iv_change_camera).setOnClickListener(this);
vbTakePic = getView().findViewById(R.id.btn_take_pic);
vbTakePic.setOnClickListener(this);
llEffect.setOnClickListener(this);
llSticker.setOnClickListener(this);
llAnimoji.setOnClickListener(this);
scExclusive = getView().findViewById(R.id.switch_exclusive);
scExclusive.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked == UserData.getExclusive(getContext(), false)) {
return;
}
UserData.setExclusive(getContext(), isChecked);
ToasUtils.show(getString(R.string.exclusive_tip));
}
});
mFpsTextView = getView().findViewById(R.id.info_fps);
rootView = getView().findViewById(R.id.rl_root);
rootView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
closeFeature(true);
return false;
}
});
}
// private void switchCamera() {
// mSurfaceView.switchCamera();
// }
/**
* 根据 TAG 创建对应的 Fragment
* Create the corresponding Fragment based on TAG
* @param tag tag
* @return Fragment
*/
private Fragment generateFragment(String tag) {
switch (tag) {
case TAG_EFFECT:
if (mEffectFragment != null) return mEffectFragment;
final EffectFragment effectFragment = new EffectFragment();
effectFragment.setCheckAvailableCallback(mCheckAvailableCallback)
.setCallback(new EffectFragment.IEffectCallback() {
@Override
public void updateComposeNodes(final String[] nodes) {
LogUtils.e("update composer nodes: " + Arrays.toString(nodes));
// if (nodes.length > 0) {
// onFragmentWorking(mEffectFragment);
// }
effectRenderHelper.setComposeNodes(nodes);
}
@Override
public void updateComposeNodeIntensity(final ComposerNode node) {
LogUtils.e("update composer node intensity: node: " + node.getNode() + ", key: " + node.getKey() + ", value: " + node.getValue());
effectRenderHelper.updateComposeNode(node, true);
}
@Override
public void onFilterSelected(final File file) {
effectRenderHelper.setFilter(file != null ? file.getAbsolutePath() : "");
// if (file != null) {
// onFragmentWorking(mEffectFragment);
// }
}
@Override
public void onFilterValueChanged(final float cur) {
effectRenderHelper.updateIntensity(BytedEffectConstants.IntensityType.Filter, cur);
}
@Override
public void setEffectOn(final boolean isOn) {
effectRenderHelper.setEffectOn(isOn);
}
@Override
public void onDefaultClick() {
onFragmentWorking(mEffectFragment);
}
});
mEffectFragment = effectFragment;
return effectFragment;
case TAG_STICKER:
if (mStickerFragment != null) return mStickerFragment;
StickerFragment stickerFragment = new StickerFragment()
.setCheckAvailableCallback(mCheckAvailableCallback)
.setType(TYPE_STICKER);
stickerFragment.setCallback(new StickerFragment.IStickerCallback() {
@Override
public void onStickerSelected(final File file) {
mSavedStickerPath = file == null ? null : file.getAbsolutePath();
if (file != null) {
onFragmentWorking(mStickerFragment);
}
effectRenderHelper.setSticker(file != null ? file.getAbsolutePath() : "");
if (isExclusive() && file == null) {
mEffectFragment.recoverState();
}
}
});
mStickerFragment = stickerFragment;
return stickerFragment;
case TAG_ANIMOJI:
if (mAnimojiFragment != null) return mAnimojiFragment;
StickerFragment animojiFragment = new StickerFragment().setType(TYPE_ANIMOJI);
animojiFragment.setCallback(new StickerFragment.IStickerCallback() {
@Override
public void onStickerSelected(final File file) {
mSavedAnimojiPath = file == null ? null : file.getAbsolutePath();
if (file != null) {
onFragmentWorking(mAnimojiFragment);
}
effectRenderHelper.setSticker(file != null ? file.getAbsolutePath() : "");
if (file == null) {
if (mStickerFragment != null && mSavedStickerPath != null && !mSavedStickerPath.equals("")) {
mStickerFragment.recoverState(mSavedStickerPath);
}
if ((!isExclusive() || mSavedStickerPath == null || mSavedStickerPath.equals(""))
&& mEffectFragment != null) {
mEffectFragment.recoverState();
}
}
// if (file == null && mEffectFragment != null) {
// mEffectFragment.recoverState();
// }
// if (file == null && mSavedStickerPath != null &&
// !mSavedStickerPath.equals("") && mStickerFragment != null) {
// mStickerFragment.recoverState(mSavedStickerPath);
// }
}
});
mAnimojiFragment = animojiFragment;
return animojiFragment;
default:
return null;
}
}
/**
* 展示某一个 feature 面板
* Show a feature panel
* @param tag tag use to mark Fragment 用于标志 Fragment 的 tag
*/
private void showFeature(String tag, boolean hideBoard) {
// if (mSurfaceView == null) return;
if (effectRenderHelper == null) return;
if (showingFragment() != null) {
getChildFragmentManager().beginTransaction().hide(showingFragment()).commit();
}
FragmentManager fm = getChildFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
if (hideBoard) {
ft.setCustomAnimations(R.anim.board_enter, R.anim.board_exit);
}
Fragment fragment = fm.findFragmentByTag(tag);
if (fragment == null) {
fragment = generateFragment(tag);
ft.add(R.id.board_container, fragment, tag).commit();
} else {
ft.show(fragment).commit();
}
if (hideBoard) {
showOrHideBoard(false);
}
}
/**
* 关闭所有的 feature 面板
* close all feature panel
* @return whether close panel successfully 是否成功关闭某个面板,即是否有面板正在开启中
*/
private boolean closeFeature(boolean animation) {
Fragment showingFragment = showingFragment();
if (showingFragment != null) {
FragmentTransaction ft =getChildFragmentManager().beginTransaction();
if (animation) {
ft.setCustomAnimations(R.anim.board_enter, R.anim.board_exit);
}
ft.hide(showingFragment).commit();
}
showOrHideBoard(true);
return showingFragment != null;
}
private Fragment showingFragment() {
if (mEffectFragment != null && !mEffectFragment.isHidden()) {
return mEffectFragment;
} else if (mStickerFragment != null && !mStickerFragment.isHidden()) {
return mStickerFragment;
} else if (mAnimojiFragment != null && !mAnimojiFragment.isHidden()) {
return mAnimojiFragment;
}
return null;
}
/**
* 展示或关闭菜单面板
* show board
* @param show 展示
*/
private void showOrHideBoard(boolean show) {
if (show) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (showingFragment() == null) {
vbTakePic.setVisibility(View.VISIBLE);
llFeature.setVisibility(View.VISIBLE);
}
}
}, ANIMATOR_DURATION);
} else {
vbTakePic.setVisibility(View.GONE);
llFeature.setVisibility(View.GONE);
}
}
@Override
public void onPause() {
super.onPause();
// release device
mHandler.removeCallbacksAndMessages(null);
// mSurfaceView.onPause();
}
@Override
public void onDestroy() {
OrientationSensor.stop();
// mSurfaceContainer.removeAllViews();
super.onDestroy();
// mSurfaceView = null;
mEffectFragment = null;
mStickerFragment = null;
}
@Override
public void onResume() {
super.onResume();
// setup device
// mSurfaceView.onResume();
mHandler.sendEmptyMessageDelayed(UPDATE_INFO, UPDATE_INFO_INTERVAL);
}
// private void checkPermissions() {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// if (checkSelfPermission(Config.PERMISSION_CAMERA) != PackageManager.PERMISSION_GRANTED ||
// checkSelfPermission(Config.PERMISSION_STORAGE) != PackageManager.PERMISSION_GRANTED ||
// checkSelfPermission(Config.PERMISSION_AUDIO) != PackageManager.PERMISSION_GRANTED) {
// // start Permissions activity
// Intent intent = new Intent(this, PermissionsActivity.class);
// startActivity(intent);
// finish();
// overridePendingTransition(0, 0);
// }
// }
// }
@Override
public void onClick(View v) {
if (CommonUtils.isFastClick()) {
ToasUtils.show("too fast click");
return;
}
switch (v.getId()) {
case R.id.iv_change_camera:
// switchCamera();
break;
case R.id.btn_take_pic:
takePic();
break;
case R.id.ll_effect:
showFeature(TAG_EFFECT, true);
break;
case R.id.ll_sticker:
showFeature(TAG_STICKER, true);
break;
case R.id.ll_animoji:
showFeature(TAG_ANIMOJI, true);
break;
}
}
//
// @Override
// public void onBackPressed() {
// if (closeFeature(true)) {
// return;
// }
// super.onBackPressed();
// }
private void takePic() {
if (null == effectRenderHelper) return;
if (mHandler == null) return;
CaptureResult captureResult= effectRenderHelper.capture();
if (null == captureResult || captureResult.getWidth() == 0 || captureResult.getHeight() == 0|| null == captureResult.getByteBuffer()){
mHandler.sendEmptyMessage(CAPTURE_FAIL);
}else {
Message msg = mHandler.obtainMessage(CAPTURE_SUCCESS, captureResult);
mHandler.sendMessage(msg);
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getActivity().finish();
}
private static class InnerHandler extends Handler {
private final WeakReference<MainFragment> mActivity;
public InnerHandler(MainFragment activity) {
mActivity = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg) {
MainFragment activity = mActivity.get();
if (activity != null) {
switch (msg.what) {
case UPDATE_INFO:
// activity.mFpsTextView.setText("" + activity.mSurfaceView.getFrameRate());
sendEmptyMessageDelayed(UPDATE_INFO, UPDATE_INFO_INTERVAL);
break;
case CAPTURE_SUCCESS:
CaptureResult captureResult = (CaptureResult) msg.obj;
SavePicTask task = new SavePicTask(mActivity.get().getContext());
task.execute(captureResult);
break;
}
}
}
}
static class SavePicTask extends AsyncTask<CaptureResult, Void,String> {
private WeakReference<Context> mContext;
public SavePicTask(Context context) {
mContext = new WeakReference<>(context);
}
@Override
protected String doInBackground(CaptureResult... captureResults) {
if (captureResults.length == 0) return "captureResult arrayLength is 0";
Bitmap bitmap = Bitmap.createBitmap(captureResults[0].getWidth(), captureResults[0].getHeight(), Bitmap.Config.ARGB_8888);
bitmap.copyPixelsFromBuffer(captureResults[0].getByteBuffer().position(0));
File file = BitmapUtils.saveToLocal(bitmap);
if (file.exists()){
return file.getAbsolutePath();
}else{
return "";
}
}
@Override
protected void onPostExecute(String path) {
super.onPostExecute(path);
if (TextUtils.isEmpty(path)){
ToasUtils.show("图片保存失败");
return;
}
if (mContext.get() == null) {
try {
new File(path).delete();
} catch (Exception ignored) {
}
ToasUtils.show("图片保存失败");
}
try{
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, path);
values.put(MediaStore.Images.Media.MIME_TYPE, "image/*");
mContext.get().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
}catch (Exception e){
e.printStackTrace();
}
ToasUtils.show("保存成功,路径:"+path);
}
}
/**
* 当用户选择贴纸时,利用回调接口,关闭对应的开关
* When the user selects the sticker
* Use the callback interface to turn off the corresponding switch
*/
private void onFragmentWorking(Fragment fragment) {
if (fragment == mEffectFragment) {
if (mStickerFragment != null) {
if (mSavedStickerPath != null) {
mStickerFragment.onClose();
mSavedStickerPath = null;
effectRenderHelper.setSticker(null);
}
}
if (mAnimojiFragment != null) {
if (mSavedAnimojiPath != null) {
mAnimojiFragment.onClose();
mSavedAnimojiPath = null;
effectRenderHelper.setSticker(null);
}
}
} else if (fragment == mStickerFragment) {
if (isExclusive() && mEffectFragment != null) {
mEffectFragment.onClose();
}
} else if (fragment == mAnimojiFragment) {
if (mEffectFragment != null) {
mEffectFragment.onClose();
}
if (mStickerFragment != null) {
mStickerFragment.onClose();
}
}
// if (fragment == mAnimojiFragment) {
// if (mEffectFragment != null) {
// mEffectFragment.onClose();
// }
// if (mStickerFragment != null) {
// mStickerFragment.onClose();
// }
// return;
// }
// if (!isExclusive()) {
// return;
// }
// if (fragment instanceof OnCloseListener) {
// if (fragment != mWorkingFragment) {
// // 开启贴纸会关闭美颜,反之不生效
// if (mWorkingFragment != null) {
// mWorkingFragment.onClose();
// }
// mWorkingFragment = (OnCloseListener) fragment;
// }
// } else {
// throw new IllegalArgumentException("fragment " + fragment + " must implement " + OnCloseListener.class);
// }
}
@Override
public void onEffectInitialized() {
if (!mFirstEnter) {
return;
}
mFirstEnter = false;
final boolean exclusive = UserData.getExclusive(getContext(), false);
effectRenderHelper.setComposerMode(exclusive ? 0 : 1);
final String[] features = new String[30];
effectRenderHelper.getAvailableFeatures(features);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
scExclusive.setChecked(exclusive);
showFeature(TAG_EFFECT, false);
new Handler().post(new Runnable() {
@Override
public void run() {
if (mEffectFragment != null) {
mEffectFragment.onDefaultClick();
}
closeFeature(false);
}
});
for (String feature : features) {
if (feature != null && feature.equals("3DStickerV3")) {
llAnimoji.setVisibility(View.VISIBLE);
break;
}
}
llFeature.setVisibility(View.VISIBLE);
}
});
}
private boolean isExclusive() {
return effectRenderHelper.getComposerMode() == 0;
}
public void initEffectRenderHelper(int width, int height) {
effectRenderHelper.initEffectSDK(width, height);
effectRenderHelper.onSurfaceChanged(width, height);
effectRenderHelper.recoverStatus();
}
public int processTexture(int texture, int width, int height) {
return effectRenderHelper.processTexure(texture, BytedEffectConstants.TextureFormat.Texure2D,
width, height, 0, true, BytedEffectConstants.Rotation.CLOCKWISE_ROTATE_0,
System.currentTimeMillis());
}
/**
* 定义一个回调接口,用于当用户选择其中一个面板时,
* 关闭其他面板的回调,此接口由各 Fragment 实现,
* 在 onClose() 方法中要完成各 Fragment 中 UI 的初始化,
* 即关闭用户已经开启的开关
*
* Define a callback interface for when a user selects one of the panels,
* close the callback of the other panel, which is implemented by each Fragment
* In the onClose() method, initialize the UI of each Fragment:
* turn off the switch that the user has already turned on
*/
public interface OnCloseListener {
void onClose();
}
public interface ICheckAvailableCallback {
boolean checkAvailable(int id);
}
}
| [
"kevinhuox@gmail.com"
] | kevinhuox@gmail.com |
63eabfe55c5ddc12e93d692d8a73687c2e205c93 | d51921c79567fb52ac8f75ac4d877949f3b2181f | /dart/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/PropertySemanticProcessorTest.java | f773df5c46d1796923656bae71b0bb29ed2f4ed3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jaylistack/bleeding_edge | 93723fc1c0b3ceb8ede0e91f9ba9478b15440b4a | ec2f7997d2fd905bc0c3a40d515a7f1b1937183f | refs/heads/master | 2021-05-27T14:12:35.112320 | 2014-03-25T09:14:32 | 2014-03-25T09:14:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,467 | java | /*
* Copyright (c) 2013, the Dart project authors.
*
* Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html
*
* 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.google.dart.java2dart.processor;
/**
* Test for {@link PropertySemanticProcessor}.
*/
public class PropertySemanticProcessorTest extends SemanticProcessorTest {
public void test_field_BAD_accessedInConstructorInvocation() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" public class Super {",
" public Super(int bar) {",
" }",
" }",
" public class Sub extends Super {",
" private int foo;",
" public int getFoo() {",
" return foo;",
" }",
" public void setFoo(int foo) {",
" this.foo = foo;",
" }",
" public Sub(int foo) {",
" super(foo + 1);",
" this.foo = foo;",
" }",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
"}",
"class Test_Super {",
" Test_Super(int bar);",
"}",
"class Test_Sub extends Test_Super {",
" int foo = 0;",
" Test_Sub(int foo) : super(foo + 1) {",
" this.foo = foo;",
" }",
"}");
}
public void test_field_BAD_has_set() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private boolean foo;",
" public boolean hasFoo() {",
" return foo;",
" }",
" public void setHasFoo(boolean foo) {",
" this.foo = foo;",
" }",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" bool _foo = false;",
" bool get hasFoo => _foo;",
" void set hasFoo(bool foo) {",
" this._foo = foo;",
" }",
"}");
}
public void test_field_BAD_noSetter_butCannotBeFinal() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int foo;",
" public int getFoo() {",
" return foo;",
" }",
" public Test(int foo) {",
" this.foo = foo;",
" }",
" public Test(boolean bar) {",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
" int _foo = 0;",
" int get foo => _foo;",
" Test.con1(int foo) {",
" this._foo = foo;",
" }",
" Test.con2(bool bar);",
"}");
}
public void test_field_BAD_notSameGetterSetterFields() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int fooA;",
" private int fooB;",
" public int getFoo() {",
" return fooA;",
" }",
" public void setFoo(int foo) {",
" this.fooB = foo;",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
" int _fooA = 0;",
" int _fooB = 0;",
" int get foo => _fooA;",
" void set foo(int foo) {",
" this._fooB = foo;",
" }",
"}");
}
public void test_field_BAD_onlySetter() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int foo;",
" public void setFoo(int foo) {",
" this.foo = foo;",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
" int _foo = 0;",
" void set foo(int foo) {",
" this._foo = foo;",
" }",
"}");
}
public void test_field_BAD_overriden_getterSetter() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" public class Super {",
" private int foo;",
" public int getFoo() {",
" return foo;",
" }",
" public void setFoo(int foo) {",
" this.foo = foo;",
" }",
" }",
" public class Sub extends Super {",
" private int foo;",
" public int getFoo() {",
" return foo;",
" }",
" public void setFoo(int foo) {",
" this.foo = foo;",
" }",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
"}",
"class Test_Super {",
" int _foo = 0;",
" int get foo => _foo;",
" void set foo(int foo) {",
" this._foo = foo;",
" }",
"}",
"class Test_Sub extends Test_Super {",
" int foo = 0;",
"}");
}
public void test_field_BAD_overriden_setter() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" public class Super {",
" private int foo;",
" public int getFoo() {",
" return foo;",
" }",
" public void setFoo(int foo) {",
" this.foo = foo;",
" }",
" }",
" public class Sub extends Super {",
" private int foo;",
" public void setFoo(int foo) {",
" this.foo = foo;",
" }",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
"}",
"class Test_Super {",
" int _foo = 0;",
" int get foo => _foo;",
" void set foo(int foo) {",
" this._foo = foo;",
" }",
"}",
"class Test_Sub extends Test_Super {",
" int _foo = 0;",
" void set foo(int foo) {",
" this._foo = foo;",
" }",
"}");
}
public void test_field_OK_getter() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int foo;",
" public int getFoo() {",
" return foo;",
" }",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" final int foo = 0;",
"}");
}
// XXX
public void test_field_OK_getter_hasInitializer() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int foo = 123;",
" public int getFoo() {",
" return foo;",
" }",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" final int foo = 123;",
"}");
}
public void test_field_OK_getter_protected() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" protected final int foo = 42;",
" public Test(int foo) {",
" this.foo = foo;",
" }",
" public int getFoo() {",
" return foo;",
" }",
"}");
runProcessor();
context.ensureUniqueClassMemberNames();
assertFormattedSource(//
"class Test {",
" final int foo;",
" Test(this.foo);",
"}");
}
public void test_field_OK_getter_withConstructor() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int foo;",
" public Test(int foo) {",
" this.foo = foo;",
" }",
" public int getFoo() {",
" return foo;",
" }",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" final int foo;",
" Test(this.foo);",
"}");
}
public void test_field_OK_getterSetter() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int foo;",
" public int getFoo() {",
" return foo;",
" }",
" public void setFoo(int foo) {",
" this.foo = foo;",
" }",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" int foo = 0;",
"}");
}
public void test_field_OK_getterSetter_withConstructor() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int foo;",
" public int getFoo() {",
" return foo;",
" }",
" public void setFoo(int foo) {",
" this.foo = foo;",
" }",
" public Test(int foo) {",
" this.foo = foo;",
" }",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" int foo = 0;",
" Test(this.foo);",
"}");
}
public void test_field_OK_has_set() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private boolean hasFoo;",
" public boolean hasFoo() {",
" return hasFoo;",
" }",
" public void setHasFoo(boolean hasFoo) {",
" this.hasFoo = hasFoo;",
" }",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" bool hasFoo = false;",
"}");
}
public void test_field_OK_is_setIs() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private boolean isFoo;",
" public boolean isFoo() {",
" return isFoo;",
" }",
" public void setIsFoo(boolean isFoo) {",
" this.isFoo = isFoo;",
" }",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" bool isFoo = false;",
"}");
}
public void test_methodGetWithoutName() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" public boolean get() {",
" return true;",
" }",
" public void main() {",
" print(get());",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
" bool get() => true;",
" void main() {",
" print(get());",
" }",
"}");
}
public void test_methodSetWithoutName() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" public void set(int v) {",
" }",
" public void main() {",
" set(0);",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
" void set(int v) {",
" }",
" void main() {",
" set(0);",
" }",
"}");
}
public void test_renamePrivateFields() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int a;",
" private int b, c;",
" public int d;",
"}");
runProcessor();
assertFormattedSource(//
"class Test {",
" int _a = 0;",
" int _b = 0, _c = 0;",
" int d = 0;",
"}");
}
public void test_setterWithReturnType() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int foo;",
" public int getFoo() {",
" return foo - 1;",
" }",
" public int setFoo(int foo) {",
" this.foo = foo + 1;",
" return 42;",
" }",
" public void main() {",
" setFoo(1);",
" print(getFoo());",
" }",
"}");
runProcessor();
assertFormattedSource(
"class Test {",
" int _foo = 0;",
" int get foo => _foo - 1;",
" int setFoo(int foo) {",
" this._foo = foo + 1;",
" return 42;",
" }",
" void main() {",
" setFoo(1);",
" print(foo);",
" }",
"}");
}
public void test_shareGetSetNames() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private int onlyBasicGettersSetters;",
" private int foo;",
" public int getFoo() {",
" return foo - 1;",
" }",
" public void setFoo(int foo) {",
" this.foo = foo + 1;",
" }",
" public void main() {",
" setFoo(1);",
" print(getFoo());",
" this.setFoo(2);",
" print(this.getFoo());",
" }",
"}");
runProcessor();
context.ensureUniqueClassMemberNames();
assertFormattedSource(
"class Test {",
" int _foo = 0;",
" int get foo => _foo - 1;",
" void set foo(int foo) {",
" this._foo = foo + 1;",
" }",
" void main() {",
" foo = 1;",
" print(foo);",
" this.foo = 2;",
" print(this.foo);",
" }",
"}");
}
public void test_veto() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
"package test;",
"public class Test {",
" private boolean foo;",
" public boolean isFoo() {",
" return foo;",
" }",
" public void setFoo(boolean v) {",
" this.foo = v;",
" }",
" public void main() {",
" setFoo(true);",
" print(isFoo());",
" this.setFoo(false);",
" print(this.isFoo());",
" }",
"}");
context.addNotProperty("Ltest/Test;.isFoo()");
context.addNotProperty("Ltest/Test;.setFoo(Z)");
runProcessor();
assertFormattedSource(
"class Test {",
" bool _foo = false;",
" bool isFoo() => _foo;",
" void setFoo(bool v) {",
" this._foo = v;",
" }",
" void main() {",
" setFoo(true);",
" print(isFoo());",
" this.setFoo(false);",
" print(this.isFoo());",
" }",
"}");
}
private void runProcessor() {
new PropertySemanticProcessor(context).process(unit);
}
}
| [
"scheglov@google.com@260f80e4-7a28-3924-810f-c04153c831b5"
] | scheglov@google.com@260f80e4-7a28-3924-810f-c04153c831b5 |
b42fef8a096c9e3dc1a1a9a55e3331549611f611 | 532960b369d1364e7ed58e6a3650f3f43c6d7dac | /src/main/java/com/openkm/form/suggestion/DocumentContentContainsSuggestion.java | 930d48867dfd68bcbd6761c3e0ed143721d69894 | [] | no_license | okelah/openkm-code | f0c02062d909b2d5e185b9784b33a9b8753be948 | d9e0687e0c6dab385cac0ce8b975cb92c8867743 | refs/heads/master | 2021-01-13T15:53:59.286016 | 2016-08-18T22:06:25 | 2016-08-18T22:06:25 | 76,772,981 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,240 | java | /**
* OpenKM, Open Document Management System (http://www.openkm.com)
* Copyright (c) 2006-2015 Paco Avila & Josep Llort
*
* No bytes were intentionally harmed during the development of this application.
*
* 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 2 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.openkm.form.suggestion;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.openkm.bean.form.Option;
import com.openkm.bean.form.Select;
import com.openkm.core.DatabaseException;
import com.openkm.core.PathNotFoundException;
import com.openkm.dao.NodeDocumentDAO;
import com.openkm.dao.NodeDocumentVersionDAO;
import com.openkm.dao.bean.NodeDocumentVersion;
import com.openkm.extractor.TextExtractorWork;
public class DocumentContentContainsSuggestion implements Suggestion {
private static Logger log = LoggerFactory.getLogger(DocumentContentContainsSuggestion.class);
@Override
public List<String> getSuggestions(String nodeUuid, String nodePath, Select sel) throws PathNotFoundException, SuggestionException,
DatabaseException {
log.debug("getSuggestions({}, {}, {})", new Object[] { nodeUuid, nodePath, sel });
List<String> list = new ArrayList<String>();
String textExtracted = null;
try {
if (NodeDocumentDAO.getInstance().isValid(nodeUuid)) {
// Get text extraction
if (NodeDocumentDAO.getInstance().isTextExtracted(nodeUuid)) {
textExtracted = NodeDocumentDAO.getInstance().getExtractedText(nodeUuid);
} else {
// Force text extraction
NodeDocumentVersion nDocVer = NodeDocumentVersionDAO.getInstance().findCurrentVersion(nodeUuid);
TextExtractorWork tew = new TextExtractorWork();
tew.setDocUuid(nodeUuid);
tew.setDocPath(nodePath);
tew.setDocVerUuid(nDocVer.getUuid());
// Execute extractor
textExtracted = NodeDocumentDAO.getInstance().textExtractorHelper(tew);
}
log.debug("Content length: {}", textExtracted.length());
// Looking for metadata description values
if (textExtracted != null && !textExtracted.isEmpty()) {
textExtracted = textExtracted.toLowerCase();
for (Option opt : sel.getOptions()) {
if (textExtracted.contains(opt.getLabel().toLowerCase())) {
if (!list.contains(opt.getValue())) {
list.add(opt.getValue());
break;
}
}
}
}
}
} catch (FileNotFoundException e) {
throw new SuggestionException("FileNotFoundException: " + e.getMessage(), e);
}
return list;
}
}
| [
"github@sven-joerns.de"
] | github@sven-joerns.de |
ffaa74a2ec48a7a2b5031329a65cdab2a80c9169 | 34b9ebe8f303409f59fa5343716e9a7b7b48e994 | /src/io/kurumi/ntt/fragment/twitter/list/ListExport.java | 1133b50cd90eec01c8f65a9338a55c52a427eba7 | [
"Apache-2.0"
] | permissive | Undefined-User/NTTX | fe5a8a28080a84ae257905aa471d23b221b7830f | 14a5703c652ad2da53f7510507544888e0bea318 | refs/heads/master | 2020-08-06T19:21:55.324728 | 2019-10-02T09:11:06 | 2019-10-02T09:11:06 | 213,121,769 | 0 | 1 | Apache-2.0 | 2019-10-06T06:51:16 | 2019-10-06T06:51:16 | null | UTF-8 | Java | false | false | 8,714 | java | package io.kurumi.ntt.fragment.twitter.list;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.pengrad.telegrambot.model.request.ReplyKeyboardRemove;
import com.pengrad.telegrambot.request.SendDocument;
import io.kurumi.ntt.db.PointData;
import io.kurumi.ntt.db.UserData;
import io.kurumi.ntt.fragment.BotFragment;
import io.kurumi.ntt.fragment.Fragment;
import io.kurumi.ntt.fragment.twitter.TApi;
import io.kurumi.ntt.fragment.twitter.TAuth;
import io.kurumi.ntt.model.Msg;
import io.kurumi.ntt.model.request.Keyboard;
import io.kurumi.ntt.utils.NTT;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.User;
import twitter4j.UserList;
import java.util.LinkedList;
public class ListExport extends Fragment {
final String FOLLOWING = "关注中列表";
final String FOLLOWER = "关注者列表";
final String BLOCK = "屏蔽列表";
final String MUTE = "静音列表";
final String MUTE_RT = "静音转推的列表";
final String USER = "用户创建的列表";
final String POINT_LIST_EXPORT = "list_export";
final String POINT_USER_LIST_EXPORT = "user_list_export";
@Override
public void init(BotFragment origin) {
super.init(origin);
registerFunction("export");
registerCallback(POINT_LIST_EXPORT);
registerPoint(POINT_LIST_EXPORT);
}
@Override
public void onFunction(UserData user, Msg msg, String function, String[] params) {
requestTwitter(user, msg);
}
@Override
public void onTwitterFunction(UserData user, Msg msg, String function, String[] params, TAuth account) {
PointData data = setPrivatePointData(user, msg, POINT_LIST_EXPORT, account);
msg
.send("请选择将要导出的列表 :\n将会以 .csv 官方格式导出")
.keyboard(new Keyboard() {{
newButtonLine().newButton(FOLLOWING).newButton(FOLLOWER);
newButtonLine().newButton(BLOCK).newButton(MUTE);
newButtonLine(MUTE_RT);
newButtonLine(USER);
}})
.withCancel()
.exec(data);
}
@Override
public void onPoint(UserData user, Msg msg, String point, PointData data) {
data.with(msg);
TAuth account = data.data();
Twitter api = account.createApi();
if (POINT_LIST_EXPORT.equals(point)) {
if (FOLLOWING.equals(msg.text())) {
clearPrivatePoint(user);
try {
LinkedList<Long> ids = TApi.getAllFrIDs(api, account.id);
if (ids.size() == 0) {
msg.send("列表为空 :)").exec();
return;
}
msg.sendUpdatingFile();
bot().execute(new SendDocument(msg.chatId(), StrUtil.utf8Bytes(ArrayUtil.join(ids.toArray(), "\n"))).replyMarkup(new ReplyKeyboardRemove()).fileName("FollowingList.csv"));
} catch (TwitterException e) {
msg.send("导出失败\n\n{}", NTT.parseTwitterException(e)).exec();
}
} else if (FOLLOWER.equals(msg.text())) {
clearPrivatePoint(user);
try {
LinkedList<Long> ids = TApi.getAllFoIDs(api, account.id);
if (ids.size() == 0) {
msg.send("列表为空 :)").exec();
return;
}
msg.sendUpdatingFile();
bot().execute(new SendDocument(msg.chatId(), StrUtil.utf8Bytes(ArrayUtil.join(ids.toArray(), "\n"))).replyMarkup(new ReplyKeyboardRemove()).fileName("FollowersList.csv"));
} catch (TwitterException e) {
msg.send("导出失败\n\n{}", NTT.parseTwitterException(e)).exec();
}
} else if (BLOCK.equals(msg.text())) {
clearPrivatePoint(user);
try {
LinkedList<Long> ids = TApi.getAllBlockIDs(api);
if (ids.size() == 0) {
msg.send("列表为空 :)").exec();
return;
}
msg.sendUpdatingFile();
bot().execute(new SendDocument(msg.chatId(), StrUtil.utf8Bytes(ArrayUtil.join(ids.toArray(), "\n"))).replyMarkup(new ReplyKeyboardRemove()).fileName("BlockList.csv"));
} catch (TwitterException e) {
msg.send("导出失败\n\n{}", NTT.parseTwitterException(e)).exec();
}
} else if (MUTE.equals(msg.text())) {
clearPrivatePoint(user);
try {
LinkedList<Long> ids = TApi.getAllMuteIDs(api);
if (ids.size() == 0) {
msg.send("列表为空 :)").exec();
return;
}
msg.sendUpdatingFile();
bot().execute(new SendDocument(msg.chatId(), StrUtil.utf8Bytes(ArrayUtil.join(ids.toArray(), "\n"))).replyMarkup(new ReplyKeyboardRemove()).fileName("MuteList.csv"));
} catch (TwitterException e) {
msg.send("导出失败\n\n{}", NTT.parseTwitterException(e)).exec();
}
} else if (MUTE_RT.equals(msg.text())) {
clearPrivatePoint(user);
try {
LinkedList<Long> ids = TApi.getAllNoRTIDs(api);
if (ids.size() == 0) {
msg.send("列表为空 :)").exec();
return;
}
msg.sendUpdatingFile();
bot().execute(new SendDocument(msg.chatId(), StrUtil.utf8Bytes(ArrayUtil.join(ids.toArray(), "\n"))).replyMarkup(new ReplyKeyboardRemove()).fileName("NoRTList.csv"));
} catch (TwitterException e) {
msg.send("导出失败\n\n{}", NTT.parseTwitterException(e)).exec();
}
} else if (USER.equals(msg.text())) {
data.command = null;
clearPrivatePoint(user);
setPrivatePointData(user, data.command, POINT_USER_LIST_EXPORT, data);
msg.send("现在请发送列表的链接 可以在列表 -> 分享 中导出。它看起来像这样 : twitter.com/用户名/lists/列表名").withCancel().exec();
} else {
msg.send("要导出什么?").withCancel().exec(data);
}
} else if (POINT_USER_LIST_EXPORT.equals(point)) {
if (!(msg.text().contains("twitter.com/") && msg.text().contains("/lists/"))) {
msg.send("要导出哪个 用户创建的列表?请发送该列表的链接 : 它看起来像 twitter.com/用户名/lists/列表名 ,可以在列表 -> 分享 导出。").exec(data);
return;
}
clearPrivatePoint(user);
String screenName = StrUtil.subBefore(StrUtil.subAfter(msg.text(), "lists/", true), "/", false);
String slug = StrUtil.subAfter(msg.text(), screenName, true);
if (slug.contains("?")) {
slug = StrUtil.subBefore(slug, "?", false);
}
if (slug.contains(" ")) {
slug = StrUtil.subBefore(slug, " ", false);
}
UserList list;
try {
list = api.showUserList(screenName, slug);
} catch (TwitterException e) {
msg.send("查找列表失败\n\n{}", NTT.parseTwitterException(e)).exec();
return;
}
long[] ids;
try {
LinkedList<User> userList = TApi.getListUsers(api, list.getId());
ids = new long[userList.size()];
if (ids.length == 0) {
msg.send("列表为空 :)").exec();
return;
}
for (int index = 0; index < ids.length; index++) {
ids[index] = userList.get(index).getId();
}
} catch (TwitterException e) {
msg.send("导出列表失败\n\n{}", NTT.parseTwitterException(e)).exec();
return;
}
msg.sendUpdatingFile();
bot().execute(new SendDocument(msg.chatId(), StrUtil.utf8Bytes(ArrayUtil.join(ids, "\n"))).replyMarkup(new ReplyKeyboardRemove()).fileName(list.getSlug() + ".csv"));
}
}
}
| [
"HiedaNaKan@kurumi.io"
] | HiedaNaKan@kurumi.io |
64ebd9b28bf1efa65b778f74c24b59c4d453dde1 | 361649e5f457cb27498a1c54b1574ed250be2939 | /src/main/java/com/ruoyi/project/system/controller/ProjectInventController.java | e56947bf4f6d2e6560ebc4749414f1f039c4eaa1 | [] | no_license | wgp1996/project | e9dbbd34cc063117e2000c58df444d73984ccd71 | b2ecd685e83b2debc67eb9e375b7dd8e0bf8fcf7 | refs/heads/master | 2023-04-08T06:25:52.125344 | 2021-04-23T06:34:20 | 2021-04-23T06:34:20 | 331,804,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,169 | java | package com.ruoyi.project.system.controller;
import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import com.ruoyi.project.system.domain.ProjectInventory;
import com.ruoyi.project.system.domain.SystemFile;
import com.ruoyi.project.system.service.IProjectInventoryService;
import com.ruoyi.project.system.service.ISystemFileService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.ProjectInvent;
import com.ruoyi.project.system.service.IProjectInventService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
/**
* 预算编制Controller
*
* @author ruoyi
* @date 2021-03-24
*/
@RestController
@RequestMapping("/system/projectInvent")
public class ProjectInventController extends BaseController
{
@Autowired
private IProjectInventService projectInventService;
@Autowired
private ISystemFileService systemFileService;
@Autowired
private IProjectInventoryService projectInventoryService;
/**
* 查询预算编制列表
*/
@PreAuthorize("@ss.hasPermi('system:projectInvent:list')")
@GetMapping("/list")
@DataScope(deptAlias = "d", userAlias = "u")
public TableDataInfo list(ProjectInvent projectInvent)
{
startPage();
List<ProjectInvent> list = projectInventService.selectProjectInventList(projectInvent);
return getDataTable(list);
}
/**
* 导出预算编制列表
*/
@PreAuthorize("@ss.hasPermi('system:projectInvent:export')")
@Log(title = "预算编制", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ProjectInvent projectInvent)
{
List<ProjectInvent> list = projectInventService.selectProjectInventList(projectInvent);
ExcelUtil<ProjectInvent> util = new ExcelUtil<ProjectInvent>(ProjectInvent.class);
return util.exportExcel(list, "projectInvent");
}
/**
* 获取预算编制详细信息
*/
@PreAuthorize("@ss.hasPermi('system:projectInvent:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id)
{
return AjaxResult.success(projectInventService.selectProjectInventById(id));
}
/**
* 新增/编辑预算编制
*/
@PreAuthorize("@ss.hasPermi('system:projectInvent:add')")
@Log(title = "预算编制", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProjectInvent projectInvent)
{
if(projectInvent.getProjectCode()==null){
return toAjaxByError("项目不能为空!");
}
if(projectInvent.getId()!=null){
if(projectInvent.getStatus()>0){
return toAjaxByError("该状态禁止修改!");
}
//插入附件
if(projectInvent.getFileRows()!=null&&projectInvent.getFileRows()!="") {
List<SystemFile> childList = JSONArray.parseArray(projectInvent.getFileRows(), SystemFile.class);
for (SystemFile child : childList) {
if (child.getId() != null) {
}else{
child.setCode(projectInvent.getDjNumber());
child.setCreateBy(SecurityUtils.getUsername());
systemFileService.insertSystemFile(child);
}
}
}
projectInvent.setUpdateBy(SecurityUtils.getUsername());
projectInventService.updateProjectInvent(projectInvent);
return AjaxResult.success(projectInvent);
}else{
projectInvent.setDjNumber(StringUtils.getRandomCode("PI"));
if(projectInvent.getFileRows()!=null&&projectInvent.getFileRows()!="") {
List<SystemFile> childList = JSONArray.parseArray(projectInvent.getFileRows(), SystemFile.class);
for (SystemFile child : childList) {
child.setCode(projectInvent.getDjNumber());
child.setCreateBy(SecurityUtils.getUsername());
systemFileService.insertSystemFile(child);
}
}
projectInvent.setStatus(0);
projectInvent.setCreateBy(SecurityUtils.getUsername());
projectInventService.insertProjectInvent(projectInvent);
return AjaxResult.success(projectInvent);
}
}
/**
* 修改预算编制
*/
@PreAuthorize("@ss.hasPermi('system:projectInvent:edit')")
@Log(title = "预算编制", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProjectInvent projectInvent)
{
return toAjax(projectInventService.updateProjectInvent(projectInvent));
}
/**
* 删除预算编制
*/
@PreAuthorize("@ss.hasPermi('system:projectInvent:remove')")
@Log(title = "预算编制", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids)
{
projectInventoryService.deleteProjectInventoryByPId(ids[0]);
return toAjax(projectInventService.deleteProjectInventByIds(ids));
}
}
| [
"wgp1996"
] | wgp1996 |
55f1fba17eace75f64032faa1fa9a41f3126daa5 | 67fc9ace15ff4b53625bb34f8c609a057d4a9740 | /src/main/java/com/company/javaAdvenced/notifer/Message.java | def7234333ea7282eea7c2ee2896f3232af3d528 | [] | no_license | lols0n/javaAdvanced_Patterns_SOLID | 9b887bd9fe97dfa4adcba447a13ce7f9117a06c4 | 5a5ecddbc3c392409192b7f538691b295490483b | refs/heads/master | 2022-11-28T12:04:15.777089 | 2020-08-02T08:56:45 | 2020-08-02T08:56:45 | 284,266,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | package com.company.javaAdvenced.notifer;
import static com.company.javaAdvenced.threads.ThreadsColor.ANSI_BLUE;
import static com.company.javaAdvenced.threads.ThreadsColor.ANSI_GREEN;
public class Message {
private String content;
private boolean empty;
public synchronized String read() {
while (empty) {
try {
wait();
} catch (InterruptedException e) {
System.out.println(ANSI_GREEN + "blad odczytu");
}
}
System.out.println(ANSI_GREEN + "wiadomosc odczytana wiec moge przekazac kolejna");
System.out.println(content);
empty = true;
notifyAll();
return content;
}
public synchronized void write(String newContent) {
while (!empty) {
try {
wait();
} catch (InterruptedException e) {
System.out.println(ANSI_BLUE + "bland zapisu");
}
}
System.out.println(ANSI_BLUE + "wiadomosc zapisana wiec moge zapisac nowa");
System.out.println(ANSI_BLUE + newContent);
empty = false;
this.content = newContent;
notifyAll(); //powiadom wszystkie inne watki ze skanczylem robote
//notify(); //powiadom 1 losowy watek
}
}
| [
"15343@wp.pl"
] | 15343@wp.pl |
e2a56339160e614b39a55d011a5a333da05d2c49 | 9070c973c589c5b05b6e9716d0f5f5c1abaad539 | /languages/Kajak/source_gen/jetbrains/mps/samples/Kaja/dataFlow/While_DataFlow.java | ec00c057700e3e4a224119985d6d9d115be8ee60 | [] | no_license | Harmannz/traffic-simulation | 558ba32327c2650d74cfefb765d5a6a9a68a5aba | a08ee18976b4c04b21f922342c6504a9a012065b | refs/heads/master | 2021-09-10T17:34:11.457706 | 2018-03-30T05:21:07 | 2018-03-30T05:21:07 | 103,199,400 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,300 | java | package jetbrains.mps.samples.Kaja.dataFlow;
/*Generated by MPS */
import jetbrains.mps.lang.dataFlow.DataFlowBuilder;
import jetbrains.mps.lang.dataFlow.DataFlowBuilderContext;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
public class While_DataFlow extends DataFlowBuilder {
public void build(final DataFlowBuilderContext _context) {
_context.getBuilder().build((SNode) SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0x49a08c51fe543ccL, 0xbd998b46d641d7f5L, 0x2de971c785ecece0L, 0x2de971c785ecece2L, "condition")));
_context.getBuilder().emitIfJump(_context.getBuilder().after(_context.getNode()), "r:5784598d-868b-437e-9c58-15fb07e7f373(jetbrains.mps.samples.Kaja.dataFlow)/6630310702469889342");
_context.getBuilder().build((SNode) SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getContainmentLink(0x49a08c51fe543ccL, 0xbd998b46d641d7f5L, 0x2de971c785ecece0L, 0x2de971c785ecece3L, "body")));
_context.getBuilder().emitJump(_context.getBuilder().before(_context.getNode()), "r:5784598d-868b-437e-9c58-15fb07e7f373(jetbrains.mps.samples.Kaja.dataFlow)/5696508641316673816");
}
}
| [
"harman.singh@hotmail.co.nz"
] | harman.singh@hotmail.co.nz |
ebb97067c4559d8f77be21d04106805dd61544d2 | c9eea931a2e18446152c8869ca1e37f60246d3de | /src/com/qqmaster/com/algorithms/MaxIntegerFactorial.java | 8a7e5856bf5f84183922e322bdfef9a02723c057 | [] | no_license | MasterQuan/interview | 6abdf1f86080bae9e7452e376981d66cc323189e | f0a2df58ed25bc5d3ef81db231d8bcaf0f8de353 | refs/heads/master | 2021-09-07T16:23:19.311385 | 2018-02-26T03:34:31 | 2018-02-26T03:34:31 | 113,296,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 945 | java | package com.qqmaster.com.algorithms;
public class MaxIntegerFactorial {
public static void main(String[] args) {
System.out.println(maxIntegerFactorial(1));
System.out.println(maxIntegerFactorial(3));
System.out.println(maxIntegerFactorial(5));
System.out.println(maxIntegerFactorial(10));
System.out.println(maxIntegerFactorial(5000));
}
public static String maxIntegerFactorial(int num){
StringBuilder sb = new StringBuilder("1");
//异常处理,默认返回结果为1
if(num <=1){
return sb.toString();
}
//用字符串表示结果
for(int i = 2, carry = 0; i <= num; i++){
StringBuilder sbm = new StringBuilder();
for(int j = 0; j < sb.length(); j++){
int res = (sb.charAt(j)-'0') * i + carry;
carry = res / 10;
sbm.append(res % 10);
}
while(carry != 0){
sbm.append(carry % 10);
carry = carry / 10;
}
sb = sbm;
}
sb.reverse();
return sb.toString();
}
}
| [
"zhaoshiquan@nonobank.com"
] | zhaoshiquan@nonobank.com |
3db8fe40ada52995bef0809e72ca2c87ce0ce12d | bb1302175a9c2b204a4a6ec1ecb67096b286966d | /app/src/main/java/com/example/prakash/digihome/Aboutus3.java | 7d8ad0128c6f2d0ceca9a2f5b7f1c2e9092c0f7f | [] | no_license | DEEPAK2811/Digi_remote | 8487ed6a0765935d28bae957b95e86393d89682f | 087ed64394c743a451ea4ca73a03b41e362d0891 | refs/heads/master | 2020-03-29T02:13:54.966930 | 2018-09-19T09:31:52 | 2018-09-19T09:31:52 | 149,426,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package com.example.prakash.digihome;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by PRAKASH on 06-Aug-17.
*/
public class Aboutus3 extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.aboutus3, container, false);
return rootView;
}
}
| [
"deepakprakash2811@gmail.com"
] | deepakprakash2811@gmail.com |
39fe5fbad0094d319a465429fb2d1bbfc9a12e62 | 7593d5a2ced162547843eac5e947d1cc8424be22 | /app/src/test/java/sg/edu/np/s10171369/assignment/ExampleUnitTest.java | cc6153d14d8e1c2be9ad9921d3c11297e3d28e3e | [] | no_license | s10171369/Assignment | 31dda183d0211671c3c5a12462f0674384c054c7 | 10adff1b2dd4e682c7c1ab590d8144e1d7a0bd61 | refs/heads/master | 2020-03-22T17:09:44.777613 | 2018-07-26T16:07:59 | 2018-07-26T16:07:59 | 140,377,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package sg.edu.np.s10171369.assignment;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"s10171369@connect.np.edu.sg"
] | s10171369@connect.np.edu.sg |
845b17da38482019535d35bf19a5a451f5f43e0c | bb027bf36f4a2f2cbfc2dcf2ba83e9e7d612d768 | /Grid.java | 28478760e5b9ecfe1b9ac379183a4a218a6d3a7a | [] | no_license | marissazhou/caprice | fc37786bc5e2879320d59d0a6cce43f23a1ab1d8 | 0a82e120ae6f63ae2b92186099c678e9a7b46fb4 | refs/heads/master | 2016-09-05T22:41:06.531158 | 2014-11-19T15:01:36 | 2014-11-19T15:01:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,072 | java | /* Created by : Lijuan Marissa Zhou
Email : marissa.lala.joo@gmail.com
Time : 1/10/2014
*/
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Stack;
import java.util.ArrayList;
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.EmptyStackException;
public class Grid{
public static void main(String[] args) {
try {
if (args.length>0){
/*
byte[] d = new byte[]{(byte)10101001, (byte)01001100};
byte[] p = new byte[]{(byte)10100000};
ArrayList<Integer> r = bitPatternMatch(d, 14, p, 3);
for (int i=0; i<r.size(); i++) {
System.out.print(r.get(i));
System.out.print(" ");
}
*/
int i = getNoOfPathsUpRightDP(Integer.valueOf(args[0]),Integer.valueOf(args[0]));
System.out.println(i);
}
} catch (Exception e){
e.printStackTrace();
}
System.exit(0);
}
/** Given a m * n grids, and one is allowed to move up or right, find the number of paths between two grids.
* Combination(m+n, m)
*
* @param m rows
* @param n colums
* @return number of paths
* @see
*
*/
public static int getNoOfPathsUpRight(int m, int n){
if (m == 1 || n == 1) return 1;
int up = getNoOfPathsUpRight(m-1, n);
int right = getNoOfPathsUpRight(m, n-1);
return up + right;
}
// dynamic programming
public static int getNoOfPathsUpRightDP(int m, int n){
int[][] count = new int[m][n];
for (int i=0; i<m; i++) count[i][0] = 1;
for (int i=0; i<n; i++) count[0][i] = 1;
for (int i=1; i<m; i++) {
for (int j=1; j<n; j++) {
count[i][j] = count[i-1][j] + count[i][j-1];
}
}
return count[m-1][n-1];
}
}
| [
"marissa.zhou.cn@gmail.com"
] | marissa.zhou.cn@gmail.com |
66fe449a7d625c2221c0c6b50254bda214f195bf | ba005c6729aed08554c70f284599360a5b3f1174 | /lib/selenium-server-standalone-3.4.0/org/apache/commons/codec/digest/Sha2Crypt.java | aca7531b0dcd7060af35a5519d28e0b497df2d86 | [] | no_license | Viral-patel703/Testyourbond-aut0 | f6727a6da3b1fbf69cc57aeb89e15635f09e249a | 784ab7a3df33d0efbd41f3adadeda22844965a56 | refs/heads/master | 2020-08-09T00:27:26.261661 | 2017-11-07T10:12:05 | 2017-11-07T10:12:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,877 | java | package org.apache.commons.codec.digest;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.codec.Charsets;
public class Sha2Crypt
{
private static final int ROUNDS_DEFAULT = 5000;
private static final int ROUNDS_MAX = 999999999;
private static final int ROUNDS_MIN = 1000;
private static final String ROUNDS_PREFIX = "rounds=";
private static final int SHA256_BLOCKSIZE = 32;
static final String SHA256_PREFIX = "$5$";
private static final int SHA512_BLOCKSIZE = 64;
static final String SHA512_PREFIX = "$6$";
private static final Pattern SALT_PATTERN = Pattern.compile("^\\$([56])\\$(rounds=(\\d+)\\$)?([\\.\\/a-zA-Z0-9]{1,16}).*");
public Sha2Crypt() {}
public static String sha256Crypt(byte[] keyBytes)
{
return sha256Crypt(keyBytes, null);
}
public static String sha256Crypt(byte[] keyBytes, String salt)
{
if (salt == null) {
salt = "$5$" + B64.getRandomSalt(8);
}
return sha2Crypt(keyBytes, salt, "$5$", 32, "SHA-256");
}
private static String sha2Crypt(byte[] keyBytes, String salt, String saltPrefix, int blocksize, String algorithm)
{
int keyLen = keyBytes.length;
int rounds = 5000;
boolean roundsCustom = false;
if (salt == null) {
throw new IllegalArgumentException("Salt must not be null");
}
Matcher m = SALT_PATTERN.matcher(salt);
if ((m == null) || (!m.find())) {
throw new IllegalArgumentException("Invalid salt value: " + salt);
}
if (m.group(3) != null) {
rounds = Integer.parseInt(m.group(3));
rounds = Math.max(1000, Math.min(999999999, rounds));
roundsCustom = true;
}
String saltString = m.group(4);
byte[] saltBytes = saltString.getBytes(Charsets.UTF_8);
int saltLen = saltBytes.length;
MessageDigest ctx = DigestUtils.getDigest(algorithm);
ctx.update(keyBytes);
ctx.update(saltBytes);
MessageDigest altCtx = DigestUtils.getDigest(algorithm);
altCtx.update(keyBytes);
altCtx.update(saltBytes);
altCtx.update(keyBytes);
byte[] altResult = altCtx.digest();
int cnt = keyBytes.length;
while (cnt > blocksize) {
ctx.update(altResult, 0, blocksize);
cnt -= blocksize;
}
ctx.update(altResult, 0, cnt);
cnt = keyBytes.length;
while (cnt > 0) {
if ((cnt & 0x1) != 0) {
ctx.update(altResult, 0, blocksize);
} else {
ctx.update(keyBytes);
}
cnt >>= 1;
}
altResult = ctx.digest();
altCtx = DigestUtils.getDigest(algorithm);
for (int i = 1; i <= keyLen; i++) {
altCtx.update(keyBytes);
}
byte[] tempResult = altCtx.digest();
byte[] pBytes = new byte[keyLen];
int cp = 0;
while (cp < keyLen - blocksize) {
System.arraycopy(tempResult, 0, pBytes, cp, blocksize);
cp += blocksize;
}
System.arraycopy(tempResult, 0, pBytes, cp, keyLen - cp);
altCtx = DigestUtils.getDigest(algorithm);
for (int i = 1; i <= 16 + (altResult[0] & 0xFF); i++) {
altCtx.update(saltBytes);
}
tempResult = altCtx.digest();
byte[] sBytes = new byte[saltLen];
cp = 0;
while (cp < saltLen - blocksize) {
System.arraycopy(tempResult, 0, sBytes, cp, blocksize);
cp += blocksize;
}
System.arraycopy(tempResult, 0, sBytes, cp, saltLen - cp);
for (int i = 0; i <= rounds - 1; i++)
{
ctx = DigestUtils.getDigest(algorithm);
if ((i & 0x1) != 0) {
ctx.update(pBytes, 0, keyLen);
} else {
ctx.update(altResult, 0, blocksize);
}
if (i % 3 != 0) {
ctx.update(sBytes, 0, saltLen);
}
if (i % 7 != 0) {
ctx.update(pBytes, 0, keyLen);
}
if ((i & 0x1) != 0) {
ctx.update(altResult, 0, blocksize);
} else {
ctx.update(pBytes, 0, keyLen);
}
altResult = ctx.digest();
}
StringBuilder buffer = new StringBuilder(saltPrefix);
if (roundsCustom) {
buffer.append("rounds=");
buffer.append(rounds);
buffer.append("$");
}
buffer.append(saltString);
buffer.append("$");
if (blocksize == 32) {
B64.b64from24bit(altResult[0], altResult[10], altResult[20], 4, buffer);
B64.b64from24bit(altResult[21], altResult[1], altResult[11], 4, buffer);
B64.b64from24bit(altResult[12], altResult[22], altResult[2], 4, buffer);
B64.b64from24bit(altResult[3], altResult[13], altResult[23], 4, buffer);
B64.b64from24bit(altResult[24], altResult[4], altResult[14], 4, buffer);
B64.b64from24bit(altResult[15], altResult[25], altResult[5], 4, buffer);
B64.b64from24bit(altResult[6], altResult[16], altResult[26], 4, buffer);
B64.b64from24bit(altResult[27], altResult[7], altResult[17], 4, buffer);
B64.b64from24bit(altResult[18], altResult[28], altResult[8], 4, buffer);
B64.b64from24bit(altResult[9], altResult[19], altResult[29], 4, buffer);
B64.b64from24bit((byte)0, altResult[31], altResult[30], 3, buffer);
} else {
B64.b64from24bit(altResult[0], altResult[21], altResult[42], 4, buffer);
B64.b64from24bit(altResult[22], altResult[43], altResult[1], 4, buffer);
B64.b64from24bit(altResult[44], altResult[2], altResult[23], 4, buffer);
B64.b64from24bit(altResult[3], altResult[24], altResult[45], 4, buffer);
B64.b64from24bit(altResult[25], altResult[46], altResult[4], 4, buffer);
B64.b64from24bit(altResult[47], altResult[5], altResult[26], 4, buffer);
B64.b64from24bit(altResult[6], altResult[27], altResult[48], 4, buffer);
B64.b64from24bit(altResult[28], altResult[49], altResult[7], 4, buffer);
B64.b64from24bit(altResult[50], altResult[8], altResult[29], 4, buffer);
B64.b64from24bit(altResult[9], altResult[30], altResult[51], 4, buffer);
B64.b64from24bit(altResult[31], altResult[52], altResult[10], 4, buffer);
B64.b64from24bit(altResult[53], altResult[11], altResult[32], 4, buffer);
B64.b64from24bit(altResult[12], altResult[33], altResult[54], 4, buffer);
B64.b64from24bit(altResult[34], altResult[55], altResult[13], 4, buffer);
B64.b64from24bit(altResult[56], altResult[14], altResult[35], 4, buffer);
B64.b64from24bit(altResult[15], altResult[36], altResult[57], 4, buffer);
B64.b64from24bit(altResult[37], altResult[58], altResult[16], 4, buffer);
B64.b64from24bit(altResult[59], altResult[17], altResult[38], 4, buffer);
B64.b64from24bit(altResult[18], altResult[39], altResult[60], 4, buffer);
B64.b64from24bit(altResult[40], altResult[61], altResult[19], 4, buffer);
B64.b64from24bit(altResult[62], altResult[20], altResult[41], 4, buffer);
B64.b64from24bit((byte)0, (byte)0, altResult[63], 2, buffer);
}
Arrays.fill(tempResult, (byte)0);
Arrays.fill(pBytes, (byte)0);
Arrays.fill(sBytes, (byte)0);
ctx.reset();
altCtx.reset();
Arrays.fill(keyBytes, (byte)0);
Arrays.fill(saltBytes, (byte)0);
return buffer.toString();
}
public static String sha512Crypt(byte[] keyBytes)
{
return sha512Crypt(keyBytes, null);
}
public static String sha512Crypt(byte[] keyBytes, String salt)
{
if (salt == null) {
salt = "$6$" + B64.getRandomSalt(8);
}
return sha2Crypt(keyBytes, salt, "$6$", 64, "SHA-512");
}
}
| [
"VIRUS-inside@users.noreply.github.com"
] | VIRUS-inside@users.noreply.github.com |
fe1de06935efb14cb1b9b183bfeb4e10cf30d5d4 | 149d6f9be9ec0233f3b19a6d3883e6610d0dec38 | /ConnectLocalhost.java | f61d433a7cd177acff4479f041a1b4930c9ae83a | [] | no_license | yihuihe/mongoDB | 2b34849242f0dfe700be14d36236231bc15a30c5 | 385fc1812de4bad26409507bf01ed8f621c86f79 | refs/heads/master | 2021-01-13T03:15:40.958085 | 2017-01-06T12:01:06 | 2017-01-06T12:01:06 | 77,602,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,453 | java | import com.mongodb.Block;
import com.mongodb.MongoClient;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
import org.bson.Document;
import org.bson.types.ObjectId;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
/**
* Created by MCYarn on 2016/12/28.
*/
public class ConnectLocalhost {
public static void addDataToDB (String filename) {
try {
long s = System.currentTimeMillis();
//bw.write("开始查询的时间:" + s);
// 连接到 mongodb 服务
MongoClient mongoClient = new MongoClient( "localhost" , 27017 );
//使用数据库hyh2,集合property、relation和side
MongoCollection<Document> property = mongoClient.getDatabase("hyh").getCollection("property");
MongoCollection<Document> relation = mongoClient.getDatabase("hyh").getCollection("relation");
MongoCollection<Document> side = mongoClient.getDatabase("hyh").getCollection("side");
List<Document> property_list = new ArrayList<Document>();
List<Document> relation_list = new ArrayList<Document>();
List<Document> side_list = new ArrayList<Document>();
Map<String,Set<Document>> relation_map = new HashMap<String, Set<Document>>();
File file = new File(filename);
BufferedReader reader = null;
try {
String tempString = null;
reader = new BufferedReader(new FileReader(file));
int line = 1;
while ((tempString = reader.readLine()) != null) {
// System.out.println(line);
line ++;
String[] splitData = new String[]{};
splitData = tempString.split("\\s+");
//将数据进行一一对应
String srcType = splitData[1];
String srcValue = splitData[2];
String dstType = splitData[3];
String dstValue = splitData[4];
String srcId = splitData[6];
String dstId = splitData[7];
String relationType = splitData[8];
String relationValue = splitData[9];
String relationStartTime = splitData[10];
String relationEndTime = splitData[11];
if (srcType.equals("null")) {
System.out.println("srcType is null");
continue;
}
//添加relation关系表
Set<Document> friends = new HashSet<Document>();
String key = new ObjectId(new Date()).toString();
Document friendship = new Document("dst_id",dstId).append("key",key);
boolean addOperation = friends.add(friendship);
if(!(relation_map.containsKey(srcId))){
relation_map.put(srcId,friends);
}
else{
Set<Document> set = relation_map.get(srcId);
set.add(new Document("dst_id",dstId).append("key",key));
}
// System.out.println("step ++++++++++++");
//添加key关系表
Set<Document> keyItem = new HashSet<Document>();
Document keyValue = new Document("relationType",relationType).append("relationValue",relationValue)
.append("relationStartTime",relationStartTime).append("relationEndTime",relationEndTime);
keyItem.add(keyValue);
property_list.add(new Document("id", srcId).append("val", srcValue).append("ft", srcType));
//relation.add(new Document("src_id", srcId).append("src_type", srcType).append("dst_id", dstId).append("dst_type", dstType));
side_list.add(new Document("key",key).append("keyItem",keyItem));
if(line %1000 ==0){
/*
for (Map.Entry<String,Set<Document>> entry : relation_map.entrySet()) {
//entry.getKey() ;entry.getValue(); entry.setValue();
//map.entrySet() 返回此映射中包含的映射关系的 Set视图。
relation_list.add(new Document("src_id",entry.getKey()).append("friends",entry.getValue()));
// System.out.println("key= " + entry.getKey() + " and value= "
// + entry.getValue());
}
*/
property.insertMany(property_list);
//relation.insertMany(relation_list);
side.insertMany(side_list);
property_list.clear();
//relation_list.clear();
side_list.clear();
}
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
/*
//entry.getKey() ;entry.getValue(); entry.setValue();
//map.entrySet() 返回此映射中包含的映射关系的 Set视图。
*/
int count=0;
for (Map.Entry<String,Set<Document>> entry : relation_map.entrySet()) {
FindIterable<Document> Item = relation.find(new Document("src_id",entry.getKey()));
if(relation.count(new Document("src_id",entry.getKey()))!=0) {
Item.forEach(new Block<Document>() {
@Override
public void apply(Document document) {
Set<Document> temp = new HashSet<Document>();
temp.addAll((Collection<? extends Document>) document.get("friends"));
Iterator<Document> its = entry.getValue().iterator();
while (its.hasNext()) {
temp.add(its.next());
}
relation.findOneAndReplace(new Document("src_id", entry.getKey()), new Document("src_id", entry.getKey()).append("friends", temp));
}
});
}
else {
relation_list.add(new Document("src_id", entry.getKey()).append("friends", entry.getValue()));
// System.out.println("key= " + entry.getKey() + " and value= "
// + entry.getValue());
}
}
property.insertMany(property_list);
side.insertMany(side_list);
if(relation_list.size()>0)
{
relation.insertMany(relation_list);
}
/*
//创建索引
property.createIndex(new Document("id",1));
relation.createIndex(new Document("src_id",1).append("unique",true));
side.createIndex(new Document("key",1));
*/
mongoClient.close();
long e = System.currentTimeMillis();
// bw.write("结束查询的时间:" + e);
//bw.newLine();
long d = (e-s);
// bw.write("消耗时间:" + d);
System.out.println("插入一个文件的入库时间:" + d);
} catch (Exception e) {
System.err.println(e.getClass().getName() + ":" + e.getMessage());
}
}
public static void main (String[] args){
//addDataToDB("testFile1.nb");
//addDataToDB("testFile2.nb");
addDataToDB("testFile3.nb");
//addDataToDB("add.txt");
//addDataToDB("test.txt");
//addDataToDB("teat2.txt");
//collection2.createIndex(new Document("src_id",1).append("src_type",1));
}
}
| [
"yhhe413@163.com"
] | yhhe413@163.com |
ea438fc4919c67f6bcb7babae0d4a08b531d4e23 | ef8a143893beaaa90f9287133880e90ea7d2aaaa | /Perestroika-Problem/src/main/java/cz/cuni/mff/perestroika/perestroika_problem_5_3_0_3_0_3_2/Goal.java | 6ee7f63f50d6cb3b7ecc44fa8f2192707085b134 | [
"MIT"
] | permissive | martinpilat/jPDDL | fb976ae66b248eaa021b8662f300829ef9bdb198 | c5e8389cccc9707b387de41298ae51983908a3f6 | refs/heads/master | 2021-06-13T18:41:14.994546 | 2021-03-26T15:55:23 | 2021-03-26T15:55:23 | 155,592,082 | 0 | 0 | MIT | 2018-10-31T16:46:57 | 2018-10-31T16:46:57 | null | UTF-8 | Java | false | false | 4,033 | java | package cz.cuni.mff.perestroika.perestroika_problem_5_3_0_3_0_3_2;
import cz.cuni.mff.jpddl.PDDLGoal;
import cz.cuni.mff.jpddl.PDDLState;
import cz.cuni.mff.perestroika.domain.State;
public class Goal extends PDDLGoal {
@Override
public String toPDDL() {
return "(:goal (and (alive)\n"
+ " (taken r1)\n"
+ " (taken r2)\n"
+ " (taken r3)\n"
+ " (taken r4)\n"
+ " (taken r5)\n"
+ " (taken r6)\n"
+ " (taken r7)\n"
+ " (taken r8)\n"
+ " (taken r9)\n"
+ " (taken r10)\n"
+ " )\n"
+ ")";
}
/**
* Whether the goal has been achieved in 'state'.
*
* GOAL
*
* :goal (and (alive r1)
* (taken r1)
* (taken r2)
* (taken r3)
* (taken r4)
* )
*
* @param state
* @return
*/
public boolean isAchieved(State state) {
return state.p_Alive.isSet()
&& state.p_Taken.isSet(E_Resources.r1)
&& state.p_Taken.isSet(E_Resources.r2)
&& state.p_Taken.isSet(E_Resources.r3)
&& state.p_Taken.isSet(E_Resources.r4)
&& state.p_Taken.isSet(E_Resources.r5)
&& state.p_Taken.isSet(E_Resources.r6)
&& state.p_Taken.isSet(E_Resources.r7)
&& state.p_Taken.isSet(E_Resources.r8)
&& state.p_Taken.isSet(E_Resources.r9)
&& state.p_Taken.isSet(E_Resources.r10);
}
public boolean isAchievedAll(State... states) {
for (State state : states) {
if (!isAchieved(state)) return false;
}
return true;
}
public boolean isAchievedUnion(State... states) {
boolean achieved;
achieved = false;
for (State state : states) {
if (achieved = state.p_Alive.isSet()) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r1)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r2)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r3)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r4)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r5)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r6)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r7)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r8)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r9)) break;
}
if (!achieved) return false;
achieved = false;
for (State state : states) {
if (achieved = state.p_Taken.isSet(E_Resources.r10)) break;
}
if (!achieved) return false;
return true;
}
public boolean isAchievedAny(State... states) {
for (State state : states) {
if (isAchieved(state)) return true;
}
return false;
}
// ========================
// PDDLGoal Generic Methods
// ========================
@Override
public boolean isAchieved(PDDLState state) {
return isAchieved((State)state);
}
@Override
public boolean isAchievedAll(PDDLState... states) {
return isAchievedAll((State[])states);
}
@Override
public boolean isAchievedUnion(PDDLState... states) {
return isAchievedUnion((State[])states);
}
@Override
public boolean isAchievedAny(PDDLState... states) {
return isAchievedAny((State[])states);
}
} | [
"martin.pilat@gmail.com"
] | martin.pilat@gmail.com |
23f53c49bca25faa5e3b0ac25d8c3e2bb1f756ec | 9855a8892ab2ac950d9e515b3d8195a41fc401bb | /src/attendanceLotus/util/FxmlLoader.java | c6168d6cc840e4953a5f54a8916be85d24d1c456 | [] | no_license | go-roii/AttendanceLotus | 2e0cdf715bdd6ce56028b788831774e289773e1f | 8a7b483e579240fb9bf123518ec8648421464fed | refs/heads/master | 2023-04-01T18:12:05.801956 | 2021-04-12T05:35:18 | 2021-04-12T05:35:18 | 350,397,811 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | package attendanceLotus.util;
import javafx.fxml.FXMLLoader;
import javafx.scene.layout.Pane;
import attendanceLotus.controller.admin.homeController;
import java.net.URL;
public class FxmlLoader {
private Pane view;
public Pane getPage(String userType, String fileName) {
try {
URL fileUrl = homeController.class.getResource("/attendanceLotus/view/" + userType + "/" + fileName + ".fxml");
if(fileUrl == null)
throw new java.io.FileNotFoundException("FXML file can't be found");
view = new FXMLLoader().load(fileUrl);
} catch (Exception e) {
e.printStackTrace();
}
return view;
}
}
| [
"royfgopez80@gmail.com"
] | royfgopez80@gmail.com |
1b366315441bae25f8a1d7a539556081374853b7 | e3b82a51acc4e6d6d04d124a431ef396ac43e287 | /app/src/main/java/com/superme/reader/mvp/view/adapter/MovieAdapter.java | 0e98fa8d22baef8ae5615eac9d938f4a44f17678 | [
"Apache-2.0"
] | permissive | hexingbo/SuperReader | 89bc0885166a67d0ee0199d3f607197dac6a9b5f | 1203b06712e9147ddc3697a91cc465476ae63e95 | refs/heads/master | 2020-11-24T03:23:13.480284 | 2019-12-31T01:46:15 | 2019-12-31T01:46:15 | 227,943,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,319 | java | package com.superme.reader.mvp.view.adapter;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import com.superme.reader.R;
import com.superme.reader.mvp.model.entity.res.MovieRes;
import com.superme.reader.mvp.view.adapter.base.LoadMoreBaseAdapter;
import com.superme.reader.mvp.view.adapter.base.ViewHolder;
import com.ljy.devring.DevRing;
import java.util.List;
/**
* author: ljy
* date: 2017/9/28
* description: 正在上映/即将上映列表的适配器
*/
public class MovieAdapter extends LoadMoreBaseAdapter<MovieRes> {
private int mMovieType;
public MovieAdapter(int movieType, @NonNull List<MovieRes> mDataList) {
super(mDataList);
mMovieType = movieType;
}
@Override
protected void bindDataForView_(ViewHolder holder, final MovieRes movieRes, int position) {
ImageView ivMovie = holder.getView(R.id.iv_movie);
TextView tvTitle = holder.getView(R.id.tv_title);
TextView tvType = holder.getView(R.id.tv_type);
TextView tvYear = holder.getView(R.id.tv_year);
RatingBar rbAverage = holder.getView(R.id.rb_average);
DevRing.imageManager().loadNet(movieRes.getImages().getMedium(), ivMovie);
tvTitle.setText(movieRes.getTitle());
String type = "";
for (String s : movieRes.getGenres()) {
type = type + s + "/";
}
tvType.setText(TextUtils.isEmpty(type) ? "暂无类型" : type.substring(0, type.length() - 1));
tvYear.setText(movieRes.getYear());
rbAverage.setRating(movieRes.getRating().getAverage() / 2);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
movieRes.setMovieType(mMovieType);
DevRing.busManager().postEvent(movieRes);
}
});
}
@Override
public ViewHolder onCreateViewHolder_(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_movie, parent, false);
return new ViewHolder(view);
}
}
| [
"hxb131426"
] | hxb131426 |
797511a396f03ec055a1a9e8026b16985fd2cd03 | e8ce1c60c4e790fde3a8d23ad60766b15c5f9653 | /src/com/stly7/eland/collection/hashSet/MyHashSet.java | 0d1807724bf04a7b5963aa199e2d9c8ac5142886 | [] | no_license | slty7/java_base | bc8691a13b0607d333b0711a2750a3977b5a630b | 0bd9dfad88888d99ada7c41e0fb45ef015ba31a6 | refs/heads/master | 2020-03-23T04:34:37.379895 | 2018-11-08T05:32:13 | 2018-11-08T05:32:26 | 141,091,414 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,984 | java | package com.stly7.eland.collection.hashSet;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
/**
* 用来做容器装遍历出来的相同的字符串
* @author Administrator
*
*/
public class MyHashSet {
Random random = new Random();
char[] cs = new char[2];
public static void main(String[] args) {
Set<String> set = new HashSet<>();
MyHashSet myHashSet = new MyHashSet();
//String random = myHashSet.getChar();
String[] strs = new String[100];
for (int i = 0; i < strs.length; i++) {
strs[i] = myHashSet.getChar();
}
for (String s1 : strs) {
int repeat = 0;
for (String s2 : strs) {
if (s1.equalsIgnoreCase(s2)) {
repeat++;
if (2 == repeat) {
// 当repeat==2的时候,就找到了一个非己的重复字符串
set.add(s2);
break;
}
}
}
}
System.out.printf("总共有 %d种重复的字符串%n", set.size());
if (set.size() != 0) {
System.out.println("分别是:");
for (String s : set) {
System.out.print(s + " ");
}
}
}
/**
* 或者给出一串字符串,在这个范围内随机返回一个字符然后 str += String.toArrayAt();
* @return
*/
//获得一个字符串
public String getChar() {
for (int i = 0; i < cs.length; i++) {
//这里随机是哪一个从0开始到第三个(2),都是在这3个条件范围内的随机切换
int y = random.nextInt(3) + 0;
if (y == 0) {
cs[i] = (char)(random.nextInt(9)+49);
}else if (y==1) {
cs[i] = (char)(random.nextInt(25)+66);
}else {
cs[i] = (char)(random.nextInt(25)+98);
}
}
return new String(cs);
}
}
| [
"315826333@qq.com"
] | 315826333@qq.com |
279725a7944a437238eaedc3c713158f041732fd | 482f83d40bf383187b153ab6b995840a38a6f3fb | /src/main/java/com/bolsadeideas/springboot/app/auth/handler/LoginSuccessHandler.java | 23f3a233e1efba316955f3fb5ac2d5862262d803 | [] | no_license | DevSty/SpringBootCRUDThymeleaf | e608b602329855dc0d6b90db67115988d09925e4 | ee3ae9d73495ac0e88ffd5cb4db13c899b1f4eae | refs/heads/master | 2022-09-23T21:05:27.059817 | 2020-06-05T23:15:08 | 2020-06-05T23:15:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,308 | java | package com.bolsadeideas.springboot.app.auth.handler;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.FlashMap;
import org.springframework.web.servlet.support.SessionFlashMapManager;
@Component
public class LoginSuccessHandler extends SimpleUrlAuthenticationSuccessHandler{
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
SessionFlashMapManager flashMapManager = new SessionFlashMapManager();
FlashMap flashMap = new FlashMap();
flashMap.put("success", "Hola "+authentication.getName()+", has iniciado sesión con éxito!");
flashMapManager.saveOutputFlashMap(flashMap, request, response);
if(authentication != null ) {
logger.info("El usuario '"+authentication.getName()+"' ha iniciado sesión con éxito!");
}
super.onAuthenticationSuccess(request, response, authentication);
}
}
| [
"simont98y@gmail.com"
] | simont98y@gmail.com |
d2ea7c1c028cf622b52a0df377834f3cdf3b6483 | 31f043184e2839ad5c3acbaf46eb1a26408d4296 | /src/main/java/com/github/highcharts4gwt/model/highcharts/option/api/plotoptions/arearange/point/RemoveEvent.java | 95b8dd802ea3c164ed7c4241d6973f16e6e79b69 | [] | no_license | highcharts4gwt/highchart-wrapper | 52ffa84f2f441aa85de52adb3503266aec66e0ac | 0a4278ddfa829998deb750de0a5bd635050b4430 | refs/heads/master | 2021-01-17T20:25:22.231745 | 2015-06-30T15:05:01 | 2015-06-30T15:05:01 | 24,794,406 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java |
package com.github.highcharts4gwt.model.highcharts.option.api.plotoptions.arearange.point;
import com.github.highcharts4gwt.model.highcharts.object.api.Point;
public interface RemoveEvent {
Point point();
}
| [
"ronan.quillevere@gmail.com"
] | ronan.quillevere@gmail.com |
bdc51d8707a379555409b8f659f5be821fb73bf2 | 79814ddf5ddf1923f005ffbf792d70fb965f4fbf | /src/main/java/com/progra/springboot/webflux/app/models/services/ProductoServiceImpl.java | 2bc06c74b077944cf6caff613d56ac4041158a57 | [] | no_license | Programito/spring-webflux-apirest | 476bf9b904c930e5296a056b4d7c5f3b0d49648f | f43f1c240fbde2f758374d5b384241eaef393312 | refs/heads/master | 2020-12-02T20:36:04.577299 | 2020-01-02T17:30:03 | 2020-01-02T17:30:03 | 231,113,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,885 | java | package com.progra.springboot.webflux.app.models.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.progra.springboot.webflux.app.models.dao.CategoriaDao;
import com.progra.springboot.webflux.app.models.dao.ProductoDao;
import com.progra.springboot.webflux.app.models.documents.Categoria;
import com.progra.springboot.webflux.app.models.documents.Producto;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@Service
public class ProductoServiceImpl implements ProductoService {
@Autowired
private ProductoDao dao;
@Autowired
private CategoriaDao categoriaDao;
@Override
public Flux<Producto> findAll() {
return dao.findAll();
}
@Override
public Mono<Producto> findById(String id) {
return dao.findById(id);
}
@Override
public Mono<Producto> save(Producto producto) {
return dao.save(producto);
}
@Override
public Mono<Void> delete(Producto producto) {
return dao.delete(producto);
}
@Override
public Flux<Producto> findAllConNombreUpperCase() {
return dao.findAll().map(producto -> {
producto.setNombre(producto.getNombre().toUpperCase());
return producto;
});
}
@Override
public Flux<Producto> findAllConNombreUpperCaseRepeat() {
return findAllConNombreUpperCase().repeat(5000);
}
@Override
public Flux<Categoria> findAllCategoria() {
return categoriaDao.findAll();
}
@Override
public Mono<Categoria> findCategoriaById(String id) {
return categoriaDao.findById(id);
}
@Override
public Mono<Categoria> saveCategoria(Categoria categoria) {
return categoriaDao.save(categoria);
}
@Override
public Mono<Producto> findByNombre(String nombre) {
return dao.findByNombre(nombre);
}
@Override
public Mono<Categoria> findCategoriaByNombre(String nombre) {
return categoriaDao.findByNombre(nombre);
}
}
| [
"programito@gmail.com"
] | programito@gmail.com |
9d625be5018f7003ba6806e6aa07596abbebfd1a | eeec0d68507a64b0eae5dbaaa83d24edfdac912b | /Folder16_MySelf/board_test/src/boarddemo/action/ViewAction.java | 41dc6798cdbf27988366c066408c87a01f9c2fc0 | [] | no_license | BellKim/Bitcmap_java_basic | 0eece2fa4bf6e8ef9c42be8d8e4d2f6340854d9a | 6cda0e88793e59d61d16da8f621b9a96f954d41d | refs/heads/master | 2022-12-24T22:30:04.586343 | 2020-03-29T17:55:46 | 2020-03-29T17:55:46 | 219,406,630 | 1 | 1 | null | 2022-12-16T14:51:43 | 2019-11-04T03:07:26 | Java | UTF-8 | Java | false | false | 466 | java | package boarddemo.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import boarddemo.dao.BoardDAO;
public class ViewAction {
public void execute(HttpServletRequest req, HttpServletResponse resp) {
int num=Integer.parseInt(req.getParameter("num"));
BoardDAO dao = BoardDAO.getInstance();
dao.readCountMethod(num); //뷰카운트 num값을 넘겨줌.
req.setAttribute("dto", dao.viewMeethod(num));
}
}
| [
"goste390@gmail.com"
] | goste390@gmail.com |
935997a2cc2131a3a7ef990d084c28d839c26492 | 260660e2f1adf5a78728e1ca26e245a30f2889c6 | /nd4j-jcublas-parent/nd4j-jcublas-6.5/src/main/java/jcuda/utils/KernelLauncher.java | 0703d009ac56da4ff876dbd2de1f94dbbe0d9582 | [
"Apache-2.0"
] | permissive | nchinth/nd4j | f285ba2c6ed27310610c0816ac81c8b545c30cad | 8ca6834f6ad7ff0e9a85b9d8ea0b7fdbbd3932fb | refs/heads/master | 2021-01-21T08:43:31.120475 | 2015-10-23T05:34:20 | 2015-10-23T05:34:20 | 43,264,687 | 0 | 0 | null | 2015-09-27T20:57:50 | 2015-09-27T20:57:50 | null | UTF-8 | Java | false | false | 42,010 | java | /*
* JCudaUtils - Utilities for JCuda
* http://www.jcuda.org
*
* Copyright (c) 2010 Marco Hutter - http://www.jcuda.org
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package jcuda.utils;
import static jcuda.driver.JCudaDriver.cuDeviceGetCount;
import static jcuda.driver.JCudaDriver.cuLaunchKernel;
import static jcuda.driver.JCudaDriver.cuModuleGetFunction;
import static jcuda.driver.JCudaDriver.cuModuleLoadDataEx;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import jcuda.CudaException;
import jcuda.Pointer;
import jcuda.driver.CUcontext;
import jcuda.driver.CUfunction;
import jcuda.driver.CUmodule;
import jcuda.driver.CUresult;
import jcuda.driver.CUstream;
import jcuda.driver.JCudaDriver;
import jcuda.runtime.JCuda;
import jcuda.runtime.dim3;
import org.nd4j.linalg.jcublas.SimpleJCublas;
import org.nd4j.linalg.jcublas.context.ContextHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This is a utility class that simplifies the setup and launching
* of CUDA kernels using the JCuda Driver API. <br />
* <br />
* Instances of this class may be created using one of the following
* methods: <br />
* <ul>
* <li>
* {@link KernelLauncher#compile(String, String, String...)} will
* compile a kernel from a String containing the CUDA source code
* </li>
* <li>
* {@link KernelLauncher#create(String, String, String...)} will
* create a kernel for a function that is contained in a CUDA
* source file
* </li>
* <li>
* {@link KernelLauncher#load(String, String)} will load a kernel from
* a PTX or CUBIN (CUDA binary) file.
* </li>
* <li>
* {@link KernelLauncher#load(InputStream, String)} will load a kernel
* from PTX- or CUBIN data which is provided via an InputStream
* (useful for packaging PTX- or CUBIN files into JAR archives)<br />
* </li>
* </ul>
*
* <br />
* These instances may then be used to call a kernel function with
* the {@link KernelLauncher#call(Object...)} method. The actual
* kernel function arguments which are passed to this method
* will be set up automatically, and aligned appropriately for
* their respective size.<br />
* <br />
* The setup of the execution may be performed similarly as the invocation
* of a kernel when using the Runtime API in C. Such a call has the
* form<br />
* <code>
* kernel<<<gridDim, blockDim,
* sharedMemorySize, stream>>>(...);
* </code>
* <br />
* where
* <ul>
* <li>
* <b>gridDim</b> is a dim3 which specifies the number of blocks per
* grid
* </li>
* <li>
* <b>blockDim</b> is a dim3 that specifies the number of threads
* per block
* </li>
* <li>
* <b>sharedMemorySize</b> is the size of the shared memory for
* the kernel
* </li>
* <li>
* <b>stream</b> is a stream for asynchronous kernel execution
* </li>
* </ul>
* Similarly, the KernelLauncher allows specifying these parameters
* in the {@link KernelLauncher#setup(dim3, dim3, int, CUstream)}
* method: <br />
* <br />
* <code>
* kernelLauncher.setup(gridDim,
* blockDim, sharedMemorySize, stream).call(...);
* </code>
* <br />
* <br />
* When default values for some of the parameters should be used,
* one of the overloaded versions of the setup method may be called:
* <br />
* <br />
* <code>
* kernelLauncher.setup(gridDim,
* blockDim).call(kernel);
* </code>
* <br />
* <br />
* The parameters may also be set individually:<br />
* <br />
* <code>
* kernelLauncher.setGridSize(gridSize);<br />
* kernelLauncher.setBlockSize(blockSize);<br />
* kernelLauncher.call(...);
* </code>
* <br />
*/
public class KernelLauncher {
/**
* The logger used in this class
*/
private static final Logger logger = LoggerFactory.getLogger(KernelLauncher.class.getName());
/**
* The path prefix, containing the path to the NVCC compiler.
* Not required if the path to the NVCC is present in an
* environment variable.
*/
private static String compilerPath = "";
/**
* The number of the device which should be used by the
* KernelLauncher
*/
private int deviceNumber = 0;
/**
* Set the path to the NVCC compiler. For example: <br />
* <code>setCompilerPath("C:/CUDA/bin");</code>
* <br />
* By default, this path is empty, assuming that the compiler
* is in a path that is visible via an environment variable.
*
* @param path The path to the NVCC compiler.
*/
public static void setCompilerPath(String path)
{
if (path == null)
{
compilerPath = "";
}
compilerPath = path;
if (!compilerPath.endsWith(File.separator))
{
compilerPath += File.separator;
}
}
/**
* Set the number (index) of the device which should be used
* by the KernelLauncher
*
* @param number The number of the device to use
* @throws CudaException If number < 0 or number >= deviceCount
*/
public void setDeviceNumber(int number)
{
int count[] = new int[1];
cuDeviceGetCount(count);
if (number < 0)
{
throw new CudaException(
"Invalid device number: " + number + ". "+
"There are only " + count[0] + " devices available");
}
deviceNumber = number;
}
/**
* Create a new KernelLauncher for the function with the given
* name, that is defined in the given source code. <br />
* <br />
* The source code is stored in a temporary .CU CUDA source file,
* and a PTX file is compiled from this source file using the
* NVCC (NVIDIA CUDA C Compiler) in a separate process.
* The optional nvccArguments are passed to the NVCC.<br />
* <br />
* The NVCC has to be in a visible directory. E.g. for Windows, the
* NVCC.EXE has to be in a directory that is contained in the PATH
* environment variable. Alternatively, the path to the NVCC may
* be specified by calling {@link KernelLauncher#setCompilerPath(String)}
* with the respective path. <br />
* <br />
* <u><b>Note</b></u>: In order to make the function accessible
* by the name it has in the source code, the function has to
* be declared as an <code><u>extern "C"</u></code> function: <br />
* <br />
* <code>
* <b>extern "C"</b><br />
* __global__ void functionName(...)<br />
* {<br />
* ... <br />
* }<br />
* </code>
*
*
* @see KernelLauncher#create(String, String, String...)
* @see KernelLauncher#create(String, String, boolean, String...)
* @see KernelLauncher#load(String, String)
*
* @param sourceCode The source code containing the function
* @param functionName The name of the function.
* @param nvccArguments Optional arguments for the NVCC
* @return The KernelLauncher for the specified function
* @throws CudaException If the creation of the CU- or PTX file
* fails, or the PTX may not be loaded, or the specified
* function can not be obtained.
*/
public static KernelLauncher compile(
String sourceCode, String functionName, String ... nvccArguments)
{
File cuFile = null;
try
{
cuFile = File.createTempFile("temp_JCuda_", ".cu");
}
catch (IOException e)
{
throw new CudaException("Could not create temporary .cu file", e);
}
String cuFileName = cuFile.getPath();
FileOutputStream fos = null;
try
{
fos = new FileOutputStream(cuFile);
fos.write(sourceCode.getBytes());
}
catch (IOException e)
{
throw new CudaException("Could not write temporary .cu file", e);
}
finally
{
if (fos != null)
{
try
{
fos.close();
}
catch (IOException e)
{
throw new CudaException(
"Could not close temporary .cu file", e);
}
}
}
return create(cuFileName, functionName, nvccArguments);
}
/**
* Create a new KernelLauncher for the function with the given
* name, that is contained in the .CU CUDA source file with the
* given name. <br />
* <br />
* <u><b>Note</b></u>: In order to make the function accessible
* by the name it has in the source code, the function has to
* be declared as an <code><u>extern "C"</u></code> function: <br />
* <br />
* <code>
* <b>extern "C"</b><br />
* __global__ void functionName(...)<br />
* {<br />
* ... <br />
* }<br />
* </code>
* <br />
* The extension of the given file name is replaced with "ptx".
* If the PTX file with the resulting name does not exist,
* or is older than the .CU file, it is compiled from
* the specified source file using the NVCC (NVIDIA CUDA C
* Compiler) in a separate process. The optional nvccArguments
* are passed to the NVCC.<br />
* <br />
* The NVCC has to be in a visible directory. E.g. for Windows, the
* NVCC.EXE has to be in a directory that is contained in the PATH
* environment variable. Alternatively, the path to the NVCC may
* be specified by calling {@link KernelLauncher#setCompilerPath(String)}
* with the respective path. <br />
*
* @see KernelLauncher#compile(String, String, String...)
* @see KernelLauncher#create(String, String, boolean, String...)
* @see KernelLauncher#load(String, String)
* @see KernelLauncher#load(InputStream, String)
*
* @param cuFileName The name of the source file.
* @param functionName The name of the function.
* @param nvccArguments Optional arguments for the NVCC
* @return The KernelLauncher for the specified function
* @throws CudaException If the creation of the PTX file fails,
* or the PTX may not be loaded, or the specified function can
* not be obtained.
*/
public static KernelLauncher create(
String cuFileName, String functionName, String ... nvccArguments)
{
return create(cuFileName, functionName, false, nvccArguments);
}
/**
* Create a new KernelLauncher for the function with the given
* name, that is contained in the .CU CUDA source file with the
* given name. <br />
* <br />
* <u><b>Note</b></u>: In order to make the function accessible
* by the name it has in the source code, the function has to
* be declared as an <code><u>extern "C"</u></code> function: <br />
* <br />
* <code>
* <b>extern "C"</b><br />
* __global__ void functionName(...)<br />
* {<br />
* ... <br />
* }<br />
* </code>
* <br />
* The extension of the given file name is replaced with "ptx".
* If the PTX file with the resulting name does not exist,
* or is older than the .CU file, it is compiled from
* the specified source file using the NVCC (NVIDIA CUDA C
* Compiler) in a separate process. The optional nvccArguments
* are passed to the NVCC.<br />
* <br />
* If the <code>forceRebuild</code> flag is 'true', then the
* PTX file will be recompiled from the given source file,
* even if it already existed or was newer than the source
* file, and the already existing PTX file will be
* overwritten.<br />
* <br />
* The NVCC has to be in a visible directory. E.g. for Windows, the
* NVCC.EXE has to be in a directory that is contained in the PATH
* environment variable. Alternatively, the path to the NVCC may
* be specified by calling {@link KernelLauncher#setCompilerPath(String)}
* with the respective path. <br />
*
* @see KernelLauncher#compile(String, String, String...)
* @see KernelLauncher#create(String, String, String...)
* @see KernelLauncher#load(String, String)
* @see KernelLauncher#load(InputStream, String)
*
* @param cuFileName The name of the source file.
* @param functionName The name of the function.
* @param forceRebuild Whether the PTX file should be recompiled
* and overwritten if it already exists.
* @param nvccArguments Optional arguments for the NVCC
* @return The KernelLauncher for the specified function
* @throws CudaException If the creation of the PTX file fails,
* or the PTX may not be loaded, or the specified function can
* not be obtained.
*/
public static KernelLauncher create(
String cuFileName, String functionName,
boolean forceRebuild, String ... nvccArguments)
{
// Prepare the PTX file for the CU source file
String ptxFileName = null;
try
{
ptxFileName =
preparePtxFile(cuFileName, forceRebuild, nvccArguments);
}
catch (IOException e)
{
throw new CudaException(
"Could not prepare PTX for source file '"+cuFileName+"'", e);
}
KernelLauncher kernelLauncher = new KernelLauncher();
byte ptxData[] = loadData(ptxFileName);
kernelLauncher.initModule(ptxData);
kernelLauncher.initFunction(functionName);
return kernelLauncher;
}
/**
* Create a new KernelLauncher which may be used to execute the
* specified function which is loaded from the PTX- or CUBIN
* (CUDA binary) file with the given name.
*
* @see KernelLauncher#compile(String, String, String...)
* @see KernelLauncher#create(String, String, boolean, String...)
* @see KernelLauncher#load(String, String)
* @see KernelLauncher#load(InputStream, String)
*
* @param moduleFileName The name of the PTX- or CUBIN file
* @param functionName The name of the function
* @return The KernelLauncher for the specified function
* @throws CudaException If the PTX- or CUBIN may not be loaded,
* or the specified function can not be obtained.
*/
public static KernelLauncher load(
String moduleFileName, String functionName) {
KernelLauncher kernelLauncher = new KernelLauncher();
byte moduleData[] = loadData(moduleFileName);
kernelLauncher.initModule(moduleData);
kernelLauncher.initFunction(functionName);
return kernelLauncher;
}
/**
* Create a new KernelLauncher which may be used to execute the
* specified function which is loaded from the PTX- or CUBIN
* data that is read from the given input stream.
*
* @see KernelLauncher#compile(String, String, String...)
* @see KernelLauncher#create(String, String, boolean, String...)
* @see KernelLauncher#load(String, String)
* @see KernelLauncher#load(InputStream, String)
*
* @param moduleInputStream The stream for the PTX- or CUBIN data
* @param functionName The name of the function
* @return The KernelLauncher for the specified function
* @throws CudaException If the PTX- or CUBIN may not be loaded,
* or the specified function can not be obtained.
*/
public static KernelLauncher load(
InputStream moduleInputStream, String functionName)
{
KernelLauncher kernelLauncher = new KernelLauncher();
byte moduleData[] = loadData(moduleInputStream);
kernelLauncher.initModule(moduleData);
kernelLauncher.initFunction(functionName);
return kernelLauncher;
}
/**
* Load the data from the file with the given name and returns
* it as a 0-terminated byte array
*
* @param fileName The name of the file
* @return The data from the file
*/
private static byte[] loadData(String fileName)
{
InputStream inputStream = null;
try
{
inputStream= new FileInputStream(new File(fileName));
return loadData(inputStream);
}
catch (FileNotFoundException e)
{
throw new CudaException(
"Could not open '"+fileName+"'", e);
}
finally
{
if (inputStream != null)
{
try
{
inputStream.close();
}
catch (IOException e)
{
throw new CudaException(
"Could not close '"+fileName+"'", e);
}
}
}
}
/**
* Reads the data from the given inputStream and returns it as
* a 0-terminated byte array.
*
* @param inputStream The inputStream to read
* @return The data from the inputStream
*/
private static byte[] loadData(InputStream inputStream)
{
ByteArrayOutputStream baos = null;
try
{
baos = new ByteArrayOutputStream();
byte buffer[] = new byte[8192];
while (true)
{
int read = inputStream.read(buffer);
if (read == -1)
{
break;
}
baos.write(buffer, 0, read);
}
baos.write('\0');
baos.flush();
return baos.toByteArray();
}
catch (IOException e)
{
throw new CudaException(
"Could not load data", e);
}
finally
{
if (baos != null)
{
try
{
baos.close();
}
catch (IOException e)
{
throw new CudaException(
"Could not close output", e);
}
}
}
}
/**
* The context which was used to create this instance
*/
private CUcontext context;
/**
* The module which contains the function
*/
private CUmodule module;
/**
* The function which is executed with this KernelLauncher
*/
private CUfunction function;
/**
* The current block size (number of threads per block)
* which will be used for the function call.
*/
private dim3 blockSize = new dim3(1,1,1);
/**
* The current grid size (number of blocks per grid)
* which will be used for the function call.
*/
private dim3 gridSize = new dim3(1,1,1);
/**
* The currently specified size of the shared memory
* for the function call.
*/
private int sharedMemSize = 0;
/**
* The stream that should be associated with the function call.
*/
private CUstream stream;
/**
* Private constructor. Instantiation only via the static
* methods.
*/
private KernelLauncher() {
initialize();
}
/**
* Initializes this KernelLauncher. This method will try to
* initialize the JCuda driver API. Then it will try to
* attach to the current CUDA context. If no active CUDA
* context exists, then it will try to create one, for
* the device which is specified by the current
* deviceNumber.
*
* @throws CudaException If it is neither possible to
* attach to an existing context, nor to create a new
* context.
*/
private void initialize() {
context = ContextHolder.getInstance().getContext(deviceNumber);
}
/**
* Sync the context for the current thread.
*/
public static void setContext() {
JCudaDriver.cuCtxSetCurrent(ContextHolder.getInstance().getContext());
JCuda.cudaSetDevice(ContextHolder.getInstance().getDeviceForThread());
JCudaDriver.cuCtxSynchronize();
JCuda.cudaDeviceSynchronize();
}
/**
* Create a new KernelLauncher which uses the same module as
* this KernelLauncher, but may be used to execute a different
* function. All parameters (grid size, block size, shared
* memory size and stream) of the returned KernelLauncher
* will be independent of 'this' one and initially contain
* the default values.
*
* @param functionName The name of the function
* @return The KernelLauncher for the specified function
* @throws CudaException If the specified function can not
* be obtained from the module of this KernelLauncher.
*/
public KernelLauncher forFunction(String functionName) {
KernelLauncher kernelLauncher = new KernelLauncher();
kernelLauncher.module = this.module;
kernelLauncher.initFunction(functionName);
return kernelLauncher;
}
/**
* Initialize the module for this KernelLauncher by loading
* the PTX- or CUBIN file with the given name.
*
* @param moduleData The data from the PTX- or CUBIN file
*/
private void initModule(byte moduleData[])
{
module = new CUmodule();
cuModuleLoadDataEx(module, Pointer.to(moduleData),
0, new int[0], Pointer.to(new int[0]));
}
/**
* Initialize this KernelLauncher for calling the function with
* the given name, which is contained in the module of this
* KernelLauncher
*
* @param functionName The name of the function
*/
private void initFunction(String functionName)
{
// Obtain the function from the module
function = new CUfunction();
String functionErrorString =
"Could not get function '"+functionName+"' from module. "+"\n"+
"Name in module might be mangled. Try adding the line "+"\n"+
"extern \"C\""+"\n"+
"before the function you want to call, or open the " +
"PTX/CUBIN "+"\n"+"file with a text editor to find out " +
"the mangled function name";
try
{
int result = cuModuleGetFunction(function, module, functionName);
if (result != CUresult.CUDA_SUCCESS)
{
throw new CudaException(functionErrorString);
}
}
catch (CudaException e)
{
throw new CudaException(functionErrorString, e);
}
}
/**
* Returns the module that was created from the PTX- or CUBIN file, and
* which contains the function that should be executed. This
* module may also be used to access symbols and texture
* references. However, clients should not modify or unload
* the module.
*
* @return The CUmodule
*/
public CUmodule getModule()
{
return module;
}
/**
* Set the grid size (number of blocks per grid) for the function
* call.<br />
* <br />
* This corresponds to the first parameter in the runtime call:<br />
* <br />
* <code>
* kernel<<<<b><u>gridSize</u></b>, blockSize,
* sharedMemSize, stream>>>(...);
* </code>
* <br />
* <br />
* The default grid size is (1,1,1)
*
* @see KernelLauncher#call(Object...)
* @see KernelLauncher#setup(dim3, dim3)
* @see KernelLauncher#setup(dim3, dim3, int)
* @see KernelLauncher#setup(dim3, dim3, int, CUstream)
*
* @param x The number of blocks per grid in x-direction
* @param y The number of blocks per grid in y-direction
* @return This instance
*/
public KernelLauncher setGridSize(int x, int y)
{
gridSize.x = x;
gridSize.y = y;
return this;
}
/**
* Set the grid size (number of blocks per grid) for the function
* call.<br />
* <br />
* This corresponds to the first parameter in the runtime call:<br />
* <br />
* <code>
* kernel<<<<b><u>gridSize</u></b>, blockSize,
* sharedMemSize, stream>>>(...);
* </code>
* <br />
* <br />
* The default grid size is (1,1,1)
*
* @see KernelLauncher#call(Object...)
* @see KernelLauncher#setup(dim3, dim3)
* @see KernelLauncher#setup(dim3, dim3, int)
* @see KernelLauncher#setup(dim3, dim3, int, CUstream)
*
* @param x The number of blocks per grid in x-direction
* @param y The number of blocks per grid in y-direction
* @param z The number of blocks per grid in z-direction
* @return This instance
*/
public KernelLauncher setGridSize(int x, int y, int z)
{
gridSize.x = x;
gridSize.y = y;
gridSize.z = z;
return this;
}
/**
* Set the block size (number of threads per block) for the function
* call.<br />
* <br />
* This corresponds to the second parameter in the runtime call:<br />
* <br />
* <code>
* kernel<<<gridSize, <b><u>blockSize</u></b>,
* sharedMemSize, stream>>>(...);
* </code>
* <br />
* <br />
* The default block size is (1,1,1)
*
* @see KernelLauncher#call(Object...)
* @see KernelLauncher#setup(dim3, dim3)
* @see KernelLauncher#setup(dim3, dim3, int)
* @see KernelLauncher#setup(dim3, dim3, int, CUstream)
*
* @param x The number of threads per block in x-direction
* @param y The number of threads per block in y-direction
* @param z The number of threads per block in z-direction
* @return This instance
*/
public KernelLauncher setBlockSize(int x, int y, int z)
{
blockSize.x = x;
blockSize.y = y;
blockSize.z = z;
return this;
}
/**
* Set the size of the shared memory for the function
* call.<br />
* <br />
* This corresponds to the third parameter in the runtime call:<br />
* <br />
* <code>
* kernel<<<gridSize, blockSize,
* <b><u>sharedMemSize</u></b>, stream>>>(...);
* </code>
* <br />
* <br />
* The default shared memory size is 0.
*
* @see KernelLauncher#call(Object...)
* @see KernelLauncher#setup(dim3, dim3)
* @see KernelLauncher#setup(dim3, dim3, int)
* @see KernelLauncher#setup(dim3, dim3, int, CUstream)
*
* @param sharedMemSize The size of the shared memory, in bytes
* @return This instance
*/
public KernelLauncher setSharedMemSize(int sharedMemSize)
{
this.sharedMemSize = sharedMemSize;
return this;
}
/**
* Set the stream for the function call.<br />
* <br />
* This corresponds to the fourth parameter in the runtime call:<br />
* <br />
* <code>
* kernel<<<gridSize, blockSize,
* sharedMemSize, <b><u>stream</u></b>>>>(...);
* </code>
* <br />
* <br />
* The default stream is null (0).
*
* @see KernelLauncher#call(Object...)
* @see KernelLauncher#setup(dim3, dim3)
* @see KernelLauncher#setup(dim3, dim3, int)
* @see KernelLauncher#setup(dim3, dim3, int, CUstream)
*
* @param stream The stream for the function call
* @return This instance
*/
public KernelLauncher setStream(CUstream stream) {
this.stream = stream;
return this;
}
/**
* Set the given grid size and block size for this KernelLauncher.
*
* @see KernelLauncher#call(Object...)
* @see KernelLauncher#setup(dim3, dim3, int)
* @see KernelLauncher#setup(dim3, dim3, int, CUstream)
*
* @param gridSize The grid size (number of blocks per grid)
* @param blockSize The block size (number of threads per block)
* @return This instance
*/
public KernelLauncher setup(dim3 gridSize, dim3 blockSize)
{
return setup(gridSize, blockSize, sharedMemSize, stream);
}
/**
* Set the given grid size and block size and shared memory size
* for this KernelLauncher.
*
* @see KernelLauncher#call(Object...)
* @see KernelLauncher#setup(dim3, dim3)
* @see KernelLauncher#setup(dim3, dim3, int, CUstream)
*
* @param gridSize The grid size (number of blocks per grid)
* @param blockSize The block size (number of threads per block)
* @param sharedMemSize The size of the shared memory
* @return This instance
*/
public KernelLauncher setup(dim3 gridSize, dim3 blockSize,
int sharedMemSize)
{
return setup(gridSize, blockSize, sharedMemSize, stream);
}
public CUcontext context() {
return context;
}
/**
* Set the given grid size and block size, shared memory size
* and stream for this KernelLauncher.
*
* @see KernelLauncher#call(Object...)
* @see KernelLauncher#setup(dim3, dim3)
* @see KernelLauncher#setup(dim3, dim3, int)
*
* @param gridSize The grid size (number of blocks per grid)
* @param blockSize The block size (number of threads per block)
* @param sharedMemSize The size of the shared memory
* @param stream The stream for the kernel invocation
* @return This instance
*/
public KernelLauncher setup(dim3 gridSize, dim3 blockSize,
int sharedMemSize, CUstream stream) {
setGridSize(gridSize.x, gridSize.y);
setBlockSize(blockSize.x, blockSize.y, blockSize.z);
setSharedMemSize(sharedMemSize);
setStream(stream);
return this;
}
/**
* Call the function of this KernelLauncher with the current
* grid size, block size, shared memory size and stream, and
* with the given arguments.<br />
* <br />
* The given arguments must all be either of the type
* <code>Pointer</code>, or of a primitive type except boolean.
* Otherwise, a CudaException will be thrown.
*
* @param args The arguments for the function call
* @throws CudaException if an argument with an invalid type
* was given, or one of the internal functions for setting
* up and executing the kernel failed.
*/
public void call(Object ... args) {
Pointer kernelParameters[] = new Pointer[args.length];
for (int i = 0; i < args.length; i++) {
Object arg = args[i];
if (arg instanceof Pointer)
{
Pointer argPointer = (Pointer)arg;
Pointer pointer = Pointer.to(argPointer);
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is Pointer");
}
else if (arg instanceof Byte)
{
Byte value = (Byte)arg;
Pointer pointer = Pointer.to(new byte[]{value});
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is Byte");
}
else if (arg instanceof Short)
{
Short value = (Short)arg;
Pointer pointer = Pointer.to(new short[]{value});
kernelParameters[i] = pointer;
// logger.info("argument " + i + " type is Short");
}
else if (arg instanceof Integer)
{
Integer value = (Integer)arg;
Pointer pointer = Pointer.to(new int[]{value});
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is Integer");
}
else if (arg instanceof Long)
{
Long value = (Long)arg;
Pointer pointer = Pointer.to(new long[]{value});
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is Long");
}
else if (arg instanceof Float)
{
Float value = (Float)arg;
Pointer pointer = Pointer.to(new float[]{value});
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is Float");
}
else if (arg instanceof Double)
{
Double value = (Double)arg;
Pointer pointer = Pointer.to(new double[]{value});
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is Double");
}
else if (arg instanceof double[])
{
double[] value = (double[])arg;
Pointer pointer = Pointer.to(value);
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is double[]");
}
else if (arg instanceof float[])
{
float[] value = (float[])arg;
Pointer pointer = Pointer.to(value);
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is float[]");
}
else if (arg instanceof int[])
{
int[] value = (int[])arg;
Pointer pointer = Pointer.to(value);
kernelParameters[i] = pointer;
//logger.info("argument " + i + " type is int[]");
}
else if(arg instanceof jcuda.jcurand.curandGenerator) {
jcuda.jcurand.curandGenerator rng = (jcuda.jcurand.curandGenerator) arg;
kernelParameters[i] = Pointer.to(rng);
}
else
{
throw new CudaException(
"Type " + arg.getClass() + " may not be passed to a function");
}
}
cuLaunchKernel(function,
gridSize.x, gridSize.y, gridSize.z,
blockSize.x, blockSize.y, blockSize.z,
sharedMemSize, stream,
Pointer.to(kernelParameters), null
);
ContextHolder.syncStream();
try {
SimpleJCublas.sync();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* The extension of the given file name is replaced with "ptx".
* If the file with the resulting name does not exist or is older
* than the source file, it is compiled from the given file
* using NVCC. If the forceRebuild flag is 'true', then the PTX
* file is rebuilt even if it already exists or is newer than the
* source file. The name of the PTX file is returned.
*
* @param cuFileName The name of the .CU file
* @param forceRebuild Whether the PTX file should be re-created
* even if it exists already.
* @param nvccArguments Optional arguments for the NVCC
* @return The name of the PTX file
* @throws IOException If an I/O error occurs
* @throws CudaException If the creation of the PTX file fails
*/
private static String preparePtxFile(
String cuFileName, boolean forceRebuild, String ... nvccArguments)
throws IOException {
logger.info("Preparing PTX for \n"+cuFileName);
File cuFile = new File(cuFileName);
if (!cuFile.exists())
throw new CudaException("Input file not found: " + cuFileName);
// Replace the file extension with "ptx"
String ptxFileName = null;
int lastIndex = cuFileName.lastIndexOf('.');
if (lastIndex == -1)
ptxFileName = cuFileName + ".ptx";
else
ptxFileName = cuFileName.substring(0, lastIndex)+".ptx";
// Return if the file already exists and should not be rebuilt
File ptxFile = new File(ptxFileName);
if (ptxFile.exists() && !forceRebuild) {
long cuLastModified = cuFile.lastModified();
long ptxLastModified = ptxFile.lastModified();
if (cuLastModified < ptxLastModified)
return ptxFileName;
}
// Build the command line
String modelString = "-m"+System.getProperty("sun.arch.data.model");
String defaultArguments = "";
String optionalArguments = createArgumentsString(nvccArguments);
String command =
compilerPath + "nvcc " + modelString + " " + defaultArguments +
" " + optionalArguments + " -ptx "+
cuFile.getPath()+" -o "+ptxFileName;
// Execute the command line and wait for the output
logger.info("Executing\n" + command);
Process process = Runtime.getRuntime().exec(command);
String errorMessage =
new String(toByteArray(process.getErrorStream()));
String outputMessage =
new String(toByteArray(process.getInputStream()));
int exitValue = 0;
try {
exitValue = process.waitFor();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new CudaException(
"Interrupted while waiting for nvcc output", e);
}
logger.info("nvcc process exitValue "+exitValue);
if (exitValue != 0) {
logger.error("errorMessage:\n"+errorMessage);
logger.error("outputMessage:\n"+outputMessage);
throw new CudaException(
"Could not create .ptx file: "+errorMessage);
}
return ptxFileName;
}
/**
* Creates a single string from the given argument strings
*
* @param nvccArguments The argument strings
* @return A single string containing the arguments
*/
private static String createArgumentsString(String ... nvccArguments)
{
if (nvccArguments == null || nvccArguments.length == 0)
{
return "";
}
StringBuilder sb = new StringBuilder();
for (String s : nvccArguments)
{
sb.append(s);
sb.append(" ");
}
return sb.toString();
}
/**
* Fully reads the given InputStream and returns it as a byte array.
*
* @param inputStream The input stream to read
* @return The byte array containing the data from the input stream
* @throws IOException If an I/O error occurs
*/
private static byte[] toByteArray(
InputStream inputStream) throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte buffer[] = new byte[8192];
while (true)
{
int read = inputStream.read(buffer);
if (read == -1)
{
break;
}
baos.write(buffer, 0, read);
}
return baos.toByteArray();
}
@Override
public String toString() {
return "KernelLauncher{" +
"deviceNumber=" + deviceNumber +
", context=" + context +
", module=" + module +
", function=" + function +
", blockSize=" + blockSize +
", gridSize=" + gridSize +
", sharedMemSize=" + sharedMemSize +
", stream=" + stream +
'}';
}
}
| [
"adam@skymind.io"
] | adam@skymind.io |
e83485707c566c3ffc0022adab97b924de51b792 | 9a2d84ed133208a3f021d4ebd2d49e6bce093e50 | /src/phasfjo/example/ExampleBean.java | 6cf66a828503e469f286674c46c681587a4b6e05 | [] | no_license | paulito81/SpringProject | 42680a55e1ad378229da38083fca1b75a1d5ce75 | 4a82e929d22593d4a0b75c51031f46e0fb8880ac | refs/heads/master | 2021-01-25T09:08:58.352037 | 2017-06-13T08:45:30 | 2017-06-13T08:45:30 | 93,782,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package phasfjo.example;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
/**
* Created by paul on 29.05.2017.
*/
public class ExampleBean implements InitializingBean, DisposableBean {
private String message;
public void setMessage(String message) {
this.message = message;
}
public void getMessage() {
System.out.println("Your message: '" + message+"'");
}
public void init() {
System.out.println("Bean '" + message +"' is going through init...");
}
@Override
public void afterPropertiesSet() throws Exception {
System.out.println("Nothing happening?");
}
@Override
public void destroy() throws Exception {
System.out.println("Bean '" + message+ "' is being destroyed..");
}
}
| [
"paulito@Pauls-MacBook-Pro.local"
] | paulito@Pauls-MacBook-Pro.local |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.