hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
sequence
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
sequence
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
sequence
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e0176a3ec029c7daf42c4d654c30ffe6ed16bce
2,273
java
Java
springboot-demo-img-code/src/main/java/cn/van/springboot/img/code/web/controller/ValidateCodeController.java
vanDusty/SpringBoot-Home
ead464291241006fdaaf050f0ee7c085d780b994
[ "Apache-2.0" ]
103
2019-04-18T04:14:14.000Z
2022-03-12T14:10:50.000Z
springboot-demo-img-code/src/main/java/cn/van/springboot/img/code/web/controller/ValidateCodeController.java
vanDusty/SpringBoot-Home
ead464291241006fdaaf050f0ee7c085d780b994
[ "Apache-2.0" ]
1
2021-08-12T21:39:20.000Z
2022-01-28T15:07:12.000Z
springboot-demo-img-code/src/main/java/cn/van/springboot/img/code/web/controller/ValidateCodeController.java
vanDusty/SpringBoot-Home
ead464291241006fdaaf050f0ee7c085d780b994
[ "Apache-2.0" ]
83
2019-08-07T05:51:47.000Z
2022-03-17T08:17:09.000Z
26.741176
82
0.642323
601
package cn.van.springboot.img.code.web.controller; import cn.van.springboot.img.code.util.ImgValidateCodeUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; /** * Copyright (C), 2015-2019, 风尘博客 * 公众号 : 风尘博客 * FileName: ValidateCodeController * * @author: Van * Date: 2019-09-15 13:57 * Description: ${DESCRIPTION} * Version: V1.0 */ @RestController @RequestMapping("/code") public class ValidateCodeController { @Autowired StringRedisTemplate redisTemplate; /** * 生成图片验证码 * @return */ @GetMapping("/getImgCode") public Map<String, String> getImgCode() { Map<String, String> result = new HashMap<>(); try { // 获取 4位数验证码 result= ImgValidateCodeUtil.getImgCodeBaseCode(4); // 将验证码存入redis 中(有效时长5分钟) cacheImgCode(result); } catch (Exception e) { System.out.println(e); } return result; } /** * 校验验证码 * @param imgCodeKey * @param imgCode * @return */ @GetMapping("/checkImgCode") public String checkImgCode(String imgCodeKey, String imgCode) { String cacheCode = redisTemplate.opsForValue().get(imgCodeKey); if (null == cacheCode) { return "图片验证码已过期,请重新获取"; } if (cacheCode.equals(imgCode.toLowerCase())) { return "验证码输入正确"; } return "验证码输入错误"; } /** * 将验证码存入redis 中 * @param result */ public void cacheImgCode(Map<String, String> result) { String imgCode = result.get("imgCode"); UUID randomUUID = UUID.randomUUID(); String imgCodeKey = randomUUID.toString(); System.out.println("imgCodeKey:" + imgCodeKey); // 图片验证码有效时间 :5 分钟 redisTemplate.opsForValue().set(imgCodeKey, imgCode, 5, TimeUnit.MINUTES); result.put("imgCodeKey", imgCodeKey); } }
3e0176a44e03cd64f00ef3730db1b5be0e29556f
838
java
Java
clbs/src/main/java/com/zw/platform/domain/basicinfo/LoginPersonalized.java
youyouqiu/hybrid-development
784c5227a73d1e6609b701a42ef4cdfd6400d2b7
[ "MIT" ]
1
2021-09-29T02:13:49.000Z
2021-09-29T02:13:49.000Z
clbs/src/main/java/com/zw/platform/domain/basicinfo/LoginPersonalized.java
youyouqiu/hybrid-development
784c5227a73d1e6609b701a42ef4cdfd6400d2b7
[ "MIT" ]
null
null
null
clbs/src/main/java/com/zw/platform/domain/basicinfo/LoginPersonalized.java
youyouqiu/hybrid-development
784c5227a73d1e6609b701a42ef4cdfd6400d2b7
[ "MIT" ]
null
null
null
16.431373
56
0.596659
602
package com.zw.platform.domain.basicinfo; import lombok.Data; import java.io.Serializable; /** * @author tianzhangxu * @date 2019.7.22 * “登录页个性化配置”字段对应实体类 */ @Data public class LoginPersonalized implements Serializable { private static final long serialVersionUID = 1L; /** * 输入框位置 1:居左 2:居中 3:居右 */ private Integer inputPosition; /** * logo位置 1:左上 2:右上 3:跟随输入框 */ private Integer logoPosition; /** * 备案号颜色 默认值:rgb(45,45,45) */ private String recordNumberColor; /** * 备案号阴影(描边) 默认值:rgb(255,255,255) */ private String recordNumberShadow; /** * 按钮颜色 默认值:rgb(85,101,123) */ private String buttonColor; /** * 预留颜色字段4 */ private String fourthColor; /** * 预留颜色字段5 */ private String fifthColor; }
3e0177567ae78f8ccd211633abbb6457af1b8e8a
6,568
java
Java
modules/ContentExplorer/src/test/java/it/tidalwave/northernwind/rca/ui/contentexplorer/impl/DefaultContentExplorerPresentationControlTest.java
tidalwave-it/northernwind-rca-src
5d530d4ad69b8dd3b1e628498c6bd20017e93d41
[ "Apache-2.0" ]
null
null
null
modules/ContentExplorer/src/test/java/it/tidalwave/northernwind/rca/ui/contentexplorer/impl/DefaultContentExplorerPresentationControlTest.java
tidalwave-it/northernwind-rca-src
5d530d4ad69b8dd3b1e628498c6bd20017e93d41
[ "Apache-2.0" ]
1
2021-03-02T00:07:57.000Z
2021-03-02T00:07:57.000Z
modules/ContentExplorer/src/test/java/it/tidalwave/northernwind/rca/ui/contentexplorer/impl/DefaultContentExplorerPresentationControlTest.java
tidalwave-it/northernwind-rca-src
5d530d4ad69b8dd3b1e628498c6bd20017e93d41
[ "Apache-2.0" ]
null
null
null
45.93007
120
0.558465
603
/* * #%L * ********************************************************************************************************************* * * NorthernWind - lightweight CMS * http://northernwind.tidalwave.it - git clone [email protected]:tidalwave/northernwind-rca-src.git * %% * Copyright (C) 2013 - 2021 Tidalwave s.a.s. (http://tidalwave.it) * %% * ********************************************************************************************************************* * * 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% */ package it.tidalwave.northernwind.rca.ui.contentexplorer.impl; import org.springframework.context.support.ClassPathXmlApplicationContext; import it.tidalwave.util.RoleFactory; import it.tidalwave.role.ContextManager; import it.tidalwave.role.ui.Selectable; import it.tidalwave.role.ui.spi.SimpleCompositePresentable; import it.tidalwave.messagebus.MessageBus; import it.tidalwave.messagebus.annotation.SimpleMessageSubscriber; import it.tidalwave.northernwind.core.model.Content; import it.tidalwave.northernwind.core.model.ModelFactory; import it.tidalwave.northernwind.core.model.ResourceFile; import it.tidalwave.northernwind.core.model.ResourceFileSystem; import it.tidalwave.northernwind.rca.ui.contentexplorer.ContentExplorerPresentation; import it.tidalwave.northernwind.rca.ui.event.OpenSiteEvent; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import static it.tidalwave.role.ui.PresentationModelMatcher.*; import static it.tidalwave.northernwind.rca.ui.event.ContentSelectedEventMatcher.*; import static it.tidalwave.util.Parameters.r; import static org.hamcrest.MatcherAssert.*; import static org.hamcrest.CoreMatchers.*; import static org.mockito.Mockito.*; import static org.mockito.Mockito.any; import static it.tidalwave.util.MockAs.*; import static it.tidalwave.northernwind.rca.ui.contentexplorer.impl.DefaultContentExplorerPresentationControl.*; /*********************************************************************************************************************** * * @author Fabrizio Giudici * **********************************************************************************************************************/ public class DefaultContentExplorerPresentationControlTest { private DefaultContentExplorerPresentationControl underTest; private ClassPathXmlApplicationContext context; private ContentExplorerPresentation presentation; private MessageBus messageBus; private ResourceFileSystem fileSystem; private ResourceFile root; private OpenSiteEvent openSiteEvent; private ModelFactory modelFactory; private Content content; /******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() { ContextManager.Locator.set(null); context = new ClassPathXmlApplicationContext("DefaultContentExplorerPresentationControlTestBeans.xml"); underTest = context.getBean(DefaultContentExplorerPresentationControl.class); presentation = context.getBean(ContentExplorerPresentation.class); messageBus = context.getBean(MessageBus.class); modelFactory = context.getBean(ModelFactory.class); openSiteEvent = mock(OpenSiteEvent.class); fileSystem = mock(ResourceFileSystem.class); root = mock(ResourceFile.class); content = mockWithAsSupport(Content.class, r((RoleFactory<Content>)(SimpleCompositePresentable::new))); when(fileSystem.findFileByPath(eq(ROOT_DOCUMENT_PATH))).thenReturn(root); when(openSiteEvent.getFileSystem()).thenReturn(fileSystem); // FIXME: this is cumbersome // when(modelFactory.createContent(eq(root))).thenReturn(content); FIXME!!! final Content.Builder.CallBack callBack = mock(Content.Builder.CallBack.class); when(callBack.build(any(Content.Builder.class))).thenReturn(content); when(modelFactory.createContent()).thenReturn(new Content.Builder(modelFactory, callBack)); } /******************************************************************************************************************* * ******************************************************************************************************************/ @AfterMethod public void tearDown() { context.close(); } /******************************************************************************************************************* * ******************************************************************************************************************/ @Test public void must_be_a_MessageSubscriber() { assertThat(underTest.getClass().getAnnotation(SimpleMessageSubscriber.class), is(not(nullValue()))); } /******************************************************************************************************************* * ******************************************************************************************************************/ @Test public void when_a_Site_has_been_opened_must_properly_populate_the_presentation_and_publish_an_empty_selection() { // given reset(messageBus); // when underTest.onOpenSite(openSiteEvent); // then verify(presentation).populate(argThat(presentationModel().withRole(Selectable.class))); verify(presentation).expandFirstLevel(); verifyNoMoreInteractions(presentation); verify(messageBus).publish(emptyEvent()); verifyNoMoreInteractions(messageBus); } }
3e01779947b9e63abc1cdfeab222ce585eb983d6
3,170
java
Java
app/src/main/java/com/brandonhogan/liftscout/views/SettingsHomeFragment.java
BrandonMHogan/LiftScout-Android-old
13ed1618664f52c8d6b085a44327c939769342cc
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/brandonhogan/liftscout/views/SettingsHomeFragment.java
BrandonMHogan/LiftScout-Android-old
13ed1618664f52c8d6b085a44327c939769342cc
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/brandonhogan/liftscout/views/SettingsHomeFragment.java
BrandonMHogan/LiftScout-Android-old
13ed1618664f52c8d6b085a44327c939769342cc
[ "Apache-2.0" ]
null
null
null
29.082569
103
0.705363
604
package com.brandonhogan.liftscout.views; import android.os.Bundle; import androidx.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.brandonhogan.liftscout.R; import com.brandonhogan.liftscout.injection.components.Injector; import com.brandonhogan.liftscout.interfaces.contracts.SettingsHomeContract; import com.brandonhogan.liftscout.views.base.BaseFragment; import com.jaredrummler.materialspinner.MaterialSpinner; import java.util.ArrayList; import javax.inject.Inject; import butterknife.BindView; public class SettingsHomeFragment extends BaseFragment implements SettingsHomeContract.View { @Inject SettingsHomeContract.Presenter presenter; // Instance // public static SettingsHomeFragment newInstance() { return new SettingsHomeFragment(); } // Bindings // @BindView(R.id.homeDefaultSpinner) MaterialSpinner homeDefaultSpinner; @BindView(R.id.todayTransformSpinner) MaterialSpinner transformSpinner; //Overrides // @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.frag_settings_home, container, false); Injector.getFragmentComponent().inject(this); return rootView; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); presenter.setView(this); setTitle(getResources().getString(R.string.title_frag_settings_home)); } @Override public void onResume() { super.onResume(); presenter.onResume(); } @Override public void onPause() { super.onPause(); presenter.onPause(); } @Override public void onDestroyView() { super.onDestroyView(); presenter.onDestroy(); } // Contract // @Override public void populateTransforms(ArrayList<String> themes, int position) { transformSpinner.setItems(themes); transformSpinner.setSelectedIndex(position); transformSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() { @Override public void onItemSelected(MaterialSpinner view, int position, long id, Object item) { presenter.onTransformSelected(position); } }); } @Override public void populateHomeDefaults(ArrayList<String> screens, int position) { homeDefaultSpinner.setItems(screens); homeDefaultSpinner.setSelectedIndex(position); homeDefaultSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() { @Override public void onItemSelected(MaterialSpinner view, int position, long id, Object item) { presenter.onHomeDefaultSelected(position); } }); } @Override public void saveSuccess(int message) { Toast.makeText(getActivity(), getString(message), Toast.LENGTH_SHORT).show(); } }
3e01779fef4e57e18037cce486d38c981dc620be
12,301
java
Java
src/main/java/com/amazon/sqs/javamessaging/SQSConnectionFactory.java
stanley-travelex/amazon-sqs-java-messaging-lib
b462bdceac814c56e75ee0ba638b3928ce8adee1
[ "Apache-2.0" ]
136
2015-01-02T01:30:19.000Z
2022-03-09T14:35:03.000Z
src/main/java/com/amazon/sqs/javamessaging/SQSConnectionFactory.java
stanley-travelex/amazon-sqs-java-messaging-lib
b462bdceac814c56e75ee0ba638b3928ce8adee1
[ "Apache-2.0" ]
93
2015-01-04T13:59:50.000Z
2022-03-25T16:01:01.000Z
src/main/java/com/amazon/sqs/javamessaging/SQSConnectionFactory.java
stanley-travelex/amazon-sqs-java-messaging-lib
b462bdceac814c56e75ee0ba638b3928ce8adee1
[ "Apache-2.0" ]
140
2015-02-03T10:47:16.000Z
2022-03-28T10:41:35.000Z
38.804416
139
0.684253
605
/* * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazon.sqs.javamessaging; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; import com.amazonaws.regions.Region; import com.amazonaws.regions.Regions; import com.amazonaws.services.sqs.AmazonSQS; import com.amazonaws.services.sqs.AmazonSQSClient; import com.amazonaws.services.sqs.AmazonSQSClientBuilder; /** * A ConnectionFactory object encapsulates a set of connection configuration * parameters for <code>AmazonSQSClient</code> as well as setting * <code>numberOfMessagesToPrefetch</code>. * <P> * The <code>numberOfMessagesToPrefetch</code> parameter is used to size of the * prefetched messages, which can be tuned based on the application workload. It * helps in returning messages from internal buffers(if there is any) instead of * waiting for the SQS <code>receiveMessage</code> call to return. * <P> * If more physical connections than the default maximum value (that is 50 as of * today) are needed on the connection pool, * {@link com.amazonaws.ClientConfiguration} needs to be configured. * <P> * None of the <code>createConnection</code> methods set-up the physical * connection to SQS, so validity of credentials are not checked with those * methods. */ public class SQSConnectionFactory implements ConnectionFactory, QueueConnectionFactory { private final ProviderConfiguration providerConfiguration; private final AmazonSQSClientSupplier amazonSQSClientSupplier; /* * At the time when the library will stop supporting Java 7, this can be removed and Supplier<T> from Java 8 can be used directly. */ private interface AmazonSQSClientSupplier { AmazonSQS get(); } /* * Creates a SQSConnectionFactory that uses AmazonSQSClientBuilder.standard() for creating AmazonSQS client connections. * Every SQSConnection will have its own copy of AmazonSQS client. */ public SQSConnectionFactory(ProviderConfiguration providerConfiguration) { this(providerConfiguration, AmazonSQSClientBuilder.standard()); } /* * Creates a SQSConnectionFactory that uses the provided AmazonSQS client connection. * Every SQSConnection will use the same provided AmazonSQS client. */ public SQSConnectionFactory(ProviderConfiguration providerConfiguration, final AmazonSQS client) { if (providerConfiguration == null) { throw new IllegalArgumentException("Provider configuration cannot be null"); } if (client == null) { throw new IllegalArgumentException("AmazonSQS client cannot be null"); } this.providerConfiguration = providerConfiguration; this.amazonSQSClientSupplier = new AmazonSQSClientSupplier() { @Override public AmazonSQS get() { return client; } }; } /* * Creates a SQSConnectionFactory that uses the provided AmazonSQSClientBuilder for creating AmazonSQS client connections. * Every SQSConnection will have its own copy of AmazonSQS client created through the provided builder. */ public SQSConnectionFactory(ProviderConfiguration providerConfiguration, final AmazonSQSClientBuilder clientBuilder) { if (providerConfiguration == null) { throw new IllegalArgumentException("Provider configuration cannot be null"); } if (clientBuilder == null) { throw new IllegalArgumentException("AmazonSQS client builder cannot be null"); } this.providerConfiguration = providerConfiguration; this.amazonSQSClientSupplier = new AmazonSQSClientSupplier() { @Override public AmazonSQS get() { return clientBuilder.build(); } }; } private SQSConnectionFactory(final Builder builder) { this.providerConfiguration = builder.providerConfiguration; this.amazonSQSClientSupplier = new AmazonSQSClientSupplier() { @Override public AmazonSQS get() { AmazonSQSClient amazonSQSClient = new AmazonSQSClient(builder.awsCredentialsProvider, builder.clientConfiguration); if (builder.region != null) { amazonSQSClient.setRegion(builder.region); } if (builder.endpoint != null) { amazonSQSClient.setEndpoint(builder.endpoint); } if (builder.signerRegionOverride != null) { amazonSQSClient.setSignerRegionOverride(builder.signerRegionOverride); } return amazonSQSClient; } }; } @Override public SQSConnection createConnection() throws JMSException { try { AmazonSQS amazonSQS = amazonSQSClientSupplier.get(); return createConnection(amazonSQS, null); } catch (RuntimeException e) { throw (JMSException) new JMSException("Error creating SQS client: " + e.getMessage()).initCause(e); } } @Override public SQSConnection createConnection(String awsAccessKeyId, String awsSecretKey) throws JMSException { BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(awsAccessKeyId, awsSecretKey); return createConnection(basicAWSCredentials); } public SQSConnection createConnection(AWSCredentials awsCredentials) throws JMSException { AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials); return createConnection(awsCredentialsProvider); } public SQSConnection createConnection(AWSCredentialsProvider awsCredentialsProvider) throws JMSException { try { AmazonSQS amazonSQS = amazonSQSClientSupplier.get(); return createConnection(amazonSQS, awsCredentialsProvider); } catch(Exception e) { throw (JMSException) new JMSException("Error creating SQS client: " + e.getMessage()).initCause(e); } } private SQSConnection createConnection(AmazonSQS amazonSQS, AWSCredentialsProvider awsCredentialsProvider) throws JMSException { AmazonSQSMessagingClientWrapper amazonSQSClientJMSWrapper = new AmazonSQSMessagingClientWrapper(amazonSQS, awsCredentialsProvider); return new SQSConnection(amazonSQSClientJMSWrapper, providerConfiguration.getNumberOfMessagesToPrefetch()); } @Override public QueueConnection createQueueConnection() throws JMSException { return (QueueConnection) createConnection(); } @Override public QueueConnection createQueueConnection(String userName, String password) throws JMSException { return (QueueConnection) createConnection(userName, password); } /** * Deprecated. Use one of the constructors of this class instead and provide either AmazonSQS client or AmazonSQSClientBuilder. * @return */ @Deprecated public static Builder builder() { return new Builder(); } /** * Deprecated. Use one of the constructors of SQSConnectionFactory instead. * @return */ @Deprecated public static class Builder { private Region region; private String endpoint; private String signerRegionOverride; private ClientConfiguration clientConfiguration; private AWSCredentialsProvider awsCredentialsProvider = new DefaultAWSCredentialsProviderChain(); private ProviderConfiguration providerConfiguration; public Builder(Region region) { this(); this.region = region; } /** Recommended way to set the AmazonSQSClient is to use region */ public Builder(String region) { this(Region.getRegion(Regions.fromName(region))); } public Builder() { providerConfiguration = new ProviderConfiguration(); clientConfiguration = new ClientConfiguration(); } public Builder withRegion(Region region) { setRegion(region); return this; } public Builder withRegionName(String regionName) throws IllegalArgumentException { setRegion(Region.getRegion( Regions.fromName(regionName) ) ); return this; } public Builder withEndpoint(String endpoint) { setEndpoint(endpoint); return this; } /** * An internal method used to explicitly override the internal signer region * computed by the default implementation. This method is not expected to be * normally called except for AWS internal development purposes. */ public Builder withSignerRegionOverride(String signerRegionOverride) { setSignerRegionOverride(signerRegionOverride); return this; } public Builder withAWSCredentialsProvider(AWSCredentialsProvider awsCredentialsProvider) { setAwsCredentialsProvider(awsCredentialsProvider); return this; } public Builder withClientConfiguration(ClientConfiguration clientConfig) { setClientConfiguration(clientConfig); return this; } public Builder withNumberOfMessagesToPrefetch(int numberOfMessagesToPrefetch) { providerConfiguration.setNumberOfMessagesToPrefetch(numberOfMessagesToPrefetch); return this; } public SQSConnectionFactory build() { return new SQSConnectionFactory(this); } public Region getRegion() { return region; } public void setRegion(Region region) { this.region = region; this.endpoint = null; } public void setRegionName(String regionName) { setRegion( Region.getRegion( Regions.fromName( regionName ) ) ); } public String getEndpoint() { return endpoint; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; this.region = null; } public String getSignerRegionOverride() { return signerRegionOverride; } public void setSignerRegionOverride(String signerRegionOverride) { this.signerRegionOverride = signerRegionOverride; } public ClientConfiguration getClientConfiguration() { return clientConfiguration; } public void setClientConfiguration(ClientConfiguration clientConfig) { clientConfiguration = clientConfig; } public int getNumberOfMessagesToPrefetch() { return providerConfiguration.getNumberOfMessagesToPrefetch(); } public void setNumberOfMessagesToPrefetch(int numberOfMessagesToPrefetch) { providerConfiguration.setNumberOfMessagesToPrefetch(numberOfMessagesToPrefetch); } public AWSCredentialsProvider getAwsCredentialsProvider() { return awsCredentialsProvider; } public void setAwsCredentialsProvider( AWSCredentialsProvider awsCredentialsProvider) { this.awsCredentialsProvider = awsCredentialsProvider; } } }
3e0177debefaa11c6491319ffe405e5f4e37c758
11,213
java
Java
ou-util/src/main/java/com/ou/generator/service/impl/AutoGeneratorServiceImpl.java
vinceDa/ououou-admin
421acd25967ac0324c80fdd144b379e7ca01fc34
[ "Apache-2.0" ]
null
null
null
ou-util/src/main/java/com/ou/generator/service/impl/AutoGeneratorServiceImpl.java
vinceDa/ououou-admin
421acd25967ac0324c80fdd144b379e7ca01fc34
[ "Apache-2.0" ]
null
null
null
ou-util/src/main/java/com/ou/generator/service/impl/AutoGeneratorServiceImpl.java
vinceDa/ououou-admin
421acd25967ac0324c80fdd144b379e7ca01fc34
[ "Apache-2.0" ]
null
null
null
39.762411
192
0.603318
606
package com.ou.generator.service.impl; import cn.hutool.core.convert.Convert; import cn.hutool.core.io.FileUtil; import cn.hutool.core.lang.TypeReference; import cn.hutool.core.util.ZipUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.ou.common.exception.BadRequestException; import com.ou.generator.domain.GeneratorConfig; import com.ou.generator.domain.GeneratorContent; import com.ou.generator.domain.GeneratorSetting; import com.ou.generator.domain.GeneratorTableInfo; import com.ou.generator.service.AutoGeneratorService; import freemarker.template.Configuration; import freemarker.template.Template; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpException; import org.springframework.stereotype.Service; import org.springframework.util.ResourceUtils; import java.io.*; import java.net.HttpURLConnection; import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.nio.charset.Charset; import java.sql.*; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; /** * @author vince * @date 2019/12/30 20:13 */ @Slf4j @Service public class AutoGeneratorServiceImpl implements AutoGeneratorService { @Override public String generateCode(List<String> tables, GeneratorSetting setting) { String uuid = UUID.randomUUID().toString().replace("-", ""); String rootDir = File.separator + "template" + File.separator + uuid + File.separator; try { // 解析配置文件 String configPath = "http://47.106.148.107/config/Config.json"; // 创建url对象 URL urlObj = new URL(configPath); // 创建HttpURLConnection对象,通过这个对象打开跟远程服务器之间的连接 HttpURLConnection httpConn = (HttpURLConnection) urlObj.openConnection(); httpConn.setDoInput(true); httpConn.setRequestMethod("GET"); httpConn.setConnectTimeout(5000); // 服务器有响应后,会将访问的url页面中的内容放进inputStream中,使用httpConn就可以获取到这个字节流 InputStream inStream = httpConn.getInputStream(); byte[] bytes = new byte[inStream.available()]; inStream.read(bytes); String jsonContent = new String(bytes); GeneratorConfig config = Convert.convert(GeneratorConfig.class, JSONUtil.parseObj(jsonContent)); for (String tableName : tables) { List<GeneratorTableInfo> tableInfos = listTableInfos(tableName); for (GeneratorTableInfo single : tableInfos) { single.setColumnHumpName(nameToHump(single.getColumnName(), false)); single.setJavaDataType(getPackagingTypeByDbType(single.getDataType())); } generateCodeByFreemarker(config,tableName, setting, tableInfos, rootDir); } File zip = ZipUtil.zip(rootDir); log.info("zip result: {}", zip.exists()); return rootDir; } catch (Exception e) { e.printStackTrace(); } return null; } /** * 根据模板生成代码 * @param tableName 表名 * @param setting 配置信息 * @param tableInfos 表信息(字段名, 字段类型...) * @param rootDir 文件所属目录 */ private void generateCodeByFreemarker(GeneratorConfig config, String tableName, GeneratorSetting setting, List<GeneratorTableInfo> tableInfos, String rootDir) { LocalDateTime date = LocalDateTime.now(); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy/MM/dd hh:mm:ss"); String dateFormat = date.format(dateTimeFormatter); // 实体类英文名根据表名大驼峰命名 String entityName = nameToHump(tableName, true); // 实体类中文名设置为前端可配置, 用于接口的描述信息, 将来可用于swagger文档的接口描述 // tableInfos // step1 创建freeMarker配置实例 Configuration configuration = new Configuration(Configuration.VERSION_2_3_29); Writer out = null; try { String remoteFreemarkerPath = config.getFreemarkerPath(); // 获取模版路径 String freemarkerPath = ResourceUtils.getURL("classpath:" + remoteFreemarkerPath).getPath(); configuration.setDirectoryForTemplateLoading(new File(freemarkerPath)); // 创建数据模型 Map<String, Object> dataMap = new HashMap<>(7); String packageName = setting.getPackageName(); dataMap.put("tableInfos", tableInfos); dataMap.put("author", setting.getAuthor()); dataMap.put("date", dateFormat); dataMap.put("package", packageName); dataMap.put("tableName", tableName); dataMap.put("entityName", entityName); File templateDir = new File(freemarkerPath); List<GeneratorContent> content = config.getContent(); String packagePrefix = config.getPackagePrefix(); packagePrefix = completeFormat(packagePrefix); for (GeneratorContent singleContent : content) { String suffix = singleContent.getSuffix(); // step4 加载模版文件 String singleContentPackageName = singleContent.getPackageName(); String fileType = singleContent.getFileType(); String packagePath = completeFormat(packageName); // 当前文件的所属绝对路径 String absolutePath = rootDir + packagePrefix + packagePath + singleContentPackageName; String filename = entityName + suffix + "." + fileType; String templatePath = freemarkerPath + singleContent.getTemplateName(); log.info("templatePath: {}", templatePath); Template template = configuration.getTemplate(singleContent.getTemplateName()); // step5 生成数据 String outputPath = absolutePath.replace(".", File.separator); File mkdir = FileUtil.mkdir(outputPath); log.info("mkdir path: {}, mkdir exist: {}", mkdir.getPath(), mkdir.exists()); outputPath = outputPath + File.separator + filename; File docFile = new File(outputPath); out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(docFile))); // step6 输出文件 template.process(dataMap, out); } File[] templates = templateDir.listFiles(); if (templates == null) { throw new BadRequestException("error template dir path"); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (null != out) { out.flush(); } } catch (Exception e2) { e2.printStackTrace(); } } } /** * 将传入的字符串补全为所需的格式,此处为保证末尾有 "." */ private String completeFormat(String target) { target = target.endsWith("\\.") ? target : target + "\\."; return target; } private List<GeneratorTableInfo> listTableInfos(String tableName) { List<GeneratorTableInfo> tableInfos = null; try { Class.forName("com.mysql.cj.jdbc.Driver"); // useOldAliasMetadataBehavior=true 使得别名生效 String url = "jdbc:mysql://localhost:3306/meteorite?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&useOldAliasMetadataBehavior=true"; Connection connection = DriverManager.getConnection(url, "root", "123456"); List<Map<String, Object>> result = new ArrayList<>(); String listTablesSql = "select COLUMN_NAME columnName, IS_NULLABLE isNullable, DATA_TYPE dataType,COLUMN_COMMENT columnComment " + "from information_schema.columns where table_name = ?"; PreparedStatement listTables = connection.prepareStatement(listTablesSql); listTables.setString(1, tableName); ResultSet resultSet = listTables.executeQuery(); ResultSetMetaData md = resultSet.getMetaData();//获取键名 int columnCount = md.getColumnCount();//获取行的数量 while (resultSet.next()) { Map<String, Object> rowData = new HashMap<>();//声明Map for (int i = 1; i <= columnCount; i++) { // 获取键名及值 rowData.put(md.getColumnName(i), resultSet.getObject(i)); } result.add(rowData); } tableInfos = Convert.convert(new TypeReference<List<GeneratorTableInfo>>() {}, result); } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } return tableInfos; } /** * 根据数据库类型获取包装类型 * * @param type * 数据库类型 * @return 包装类型 */ private String getPackagingTypeByDbType(String type) { String packingType; if (type.contains("bigint")) { packingType = "Long"; } else if (type.contains("char")) { packingType = "String"; } else if (type.contains("time")) { packingType = "LocalDateTime"; } else if (type.contains("tinyint(1)")) { packingType = "Boolean"; } else { packingType = "Integer"; } return packingType; } /** * 大驼峰转路径, 用于将使用DaoImpl.ftl生成的文件至于dao.impl的目录下 */ private String upperCamelCaseToPath(String origin) { List<Integer> upperCameCaseIndexList = new ArrayList<>(); char[] chars = origin.toCharArray(); for (int i = 0; i < chars.length; i++) { if (Character.isUpperCase(chars[i]) && i != 0) { upperCameCaseIndexList.add(i); } } StringBuilder sb = new StringBuilder(origin.toLowerCase()); for (Integer index : upperCameCaseIndexList) { sb.insert(index, "."); } return sb.toString(); } /** * 根据路径生成所有的文件夹 * @param path 路径 */ private void mkdirs(String path) { if (!FileUtil.exist(path)) { File mkdir = FileUtil.mkdir(path); log.info("mkdir path: {}, exist: {}", mkdir.getPath(), mkdir.exists()); } else { log.info("path: {} is already exist", path); } } /** * 下划线命名转驼峰 xx_yy -> XxYy /xxYy * * @param name * 源值 * @param isUpperCamelCase * 是否转为大驼峰, 否则为小驼峰 * @return 转换后的值 */ private String nameToHump(String name, Boolean isUpperCamelCase) { StringBuilder entityName = new StringBuilder(); String[] strings = name.split("_"); for (int i = 0; i < strings.length; i++) { String single = strings[i].toLowerCase(); single = (i == 0 && !isUpperCamelCase) ? single : captureName(single); entityName.append(single); } return entityName.toString(); } /** * 首字母大写 * * @param name * 原值 * @return 转换后的值 */ private String captureName(String name) { char[] cs = name.toCharArray(); cs[0] -= 32; return String.valueOf(cs); } }
3e0177e35eeb54cbcb029804087222efbbc757fe
2,570
java
Java
src/main/java/com/revature/mikeworks/drivers/CustomerDirectoryDriver.java
Michael-Kochis/Revature-eBank
125fc215fb21ec2443804f3509dc5d07afee945f
[ "MIT" ]
null
null
null
src/main/java/com/revature/mikeworks/drivers/CustomerDirectoryDriver.java
Michael-Kochis/Revature-eBank
125fc215fb21ec2443804f3509dc5d07afee945f
[ "MIT" ]
null
null
null
src/main/java/com/revature/mikeworks/drivers/CustomerDirectoryDriver.java
Michael-Kochis/Revature-eBank
125fc215fb21ec2443804f3509dc5d07afee945f
[ "MIT" ]
null
null
null
34.72973
95
0.648249
607
package com.revature.mikeworks.drivers; import com.revature.mikeworks.components.BankData; import com.revature.mikeworks.controllers.CustomerDirectoryMenuController; import com.revature.mikeworks.dao.CustomerDAO; import com.revature.mikeworks.handlers.CustomerHandler; import com.revature.mikeworks.utils.ValidScanner; public class CustomerDirectoryDriver { private static boolean looping; private static CustomerHandler cHandler = BankData.getCHandler(); private static CustomerDirectoryMenuController cdc = new CustomerDirectoryMenuController(); private static ValidScanner scan = new ValidScanner(); public void doMain() { looping = true; while (looping) { System.out.println(BankData.getWhoAmI().toString() ); int option = cdc.readOption(); mainStep(option); } } private void mainStep(int option) { switch (option) { case (1) -> doUpdateUsername(); case (2) -> doUpdatePassword(); case (3) -> doUpdateFirstName(); case (4) -> doUpdateLastName(); case (5) -> doUpdateEmail(); default -> looping = false; } } private void doUpdateEmail() { System.out.println("Enter your new email"); String neoMail = scan.readString(); BankData.getWhoAmI().setEmail(neoMail); cHandler.writeCustomer(BankData.getWhoAmI()); } private void doUpdateLastName() { System.out.println("Enter your new last name"); String neoName = scan.readString(); BankData.getWhoAmI().setLastName(neoName); cHandler.writeCustomer(BankData.getWhoAmI()); } private void doUpdateFirstName() { System.out.println("Enter your new first name"); String neoName = scan.readString(); BankData.getWhoAmI().setFirstName(neoName); cHandler.writeCustomer(BankData.getWhoAmI()); } private void doUpdatePassword() { System.out.println("Enter your new password"); String neoPass = scan.readString(); BankData.getWhoAmI().setPassword(neoPass); cHandler.writeCustomer(BankData.getWhoAmI()); } private void doUpdateUsername() { System.out.println("Enter your new username"); String neoName = scan.readString(); if (cHandler.contains(neoName)) { System.out.println("That name is taken."); } else { BankData.getWhoAmI().setUsername(neoName); cHandler.writeCustomer(BankData.getWhoAmI()); } } }
3e017837e0ba63d6b4a54871b10c87d7fc3a6a5e
1,519
java
Java
src/test/java/com/gildedrose/BackstagePassesTest.java
lucasosuza/GildedRose-Refactoring-Kata
eb27a3270d058b6c1e18b36061d4c6ffee2afbdd
[ "MIT" ]
null
null
null
src/test/java/com/gildedrose/BackstagePassesTest.java
lucasosuza/GildedRose-Refactoring-Kata
eb27a3270d058b6c1e18b36061d4c6ffee2afbdd
[ "MIT" ]
null
null
null
src/test/java/com/gildedrose/BackstagePassesTest.java
lucasosuza/GildedRose-Refactoring-Kata
eb27a3270d058b6c1e18b36061d4c6ffee2afbdd
[ "MIT" ]
null
null
null
44.676471
136
0.74391
608
package com.gildedrose; import org.junit.Test; import static org.junit.Assert.assertEquals; public class BackstagePassesTest { @Test public void backstagePassesShouldIncreseQualityOverTime() { GildedRose app = GildedRoseTest.buildGuildedRoseAndUpdateQuality(new Item("Backstage passes to a TAFKAL80ETC concert", 12, 10)); assertEquals("The quality of Backstage passes has to increase", 11, app.items[0].quality); } @Test public void backstagePassesShouldIncreseQualityBy2At10DaysOrLess() { GildedRose app = GildedRoseTest.buildGuildedRoseAndUpdateQuality(new Item("Backstage passes to a TAFKAL80ETC concert", 10, 10)); assertEquals("The quality of Backstage passes has to increase by 2 when there are 10 days or less", 12, app.items[0].quality); } @Test public void backstagePassesShouldIncreseQualityBy3At5DaysOrLess() { GildedRose app = GildedRoseTest.buildGuildedRoseAndUpdateQuality(new Item("Backstage passes to a TAFKAL80ETC concert", 5, 10)); assertEquals("The quality of Backstage passes has to increase by 3 when there are 5 days or less", 13, app.items[0].quality); } @Test public void backstagePassesQualityShouldDropToZeroAfterConcert() { GildedRose app = GildedRoseTest.buildGuildedRoseAndUpdateQuality(new Item("Backstage passes to a TAFKAL80ETC concert", 0, 10)); assertEquals("The quality of Backstage passes should drop to zero after the concert", 0, app.items[0].quality); } }
3e0178b202038125f24b10f0843fdc7936e1255f
757
java
Java
src/main/java/cn/chain33/javasdk/model/decode/DecodeSignature.java
harrylee2015/chain33-sdk-java
d0ecec78fd19cb46fbaf82c03530ad80f048f18e
[ "BSD-2-Clause" ]
18
2018-11-13T06:59:53.000Z
2021-11-24T11:22:35.000Z
src/main/java/cn/chain33/javasdk/model/decode/DecodeSignature.java
harrylee2015/chain33-sdk-java
d0ecec78fd19cb46fbaf82c03530ad80f048f18e
[ "BSD-2-Clause" ]
15
2020-02-12T07:39:27.000Z
2022-01-25T08:58:43.000Z
src/main/java/cn/chain33/javasdk/model/decode/DecodeSignature.java
harrylee2015/chain33-sdk-java
d0ecec78fd19cb46fbaf82c03530ad80f048f18e
[ "BSD-2-Clause" ]
20
2018-11-29T08:46:42.000Z
2022-03-03T07:14:31.000Z
18.02381
101
0.575958
609
package cn.chain33.javasdk.model.decode; public class DecodeSignature { private Integer ty; private String signature; private String pubkey; public Integer getTy() { return ty; } public void setTy(Integer ty) { this.ty = ty; } public String getSignature() { return signature; } public void setSignature(String signature) { this.signature = signature; } public String getPubkey() { return pubkey; } public void setPubkey(String pubkey) { this.pubkey = pubkey; } @Override public String toString() { return "DecodeSignature [ty=" + ty + ", signature=" + signature + ", pubkey=" + pubkey + "]"; } }
3e017953628ea252ed3f5fa4832c1f6a249d2388
8,871
java
Java
app/connector/google-calendar/src/main/java/io/syndesis/connector/calendar/GoogleCalendarUpdateEventCustomizer.java
wyvie/syndesis
1e9c0af08c6ed65c5a82f501317ff5c7b7b15378
[ "Apache-2.0" ]
null
null
null
app/connector/google-calendar/src/main/java/io/syndesis/connector/calendar/GoogleCalendarUpdateEventCustomizer.java
wyvie/syndesis
1e9c0af08c6ed65c5a82f501317ff5c7b7b15378
[ "Apache-2.0" ]
1
2018-12-03T22:37:02.000Z
2018-12-03T22:37:02.000Z
app/connector/google-calendar/src/main/java/io/syndesis/connector/calendar/GoogleCalendarUpdateEventCustomizer.java
wyvie/syndesis
1e9c0af08c6ed65c5a82f501317ff5c7b7b15378
[ "Apache-2.0" ]
null
null
null
45.963731
198
0.660918
610
/* * Copyright (C) 2016 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.syndesis.connector.calendar; import static io.syndesis.connector.calendar.utils.GoogleCalendarUtils.getAttendeesList; import static io.syndesis.connector.calendar.utils.GoogleCalendarUtils.getAttendeesString; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.Map; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.component.google.calendar.internal.CalendarEventsApiMethod; import org.apache.camel.component.google.calendar.internal.GoogleCalendarApiCollection; import org.apache.camel.util.ObjectHelper; import com.google.api.client.util.DateTime; import com.google.api.services.calendar.model.Event; import com.google.api.services.calendar.model.EventDateTime; import io.syndesis.connector.support.util.ConnectorOptions; import io.syndesis.integration.component.proxy.ComponentProxyComponent; import io.syndesis.integration.component.proxy.ComponentProxyCustomizer; public class GoogleCalendarUpdateEventCustomizer implements ComponentProxyCustomizer { private String description; private String summary; private String attendees; private String calendarId; private String eventId; private String startDate; private String endDate; private String startTime; private String endTime; private String location; @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); component.setAfterProducer(this::afterProducer); } private void setApiMethod(Map<String, Object> options) { description = ConnectorOptions.extractOption(options, "description"); summary = ConnectorOptions.extractOption(options, "summary"); calendarId = ConnectorOptions.extractOption(options, "calendarId"); eventId = ConnectorOptions.extractOption(options, "eventId"); attendees = ConnectorOptions.extractOption(options, "attendees"); startDate = ConnectorOptions.extractOption(options, "startDate"); endDate = ConnectorOptions.extractOption(options, "endDate"); startTime = ConnectorOptions.extractOption(options, "startTime"); endTime = ConnectorOptions.extractOption(options, "endTime"); location = ConnectorOptions.extractOption(options, "location"); options.put("apiName", GoogleCalendarApiCollection.getCollection().getApiName(CalendarEventsApiMethod.class).getName()); options.put("methodName", "update"); } @SuppressWarnings("PMD.NPathComplexity") private void beforeProducer(Exchange exchange) throws ParseException { final Message in = exchange.getIn(); final GoogleCalendarEventModel event = exchange.getIn().getBody(GoogleCalendarEventModel.class); if (event != null) { if (ObjectHelper.isNotEmpty(event.getTitle())) { summary = event.getTitle(); } if (ObjectHelper.isNotEmpty(event.getDescription())) { description = event.getDescription(); } if (ObjectHelper.isNotEmpty(event.getAttendees())) { attendees = event.getAttendees(); } if (ObjectHelper.isNotEmpty(event.getStartDate())) { startDate = event.getStartDate(); } if (ObjectHelper.isNotEmpty(event.getStartTime())) { startTime = event.getStartTime(); } if (ObjectHelper.isNotEmpty(event.getEndDate())) { endDate = event.getEndDate(); } if (ObjectHelper.isNotEmpty(event.getEndTime())) { endTime = event.getEndTime(); } if (ObjectHelper.isNotEmpty(event.getLocation())) { location = event.getLocation(); } if (ObjectHelper.isNotEmpty(event.getEventId())) { eventId = event.getEventId(); } } in.setHeader("CamelGoogleCalendar.content", createGoogleEvent(summary, description, attendees, startDate, startTime, endDate, endTime, location)); in.setHeader("CamelGoogleCalendar.eventId", eventId); in.setHeader("CamelGoogleCalendar.calendarId", calendarId); } @SuppressWarnings("PMD.NPathComplexity") private void afterProducer(Exchange exchange) { final Message in = exchange.getIn(); final Event event = exchange.getIn().getBody(Event.class); GoogleCalendarEventModel model = new GoogleCalendarEventModel(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); DateFormat timeFormat = new SimpleDateFormat("HH:mm", Locale.getDefault()); if (event != null) { if (ObjectHelper.isNotEmpty(event.getSummary())) { model.setTitle(event.getSummary()); } if (ObjectHelper.isNotEmpty(event.getDescription())) { model.setDescription(event.getDescription()); } if (ObjectHelper.isNotEmpty(event.getAttendees())) { model.setAttendees(getAttendeesString(event.getAttendees())); } if (ObjectHelper.isNotEmpty(event.getStart())) { if (event.getStart().getDateTime() != null) { model.setStartDate(dateFormat.format(new Date(event.getStart().getDateTime().getValue()))); model.setStartTime(timeFormat.format(new Date(event.getStart().getDateTime().getValue()))); } else { model.setStartDate(dateFormat.format(new Date(event.getStart().getDate().getValue()))); } } if (ObjectHelper.isNotEmpty(event.getEnd())) { if (event.getEnd().getDateTime() != null) { model.setEndDate(dateFormat.format(new Date(event.getEnd().getDateTime().getValue()))); model.setEndTime(timeFormat.format(new Date(event.getEnd().getDateTime().getValue()))); } else { model.setEndDate(dateFormat.format(new Date(event.getEnd().getDate().getValue()))); } } if (ObjectHelper.isNotEmpty(event.getLocation())) { model.setLocation(event.getLocation()); } if (ObjectHelper.isNotEmpty(event.getId())) { model.setEventId(event.getId()); } } in.setBody(model); } private Event createGoogleEvent(String summary, String description, String attendees, String startDate, String startTime, String endDate, String endTime, String location) throws ParseException { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault()); Event event = new Event(); event.setSummary(summary); event.setDescription(description); event.setAttendees(getAttendeesList(attendees)); String composedTime; if (ObjectHelper.isNotEmpty(startTime)) { composedTime = startDate + " " + startTime; Date startMidDate = dateFormat.parse(composedTime); DateTime start = new DateTime(startMidDate); event.setStart(new EventDateTime().setDateTime(start)); } else { composedTime = startDate; DateTime startDateTime = new DateTime(composedTime); EventDateTime startEventDateTime = new EventDateTime().setDate(startDateTime); event.setStart(startEventDateTime); } if (ObjectHelper.isNotEmpty(endTime)) { composedTime = endDate + " " + endTime; Date endMidDate = dateFormat.parse(composedTime); DateTime end = new DateTime(endMidDate); event.setEnd(new EventDateTime().setDateTime(end)); } else { composedTime = endDate; DateTime endDateTime = new DateTime(composedTime); EventDateTime endEventDateTime = new EventDateTime().setDate(endDateTime); event.setEnd(endEventDateTime); } event.setLocation(location); return event; } }
3e017a038285ed9d0810d6c763ba242e6496a78e
5,485
java
Java
tcmj/commons-basic/src/main/java/com/tcmj/common/date/Range.java
tcmj/javaone
26cd2805c4d75ae9cc2e6fdf2cfa42ba17b7c128
[ "MIT" ]
2
2015-01-29T01:18:50.000Z
2015-11-19T19:33:37.000Z
tcmj/commons-basic/src/main/java/com/tcmj/common/date/Range.java
tcmj/javaone
26cd2805c4d75ae9cc2e6fdf2cfa42ba17b7c128
[ "MIT" ]
null
null
null
tcmj/commons-basic/src/main/java/com/tcmj/common/date/Range.java
tcmj/javaone
26cd2805c4d75ae9cc2e6fdf2cfa42ba17b7c128
[ "MIT" ]
null
null
null
36.357616
148
0.62623
611
package com.tcmj.common.date; import static java.lang.Integer.MAX_VALUE; import static java.lang.Integer.MIN_VALUE; /** * A range is defined by a begin and an end. It allows checking whether a value is within the range or outside. A range can be open at one or both * ends, i. e. the range is assumed to be endless in that direction. * * @author Markus KARG ([email protected]) * @version 1.2.1 * @param <T> any comparable object */ public final class Range<T extends Comparable<T>> { private final T lowerBound; private final T upperBound; /** * Creates a range with the specified bounds. The bounds will be included, i. e. are part of the range. Bounds can be declared as being open, i. * e. the range is assumed to be endless in that direction. * * @param lowerBound The lowest possible value of the range, or {@code null} if there is no lower bound. * @param upperBound The greatest possible value of the range, or {@code null} if there is no upper bound. * @throws IllegalArgumentException if lower bound is greater than upper bound */ public Range(final T lowerBound, final T upperBound) { if (lowerBound != null && upperBound != null && lowerBound.compareTo(upperBound) > 0) { throw new IllegalArgumentException("lowerBound is greater than upperBound"); } this.lowerBound = lowerBound; this.upperBound = upperBound; } /** * Checks whether the specified object is within the range, including bounds. * * throws IllegalArgumentException if {@code object} is {@code null}. * @param object The object to be checked. Must not be {@code null}. * @return {@code false} if {@code object} is lower than the lower bound or greater than the upper bound; otherwise {@code true}. */ public boolean contains(final T object) { if (object == null) { throw new IllegalArgumentException("object is null"); } if (this.lowerBound != null && object.compareTo(this.lowerBound) < 0) { return false; } if (this.upperBound != null && object.compareTo(this.upperBound) > 0) { return false; } return true; } /** * Checks whether the specified range is entirely contained in the range, including bounds. * * throws IllegalArgumentException if {@code other} is {@code null}. * @param range The range to be checked. Must not be {@code null}. * @return {@code false} if {@code range} has a lower bound lower than the lower bound of this or an upper bound greater than the upper bound of * this (i. e. {@code other} overlaps or is completely outside); otherwise {@code true}. * @since 1.1.0 */ public boolean contains(final Range<T> range) { if (range == null) { throw new IllegalArgumentException("range is null"); } if (this.lowerBound != null && (range.lowerBound == null || range.lowerBound.compareTo(this.lowerBound) < 0)) { return false; } if (this.upperBound != null && (range.upperBound == null || range.upperBound.compareTo(this.upperBound) > 0)) { return false; } return true; } /** * Checks whether the specified range overlaps this range (i. e. whether the ranges intersect). * * throws IllegalArgumentException if {@code range} is {@code null}. * @param range The {@code range} to be checked. Must not be {@code null}. * @return {@code false} if {@code range} has an upper bound lower than the lower bound of this or a lower bound greater than the upper bound of * this; otherwise {@code true}. * @since 1.2.0 */ public boolean overlaps(final Range<T> range) { if (range == null) { throw new IllegalArgumentException("range is null"); } if (this.upperBound != null && range.lowerBound != null && this.upperBound.compareTo(range.lowerBound) < 0) { return false; } if (this.lowerBound != null && range.upperBound != null && this.lowerBound.compareTo(range.upperBound) > 0) { return false; } return true; } @Override public int hashCode() { // MAX_value is used for open LOWER bound as it will be most far away // from any existing LOWER bound. final int lowerBoundHashCode = this.lowerBound == null ? MAX_VALUE : this.lowerBound.hashCode(); // MIN_value is used for open UPPER bound as it will be most far away // from any existing UPPER bound. final int upperBoundHashCode = this.upperBound == null ? MIN_VALUE : this.upperBound.hashCode(); return lowerBoundHashCode << 16 ^ upperBoundHashCode; } @Override public boolean equals(final Object other) { if (!(other instanceof Range)) { return false; } final Range<?> that = (Range<?>) other; return equals(this.lowerBound, that.lowerBound) && equals(this.upperBound, that.upperBound); } private static boolean equals(final Object a, final Object b) { if (a == null && b == null) { return true; } if (a != null && b != null) { return a.equals(b); } return false; } @Override public String toString() { return String.format("Range[%s, %s]", this.lowerBound, this.upperBound); } }
3e017bef02d942a6e512d05ad97dd0464c76316f
1,046
java
Java
febs-server/febs-server-test/src/main/java/cc/mrbird/febs/server/test/feign/IRemoteUserService.java
yhaoooooooo/FEBS-Cloud
68255e7b3930361a1f22a4c261c8592a02e9b84d
[ "Apache-2.0" ]
923
2020-06-12T17:08:14.000Z
2022-03-31T06:55:00.000Z
febs-server/febs-server-test/src/main/java/cc/mrbird/febs/server/test/feign/IRemoteUserService.java
yhaoooooooo/FEBS-Cloud
68255e7b3930361a1f22a4c261c8592a02e9b84d
[ "Apache-2.0" ]
33
2020-06-17T12:48:56.000Z
2022-02-07T14:12:18.000Z
febs-server/febs-server-test/src/main/java/cc/mrbird/febs/server/test/feign/IRemoteUserService.java
yhaoooooooo/FEBS-Cloud
68255e7b3930361a1f22a4c261c8592a02e9b84d
[ "Apache-2.0" ]
420
2020-06-15T06:25:51.000Z
2022-03-24T12:55:35.000Z
37.357143
143
0.777247
612
package cc.mrbird.febs.server.test.feign; import cc.mrbird.febs.common.core.entity.FebsResponse; import cc.mrbird.febs.common.core.entity.QueryRequest; import cc.mrbird.febs.common.core.entity.constant.FebsServerConstant; import cc.mrbird.febs.common.core.entity.system.SystemUser; import cc.mrbird.febs.server.test.feign.fallback.RemoteUserServiceFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; /** * @author MrBird */ @FeignClient(value = FebsServerConstant.FEBS_SERVER_SYSTEM, contextId = "userServiceClient", fallbackFactory = RemoteUserServiceFallback.class) public interface IRemoteUserService { /** * remote /user endpoint * * @param queryRequest queryRequest * @param user user * @return FebsResponse */ @GetMapping("user") FebsResponse userList(@RequestParam("queryRequest") QueryRequest queryRequest, @RequestParam("user") SystemUser user); }
3e017c0e660cd5f00621696791feda153e799bf1
1,551
java
Java
neptune-export/src/main/java/com/amazonaws/services/neptune/profiles/neptune_ml/v2/config/DatetimeConfigV2.java
gokhaled89/amazon-neptune-tools
7c1a9e8d20fec99ae5e7e3fb55b594416e078aff
[ "Apache-2.0" ]
223
2018-04-12T10:12:43.000Z
2022-03-29T13:41:37.000Z
neptune-export/src/main/java/com/amazonaws/services/neptune/profiles/neptune_ml/v2/config/DatetimeConfigV2.java
gokhaled89/amazon-neptune-tools
7c1a9e8d20fec99ae5e7e3fb55b594416e078aff
[ "Apache-2.0" ]
65
2018-08-29T05:43:30.000Z
2022-03-29T18:20:31.000Z
neptune-export/src/main/java/com/amazonaws/services/neptune/profiles/neptune_ml/v2/config/DatetimeConfigV2.java
gokhaled89/amazon-neptune-tools
7c1a9e8d20fec99ae5e7e3fb55b594416e078aff
[ "Apache-2.0" ]
107
2018-07-05T05:01:49.000Z
2022-03-19T00:46:21.000Z
29.826923
101
0.684075
613
/* Copyright 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://www.apache.org/licenses/LICENSE-2.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.neptune.profiles.neptune_ml.v2.config; import com.amazonaws.services.neptune.propertygraph.Label; import java.util.Collection; public class DatetimeConfigV2 { private final Label label; private final String property; private final Collection<DatetimePartV2> datetimeParts; public DatetimeConfigV2(Label label, String property, Collection<DatetimePartV2> datetimeParts) { this.label = label; this.property = property; this.datetimeParts = datetimeParts; } public Label label() { return label; } public String property() { return property; } public Collection<DatetimePartV2> datetimeParts() { return datetimeParts; } @Override public String toString() { return "DatetimeConfigV2{" + "label=" + label + ", property='" + property + '\'' + ", datetimeParts=" + datetimeParts + '}'; } }
3e017c5bea35a044a744496a98367a4719181e30
527
java
Java
src/main/java/com/ymcsoft/logging/util/ProxyFactory.java
ymcsoft/logging-utils
33f51e90f237079d8da316955d31a9dc1c094f92
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ymcsoft/logging/util/ProxyFactory.java
ymcsoft/logging-utils
33f51e90f237079d8da316955d31a9dc1c094f92
[ "Apache-2.0" ]
1
2022-03-31T20:37:25.000Z
2022-03-31T20:37:25.000Z
src/main/java/com/ymcsoft/logging/util/ProxyFactory.java
ymcsoft/logging-utils
33f51e90f237079d8da316955d31a9dc1c094f92
[ "Apache-2.0" ]
null
null
null
29.277778
74
0.603416
614
package com.ymcsoft.logging.util; import java.lang.reflect.Proxy; public class ProxyFactory { public static final <T> T create(T obj) { return (T) Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new LoggingProxy(obj)); } public static final <T,R> R create(T obj, Class<R>... iface) { return (R) Proxy.newProxyInstance(obj.getClass().getClassLoader(), iface, new LoggingProxy(obj)); } }
3e017c69b6f2277701f2a31e2ca3d092f2239aa6
21,293
java
Java
modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSession.java
treelab/ignite
ec89c8586df89899ae56ebbc598639e0afea5901
[ "CC0-1.0" ]
4,339
2015-08-21T21:13:25.000Z
2022-03-30T09:56:44.000Z
modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSession.java
treelab/ignite
ec89c8586df89899ae56ebbc598639e0afea5901
[ "CC0-1.0" ]
1,933
2015-08-24T11:37:40.000Z
2022-03-31T08:37:08.000Z
modules/core/src/main/java/org/apache/ignite/compute/ComputeTaskSession.java
treelab/ignite
ec89c8586df89899ae56ebbc598639e0afea5901
[ "CC0-1.0" ]
2,140
2015-08-21T22:09:00.000Z
2022-03-25T07:57:34.000Z
47.957207
134
0.707416
615
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ignite.compute; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.UUID; import org.apache.ignite.IgniteException; import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.lang.IgniteUuid; import org.jetbrains.annotations.Nullable; /** * Defines a distributed session for particular task execution. * <h1 class="header">Description</h1> * This interface defines a distributed session that exists for particular task * execution. Task session is distributed across the parent task and all grid * jobs spawned by it, so attributes set on a task or on a job can be viewed on * other jobs. Correspondingly attributes set on any of the jobs can also be * viewed on a task. * <p> * Session has 2 main features: {@code attribute} and {@code checkpoint} * management. Both attributes and checkpoints can be used from task itself and * from the jobs belonging to this task. Session attributes and checkpoints can * be set from any task or job methods. Session attribute and checkpoint consistency * is fault tolerant and is preserved whenever a job gets failed over to * another node for execution. Whenever task execution ends, all checkpoints * saved within session with {@link ComputeTaskSessionScope#SESSION_SCOPE} scope * will be removed from checkpoint storage. Checkpoints saved with * {@link ComputeTaskSessionScope#GLOBAL_SCOPE} will outlive the session and * can be viewed by other tasks. * <p> * The sequence in which session attributes are set is consistent across * the task and all job siblings within it. There will never be a * case when one job sees attribute A before attribute B, and another job sees * attribute B before A. Attribute order is identical across all session * participants. Attribute order is also fault tolerant and is preserved * whenever a job gets failed over to another node. * <p> * <h1 class="header">Connected Tasks</h1> * Note that apart from setting and getting session attributes, tasks or * jobs can choose to wait for a certain attribute to be set using any of * the {@code waitForAttribute(...)} methods. Tasks and jobs can also * receive asynchronous notifications about a certain attribute being set * through {@link ComputeTaskSessionAttributeListener} listener. Such feature * allows grid jobs and tasks remain <u><i>connected</i></u> in order * to synchronize their execution with each other and opens a solution for a * whole new range of problems. * <p> * Imagine for example that you need to compress a very large file (let's say * terabytes in size). To do that in grid environment you would split such * file into multiple sections and assign every section to a remote job for * execution. Every job would have to scan its section to look for repetition * patterns. Once this scan is done by all jobs in parallel, jobs would need to * synchronize their results with their siblings so compression would happen * consistently across the whole file. This can be achieved by setting * repetition patterns discovered by every job into the session. Once all * patterns are synchronized, all jobs can proceed with compressing their * designated file sections in parallel, taking into account repetition patterns * found by all the jobs in the split. Grid task would then reduce (aggregate) * all compressed sections into one compressed file. Without session attribute * synchronization step this problem would be much harder to solve. * <p> * <h1 class="header">Session Injection</h1> * Session can be injected into a task or a job using IoC (dependency * injection) by attaching {@link org.apache.ignite.resources.TaskSessionResource @TaskSessionResource} * annotation to a field or a setter method inside of {@link ComputeTask} or * {@link ComputeJob} implementations as follows: * <pre name="code" class="java"> * ... * // This field will be injected with distributed task session. * &#64TaskSessionResource * private ComputeTaskSession ses; * ... * </pre> * or from a setter method: * <pre name="code" class="java"> * // This setter method will be automatically called by the system * // to set grid task session. * &#64TaskSessionResource * void setSession(ComputeTaskSession ses) { * this.ses = ses; * } * </pre> * <h1 class="header">Example</h1> */ public interface ComputeTaskSession { /** * Gets task name of the task this session belongs to. * * @return Task name of the task this session belongs to. */ public String getTaskName(); /** * Gets ID of the node on which task execution originated. * * @return ID of the node on which task execution originated. */ public UUID getTaskNodeId(); /** * Gets start of computation time for the task. * * @return Start of computation time for the task. */ public long getStartTime(); /** * Gets end of computation time for the task. No job within the task * will be allowed to execute passed this time. * * @return End of computation time for the task. */ public long getEndTime(); /** * Gets session ID of the task being executed. * * @return Session ID of the task being executed. */ public IgniteUuid getId(); /** * Gets class loader responsible for loading all classes within task. * <p> * Note that for classes that were loaded remotely from other nodes methods * {@link Class#getResource(String)} or {@link ClassLoader#getResource(String)} * will always return {@code null}. Use * {@link Class#getResourceAsStream(String)} or {@link ClassLoader#getResourceAsStream(String)} * instead. * * @return Class loader responsible for loading all classes within task. */ public ClassLoader getClassLoader(); /** * Gets a collection of all grid job siblings. Job siblings are grid jobs * that are executing within the same task. * <p> * If task uses continuous mapper (i.e. it injected into task class) then * job siblings will be requested from task node for each apply. * * @return Collection of grid job siblings executing within this task. * @throws IgniteException If job siblings can not be received from task node. */ public Collection<ComputeJobSibling> getJobSiblings() throws IgniteException; /** * Refreshes collection of job siblings. This method has no effect when invoked * on originating node, as the list of siblings is always most recent. However, * when using <tt>continuous mapping</tt> (see {@link ComputeTaskContinuousMapper}), * list of siblings on remote node may not be fresh. In that case, this method * will re-request list of siblings from originating node. * * @return Refreshed collection of job siblings. * @throws IgniteException If refresh failed. */ public Collection<ComputeJobSibling> refreshJobSiblings() throws IgniteException; /** * Gets job sibling for a given ID. * <p> * If task uses continuous mapper (i.e. it injected into task class) then * job sibling will be requested from task node for each apply. * * * @param jobId Job ID to get the sibling for. * @return Grid job sibling for a given ID. * @throws IgniteException If job sibling can not be received from task node. */ @Nullable public ComputeJobSibling getJobSibling(IgniteUuid jobId) throws IgniteException; /** * Sets session attributed. Note that task session is distributed and * this attribute will be propagated to all other jobs within this task and task * itself - i.e., to all accessors of this session. * Other jobs then will be notified by {@link ComputeTaskSessionAttributeListener} * callback than an attribute has changed. * <p> * This method is no-op if the session has finished. * * @param key Attribute key. * @param val Attribute value. Can be {@code null}. * @throws IgniteException If sending of attribute message failed. */ public void setAttribute(Object key, @Nullable Object val) throws IgniteException; /** * Gets an attribute set by {@link #setAttribute(Object, Object)} or {@link #setAttributes(Map)} * method. Note that this attribute could have been set by another job on * another node. * <p> * This method is no-op if the session has finished. * * @param key Attribute key. * @param <K> Attribute key type. * @param <V> Attribute value type. * @return Gets task attribute for given name. */ @Nullable public <K, V> V getAttribute(K key); /** * Sets task attributes. This method exists so one distributed replication * operation will take place for the whole group of attributes passed in. * Use it for performance reasons, rather than {@link #setAttribute(Object, Object)} * method, whenever you need to set multiple attributes. * <p> * This method is no-op if the session has finished. * * @param attrs Attributes to set. * @throws IgniteException If sending of attribute message failed. */ public void setAttributes(Map<?, ?> attrs) throws IgniteException; /** * Gets all attributes. * * @return All session attributes. */ public Map<?, ?> getAttributes(); /** * Add listener for the session attributes. * * @param lsnr Listener to add. * @param rewind {@code true} value will result in calling given listener for all * already received attributes, while {@code false} value will result only * in new attribute notification. Settings {@code rewind} to {@code true} * allows for a simple mechanism that prevents the loss of notifications for * the attributes that were previously received or received while this method * was executing. */ public void addAttributeListener(ComputeTaskSessionAttributeListener lsnr, boolean rewind); /** * Removes given listener. * * @param lsnr Listener to remove. * @return {@code true} if listener was removed, {@code false} otherwise. */ public boolean removeAttributeListener(ComputeTaskSessionAttributeListener lsnr); /** * Waits for the specified attribute to be set. If this attribute is already in session * this method will return immediately. * * @param key Attribute key to wait for. * @param timeout Timeout in milliseconds to wait for. {@code 0} means indefinite wait. * @param <K> Attribute key type. * @param <V> Attribute value type. * @return Value of newly set attribute. * @throws InterruptedException Thrown if wait was interrupted. */ public <K, V> V waitForAttribute(K key, long timeout) throws InterruptedException; /** * Waits for the specified attribute to be set or updated with given value. Note that * this method will block even if attribute is set for as long as its value is not equal * to the specified. * * @param key Attribute key to wait for. * @param val Attribute value to wait for. Can be {@code null}. * @param timeout Timeout in milliseconds to wait for. {@code 0} means indefinite wait. * @param <K> Attribute key type. * @param <V> Attribute value type. * @return Whether or not specified key/value pair has been set. * @throws InterruptedException Thrown if wait was interrupted. */ public <K, V> boolean waitForAttribute(K key, @Nullable V val, long timeout) throws InterruptedException; /** * Waits for the specified attributes to be set. If these attributes are already in session * this method will return immediately. * * @param keys Attribute keys to wait for. * @param timeout Timeout in milliseconds to wait for. {@code 0} means indefinite wait. * @return Attribute values mapped by their keys. * @throws InterruptedException Thrown if wait was interrupted. */ public Map<?, ?> waitForAttributes(Collection<?> keys, long timeout) throws InterruptedException; /** * Waits for the specified attributes to be set or updated with given values. Note that * this method will block even if attributes are set for as long as their values are not equal * to the specified. * * @param attrs Key/value pairs to wait for. * @param timeout Timeout in milliseconds to wait for. {@code 0} means indefinite wait. * @return Whether or not key/value pair has been set. * @throws InterruptedException Thrown if wait was interrupted. */ public boolean waitForAttributes(Map<?, ?> attrs, long timeout) throws InterruptedException; /** * Saves intermediate state of a job or task to a storage. The storage implementation is defined * by {@link org.apache.ignite.spi.checkpoint.CheckpointSpi} implementation used. * <p> * Long running jobs may decide to store intermediate state to protect themselves from failures. * This way whenever a job fails over to another node, it can load its previously saved state via * {@link #loadCheckpoint(String)} method and continue with execution. * <p> * This method defaults checkpoint scope to {@link ComputeTaskSessionScope#SESSION_SCOPE} and * implementation will automatically remove the checkpoint at the end of the session. It is * analogous to calling {@link #saveCheckpoint(String, Object, ComputeTaskSessionScope, long) * saveCheckpoint(String, Serializable, GridCheckpointScope.SESSION_SCOPE, 0}. * * @param key Key to be used to load this checkpoint in future. * @param state Intermediate job state to save. * @throws IgniteException If failed to save intermediate job state. * @see #loadCheckpoint(String) * @see #removeCheckpoint(String) * @see org.apache.ignite.spi.checkpoint.CheckpointSpi */ public void saveCheckpoint(String key, Object state) throws IgniteException; /** * Saves intermediate state of a job to a storage. The storage implementation is defined * by {@link org.apache.ignite.spi.checkpoint.CheckpointSpi} implementation used. * <p> * Long running jobs may decide to store intermediate state to protect themselves from failures. * This way whenever a job fails over to another node, it can load its previously saved state via * {@link #loadCheckpoint(String)} method and continue with execution. * <p> * The life time of the checkpoint is determined by its timeout and scope. * If {@link ComputeTaskSessionScope#GLOBAL_SCOPE} is used, the checkpoint will outlive * its session, and can only be removed by calling {@link org.apache.ignite.spi.checkpoint.CheckpointSpi#removeCheckpoint(String)} * from {@link org.apache.ignite.Ignite} or another task or job. * * @param key Key to be used to load this checkpoint in future. * @param state Intermediate job state to save. * @param scope Checkpoint scope. If equal to {@link ComputeTaskSessionScope#SESSION_SCOPE}, then * state will automatically be removed at the end of task execution. Otherwise, if scope is * {@link ComputeTaskSessionScope#GLOBAL_SCOPE} then state will outlive its session and can be * removed by calling {@link #removeCheckpoint(String)} from another task or whenever * timeout expires. * @param timeout Maximum time this state should be kept by the underlying storage. Value {@code 0} means that * timeout will never expire. * @throws IgniteException If failed to save intermediate job state. * @see #loadCheckpoint(String) * @see #removeCheckpoint(String) * @see org.apache.ignite.spi.checkpoint.CheckpointSpi */ public void saveCheckpoint(String key, Object state, ComputeTaskSessionScope scope, long timeout) throws IgniteException; /** * Saves intermediate state of a job or task to a storage. The storage implementation is defined * by {@link org.apache.ignite.spi.checkpoint.CheckpointSpi} implementation used. * <p> * Long running jobs may decide to store intermediate state to protect themselves from failures. * This way whenever a job fails over to another node, it can load its previously saved state via * {@link #loadCheckpoint(String)} method and continue with execution. * <p> * The life time of the checkpoint is determined by its timeout and scope. * If {@link ComputeTaskSessionScope#GLOBAL_SCOPE} is used, the checkpoint will outlive * its session, and can only be removed by calling {@link org.apache.ignite.spi.checkpoint.CheckpointSpi#removeCheckpoint(String)} * from {@link org.apache.ignite.Ignite} or another task or job. * * @param key Key to be used to load this checkpoint in future. * @param state Intermediate job state to save. * @param scope Checkpoint scope. If equal to {@link ComputeTaskSessionScope#SESSION_SCOPE}, then * state will automatically be removed at the end of task execution. Otherwise, if scope is * {@link ComputeTaskSessionScope#GLOBAL_SCOPE} then state will outlive its session and can be * removed by calling {@link #removeCheckpoint(String)} from another task or whenever * timeout expires. * @param timeout Maximum time this state should be kept by the underlying storage. Value <tt>0</tt> means that * timeout will never expire. * @param overwrite Whether or not overwrite checkpoint if it already exists. * @throws IgniteException If failed to save intermediate job state. * @see #loadCheckpoint(String) * @see #removeCheckpoint(String) * @see org.apache.ignite.spi.checkpoint.CheckpointSpi */ public void saveCheckpoint(String key, Object state, ComputeTaskSessionScope scope, long timeout, boolean overwrite) throws IgniteException; /** * Loads job's state previously saved via {@link #saveCheckpoint(String, Object, ComputeTaskSessionScope, long)} * method from an underlying storage for a given {@code key}. If state was not previously * saved, then {@code null} will be returned. The storage implementation is defined by * {@link org.apache.ignite.spi.checkpoint.CheckpointSpi} implementation used. * <p> * Long running jobs may decide to store intermediate state to protect themselves from failures. * This way whenever a job starts, it can load its previously saved state and continue * with execution. * * @param key Key for intermediate job state to load. * @param <T> Type of the checkpoint state. * @return Previously saved state or {@code null} if no state was found for a given {@code key}. * @throws IgniteException If failed to load job state. * @see #removeCheckpoint(String) * @see org.apache.ignite.spi.checkpoint.CheckpointSpi */ @Nullable public <T> T loadCheckpoint(String key) throws IgniteException; /** * Removes previously saved job's state for a given {@code key} from an underlying storage. * The storage implementation is defined by {@link org.apache.ignite.spi.checkpoint.CheckpointSpi} implementation used. * <p> * Long running jobs may decide to store intermediate state to protect themselves from failures. * This way whenever a job starts, it can load its previously saved state and continue * with execution. * * @param key Key for intermediate job state to load. * @return {@code true} if job state was removed, {@code false} if state was not found. * @throws IgniteException If failed to remove job state. * @see #loadCheckpoint(String) * @see org.apache.ignite.spi.checkpoint.CheckpointSpi */ public boolean removeCheckpoint(String key) throws IgniteException; /** * Gets a collection of grid nodes IDs. * * @return Collection of grid nodes IDs for the task's split. */ public Collection<UUID> getTopology(); /** * Gets future that will be completed when task "<tt>map</tt>" step has completed * (which means that {@link ComputeTask#map(List, Object)} method has finished). * * @return Future that will be completed when task "<tt>map</tt>" step has completed. */ public IgniteFuture<?> mapFuture(); }
3e017c906e315057fabc4229d975ab5391ac975c
20,112
java
Java
released/MyBox/src/main/java/mara/mybox/controller/BaseFileEditorController_Actions.java
Mararsh/MyBox
be9c143971e7c1a2c9d7bdba450e49750b6c037b
[ "Apache-2.0" ]
76
2018-06-12T09:02:49.000Z
2022-03-31T03:43:39.000Z
released/MyBox/src/main/java/mara/mybox/controller/BaseFileEditorController_Actions.java
Mararsh/MyBox
be9c143971e7c1a2c9d7bdba450e49750b6c037b
[ "Apache-2.0" ]
1,377
2018-06-16T23:16:41.000Z
2022-03-29T03:01:43.000Z
released/MyBox/src/main/java/mara/mybox/controller/BaseFileEditorController_Actions.java
Mararsh/MyBox
be9c143971e7c1a2c9d7bdba450e49750b6c037b
[ "Apache-2.0" ]
18
2018-11-18T04:33:06.000Z
2022-03-08T07:47:09.000Z
37.875706
143
0.506961
616
package mara.mybox.controller; import java.io.File; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Optional; import javafx.fxml.FXML; import javafx.geometry.Point2D; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; import javafx.scene.layout.Region; import javafx.stage.Stage; import mara.mybox.data.FileEditInformation; import mara.mybox.data.FileEditInformation.Edit_Type; import mara.mybox.dev.MyBoxLog; import mara.mybox.tools.TextFileTools; import mara.mybox.tools.TextTools; import mara.mybox.tools.TmpFileTools; import mara.mybox.value.Fxmls; import static mara.mybox.value.Languages.message; /** * @Author Mara * @CreateDate 2021-7-29 * @License Apache License Version 2.0 */ public abstract class BaseFileEditorController_Actions extends BaseFileEditorController_File { @FXML @Override public void recoverAction() { try { if (!recoverButton.isDisabled() && sourceInformation.getFile() != null) { loadPage(); } } catch (Exception e) { } } @FXML public void refreshAction() { try { if (!isSettingValues && sourceFile != null) { sourceInformation.setCharsetDetermined(true); sourceInformation.setCharset(Charset.forName(charsetSelector.getSelectionModel().getSelectedItem())); openFile(sourceFile); }; } catch (Exception e) { MyBoxLog.console(e); } } @FXML @Override public void saveAction() { if (!validateMainArea()) { popError(message("InvalidData")); return; } if (sourceFile == null) { saveNew(); } else { saveExisted(); } } protected void saveNew() { final File file = chooseSaveFile(); if (file == null) { return; } sourceInformation.setFile(file); synchronized (this) { if (task != null && !task.isQuit()) { return; } task = new SingletonTask<Void>() { @Override protected boolean handle() { ok = sourceInformation.writeObject(mainArea.getText()); return ok; } @Override protected void whenSucceeded() { recordFileWritten(file); popSaved(); sourceFile = file; sourceInformation.setTotalNumberRead(false); String pageText = mainArea.getText(); sourceInformation.setCurrentPageLineStart(0); sourceInformation.setCurrentPageLineEnd(pageLinesNumber(pageText)); sourceInformation.setCurrentPageObjectStart(0); sourceInformation.setCurrentPageObjectEnd(pageObjectsNumber(pageText)); updateInterface(false); loadTotalNumbers(); } }; start(task); } } protected void saveExisted() { if (confirmCheck.isVisible() && confirmCheck.isSelected() && (autoSaveTimer == null)) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getMyStage().getTitle()); alert.setContentText(message("SureOverrideFile")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonSave = new ButtonType(message("Save")); ButtonType buttonSaveAs = new ButtonType(message("SaveAs")); ButtonType buttonCancel = new ButtonType(message("Cancel")); alert.getButtonTypes().setAll(buttonSave, buttonSaveAs, buttonCancel); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonCancel) { return; } else if (result.get() == buttonSaveAs) { saveAsAction(); return; } } synchronized (this) { if (task != null && !task.isQuit()) { return; } task = new SingletonTask<Void>() { @Override protected boolean handle() { if (backupController != null && backupController.isBack()) { backupController.addBackup(sourceFile); } return sourceInformation.writePage(sourceInformation, mainArea.getText()); } @Override protected void whenSucceeded() { recordFileWritten(sourceFile); if (getMyWindow() != null && myWindow.isFocused()) { popSaved(); } sourceInformation.setTotalNumberRead(false); String pageText = mainArea.getText(); sourceInformation.setCurrentPageLineEnd(sourceInformation.getCurrentPageLineStart() + pageLinesNumber(pageText)); sourceInformation.setCurrentPageObjectEnd(sourceInformation.getCurrentPageObjectStart() + pageObjectsNumber(pageText)); updateInterface(false); loadTotalNumbers(); } }; start(task, getMyWindow() == null || myWindow.isFocused()); } } @FXML @Override public void saveAsAction() { if (!validateMainArea()) { return; } final File file = chooseSaveFile(); if (file == null) { return; } synchronized (this) { if (task != null && !task.isQuit()) { return; } FileEditInformation targetInformation = FileEditInformation.newEditInformation(editType, file); targetInformation.setFile(file); targetInformation.setCharset(Charset.forName(targetCharsetSelector.getSelectionModel().getSelectedItem())); targetInformation.setPageSize(sourceInformation.getPageSize()); targetInformation.setCurrentPage(sourceInformation.getCurrentPage()); if (targetBomCheck != null) { targetInformation.setWithBom(targetBomCheck.isSelected()); } else { targetInformation.setWithBom(sourceInformation.isWithBom()); } targetInformation.setLineBreak(lineBreak); targetInformation.setLineBreakValue(TextTools.lineBreakValue(lineBreak)); task = new SingletonTask<Void>() { @Override protected boolean handle() { return targetInformation.writePage(sourceInformation, mainArea.getText()); } @Override protected void whenSucceeded() { recordFileWritten(file); BaseFileEditorController controller = null; if (saveAsType == SaveAsType.Load) { controller = (BaseFileEditorController) myController; } else if (saveAsType == SaveAsType.Open) { controller = openNewStage(); } if (controller != null) { controller.editType = editType; controller.sourceInformation = targetInformation; controller.sourceInformation.setCharsetDetermined(true); controller.openFile(file); } popSaved(); } }; start(task); } } public BaseFileEditorController openNewStage() { if (null == editType) { return null; } else { switch (editType) { case Text: return (TextEditorController) openStage(Fxmls.TextEditorFxml); case Bytes: return (BytesEditorController) openStage(Fxmls.BytesEditorFxml); case Markdown: return (MarkdownEditorController) openStage(Fxmls.MarkdownEditorFxml); default: return null; } } } @FXML protected void locateLine() { if (locateLine < 0 || locateLine >= sourceInformation.getLinesNumber()) { popError(message("InvalidParameters")); return; } if (sourceFile == null || sourceInformation.getPagesNumber() <= 1) { selectLine(locateLine); } else { if (locateLine >= sourceInformation.getCurrentPageLineStart() && locateLine < sourceInformation.getCurrentPageLineEnd()) { selectLine(locateLine - sourceInformation.getCurrentPageLineStart()); } else { if (!checkBeforeNextAction()) { return; } synchronized (this) { if (task != null && !task.isQuit()) { return; } task = new SingletonTask<Void>() { String text; @Override protected boolean handle() { text = sourceInformation.readLine(locateLine); return text != null; } @Override protected void whenSucceeded() { loadText(text, false); selectLine(locateLine - sourceInformation.getCurrentPageLineStart()); } }; start(task); } } } } @FXML protected void locateObject() { if (locateObject < 0 || locateObject >= sourceInformation.getObjectsNumber()) { popError(message("InvalidParameters")); return; } int unit = sourceInformation.getObjectUnit(); if (sourceFile == null || sourceInformation.getPagesNumber() <= 1) { selectObjects(locateObject * unit, unit); } else { if (locateObject >= sourceInformation.getCurrentPageObjectStart() && locateObject < sourceInformation.getCurrentPageObjectEnd()) { selectObjects((locateObject - sourceInformation.getCurrentPageObjectStart()) * unit, unit); } else { if (!checkBeforeNextAction()) { return; } synchronized (this) { if (task != null && !task.isQuit()) { return; } task = new SingletonTask<Void>() { String text; @Override protected boolean handle() { text = sourceInformation.readObject(locateObject); return text != null; } @Override protected void whenSucceeded() { loadText(text, false); selectObjects((locateObject - sourceInformation.getCurrentPageObjectStart()) * unit, unit); } }; start(task); } } } } @FXML protected void locateLinesRange() { long from, to; // 0-based, exlcuded end try { from = Long.valueOf(lineFromInput.getText()) - 1; if (from < 0 || from >= sourceInformation.getLinesNumber()) { popError(message("InvalidParameters") + ": " + message("From")); return; } to = Long.valueOf(lineToInput.getText()); if (to < 0 || to > sourceInformation.getLinesNumber() || from > to) { popError(message("InvalidParameters") + ": " + message("To")); return; } } catch (Exception e) { popError(e.toString()); return; } int number = (int) (to - from); if (sourceFile == null || sourceInformation.getPagesNumber() <= 1) { selectLines(from, number); } else { if (from >= sourceInformation.getCurrentPageLineStart() && to <= sourceInformation.getCurrentPageLineEnd()) { selectLines(from - sourceInformation.getCurrentPageLineStart(), number); } else { if (!checkBeforeNextAction()) { return; } synchronized (this) { if (task != null && !task.isQuit()) { return; } task = new SingletonTask<Void>() { String text; @Override protected boolean handle() { text = sourceInformation.readLines(from, number); return text != null; } @Override protected void whenSucceeded() { loadText(text, false); selectLines(from - sourceInformation.getCurrentPageLineStart(), number); } }; start(task); } } } } @FXML protected void locateObjectsRange() { long from, to; // 0-based, exlcuded end try { from = Long.valueOf(objectFromInput.getText()) - 1; if (from < 0 || from >= sourceInformation.getObjectsNumber()) { popError(message("InvalidParameters") + ": " + message("From")); return; } to = Long.valueOf(objectToInput.getText()); if (to < 0 || to > sourceInformation.getObjectsNumber() || from > to) { popError(message("InvalidParameters") + ": " + message("To")); return; } } catch (Exception e) { popError(e.toString()); return; } int len = (int) (to - from), unit = sourceInformation.getObjectUnit(); if (sourceFile == null || sourceInformation.getPagesNumber() <= 1) { selectObjects(from * unit, len * unit); } else { if (from >= sourceInformation.getCurrentPageObjectStart() && to <= sourceInformation.getCurrentPageObjectEnd()) { selectObjects((from - sourceInformation.getCurrentPageObjectStart()) * unit, len * unit); } else { if (!checkBeforeNextAction()) { return; } synchronized (this) { if (task != null && !task.isQuit()) { return; } task = new SingletonTask<Void>() { String text; @Override protected boolean handle() { text = sourceInformation.readObjects(from, len); return text != null; } @Override protected void whenSucceeded() { loadText(text, false); selectObjects((from - sourceInformation.getCurrentPageObjectStart()) * unit, len * unit); } }; start(task); } } } } @FXML protected void filterAction() { if (isSettingValues || filterButton.isDisabled() || sourceInformation == null || filterController == null) { return; } if (filterController.filterStrings == null || filterController.filterStrings.length == 0) { popError(message("InvalidParameters")); return; } if (fileChanged.get() && sourceInformation.getPagesNumber() > 1 && !checkBeforeNextAction()) { return; } synchronized (this) { SingletonTask filterTask = new SingletonTask<Void>() { private File filteredFile; private String finalCondition; @Override protected boolean handle() { FileEditInformation filterInfo; if (sourceFile != null) { filterInfo = sourceInformation; } else { File tmpfile = TextFileTools.writeFile(TmpFileTools.getTempFile(".txt"), mainArea.getText(), Charset.forName("utf-8")); filterInfo = FileEditInformation.newEditInformation(editType, tmpfile); filterConditionsString = ""; if (editType != Edit_Type.Bytes) { filterInfo.setLineBreak(TextTools.checkLineBreak(tmpfile)); filterInfo.setLineBreakValue(TextTools.lineBreakValue(filterInfo.getLineBreak())); } else { filterInfo.setLineBreak(sourceInformation.getLineBreak()); filterInfo.setLineBreakValue(sourceInformation.getLineBreakValue()); } filterInfo.setCharset(Charset.forName("utf-8")); filterInfo.setPageSize(sourceInformation.getPageSize()); } filterInfo.setFilterStrings(filterController.filterStrings); filterInfo.setFilterType(filterController.filterType); String conditions = " (" + filterInfo.filterTypeName() + ": " + Arrays.asList(filterInfo.getFilterStrings()) + ") "; if (filterConditionsString == null || filterConditionsString.isEmpty()) { finalCondition = filterInfo.getFile().getAbsolutePath() + "\n" + conditions; } else { finalCondition = filterConditionsString + "\n" + message("And") + conditions; } filteredFile = filterInfo.filter(filterController.filterLineNumberCheck.isSelected()); return filteredFile != null; } @Override protected void whenSucceeded() { if (filteredFile.length() == 0) { popInformation(message("NoData")); return; } TextEditorController controller = (TextEditorController) openStage(Fxmls.TextEditorFxml); controller.sourceFileChanged(filteredFile); controller.filterConditionsLabel.setText(finalCondition); controller.filterConditionsString = finalCondition; controller.filterPane.setExpanded(true); } }; start(filterTask, false, null); } } @FXML @Override public void createAction() { if (!checkBeforeNextAction()) { return; } sourceInformation = null; initPage(null); updateInterface(false); } @FXML @Override public void myBoxClipBoard() { TextClipboardPopController.open(this, mainArea); } @FXML @Override public boolean menuAction() { Point2D localToScreen = mainArea.localToScreen(mainArea.getWidth() - 80, 80); MenuTextEditController.open(myController, mainArea, localToScreen.getX(), localToScreen.getY()); return true; } }
3e017d79630ae862888da87373f3a66add56eff1
1,524
java
Java
app/src/main/java/android/rezkyauliapratama/id/robusta/model/api/RawanBencana.java
rezkyauliapratama/robusta
d81433d6a24f18a8ca6d95e3c91440193fb010e8
[ "MIT" ]
1
2018-08-17T11:09:04.000Z
2018-08-17T11:09:04.000Z
app/src/main/java/android/rezkyauliapratama/id/robusta/model/api/RawanBencana.java
rezkyauliapratama/robusta
d81433d6a24f18a8ca6d95e3c91440193fb010e8
[ "MIT" ]
null
null
null
app/src/main/java/android/rezkyauliapratama/id/robusta/model/api/RawanBencana.java
rezkyauliapratama/robusta
d81433d6a24f18a8ca6d95e3c91440193fb010e8
[ "MIT" ]
null
null
null
19.538462
63
0.633202
617
package android.rezkyauliapratama.id.robusta.model.api; import android.rezkyauliapratama.id.robusta.model.api.Location; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class RawanBencana { @SerializedName("id") @Expose private Integer id; @SerializedName("bencana") @Expose private String bencana; @SerializedName("lokasi") @Expose private String lokasi; @SerializedName("kecamatan") @Expose private String kecamatan; @SerializedName("kota") @Expose private String kota; @SerializedName("location") @Expose private Location location; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getBencana() { return bencana; } public void setBencana(String bencana) { this.bencana = bencana; } public String getLokasi() { return lokasi; } public void setLokasi(String lokasi) { this.lokasi = lokasi; } public String getKecamatan() { return kecamatan; } public void setKecamatan(String kecamatan) { this.kecamatan = kecamatan; } public String getKota() { return kota; } public void setKota(String kota) { this.kota = kota; } public Location getLocation() { return location; } public void setLocation(Location location) { this.location = location; } }
3e017db199a9e5fa363378c586127750bbff5e63
6,368
java
Java
core/cim15/src/CIM15/IEC61970/LoadModel/NonConformLoadSchedule.java
SES-fortiss/SmartGridCoSimulation
f36af788b2c4de0e63688cd8faf0b0645c20264a
[ "Apache-2.0" ]
10
2018-03-14T15:47:10.000Z
2022-01-16T14:21:49.000Z
core/cim15/src/CIM15/IEC61970/LoadModel/NonConformLoadSchedule.java
SES-fortiss/SmartGridCoSimulation
f36af788b2c4de0e63688cd8faf0b0645c20264a
[ "Apache-2.0" ]
132
2019-08-27T15:01:56.000Z
2022-02-16T01:15:51.000Z
core/cim15/src/CIM15/IEC61970/LoadModel/NonConformLoadSchedule.java
SES-fortiss/SmartGridCoSimulation
f36af788b2c4de0e63688cd8faf0b0645c20264a
[ "Apache-2.0" ]
7
2017-12-11T11:33:13.000Z
2021-09-16T03:03:20.000Z
30.615385
174
0.714824
618
/** */ package CIM15.IEC61970.LoadModel; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Non Conform Load Schedule</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link CIM15.IEC61970.LoadModel.NonConformLoadSchedule#getNonConformLoadGroup <em>Non Conform Load Group</em>}</li> * </ul> * </p> * * @generated */ public class NonConformLoadSchedule extends SeasonDayTypeSchedule { /** * The cached value of the '{@link #getNonConformLoadGroup() <em>Non Conform Load Group</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getNonConformLoadGroup() * @generated * @ordered */ protected NonConformLoadGroup nonConformLoadGroup; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected NonConformLoadSchedule() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return LoadModelPackage.Literals.NON_CONFORM_LOAD_SCHEDULE; } /** * Returns the value of the '<em><b>Non Conform Load Group</b></em>' reference. * It is bidirectional and its opposite is '{@link CIM15.IEC61970.LoadModel.NonConformLoadGroup#getNonConformLoadSchedules <em>Non Conform Load Schedules</em>}'. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Non Conform Load Group</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Non Conform Load Group</em>' reference. * @see #setNonConformLoadGroup(NonConformLoadGroup) * @see CIM15.IEC61970.LoadModel.NonConformLoadGroup#getNonConformLoadSchedules * @generated */ public NonConformLoadGroup getNonConformLoadGroup() { if (nonConformLoadGroup != null && nonConformLoadGroup.eIsProxy()) { InternalEObject oldNonConformLoadGroup = (InternalEObject)nonConformLoadGroup; nonConformLoadGroup = (NonConformLoadGroup)eResolveProxy(oldNonConformLoadGroup); if (nonConformLoadGroup != oldNonConformLoadGroup) { } } return nonConformLoadGroup; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NonConformLoadGroup basicGetNonConformLoadGroup() { return nonConformLoadGroup; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetNonConformLoadGroup(NonConformLoadGroup newNonConformLoadGroup, NotificationChain msgs) { NonConformLoadGroup oldNonConformLoadGroup = nonConformLoadGroup; nonConformLoadGroup = newNonConformLoadGroup; return msgs; } /** * Sets the value of the '{@link CIM15.IEC61970.LoadModel.NonConformLoadSchedule#getNonConformLoadGroup <em>Non Conform Load Group</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Non Conform Load Group</em>' reference. * @see #getNonConformLoadGroup() * @generated */ public void setNonConformLoadGroup(NonConformLoadGroup newNonConformLoadGroup) { if (newNonConformLoadGroup != nonConformLoadGroup) { NotificationChain msgs = null; if (nonConformLoadGroup != null) msgs = ((InternalEObject)nonConformLoadGroup).eInverseRemove(this, LoadModelPackage.NON_CONFORM_LOAD_GROUP__NON_CONFORM_LOAD_SCHEDULES, NonConformLoadGroup.class, msgs); if (newNonConformLoadGroup != null) msgs = ((InternalEObject)newNonConformLoadGroup).eInverseAdd(this, LoadModelPackage.NON_CONFORM_LOAD_GROUP__NON_CONFORM_LOAD_SCHEDULES, NonConformLoadGroup.class, msgs); msgs = basicSetNonConformLoadGroup(newNonConformLoadGroup, msgs); if (msgs != null) msgs.dispatch(); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case LoadModelPackage.NON_CONFORM_LOAD_SCHEDULE__NON_CONFORM_LOAD_GROUP: if (nonConformLoadGroup != null) msgs = ((InternalEObject)nonConformLoadGroup).eInverseRemove(this, LoadModelPackage.NON_CONFORM_LOAD_GROUP__NON_CONFORM_LOAD_SCHEDULES, NonConformLoadGroup.class, msgs); return basicSetNonConformLoadGroup((NonConformLoadGroup)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case LoadModelPackage.NON_CONFORM_LOAD_SCHEDULE__NON_CONFORM_LOAD_GROUP: return basicSetNonConformLoadGroup(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case LoadModelPackage.NON_CONFORM_LOAD_SCHEDULE__NON_CONFORM_LOAD_GROUP: if (resolve) return getNonConformLoadGroup(); return basicGetNonConformLoadGroup(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case LoadModelPackage.NON_CONFORM_LOAD_SCHEDULE__NON_CONFORM_LOAD_GROUP: setNonConformLoadGroup((NonConformLoadGroup)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case LoadModelPackage.NON_CONFORM_LOAD_SCHEDULE__NON_CONFORM_LOAD_GROUP: setNonConformLoadGroup((NonConformLoadGroup)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case LoadModelPackage.NON_CONFORM_LOAD_SCHEDULE__NON_CONFORM_LOAD_GROUP: return nonConformLoadGroup != null; } return super.eIsSet(featureID); } } // NonConformLoadSchedule
3e017e4f8ac17c6a3c2992a960f88d4b51de6c10
304
java
Java
simple-travel/app/src/main/java/org/vaadin/activiti/simpletravel/process/ui/NewTravelRequestFormView.java
peholmst/ActivitiVaadinDevoxx11
910c8b2063f9d055b3e64dbb2615c06d7edc537f
[ "Apache-2.0" ]
3
2015-03-31T10:03:58.000Z
2021-02-14T18:11:56.000Z
simple-travel/app/src/main/java/org/vaadin/activiti/simpletravel/process/ui/NewTravelRequestFormView.java
peholmst/ActivitiVaadinDevoxx11
910c8b2063f9d055b3e64dbb2615c06d7edc537f
[ "Apache-2.0" ]
1
2018-06-20T05:11:54.000Z
2018-06-20T05:11:54.000Z
simple-travel/app/src/main/java/org/vaadin/activiti/simpletravel/process/ui/NewTravelRequestFormView.java
peholmst/ActivitiVaadinDevoxx11
910c8b2063f9d055b3e64dbb2615c06d7edc537f
[ "Apache-2.0" ]
7
2015-02-17T12:35:07.000Z
2020-04-20T12:01:04.000Z
27.636364
65
0.8125
619
package org.vaadin.activiti.simpletravel.process.ui; import org.vaadin.activiti.simpletravel.domain.TravelRequest; import org.vaadin.activiti.simpletravel.ui.forms.StartFormView; public interface NewTravelRequestFormView extends StartFormView { void setRequest(TravelRequest request); }
3e017f693a049cca2882fa0ec792a814666a29ce
1,440
java
Java
src/test/java/net/troja/eve/esi/model/CorporationIconsResponseTest.java
burberius/eve-esi
e1dac6a4fe87b4af6e35e17fde7403642002dbe9
[ "Apache-2.0" ]
38
2016-11-17T15:42:18.000Z
2022-01-18T14:59:52.000Z
src/test/java/net/troja/eve/esi/model/CorporationIconsResponseTest.java
burberius/eve-esi
e1dac6a4fe87b4af6e35e17fde7403642002dbe9
[ "Apache-2.0" ]
47
2016-12-12T22:15:59.000Z
2021-12-17T07:17:15.000Z
src/test/java/net/troja/eve/esi/model/CorporationIconsResponseTest.java
burberius/eve-esi
e1dac6a4fe87b4af6e35e17fde7403642002dbe9
[ "Apache-2.0" ]
19
2017-07-05T19:09:07.000Z
2022-03-30T05:28:08.000Z
21.492537
92
0.681944
620
/* * EVE Swagger Interface * An OpenAPI for EVE Online * * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package net.troja.eve.esi.model; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** * Model tests for CorporationIconsResponse */ public class CorporationIconsResponseTest { private final CorporationIconsResponse model = new CorporationIconsResponse(); /** * Model tests for CorporationIconsResponse */ @Test public void testCorporationIconsResponse() { // TODO: test CorporationIconsResponse } /** * Test the property 'px256x256' */ @Test public void px256x256Test() { // TODO: test px256x256 } /** * Test the property 'px64x64' */ @Test public void px64x64Test() { // TODO: test px64x64 } /** * Test the property 'px128x128' */ @Test public void px128x128Test() { // TODO: test px128x128 } }
3e01815fa67ec5d8a81ddddad12c937785e933c6
272
java
Java
src/com/hilton/effectiveandroid/networks/SendBroadcastActivity.java
alexhilton/EffectiveAndroid
518dfa41088741f1728be4ac679d75ba3336f539
[ "Apache-2.0" ]
2
2015-05-09T14:43:46.000Z
2015-12-03T08:06:08.000Z
src/com/hilton/effectiveandroid/networks/SendBroadcastActivity.java
alexhilton/EffectiveAndroid
518dfa41088741f1728be4ac679d75ba3336f539
[ "Apache-2.0" ]
null
null
null
src/com/hilton/effectiveandroid/networks/SendBroadcastActivity.java
alexhilton/EffectiveAndroid
518dfa41088741f1728be4ac679d75ba3336f539
[ "Apache-2.0" ]
null
null
null
24.727273
56
0.794118
621
package com.hilton.effectiveandroid.networks; import android.app.Activity; import android.os.Bundle; public class SendBroadcastActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } }
3e01818e5c62e05a7a35a87f39c72ebdf1f77b32
189
java
Java
src/main/java/io/confluent/demo/datamesh/model/Topic.java
confluentinc/data-mesh-demo
cbfaee204cfa6e6b7268831a025fe3299a44c606
[ "Apache-2.0" ]
20
2021-12-14T20:29:04.000Z
2022-03-11T10:39:51.000Z
src/main/java/io/confluent/demo/datamesh/model/Topic.java
confluentinc/data-mesh-demo
cbfaee204cfa6e6b7268831a025fe3299a44c606
[ "Apache-2.0" ]
5
2021-11-15T20:58:00.000Z
2022-02-27T21:07:18.000Z
src/main/java/io/confluent/demo/datamesh/model/Topic.java
confluentinc/data-mesh-demo
cbfaee204cfa6e6b7268831a025fe3299a44c606
[ "Apache-2.0" ]
7
2021-11-14T19:24:53.000Z
2022-03-24T09:41:24.000Z
23.625
53
0.730159
622
package io.confluent.demo.datamesh.model; public class Topic extends DataProductOrTopic { public Topic(String name, String qualifiedName) { super(name, qualifiedName); } }
3e0181ed2354cc52e2aacaaab83b90c455ac8c6e
3,230
java
Java
logdb/src/main/java/org/logdb/async/AsyncWriteDelegatingBTree.java
borer/logdb
a7f4f7e946d9a76802611d8afff1179febf604ce
[ "Apache-2.0" ]
null
null
null
logdb/src/main/java/org/logdb/async/AsyncWriteDelegatingBTree.java
borer/logdb
a7f4f7e946d9a76802611d8afff1179febf604ce
[ "Apache-2.0" ]
null
null
null
logdb/src/main/java/org/logdb/async/AsyncWriteDelegatingBTree.java
borer/logdb
a7f4f7e946d9a76802611d8afff1179febf604ce
[ "Apache-2.0" ]
null
null
null
23.75
98
0.641176
623
package org.logdb.async; import org.logdb.bbtree.BTree; import org.logdb.bbtree.BTreeNode; import org.logdb.storage.PageNumber; import org.logdb.storage.Version; import org.logdb.time.Milliseconds; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.concurrent.ThreadFactory; public class AsyncWriteDelegatingBTree implements BTree { private static final Logger LOGGER = LoggerFactory.getLogger(AsyncWriteDelegatingBTree.class); private static final byte[] INVALID_VALUE = new byte[0]; private final ManyToOneConcurrentArrayQueue<Command> queue; private final ThreadFactory threadFactory; private final BTree delegate; private Thread thread; private final CommandProcessingThread commandProcessingThread; public AsyncWriteDelegatingBTree( final ThreadFactory threadFactory, final BTree delegate, final int queueCapacity) { this.threadFactory = threadFactory; this.delegate = delegate; this.queue = new ManyToOneConcurrentArrayQueue<>(queueCapacity); this.commandProcessingThread = new CommandProcessingThread(queue, delegate); } public void start() { if (commandProcessingThread.isRunning()) { return; } thread = threadFactory.newThread(commandProcessingThread); thread.start(); } private void stop() { try { commandProcessingThread.stop(); thread.join(); } catch (final InterruptedException e) { LOGGER.error("InterruptedException while trying to stop index writing thread", e); } } @Override public void remove(final byte[] key) { sendCommandToQueue(new Command(CommandType.DELETE, key, INVALID_VALUE)); } @Override public void put(final byte[] key, final byte[] value) { sendCommandToQueue(new Command(CommandType.ADD, key, value)); } private void sendCommandToQueue(final Command command) { boolean isAdded = false; while (!isAdded) { isAdded = queue.offer(command); } } @Override public byte[] get(final byte[] key, final @Version long version) { return delegate.get(key, version); } @Override public byte[] get(final byte[] key) { return delegate.get(key); } @Override public byte[] getByTimestamp(final byte[] key, @Milliseconds long timestamp) { return delegate.getByTimestamp(key, timestamp); } @Override public void commit() throws IOException { //NO-OP } @Override public String print() { return delegate.print(); } @Override public long getNodesCount() { return delegate.getNodesCount(); } @Override public @PageNumber long getCommittedRoot() { return delegate.getCommittedRoot(); } @Override public BTreeNode getUncommittedRoot() { return delegate.getUncommittedRoot(); } @Override public void close() throws Exception { stop(); delegate.close(); } }
3e018232ce90227b838907fbff948c44b356dbd5
2,511
java
Java
mongo-morphia/src/main/java/dev/morphia/mapping/lazy/NonFinalizingHotSwappingInvoker.java
mhus-info/mhus-mongo
371953cb88023679f5b3aa2760dc77f6fa7fb293
[ "Apache-2.0" ]
null
null
null
mongo-morphia/src/main/java/dev/morphia/mapping/lazy/NonFinalizingHotSwappingInvoker.java
mhus-info/mhus-mongo
371953cb88023679f5b3aa2760dc77f6fa7fb293
[ "Apache-2.0" ]
1
2020-06-01T08:18:01.000Z
2020-06-01T08:18:01.000Z
mongo-morphia/src/main/java/dev/morphia/mapping/lazy/NonFinalizingHotSwappingInvoker.java
mhus/mhus-mongo
da2d5510cf396f53ab3182763d98893ed5ca38ed
[ "Apache-2.0" ]
null
null
null
39.125
122
0.698482
624
/** * Copyright (C) 2019 Mike Hummel ([email protected]) * * 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 dev.morphia.mapping.lazy; import java.lang.reflect.Method; import com.thoughtworks.proxy.ProxyFactory; import com.thoughtworks.proxy.kit.ObjectReference; import com.thoughtworks.proxy.toys.delegate.DelegationMode; import com.thoughtworks.proxy.toys.hotswap.HotSwappingInvoker; import dev.morphia.annotations.IdGetter; import dev.morphia.mapping.lazy.proxy.EntityObjectReference; class NonFinalizingHotSwappingInvoker<T> extends HotSwappingInvoker<T> { private static final long serialVersionUID = 1L; NonFinalizingHotSwappingInvoker( final Class<?>[] types, final ProxyFactory proxyFactory, final ObjectReference<Object> delegateReference, final DelegationMode delegationMode) { super(types, proxyFactory, delegateReference, delegationMode); } @Override public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { if ("finalize".equals(method.getName()) && args != null && args.length == 0) { return null; } /* * If the method being invoked is annotated with @IdGetter and the delegate reference is an EntityObjectReference, * return the id of the EntityObjectReference's key. This allows us to return the referenced entity's id without * fetching the entity from the datastore. */ if (method.getAnnotation(IdGetter.class) != null) { ObjectReference<Object> delegateReference = getDelegateReference(); if (delegateReference instanceof EntityObjectReference) { EntityObjectReference entityObjectReference = (EntityObjectReference) delegateReference; return entityObjectReference.__getKey().getId(); } } return super.invoke(proxy, method, args); } }
3e018278d69eaa7283d9be027ef2101d74c74646
1,470
java
Java
old_robots/y2016/Neohuman_Assassination_Golem/src/main/java/com/gos/stronghold/robot/commands/autonomous/AutoDriveForward.java
pjreiniger/GirlsOfSteelFRC
03ab0fb699dfc14985ce3c95b1eacb145288fc7e
[ "BSD-3-Clause" ]
null
null
null
old_robots/y2016/Neohuman_Assassination_Golem/src/main/java/com/gos/stronghold/robot/commands/autonomous/AutoDriveForward.java
pjreiniger/GirlsOfSteelFRC
03ab0fb699dfc14985ce3c95b1eacb145288fc7e
[ "BSD-3-Clause" ]
null
null
null
old_robots/y2016/Neohuman_Assassination_Golem/src/main/java/com/gos/stronghold/robot/commands/autonomous/AutoDriveForward.java
pjreiniger/GirlsOfSteelFRC
03ab0fb699dfc14985ce3c95b1eacb145288fc7e
[ "BSD-3-Clause" ]
null
null
null
27.222222
92
0.680952
625
package com.gos.stronghold.robot.commands.autonomous; import edu.wpi.first.wpilibj2.command.CommandBase; import com.gos.stronghold.robot.subsystems.Chassis; /** * */ public class AutoDriveForward extends CommandBase { private final Chassis m_chassis; private final double m_inches; private final double m_speed; public AutoDriveForward(Chassis chassis, double distance, double speed) { m_chassis = chassis; addRequirements(m_chassis); m_inches = distance; m_speed = speed; } // Called just before this Command runs the first time @Override public void initialize() { m_chassis.resetEncoderDistance(); System.out.println("Encoder distance initially: " + m_chassis.getEncoderDistance()); System.out.println("Inches: " + m_inches); } // Called repeatedly when this Command is scheduled to run @Override public void execute() { m_chassis.driveSpeed(m_speed); System.out.println("Encoder distance: " + m_chassis.getEncoderDistance()); } // Make this return true when this Command no longer needs to run execute() @Override public boolean isFinished() { return m_chassis.getEncoderDistance() >= Math.abs(m_inches); //competition bot } // Called once after isFinished returns true @Override public void end(boolean interrupted) { m_chassis.stop(); System.out.println("Stopped"); } }
3e01827eaea4c5ec93b36b580f742da3151481aa
8,323
java
Java
core/src/main/java/com/sequenceiq/cloudbreak/service/stack/InstanceMetaDataService.java
miklosgergely/cloudbreak
c6211e71b022336e07a861e5dcbdfc9931def30c
[ "Apache-2.0" ]
null
null
null
core/src/main/java/com/sequenceiq/cloudbreak/service/stack/InstanceMetaDataService.java
miklosgergely/cloudbreak
c6211e71b022336e07a861e5dcbdfc9931def30c
[ "Apache-2.0" ]
null
null
null
core/src/main/java/com/sequenceiq/cloudbreak/service/stack/InstanceMetaDataService.java
miklosgergely/cloudbreak
c6211e71b022336e07a861e5dcbdfc9931def30c
[ "Apache-2.0" ]
null
null
null
44.037037
155
0.713325
626
package com.sequenceiq.cloudbreak.service.stack; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import javax.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.AccessDeniedException; import org.springframework.stereotype.Service; import com.sequenceiq.common.api.type.InstanceGroupType; import com.sequenceiq.cloudbreak.cloud.model.CloudInstance; import com.sequenceiq.cloudbreak.cloud.model.Group; import com.sequenceiq.cloudbreak.cloud.model.InstanceStatus; import com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate; import com.sequenceiq.cloudbreak.domain.stack.Stack; import com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup; import com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData; import com.sequenceiq.cloudbreak.repository.InstanceMetaDataRepository; @Service public class InstanceMetaDataService { private static final Logger LOGGER = LoggerFactory.getLogger(InstanceMetaDataService.class); @Inject private InstanceMetaDataRepository repository; public void updateInstanceStatus(Iterable<InstanceGroup> instanceGroup, Map<InstanceGroupType, com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus> newStatusByGroupType) { for (InstanceGroup group : instanceGroup) { com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus newStatus = newStatusByGroupType.get(group.getInstanceGroupType()); if (newStatus != null) { for (InstanceMetaData instanceMetaData : group.getNotDeletedInstanceMetaDataSet()) { instanceMetaData.setInstanceStatus(newStatus); repository.save(instanceMetaData); } } } } public void updateInstanceStatus(Iterable<InstanceGroup> instanceGroup, com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus newStatus, Collection<String> candidateAddresses) { for (InstanceGroup group : instanceGroup) { for (InstanceMetaData instanceMetaData : group.getNotDeletedInstanceMetaDataSet()) { if (candidateAddresses.contains(instanceMetaData.getDiscoveryFQDN())) { instanceMetaData.setInstanceStatus(newStatus); repository.save(instanceMetaData); } } } } public Stack saveInstanceAndGetUpdatedStack(Stack stack, List<CloudInstance> cloudInstances, boolean save) { for (CloudInstance cloudInstance : cloudInstances) { InstanceGroup instanceGroup = getInstanceGroup(stack.getInstanceGroups(), cloudInstance.getTemplate().getGroupName()); if (instanceGroup != null) { InstanceMetaData instanceMetaData = new InstanceMetaData(); instanceMetaData.setPrivateId(cloudInstance.getTemplate().getPrivateId()); instanceMetaData.setInstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.REQUESTED); instanceMetaData.setInstanceGroup(instanceGroup); if (save) { repository.save(instanceMetaData); } instanceGroup.getInstanceMetaDataSet().add(instanceMetaData); } } return stack; } public void saveInstanceRequests(Stack stack, List<Group> groups) { Set<InstanceGroup> instanceGroups = stack.getInstanceGroups(); for (Group group : groups) { InstanceGroup instanceGroup = getInstanceGroup(instanceGroups, group.getName()); List<InstanceMetaData> existingInGroup = repository.findAllByInstanceGroupAndInstanceStatus(instanceGroup, com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.REQUESTED); for (CloudInstance cloudInstance : group.getInstances()) { InstanceTemplate instanceTemplate = cloudInstance.getTemplate(); boolean exists = existingInGroup.stream().anyMatch(i -> i.getPrivateId().equals(instanceTemplate.getPrivateId())); if (InstanceStatus.CREATE_REQUESTED == instanceTemplate.getStatus() && !exists) { InstanceMetaData instanceMetaData = new InstanceMetaData(); instanceMetaData.setPrivateId(instanceTemplate.getPrivateId()); instanceMetaData.setInstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.REQUESTED); instanceMetaData.setInstanceGroup(instanceGroup); repository.save(instanceMetaData); } } } } public void deleteInstanceRequest(Long stackId, Long privateId) { Set<InstanceMetaData> instanceMetaData = repository.findAllInStack(stackId); for (InstanceMetaData metaData : instanceMetaData) { if (metaData.getPrivateId().equals(privateId)) { repository.delete(metaData); break; } } } public Set<InstanceMetaData> unusedInstancesInInstanceGroupByName(Long stackId, String instanceGroupName) { return repository.findUnusedHostsInInstanceGroup(stackId, instanceGroupName); } public Set<InstanceMetaData> getAllInstanceMetadataByStackId(Long stackId) { return repository.findAllInStack(stackId); } private InstanceGroup getInstanceGroup(Iterable<InstanceGroup> instanceGroups, String groupName) { for (InstanceGroup instanceGroup : instanceGroups) { if (groupName.equalsIgnoreCase(instanceGroup.getGroupName())) { return instanceGroup; } } return null; } public Optional<InstanceMetaData> getPrimaryGatewayInstanceMetadata(long stackId) { try { return repository.getPrimaryGatewayInstanceMetadata(stackId); } catch (AccessDeniedException ignore) { LOGGER.debug("No primary gateway for stack [{}]", stackId); return Optional.empty(); } } public InstanceMetaData save(InstanceMetaData instanceMetaData) { return repository.save(instanceMetaData); } public Set<InstanceMetaData> findAllInStack(Long stackId) { return repository.findAllInStack(stackId); } public Set<InstanceMetaData> findNotTerminatedForStack(Long stackId) { return repository.findNotTerminatedForStack(stackId); } public Optional<InstanceMetaData> findByStackIdAndInstanceId(Long stackId, String instanceId) { return repository.findByStackIdAndInstanceId(stackId, instanceId); } public Optional<InstanceMetaData> findHostInStack(Long stackId, String hostName) { return repository.findHostInStack(stackId, hostName); } public Set<InstanceMetaData> findUnusedHostsInInstanceGroup(Long instanceGroupId) { return repository.findUnusedHostsInInstanceGroup(instanceGroupId); } public void delete(InstanceMetaData instanceMetaData) { repository.delete(instanceMetaData); } public Optional<InstanceMetaData> findNotTerminatedByPrivateAddress(Long stackId, String privateAddress) { return repository.findNotTerminatedByPrivateAddress(stackId, privateAddress); } public List<InstanceMetaData> findAliveInstancesInInstanceGroup(Long instanceGroupId) { return repository.findAliveInstancesInInstanceGroup(instanceGroupId); } public Iterable<InstanceMetaData> saveAll(Iterable<InstanceMetaData> instanceMetaData) { return repository.saveAll(instanceMetaData); } public List<InstanceMetaData> getPrimaryGatewayByInstanceGroup(Long stackId, Long instanceGroupId) { return repository.getPrimaryGatewayByInstanceGroup(stackId, instanceGroupId); } public Optional<String> getServerCertByStackId(Long stackId) { return repository.getServerCertByStackId(stackId); } public Optional<InstanceMetaData> findById(Long id) { return repository.findById(id); } public Set<InstanceMetaData> findRemovableInstances(Long stackId, String groupName) { return repository.findRemovableInstances(stackId, groupName); } }
3e018302f426c18afb9bc8e3fdf23d0e73d412dc
1,059
java
Java
robolectric/src/test/java/org/robolectric/shadows/ShadowChoreographerTest.java
senkir/robolectric
e876072e14aae6d96efd5e68156b7da222515a41
[ "MIT" ]
null
null
null
robolectric/src/test/java/org/robolectric/shadows/ShadowChoreographerTest.java
senkir/robolectric
e876072e14aae6d96efd5e68156b7da222515a41
[ "MIT" ]
null
null
null
robolectric/src/test/java/org/robolectric/shadows/ShadowChoreographerTest.java
senkir/robolectric
e876072e14aae6d96efd5e68156b7da222515a41
[ "MIT" ]
null
null
null
31.147059
94
0.789424
627
package org.robolectric.shadows; import android.view.Choreographer; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.TestRunners; import org.robolectric.util.TimeUtils; import static org.assertj.core.api.Assertions.assertThat; @RunWith(TestRunners.WithDefaults.class) public class ShadowChoreographerTest { @Test public void setFrameInterval_shouldUpdateFrameInterval() { final long frameInterval = 10 * TimeUtils.NANOS_PER_MS; ShadowChoreographer.setFrameInterval(frameInterval); final Choreographer instance = ShadowChoreographer.getInstance(); long time1 = instance.getFrameTimeNanos(); long time2 = instance.getFrameTimeNanos(); assertThat(time2 - time1).isEqualTo(frameInterval); } @Test public void reset_shouldResetFrameInterval() { ShadowChoreographer.setFrameInterval(1); assertThat(ShadowChoreographer.getFrameInterval()).isEqualTo(1); ShadowChoreographer.reset(); assertThat(ShadowChoreographer.getFrameInterval()).isEqualTo(10 * TimeUtils.NANOS_PER_MS); } }
3e01832f45081cc840ff7efeca8de91998d8391c
251
java
Java
core-tests/src/main/java/org/protobee/protocol/ProtocolTestSuite.java
dmurph/protobee
af82be69ad7d02fc59ec68e31f9e2eb1c5f13ba6
[ "BSD-2-Clause" ]
null
null
null
core-tests/src/main/java/org/protobee/protocol/ProtocolTestSuite.java
dmurph/protobee
af82be69ad7d02fc59ec68e31f9e2eb1c5f13ba6
[ "BSD-2-Clause" ]
null
null
null
core-tests/src/main/java/org/protobee/protocol/ProtocolTestSuite.java
dmurph/protobee
af82be69ad7d02fc59ec68e31f9e2eb1c5f13ba6
[ "BSD-2-Clause" ]
null
null
null
20.916667
45
0.772908
628
package org.protobee.protocol; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({PostHandlerTest.class}) public class ProtocolTestSuite { }
3e0184914948792cd936070aa13e1013ea003fb6
2,193
java
Java
OpenBeaconPackage/libraries/hibernate-release-4.2.7.SP1/project/hibernate-core/src/main/java/org/hibernate/service/jndi/spi/JndiService.java
HerrB92/obp
31238554ec22a10e56892e987439ded36d671e1e
[ "MIT" ]
null
null
null
OpenBeaconPackage/libraries/hibernate-release-4.2.7.SP1/project/hibernate-core/src/main/java/org/hibernate/service/jndi/spi/JndiService.java
HerrB92/obp
31238554ec22a10e56892e987439ded36d671e1e
[ "MIT" ]
null
null
null
OpenBeaconPackage/libraries/hibernate-release-4.2.7.SP1/project/hibernate-core/src/main/java/org/hibernate/service/jndi/spi/JndiService.java
HerrB92/obp
31238554ec22a10e56892e987439ded36d671e1e
[ "MIT" ]
1
2022-01-06T09:05:56.000Z
2022-01-06T09:05:56.000Z
32.25
95
0.734154
629
/* * Hibernate, Relational Persistence for Idiomatic Java * * Copyright (c) 2010, Red Hat Inc. or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are * distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU * Lesser General Public License, as published by the Free Software Foundation. * * 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 Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution; if not, write to: * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ package org.hibernate.service.jndi.spi; import javax.naming.event.NamespaceChangeListener; import org.hibernate.service.Service; /** * Service providing simplified access to {@literal JNDI} related features needed by Hibernate. * * @author Steve Ebersole */ public interface JndiService extends Service { /** * Locate an object in {@literal JNDI} by name * * @param jndiName The {@literal JNDI} name of the object to locate * * @return The object found (may be null). */ public Object locate(String jndiName); /** * Binds a value into {@literal JNDI} by name. * * @param jndiName The name under which to bind the object * @param value The value to bind */ public void bind(String jndiName, Object value); /** * Unbind a value from {@literal JNDI} by name. * * @param jndiName The name under which the object is bound */ public void unbind(String jndiName); /** * Adds the specified listener to the given {@literal JNDI} namespace. * * @param jndiName The {@literal JNDI} namespace * @param listener The listener */ public void addListener(String jndiName, NamespaceChangeListener listener); }
3e0185100ea23804bd8d884275f6a2ab79a2950c
284
java
Java
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/CaptchaException.java
fls530/ruoyi
b48e6fb19a70e945979c9b9d95d4f8c82d577190
[ "MIT" ]
446
2020-05-20T15:28:50.000Z
2022-03-30T06:56:14.000Z
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/CaptchaException.java
linnesi/RuoYi-Cloud
786df8e278e8bc92616e9db17313720cf1ff7280
[ "MIT" ]
18
2020-05-22T09:54:32.000Z
2022-03-17T13:29:47.000Z
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/CaptchaException.java
linnesi/RuoYi-Cloud
786df8e278e8bc92616e9db17313720cf1ff7280
[ "MIT" ]
254
2020-05-21T02:21:11.000Z
2022-03-28T03:06:34.000Z
16.705882
55
0.640845
630
package com.ruoyi.common.core.exception; /** * 验证码错误异常类 * * @author ruoyi */ public class CaptchaException extends RuntimeException { private static final long serialVersionUID = 1L; public CaptchaException(String msg) { super(msg); } }
3e0185fecaa6a6ba695c8db5c6a2adc74acf855d
14,918
java
Java
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndicesManager.java
present1001/intellij-community
08e0c753076a5d439eb017cec565395a4bedc372
[ "Apache-2.0" ]
1
2019-08-02T21:11:19.000Z
2019-08-02T21:11:19.000Z
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndicesManager.java
present1001/intellij-community
08e0c753076a5d439eb017cec565395a4bedc372
[ "Apache-2.0" ]
null
null
null
plugins/maven/src/main/java/org/jetbrains/idea/maven/indices/MavenIndicesManager.java
present1001/intellij-community
08e0c753076a5d439eb017cec565395a4bedc372
[ "Apache-2.0" ]
null
null
null
33.299107
140
0.699289
631
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.maven.indices; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.progress.BackgroundTaskQueue; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.JdomKt; import com.intellij.util.io.PathKt; import com.intellij.util.ui.update.MergingUpdateQueue; import com.intellij.util.ui.update.Update; import gnu.trove.THashSet; import org.jdom.Element; import org.jdom.JDOMException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; import org.jetbrains.concurrency.AsyncPromise; import org.jetbrains.concurrency.Promise; import org.jetbrains.concurrency.Promises; import org.jetbrains.idea.maven.model.MavenArchetype; import org.jetbrains.idea.maven.project.MavenGeneralSettings; import org.jetbrains.idea.maven.project.MavenProjectsManager; import org.jetbrains.idea.maven.server.MavenIndexerWrapper; import org.jetbrains.idea.maven.server.MavenServerDownloadListener; import org.jetbrains.idea.maven.server.MavenServerManager; import org.jetbrains.idea.maven.utils.*; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.*; public class MavenIndicesManager implements Disposable { private static final String ELEMENT_ARCHETYPES = "archetypes"; private static final String ELEMENT_ARCHETYPE = "archetype"; private static final String ELEMENT_GROUP_ID = "groupId"; private static final String ELEMENT_ARTIFACT_ID = "artifactId"; private static final String ELEMENT_VERSION = "version"; private static final String ELEMENT_REPOSITORY = "repository"; private static final String ELEMENT_DESCRIPTION = "description"; private static final String LOCAL_REPOSITORY_ID = "local"; private MavenServerDownloadListener myDownloadListener; public enum IndexUpdatingState { IDLE, WAITING, UPDATING } private volatile Path myTestIndicesDir; private volatile MavenIndexerWrapper myIndexer; private volatile MavenIndices myIndices; private final Object myUpdatingIndicesLock = new Object(); private final List<MavenSearchIndex> myWaitingIndices = new ArrayList<>(); private volatile MavenSearchIndex myUpdatingIndex; private final IndexFixer myIndexFixer = new IndexFixer(); private final BackgroundTaskQueue myUpdatingQueue = new BackgroundTaskQueue(null, IndicesBundle.message("maven.indices.updating")); private volatile List<MavenArchetype> myUserArchetypes = new ArrayList<>(); public static MavenIndicesManager getInstance() { return ServiceManager.getService(MavenIndicesManager.class); } @TestOnly public void setTestIndexDir(Path indicesDir) { myTestIndicesDir = indicesDir; } public void clear() { myUpdatingQueue.clear(); } private synchronized MavenIndices getIndicesObject() { ensureInitialized(); return myIndices; } private synchronized void ensureInitialized() { if (myIndices != null) return; myIndexer = MavenServerManager.getInstance().createIndexer(); myDownloadListener = new MavenServerDownloadListener() { @Override public void artifactDownloaded(File file, String relativePath) { addArtifact(file, relativePath); } }; MavenServerManager.getInstance().addDownloadListener(myDownloadListener); myIndices = new MavenIndices(myIndexer, getIndicesDir().toFile(), new MavenSearchIndex.IndexListener() { @Override public void indexIsBroken(@NotNull MavenSearchIndex index) { if (index instanceof MavenIndex) { scheduleUpdate(null, Collections.singletonList((MavenIndex)index), false); } } }); loadUserArchetypes(); } @NotNull private Path getIndicesDir() { return myTestIndicesDir == null ? MavenUtil.getPluginSystemDir("Indices") : myTestIndicesDir; } @Override public void dispose() { doShutdown(); if (ApplicationManager.getApplication().isUnitTestMode()) { PathKt.delete(getIndicesDir()); } } private synchronized void doShutdown() { if (myDownloadListener != null) { MavenServerManager.getInstance().removeDownloadListener(myDownloadListener); myDownloadListener = null; } if (myIndices != null) { try { myIndices.close(); } catch (Exception e) { MavenLog.LOG.error("", e); } myIndices = null; } clear(); myIndexer = null; } @TestOnly public void doShutdownInTests() { doShutdown(); } public List<MavenIndex> getIndices() { return getIndicesObject().getIndices(); } public synchronized MavenIndex ensureRemoteIndexExist(Project project, Pair<String, String> remoteIndexIdAndUrl) { try { MavenIndices indicesObjectCache = getIndicesObject(); return indicesObjectCache.add(remoteIndexIdAndUrl.first, remoteIndexIdAndUrl.second, MavenSearchIndex.Kind.REMOTE); } catch (MavenIndexException e) { MavenLog.LOG.warn(e); return null; } } public synchronized @Nullable MavenIndex createIndexForLocalRepo(Project project, @Nullable File localRepository) { if (localRepository == null) { return null; } MavenIndices indicesObjectCache = getIndicesObject(); try { MavenIndex localIndex = indicesObjectCache.add(LOCAL_REPOSITORY_ID, localRepository.getPath(), MavenIndex.Kind.LOCAL); if (localIndex.getUpdateTimestamp() == -1) { scheduleUpdate(project, Collections.singletonList(localIndex)); } return localIndex; } catch (MavenIndexException e) { MavenLog.LOG.warn(e); return null; } } public synchronized List<MavenIndex> ensureIndicesExist(Project project, Collection<Pair<String, String>> remoteRepositoriesIdsAndUrls) { // MavenIndices.add method returns an existing index if it has already been added, thus we have to use set here. LinkedHashSet<MavenIndex> result = new LinkedHashSet<>(); for (Pair<String, String> eachIdAndUrl : remoteRepositoriesIdsAndUrls) { MavenIndex index = ensureRemoteIndexExist(project, eachIdAndUrl); if (index != null) { result.add(index); } } return new ArrayList<>(result); } private void addArtifact(File artifactFile, String relativePath) { String repositoryPath = getRepositoryUrl(artifactFile, relativePath); MavenIndex index = getIndicesObject().find(repositoryPath, MavenSearchIndex.Kind.LOCAL); if (index != null) { index.addArtifact(artifactFile); } } public void fixArtifactIndex(File artifactFile, File localRepository) { MavenIndex index = getIndicesObject().find(localRepository.getPath(), MavenSearchIndex.Kind.LOCAL); if (index != null) { myIndexFixer.fixIndex(artifactFile, index); } } private static String getRepositoryUrl(File artifactFile, String name) { List<String> parts = getArtifactParts(name); File result = artifactFile; for (int i = 0; i < parts.size(); i++) { result = result.getParentFile(); } return result.getPath(); } private static List<String> getArtifactParts(String name) { return StringUtil.split(name, "/"); } public Promise<Void> scheduleUpdate(Project project, List<MavenIndex> indices) { return scheduleUpdate(project, indices, true); } private Promise<Void> scheduleUpdate(final Project projectOrNull, List<MavenIndex> indices, final boolean fullUpdate) { final List<MavenSearchIndex> toSchedule = new ArrayList<>(); synchronized (myUpdatingIndicesLock) { for (MavenSearchIndex each : indices) { if (myWaitingIndices.contains(each)) continue; toSchedule.add(each); } myWaitingIndices.addAll(toSchedule); } if (toSchedule.isEmpty()) { return Promises.resolvedPromise(); } final AsyncPromise<Void> promise = new AsyncPromise<>(); myUpdatingQueue.run(new Task.Backgroundable(projectOrNull, IndicesBundle.message("maven.indices.updating"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { try { indicator.setIndeterminate(false); doUpdateIndices(projectOrNull, toSchedule, fullUpdate, new MavenProgressIndicator(indicator,null)); } catch (MavenProcessCanceledException ignore) { } finally { promise.setResult(null); } } }); return promise; } private void doUpdateIndices(final Project projectOrNull, List<MavenSearchIndex> indices, boolean fullUpdate, MavenProgressIndicator indicator) throws MavenProcessCanceledException { MavenLog.LOG.assertTrue(!fullUpdate || projectOrNull != null); List<MavenSearchIndex> remainingWaiting = new ArrayList<>(indices); try { for (MavenSearchIndex each : indices) { if (indicator.isCanceled()) return; indicator.setText(IndicesBundle.message("maven.indices.updating.index", each.getRepositoryId(), each.getRepositoryPathOrUrl())); synchronized (myUpdatingIndicesLock) { remainingWaiting.remove(each); myWaitingIndices.remove(each); myUpdatingIndex = each; } try { MavenIndices.updateOrRepair(each, fullUpdate, fullUpdate ? getMavenSettings(projectOrNull, indicator) : null, indicator); if (projectOrNull != null) { MavenRehighlighter.rehighlight(projectOrNull); } } finally { synchronized (myUpdatingIndicesLock) { myUpdatingIndex = null; } } } } finally { synchronized (myUpdatingIndicesLock) { myWaitingIndices.removeAll(remainingWaiting); } } } private static MavenGeneralSettings getMavenSettings(@NotNull final Project project, @NotNull MavenProgressIndicator indicator) throws MavenProcessCanceledException { MavenGeneralSettings settings; settings = ReadAction .compute(() -> project.isDisposed() ? null : MavenProjectsManager.getInstance(project).getGeneralSettings().clone()); if (settings == null) { // project was closed indicator.cancel(); indicator.checkCanceled(); } return settings; } public IndexUpdatingState getUpdatingState(MavenSearchIndex index) { synchronized (myUpdatingIndicesLock) { if (myUpdatingIndex == index) return IndexUpdatingState.UPDATING; if (myWaitingIndices.contains(index)) return IndexUpdatingState.WAITING; return IndexUpdatingState.IDLE; } } public synchronized Set<MavenArchetype> getArchetypes() { ensureInitialized(); Set<MavenArchetype> result = new THashSet<>(myIndexer.getArchetypes()); result.addAll(myUserArchetypes); for (MavenSearchIndex index : myIndices.getIndices()) { if (index instanceof MavenIndex) { result.addAll(((MavenIndex)index).getArchetypes()); } } for (MavenArchetypesProvider each : MavenArchetypesProvider.EP_NAME.getExtensionList()) { result.addAll(each.getArchetypes()); } return result; } public synchronized void addArchetype(MavenArchetype archetype) { ensureInitialized(); int idx = myUserArchetypes.indexOf(archetype); if (idx >= 0) { myUserArchetypes.set(idx, archetype); } else { myUserArchetypes.add(archetype); } saveUserArchetypes(); } private void loadUserArchetypes() { try { Path file = getUserArchetypesFile(); if (!PathKt.exists(file)) { return; } // Store artifact to set to remove duplicate created by old IDEA (https://youtrack.jetbrains.com/issue/IDEA-72105) Collection<MavenArchetype> result = new LinkedHashSet<>(); List<Element> children = JdomKt.loadElement(file).getChildren(ELEMENT_ARCHETYPE); for (int i = children.size() - 1; i >= 0; i--) { Element each = children.get(i); String groupId = each.getAttributeValue(ELEMENT_GROUP_ID); String artifactId = each.getAttributeValue(ELEMENT_ARTIFACT_ID); String version = each.getAttributeValue(ELEMENT_VERSION); String repository = each.getAttributeValue(ELEMENT_REPOSITORY); String description = each.getAttributeValue(ELEMENT_DESCRIPTION); if (StringUtil.isEmptyOrSpaces(groupId) || StringUtil.isEmptyOrSpaces(artifactId) || StringUtil.isEmptyOrSpaces(version)) { continue; } result.add(new MavenArchetype(groupId, artifactId, version, repository, description)); } ArrayList<MavenArchetype> listResult = new ArrayList<>(result); Collections.reverse(listResult); myUserArchetypes = listResult; } catch (IOException | JDOMException e) { MavenLog.LOG.warn(e); } } private void saveUserArchetypes() { Element root = new Element(ELEMENT_ARCHETYPES); for (MavenArchetype each : myUserArchetypes) { Element childElement = new Element(ELEMENT_ARCHETYPE); childElement.setAttribute(ELEMENT_GROUP_ID, each.groupId); childElement.setAttribute(ELEMENT_ARTIFACT_ID, each.artifactId); childElement.setAttribute(ELEMENT_VERSION, each.version); if (each.repository != null) { childElement.setAttribute(ELEMENT_REPOSITORY, each.repository); } if (each.description != null) { childElement.setAttribute(ELEMENT_DESCRIPTION, each.description); } root.addContent(childElement); } try { JdomKt.write(root, getUserArchetypesFile()); } catch (IOException e) { MavenLog.LOG.warn(e); } } @NotNull private Path getUserArchetypesFile() { return getIndicesDir().resolve("UserArchetypes.xml"); } private static class IndexFixer { private final MergingUpdateQueue myMergingUpdateQueue = new MergingUpdateQueue(this.getClass().getName(), 1000, true, MergingUpdateQueue.ANY_COMPONENT, null, null, false); public void fixIndex(File file, MavenIndex index) { myMergingUpdateQueue.queue(new Update(file.getPath()) { @Override public void run() { index.addArtifact(file); } }); } } }
3e01862aa98f7172b0f34926d283db4c4a9a7dd8
6,544
java
Java
interpreter.common/src/test/java/gov/nist/drmf/interpreter/common/TeXPreProcessorTest.java
ag-gipp/LaCASt
e24830e16cdc4ae34c193b0bac11fef7066b1f23
[ "MIT" ]
null
null
null
interpreter.common/src/test/java/gov/nist/drmf/interpreter/common/TeXPreProcessorTest.java
ag-gipp/LaCASt
e24830e16cdc4ae34c193b0bac11fef7066b1f23
[ "MIT" ]
null
null
null
interpreter.common/src/test/java/gov/nist/drmf/interpreter/common/TeXPreProcessorTest.java
ag-gipp/LaCASt
e24830e16cdc4ae34c193b0bac11fef7066b1f23
[ "MIT" ]
null
null
null
34.994652
250
0.590312
632
package gov.nist.drmf.interpreter.common; import gov.nist.drmf.interpreter.common.latex.TeXPreProcessor; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; /** * @author Andre Greiner-Petter */ public class TeXPreProcessorTest { @Test public void displayStyleTest(){ String input = "{\\displaystyle{\\displaystyle{\\displaystyle\\ctsHahn{n}@{x}{a}{b}{c}{d}{}={%&#10;\\mathrm{i}^{n}}\\frac{\\pochhammer{a+c}{n}\\pochhammer{a+d}{n}}{n!}\\,\\HyperpFq{3}%&#10;{2}@@{-n,n+a+b+c+d-1,a+\\mathrm{i}x}{a+c,a+d}{1}}}}"; String expect = "{{\\ctsHahn{n}@{x}{a}{b}{c}{d}{}={%&#10;\\mathrm{i}^{n}}\\frac{\\pochhammer{a+c}{n}\\pochhammer{a+d}{n}}{n!}\\HyperpFq{3}%&#10;{2}@@{-n,n+a+b+c+d-1,a+\\mathrm{i}x}{a+c,a+d}{1}}}"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output, "Clear displaystyle didn't work." ); } @Test public void displayStyleCommaTest(){ String input = "{\\displaystyle \\zeta(s) =\\sum_{n=1}^\\infty\\frac{1}{n^s} ,}"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( "\\zeta(s) =\\sum_{n=1}^\\infty\\frac{1}{n^s}", output, "Clear displaystyle didn't work." ); } @Test public void environmentTest(){ String input = "\\begin{array}{c} \\frac{m+1}{n}\\\\1+\\frac{m+1}{n}\\end{array}"; String expect = "\\frac{m+1}{n}\\\\1+\\frac{m+1}{n}"; String output = TeXPreProcessor.removeTeXEnvironment( input ); assertEquals( expect, output, "Clear environment with setting didn't work." ); } @Test public void paranthesisTest(){ String input = "\\bigl( x \\bigr) \\bigg/ \\Big( y \\Big)"; String expect = "( x ) / ( y )"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output ); } @Test public void caretBugAvoidTest(){ String input = "a^bc^de_qm^a"; String expect = "a^b c^d e_q m^a"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output ); } @Test public void lineBreakSpacingTest(){ String input = "a \\\\[5pt] b"; String expect = "a \\\\ b"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output ); } @Test public void imagePartTest(){ String input = "\\Im (z+1)"; String expect = "\\imagpart (z+1)"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output ); } @Test public void nonImagePartTest(){ String input = "\\Image z"; String expect = "\\Image z"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output ); } @Test public void realPartTest(){ String input = "\\Re z"; String expect = "\\realpart z"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output ); } @Test public void stylesTest(){ String input = "{\\sf\\bf a}"; String expect = "a"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output); } @Test public void hiderelTest(){ String input = "a \\hiderel{ - } b \\hiderel{=} c \\hiderel{ /} d"; String expect = "a - b = c / d"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output); } @Test public void endingCommasTest(){ String input = "a+b=x; ."; String expect = "a+b=x"; String output = TeXPreProcessor.preProcessingTeX( input ); assertEquals( expect, output); } @Test public void numericalTest(){ String input = "2.03\\;04\\,33 1\\* x"; String i = "2.71828 \\ 18284 \\ 59045 \\ 23536"; String expect = "2.0304331* x"; String iExp = "2.71828182845904523536"; String output = TeXPreProcessor.preProcessingTeX( input ); String iOut = TeXPreProcessor.preProcessingTeX( i ); assertEquals( expect, output); assertEquals( iExp, iOut); } @Test public void bracketTest() { String in = "{{test}}"; assertTrue(TeXPreProcessor.wrappedInCurlyBrackets(in), in); in = "{{test} + {k}}"; assertTrue(TeXPreProcessor.wrappedInCurlyBrackets(in), in); in = "{a + {test}}"; assertTrue(TeXPreProcessor.wrappedInCurlyBrackets(in), in); in = "{ a + { test }} + {x}"; assertFalse(TeXPreProcessor.wrappedInCurlyBrackets(in), in); } @Test public void bracketLnTest() { String in = "{\\sqrt{1-k^2}}^{-1}\\ln{\\Jacobielldck{x}{k}+\\sqrt{1-k^2}\\Jacobiellsck{x}{k}}"; assertFalse(TeXPreProcessor.wrappedInCurlyBrackets(in)); } @Test public void reduceAtsTest() { String in = "\\Jacobiellsnk@{\\NVar{z}}{\\NVar{k}}"; assertEquals(in, TeXPreProcessor.resetNumberOfAtsToOne(in)); String twoAts = "\\Jacobiellsnk@@{\\NVar{z}}{\\NVar{k}}"; String threeAts = "\\Jacobiellsnk@@@{\\NVar{z}}{\\NVar{k}}"; assertEquals(in, TeXPreProcessor.resetNumberOfAtsToOne(twoAts)); assertEquals(in, TeXPreProcessor.resetNumberOfAtsToOne(threeAts)); } @Test public void reduceMultiAtsTest() { String in = "\\Jacobiellsnk@{\\macro@{z}}"; assertEquals(in, TeXPreProcessor.resetNumberOfAtsToOne(in)); String twoAts = "\\Jacobiellsnk@@@{\\macro@@{z}}"; String threeAts = "\\Jacobiellsnk@{\\macro@@@{z}}"; assertEquals(in, TeXPreProcessor.resetNumberOfAtsToOne(twoAts)); assertEquals(in, TeXPreProcessor.resetNumberOfAtsToOne(threeAts)); } @Test public void normalizeGenFracTest() { String in = "\\theta\\genfrac{[}{]}{0pt}{}{#1}{#2}"; String out = TeXPreProcessor.normalizeGenFrac(in); assertEquals("\\theta\\left[{#1 \\atop #2}\\right]", out); } @Test public void normalizeGenFracAngleBracketTest() { String in = "\\genfrac{<}{>}{0pt}{}{#1}{#2}"; String out = TeXPreProcessor.normalizeGenFrac(in); assertEquals("\\left<{#1 \\atop #2}\\right>", out); } @Test public void normalizeGenFracParenthesisTest() { String in = "\\genfrac(){0pt}{}{#1}{#2}"; String out = TeXPreProcessor.normalizeGenFrac(in); assertEquals("\\left({#1 \\atop #2}\\right)", out); } }
3e0186539d9133fc425b92b7ae966bd36ed70130
1,760
java
Java
chapter_006/src/test/java/ru/job4j/menu/MenuTest.java
Massimilian/Vasily-Maslov
c741c19831fcb9eabd6d83ba0450e931925f48de
[ "Apache-2.0" ]
null
null
null
chapter_006/src/test/java/ru/job4j/menu/MenuTest.java
Massimilian/Vasily-Maslov
c741c19831fcb9eabd6d83ba0450e931925f48de
[ "Apache-2.0" ]
null
null
null
chapter_006/src/test/java/ru/job4j/menu/MenuTest.java
Massimilian/Vasily-Maslov
c741c19831fcb9eabd6d83ba0450e931925f48de
[ "Apache-2.0" ]
1
2018-07-14T14:13:05.000Z
2018-07-14T14:13:05.000Z
47.567568
171
0.639205
633
package ru.job4j.menu; import org.junit.Test; import static org.hamcrest.Matchers.is; import static org.junit.Assert.*; import ru.job4j.menu.interfaces.IMenu; import ru.job4j.menu.showers.FirstShower; import ru.job4j.menu.showers.SecondShower; import ru.job4j.menu.showers.ZeroShower; public class MenuTest { IMenu menuMenuMenu = new Menu("Tarea 1.1.1", new SecondShower()); IMenu menuMenuMenuTwo = new Menu("Tarea 1.1.2", new SecondShower()); IMenu menuMenuMenuThree = new Menu("Tarea 1.1.3", new SecondShower()); IMenu menuMenu = new Menu("Tarea 1.1", new FirstShower(), new IMenu[]{menuMenuMenu, menuMenuMenuTwo, menuMenuMenuThree}); IMenu menuMenuTwo = new Menu("Tarea 1.2", new FirstShower()); IMenu menu = new Menu("Tarea 1", new ZeroShower(), new IMenu[]{menuMenu, menuMenuTwo}); IMenu menuTwo = new Menu("Tarea 2", new ZeroShower()); IMenu menuThree = new Menu("Tarea 3", new ZeroShower()); IMenu[] main = {menu, menuTwo, menuThree}; String result = ""; String answer = String.format("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", System.lineSeparator(), "Tarea 1", System.lineSeparator(), "---- Tarea 1.1", System.lineSeparator(), "-------- Tarea 1.1.1", System.lineSeparator(), "-------- Tarea 1.1.2", System.lineSeparator(), "-------- Tarea 1.1.3", System.lineSeparator(), "---- Tarea 1.2", System.lineSeparator(), "Tarea 2", System.lineSeparator(), "Tarea 3"); @Test public void whenAskAllGroupOfTasksThenReturnThemAll() { for (int i = 0; i < main.length; i++) { result = String.format("%s%s%s", result, System.lineSeparator(), main[i].getMenuName()); } assertThat(result, is(answer)); } }
3e018688ada543a62b8051d3afcbdce8629d6022
664
java
Java
src/main/java/interpres/ast/CharacterValue.java
thomasbrus/interpres
953bf4de43adb939556b3639c477f72966a40217
[ "MIT" ]
null
null
null
src/main/java/interpres/ast/CharacterValue.java
thomasbrus/interpres
953bf4de43adb939556b3639c477f72966a40217
[ "MIT" ]
null
null
null
src/main/java/interpres/ast/CharacterValue.java
thomasbrus/interpres
953bf4de43adb939556b3639c477f72966a40217
[ "MIT" ]
null
null
null
22.896552
83
0.763554
634
package interpres.ast; import java.util.List; import java.util.Arrays; import interpres.language.DefinitionTable; public class CharacterValue extends AST { private Character representation; public CharacterValue(Character representation) { this.representation = representation; } public AST evaluate(DefinitionTable definitionTable) { return ListExpression.buildFunctionCall("asm/loadc", new QuoteExpression(this)) .evaluate(definitionTable); } public Character getRepresentation() { return this.representation; } public List<String> instructionSequence() { return Arrays.asList(this.representation.toString()); } }
3e018713145ea9d4de1df3ed31d30a13de20a335
6,939
java
Java
app/src/main/java/com/example/meditrackr/ui/patient/RecordFragment.java
CMPUT301F18T15/Name
283cb68900a9852aaf4c1ccb818ecaffdadbdf62
[ "Apache-2.0" ]
2
2018-11-02T09:19:53.000Z
2019-02-13T09:16:12.000Z
app/src/main/java/com/example/meditrackr/ui/patient/RecordFragment.java
CMPUT301F18T15/Name
283cb68900a9852aaf4c1ccb818ecaffdadbdf62
[ "Apache-2.0" ]
63
2018-10-24T00:20:03.000Z
2018-11-22T04:18:00.000Z
app/src/main/java/com/example/meditrackr/ui/patient/RecordFragment.java
CMPUT301F18T15/Name
283cb68900a9852aaf4c1ccb818ecaffdadbdf62
[ "Apache-2.0" ]
1
2018-10-09T23:56:33.000Z
2018-10-09T23:56:33.000Z
38.983146
98
0.669261
635
/*-------------------------------------------------------------------------- * FILE: RecordFragment.java * * PURPOSE: A view for displaying record information to patients. * * Apache 2.0 License Notice * * Copyright 2018 CMPUT301F18T15 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * --------------------------------------------------------------------------*/ package com.example.meditrackr.ui.patient; import android.graphics.Bitmap; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.example.meditrackr.R; import com.example.meditrackr.models.record.Record; import com.example.meditrackr.utils.ConvertImage; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; /** * shows user a list of the records associated with that problem in a recycler view. * in each item it the recycler view displays the date and the description with that record. * * when a user clicks on a record it will bring them to a page where they can edit the * record (AddRecordFragment) * * there is also a + icon that when pressed brings the user to a page where they * can create a new record gor that problem (AddRecordFragment) * * @author Orest Cokan * @version 1.0 Nov 12, 2018. * @see RecordFragment */ // Class creates a Record Fragment for patients public class RecordFragment extends Fragment implements OnMapReadyCallback { // Initialize class object record and image view array private Record record; private ImageView[] images = new ImageView[10]; private ImageView[] bodyImage = new ImageView[1]; private MapView mapView; private View rootView; // Creates new instance fragment and maps record as a serializable value in bundle public static RecordFragment newInstance(Record record) { RecordFragment fragment = new RecordFragment(); Bundle bundle = new Bundle(); bundle.putSerializable("Record", record); fragment.setArguments(bundle); return fragment; } // Creates record fragment view objects based on layouts in XML @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = (ViewGroup) inflater.inflate( R.layout.fragment_record, container, false); // Initialize ui attributes final TextView title = rootView.findViewById(R.id.record_title); final TextView date = rootView.findViewById(R.id.record_date); final TextView locationTxt = rootView.findViewById(R.id.record_location); final TextView description = rootView.findViewById(R.id.record_description); record = (Record) getArguments().getSerializable( "Record"); // Allows 10 images for each record images[0] = rootView.findViewById(R.id.record_image_1); images[1] = rootView.findViewById(R.id.record_image_2); images[2] = rootView.findViewById(R.id.record_image_3); images[3] = rootView.findViewById(R.id.record_image_4); images[4] = rootView.findViewById(R.id.record_image_5); images[5] = rootView.findViewById(R.id.record_image_6); images[6] = rootView.findViewById(R.id.record_image_7); images[7] = rootView.findViewById(R.id.record_image_8); images[8] = rootView.findViewById(R.id.record_image_9); images[9] = rootView.findViewById(R.id.record_image_10); bodyImage[0] = rootView.findViewById(R.id.record_body_image_1); // Populate a record with data title.setText(record.getTitle()); description.setText(record.getDescription()); date.setText(record.getDate()); locationTxt.setText(record.getGeoLocation().getAddress()); // Populate with images try { for (int i = 0; i < record.getImages().getSize(); i++) { Bitmap bitmap = ConvertImage.convertByteToBitmap(record.getImages().getImage(i)); images[i].setImageBitmap(ConvertImage.scaleBitmap(bitmap, 350, 600)); } }catch (NullPointerException e){ Log.d("Images", "size of array is zero, no images"); } // Populate with images try { Bitmap bitmap = ConvertImage.convertByteToBitmap(record.getBodyLocation().getImage()); bodyImage[0].setImageBitmap(bitmap); }catch (NullPointerException e){ Log.d("Images", "size of array is zero, no images"); } return rootView; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mapView = (MapView) rootView.findViewById(R.id.map_view); if(mapView != null){ mapView.onCreate(null); mapView.onResume(); mapView.getMapAsync(this); } } @Override public void onMapReady(GoogleMap googleMap) { MapsInitializer.initialize(getContext()); GoogleMap mGoogleMap = googleMap; googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); googleMap.addMarker(new MarkerOptions().position(new LatLng( record.getGeoLocation().getLatitude(), record.getGeoLocation().getLongitude())) .title(record.getTitle()) .snippet(record.getDescription())); CameraPosition recordMap = CameraPosition.builder().target( new LatLng(record.getGeoLocation().getLatitude(), record.getGeoLocation() .getLongitude())) .zoom(15) .bearing(0) .tilt(0) .build(); googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(recordMap)); } }
3e01871c6a37a5c0f87bfd897beafe8ba317fb88
607
java
Java
j2modlite/src/main/java/ca/farrelltonsolar/j2modlite/msg/IllegalFunctionExceptionResponse.java
yuhuitech/ClassicMonitor
b89745d895623065c7d7c3178a8a3155952fa826
[ "Apache-2.0" ]
3
2021-02-24T16:00:05.000Z
2021-08-22T16:12:21.000Z
j2modlite/src/main/java/ca/farrelltonsolar/j2modlite/msg/IllegalFunctionExceptionResponse.java
yuhuitech/ClassicMonitor
b89745d895623065c7d7c3178a8a3155952fa826
[ "Apache-2.0" ]
1
2021-08-22T14:35:12.000Z
2021-11-17T21:22:31.000Z
j2modlite/src/main/java/ca/farrelltonsolar/j2modlite/msg/IllegalFunctionExceptionResponse.java
yuhuitech/ClassicMonitor
b89745d895623065c7d7c3178a8a3155952fa826
[ "Apache-2.0" ]
3
2021-08-22T14:19:12.000Z
2021-09-11T17:44:34.000Z
17.852941
73
0.721582
636
/** * */ package ca.farrelltonsolar.j2modlite.msg; import ca.farrelltonsolar.j2modlite.Modbus; /** * @author jfhaugh * * @version @version@ (@date@) */ public class IllegalFunctionExceptionResponse extends ExceptionResponse { /** * */ public void setFunctionCode(int fc) { super.setFunctionCode(fc | Modbus.EXCEPTION_OFFSET); } /** * */ public IllegalFunctionExceptionResponse() { super(0, Modbus.ILLEGAL_FUNCTION_EXCEPTION); } public IllegalFunctionExceptionResponse(int function) { super(function | Modbus.EXCEPTION_OFFSET, Modbus.ILLEGAL_FUNCTION_EXCEPTION); } }
3e01881c50cdbf2cd5bdebdbb193550504f73daa
375
java
Java
app/src/main/java/in/arjsna/audiorecorder/activities/TextSummarization.java
CapstoneProject18/Conciso---Voice-Categorisation-and-Text-Summarization
1155f263141e76a8ed08b2acee84907652e7ea0e
[ "Apache-2.0" ]
1
2021-05-10T08:59:37.000Z
2021-05-10T08:59:37.000Z
app/src/main/java/in/arjsna/audiorecorder/activities/TextSummarization.java
CapstoneProject18/Conciso---Voice-Categorisation-and-Text-Summarization
1155f263141e76a8ed08b2acee84907652e7ea0e
[ "Apache-2.0" ]
17
2018-10-26T05:38:32.000Z
2018-11-27T10:32:59.000Z
app/src/main/java/in/arjsna/audiorecorder/activities/TextSummarization.java
CapstoneProject18/Conciso---Voice-Categorisation-and-Text-Summarization
1155f263141e76a8ed08b2acee84907652e7ea0e
[ "Apache-2.0" ]
1
2018-11-27T12:17:26.000Z
2018-11-27T12:17:26.000Z
18.75
61
0.757333
637
package in.arjsna.audiorecorder.activities; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import in.arjsna.audiorecorder.R; public class TextSummarization extends AppCompatActivity { @Override public void onCreate(Bundle cicle){ super.onCreate(cicle); setContentView(R.layout.activity_text_summarization); } }
3e018866999e0d831baa28b04d452656e6b6a8a4
151
java
Java
src/com/java/inheritancetest/Main.java
kmestry/PROBLEM_SOLVING_HACKERRANK_LEETCODE
2332ac6771ab9ebfa568a34104ff171400557503
[ "MIT" ]
null
null
null
src/com/java/inheritancetest/Main.java
kmestry/PROBLEM_SOLVING_HACKERRANK_LEETCODE
2332ac6771ab9ebfa568a34104ff171400557503
[ "MIT" ]
null
null
null
src/com/java/inheritancetest/Main.java
kmestry/PROBLEM_SOLVING_HACKERRANK_LEETCODE
2332ac6771ab9ebfa568a34104ff171400557503
[ "MIT" ]
null
null
null
15.1
44
0.569536
638
package com.java.inheritancetest; public class Main { public static void main(String[] args) { A b = new A(); A.print(); } }
3e018873fc67e072c9c564fcc33550df9bf803ae
2,179
java
Java
test/com/google/javascript/refactoring/examples/NavigationalXssSinksRefactoringTest.java
goelayu/closure-compiler
d4a085d90bdd08039e945ea5ad1883f3c01b076a
[ "Apache-2.0" ]
2
2021-10-03T15:54:55.000Z
2021-11-17T10:34:35.000Z
test/com/google/javascript/refactoring/examples/NavigationalXssSinksRefactoringTest.java
goelayu/closure-compiler
d4a085d90bdd08039e945ea5ad1883f3c01b076a
[ "Apache-2.0" ]
1
2020-10-21T21:16:35.000Z
2020-10-21T21:16:35.000Z
test/com/google/javascript/refactoring/examples/NavigationalXssSinksRefactoringTest.java
goelayu/closure-compiler
d4a085d90bdd08039e945ea5ad1883f3c01b076a
[ "Apache-2.0" ]
1
2020-10-21T21:13:55.000Z
2020-10-21T21:13:55.000Z
38.910714
91
0.748967
639
/* * Copyright 2016 The Closure Compiler 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 com.google.javascript.refactoring.examples; import com.google.javascript.refactoring.testing.RefasterJsTestCase; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class NavigationalXssSinksRefactoringTest { /** Path of the directory containing test inputs and expected outputs. */ private static final String TESTDATA_DIR = "test/" + "com/google/javascript/refactoring/examples/testdata"; /** The RefasterJs template to use. */ private static final String NAVIGATIONAL_XSS_SINKS_TEMPLATE = "com/google/javascript/refactoring/examples/refasterjs/navigational_xss_sinks.js"; @Test public void test_refactorings() throws Exception { RefasterJsTestCase.builder() .setTemplatePath(NAVIGATIONAL_XSS_SINKS_TEMPLATE) .setInputPath(TESTDATA_DIR + "/navigational_xss_sinks_test_in.js") .addExpectedOutputPath(TESTDATA_DIR + "/navigational_xss_sinks_test_out.js") .addAdditionalSourcePath(TESTDATA_DIR + "/goog_base.js") .test(); } @Test public void testModuleRefactoring() throws Exception { RefasterJsTestCase.builder() .setTemplatePath(NAVIGATIONAL_XSS_SINKS_TEMPLATE) .setInputPath(TESTDATA_DIR + "/navigational_xss_sinks_test_module_in.js") .addExpectedOutputPath(TESTDATA_DIR + "/navigational_xss_sinks_test_module_out.js") .addAdditionalSourcePath(TESTDATA_DIR + "/goog_base.js") .addAdditionalSourcePath(TESTDATA_DIR + "/goog_foo.js") .test(); } }
3e018a442c8858258b1e0aa9e5c29770b490f540
4,011
java
Java
sampleApp/src/chain3jApplicationSample/Application.java
DavidRicardoWilde/chain3j-demo
02bf07989a0f5d35144444ed963ac5f008c7822f
[ "Apache-2.0" ]
3
2019-02-21T05:40:16.000Z
2021-01-06T07:35:33.000Z
sampleApp/src/chain3jApplicationSample/Application.java
DavidRicardoWilde/chain3j-demo
02bf07989a0f5d35144444ed963ac5f008c7822f
[ "Apache-2.0" ]
null
null
null
sampleApp/src/chain3jApplicationSample/Application.java
DavidRicardoWilde/chain3j-demo
02bf07989a0f5d35144444ed963ac5f008c7822f
[ "Apache-2.0" ]
null
null
null
39.712871
135
0.670157
640
package chain3jApplicationSample; import java.math.BigInteger; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Protocol; import okhttp3.Request; import okhttp3.RequestBody; import okio.Buffer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.chain3j.crypto.Credentials; import org.chain3j.crypto.RawTransaction; import org.chain3j.crypto.TransactionEncoder; import org.chain3j.crypto.WalletUtils; import org.chain3j.protocol.Chain3j; import org.chain3j.protocol.core.DefaultBlockParameter; import org.chain3j.protocol.core.methods.response.McGetBalance; import org.chain3j.protocol.core.methods.response.McGetTransactionCount; import org.chain3j.protocol.http.HttpService; import org.chain3j.utils.Numeric; public class Application { private static final Logger log = LoggerFactory.getLogger(Application.class); public static void main(String[] args) throws Exception { new Application().run(); } private void run() throws Exception { // We start by creating a new web3j instance to connect to remote nodes on the network. // Note: if using chain3j Android, use Chain3jFactory.build(... //Chain3j chain3j = Chain3j.build(new HttpService( // "http://gateway.moac.io/testnet")); // FIXME: Enter your http connection here; Chain3j chain3j = Chain3j.build(new HttpService( "http://127.0.0.1:8545")); // Use local MOAC server; //log.info("Connected to Moac client version: " // + chain3j.chain3ClientVersion().send().getChain3ClientVersion()); System.out.println("Out Connected to MOAC client version: " + chain3j.chain3ClientVersion().send().getChain3ClientVersion()); //Load the wallet info from a keystore file Credentials credentials = LoadCredentialsFromKeystoreFile("Insecure Pa55w0rd"); String src = credentials.getAddress(); System.out.println("Load address: " + src); // Get the TX count from network and build the TX BigInteger srcNonce = chain3j.mcGetTransactionCount(src, DefaultBlockParameter.valueOf("latest")).send().getTransactionCount(); System.out.println("MOAC testnet account TX count: " + srcNonce.toString()); System.out.println("MOAC testnet account balance: " + chain3j.mcGetBalance(src, DefaultBlockParameter.valueOf("latest")).send().getBalance()); // Build the Raw TX BigInteger sendValue = BigInteger.valueOf(1000000000000L); String des = "0x7312F4B8A4457a36827f185325Fd6B66a3f8BB8B"; RawTransaction rawTx = createTX(srcNonce, des, sendValue); // Sign the TX with Credential byte[] signedTX = TransactionEncoder.signTxEIP155(rawTx, 100, credentials); String signedRawTx = Numeric.toHexString(signedTX); System.out.println("Signed RawTX: "+signedRawTx); // Send the TX to the network and wait for the results System.out.println("MOAC TX send: " + chain3j.mcSendRawTransaction(signedRawTx).send()); } public Credentials LoadCredentialsFromKeystoreFile(String password) throws Exception { return WalletUtils.loadCredentials( password, "/Users/zpli/Desktop/Projects/MOAC/explorers/java/chain3j/crypto/src/test/resources" + "/keyfiles/UTC--2016-11-03T05-55-06." + "340672473Z--ef678007d18427e6022059dbc264f27507cd1ffc"); } // Send value private RawTransaction createTX(BigInteger nonce, String des, BigInteger sendValue) { // nonce, gasPrice, gasLimit, des, amount to send in Sha return RawTransaction.createMcTransaction( nonce, BigInteger.valueOf(20000000000L), BigInteger.valueOf(21000), des, sendValue); } }
3e018b222a28e3a815514069a1a040ed484241c2
16,311
java
Java
#633 - Server/src/com/rs/game/player/CombatDefinitions.java
CSS-Lletya/open633
e512f3a8af1581427539bde4c535e6c117851dac
[ "Apache-2.0" ]
null
null
null
#633 - Server/src/com/rs/game/player/CombatDefinitions.java
CSS-Lletya/open633
e512f3a8af1581427539bde4c535e6c117851dac
[ "Apache-2.0" ]
null
null
null
#633 - Server/src/com/rs/game/player/CombatDefinitions.java
CSS-Lletya/open633
e512f3a8af1581427539bde4c535e6c117851dac
[ "Apache-2.0" ]
null
null
null
26.478896
259
0.666851
641
package com.rs.game.player; import java.io.Serializable; import com.rs.cache.loaders.ItemDefinitions; import com.rs.game.item.Item; import com.rs.game.player.actions.PlayerCombat; import com.rs.game.player.controllers.DTControler; public final class CombatDefinitions implements Serializable { private static final long serialVersionUID = 2102201264836121104L; public static final int STAB_ATTACK = 0, SLASH_ATTACK = 1, CRUSH_ATTACK = 2, RANGE_ATTACK = 4, MAGIC_ATTACK = 3; public static final int STAB_DEF = 5, SLASH_DEF = 6, CRUSH_DEF = 7, RANGE_DEF = 9, MAGIC_DEF = 8, SUMMONING_DEF = 10; public static final int STRENGTH_BONUS = 14, RANGED_STR_BONUS = 15, MAGIC_DAMAGE = 17, PRAYER_BONUS = 16; public static final int ABSORB_MELEE = 11, ABSORB_RANGE = 13, ABSORB_MAGIC = 12; public static final int SHARED = -1; private transient Player player; private transient boolean usingSpecialAttack; private transient int[] bonuses; // saving stuff private byte attackStyle; private byte specialAttackPercentage; private boolean autoRelatie; private byte sortSpellBook; private boolean showCombatSpells; private boolean showSkillSpells; private boolean showMiscallaneousSpells; private boolean showTeleportSpells; private boolean defensiveCasting; private transient boolean instantAttack; private transient boolean dungeonneringSpellBook; private byte spellBook; private byte autoCastSpell; public int getSpellId() { Integer tempCastSpell = (Integer) player.getTemporaryAttributtes().get("tempCastSpell"); if (tempCastSpell != null) return tempCastSpell + 256; return autoCastSpell; } public int getAutoCastSpell() { return autoCastSpell; } public void resetSpells(boolean removeAutoSpell) { player.getTemporaryAttributtes().remove("tempCastSpell"); if (removeAutoSpell) { setAutoCastSpell(0); refreshAutoCastSpell(); } } public void setAutoCastSpell(int id) { autoCastSpell = (byte) id; refreshAutoCastSpell(); } public void refreshAutoCastSpell() { refreshAttackStyle(); player.getVarsManager().sendVar(108, getSpellAutoCastConfigValue()); } public int getSpellAutoCastConfigValue() { if (dungeonneringSpellBook) return 0; if (spellBook == 0) { switch (autoCastSpell) { case 25: return 3; case 28: return 5; case 30: return 7; case 32: return 9; case 34: return 11; // air bolt case 39: return 13;// water bolt case 42: return 15;// earth bolt case 45: return 17; // fire bolt case 49: return 19;// air blast case 52: return 21;// water blast case 58: return 23;// earth blast case 63: return 25;// fire blast case 66: // Saradomin Strike return 41; case 67:// Claws of Guthix return 39; case 68:// Flames of Zammorak return 43; case 70: return 27;// air wave case 73: return 29;// water wave case 77: return 31;// earth wave case 80: return 33;// fire wave case 84: return 47; case 87: return 49; case 89: return 51; case 91: return 53; case 99: return 145; default: return 0; } } else if (spellBook == 1) { switch (autoCastSpell) { case 28: return 63; case 32: return 65; case 24: return 67; case 20: return 69; case 30: return 71; case 34: return 73; case 26: return 75; case 22: return 77; case 29: return 79; case 33: return 81; case 25: return 83; case 21: return 85; case 31: return 87; case 35: return 89; case 27: return 91; case 23: return 93; case 36: return 95; case 37: return 99; case 38: return 97; case 39: return 101; default: return 0; } } else { return 0; } } public CombatDefinitions() { specialAttackPercentage = 100; autoRelatie = true; showCombatSpells = true; showSkillSpells = true; showMiscallaneousSpells = true; showTeleportSpells = true; } public void setSpellBook(int id) { if (id == 3) dungeonneringSpellBook = true; else spellBook = (byte) id; refreshSpellBookScrollBar_DefCast(); player.getInterfaceManager().sendMagicBook(); } public void refreshSpellBookScrollBar_DefCast() { player.getVarsManager().sendVar(439, (dungeonneringSpellBook ? 3 : spellBook) + (defensiveCasting ? 0 : 1 << 8)); } public int getSpellBook() { if (dungeonneringSpellBook) return 950; // dung book else { if (spellBook == 0) return 192; // normal else if (spellBook == 1) return 193; // ancients else return 430; // lunar } } public void switchShowCombatSpells() { showCombatSpells = !showCombatSpells; refreshSpellBook(); } public void switchShowSkillSpells() { showSkillSpells = !showSkillSpells; refreshSpellBook(); } public void switchShowMiscallaneousSpells() { showMiscallaneousSpells = !showMiscallaneousSpells; refreshSpellBook(); } public void switchShowTeleportSkillSpells() { showTeleportSpells = !showTeleportSpells; refreshSpellBook(); } public void switchDefensiveCasting() { defensiveCasting = !defensiveCasting; refreshSpellBookScrollBar_DefCast(); } public void setSortSpellBook(int sortId) { this.sortSpellBook = (byte) sortId; refreshSpellBook(); } public boolean isDefensiveCasting() { return defensiveCasting; } public void refreshSpellBook() { if (spellBook == 0) { player.getVarsManager().sendVar(1376, sortSpellBook | (showCombatSpells ? 0 : 1 << 9) | (showSkillSpells ? 0 : 1 << 10) | (showMiscallaneousSpells ? 0 : 1 << 11) | (showTeleportSpells ? 0 : 1 << 12)); } else if (spellBook == 1) { player.getVarsManager().sendVar(1376, sortSpellBook << 3 | (showCombatSpells ? 0 : 1 << 16) | (showTeleportSpells ? 0 : 1 << 17)); } else if (spellBook == 2) { player.getVarsManager().sendVar(1376, sortSpellBook << 6 | (showCombatSpells ? 0 : 1 << 13) | (showMiscallaneousSpells ? 0 : 1 << 14) | (showTeleportSpells ? 0 : 1 << 15)); } } public static final int getMeleeDefenceBonus(int bonusId) { if (bonusId == STAB_ATTACK) return STAB_DEF; if (bonusId == SLASH_DEF) return SLASH_DEF; return CRUSH_DEF; } public static final int getMeleeBonusStyle(int weaponId, int attackStyle) { if (weaponId != -1) { if (weaponId == -2) { return CRUSH_ATTACK; } String weaponName = ItemDefinitions.getItemDefinitions(weaponId).getName().toLowerCase(); if (weaponName.contains("whip")) return SLASH_ATTACK; if (weaponName.contains("staff of light")) { switch (attackStyle) { case 0: return STAB_ATTACK; case 1: return SLASH_ATTACK; default: return CRUSH_ATTACK; } } if (weaponName.contains("mindspike") || weaponName.contains("staff") || weaponName.contains("granite mace") || weaponName.contains("hammer") || weaponName.contains("tzhaar-ket-em") || weaponName.contains("tzhaar-ket-om") || weaponName.contains("maul")) return CRUSH_ATTACK; if (weaponName.contains("godsword") || weaponName.contains("greataxe") || weaponName.contains("2h sword") || weaponName.equals("saradomin sword") || weaponName.contains("battleaxe")) { switch (attackStyle) { case 2: return CRUSH_ATTACK; default: return SLASH_ATTACK; } } if (weaponName.contains("scimitar") || weaponName.contains("sabre") || weaponName.contains("hatchet") || weaponName.contains("claws") || weaponName.contains(" sword") || weaponName.contains("longsword")) { switch (attackStyle) { case 2: return STAB_ATTACK; default: return SLASH_ATTACK; } } if (weaponName.contains("mace") || weaponName.contains("anchor") || weaponName.contains("annihilation")) { switch (attackStyle) { case 2: return STAB_ATTACK; default: return CRUSH_ATTACK; } } if (weaponName.contains("halberd")) { switch (attackStyle) { case 1: return SLASH_ATTACK; default: return STAB_ATTACK; } } if (weaponName.contains("spear")) { switch (attackStyle) { case 1: return SLASH_ATTACK; case 2: return CRUSH_ATTACK; default: return STAB_ATTACK; } } if (weaponName.contains("pickaxe")) { switch (attackStyle) { case 2: return CRUSH_ATTACK; default: return STAB_ATTACK; } } if (weaponName.contains("dagger") || weaponName.contains("rapier")) { switch (attackStyle) { case 2: return SLASH_ATTACK; default: return STAB_ATTACK; } } } switch (weaponId) { default: return CRUSH_ATTACK; } } public static final int getXpStyle(int weaponId, int attackStyle) { if (weaponId != -1 && weaponId != -2) { String weaponName = ItemDefinitions.getItemDefinitions(weaponId).getName().toLowerCase(); if (weaponName.contains("whip")) { switch (attackStyle) { case 0: return Skills.ATTACK; case 1: return SHARED; case 2: default: return Skills.DEFENCE; } } if (weaponName.contains("halberd")) { switch (attackStyle) { case 0: return SHARED; case 1: return Skills.STRENGTH; case 2: default: return Skills.DEFENCE; } } if (weaponName.contains("mindspike") || weaponName.contains("staff") || weaponName.contains("granite mace") || weaponName.contains("hammer") || weaponName.contains("tzhaar-ket-em") || weaponName.contains("tzhaar-ket-om") || weaponName.contains("maul")) { switch (attackStyle) { case 0: return Skills.ATTACK; case 1: return Skills.STRENGTH; case 2: default: return Skills.DEFENCE; } } if (weaponName.contains("godsword") || weaponName.contains("sword") || weaponName.contains("2h")) { switch (attackStyle) { case 0: return Skills.ATTACK; case 1: return Skills.STRENGTH; case 2: return Skills.STRENGTH; case 3: default: return Skills.DEFENCE; } } } switch (weaponId) { case -1: case -2: switch (attackStyle) { case 0: return Skills.ATTACK; case 1: return Skills.STRENGTH; case 2: default: return Skills.DEFENCE; } default: switch (attackStyle) { case 0: return Skills.ATTACK; case 1: return Skills.STRENGTH; case 2: return SHARED; case 3: default: return Skills.DEFENCE; } } } public void setPlayer(Player player) { this.player = player; bonuses = new int[18]; } public int[] getBonuses() { return bonuses; } public void refreshBonuses() { bonuses = new int[18]; int weapon = player.getEquipment().getWeaponId(); for (Item item : player.getEquipment().getItems().getItems()) { if (item == null) continue; // dominion weapons work only in tower if (item.getId() >= 22346 && item.getId() <= 22348 && !(player.getControlerManager().getControler() instanceof DTControler)) continue; ItemDefinitions defs = item.getDefinitions(); bonuses[STAB_ATTACK] += defs.getStabAttack(); bonuses[SLASH_ATTACK] += defs.getSlashAttack(); bonuses[CRUSH_ATTACK] += defs.getCrushAttack(); bonuses[MAGIC_ATTACK] += defs.getMagicAttack(); bonuses[RANGE_ATTACK] += defs.getRangeAttack(); bonuses[STAB_DEF] += defs.getStabDef(); bonuses[SLASH_DEF] += defs.getSlashDef(); bonuses[CRUSH_DEF] += defs.getCrushDef(); bonuses[MAGIC_DEF] += defs.getMagicDef(); bonuses[RANGE_DEF] += defs.getRangeDef(); bonuses[SUMMONING_DEF] += defs.getSummoningDef(); bonuses[ABSORB_MELEE] += defs.getAbsorptionMeleeBonus(); bonuses[ABSORB_MAGIC] += defs.getAbsorptionMageBonus(); bonuses[ABSORB_RANGE] += defs.getAbsorptionRangeBonus(); bonuses[STRENGTH_BONUS] += defs.getStrengthBonus(); if (bonuses[RANGED_STR_BONUS] == 0 && weapon != 13720 && weapon != 25202) bonuses[RANGED_STR_BONUS] += defs.getRangedStrBonus(); bonuses[PRAYER_BONUS] += defs.getPrayerBonus(); bonuses[MAGIC_DAMAGE] += defs.getMagicDamage(); } } public void resetSpecialAttack() { desecreaseSpecialAttack(0); specialAttackPercentage = 100; refreshSpecialAttackPercentage(); } public void setSpecialAttack(int special) { desecreaseSpecialAttack(0); specialAttackPercentage = (byte) special; refreshSpecialAttackPercentage(); } public void restoreSpecialAttack() { if (player.getFamiliar() != null) player.getFamiliar().restoreSpecialAttack(15); if (specialAttackPercentage == 100) return; restoreSpecialAttack(10); if (specialAttackPercentage == 100 || specialAttackPercentage == 50) player.getPackets().sendGameMessage("<col=00FF00>Your special attack energy is now " + specialAttackPercentage + "%.", true); } public void restoreSpecialAttack(int percentage) { if (specialAttackPercentage >= 100 || player.getInterfaceManager().containsScreenInter()) return; specialAttackPercentage += specialAttackPercentage > (100 - percentage) ? 100 - specialAttackPercentage : percentage; refreshSpecialAttackPercentage(); } public void init() { refreshUsingSpecialAttack(); refreshSpecialAttackPercentage(); refreshAutoRelatie(); refreshAttackStyle(); refreshSpellBook(); refreshAutoCastSpell(); refreshSpellBookScrollBar_DefCast(); } public void checkAttackStyle() { if (autoCastSpell == 0) setAttackStyle(attackStyle); } public void setAttackStyle(int style) { int maxSize = 3; int weaponId = player.getEquipment().getWeaponId(); String name = weaponId == -1 ? "" : ItemDefinitions.getItemDefinitions(weaponId).getName().toLowerCase(); if (weaponId == -1 || PlayerCombat.isRanging(player) != 0 || name.contains("whip") || name.contains("halberd")) maxSize = 2; if (style > maxSize) style = maxSize; if (style != attackStyle) { attackStyle = (byte) style; if (autoCastSpell > 1) resetSpells(true); else refreshAttackStyle(); } else if (autoCastSpell > 1) resetSpells(true); } public void refreshAttackStyle() { player.getVarsManager().sendVar(43, autoCastSpell > 0 ? 4 : attackStyle); } public void sendUnlockAttackStylesButtons() { for (int componentId = 11; componentId <= 14; componentId++) player.getPackets().sendUnlockIComponentOptionSlots(884, componentId, -1, 0, 0); } public void switchUsingSpecialAttack() { usingSpecialAttack = !usingSpecialAttack; refreshUsingSpecialAttack(); } public void desecreaseSpecialAttack(int ammount) { usingSpecialAttack = false; refreshUsingSpecialAttack(); if (ammount > 0) { specialAttackPercentage -= ammount; refreshSpecialAttackPercentage(); } } public boolean hasRingOfVigour() { return player.getEquipment().getRingId() == 19669; } public int getSpecialAttackPercentage() { return specialAttackPercentage; } public void refreshUsingSpecialAttack() { player.getVarsManager().sendVar(301, usingSpecialAttack ? 1 : 0); } public void refreshSpecialAttackPercentage() { player.getVarsManager().sendVar(300, specialAttackPercentage * 10); } public void switchAutoRelatie() { autoRelatie = !autoRelatie; refreshAutoRelatie(); } public void refreshAutoRelatie() { player.getVarsManager().sendVar(172, autoRelatie ? 0 : 1); } public boolean isUsingSpecialAttack() { return usingSpecialAttack; } public int getAttackStyle() { return attackStyle; } public boolean isAutoRelatie() { return autoRelatie; } public void setAutoRelatie(boolean autoRelatie) { this.autoRelatie = autoRelatie; } public boolean isDungeonneringSpellBook() { return dungeonneringSpellBook; } public void removeDungeonneringBook() { if (dungeonneringSpellBook) { dungeonneringSpellBook = false; player.getInterfaceManager().sendMagicBook(); } } public boolean isInstantAttack() { return instantAttack; } public void setInstantAttack(boolean instantAttack) { this.instantAttack = instantAttack; } }
3e018b807319f9c0851ccf6300dd0a46033c4430
2,251
java
Java
src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java
Manny27nyc/ldk-garbagecollected
7d6be8a5ef72a4ebfe07660cce55f43f6cc30b80
[ "Apache-2.0", "MIT" ]
null
null
null
src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java
Manny27nyc/ldk-garbagecollected
7d6be8a5ef72a4ebfe07660cce55f43f6cc30b80
[ "Apache-2.0", "MIT" ]
null
null
null
src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java
Manny27nyc/ldk-garbagecollected
7d6be8a5ef72a4ebfe07660cce55f43f6cc30b80
[ "Apache-2.0", "MIT" ]
null
null
null
31.263889
80
0.748556
642
package org.ldk.structs; import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; import javax.annotation.Nullable; public class Result_InvoiceNoneZ extends CommonBase { private Result_InvoiceNoneZ(Object _dummy, long ptr) { super(ptr); } protected void finalize() throws Throwable { if (ptr != 0) { bindings.CResult_InvoiceNoneZ_free(ptr); } super.finalize(); } static Result_InvoiceNoneZ constr_from_ptr(long ptr) { if (bindings.LDKCResult_InvoiceNoneZ_result_ok(ptr)) { return new Result_InvoiceNoneZ_OK(null, ptr); } else { return new Result_InvoiceNoneZ_Err(null, ptr); } } public static final class Result_InvoiceNoneZ_OK extends Result_InvoiceNoneZ { public final Invoice res; private Result_InvoiceNoneZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); long res = bindings.LDKCResult_InvoiceNoneZ_get_ok(ptr); Invoice res_hu_conv = new Invoice(null, res); res_hu_conv.ptrs_to.add(this); this.res = res_hu_conv; } } public static final class Result_InvoiceNoneZ_Err extends Result_InvoiceNoneZ { private Result_InvoiceNoneZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); } } /** * Creates a new CResult_InvoiceNoneZ in the success state. */ public static Result_InvoiceNoneZ ok(Invoice o) { long ret = bindings.CResult_InvoiceNoneZ_ok(o == null ? 0 : o.ptr & ~1); if (ret < 1024) { return null; } Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(o); return ret_hu_conv; } /** * Creates a new CResult_InvoiceNoneZ in the error state. */ public static Result_InvoiceNoneZ err() { long ret = bindings.CResult_InvoiceNoneZ_err(); if (ret < 1024) { return null; } Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; } /** * Creates a new CResult_InvoiceNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ public Result_InvoiceNoneZ clone() { long ret = bindings.CResult_InvoiceNoneZ_clone(this.ptr); if (ret < 1024) { return null; } Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; } }
3e018c162e6ba162d36055eb1b0ccad273d41a9f
4,151
java
Java
src/shims/src/common/java/org/apache/hadoop/hive/shims/ShimLoader.java
pentaho/hive-0.7.0
aeefdef0f9f262b7618bed1eeff71c902e013ffa
[ "Apache-2.0" ]
null
null
null
src/shims/src/common/java/org/apache/hadoop/hive/shims/ShimLoader.java
pentaho/hive-0.7.0
aeefdef0f9f262b7618bed1eeff71c902e013ffa
[ "Apache-2.0" ]
null
null
null
src/shims/src/common/java/org/apache/hadoop/hive/shims/ShimLoader.java
pentaho/hive-0.7.0
aeefdef0f9f262b7618bed1eeff71c902e013ffa
[ "Apache-2.0" ]
12
2015-04-18T00:21:12.000Z
2021-08-13T01:36:57.000Z
30.977612
86
0.687304
643
/*! * Copyright 2010 - 2013 Pentaho Corporation. 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.hadoop.hive.shims; import java.util.HashMap; import java.util.Map; import org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge; import org.apache.hadoop.util.VersionInfo; /** * ShimLoader. * */ public abstract class ShimLoader { private static HadoopShims hadoopShims; private static JettyShims jettyShims; /** * The names of the classes for shimming Hadoop for each major version. */ private static final HashMap<String, String> HADOOP_SHIM_CLASSES = new HashMap<String, String>(); static { HADOOP_SHIM_CLASSES.put("0.20", "org.apache.hadoop.hive.shims.Hadoop20Shims"); HADOOP_SHIM_CLASSES.put("0.20S", "org.apache.hadoop.hive.shims.Hadoop20SShims"); } /** * The names of the classes for shimming Jetty for each major version of * Hadoop. */ private static final HashMap<String, String> JETTY_SHIM_CLASSES = new HashMap<String, String>(); static { JETTY_SHIM_CLASSES.put("0.20", "org.apache.hadoop.hive.shims.Jetty20Shims"); JETTY_SHIM_CLASSES.put("0.20S", "org.apache.hadoop.hive.shims.Jetty20SShims"); } /** * Factory method to get an instance of HadoopShims based on the * version of Hadoop on the classpath. */ public static synchronized HadoopShims getHadoopShims() { if (hadoopShims == null) { hadoopShims = loadShims(HADOOP_SHIM_CLASSES, HadoopShims.class); } return hadoopShims; } /** * Factory method to get an instance of JettyShims based on the version * of Hadoop on the classpath. */ public static synchronized JettyShims getJettyShims() { if (jettyShims == null) { jettyShims = loadShims(JETTY_SHIM_CLASSES, JettyShims.class); } return jettyShims; } public static synchronized HadoopThriftAuthBridge getHadoopThriftAuthBridge() { if ("0.20S".equals(getMajorVersion())) { return createShim("org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge20S", HadoopThriftAuthBridge.class); } else { return new HadoopThriftAuthBridge(); } } @SuppressWarnings("unchecked") private static <T> T loadShims(Map<String, String> classMap, Class<T> xface) { String vers = getMajorVersion(); String className = classMap.get(vers); return createShim(className, xface); } private static <T> T createShim(String className, Class<T> xface) { try { Class clazz = Class.forName(className); return xface.cast(clazz.newInstance()); } catch (Exception e) { throw new RuntimeException("Could not load shims in class " + className, e); } } /** * Return the major version of Hadoop currently on the classpath. * This is simply the first two components of the version number * (e.g "0.18" or "0.20") */ public static String getMajorVersion() { String vers = VersionInfo.getVersion(); String[] parts = vers.split("\\."); if (parts.length < 2) { throw new RuntimeException("Illegal Hadoop Version: " + vers + " (expected A.B.* format)"); } String majorVersion = parts[0] + "." + parts[1]; // If we are running a security release, we won't have UnixUserGroupInformation // (removed by HADOOP-6299 when switching to JAAS for Login) try { Class.forName("org.apache.hadoop.security.UnixUserGroupInformation"); } catch (ClassNotFoundException cnf) { majorVersion += "S"; } return majorVersion; } private ShimLoader() { // prevent instantiation } }
3e018ed0358313d6bb72656c810d869010fd0ea7
2,174
java
Java
src/main/java/jp/ac/utokyo/rcast/karkinos/exec/CopyNumberInterval.java
hirokiuedaRcast/karkinos
9525c4e01a049a30261e306ecc9c4e78b15d8ac2
[ "Apache-2.0" ]
7
2019-01-12T16:07:07.000Z
2022-02-28T16:42:24.000Z
src/main/java/jp/ac/utokyo/rcast/karkinos/exec/CopyNumberInterval.java
hirokiuedaRcast/karkinos
9525c4e01a049a30261e306ecc9c4e78b15d8ac2
[ "Apache-2.0" ]
16
2017-04-13T04:01:25.000Z
2021-01-22T10:35:00.000Z
src/main/java/jp/ac/utokyo/rcast/karkinos/exec/CopyNumberInterval.java
hirokiuedaRcast/karkinos
9525c4e01a049a30261e306ecc9c4e78b15d8ac2
[ "Apache-2.0" ]
1
2018-11-16T08:56:35.000Z
2018-11-16T08:56:35.000Z
19.763636
80
0.710212
644
/* Copyright Hiroki Ueda 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.ac.utokyo.rcast.karkinos.exec; /** * The range is 1-based closed range [start,end] */ public class CopyNumberInterval implements java.io.Serializable{ private final String chr; private final float aaf, baf; private int start, end; private float copynumber; private boolean allelic = false; private boolean hdeletion = false; // Homozygous deletion private int noSNP; public CopyNumberInterval(final String chr) { this(chr, 0, 0); } public CopyNumberInterval(final String chr, final float aaf, final float baf) { this.chr = chr; this.aaf = aaf; this.baf = baf; } public void setNoSNP(final int noSNP) { this.noSNP = noSNP; } public float getAaf() { return aaf; } public float getBaf() { return baf; } public boolean isAllelic() { return allelic; } public void setAllelic(final boolean allelic) { this.allelic = allelic; } public boolean isHdeletion() { return hdeletion; } public void setHdeletion(final boolean hdeletion) { this.hdeletion = hdeletion; } public String getChr() { return chr; } public int getStart() { return start; } public void setStart(final int start) { this.start = start; } public int getEnd() { return end; } public void setEnd(final int end) { this.end = end; } public float getCopynumber() { return copynumber; } public int getNoSNP() { return noSNP; } public void setCopynumber(final float copynumber) { this.copynumber = copynumber; } /** * Return the length of Copy Number Interval. */ public int length() { if (start > end) { return 0; } return end - start + 1; } }
3e018f035425feb0c8b9de1ecce29a9daa239433
215
java
Java
app/cachemanager/cache/CacheKey.java
ugurlu/play-cacheman
01daaeb8edeb7889f991fd4ba4721a8efb3aedc2
[ "Apache-2.0" ]
null
null
null
app/cachemanager/cache/CacheKey.java
ugurlu/play-cacheman
01daaeb8edeb7889f991fd4ba4721a8efb3aedc2
[ "Apache-2.0" ]
null
null
null
app/cachemanager/cache/CacheKey.java
ugurlu/play-cacheman
01daaeb8edeb7889f991fd4ba4721a8efb3aedc2
[ "Apache-2.0" ]
null
null
null
15.357143
37
0.669767
645
package cachemanager.cache; public interface CacheKey { public enum CacheScope { SESSION, GLOBAL } public CacheScope scope(); public String key(); public CacheAdapter getAdapter(); }
3e018f1de3de488059095887786473bede583f34
201
java
Java
app/src/main/java/com/android1/shoplarity/credentials.java
Mugengano18/E_Search2
88c0ba9bc4b3fb813b9a01e25c7b0adb4fac78a0
[ "Unlicense" ]
null
null
null
app/src/main/java/com/android1/shoplarity/credentials.java
Mugengano18/E_Search2
88c0ba9bc4b3fb813b9a01e25c7b0adb4fac78a0
[ "Unlicense" ]
null
null
null
app/src/main/java/com/android1/shoplarity/credentials.java
Mugengano18/E_Search2
88c0ba9bc4b3fb813b9a01e25c7b0adb4fac78a0
[ "Unlicense" ]
null
null
null
28.714286
69
0.776119
646
package com.android1.shoplarity; public class credentials { public static final String Base_URL="https://api.yelp.com/v3/"; public static final String YELP_API_KEY=BuildConfig.YELP_API_KEY; }
3e018f83d0a9bb0156ed60c21d639c3e8a638bf2
1,124
java
Java
SQLPlugin/gen/com/sqlplugin/psi/impl/SqlModuleTransformGroupSpecificationImpl.java
smoothwind/SQL-IDEAplugin
3efa434095b4cac4772a0a7df18b34042a4c7557
[ "MIT" ]
null
null
null
SQLPlugin/gen/com/sqlplugin/psi/impl/SqlModuleTransformGroupSpecificationImpl.java
smoothwind/SQL-IDEAplugin
3efa434095b4cac4772a0a7df18b34042a4c7557
[ "MIT" ]
null
null
null
SQLPlugin/gen/com/sqlplugin/psi/impl/SqlModuleTransformGroupSpecificationImpl.java
smoothwind/SQL-IDEAplugin
3efa434095b4cac4772a0a7df18b34042a4c7557
[ "MIT" ]
null
null
null
31.222222
132
0.80427
647
// This is a generated file. Not intended for manual editing. package com.sqlplugin.psi.impl; import java.util.List; import org.jetbrains.annotations.*; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.util.PsiTreeUtil; import static com.sqlplugin.psi.SqlTypes.*; import com.intellij.extapi.psi.ASTWrapperPsiElement; import com.sqlplugin.psi.*; public class SqlModuleTransformGroupSpecificationImpl extends ASTWrapperPsiElement implements SqlModuleTransformGroupSpecification { public SqlModuleTransformGroupSpecificationImpl(@NotNull ASTNode node) { super(node); } public void accept(@NotNull SqlVisitor visitor) { visitor.visitModuleTransformGroupSpecification(this); } public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof SqlVisitor) accept((SqlVisitor)visitor); else super.accept(visitor); } @Override @NotNull public SqlTransformGroupSpecification getTransformGroupSpecification() { return findNotNullChildByClass(SqlTransformGroupSpecification.class); } }
3e01903564082ab67862c0f2444d7e7075134b34
159
java
Java
vertx-quickstart/src/test/java/org/acme/vertx/ResourceUsingWebClientIT.java
penehyba/quarkus-quickstarts
0d79da7ce2d793dff9560f018664cb685836d4de
[ "Apache-2.0" ]
7
2020-12-10T10:16:35.000Z
2021-08-30T07:00:41.000Z
vertx-quickstart/src/test/java/org/acme/vertx/ResourceUsingWebClientIT.java
penehyba/quarkus-quickstarts
0d79da7ce2d793dff9560f018664cb685836d4de
[ "Apache-2.0" ]
3
2020-01-15T07:46:20.000Z
2020-01-15T07:48:52.000Z
vertx-quickstart/src/test/java/org/acme/vertx/ResourceUsingWebClientIT.java
penehyba/quarkus-quickstarts
0d79da7ce2d793dff9560f018664cb685836d4de
[ "Apache-2.0" ]
6
2021-06-17T15:03:42.000Z
2022-02-08T16:10:46.000Z
19.875
67
0.849057
648
package org.acme.vertx; import io.quarkus.test.junit.NativeImageTest; @NativeImageTest class ResourceUsingWebClientIT extends ResourceUsingWebClientTest { }
3e01907e664f5642dddd4da7362236cf782ea3f0
3,427
java
Java
src/test/java/dev/ESTest1.java
castagna/EARQ
12768bd6bf71d366b3391dbe3ab4232b46f909d5
[ "Apache-2.0" ]
null
null
null
src/test/java/dev/ESTest1.java
castagna/EARQ
12768bd6bf71d366b3391dbe3ab4232b46f909d5
[ "Apache-2.0" ]
1
2021-07-02T18:43:44.000Z
2021-07-02T18:43:44.000Z
src/test/java/dev/ESTest1.java
castagna/EARQ
12768bd6bf71d366b3391dbe3ab4232b46f909d5
[ "Apache-2.0" ]
1
2019-01-11T22:14:40.000Z
2019-01-11T22:14:40.000Z
34.27
111
0.717245
649
package dev; import static org.elasticsearch.index.query.xcontent.QueryBuilders.fieldQuery; import static org.elasticsearch.client.Requests.refreshRequest; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchType; import org.elasticsearch.client.Client; import org.elasticsearch.client.action.index.IndexRequestBuilder; import org.elasticsearch.client.action.search.SearchRequestBuilder; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.node.Node; import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.search.SearchHits; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class ESTest1 extends Assert { private Node node; private static final String INDEX_NAME = "test_index"; private static final String DOC_ID = "1"; private static final String FIELD_NAME = "title"; private static final String FIELD_VALUE = "Hello, World!"; @Before public void startNode() { node = NodeBuilder.nodeBuilder() .loadConfigSettings(false) .clusterName("mycluster") .local(true) .settings(ImmutableSettings.settingsBuilder() .put("gateway.type", "none") .put("index.number_of_shards", 1) .put("index.number_of_replicas", 1).build() ).node().start(); } @After public void stopNode() { node.stop(); } @Test public void test() throws IOException { Client client = node.client(); IndexResponse res = index(client); assertEquals(DOC_ID, res.id()); refresh(client); SearchHits hits = search(client, "Hello"); assertEquals(1, hits.totalHits()); System.out.println(hits.getAt(0)); System.out.println(hits.getHits()[0]); System.out.println(hits.getHits()[0].getSource()); System.out.println(hits.getHits()[0].getFields()); System.out.println(hits.getAt(0).getFields()); System.out.println(hits.getAt(0).getFields().get(FIELD_NAME)); System.out.println(hits.getAt(0).getFields().get(FIELD_NAME).value()); assertEquals(FIELD_VALUE, hits.getAt(0).getFields().get(FIELD_NAME).value()); } private void refresh(Client client) { client.admin().indices().refresh(refreshRequest()).actionGet(); client.admin().cluster().prepareHealth().setWaitForYellowStatus().setTimeout("10s").execute().actionGet(); } private SearchHits search(Client client, String query) { SearchRequestBuilder srb = client.prepareSearch(INDEX_NAME); srb.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); srb.setQuery(fieldQuery(FIELD_NAME, query)); srb.setFrom(0); srb.setSize(10); srb.setExplain(false); SearchResponse response = srb.execute().actionGet(); return response.getHits(); } private IndexResponse index(Client client) throws IOException { IndexRequestBuilder irb = client.prepareIndex(INDEX_NAME, "node", DOC_ID); XContentBuilder cb = jsonBuilder(); cb.startObject(); cb.field(FIELD_NAME, FIELD_VALUE); cb.endObject(); irb.setSource(cb); irb.setCreate(true); return irb.execute().actionGet(); } }
3e0190a32b23665308aed079dca2f650a6a7baae
735
java
Java
multithreading/src/main/java/com/mythtrad/proj4/lockMethodTest3/test1/Run.java
xiangzz159/JInterview-demo
5669af41897d14e57bdc6f6926ddc3f797edfe8b
[ "MIT" ]
null
null
null
multithreading/src/main/java/com/mythtrad/proj4/lockMethodTest3/test1/Run.java
xiangzz159/JInterview-demo
5669af41897d14e57bdc6f6926ddc3f797edfe8b
[ "MIT" ]
null
null
null
multithreading/src/main/java/com/mythtrad/proj4/lockMethodTest3/test1/Run.java
xiangzz159/JInterview-demo
5669af41897d14e57bdc6f6926ddc3f797edfe8b
[ "MIT" ]
null
null
null
26.25
72
0.552381
650
package com.mythtrad.proj4.lockMethodTest3.test1; /** * @Author:Yerik Xiang * @Date:2020/10/13 15:09 * @Desc: */ public class Run { public static void main(String[] args) throws InterruptedException { final Service service1 = new Service(true); Runnable runnable = new Runnable() { public void run() { service1.serviceMethod(); } }; Thread thread = new Thread(runnable); thread.start(); final Service service2 = new Service(false); runnable = new Runnable() { public void run() { service2.serviceMethod(); } }; thread = new Thread(runnable); thread.start(); } }
3e0190d0f3f710cdd57e5231293c23c4f15f4ba6
3,237
java
Java
KalimaJavaExample/src/org/kalima/example/client/Client.java
Kalima-Systems/Kalima-Tuto
4ea4760e4f6d02ff00fa4180dfd12939e35d5fdf
[ "MIT" ]
3
2021-02-11T15:57:09.000Z
2022-02-25T13:22:38.000Z
KalimaJavaExample/src/org/kalima/example/client/Client.java
Kalima-Systems/Kalima-Tuto
4ea4760e4f6d02ff00fa4180dfd12939e35d5fdf
[ "MIT" ]
null
null
null
KalimaJavaExample/src/org/kalima/example/client/Client.java
Kalima-Systems/Kalima-Tuto
4ea4760e4f6d02ff00fa4180dfd12939e35d5fdf
[ "MIT" ]
null
null
null
29.972222
138
0.71764
651
package org.kalima.example.client; import java.io.IOException; import java.sql.Timestamp; import java.util.Arrays; import java.util.Map; import java.util.Random; import java.util.Scanner; import org.kalima.cache.lib.Clone; import org.kalima.cache.lib.ClonePreferences; import org.kalima.cache.lib.KMsg; import org.kalima.cache.lib.KProps; import org.kalima.cache.lib.KalimaNode; import org.kalima.dbmodel.Person; import org.kalima.dbmodel.Thing; import org.kalima.kalimamq.crypto.KKeyStore; import org.kalima.kalimamq.message.KMessage; import org.kalima.kalimamq.nodelib.KCache; import org.kalima.kalimamq.nodelib.Node; import org.kalima.util.Logger; public class Client implements KalimaNode { private Node node; private Clone clone; private Logger logger; private KalimaClientCallBack clientCallBack; private ClonePreferences clonePreferences; private String gitUser; private String gitPassword; public Client(String[] args) { clonePreferences = new ClonePreferences(args[0]); logger = clonePreferences.getLoadConfig().getLogger(); } public void run() { try { Scanner scanner = new Scanner(System.in); System.out.println("Do you want use Smart Contracts ? (Y/n)"); String resp = scanner.nextLine(); if(resp.equalsIgnoreCase("Y")) { System.out.println("Enter git username: "); gitUser = scanner.nextLine(); System.out.println("Enter git password: "); gitPassword = scanner.nextLine(); } scanner.close(); initComponents(); Thread.sleep(2000); System.out.println("GO"); // Here we make 10 transactions with body "hello x" in cache path "/sensors", with key "keyx" // new KProps("10") set the ttl (time to live) to 10 seconds. So, the record will be automatically deleted in memCaches after 10 second // But of course, all transactions are still present in blockchain for(int i=0 ; i<10 ; i++) { String body = String.valueOf(21 + i); KMsg kMsg = new KMsg(0); node.sendToNotaryNodes(kMsg.getMessage(node.getDevID(), KMessage.PUB, "/sensors", "key" + i, body.getBytes(), new KProps("10"))); Thread.sleep(1000); } } catch (Exception e) { logger.log_srvMsg("ExampleClientNode", "Client", Logger.ERR, e); } } public void rmCache(String cachePath) throws InterruptedException { for(Map.Entry<String, KMessage> entry : clone.getMemCache(cachePath).getKvmap().entrySet()) { KMsg msg = KMsg.setMessage(entry.getValue()); KMsg kMsg = new KMsg(0); node.sendToNotaryNodes(kMsg.getMessage(node.getDevID(), KMsg.PUB, cachePath, msg.getKey(), "".getBytes(), new KProps("-1"))); } } public void initComponents(){ node = new Node(clonePreferences.getLoadConfig()); clone = new Clone(clonePreferences, node); clientCallBack = new KalimaClientCallBack(this, gitUser, gitPassword); try { node.connect(null, clientCallBack); } catch (IOException e) { logger.log_srvMsg("ExampleClientNode", "Client", Logger.ERR, "initComponents initNode failed : " + e.getMessage()); } } public static void main(String[] args) { new Client(args).run(); } public Node getNode() { return node; } @Override public Logger getLogger() { return logger; } @Override public Clone getClone() { return clone; } }
3e019127de8be4e90125e668d91ab45664ff3e72
1,214
java
Java
FRC-2015cb/src/org/team2642/robot/commands/DriveTrain/DriveForward.java
PittPiratesRobotics2642/FRC-2015cb
3587aacb3974bb1c746fb5c0b223dc98c8f32e3d
[ "MIT" ]
2
2015-03-08T01:41:35.000Z
2015-05-23T23:19:39.000Z
FRC-2015cb/src/org/team2642/robot/commands/DriveTrain/DriveForward.java
PittPiratesRobotics2642/FRC-2015cb
3587aacb3974bb1c746fb5c0b223dc98c8f32e3d
[ "MIT" ]
null
null
null
FRC-2015cb/src/org/team2642/robot/commands/DriveTrain/DriveForward.java
PittPiratesRobotics2642/FRC-2015cb
3587aacb3974bb1c746fb5c0b223dc98c8f32e3d
[ "MIT" ]
null
null
null
23.803922
79
0.672982
652
package org.team2642.robot.commands.DriveTrain; import org.team2642.robot.Robot; import edu.wpi.first.wpilibj.command.Command; /** * */ public class DriveForward extends Command { double distance; double setangle; public DriveForward(double inches) { requires(Robot.driveTrain); distance = inches; } // Called just before this Command runs the first time protected void initialize() { setangle = Robot.driveTrain.getGyro(); } // Called repeatedly when this Command is scheduled to run protected void execute() { if (distance > 0) { Robot.driveTrain.driveStraight(0.7, setangle); } else if (distance < 0) { Robot.driveTrain.driveStraight(-0.7, setangle); } } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return Robot.driveTrain.distanceOnTarget(distance); } // Called once after isFinished returns true protected void end() { Robot.driveTrain.stopMotors(); } // Called when another command which requires one or more of the same // subsystems is scheduled to run protected void interrupted() { end(); } }
3e0191a48b18807664c919130c41ff784697039e
392
java
Java
src/main/java/stew6/ui/Launcher.java
argius/Stew6
55da5d62bd80630ed8087fec47f5d61d113c0f50
[ "Apache-2.0" ]
1
2020-01-25T09:42:12.000Z
2020-01-25T09:42:12.000Z
src/main/java/stew6/ui/Launcher.java
argius/Stew6
55da5d62bd80630ed8087fec47f5d61d113c0f50
[ "Apache-2.0" ]
null
null
null
src/main/java/stew6/ui/Launcher.java
argius/Stew6
55da5d62bd80630ed8087fec47f5d61d113c0f50
[ "Apache-2.0" ]
null
null
null
18.666667
66
0.647959
653
package stew6.ui; import stew6.*; public interface Launcher { void launch(Environment env); default void launchWith(OutputProcessor op) { Environment env = new Environment(); env.setOutputProcessor(op); launch(env); } default void launchWith(OutputProcessor op, Environment env) { env.setOutputProcessor(op); launch(env); } }
3e0192447a869ab59e37aef9ebe019694afbb460
7,603
java
Java
src/sedona/src/sedona/sox/SoxComponent.java
vancepym/sedona-1.2
63f71564b8418e2e8e502b6f84e3fcc832f2c0a6
[ "AFL-1.1" ]
26
2015-02-16T18:35:06.000Z
2021-12-22T03:10:32.000Z
src/sedona/src/sedona/sox/SoxComponent.java
vancepym/sedona-1.2
63f71564b8418e2e8e502b6f84e3fcc832f2c0a6
[ "AFL-1.1" ]
40
2015-09-29T11:19:16.000Z
2021-07-12T02:53:35.000Z
src/sedona/src/sedona/sox/SoxComponent.java
vancepym/sedona-1.2
63f71564b8418e2e8e502b6f84e3fcc832f2c0a6
[ "AFL-1.1" ]
34
2015-12-10T02:53:21.000Z
2022-01-13T16:28:30.000Z
25.772881
85
0.498619
654
// // Copyright (c) 2007 Tridium, Inc. // Licensed under the Academic Free License version 3.0 // // History: // 21 Jun 07 Brian Frank Creation // package sedona.sox; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import sedona.*; import sedona.util.ArrayUtil; /** * SoxComponent represents a remote Sedona component * being accessed over a SoxClient session. */ public class SoxComponent extends Component { ////////////////////////////////////////////////////////////////////////// // Constructor ////////////////////////////////////////////////////////////////////////// /** * Public constructor for testing only - always load from SoxClient. */ public SoxComponent(SoxClient client, int id, Type type) { super(type); this.client = client; this.id = id; } ////////////////////////////////////////////////////////////////////////// // Identity ////////////////////////////////////////////////////////////////////////// /** * Get associated SoxClient being used to access * this remote representation of a component. */ public SoxClient client() { return client; } /** * Get the id which identifies this component in its app. */ public int id() { return id; } /** * Get the component name which is unique with its parent. */ public String name() { return name; } public Component getParent() { return parent(); } public Component[] getChildren() { return children(); } public Component getChild(String name) { return child(name); } /** * Get the parent id. */ public int parentId() { return parent; } /** * Get my parent component. If this is the first time the * parent has been accessed, then method will block to perform * a network call. */ public SoxComponent parent() { try { if (id == 0) return null; return client.load(parent); } catch (Exception e) { throw new SoxException("Cannot read parent", e); } } /** * Get the children ids. */ public int[] childrenIds() { return (int[])children.clone(); } /** * Get list of this component's children. If the children * have not been loaded yet, then this method will block to * perform one or more network calls. */ public SoxComponent[] children() { try { // load chlidren int[] ids = this.children; SoxComponent[] comps = client.load(ids, false); // check if we had any errors reading the children boolean errors = false; for (int i=0; i<comps.length; ++i) if (comps[i] == null) { errors = true; break; } if (!errors) return comps; // if we had errors it means that the children array // on client side doesn't match the reality of the // server, so ignore the children ids in error ArrayList acc = new ArrayList(); for (int i=0; i<comps.length; ++i) if (comps[i] != null) acc.add(comps[i]); comps = (SoxComponent[])acc.toArray(new SoxComponent[acc.size()]); // save away actual list of ids we are using now ids = new int[comps.length]; for (int i=0; i<comps.length; ++i) ids[i] = comps[i].id; this.children = ids; return comps; } catch (Exception e) { throw new SoxException("Cannot read children", e); } } /** * Lookup a child by its simple name. If the children * have not been loaded yet, then this method will block to * perform one or more network calls. */ public SoxComponent child(String name) { // scan linear - might want to stick kids in a // hash table, but that is probably overkill SoxComponent[] kids = (SoxComponent[])children(); for (int i=0; i<kids.length; ++i) if (name.equals(kids[i].name)) return kids[i]; return null; } /** * Get the list of links into and out of this component. */ public Link[] links() { return (Link[])links.clone(); } //////////////////////////////////////////////////////////////// // Security //////////////////////////////////////////////////////////////// /** * Return the permissions bitmask which defines what the * current client has access to do on this component. This * value is available after tree load, and defaults to zero * until then. */ public int permissions() { return permissions; } //////////////////////////////////////////////////////////////// // Internal Children Id Management //////////////////////////////////////////////////////////////// synchronized void setChildren(int[] newChildren) { HashSet set = new HashSet(newChildren.length); for (int i=0; i<newChildren.length; ++i) set.add(new Integer(newChildren[i])); if (children != null) { for (int i=0; i<children.length; ++i) { if (!set.contains(new Integer(children[i]))) { SoxComponent c = client.cache(children[i]); if (c != null) client.cacheRemove(c); } } } this.children = newChildren; } synchronized void addChild(int child) { for (int i=0; i<children.length; ++i) if (children[i] == child) return; children = ArrayUtil.addOne(children, child); } synchronized void removeChild(int child) { children = ArrayUtil.removeOne(children, child); } ////////////////////////////////////////////////////////////////////////// // Subscription ////////////////////////////////////////////////////////////////////////// /** * Get the bitmask of what is subscribed or 0 if not subscribed * at all. If the SoxClient's watch was subscribed with allTreeEvents * then the TREE bit is always set. */ public int subscription() { return (this.subscription) | (client.allTreeEvents ? TREE : 0); } /** * Fire a changed event on the listener. */ public void fireChanged(int mask) { try { if (listener != null) listener.changed(this, mask); } catch (Throwable e) { e.printStackTrace(); } } ////////////////////////////////////////////////////////////////////////// // Debug ////////////////////////////////////////////////////////////////////////// public void dump() { dump(new PrintWriter(System.out)); } public void dump(PrintWriter out) { Slot[] slots = type.slots; out.println(type + " " + id + " " + name); for (int i=0; i<slots.length; ++i) { Slot slot = slots[i]; if (slot.isProp()) out.println(" " + slot.name + " = " + get(slot)); } out.flush(); } ////////////////////////////////////////////////////////////////////////// // Fields ////////////////////////////////////////////////////////////////////////// public static final int TREE = 0x01; public static final int CONFIG = 0x02; public static final int RUNTIME = 0x04; public static final int LINKS = 0x08; public SoxComponentListener listener; final SoxClient client; final int id; String name; int parent; int subscription; Link[] links = Link.none; int[] children = new int[0]; int permissions; }
3e019289dfa8b8224512d7cb861559599737095f
3,565
java
Java
data-service-center/data-service-common/datax-common/src/main/java/com/alibaba/datax/common/element/LongColumn.java
PorcupineBoy/dataServiceCenter
bd86767a4a8b5f60aa9c93eb6f84c0348617fa08
[ "Apache-2.0" ]
1
2022-01-18T02:27:45.000Z
2022-01-18T02:27:45.000Z
data-service-center/data-service-common/datax-common/src/main/java/com/alibaba/datax/common/element/LongColumn.java
PorcupineBoy/dataServiceCenter
bd86767a4a8b5f60aa9c93eb6f84c0348617fa08
[ "Apache-2.0" ]
null
null
null
data-service-center/data-service-common/datax-common/src/main/java/com/alibaba/datax/common/element/LongColumn.java
PorcupineBoy/dataServiceCenter
bd86767a4a8b5f60aa9c93eb6f84c0348617fa08
[ "Apache-2.0" ]
null
null
null
22.006173
94
0.697055
655
package com.alibaba.datax.common.element; import com.alibaba.datax.common.exception.CommonErrorCode; import com.alibaba.datax.common.exception.DataXException; import org.apache.commons.lang3.math.NumberUtils; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; public class LongColumn extends Column { /** * 从整形字符串表示转为LongColumn,支持Java科学计数法 * * NOTE: <br> * 如果data为浮点类型的字符串表示,数据将会失真,请使用DoubleColumn对接浮点字符串 * * */ public LongColumn(final String data) { super(null, Column.Type.LONG, 0); if (null == data) { return; } try { BigInteger rawData = NumberUtils.createBigDecimal(data) .toBigInteger(); super.setRawData(rawData); // 当 rawData 为[0-127]时,rawData.bitLength() < 8,导致其 byteSize = 0,简单起见,直接认为其长度为 data.length() // super.setByteSize(rawData.bitLength() / 8); super.setByteSize(data.length()); } catch (Exception e) { throw DataXException.asDataXException( CommonErrorCode.CONVERT_NOT_SUPPORT, String.format("String[%s]不能转为Long .", data)); } } public LongColumn(Long data) { this(null == data ? (BigInteger) null : BigInteger.valueOf(data)); } public LongColumn(Integer data) { this(null == data ? (BigInteger) null : BigInteger.valueOf(data)); } public LongColumn(BigInteger data) { this(data, null == data ? 0 : 8); } private LongColumn(BigInteger data, int byteSize) { super(data, Column.Type.LONG, byteSize); } public LongColumn() { this((BigInteger) null); } public LongColumn (final String data,final String columnName){ this(data); this.setColumnName(columnName); } public LongColumn(Long data,String columnName) { this(null == data ? (BigInteger) null : BigInteger.valueOf(data)); this.setColumnName(columnName); } public LongColumn(Integer data,String columnName) { this(null == data ? (BigInteger) null : BigInteger.valueOf(data)); this.setColumnName(columnName); } public LongColumn(BigInteger data,String columnName) { this(data, null == data ? 0 : 8); this.setColumnName(columnName); } private LongColumn(BigInteger data, int byteSize,String columnName) { super(data, Column.Type.LONG, byteSize); this.setColumnName(columnName); } @Override public BigInteger asBigInteger() { if (null == this.getRawData()) { return null; } return (BigInteger) this.getRawData(); } @Override public Long asLong() { BigInteger rawData = (BigInteger) this.getRawData(); if (null == rawData) { return null; } OverFlowUtil.validateLongNotOverFlow(rawData); return rawData.longValue(); } @Override public Double asDouble() { if (null == this.getRawData()) { return null; } BigDecimal decimal = this.asBigDecimal(); OverFlowUtil.validateDoubleNotOverFlow(decimal); return decimal.doubleValue(); } @Override public Boolean asBoolean() { if (null == this.getRawData()) { return null; } return this.asBigInteger().compareTo(BigInteger.ZERO) != 0 ? true : false; } @Override public BigDecimal asBigDecimal() { if (null == this.getRawData()) { return null; } return new BigDecimal(this.asBigInteger()); } @Override public String asString() { if (null == this.getRawData()) { return null; } return ((BigInteger) this.getRawData()).toString(); } @Override public Date asDate() { if (null == this.getRawData()) { return null; } return new Date(this.asLong()); } @Override public byte[] asBytes() { throw DataXException.asDataXException( CommonErrorCode.CONVERT_NOT_SUPPORT, "Long类型不能转为Bytes ."); } }
3e0192a3867230b2440da268626d264c4b1d1835
102
java
Java
shared/shared-api/src/main/java/com/whippyteam/api/entity/IdentifableEntity.java
WhippyTeam/WhippyReloaded
91b8b397811909282d8376bb4d7197881528e0cf
[ "MIT" ]
11
2018-09-08T17:06:52.000Z
2022-03-20T22:00:26.000Z
shared/shared-api/src/main/java/com/whippyteam/api/entity/IdentifableEntity.java
WhippyTeam/WhippyReloaded
91b8b397811909282d8376bb4d7197881528e0cf
[ "MIT" ]
20
2019-11-30T22:19:53.000Z
2022-03-01T20:14:55.000Z
shared/shared-api/src/main/java/com/whippyteam/api/entity/IdentifableEntity.java
WhippyTeam/WhippyReloaded
91b8b397811909282d8376bb4d7197881528e0cf
[ "MIT" ]
3
2018-09-09T17:44:27.000Z
2019-12-01T16:38:24.000Z
14.571429
39
0.745098
656
package com.whippyteam.api.entity; public interface IdentifableEntity<T> { T getIdentifier(); }
3e0192bae65f0adbc5d0d8ba339b511aa5cdc3e4
1,420
java
Java
php/classes.src/protocol/MoveRoleCreate.java
marhazk/jsp
4fde35c0dfbec747683ed4668be34db75a337a13
[ "FSFAP" ]
null
null
null
php/classes.src/protocol/MoveRoleCreate.java
marhazk/jsp
4fde35c0dfbec747683ed4668be34db75a337a13
[ "FSFAP" ]
null
null
null
php/classes.src/protocol/MoveRoleCreate.java
marhazk/jsp
4fde35c0dfbec747683ed4668be34db75a337a13
[ "FSFAP" ]
2
2015-05-12T14:21:59.000Z
2021-12-03T02:42:00.000Z
30.869565
90
0.523239
657
/* */ package protocol; /* */ /* */ import com.goldhuman.IO.Protocol.ProtocolException; /* */ import com.goldhuman.IO.Protocol.Rpc; /* */ import com.goldhuman.IO.Protocol.Rpc.Data; /* */ /* */ public final class MoveRoleCreate extends Rpc /* */ { /* */ public int retcode; /* */ public int roleid; /* */ /* */ public void Server(Rpc.Data argument, Rpc.Data result) /* */ throws ProtocolException /* */ { /* 15 */ MoveRoleCreateArg arg = (MoveRoleCreateArg)argument; /* 16 */ MoveRoleCreateRes res = (MoveRoleCreateRes)result; /* */ } /* */ /* */ public void Client(Rpc.Data argument, Rpc.Data result) throws ProtocolException /* */ { /* 21 */ MoveRoleCreateArg arg = (MoveRoleCreateArg)argument; /* 22 */ MoveRoleCreateRes res = (MoveRoleCreateRes)result; /* */ /* 24 */ synchronized (this) /* */ { /* 26 */ this.retcode = res.retcode; /* 27 */ this.roleid = res.roleid; /* 28 */ notify(); /* */ } /* */ } /* */ /* */ public void OnTimeout() /* */ { /* 34 */ synchronized (this) /* */ { /* 36 */ this.retcode = 4; /* 37 */ this.roleid = -1; /* 38 */ notify(); /* */ } /* */ } /* */ } /* Location: D:\PW\1.4.5iweb\iweb\WEB-INF\classes\ * Qualified Name: protocol.MoveRoleCreate * JD-Core Version: 0.6.2 */
3e0192f41dd01217d06ee04786d31be8c205a5b3
1,700
java
Java
transform/src/main/java/com/github/pfichtner/maedle/transform/util/jar/ToResourceTransformer.java
pfichtner/maedle
9f0f75b40d0209516ca20a387510b07c8da29447
[ "Apache-2.0" ]
null
null
null
transform/src/main/java/com/github/pfichtner/maedle/transform/util/jar/ToResourceTransformer.java
pfichtner/maedle
9f0f75b40d0209516ca20a387510b07c8da29447
[ "Apache-2.0" ]
1
2021-04-17T12:19:21.000Z
2021-04-17T12:19:21.000Z
transform/src/main/java/com/github/pfichtner/maedle/transform/util/jar/ToResourceTransformer.java
pfichtner/maedle
9f0f75b40d0209516ca20a387510b07c8da29447
[ "Apache-2.0" ]
null
null
null
32.075472
114
0.777059
658
package com.github.pfichtner.maedle.transform.util.jar; import static com.pfichtner.github.maedle.transform.PluginWriter.createPlugin; import java.io.IOException; import org.objectweb.asm.Type; import com.pfichtner.github.maedle.transform.TransformationParameters; import com.pfichtner.github.maedle.transform.TransformationResult; @Deprecated public class ToResourceTransformer { public static interface Resource { void add(byte[] content, String path) throws IOException; } private final Resource resource; public ToResourceTransformer(Resource resource) { this.resource = resource; } public void add(TransformationParameters parameters, Type pluginType, PluginInfo pluginInfo) throws IOException { TransformationResult result = new TransformationResult(parameters); Type mojoType = parameters.getMojoClass(); add(result.getTransformedMojo(), toPath(mojoType)); add(result.getExtension(), toPath(parameters.getExtensionClass())); add(createPlugin(pluginType, parameters.getExtensionClass(), mojoType, taskName(parameters), pluginInfo.extensionName), toPath(pluginType)); // TODO we should check if file already exists and append content if add(("implementation-class=" + pluginType.getInternalName().replace('/', '.')).getBytes(), "META-INF/gradle-plugins/" + pluginInfo.pluginId + ".properties"); } private String taskName(TransformationParameters parameters) { return String.valueOf(parameters.getMojoData().getMojoAnnotationValues().get("name")); } public void add(byte[] content, String path) throws IOException { resource.add(content, path); } private static String toPath(Type type) { return type.getInternalName() + ".class"; } }
3e0193374b7254a573c78d73601aaae6f44ba34c
21,719
java
Java
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmCommand.java
raksha-rao/gluster-ovirt
cfb4bf1e133861b12ea7f9c817a98ea1fc0402de
[ "Apache-2.0" ]
1
2019-01-12T06:47:20.000Z
2019-01-12T06:47:20.000Z
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmCommand.java
anjalshireesh/gluster-ovirt-poc
8778ec6809aac91034f1a497383b4ba500f11848
[ "Apache-2.0" ]
null
null
null
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ExportVmCommand.java
anjalshireesh/gluster-ovirt-poc
8778ec6809aac91034f1a497383b4ba500f11848
[ "Apache-2.0" ]
2
2015-01-15T19:06:01.000Z
2015-04-29T08:15:29.000Z
44.506148
119
0.617202
659
package org.ovirt.engine.core.bll; import java.util.List; import java.util.Map; import org.ovirt.engine.core.bll.command.utils.StorageDomainSpaceChecker; import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.action.MoveOrCopyImageGroupParameters; import org.ovirt.engine.core.common.action.MoveVmParameters; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.businessentities.CopyVolumeType; import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.common.businessentities.DiskImageBase; import org.ovirt.engine.core.common.businessentities.StorageDomainType; import org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VmNetworkInterface; import org.ovirt.engine.core.common.businessentities.VmTemplate; import org.ovirt.engine.core.common.businessentities.VolumeFormat; import org.ovirt.engine.core.common.queries.DiskImageList; import org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParamenters; import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; import org.ovirt.engine.core.common.queries.VdcQueryType; import org.ovirt.engine.core.common.vdscommands.GetImageInfoVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.UpdateVMVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.common.vdscommands.VDSReturnValue; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.KeyValuePairCompat; import org.ovirt.engine.core.compat.LogCompat; import org.ovirt.engine.core.compat.LogFactoryCompat; import org.ovirt.engine.core.compat.RefObject; import org.ovirt.engine.core.compat.StringHelper; import org.ovirt.engine.core.dal.VdcBllMessages; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.utils.linq.Function; import org.ovirt.engine.core.utils.linq.LinqUtils; import org.ovirt.engine.core.utils.linq.Predicate; import org.ovirt.engine.core.utils.ovf.OvfManager; import org.ovirt.engine.core.utils.transaction.TransactionMethod; import org.ovirt.engine.core.utils.transaction.TransactionSupport; @NonTransactiveCommandAttribute(forceCompensation = true) public class ExportVmCommand<T extends MoveVmParameters> extends MoveOrCopyTemplateCommand<T> { /** * Constructor for command creation when compensation is applied on startup * * @param commandId */ protected ExportVmCommand(Guid commandId) { super(commandId); } public ExportVmCommand(T parameters) { super(parameters); setVmId(parameters.getContainerId()); parameters.setEntityId(getVmId()); setStoragePoolId(getVm().getstorage_pool_id()); } @Override protected boolean canDoAction() { boolean retVal = true; if (getVm() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } else { setDescription(getVmName()); } // check that target domain exists if (retVal) { retVal = ImportExportCommon.CheckStorageDomain(getParameters().getStorageDomainId(), getReturnValue() .getCanDoActionMessages()); } // load the disks of vm from database VmHandler.updateDisksFromDb(getVm()); // update vm snapshots for storage free space check for (DiskImage diskImage : getVm().getDiskMap().values()) { diskImage.getSnapshots().addAll( ImagesHandler.getAllImageSnapshots(diskImage.getId(), diskImage.getit_guid())); } setStoragePoolId(getVm().getstorage_pool_id()); // check that the target and source domain are in the same storage_pool if (DbFacade.getInstance() .getStoragePoolIsoMapDAO() .get(new StoragePoolIsoMapId(getStorageDomain().getid(), getVm().getstorage_pool_id())) == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH); } // check if template exists only if asked for if (retVal && getParameters().getTemplateMustExists()) { retVal = CheckTemplateInStorageDomain(getVm().getstorage_pool_id(), getParameters().getStorageDomainId(), getVm().getvmt_guid()); if (!retVal) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NOT_FOUND_ON_EXPORT_DOMAIN); getReturnValue().getCanDoActionMessages().add( String.format("$TemplateName %1$s", getVm().getvmt_name())); } } // check if Vm has disks if (retVal && getVm().getDiskMap().size() <= 0) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_HAS_NO_DISKS); retVal = false; } if (retVal) { Map<String, ? extends DiskImageBase> images = getParameters().getDiskInfoList(); if (images == null) { images = getVm().getDiskMap(); } // check that the images requested format are valid (COW+Sparse) retVal = ImagesHandler.CheckImagesConfiguration(getParameters().getStorageDomainId(), new java.util.ArrayList<DiskImageBase>(images.values()), getReturnValue().getCanDoActionMessages()); if (retVal && getParameters().getCopyCollapse()) { for (DiskImage img : getVm().getDiskMap().values()) { if (images.containsKey(img.getinternal_drive_mapping())) { // check that no RAW format exists (we are in collapse // mode) if (images.get(img.getinternal_drive_mapping()).getvolume_format() == VolumeFormat.RAW && img.getvolume_format() != VolumeFormat.RAW) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_EXPORT_RAW_FORMAT); retVal = false; } } } } } // check destination storage is active if (retVal) { retVal = IsDomainActive(getStorageDomain().getid(), getVm().getstorage_pool_id()); } // check destination storage is Export domain if (retVal) { if (getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SPECIFY_DOMAIN_IS_NOT_EXPORT_DOMAIN); retVal = false; } } // check destination storage have free space if (retVal) { int sizeInGB = (int) getVm().getActualDiskWithSnapshotsSize(); retVal = StorageDomainSpaceChecker.hasSpaceForRequest(getStorageDomain(), sizeInGB); if (!retVal) addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); } // Set source domain if (retVal) { // DiskImage image = null; //LINQ Vm.DiskMap.First().Value; DiskImage image = LinqUtils.first(getVm().getDiskMap().values()); if (image == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_HAS_NO_DISKS); retVal = false; } if (retVal) { SetSourceDomainId(image.getstorage_id().getValue()); if (getSourceDomain() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); retVal = false; } } } // check soource domain is active if (retVal) { retVal = IsDomainActive(getSourceDomain().getid(), getVm().getstorage_pool_id()); } // check that source domain is not ISO or Export domain if (retVal) { if (getSourceDomain().getstorage_domain_type() == StorageDomainType.ISO || getSourceDomain().getstorage_domain_type() == StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } } // check if Vm exists in export domain if (retVal) { retVal = CheckVmInStorageDomain(); } if (retVal) { // check that vm is down and images are ok retVal = retVal && ImagesHandler.PerformImagesChecks(getVmId(), getReturnValue().getCanDoActionMessages(), getVm() .getstorage_pool_id(), Guid.Empty, false, true, false, false, true, true, false); } if (!retVal) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EXPORT); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); } return retVal; } @Override protected void executeCommand() { VmHandler.checkStatusAndLockVm(getVm().getvm_guid(), getCompensationContext()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { MoveOrCopyAllImageGroups(); return null; } }); if (!getReturnValue().getTaskIdList().isEmpty()) { setSucceeded(true); } } public boolean UpdateCopyVmInSpm(Guid storagePoolId, java.util.ArrayList<VM> vmsList, Guid storageDomainId) { java.util.HashMap<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndMetaDictionary = new java.util.HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>( vmsList.size()); OvfManager ovfManager = new OvfManager(); for (VM vm : vmsList) { java.util.ArrayList<DiskImage> AllVmImages = new java.util.ArrayList<DiskImage>(); VmHandler.updateDisksFromDb(vm); if (vm.getInterfaces() == null) { // TODO remove this when the API changes vm.getInterfaces().clear(); for(VmNetworkInterface iface: DbFacade.getInstance().getVmNetworkInterfaceDAO() .getAllForVm(vm.getvm_guid())) { vm.getInterfaces().add(iface); } } for (DiskImage disk : vm.getDiskMap().values()) { disk.setParentId(VmTemplateHandler.BlankVmTemplateId); disk.setit_guid(VmTemplateHandler.BlankVmTemplateId); disk.setstorage_id(storageDomainId); DiskImage diskForVolumeInfo = getDiskForVolumeInfo(disk); disk.setvolume_format(diskForVolumeInfo.getvolume_format()); disk.setvolume_type(diskForVolumeInfo.getvolume_type()); VDSReturnValue vdsReturnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.GetImageInfo, new GetImageInfoVDSCommandParameters(storagePoolId, storageDomainId, disk .getimage_group_id().getValue(), disk.getId())); if (vdsReturnValue != null && vdsReturnValue.getSucceeded()) { DiskImage fromVdsm = (DiskImage) vdsReturnValue.getReturnValue(); disk.setactual_size(fromVdsm.getactual_size()); } AllVmImages.add(disk); } if (StringHelper.isNullOrEmpty(vm.getvmt_name())) { VmTemplate t = DbFacade.getInstance().getVmTemplateDAO() .get(vm.getvmt_guid()); vm.setvmt_name(t.getname()); } getVm().setvmt_guid(VmTemplateHandler.BlankVmTemplateId); String vmMeta = null; RefObject<String> tempRefObject = new RefObject<String>(vmMeta); ovfManager.ExportVm(tempRefObject, vm, AllVmImages); vmMeta = tempRefObject.argvalue; // LINQ vmsAndMetaDictionary.Add(vm.vm_guid, new // KeyValuePair<string,List<Guid>> // LINQ (vmMeta, vm.DiskMap.Values.Select(a => // a.image_group_id.Value).ToList())); List<Guid> imageGroupIds = LinqUtils.foreach(vm.getDiskMap().values(), new Function<DiskImage, Guid>() { @Override public Guid eval(DiskImage diskImage) { return diskImage.getimage_group_id().getValue(); } }); vmsAndMetaDictionary .put(vm.getvm_guid(), new KeyValuePairCompat<String, List<Guid>>(vmMeta, imageGroupIds)); } UpdateVMVDSCommandParameters tempVar = new UpdateVMVDSCommandParameters(storagePoolId, vmsAndMetaDictionary); tempVar.setStorageDomainId(storageDomainId); return Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.UpdateVM, tempVar) .getSucceeded(); } @Override protected void MoveOrCopyAllImageGroups() { MoveOrCopyAllImageGroups(getVm().getvm_guid(), getVm().getDiskMap().values()); } @Override protected void MoveOrCopyAllImageGroups(Guid containerID, Iterable<DiskImage> disks) { for (DiskImage disk : disks) { MoveOrCopyImageGroupParameters tempVar = new MoveOrCopyImageGroupParameters(containerID, disk .getimage_group_id().getValue(), disk.getId(), getParameters().getStorageDomainId(), getMoveOrCopyImageOperation()); tempVar.setParentCommand(getActionType()); tempVar.setEntityId(getParameters().getEntityId()); tempVar.setUseCopyCollapse(getParameters().getCopyCollapse()); DiskImage diskForVolumeInfo = getDiskForVolumeInfo(disk); tempVar.setVolumeFormat(diskForVolumeInfo.getvolume_format()); tempVar.setVolumeType(diskForVolumeInfo.getvolume_type()); tempVar.setCopyVolumeType(CopyVolumeType.LeafVol); tempVar.setPostZero(disk.getwipe_after_delete()); tempVar.setForceOverride(getParameters().getForceOverride()); MoveOrCopyImageGroupParameters p = tempVar; p.setParentParemeters(getParameters()); VdcReturnValueBase vdcRetValue = Backend.getInstance().runInternalAction( VdcActionType.MoveOrCopyImageGroup, p); getParameters().getImagesParameters().add(p); getReturnValue().getTaskIdList().addAll(vdcRetValue.getInternalTaskIdList()); } } /** * Return the correct disk to get the volume info (type & allocation) from. For copy collapse it's the ancestral * disk of the given disk, and otherwise it's the disk itself. * * @param disk * The disk for which to get the disk with the info. * @return The disk with the correct volume info. */ private DiskImage getDiskForVolumeInfo(DiskImage disk) { if (getParameters().getCopyCollapse()) { DiskImage ancestor = DbFacade.getInstance().getDiskImageDAO().getAncestor(disk.getId()); if (ancestor == null) { log.warnFormat("Can't find ancestor of Disk with ID {0}, using original disk for volume info.", disk.getId()); ancestor = disk; } return ancestor; } else { return disk; } } protected boolean CheckVmInStorageDomain() { boolean retVal = true; GetAllFromExportDomainQueryParamenters tempVar = new GetAllFromExportDomainQueryParamenters(getVm() .getstorage_pool_id(), getParameters().getStorageDomainId()); tempVar.setGetAll(true); VdcQueryReturnValue qretVal = Backend.getInstance().runInternalQuery(VdcQueryType.GetVmsFromExportDomain, tempVar); if (qretVal.getSucceeded()) { java.util.ArrayList<VM> vms = (java.util.ArrayList<VM>) qretVal.getReturnValue(); for (VM vm : vms) { // check the same id when not overriding if (vm.getvm_guid().equals(getVm().getvm_guid()) && !getParameters().getForceOverride()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_GUID_ALREADY_EXIST); retVal = false; break; // check the same name when not overriding } else if (vm.getvm_name().equals(getVm().getvm_name()) && !getParameters().getForceOverride()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_ALREADY_EXIST); retVal = false; break; // check if we have vm with the same name and overriding } else if (!vm.getvm_guid().equals(getVm().getvm_guid()) && vm.getvm_name().equals(getVm().getvm_name())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_ALREADY_EXIST); retVal = false; break; } // check if we have vm with the same id and overriding else if (vm.getvm_guid().equals(getVm().getvm_guid()) && !vm.getvm_name().equals(getVm().getvm_name())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_GUID_ALREADY_EXIST); retVal = false; break; } } } return retVal; } public static boolean CheckTemplateInStorageDomain(Guid storagePoolId, Guid storageDomainId, final Guid tmplId) { boolean retVal = false; GetAllFromExportDomainQueryParamenters tempVar = new GetAllFromExportDomainQueryParamenters(storagePoolId, storageDomainId); tempVar.setGetAll(true); VdcQueryReturnValue qretVal = Backend.getInstance().runInternalQuery(VdcQueryType.GetTemplatesFromExportDomain, tempVar); if (qretVal.getSucceeded()) { if (!VmTemplateHandler.BlankVmTemplateId.equals(tmplId)) { Map<VmTemplate, DiskImageList> templates = (Map) qretVal.getReturnValue(); // LINQ VAR var tmpl = templates.FirstOrDefault(t => // t.Key.vmt_guid == tmplId); VmTemplate tmpl = LinqUtils.firstOrNull(templates.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate vmTemplate) { return vmTemplate.getId().equals(tmplId); } }); // retVal = false; //LINQ VAR (tmpl.Key != null); retVal = tmpl != null; } else { retVal = true; } } return retVal; } @Override public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: return getSucceeded() ? AuditLogType.IMPORTEXPORT_STARTING_EXPORT_VM : AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; case END_SUCCESS: return getSucceeded() ? AuditLogType.IMPORTEXPORT_EXPORT_VM : AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; case END_FAILURE: return AuditLogType.IMPORTEXPORT_EXPORT_VM_FAILED; } return super.getAuditLogTypeValue(); } protected boolean UpdateVmImSpm() { return VmCommand.UpdateVmInSpm(getVm().getstorage_pool_id(), new java.util.ArrayList<VM>(java.util.Arrays.asList(new VM[] { getVm() })), getParameters() .getStorageDomainId()); } @Override protected void EndSuccessfully() { EndActionOnAllImageGroups(); if (getVm() != null) { VmHandler.UnLockVm(getVm().getvm_guid()); VmHandler.updateDisksFromDb(getVm()); if (getParameters().getCopyCollapse()) { VM vm = getVm(); vm.setvmt_guid(VmTemplateHandler.BlankVmTemplateId); vm.setvmt_name(null); UpdateCopyVmInSpm(getVm().getstorage_pool_id(), new java.util.ArrayList<VM>(java.util.Arrays.asList(new VM[] { vm })), getParameters() .getStorageDomainId()); } else { UpdateVmImSpm(); } } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); } @Override protected void EndWithFailure() { EndActionOnAllImageGroups(); if (getVm() != null) { VmHandler.UnLockVm(getVm().getvm_guid()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); } private static LogCompat log = LogFactoryCompat.getLog(ExportVmCommand.class); }
3e01937740575c3d514879870a300fc9cb22be10
286
java
Java
src/thinkinjava/annotation/Test.java
imckh/java-learning
12376894ebc9f717d7bdc1fa2c7c2470a10eb9e7
[ "Apache-2.0" ]
null
null
null
src/thinkinjava/annotation/Test.java
imckh/java-learning
12376894ebc9f717d7bdc1fa2c7c2470a10eb9e7
[ "Apache-2.0" ]
null
null
null
src/thinkinjava/annotation/Test.java
imckh/java-learning
12376894ebc9f717d7bdc1fa2c7c2470a10eb9e7
[ "Apache-2.0" ]
null
null
null
23.833333
44
0.832168
660
package thinkinjava.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Test { }
3e0193ab3f3e82d0b23579aa15ff9d054c2edda0
97,334
java
Java
tests/time/rmosa/tests/s1009/69_lhamacaw/evosuite-tests/macaw/businessLayer/Variable_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
null
null
null
tests/time/rmosa/tests/s1009/69_lhamacaw/evosuite-tests/macaw/businessLayer/Variable_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
3
2020-11-16T20:40:56.000Z
2021-03-23T00:18:04.000Z
tests/time/rmosa/tests/s1009/69_lhamacaw/evosuite-tests/macaw/businessLayer/Variable_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
null
null
null
34.020972
176
0.690334
661
/* * This file was automatically generated by EvoSuite * Sat Nov 28 19:59:45 GMT 2020 */ package macaw.businessLayer; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import java.util.ArrayList; import java.util.Collection; import java.util.ConcurrentModificationException; import macaw.businessLayer.DerivedVariable; import macaw.businessLayer.OntologyTerm; import macaw.businessLayer.RawVariable; import macaw.businessLayer.SupportingDocument; import macaw.businessLayer.User; import macaw.businessLayer.ValueLabel; import macaw.businessLayer.Variable; import macaw.businessLayer.VariableSummary; import macaw.system.MacawChangeEvent; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class Variable_ESTest extends Variable_ESTest_scaffolding { /** //Test case number: 0 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test000() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCleaningDescription("N)zL\"PmyXR>Q+lD"); RawVariable rawVariable1 = (RawVariable)rawVariable0.clone(); assertEquals("N)zL\"PmyXR>Q+lD", rawVariable1.getCleaningDescription()); assertEquals("Unknown", rawVariable1.getCleaningStatus()); assertFalse(rawVariable1.isCoded()); assertFalse(rawVariable1.isCleaned()); assertEquals("Unknown", rawVariable1.getCategory()); assertEquals(0, rawVariable1.getIdentifier()); assertFalse(rawVariable1.isNewRecord()); assertEquals("Unknown", rawVariable1.getAvailability()); } /** //Test case number: 1 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test001() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setYear("kZ'|v>"); rawVariable0.clone(); assertEquals("kZ'|v>", rawVariable0.getYear()); } /** //Test case number: 2 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test002() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.questionNumber = "UNABLE_TO_GET_CLEANING_STATES"; DerivedVariable derivedVariable1 = (DerivedVariable)derivedVariable0.clone(); assertFalse(derivedVariable1.isCleaned()); assertEquals("", derivedVariable1.getYear()); assertEquals("", derivedVariable1.getForm()); assertEquals("", derivedVariable1.getLabel()); assertFalse(derivedVariable1.isNewRecord()); assertEquals("", derivedVariable1.getColumnEnd()); assertEquals("", derivedVariable1.getColumnStart()); assertEquals("UNABLE_TO_GET_CLEANING_STATES", derivedVariable1.getQuestionNumber()); assertEquals("", derivedVariable1.getCodeBookNumber()); assertEquals("Unknown", derivedVariable1.getCleaningStatus()); assertEquals("Unknown", derivedVariable1.getCategory()); assertEquals("0", derivedVariable1.getDisplayItemIdentifier()); assertEquals("Unknown", derivedVariable1.getAvailability()); assertEquals("", derivedVariable1.getNotes()); assertFalse(derivedVariable1.isCoded()); } /** //Test case number: 3 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test003() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.codeBookNumber = ")6H*^0+4r"; RawVariable rawVariable1 = (RawVariable)rawVariable0.clone(); assertEquals(")6H*^0+4r", rawVariable1.getCodeBookNumber()); assertEquals("Unknown", rawVariable1.getAvailability()); assertFalse(rawVariable1.isCoded()); assertEquals("", rawVariable1.getNotes()); assertEquals("", rawVariable1.getQuestionNumber()); assertEquals("", rawVariable1.getDisplayName()); assertEquals("Unknown", rawVariable1.getCleaningStatus()); assertEquals(0, rawVariable1.getIdentifier()); assertEquals("", rawVariable1.getAlias()); assertFalse(rawVariable1.isNewRecord()); assertEquals("", rawVariable1.getYear()); assertEquals("", rawVariable1.getCleaningDescription()); assertEquals("Unknown", rawVariable1.getCategory()); assertEquals("", rawVariable1.getColumnStart()); } /** //Test case number: 4 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test004() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setNotes("-%ISt"); rawVariable0.clone(); assertEquals("-%ISt", rawVariable0.getNotes()); } /** //Test case number: 5 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test005() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.columnStart = "N)zL\"PmyXR>Q+lD"; RawVariable rawVariable1 = (RawVariable)rawVariable0.clone(); assertEquals("N)zL\"PmyXR>Q+lD", rawVariable1.getColumnStart()); assertFalse(rawVariable1.isCleaned()); assertEquals("", rawVariable1.getName()); assertEquals("", rawVariable1.getForm()); assertEquals("", rawVariable1.getColumnEnd()); assertEquals("", rawVariable1.getLabel()); assertEquals("Unknown", rawVariable1.getCategory()); assertEquals("0", rawVariable1.getDisplayItemIdentifier()); assertFalse(rawVariable1.isNewRecord()); assertEquals("", rawVariable1.getQuestionNumber()); assertFalse(rawVariable1.isCoded()); assertEquals("Unknown", rawVariable1.getAvailability()); assertEquals("", rawVariable1.getNotes()); assertEquals("Unknown", rawVariable1.getCleaningStatus()); assertEquals("", rawVariable1.getFilePath()); } /** //Test case number: 6 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test006() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.columnEnd = null; DerivedVariable derivedVariable1 = (DerivedVariable)derivedVariable0.clone(); assertEquals("Unknown", derivedVariable1.getCleaningStatus()); assertEquals("Unknown", derivedVariable1.getAvailability()); assertFalse(derivedVariable1.isCoded()); assertEquals("Unknown", derivedVariable1.getCategory()); assertEquals("0", derivedVariable1.getDisplayItemIdentifier()); assertFalse(derivedVariable1.isCleaned()); assertFalse(derivedVariable1.isNewRecord()); } /** //Test case number: 7 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test007() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setLabel("-%ISt"); rawVariable0.clone(); assertEquals("-%ISt", rawVariable0.getLabel()); } /** //Test case number: 8 /*Coverage entropy=3.044820482464577 */ @Test(timeout = 4000) public void test008() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setName("variable.columnStart.label"); rawVariable0.clone(); assertEquals("variable.columnStart.label", rawVariable0.getDisplayName()); } /** //Test case number: 9 /*Coverage entropy=1.4978661367769954 */ @Test(timeout = 4000) public void test009() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); RawVariable rawVariable0 = new RawVariable(); derivedVariable0.setAlternativeVariable(rawVariable0); derivedVariable0.setIdentifier(152); User user0 = new User(); Variable.detectChangesInAlternativeVariable(user0, derivedVariable0, derivedVariable0); assertEquals(152, derivedVariable0.getIdentifier()); assertEquals("152", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 10 /*Coverage entropy=1.5171515848932915 */ @Test(timeout = 4000) public void test010() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); RawVariable rawVariable0 = new RawVariable(); derivedVariable0.setAlternativeVariable(derivedVariable0); // Undeclared exception! try { Variable.detectChangesInAlternativeVariable((User) null, derivedVariable0, rawVariable0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 11 /*Coverage entropy=2.2522392503365087 */ @Test(timeout = 4000) public void test011() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setLabel("X"); User user0 = new User("X", "X"); DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setName("X"); Variable.detectFieldChanges(user0, rawVariable0, derivedVariable0); assertEquals("X", derivedVariable0.getName()); assertEquals("X", rawVariable0.getLabel()); } /** //Test case number: 12 /*Coverage entropy=2.2522392503365087 */ @Test(timeout = 4000) public void test012() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setName("e$WD/;?"); rawVariable0.setLabel("+dB,5E`iRc`iP~r"); User user0 = new User(); DerivedVariable derivedVariable0 = new DerivedVariable(); Variable.detectFieldChanges(user0, rawVariable0, derivedVariable0); assertEquals("e$WD/;?", rawVariable0.getName()); assertEquals("+dB,5E`iRc`iP~r", rawVariable0.getLabel()); } /** //Test case number: 13 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test013() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User(); DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setName("qoF"); Variable.detectFieldChanges(user0, rawVariable0, derivedVariable0); assertEquals("qoF", derivedVariable0.getDisplayName()); assertEquals("qoF", derivedVariable0.getName()); } /** //Test case number: 14 /*Coverage entropy=1.2424533248940002 */ @Test(timeout = 4000) public void test014() throws Throwable { OntologyTerm ontologyTerm0 = new OntologyTerm(); OntologyTerm ontologyTerm1 = (OntologyTerm)ontologyTerm0.clone(); DerivedVariable derivedVariable0 = new DerivedVariable(); ontologyTerm0.setIdentifier(586); derivedVariable0.addOntologyTerm(ontologyTerm1); derivedVariable0.updateOntologyTerm(ontologyTerm0); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 15 /*Coverage entropy=1.3296613488547582 */ @Test(timeout = 4000) public void test015() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); derivedVariable0.addOntologyTerm(ontologyTerm0); OntologyTerm ontologyTerm1 = new OntologyTerm(); derivedVariable0.addOntologyTerm(ontologyTerm1); derivedVariable0.updateOntologyTerm(ontologyTerm1); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 16 /*Coverage entropy=1.3296613488547582 */ @Test(timeout = 4000) public void test016() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); derivedVariable0.addOntologyTerm(ontologyTerm0); OntologyTerm ontologyTerm1 = new OntologyTerm(); derivedVariable0.updateOntologyTerm(ontologyTerm1); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 17 /*Coverage entropy=1.3321790402101223 */ @Test(timeout = 4000) public void test017() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); ArrayList<OntologyTerm> arrayList0 = derivedVariable0.getOntologyTerms(); OntologyTerm ontologyTerm1 = new OntologyTerm(); arrayList0.add(ontologyTerm0); derivedVariable0.removeOntologyTerm(ontologyTerm1); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 18 /*Coverage entropy=0.9502705392332347 */ @Test(timeout = 4000) public void test018() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<OntologyTerm> arrayList0 = new ArrayList<OntologyTerm>(); OntologyTerm ontologyTerm0 = new OntologyTerm(); ontologyTerm0.setIdentifier(1076); arrayList0.add(ontologyTerm0); ArrayList<OntologyTerm> arrayList1 = rawVariable0.getOntologyTerms(); arrayList1.addAll((Collection<? extends OntologyTerm>) arrayList0); OntologyTerm ontologyTerm1 = new OntologyTerm(); boolean boolean0 = rawVariable0.containsOntologyTerm(ontologyTerm1); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCleaned()); assertFalse(boolean0); } /** //Test case number: 19 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test019() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.questionNumber = "variable.columnEnd.label"; VariableSummary variableSummary0 = derivedVariable0.createVariableSummary(); assertEquals("", variableSummary0.getLabel()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertEquals("", variableSummary0.getYear()); assertEquals("0", variableSummary0.getDisplayItemIdentifier()); assertEquals("", variableSummary0.getName()); } /** //Test case number: 20 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test020() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setColumnStart("+dB,5E`iRc`iP~r"); derivedVariable0.createVariableSummary(); assertEquals("+dB,5E`iRc`iP~r", derivedVariable0.getColumnStart()); } /** //Test case number: 21 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test021() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.codeBookNumber = "Vi{ntHa#3RozRl"; VariableSummary variableSummary0 = derivedVariable0.createVariableSummary(); assertEquals(0, variableSummary0.getIdentifier()); assertEquals("", variableSummary0.getLabel()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCleaned()); assertEquals("", variableSummary0.getName()); assertEquals("", variableSummary0.getYear()); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 22 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test022() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.form = "T#*cDG~vrt5Te-x/L"; VariableSummary variableSummary0 = rawVariable0.createVariableSummary(); assertEquals("", variableSummary0.getLabel()); assertEquals("", variableSummary0.getYear()); assertEquals("", variableSummary0.getDisplayName()); assertEquals(0, variableSummary0.getIdentifier()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 23 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test023() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setNotes((String) null); VariableSummary variableSummary0 = rawVariable0.createVariableSummary(); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", variableSummary0.getDisplayItemIdentifier()); } /** //Test case number: 24 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test024() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.columnEnd = ")"; VariableSummary variableSummary0 = derivedVariable0.createVariableSummary(); assertFalse(derivedVariable0.isCleaned()); assertEquals(0, variableSummary0.getIdentifier()); assertFalse(derivedVariable0.isNewRecord()); assertEquals("", variableSummary0.getName()); assertFalse(derivedVariable0.isCoded()); assertEquals("", variableSummary0.getYear()); assertEquals("", variableSummary0.getLabel()); } /** //Test case number: 25 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test025() throws Throwable { User user0 = new User("#", "#"); RawVariable rawVariable0 = new RawVariable(); RawVariable rawVariable1 = new RawVariable(); rawVariable1.setCleaningStatus("E"); RawVariable.detectFieldChanges(user0, rawVariable1, rawVariable0); assertEquals("E", rawVariable1.getCleaningStatus()); assertEquals("Unknown", rawVariable0.getAvailability()); } /** //Test case number: 26 /*Coverage entropy=1.6674619334292948 */ @Test(timeout = 4000) public void test026() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setName("$80"); Variable.validateFields(rawVariable0); assertEquals("$80", rawVariable0.getDisplayName()); assertEquals("$80", rawVariable0.getName()); } /** //Test case number: 27 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test027() throws Throwable { RawVariable rawVariable0 = new RawVariable(); boolean boolean0 = rawVariable0.isCoded(); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(boolean0); } /** //Test case number: 28 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test028() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); assertFalse(derivedVariable0.isCleaned()); derivedVariable0.setCleaned(true); boolean boolean0 = derivedVariable0.isCleaned(); assertTrue(boolean0); } /** //Test case number: 29 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test029() throws Throwable { RawVariable rawVariable0 = new RawVariable(); boolean boolean0 = rawVariable0.isCleaned(); assertFalse(rawVariable0.isNewRecord()); assertFalse(boolean0); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 30 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test030() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setYear("general.fieldValue.blank"); rawVariable0.getYear(); assertEquals("general.fieldValue.blank", rawVariable0.getYear()); } /** //Test case number: 31 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test031() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getYear(); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 32 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test032() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); ValueLabel valueLabel0 = new ValueLabel(); derivedVariable0.addValueLabel(valueLabel0); derivedVariable0.getValueLabels(); assertFalse(derivedVariable0.isNewRecord()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 33 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test033() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.questionNumber = "OrL5b_qNb(nG"; rawVariable0.getQuestionNumber(); assertEquals("OrL5b_qNb(nG", rawVariable0.getQuestionNumber()); } /** //Test case number: 34 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test034() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getQuestionNumber(); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 35 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test035() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setOntologyTerms((ArrayList<OntologyTerm>) null); rawVariable0.getOntologyTerms(); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 36 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test036() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); derivedVariable0.addOntologyTerm(ontologyTerm0); derivedVariable0.getOntologyTerms(); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCoded()); assertEquals(0, derivedVariable0.getIdentifier()); } /** //Test case number: 37 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test037() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.notes = ",qx/in DCF+oW?"; rawVariable0.getNotes(); assertEquals(",qx/in DCF+oW?", rawVariable0.getNotes()); } /** //Test case number: 38 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test038() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.getNotes(); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCoded()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 39 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test039() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setName("variable.alternativeVariable.label"); rawVariable0.getName(); assertEquals("variable.alternativeVariable.label", rawVariable0.getName()); } /** //Test case number: 40 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test040() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.getName(); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 41 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test041() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setLabel("X"); rawVariable0.getLabel(); assertEquals("X", rawVariable0.getLabel()); } /** //Test case number: 42 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test042() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getLabel(); assertFalse(rawVariable0.isNewRecord()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 43 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test043() throws Throwable { RawVariable rawVariable0 = new RawVariable(); int int0 = rawVariable0.getIdentifier(); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); assertEquals(0, int0); } /** //Test case number: 44 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test044() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); derivedVariable0.setIdentifier(1); int int0 = derivedVariable0.getIdentifier(); assertEquals(1, int0); } /** //Test case number: 45 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test045() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.form = "jzW\"IZA,&?EgxQpqT"; derivedVariable0.getForm(); assertEquals("jzW\"IZA,&?EgxQpqT", derivedVariable0.getForm()); } /** //Test case number: 46 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test046() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.getForm(); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCoded()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCleaned()); } /** //Test case number: 47 /*Coverage entropy=1.3862943611198906 */ @Test(timeout = 4000) public void test047() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setName((String) null); String string0 = derivedVariable0.getDisplayName(); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isCleaned()); assertNull(string0); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 48 /*Coverage entropy=1.3862943611198906 */ @Test(timeout = 4000) public void test048() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setName("X"); derivedVariable0.getDisplayName(); assertEquals("X", derivedVariable0.getDisplayName()); } /** //Test case number: 49 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test049() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getDisplayName(); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCleaned()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 50 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test050() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.columnStart = null; String string0 = derivedVariable0.getColumnStart(); assertFalse(derivedVariable0.isCoded()); assertNull(string0); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCleaned()); } /** //Test case number: 51 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test051() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setColumnStart("Ts&(6WdqZq"); derivedVariable0.getColumnStart(); assertEquals("Ts&(6WdqZq", derivedVariable0.getColumnStart()); } /** //Test case number: 52 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test052() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getColumnStart(); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCleaned()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCoded()); } /** //Test case number: 53 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test053() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.columnEnd = "UNABLE_TO_UPDATE_RAW_VARIABLE"; derivedVariable0.getColumnEnd(); assertEquals("UNABLE_TO_UPDATE_RAW_VARIABLE", derivedVariable0.getColumnEnd()); } /** //Test case number: 54 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test054() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getColumnEnd(); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 55 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test055() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.getCodeBookNumber(); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 56 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test056() throws Throwable { RawVariable rawVariable0 = new RawVariable(); String string0 = rawVariable0.getCleaningStatus(); assertFalse(rawVariable0.isCleaned()); assertEquals("Unknown", string0); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 57 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test057() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.getCleaningDescription(); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 58 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test058() throws Throwable { RawVariable rawVariable0 = new RawVariable(); String string0 = rawVariable0.getCategory(); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertEquals("Unknown", string0); assertFalse(rawVariable0.isCleaned()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 59 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test059() throws Throwable { RawVariable rawVariable0 = new RawVariable(); assertEquals("Unknown", rawVariable0.getCategory()); rawVariable0.setCategory(""); rawVariable0.getCategory(); assertFalse(rawVariable0.isCoded()); } /** //Test case number: 60 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test060() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); String string0 = derivedVariable0.getAvailability(); assertFalse(derivedVariable0.isNewRecord()); assertEquals("Unknown", string0); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 61 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test061() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); assertEquals("Unknown", derivedVariable0.getAvailability()); derivedVariable0.setAvailability(""); derivedVariable0.getAvailability(); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 62 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test062() throws Throwable { RawVariable rawVariable0 = new RawVariable(); DerivedVariable derivedVariable0 = new DerivedVariable(); rawVariable0.setAlternativeVariable(derivedVariable0); Variable variable0 = rawVariable0.getAlternativeVariable(); assertFalse(variable0.isCoded()); assertFalse(variable0.isNewRecord()); assertEquals(0, variable0.getIdentifier()); assertFalse(variable0.isCleaned()); } /** //Test case number: 63 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test063() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setAlias("4 ~w9]n-|qmk|4="); derivedVariable0.getAlias(); assertEquals("4 ~w9]n-|qmk|4=", derivedVariable0.getAlias()); } /** //Test case number: 64 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test064() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.getAlias(); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 65 /*Coverage entropy=1.4205719259467042 */ @Test(timeout = 4000) public void test065() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User(); DerivedVariable derivedVariable0 = new DerivedVariable(); MacawChangeEvent macawChangeEvent0 = Variable.detectChangesInAlternativeVariable(user0, derivedVariable0, rawVariable0); assertEquals(0, (int)macawChangeEvent0.getVariableOwnerID()); assertFalse(derivedVariable0.isNewRecord()); assertEquals("Changed variable \"Alternative Variable\", field \"blank\", from \"\" to \"{3}\".", macawChangeEvent0.getChangeMessage()); assertFalse(derivedVariable0.isCoded()); assertNotNull(macawChangeEvent0); assertFalse(derivedVariable0.isCleaned()); } /** //Test case number: 66 /*Coverage entropy=1.589026915173973 */ @Test(timeout = 4000) public void test066() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setIdentifier(193); User user0 = new User("variable.category.label", "-WZLXk-"); DerivedVariable derivedVariable0 = new DerivedVariable(); MacawChangeEvent macawChangeEvent0 = Variable.detectChangesInAlternativeVariable(user0, rawVariable0, derivedVariable0); assertEquals("193", rawVariable0.getDisplayItemIdentifier()); assertEquals("Changed variable \"Alternative Variable\", field \"blank\", from \"\" to \"{3}\".", macawChangeEvent0.getChangeMessage()); } /** //Test case number: 67 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test067() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setIdentifier(2780); derivedVariable0.createVariableSummary(); assertEquals("2780", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 68 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test068() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setIdentifier((-7044)); derivedVariable0.createVariableSummary(); assertEquals((-7044), derivedVariable0.getIdentifier()); } /** //Test case number: 69 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test069() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setYear((String) null); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 70 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test070() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setYear(""); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isNewRecord()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCleaned()); } /** //Test case number: 71 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test071() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); ArrayList<ValueLabel> arrayList0 = new ArrayList<ValueLabel>(158); arrayList0.add((ValueLabel) null); derivedVariable0.setValueLabels(arrayList0); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 72 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test072() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setSupportingDocuments((ArrayList<SupportingDocument>) null); derivedVariable0.getSupportingDocuments(); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 73 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test073() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<SupportingDocument> arrayList0 = new ArrayList<SupportingDocument>(); rawVariable0.setSupportingDocuments(arrayList0); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 74 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test074() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setQuestionNumber((String) null); assertFalse(rawVariable0.isNewRecord()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); } /** //Test case number: 75 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test075() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setQuestionNumber("-WZLXk-"); assertEquals("-WZLXk-", rawVariable0.getQuestionNumber()); } /** //Test case number: 76 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test076() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setQuestionNumber(""); assertFalse(rawVariable0.isCleaned()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); } /** //Test case number: 77 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test077() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<OntologyTerm> arrayList0 = new ArrayList<OntologyTerm>(); rawVariable0.setOntologyTerms(arrayList0); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); } /** //Test case number: 78 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test078() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setNotes((String) null); String string0 = rawVariable0.getNotes(); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); assertNull(string0); } /** //Test case number: 79 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test079() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setNotes(""); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCleaned()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 80 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test080() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setName((String) null); String string0 = rawVariable0.getName(); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertNull(string0); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 81 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test081() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setName(""); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 82 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test082() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setLabel((String) null); String string0 = rawVariable0.getLabel(); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertNull(string0); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 83 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test083() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setLabel(""); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 84 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test084() throws Throwable { RawVariable rawVariable0 = new RawVariable(); assertFalse(rawVariable0.isNewRecord()); rawVariable0.setIsNewRecord(true); boolean boolean0 = rawVariable0.isNewRecord(); assertTrue(boolean0); } /** //Test case number: 85 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test085() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setIsNewRecord(false); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 86 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test086() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setIdentifier(0); assertFalse(derivedVariable0.isNewRecord()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); } /** //Test case number: 87 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test087() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setIdentifier((-2586)); int int0 = rawVariable0.getIdentifier(); assertEquals("-2586", rawVariable0.getDisplayItemIdentifier()); assertEquals((-2586), int0); } /** //Test case number: 88 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test088() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setForm((String) null); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 89 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test089() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setForm("INVALID_CATEGORY"); assertEquals("INVALID_CATEGORY", rawVariable0.getForm()); } /** //Test case number: 90 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test090() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setForm(""); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCleaned()); assertEquals(0, derivedVariable0.getIdentifier()); } /** //Test case number: 91 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test091() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setFilePath((String) null); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 92 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test092() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setFilePath("user.userID.saveChanges"); rawVariable0.getFilePath(); assertEquals("user.userID.saveChanges", rawVariable0.getFilePath()); } /** //Test case number: 93 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test093() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setFilePath(""); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isNewRecord()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 94 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test094() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setColumnStart((String) null); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 95 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test095() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setColumnStart(""); assertFalse(derivedVariable0.isNewRecord()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 96 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test096() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setColumnEnd((String) null); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCleaned()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCoded()); } /** //Test case number: 97 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test097() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setColumnEnd("z@"); assertEquals("z@", rawVariable0.getColumnEnd()); } /** //Test case number: 98 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test098() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setColumnEnd(""); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 99 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test099() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCoded(false); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 100 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test100() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCodeBookNumber((String) null); String string0 = rawVariable0.getCodeBookNumber(); assertFalse(rawVariable0.isCleaned()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isCoded()); assertNull(string0); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 101 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test101() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCodeBookNumber("hyonte"); rawVariable0.getCodeBookNumber(); assertEquals("hyonte", rawVariable0.getCodeBookNumber()); } /** //Test case number: 102 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test102() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setCodeBookNumber(""); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); } /** //Test case number: 103 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test103() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCleaningStatus(""); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 104 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test104() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setCleaningDescription((String) null); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 105 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test105() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCleaningDescription("variable.year.label"); rawVariable0.getCleaningDescription(); assertEquals("variable.year.label", rawVariable0.getCleaningDescription()); } /** //Test case number: 106 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test106() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCleaningDescription(""); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 107 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test107() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setCleaned(false); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 108 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test108() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCategory((String) null); String string0 = rawVariable0.getCategory(); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertNull(string0); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 109 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test109() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCategory("<R()"); assertEquals("<R()", rawVariable0.getCategory()); } /** //Test case number: 110 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test110() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setAvailability((String) null); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 111 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test111() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setAlternativeVariable((Variable) null); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCleaned()); assertEquals(0, derivedVariable0.getIdentifier()); } /** //Test case number: 112 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test112() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setAlias((String) null); String string0 = derivedVariable0.getAlias(); assertFalse(derivedVariable0.isCleaned()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isNewRecord()); assertNull(string0); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 113 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test113() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setAlias(""); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isCoded()); } /** //Test case number: 114 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test114() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ValueLabel valueLabel0 = new ValueLabel(); rawVariable0.removeValueLabel(valueLabel0); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 115 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test115() throws Throwable { User user0 = new User(); // Undeclared exception! try { Variable.detectFieldChanges(user0, (Variable) null, (Variable) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 116 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test116() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); User user0 = new User((String) null, (String) null); // Undeclared exception! try { Variable.detectChangesInAlternativeVariable(user0, (Variable) null, derivedVariable0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 117 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test117() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); // Undeclared exception! try { derivedVariable0.containsSupportingDocument((SupportingDocument) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 118 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test118() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); // Undeclared exception! try { derivedVariable0.containsOntologyTerm((OntologyTerm) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 119 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test119() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.addValueLabel((ValueLabel) null); assertFalse(rawVariable0.isCleaned()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 120 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test120() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); ArrayList<SupportingDocument> arrayList0 = new ArrayList<SupportingDocument>(); SupportingDocument supportingDocument0 = new SupportingDocument(); arrayList0.add(supportingDocument0); derivedVariable0.addSupportingDocuments(arrayList0); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 121 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test121() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); SupportingDocument supportingDocument0 = new SupportingDocument(); derivedVariable0.addSupportingDocument(supportingDocument0); derivedVariable0.getSupportingDocuments(); assertFalse(derivedVariable0.isCleaned()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 122 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test122() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); ArrayList<OntologyTerm> arrayList0 = new ArrayList<OntologyTerm>(); arrayList0.add((OntologyTerm) null); derivedVariable0.addOntologyTerms(arrayList0); assertFalse(derivedVariable0.isNewRecord()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 123 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test123() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.addOntologyTerm((OntologyTerm) null); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); } /** //Test case number: 124 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test124() throws Throwable { // Undeclared exception! try { Variable.validateFields((Variable) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 125 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test125() throws Throwable { RawVariable rawVariable0 = new RawVariable(); // Undeclared exception! try { rawVariable0.updateOntologyTerm((OntologyTerm) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 126 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test126() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); // Undeclared exception! try { derivedVariable0.removeSupportingDocuments((ArrayList<SupportingDocument>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 127 /*Coverage entropy=1.5498260458782016 */ @Test(timeout = 4000) public void test127() throws Throwable { RawVariable rawVariable0 = new RawVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); ArrayList<OntologyTerm> arrayList0 = rawVariable0.getOntologyTerms(); arrayList0.add(ontologyTerm0); // Undeclared exception! try { rawVariable0.removeOntologyTerms(arrayList0); fail("Expecting exception: ConcurrentModificationException"); } catch(ConcurrentModificationException e) { // // no message in exception (getMessage() returned null) // verifyException("java.util.ArrayList$Itr", e); } } /** //Test case number: 128 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test128() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); // Undeclared exception! try { derivedVariable0.removeOntologyTerms((ArrayList<OntologyTerm>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 129 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test129() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); // Undeclared exception! try { derivedVariable0.removeOntologyTerm((OntologyTerm) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 130 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test130() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); // Undeclared exception! try { Variable.detectFieldChanges((User) null, derivedVariable0, derivedVariable0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 131 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test131() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.addSupportingDocument((SupportingDocument) null); SupportingDocument supportingDocument0 = new SupportingDocument(); // Undeclared exception! try { rawVariable0.containsSupportingDocument(supportingDocument0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 132 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test132() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); // Undeclared exception! try { derivedVariable0.cloneAttributes((Variable) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 133 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test133() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.setValueLabels((ArrayList<ValueLabel>) null); ValueLabel valueLabel0 = new ValueLabel(); // Undeclared exception! try { derivedVariable0.addValueLabel(valueLabel0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 134 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test134() throws Throwable { RawVariable rawVariable0 = new RawVariable(); // Undeclared exception! try { rawVariable0.addSupportingDocuments((ArrayList<SupportingDocument>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("java.util.ArrayList", e); } } /** //Test case number: 135 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test135() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); // Undeclared exception! try { derivedVariable0.addOntologyTerms((ArrayList<OntologyTerm>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("java.util.ArrayList", e); } } /** //Test case number: 136 /*Coverage entropy=1.0986122886681096 */ @Test(timeout = 4000) public void test136() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); derivedVariable0.setOntologyTerms((ArrayList<OntologyTerm>) null); // Undeclared exception! try { derivedVariable0.addOntologyTerm(ontologyTerm0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 137 /*Coverage entropy=3.044804882954829 */ @Test(timeout = 4000) public void test137() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); RawVariable rawVariable0 = new RawVariable(); derivedVariable0.setAlternativeVariable(rawVariable0); DerivedVariable derivedVariable1 = (DerivedVariable)derivedVariable0.clone(); assertFalse(derivedVariable1.isCoded()); assertEquals("Unknown", derivedVariable1.getAvailability()); assertEquals("Unknown", derivedVariable1.getCategory()); assertEquals("Unknown", derivedVariable1.getCleaningStatus()); assertFalse(derivedVariable1.isCleaned()); assertEquals("0", derivedVariable1.getDisplayItemIdentifier()); assertFalse(derivedVariable1.isNewRecord()); } /** //Test case number: 138 /*Coverage entropy=1.4978661367769954 */ @Test(timeout = 4000) public void test138() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); RawVariable rawVariable0 = new RawVariable(); derivedVariable0.setAlternativeVariable(rawVariable0); rawVariable0.setIdentifier(38); assertEquals("38", rawVariable0.getDisplayItemIdentifier()); Variable.detectChangesInAlternativeVariable((User) null, derivedVariable0, derivedVariable0); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 139 /*Coverage entropy=1.4205719259467042 */ @Test(timeout = 4000) public void test139() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); RawVariable rawVariable0 = new RawVariable(); derivedVariable0.setAlternativeVariable(rawVariable0); // Undeclared exception! try { Variable.detectChangesInAlternativeVariable((User) null, derivedVariable0, (Variable) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } /** //Test case number: 140 /*Coverage entropy=0.9502705392332347 */ @Test(timeout = 4000) public void test140() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); User user0 = new User("blank", "/o"); MacawChangeEvent macawChangeEvent0 = Variable.detectChangesInAlternativeVariable(user0, derivedVariable0, (Variable) null); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); assertNull(macawChangeEvent0); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 141 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test141() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User("X", "X"); rawVariable0.setNotes("'U{IZN1yg195"); RawVariable rawVariable1 = new RawVariable(); RawVariable.detectFieldChanges(user0, rawVariable0, rawVariable1); assertEquals("'U{IZN1yg195", rawVariable0.getNotes()); assertEquals("Unknown", rawVariable0.getAvailability()); } /** //Test case number: 142 /*Coverage entropy=2.1272886853327275 */ @Test(timeout = 4000) public void test142() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.questionNumber = "*5<25aC~%:"; User user0 = new User("X", "X"); RawVariable rawVariable1 = new RawVariable(); RawVariable.detectFieldChanges(user0, rawVariable0, rawVariable1); assertEquals("*5<25aC~%:", rawVariable0.getQuestionNumber()); assertEquals("", rawVariable0.getCleaningDescription()); } /** //Test case number: 143 /*Coverage entropy=2.1272886853327275 */ @Test(timeout = 4000) public void test143() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.form = "f X."; User user0 = new User("X", "X"); RawVariable rawVariable1 = new RawVariable(); RawVariable.detectFieldChanges(user0, rawVariable0, rawVariable1); assertEquals("f X.", rawVariable0.getForm()); assertEquals("Unknown", rawVariable0.getCategory()); } /** //Test case number: 144 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test144() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User("X", "X"); rawVariable0.setCoded(true); RawVariable rawVariable1 = new RawVariable(); RawVariable.detectFieldChanges(user0, rawVariable0, rawVariable1); assertTrue(rawVariable0.isCoded()); assertEquals("Unknown", rawVariable0.getAvailability()); } /** //Test case number: 145 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test145() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User("!", "'U{IZN1yg195"); rawVariable0.setAvailability("t8G<WE=p.iVh"); RawVariable rawVariable1 = new RawVariable(); RawVariable.detectFieldChanges(user0, rawVariable0, rawVariable1); assertEquals("t8G<WE=p.iVh", rawVariable0.getAvailability()); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 146 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test146() throws Throwable { User user0 = new User("T;djL3f|", "U%u,cy)n"); RawVariable rawVariable0 = new RawVariable(); RawVariable rawVariable1 = new RawVariable(); rawVariable0.setAlias("U%u,cy)n"); RawVariable.detectFieldChanges(user0, rawVariable1, rawVariable0); assertEquals("U%u,cy)n", rawVariable0.getAlias()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 147 /*Coverage entropy=2.060884963119022 */ @Test(timeout = 4000) public void test147() throws Throwable { User user0 = new User("SG$e0[(y$,DAYSod>4o", "SG$e0[(y$,DAYSod>4o"); RawVariable rawVariable0 = new RawVariable(); rawVariable0.columnEnd = "0W8 !Czg7#|C(itb"; Variable.detectFieldChanges(user0, rawVariable0, rawVariable0); assertEquals("0W8 !Czg7#|C(itb", rawVariable0.getColumnEnd()); assertEquals("", rawVariable0.getLabel()); } /** //Test case number: 148 /*Coverage entropy=2.1272886853327275 */ @Test(timeout = 4000) public void test148() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); User user0 = new User(); derivedVariable0.columnEnd = "0V}S7"; RawVariable rawVariable0 = new RawVariable(); Variable.detectFieldChanges(user0, derivedVariable0, rawVariable0); assertEquals("0V}S7", derivedVariable0.getColumnEnd()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 149 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test149() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User("X", "X"); RawVariable rawVariable1 = new RawVariable(); rawVariable1.setColumnStart("-"); RawVariable.detectFieldChanges(user0, rawVariable0, rawVariable1); assertEquals("-", rawVariable1.getColumnStart()); } /** //Test case number: 150 /*Coverage entropy=2.060884963119022 */ @Test(timeout = 4000) public void test150() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.columnStart = null; User user0 = new User(); ArrayList<MacawChangeEvent> arrayList0 = Variable.detectFieldChanges(user0, rawVariable0, rawVariable0); assertEquals("Unknown", rawVariable0.getAvailability()); assertEquals("Unknown", rawVariable0.getCategory()); assertEquals("Unknown", rawVariable0.getCleaningStatus()); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); assertTrue(arrayList0.isEmpty()); } /** //Test case number: 151 /*Coverage entropy=2.1272886853327275 */ @Test(timeout = 4000) public void test151() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User("", ""); rawVariable0.codeBookNumber = "T;djL3f|"; RawVariable rawVariable1 = new RawVariable(); RawVariable.detectFieldChanges(user0, rawVariable0, rawVariable1); assertEquals("T;djL3f|", rawVariable0.getCodeBookNumber()); assertEquals("", rawVariable0.getDisplayName()); } /** //Test case number: 152 /*Coverage entropy=1.9212530320280818 */ @Test(timeout = 4000) public void test152() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User("X", "X"); RawVariable rawVariable1 = new RawVariable(); rawVariable1.setCleaningStatus((String) null); // Undeclared exception! try { RawVariable.detectFieldChanges(user0, rawVariable0, rawVariable1); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.util.ValidationUtility", e); } } /** //Test case number: 153 /*Coverage entropy=2.090505174309139 */ @Test(timeout = 4000) public void test153() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCleaned(true); User user0 = new User("b;3OxL}]/~?F", "-WZLXk-"); RawVariable rawVariable1 = new RawVariable(); ArrayList<MacawChangeEvent> arrayList0 = RawVariable.detectFieldChanges(user0, rawVariable1, rawVariable0); assertTrue(rawVariable0.isCleaned()); assertFalse(rawVariable1.isCleaned()); assertEquals(0, arrayList0.size()); } /** //Test case number: 154 /*Coverage entropy=2.0989087071263235 */ @Test(timeout = 4000) public void test154() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCleaned(true); DerivedVariable derivedVariable0 = new DerivedVariable(); User user0 = new User(); ArrayList<MacawChangeEvent> arrayList0 = Variable.detectFieldChanges(user0, rawVariable0, derivedVariable0); assertTrue(rawVariable0.isCleaned()); assertEquals(1, arrayList0.size()); } /** //Test case number: 155 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test155() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); User user0 = new User(); RawVariable rawVariable0 = new RawVariable(); assertEquals("Unknown", rawVariable0.getCategory()); rawVariable0.setCategory(""); Variable.detectFieldChanges(user0, derivedVariable0, rawVariable0); assertEquals("Unknown", derivedVariable0.getCategory()); } /** //Test case number: 156 /*Coverage entropy=2.191013317336941 */ @Test(timeout = 4000) public void test156() throws Throwable { RawVariable rawVariable0 = new RawVariable(); User user0 = new User(); rawVariable0.setYear("variable.availability.label"); RawVariable rawVariable1 = new RawVariable(); RawVariable.detectFieldChanges(user0, rawVariable1, rawVariable0); assertEquals("variable.availability.label", rawVariable0.getYear()); } /** //Test case number: 157 /*Coverage entropy=1.7480673485460891 */ @Test(timeout = 4000) public void test157() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.setCleaned(true); try { RawVariable.validateFields(rawVariable0); fail("Expecting exception: Exception"); } catch(Exception e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.RawVariable", e); } } /** //Test case number: 158 /*Coverage entropy=1.6674619334292948 */ @Test(timeout = 4000) public void test158() throws Throwable { RawVariable rawVariable0 = new RawVariable(); assertEquals("Unknown", rawVariable0.getAvailability()); rawVariable0.setAvailability(""); ArrayList<String> arrayList0 = Variable.validateFields(rawVariable0); assertEquals(2, arrayList0.size()); } /** //Test case number: 159 /*Coverage entropy=1.2424533248940002 */ @Test(timeout = 4000) public void test159() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<OntologyTerm> arrayList0 = new ArrayList<OntologyTerm>(); OntologyTerm ontologyTerm0 = new OntologyTerm(); arrayList0.add(ontologyTerm0); rawVariable0.setOntologyTerms(arrayList0); OntologyTerm ontologyTerm1 = new OntologyTerm(); ontologyTerm1.setIdentifier((-2030976309)); rawVariable0.updateOntologyTerm(ontologyTerm1); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 160 /*Coverage entropy=1.3321790402101223 */ @Test(timeout = 4000) public void test160() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<OntologyTerm> arrayList0 = new ArrayList<OntologyTerm>(); OntologyTerm ontologyTerm0 = new OntologyTerm(); arrayList0.add(ontologyTerm0); rawVariable0.removeOntologyTerms(arrayList0); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 161 /*Coverage entropy=0.9502705392332347 */ @Test(timeout = 4000) public void test161() throws Throwable { RawVariable rawVariable0 = new RawVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); ontologyTerm0.setIdentifier((-426)); ArrayList<OntologyTerm> arrayList0 = rawVariable0.getOntologyTerms(); OntologyTerm ontologyTerm1 = new OntologyTerm(); arrayList0.add(ontologyTerm0); boolean boolean0 = rawVariable0.containsOntologyTerm(ontologyTerm1); assertFalse(boolean0); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 162 /*Coverage entropy=1.0397207708399179 */ @Test(timeout = 4000) public void test162() throws Throwable { RawVariable rawVariable0 = new RawVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); ArrayList<OntologyTerm> arrayList0 = rawVariable0.getOntologyTerms(); arrayList0.add(ontologyTerm0); boolean boolean0 = rawVariable0.containsOntologyTerm(ontologyTerm0); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertTrue(boolean0); } /** //Test case number: 163 /*Coverage entropy=1.0397207708399179 */ @Test(timeout = 4000) public void test163() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<SupportingDocument> arrayList0 = rawVariable0.getSupportingDocuments(); SupportingDocument supportingDocument0 = new SupportingDocument(); arrayList0.add(supportingDocument0); // Undeclared exception! try { rawVariable0.removeSupportingDocuments(arrayList0); fail("Expecting exception: ConcurrentModificationException"); } catch(ConcurrentModificationException e) { // // no message in exception (getMessage() returned null) // verifyException("java.util.ArrayList$Itr", e); } } /** //Test case number: 164 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test164() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<SupportingDocument> arrayList0 = new ArrayList<SupportingDocument>(); rawVariable0.removeSupportingDocuments(arrayList0); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 165 /*Coverage entropy=0.9502705392332347 */ @Test(timeout = 4000) public void test165() throws Throwable { RawVariable rawVariable0 = new RawVariable(); SupportingDocument supportingDocument0 = new SupportingDocument(); supportingDocument0.setIdentifier((-273)); ArrayList<SupportingDocument> arrayList0 = rawVariable0.getSupportingDocuments(); arrayList0.add(supportingDocument0); SupportingDocument supportingDocument1 = new SupportingDocument(); boolean boolean0 = rawVariable0.containsSupportingDocument(supportingDocument1); assertFalse(rawVariable0.isNewRecord()); assertFalse(boolean0); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 166 /*Coverage entropy=1.0397207708399179 */ @Test(timeout = 4000) public void test166() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<SupportingDocument> arrayList0 = new ArrayList<SupportingDocument>(); SupportingDocument supportingDocument0 = new SupportingDocument(); arrayList0.add(supportingDocument0); rawVariable0.setSupportingDocuments(arrayList0); boolean boolean0 = rawVariable0.containsSupportingDocument(supportingDocument0); assertFalse(rawVariable0.isNewRecord()); assertTrue(boolean0); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); } /** //Test case number: 167 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test167() throws Throwable { RawVariable rawVariable0 = new RawVariable(); String string0 = rawVariable0.getDisplayItemIdentifier(); assertFalse(rawVariable0.isCoded()); assertEquals("0", string0); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isNewRecord()); } /** //Test case number: 168 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test168() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.removeValueLabel((ValueLabel) null); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCleaned()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 169 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test169() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); ArrayList<OntologyTerm> arrayList0 = new ArrayList<OntologyTerm>(); derivedVariable0.addOntologyTerms(arrayList0); assertFalse(derivedVariable0.isCoded()); assertFalse(derivedVariable0.isNewRecord()); assertEquals(0, derivedVariable0.getIdentifier()); assertFalse(derivedVariable0.isCleaned()); } /** //Test case number: 170 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test170() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); boolean boolean0 = derivedVariable0.isNewRecord(); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); assertFalse(derivedVariable0.isCleaned()); assertFalse(boolean0); assertFalse(derivedVariable0.isCoded()); } /** //Test case number: 171 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test171() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getValueLabels(); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 172 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test172() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.removeSupportingDocument((SupportingDocument) null); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 173 /*Coverage entropy=3.044804882954829 */ @Test(timeout = 4000) public void test173() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); ValueLabel valueLabel0 = new ValueLabel(); derivedVariable0.addValueLabel(valueLabel0); RawVariable rawVariable0 = new RawVariable(); derivedVariable0.cloneAttributes(rawVariable0); assertEquals("Unknown", rawVariable0.getCleaningStatus()); assertFalse(rawVariable0.isCoded()); assertEquals("Unknown", rawVariable0.getAvailability()); assertFalse(rawVariable0.isNewRecord()); assertEquals("Unknown", rawVariable0.getCategory()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 174 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test174() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); ArrayList<ValueLabel> arrayList0 = new ArrayList<ValueLabel>(158); derivedVariable0.setValueLabels(arrayList0); assertFalse(derivedVariable0.isCleaned()); assertFalse(derivedVariable0.isNewRecord()); assertFalse(derivedVariable0.isCoded()); assertEquals("0", derivedVariable0.getDisplayItemIdentifier()); } /** //Test case number: 175 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test175() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getFilePath(); assertFalse(rawVariable0.isCleaned()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); } /** //Test case number: 176 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test176() throws Throwable { RawVariable rawVariable0 = new RawVariable(); ArrayList<SupportingDocument> arrayList0 = new ArrayList<SupportingDocument>(); rawVariable0.addSupportingDocuments(arrayList0); assertFalse(rawVariable0.isNewRecord()); assertFalse(rawVariable0.isCoded()); assertEquals(0, rawVariable0.getIdentifier()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 177 /*Coverage entropy=3.044804882954829 */ @Test(timeout = 4000) public void test177() throws Throwable { RawVariable rawVariable0 = new RawVariable(); OntologyTerm ontologyTerm0 = new OntologyTerm(); rawVariable0.addOntologyTerm(ontologyTerm0); RawVariable rawVariable1 = (RawVariable)rawVariable0.clone(); assertEquals("Unknown", rawVariable1.getCleaningStatus()); assertFalse(rawVariable1.isCoded()); assertEquals("Unknown", rawVariable1.getAvailability()); assertFalse(rawVariable1.isNewRecord()); assertEquals(0, rawVariable1.getIdentifier()); assertEquals("Unknown", rawVariable1.getCategory()); assertFalse(rawVariable1.isCleaned()); } /** //Test case number: 178 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test178() throws Throwable { RawVariable rawVariable0 = new RawVariable(); rawVariable0.getAlternativeVariable(); assertFalse(rawVariable0.isNewRecord()); assertEquals("0", rawVariable0.getDisplayItemIdentifier()); assertFalse(rawVariable0.isCoded()); assertFalse(rawVariable0.isCleaned()); } /** //Test case number: 179 /*Coverage entropy=2.992196960885483 */ @Test(timeout = 4000) public void test179() throws Throwable { DerivedVariable derivedVariable0 = new DerivedVariable(); derivedVariable0.addSupportingDocument((SupportingDocument) null); // Undeclared exception! try { derivedVariable0.clone(); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("macaw.businessLayer.Variable", e); } } }
3e0194deb9b1363848f1048ced48392d0e77f856
1,621
java
Java
server/org.eclipse.lsp4j-gen/org/eclipse/lsp4j/MonikerParams.java
HumphreyHCB/SOMns-vscode
7cdd0dfc016280f6f91c9d88853064b963ca6a9b
[ "MIT" ]
2
2016-07-07T23:08:26.000Z
2017-12-18T12:39:35.000Z
server/org.eclipse.lsp4j-gen/org/eclipse/lsp4j/MonikerParams.java
HumphreyHCB/SOMns-vscode
7cdd0dfc016280f6f91c9d88853064b963ca6a9b
[ "MIT" ]
10
2016-12-18T07:02:31.000Z
2022-03-05T11:30:15.000Z
server/org.eclipse.lsp4j-gen/org/eclipse/lsp4j/MonikerParams.java
HumphreyHCB/SOMns-vscode
7cdd0dfc016280f6f91c9d88853064b963ca6a9b
[ "MIT" ]
1
2018-10-27T16:03:07.000Z
2018-10-27T16:03:07.000Z
28.438596
123
0.700185
662
/** * Copyright (c) 2016-2018 TypeFox and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0, * or the Eclipse Distribution License v. 1.0 which is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause */ package org.eclipse.lsp4j; import org.eclipse.lsp4j.TextDocumentPositionAndWorkDoneProgressAndPartialResultParams; import org.eclipse.xtext.xbase.lib.Pure; import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; /** * The moniker request is sent from the client to the server to get the symbol monikers for a given text document position. * <p> * Since 3.16.0 */ @SuppressWarnings("all") public class MonikerParams extends TextDocumentPositionAndWorkDoneProgressAndPartialResultParams { @Override @Pure public String toString() { ToStringBuilder b = new ToStringBuilder(this); b.add("partialResultToken", getPartialResultToken()); b.add("workDoneToken", getWorkDoneToken()); b.add("textDocument", getTextDocument()); b.add("uri", getUri()); b.add("position", getPosition()); return b.toString(); } @Override @Pure public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; if (!super.equals(obj)) return false; return true; } @Override @Pure public int hashCode() { return super.hashCode(); } }
3e0194ead0feb10bc8f33909d91863f62dc34f6e
8,848
java
Java
src/test/java/org/sonar/plugins/text/checks/StringDisallowedIfMatchInAnotherFileCheckTest.java
gjd6640/sonar-text-plugin
59659dfb2943788061b36c893812e449501db0da
[ "Apache-2.0" ]
22
2015-08-24T07:12:55.000Z
2022-02-25T14:40:35.000Z
src/test/java/org/sonar/plugins/text/checks/StringDisallowedIfMatchInAnotherFileCheckTest.java
gjd6640/sonar-text-plugin
59659dfb2943788061b36c893812e449501db0da
[ "Apache-2.0" ]
15
2015-10-08T00:55:42.000Z
2022-03-13T18:18:36.000Z
src/test/java/org/sonar/plugins/text/checks/StringDisallowedIfMatchInAnotherFileCheckTest.java
gjd6640/sonar-text-plugin
59659dfb2943788061b36c893812e449501db0da
[ "Apache-2.0" ]
6
2016-11-14T21:22:38.000Z
2019-11-19T15:10:03.000Z
45.84456
173
0.766614
663
package org.sonar.plugins.text.checks; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.DefaultFileSystem; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.rule.CheckFactory; import org.sonar.api.batch.rule.Checks; import org.sonar.api.batch.sensor.internal.SensorContextTester; import org.sonar.api.batch.sensor.issue.Issue; import org.sonar.api.rule.RuleKey; import org.sonar.api.scanner.fs.InputProject; import org.sonar.plugins.text.batch.TextIssueSensor; import org.sonar.plugins.text.checks.AbstractCrossFileCheck.RulePart; import org.sonar.plugins.text.testutils.FileTestUtils; public class StringDisallowedIfMatchInAnotherFileCheckTest extends AbstractCrossFileCheckTester { final private Path tempInputFilesPath = Paths.get("target/surefire-test-resources/StringDisallowedIfMatchInAnotherFileCheckTest/"); private DefaultFileSystem fs; private TextIssueSensor sensor; private final StringDisallowedIfMatchInAnotherFileCheck realStringDisallowedMultiFileCheck = new StringDisallowedIfMatchInAnotherFileCheck(); @Mock private InputProject project; private SensorContextTester sensorContext; @Before public void setUp() throws Exception { Files.createDirectories(tempInputFilesPath); sensorContext = SensorContextTester.create(tempInputFilesPath); fs = sensorContext.fileSystem(); } // Code originally borrowed from IssueSensorTest... // This is a bit of an integration test as it wires up the TextIssueSensor. This enables us to know that these classes play nice together. @Test public void analyse_multi_class_integration_test() throws IOException { // Setup // Create files to be scanned // File containing trigger pattern Path inputFilePath = Paths.get(tempInputFilesPath.toString(), "effective-pom.xml"); DefaultInputFile inputFile = FileTestUtils.createInputFile(inputFilePath, String.join("\n", Arrays.asList("The first line", "<target>1.8</target>", "The third line"))); fs.add(inputFile); // File with disallowed config inputFilePath = Paths.get(tempInputFilesPath.toString(), "feature-setup-env.properties"); inputFile = FileTestUtils.createInputFile(inputFilePath, String.join("\n", Arrays.asList("The first line", "JAVA_HOME=/software/java64/jdk1.7.0_60", "The third line"))); fs.add(inputFile); // Configure the check realStringDisallowedMultiFileCheck.setTriggerFilePattern("**/effective-pom.xml"); realStringDisallowedMultiFileCheck.setTriggerExpression(".*<target>1.8</target>.*"); realStringDisallowedMultiFileCheck.setDisallowFilePattern("**/*setup-env*"); realStringDisallowedMultiFileCheck.setDisallowExpression(".*JAVA_HOME=.*jdk1.(6|7).*"); realStringDisallowedMultiFileCheck.setApplyExpressionToOneLineOfTextAtATime(true); realStringDisallowedMultiFileCheck.setMessage("Project compiled to target Java 8 is being booted under a prior JVM version."); // Run sensor.execute(sensorContext); // Verify assertEquals(1, sensorContext.allIssues().size()); Issue issueRaised = sensorContext.allIssues().iterator().next(); assertEquals(RuleKey.of("text", "StringDisallowedIfMatchInAnotherFileCheck"), issueRaised.ruleKey()); } @Test public void analyse_multi_class_integration_test_multiline_aka_DOTALL_regex() throws IOException { // Setup: Create files to be scanned // File containing trigger pattern Path inputFilePath = Paths.get(tempInputFilesPath.toString(), "effective-pom.xml"); DefaultInputFile inputFile = FileTestUtils.createInputFile(inputFilePath, String.join("\n", Arrays.asList("The first line", "<target>1.8</target>", "The third line"))); fs.add(inputFile); // File with disallowed config inputFilePath = Paths.get(tempInputFilesPath.toString(), "feature-setup-env.properties"); inputFile = FileTestUtils.createInputFile(inputFilePath, String.join("\n", Arrays.asList("The first line", "JAVA_HOME=/software/java64/jdk1.7.0_60", "The third line"))); fs.add(inputFile); // Configure the check realStringDisallowedMultiFileCheck.setTriggerFilePattern("**/effective-pom.xml"); realStringDisallowedMultiFileCheck.setTriggerExpression("(?s).*<target>1.8</target>.*third"); realStringDisallowedMultiFileCheck.setDisallowFilePattern("**/*setup-env*"); realStringDisallowedMultiFileCheck.setDisallowExpression("(?s).*JAVA_HOME=.*jdk1.(6|7).*third"); realStringDisallowedMultiFileCheck.setApplyExpressionToOneLineOfTextAtATime(false); realStringDisallowedMultiFileCheck.setMessage("Project compiled to target Java 8 is being booted under a prior JVM version."); // Run sensor.execute(sensorContext); // Verify assertEquals(1, sensorContext.allIssues().size()); Issue issueRaised = sensorContext.allIssues().iterator().next(); assertEquals(RuleKey.of("text", "StringDisallowedIfMatchInAnotherFileCheck"), issueRaised.ruleKey()); } @Test public void recordMatchTest(){ // Set up StringDisallowedIfMatchInAnotherFileCheck chk = new StringDisallowedIfMatchInAnotherFileCheck(); Map<InputFile, List<CrossFileScanPrelimIssue>> rawResults = new HashMap<>(); chk.setCrossFileChecksRawResults(rawResults); // Execute chk.setRuleKey(RuleKey.of("text","rule1")); // Path inputFilePath = Paths.get(tempInputFilesPath.toString(), "effective-pom.xml"); chk.setTextSourceFile(new TextSourceFile(FileTestUtils.createInputFileShell(tempInputFilesPath.toString() + "somepath"))); chk.recordMatch(RulePart.TriggerPattern, 1, "msg"); chk.recordMatch(RulePart.TriggerPattern, 1, "msg"); chk.setRuleKey(RuleKey.of("text","rule2")); chk.setTextSourceFile(new TextSourceFile(FileTestUtils.createInputFileShell(tempInputFilesPath.toString() + "someOtherPath"))); chk.recordMatch(RulePart.TriggerPattern, 1, "msg"); chk.recordMatch(RulePart.TriggerPattern, 1, "msg"); // Verify Assert.assertTrue(rawResults.size() == 2); List<CrossFileScanPrelimIssue> issuesForOneFile = rawResults.get(FileTestUtils.createInputFileShell(tempInputFilesPath.toString() + "somepath")); Assert.assertTrue(issuesForOneFile.size() == 2); issuesForOneFile = rawResults.get(FileTestUtils.createInputFileShell(tempInputFilesPath.toString() + "someOtherPath")); Assert.assertTrue(issuesForOneFile.size() == 2); } @Test public void raiseIssuesAfterScanTest() { // Set up StringDisallowedIfMatchInAnotherFileCheck chk = new StringDisallowedIfMatchInAnotherFileCheck(); Map<InputFile, List<CrossFileScanPrelimIssue>> rawResults = new HashMap<>(); chk.setCrossFileChecksRawResults(rawResults); List<CrossFileScanPrelimIssue> issuesForOneFile = new LinkedList<>(); issuesForOneFile.add(new CrossFileScanPrelimIssue(RulePart.TriggerPattern, RuleKey.of("text","rule1"), 1, "msg")); issuesForOneFile.add(new CrossFileScanPrelimIssue(RulePart.DisallowPattern, RuleKey.of("text","rule1"), 1, "msg")); issuesForOneFile.add(new CrossFileScanPrelimIssue(RulePart.DisallowPattern, RuleKey.of("text","rule2"), 1, "msg")); // not triggered, should not raise an issue rawResults.put(FileTestUtils.createInputFileShell(tempInputFilesPath.toString() + "file1"), issuesForOneFile); // Execute chk.setRuleKey(RuleKey.of("text","rule1")); List<TextSourceFile> rule1Results = chk.raiseIssuesAfterScan(); chk.setRuleKey(RuleKey.of("text","rule2")); List<TextSourceFile> rule2Results = chk.raiseIssuesAfterScan(); // Verify Assert.assertTrue(rule1Results.size() == 1); Assert.assertTrue(rule2Results.size() == 0); } @Before public void createIssueSensorBackedByMocks() { Checks<Object> checks = mock(Checks.class); CheckFactory checkFactory = mock(CheckFactory.class); when(checkFactory.create(Mockito.anyString())).thenReturn(checks); when(checks.addAnnotatedChecks(Mockito.any(Iterable.class))).thenReturn(checks); List<Object> checksList = Arrays.asList(new Object[] {realStringDisallowedMultiFileCheck}); when(checks.all()).thenReturn(checksList); when(checks.ruleKey(Mockito.isA(StringDisallowedIfMatchInAnotherFileCheck.class))).thenReturn(RuleKey.of("text", "StringDisallowedIfMatchInAnotherFileCheck")); sensor = new TextIssueSensor(fs, sensorContext, checkFactory); } }
3e019514ed531b05ba88950c01c3956fd5ce64de
6,256
java
Java
proto-google-cloud-network-management-v1beta1/src/main/java/com/google/cloud/networkmanagement/v1beta1/ProbingDetailsOrBuilder.java
suztomo/java-network-management
fa1e3180bec2c03a89eaac8be6bf04ba8e6665d3
[ "Apache-2.0" ]
1
2022-02-17T16:07:36.000Z
2022-02-17T16:07:36.000Z
proto-google-cloud-network-management-v1beta1/src/main/java/com/google/cloud/networkmanagement/v1beta1/ProbingDetailsOrBuilder.java
suztomo/java-network-management
fa1e3180bec2c03a89eaac8be6bf04ba8e6665d3
[ "Apache-2.0" ]
38
2021-07-08T20:26:38.000Z
2022-03-29T18:25:48.000Z
proto-google-cloud-network-management-v1beta1/src/main/java/com/google/cloud/networkmanagement/v1beta1/ProbingDetailsOrBuilder.java
suztomo/java-network-management
fa1e3180bec2c03a89eaac8be6bf04ba8e6665d3
[ "Apache-2.0" ]
2
2021-07-08T20:25:11.000Z
2021-08-24T16:48:24.000Z
24.924303
104
0.657449
664
/* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/networkmanagement/v1beta1/connectivity_test.proto package com.google.cloud.networkmanagement.v1beta1; public interface ProbingDetailsOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.networkmanagement.v1beta1.ProbingDetails) com.google.protobuf.MessageOrBuilder { /** * * * <pre> * The overall result of active probing. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.ProbingDetails.ProbingResult result = 1;</code> * * @return The enum numeric value on the wire for result. */ int getResultValue(); /** * * * <pre> * The overall result of active probing. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.ProbingDetails.ProbingResult result = 1;</code> * * @return The result. */ com.google.cloud.networkmanagement.v1beta1.ProbingDetails.ProbingResult getResult(); /** * * * <pre> * The time that reachability was assessed through active probing. * </pre> * * <code>.google.protobuf.Timestamp verify_time = 2;</code> * * @return Whether the verifyTime field is set. */ boolean hasVerifyTime(); /** * * * <pre> * The time that reachability was assessed through active probing. * </pre> * * <code>.google.protobuf.Timestamp verify_time = 2;</code> * * @return The verifyTime. */ com.google.protobuf.Timestamp getVerifyTime(); /** * * * <pre> * The time that reachability was assessed through active probing. * </pre> * * <code>.google.protobuf.Timestamp verify_time = 2;</code> */ com.google.protobuf.TimestampOrBuilder getVerifyTimeOrBuilder(); /** * * * <pre> * Details about an internal failure or the cancellation of active probing. * </pre> * * <code>.google.rpc.Status error = 3;</code> * * @return Whether the error field is set. */ boolean hasError(); /** * * * <pre> * Details about an internal failure or the cancellation of active probing. * </pre> * * <code>.google.rpc.Status error = 3;</code> * * @return The error. */ com.google.rpc.Status getError(); /** * * * <pre> * Details about an internal failure or the cancellation of active probing. * </pre> * * <code>.google.rpc.Status error = 3;</code> */ com.google.rpc.StatusOrBuilder getErrorOrBuilder(); /** * * * <pre> * The reason probing was aborted. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.ProbingDetails.ProbingAbortCause abort_cause = 4; * </code> * * @return The enum numeric value on the wire for abortCause. */ int getAbortCauseValue(); /** * * * <pre> * The reason probing was aborted. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.ProbingDetails.ProbingAbortCause abort_cause = 4; * </code> * * @return The abortCause. */ com.google.cloud.networkmanagement.v1beta1.ProbingDetails.ProbingAbortCause getAbortCause(); /** * * * <pre> * Number of probes sent. * </pre> * * <code>int32 sent_probe_count = 5;</code> * * @return The sentProbeCount. */ int getSentProbeCount(); /** * * * <pre> * Number of probes that reached the destination. * </pre> * * <code>int32 successful_probe_count = 6;</code> * * @return The successfulProbeCount. */ int getSuccessfulProbeCount(); /** * * * <pre> * The source and destination endpoints derived from the test input and used * for active probing. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.EndpointInfo endpoint_info = 7;</code> * * @return Whether the endpointInfo field is set. */ boolean hasEndpointInfo(); /** * * * <pre> * The source and destination endpoints derived from the test input and used * for active probing. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.EndpointInfo endpoint_info = 7;</code> * * @return The endpointInfo. */ com.google.cloud.networkmanagement.v1beta1.EndpointInfo getEndpointInfo(); /** * * * <pre> * The source and destination endpoints derived from the test input and used * for active probing. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.EndpointInfo endpoint_info = 7;</code> */ com.google.cloud.networkmanagement.v1beta1.EndpointInfoOrBuilder getEndpointInfoOrBuilder(); /** * * * <pre> * Latency as measured by active probing in one direction: * from the source to the destination endpoint. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.LatencyDistribution probing_latency = 8;</code> * * @return Whether the probingLatency field is set. */ boolean hasProbingLatency(); /** * * * <pre> * Latency as measured by active probing in one direction: * from the source to the destination endpoint. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.LatencyDistribution probing_latency = 8;</code> * * @return The probingLatency. */ com.google.cloud.networkmanagement.v1beta1.LatencyDistribution getProbingLatency(); /** * * * <pre> * Latency as measured by active probing in one direction: * from the source to the destination endpoint. * </pre> * * <code>.google.cloud.networkmanagement.v1beta1.LatencyDistribution probing_latency = 8;</code> */ com.google.cloud.networkmanagement.v1beta1.LatencyDistributionOrBuilder getProbingLatencyOrBuilder(); }
3e019519e52777b80880aee8aaf97851cc3bcb34
642
java
Java
src/main/java/com/mingshashan/learn/design/pattern/basic_principle/o/OpenClosedPrinciple.java
aikongfu/design-pattern
fa10fb4f7d69922143abc562aa51868268ae242b
[ "MIT" ]
null
null
null
src/main/java/com/mingshashan/learn/design/pattern/basic_principle/o/OpenClosedPrinciple.java
aikongfu/design-pattern
fa10fb4f7d69922143abc562aa51868268ae242b
[ "MIT" ]
null
null
null
src/main/java/com/mingshashan/learn/design/pattern/basic_principle/o/OpenClosedPrinciple.java
aikongfu/design-pattern
fa10fb4f7d69922143abc562aa51868268ae242b
[ "MIT" ]
null
null
null
16.461538
63
0.540498
665
package com.mingshashan.learn.design.pattern.basic_principle.o; /** * OpenClosedPrinciple * * @author xufj */ public class OpenClosedPrinciple { class AccountSignIn { INotice notice; AccountSignIn(INotice notice) { this.notice = notice; } public void signIn() { // 注册的逻辑 // 通知的逻辑 notice.notice(); } } interface INotice { void notice(); } class EmailNotice implements INotice { public void notice() { } } class SMSNotice implements INotice { public void notice() { } } }
3e01954f7cefb8a4699d69c5218b2996ccf7682a
6,599
java
Java
src/java/com/sshtools/common/authentication/KBIRequestHandlerDialog.java
marionolte/wlsdebuginfo
31c3464a52306253929a6d11817af84a8d419d36
[ "MIT" ]
1
2021-08-14T20:13:19.000Z
2021-08-14T20:13:19.000Z
src/java/com/sshtools/common/authentication/KBIRequestHandlerDialog.java
marionolte/wlsdebuginfo
31c3464a52306253929a6d11817af84a8d419d36
[ "MIT" ]
null
null
null
src/java/com/sshtools/common/authentication/KBIRequestHandlerDialog.java
marionolte/wlsdebuginfo
31c3464a52306253929a6d11817af84a8d419d36
[ "MIT" ]
null
null
null
32.995
83
0.648735
666
/* * SSHTools - Java SSH2 API * * Copyright (C) 2002-2003 Lee David Painter and Contributors. * * Contributions made by: * * Brett Smith * Richard Pernavas * Erwin Bolwidt * * 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.sshtools.common.authentication; import com.sshtools.common.ui.IconWrapperPanel; import com.sshtools.common.ui.ResourceIcon; import com.sshtools.common.ui.UIUtil; import com.sshtools.common.ui.XTextField; import com.sshtools.j2ssh.authentication.KBIPrompt; import com.sshtools.j2ssh.authentication.KBIRequestHandler; import java.awt.BorderLayout; import java.awt.Dialog; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.SwingConstants; import javax.swing.text.JTextComponent; /** * * * @author $author$ * @version $Revision: 1.15 $ */ public class KBIRequestHandlerDialog extends JDialog implements KBIRequestHandler { /** */ public final static String KBI_ICON = "largekbi.png"; boolean cancelled; JLabel instructionLabel = new JLabel(); JPanel buttonsPanel = new JPanel(); JTextComponent[] promptReply; /** * Creates a new KBIRequestHandlerDialog object. */ public KBIRequestHandlerDialog() { super((Frame) null, "", true); init(); } /** * Creates a new KBIRequestHandlerDialog object. * * @param frame */ public KBIRequestHandlerDialog(Frame frame) { super(frame, "", true); init(); } /** * Creates a new KBIRequestHandlerDialog object. * * @param dialog */ public KBIRequestHandlerDialog(Dialog dialog) { super(dialog, "", true); init(); } void init() { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); instructionLabel.setHorizontalAlignment(JLabel.CENTER); instructionLabel.setBorder(BorderFactory.createEmptyBorder(4, 4, 8, 4)); JButton ok = new JButton("Ok"); ok.setMnemonic('o'); ok.setDefaultCapable(true); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { setVisible(false); } }); getRootPane().setDefaultButton(ok); JButton cancel = new JButton("Cancel"); cancel.setMnemonic('c'); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { cancelled = true; setVisible(false); } }); buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); buttonsPanel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); buttonsPanel.add(cancel); buttonsPanel.add(ok); } /** * * * @param name * @param instruction * @param prompts */ public void showPrompts(String name, String instruction, KBIPrompt[] prompts) { setTitle(name); getContentPane().invalidate(); getContentPane().removeAll(); instructionLabel.setText(instruction); JPanel promptPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 4, 4); gbc.fill = GridBagConstraints.CENTER; gbc.anchor = GridBagConstraints.WEST; promptReply = new JTextComponent[prompts.length]; for (int i = 0; i < prompts.length; i++) { if (prompts[i].echo()) { promptReply[i] = new XTextField(prompts[i].getResponse(), 15); } else { promptReply[i] = new JPasswordField(prompts[i].getResponse(), 15); } System.out.println("Creating prompt " + prompts[i].getPrompt() + " and setting to " + prompts[i].getResponse()); gbc.weightx = 0.0; UIUtil.jGridBagAdd(promptPanel, new JLabel(prompts[i].getPrompt() + " "), gbc, GridBagConstraints.RELATIVE); gbc.weightx = 1.0; UIUtil.jGridBagAdd(promptPanel, promptReply[i], gbc, GridBagConstraints.REMAINDER); } JPanel centerPanel = new JPanel(new BorderLayout()); centerPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); centerPanel.add(instructionLabel, BorderLayout.NORTH); centerPanel.add(promptPanel, BorderLayout.CENTER); // Create the center banner panel IconWrapperPanel iconPanel = new IconWrapperPanel(new ResourceIcon( KBIRequestHandlerDialog.class, KBI_ICON), centerPanel); iconPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); // The main panel contains everything and is surrounded by a border JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPanel.add(iconPanel, BorderLayout.CENTER); mainPanel.add(buttonsPanel, BorderLayout.SOUTH); // Build the main panel getContentPane().setLayout(new GridLayout(1, 1)); getContentPane().add(mainPanel); getContentPane().validate(); pack(); UIUtil.positionComponent(SwingConstants.CENTER, this); setVisible(true); if (!cancelled) { for (int i = 0; i < promptReply.length; i++) { System.out.println("Setting reply " + i + " to " + promptReply[i].getText()); prompts[i].setResponse(promptReply[i].getText()); } } } }
3e01958143f2507c1748e3802b89252e2e8443a7
998
java
Java
src/mstore/webapp/src/main/java/com/mstore/controller/ShoppingCartController.java
maithanhduyan/mstore
a856ad1a95ba559765291118042fb9d693de1224
[ "MIT" ]
2
2021-08-20T08:54:05.000Z
2021-09-25T10:04:13.000Z
src/mstore/webapp/src/main/java/com/mstore/controller/ShoppingCartController.java
maithanhduyan/m-store
a856ad1a95ba559765291118042fb9d693de1224
[ "MIT" ]
2
2021-03-09T12:26:47.000Z
2021-05-10T02:34:57.000Z
src/mstore/webapp/src/main/java/com/mstore/controller/ShoppingCartController.java
maithanhduyan/m-store
a856ad1a95ba559765291118042fb9d693de1224
[ "MIT" ]
1
2021-09-25T10:04:14.000Z
2021-09-25T10:04:14.000Z
31.1875
89
0.822645
667
package com.mstore.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.mstore.domain.product.service.ProductCategoryService; import com.mstore.domain.product.service.ProductService; @Controller public class ShoppingCartController { private static final Logger LOG = LoggerFactory.getLogger(ShoppingCartController.class); @Autowired ProductService productService; @Autowired ProductCategoryService productCategoryService; @RequestMapping(value = "/cart.html", method = RequestMethod.GET) public String viewCart(Model model) { model.addAttribute("message", "Mini Store"); model.addAttribute("productCategories", productCategoryService.findAll()); return "shopping_cart"; } }
3e0195a7e4c91c1a85e876a2f959e6b9d3227a42
1,164
java
Java
src/test/java/com/formulasearchengine/sql/check/GenericTests.java
ag-gipp/eCoachSql
446927bf4428d68e3f81058b32b19ef0e7796dd0
[ "Apache-2.0" ]
4
2021-12-10T12:25:50.000Z
2021-12-14T20:23:44.000Z
src/test/java/com/formulasearchengine/sql/check/GenericTests.java
ag-gipp/eCoachSql
446927bf4428d68e3f81058b32b19ef0e7796dd0
[ "Apache-2.0" ]
2
2021-12-10T12:52:15.000Z
2021-12-10T13:02:02.000Z
src/test/java/com/formulasearchengine/sql/check/GenericTests.java
ag-gipp/eCoachSql
446927bf4428d68e3f81058b32b19ef0e7796dd0
[ "Apache-2.0" ]
null
null
null
29.846154
101
0.67354
668
package com.formulasearchengine.sql.check; import org.junit.Test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.Properties; import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; /** * Created by Moritz on 28.04.2017. */ public class GenericTests { @Test public void dbsAccessTest() throws Exception { String url = "jdbc:postgresql://localhost:54321/exampleDatabase"; Properties props = new Properties(); props.setProperty("user", "exampleUser"); props.setProperty("password", "examplePassword"); Connection con = DriverManager.getConnection(url, props); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("SELECT VERSION()"); if (rs.next()) { String version = rs.getString(1); assertThat("Check that it's a MariadDB database", version, containsString("PostgreSQL")); System.out.println(); } else { fail("SQL command failed"); } } }
3e019628888cb28bed27e1aed4b78f96f44e0079
5,022
java
Java
core/src/week/of/awesome/game/PlayGameState.java
daveagill/GamutOfBlob
52f0e39ade40aceedadf892dd0861b8ef29e10d5
[ "CC-BY-3.0" ]
1
2020-01-20T11:04:19.000Z
2020-01-20T11:04:19.000Z
core/src/week/of/awesome/game/PlayGameState.java
daveagill/GamutOfBlob
52f0e39ade40aceedadf892dd0861b8ef29e10d5
[ "CC-BY-3.0" ]
null
null
null
core/src/week/of/awesome/game/PlayGameState.java
daveagill/GamutOfBlob
52f0e39ade40aceedadf892dd0861b8ef29e10d5
[ "CC-BY-3.0" ]
null
null
null
23.036697
77
0.694544
669
package week.of.awesome.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.InputAdapter; import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.audio.Sound; import java.util.ArrayDeque; import java.util.Deque; import com.badlogic.gdx.Input.Keys; import week.of.awesome.framework.GameState; import week.of.awesome.framework.Services; import week.of.awesome.game.World.Direction; public class PlayGameState implements GameState { private static final float FADE_IN_SPEED = 2f; private static final float FADE_OUT_SPEED = 4f; private Services services; private GameState gameOverState; private int levelNum = 1; private boolean levelComplete; private boolean gameComplete; private float fadeIn; private float fadeOut; private Deque<Direction> directionStack = new ArrayDeque<>(); private AmbientMusic music; private GameRenderer renderer; private World world; private Sound blobMovedSound; private Sound collectedGeneSound; private Sound collectedStarSound; private Sound switchBlobSound; private Sound buttonActivatedSound; private Sound buttonDeactivatedSound; private Sound teleportSound; private WorldEvents eventHandler = new WorldEvents() { @Override public void onBlobMoved(Tile tile) { blobMovedSound.play(0.5f); } @Override public void onCollectedGene() { collectedGeneSound.play(); } @Override public void onCollectedStar() { collectedStarSound.play(); } @Override public void onLevelComplete() { String nextLevelFilename = filenameForLevel(levelNum+1); gameComplete = !Gdx.files.internal(nextLevelFilename).exists(); levelComplete = true; } @Override public void onButtonActivated() { buttonActivatedSound.play(); } @Override public void onButtonDeactivated() { buttonDeactivatedSound.play(); } @Override public void onTeleport() { teleportSound.play(); } }; public void setGameOverState(GameState gameOverState) { this.gameOverState = gameOverState; } @Override public void onEnter(Services services) { this.services = services; levelComplete = false; gameComplete = false; fadeIn = 1f; fadeOut = 0f; directionStack.clear(); if (music == null) { music = new AmbientMusic(services.jukebox); } renderer = new GameRenderer(services.gfxResources, services.gfx); world = new World(filenameForLevel(levelNum)); blobMovedSound = newSound("blobMoved.wav"); collectedGeneSound = newSound("collectedGene.wav"); collectedStarSound = newSound("collectedStar.wav"); switchBlobSound = newSound("switchBlob.wav"); teleportSound = newSound("teleport.wav"); buttonActivatedSound = newSound("buttonActivated.wav"); buttonDeactivatedSound = newSound("buttonDeactivated.wav"); //music.playNext(Mood.COMFORTABLE); music.playNext(world.getSoundtrack()); } @Override public GameState update(float dt) { if (!directionStack.isEmpty()) { world.moveBlob(directionStack.getLast()); } world.update(dt, eventHandler); // decide which gamestate to advance to if (levelComplete && fadeOut == 1f) { if (gameComplete) { levelNum = 1; // reset level for 2nd play through return gameOverState; } ++levelNum; return this; // next level } return null; } @Override public void render(float dt) { fadeIn = Math.max(0f, fadeIn - dt * FADE_IN_SPEED); fadeOut = levelComplete ? Math.min(1f, fadeOut + dt * FADE_OUT_SPEED) : 0f; renderer.draw(world, dt); if (fadeIn > 0) { renderer.drawFade(fadeIn); } if (fadeOut > 0) { renderer.drawFade(fadeOut); } } @Override public InputProcessor getInputProcessor() { return new InputAdapter() { @Override public boolean keyDown(int keycode) { Direction direction = mapToDirection(keycode); if (direction != null) { directionStack.addLast(direction); } else if (keycode == Keys.SPACE) { world.switchBlob(true); switchBlobSound.play(); } else if (keycode == Keys.EQUALS) { eventHandler.onLevelComplete(); } else if (keycode == Keys.R) { --levelNum; eventHandler.onLevelComplete(); } return false; } @Override public boolean keyUp(int keycode) { Direction direction = mapToDirection(keycode); if (direction != null) { directionStack.remove(direction); } return false; } private Direction mapToDirection(int keycode) { if (keycode == Keys.RIGHT || keycode == Keys.D) { return Direction.RIGHT; } if (keycode == Keys.LEFT || keycode == Keys.A) { return Direction.LEFT; } if (keycode == Keys.UP || keycode == Keys.W) { return Direction.UP; } if (keycode == Keys.DOWN || keycode == Keys.S) { return Direction.DOWN; } return null; } }; } private String filenameForLevel(int idx) { return "level" + idx + ".txt"; } private Sound newSound(String filename) { return services.sfxResources.newSound("sfx/" + filename); } }
3e01978241b09d05b11b55a5613918c03890984d
517
java
Java
src/main/java/com/chao/cloud/im/websocket/model/WsMsgDTO.java
chaojunzi/chao-cloud-im
0eaebc355f44a65ce380d87eed89e3c785b1d694
[ "ECL-2.0", "Apache-2.0" ]
9
2019-08-12T10:18:05.000Z
2021-11-12T03:15:42.000Z
src/main/java/com/chao/cloud/im/websocket/model/WsMsgDTO.java
Zhouy2889/chao-cloud-im
6d2cd92addadf2b2e1dd5422a5496215e2157524
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/main/java/com/chao/cloud/im/websocket/model/WsMsgDTO.java
Zhouy2889/chao-cloud-im
6d2cd92addadf2b2e1dd5422a5496215e2157524
[ "ECL-2.0", "Apache-2.0" ]
6
2019-09-18T10:59:06.000Z
2022-02-17T12:47:01.000Z
12.925
60
0.630561
670
package com.chao.cloud.im.websocket.model; import com.chao.cloud.im.websocket.constant.MsgEnum; import lombok.Data; /** * 返回值 * @功能: * @author: 薛超 * @时间:2019年6月19日 * @version 1.0.0 */ @Data public class WsMsgDTO { /** * 数据类型 */ private Integer type; /** * 数据内容 */ private Object msg; /** * 提示消息 * @param msg * @return */ public static WsMsgDTO buildMsg(MsgEnum type, Object msg) { WsMsgDTO resp = new WsMsgDTO(); resp.setType(type.type); resp.setMsg(msg); return resp; } }
3e01989ba678db779fe1c44482706420a20e9f82
3,982
java
Java
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/filter/sofatracer/ProviderTracerFilter.java
JervyShi/sofa-rpc
eaf94e09d5b866671350425a5862aa640dc8bbe4
[ "Apache-2.0" ]
2,443
2018-04-09T04:47:31.000Z
2019-05-11T16:27:14.000Z
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/filter/sofatracer/ProviderTracerFilter.java
JervyShi/sofa-rpc
eaf94e09d5b866671350425a5862aa640dc8bbe4
[ "Apache-2.0" ]
563
2018-04-13T02:31:52.000Z
2019-05-13T08:55:02.000Z
tracer/tracer-opentracing/src/main/java/com/alipay/sofa/rpc/filter/sofatracer/ProviderTracerFilter.java
JervyShi/sofa-rpc
eaf94e09d5b866671350425a5862aa640dc8bbe4
[ "Apache-2.0" ]
688
2018-04-10T14:40:45.000Z
2019-05-13T01:49:27.000Z
47.47619
115
0.735206
671
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alipay.sofa.rpc.filter.sofatracer; import com.alipay.common.tracer.core.context.trace.SofaTraceContext; import com.alipay.common.tracer.core.holder.SofaTraceContextHolder; import com.alipay.common.tracer.core.span.SofaTracerSpan; import com.alipay.sofa.rpc.common.RpcConstants; import com.alipay.sofa.rpc.config.ProviderConfig; import com.alipay.sofa.rpc.context.RpcInternalContext; import com.alipay.sofa.rpc.core.exception.SofaRpcException; import com.alipay.sofa.rpc.core.request.SofaRequest; import com.alipay.sofa.rpc.core.response.SofaResponse; import com.alipay.sofa.rpc.ext.Extension; import com.alipay.sofa.rpc.filter.AutoActive; import com.alipay.sofa.rpc.filter.Filter; import com.alipay.sofa.rpc.filter.FilterInvoker; import com.alipay.sofa.rpc.module.SofaTracerModule; import com.alipay.sofa.rpc.tracer.sofatracer.log.tags.RpcSpanTags; import static com.alipay.sofa.rpc.common.RemotingConstants.HEAD_APP_NAME; import static com.alipay.sofa.rpc.common.RemotingConstants.HEAD_INVOKE_TYPE; import static com.alipay.sofa.rpc.common.RemotingConstants.HEAD_PROTOCOL; /** * @author <a href="mailto:[email protected]">zhanggeng</a> */ @Extension(value = "providerTracer", order = -10000) @AutoActive(providerSide = true) public class ProviderTracerFilter extends Filter { @Override public boolean needToLoad(FilterInvoker invoker) { return SofaTracerModule.isEnable(); } @Override public SofaResponse invoke(FilterInvoker invoker, SofaRequest request) throws SofaRpcException { SofaTracerSpan serverSpan = null; try { SofaTraceContext sofaTraceContext = SofaTraceContextHolder.getSofaTraceContext(); serverSpan = sofaTraceContext.getCurrentSpan(); if (serverSpan != null) { RpcInternalContext context = RpcInternalContext.getContext(); serverSpan.setTag(RpcSpanTags.SERVICE, request.getTargetServiceUniqueName()); serverSpan.setTag(RpcSpanTags.METHOD, request.getMethodName()); serverSpan.setTag(RpcSpanTags.REMOTE_IP, context.getRemoteHostName()); // 客户端地址 // 从请求里获取ConsumerTracerFilter额外传递的信息 serverSpan.setTag(RpcSpanTags.REMOTE_APP, (String) request.getRequestProp(HEAD_APP_NAME)); serverSpan.setTag(RpcSpanTags.PROTOCOL, (String) request.getRequestProp(HEAD_PROTOCOL)); serverSpan.setTag(RpcSpanTags.INVOKE_TYPE, (String) request.getRequestProp(HEAD_INVOKE_TYPE)); ProviderConfig providerConfig = (ProviderConfig) invoker.getConfig(); serverSpan.setTag(RpcSpanTags.LOCAL_APP, providerConfig.getAppName()); serverSpan.setTag(RpcSpanTags.SERVER_THREAD_POOL_WAIT_TIME, (Number) context.getAttachment(RpcConstants.INTERNAL_KEY_PROCESS_WAIT_TIME)); } return invoker.invoke(request); } finally { if (serverSpan != null) { serverSpan.setTag(RpcSpanTags.SERVER_BIZ_TIME, (Number) RpcInternalContext.getContext().getAttachment(RpcConstants.INTERNAL_KEY_IMPL_ELAPSE)); } } } }
3e0198bf290c691b6eb1a6ed67544aa6a1c0ea45
197
java
Java
src/main/java/com/jitterted/mobreg/adapter/out/jdbc/EnsembleJdbcRepository.java
tedyoung/moborg
e6e37a51bb4dc052a0659d676f2f3abaf97fdf1d
[ "Apache-2.0" ]
23
2021-06-14T00:34:00.000Z
2022-03-14T23:34:35.000Z
src/main/java/com/jitterted/mobreg/adapter/out/jdbc/EnsembleJdbcRepository.java
tedyoung/moborg
e6e37a51bb4dc052a0659d676f2f3abaf97fdf1d
[ "Apache-2.0" ]
64
2021-10-23T00:23:12.000Z
2022-03-29T00:22:33.000Z
src/main/java/com/jitterted/mobreg/adapter/out/jdbc/EnsembleJdbcRepository.java
tedyoung/moborg
e6e37a51bb4dc052a0659d676f2f3abaf97fdf1d
[ "Apache-2.0" ]
6
2021-08-24T07:21:11.000Z
2022-03-28T00:12:39.000Z
28.142857
86
0.847716
672
package com.jitterted.mobreg.adapter.out.jdbc; import org.springframework.data.repository.CrudRepository; public interface EnsembleJdbcRepository extends CrudRepository<EnsembleEntity, Long> { }
3e01993cd8fc673d56a42011247b96680c85307f
475
java
Java
9. Spring Data Advanced Querying/Book Shop System/src/main/java/javadbfundametals/bookshopsystem/repositories/AuthorRepository.java
emarinova/Databases-Frameworks---Hibernate-Spring-Data
0e9f79f8abb6fabb8bc0dcac5e9913bc06e584aa
[ "MIT" ]
null
null
null
9. Spring Data Advanced Querying/Book Shop System/src/main/java/javadbfundametals/bookshopsystem/repositories/AuthorRepository.java
emarinova/Databases-Frameworks---Hibernate-Spring-Data
0e9f79f8abb6fabb8bc0dcac5e9913bc06e584aa
[ "MIT" ]
null
null
null
9. Spring Data Advanced Querying/Book Shop System/src/main/java/javadbfundametals/bookshopsystem/repositories/AuthorRepository.java
emarinova/Databases-Frameworks---Hibernate-Spring-Data
0e9f79f8abb6fabb8bc0dcac5e9913bc06e584aa
[ "MIT" ]
null
null
null
33.928571
85
0.856842
673
package javadbfundametals.bookshopsystem.repositories; import javadbfundametals.bookshopsystem.entities.Author; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface AuthorRepository extends JpaRepository<Author,Long> { Author findByFirstNameEqualsAndLastNameEquals(String firstName, String lastName); }
3e0199cb9ac84da129da516d166f5d100008d5f4
4,561
java
Java
src/gui/TelaInicio.java
jvwasquevite/battleship
c2678bd6636f9464465b484ada7718737b194f67
[ "MIT" ]
1
2021-06-14T21:53:03.000Z
2021-06-14T21:53:03.000Z
src/gui/TelaInicio.java
jvwasquevite/battleship
c2678bd6636f9464465b484ada7718737b194f67
[ "MIT" ]
null
null
null
src/gui/TelaInicio.java
jvwasquevite/battleship
c2678bd6636f9464465b484ada7718737b194f67
[ "MIT" ]
null
null
null
34.55303
97
0.565227
674
package gui; import javax.swing.*; import java.awt.Font; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class TelaInicio extends JFrame implements ActionListener { // Instanciando o painel inicial private final JPanel contentPane = new JPanel(); // Campo de texto que insere o nome do johador private final JTextField caixaDeTexto = new JTextField(20); // Botoes private final JButton jogoAleatorio = new JButton("Jogo Aleatório"); private final JButton jogoDefinido = new JButton("Definir Jogo"); private final JButton rankingBotao = new JButton("Ranking"); // Labels private final JLabel labelTitulo = new JLabel("Batalha Naval: POO 2020/2"); private final JLabel labelSubtitulo = new JLabel("Criado por Diulia Deon e João Wasquevite"); private final JLabel labelNome = new JLabel("Qual o seu nome?"); // Construtor public TelaInicio() { setTitle("Batalha Naval em Java"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Estilização do painel setBounds(100, 100, 500, 350); contentPane.setBorder(null); contentPane.setLayout(null); // Insere o painel no frame setContentPane(contentPane); // Campo de texto com o nome do jogador caixaDeTexto.setBounds(90, 140, 310, 29); contentPane.add(caixaDeTexto); // Titulo do Jogo labelTitulo.setFont(new Font("Arial", Font.BOLD, 18)); labelTitulo.setBounds(110, 20, 290, 29); contentPane.add(labelTitulo); // Subtitulo do Jogo labelSubtitulo.setFont(new Font("Arial", Font.ITALIC, 12)); labelSubtitulo.setBounds(115, 50, 280, 15); contentPane.add(labelSubtitulo); // Nome do Jogador labelNome.setFont(new Font("Arial", Font.PLAIN, 14)); labelNome.setBounds(90, 115, 150, 14); contentPane.add(labelNome); // Botão do Ranking rankingBotao.setBounds(200, 270, 90, 25); rankingBotao.setFont(new Font("Arial", Font.PLAIN, 12)); rankingBotao.addActionListener(this); contentPane.add(rankingBotao); // Botão de Jogo Aleatório jogoAleatorio.setBounds(90, 175, 150, 36); jogoAleatorio.setFont(new Font("Arial", Font.PLAIN, 12)); jogoAleatorio.addActionListener(this); contentPane.add(jogoAleatorio); // Botão de Jogo Definido jogoDefinido.setBounds(250, 175, 150, 36); jogoDefinido.setFont(new Font("Arial", Font.PLAIN, 12)); jogoDefinido.addActionListener(this); contentPane.add(jogoDefinido); // Centralizando a tela setLocationRelativeTo(null); } @Override public void actionPerformed(ActionEvent e) { // Guarda o nome do jogador em uma string String nome = caixaDeTexto.getText(); // Evento de Jogo Aleatório if (e.getSource() == jogoAleatorio){ // Verificacao de nome vazio if (nome.equals("")){ JOptionPane.showMessageDialog(null, "Digite um nome válido"); } else if (!(nome.equals(""))){ // Iniciando um Jogo Aleatório SwingUtilities.invokeLater(() -> { Jogo aleatorio = new Jogo(nome); aleatorio.setVisible(true); }); caixaDeTexto.setText(""); this.dispose(); } } // Evento de Jogo Definido if (e.getSource() == jogoDefinido){ // Verificacao de nome vazio if (nome.equals("")){ JOptionPane.showMessageDialog(null, "Digite um nome válido"); } else if (!(nome.equals(""))){ // Iniciando um Jogo Definido SwingUtilities.invokeLater(() -> { DefinirJogo definir = new DefinirJogo(nome); definir.setVisible(true); }); caixaDeTexto.setText(""); this.dispose(); } } if (e.getSource() == rankingBotao){ SwingUtilities.invokeLater(() -> { Ranking ranking = new Ranking(); ranking.setVisible(true); }); this.dispose(); } } }
3e0199e8d3bc3aebf65f8848e06108c954d19af0
457
java
Java
athena-ware/src/main/java/com/zhuangxiaoyan/athena/ware/service/PurchaseService.java
2462612540/Athena
0ad4ed2d8261574e715565b0c06264274832d9cb
[ "Apache-2.0" ]
1
2022-01-23T05:24:20.000Z
2022-01-23T05:24:20.000Z
athena-ware/src/main/java/com/zhuangxiaoyan/athena/ware/service/PurchaseService.java
2462612540/Athena
0ad4ed2d8261574e715565b0c06264274832d9cb
[ "Apache-2.0" ]
null
null
null
athena-ware/src/main/java/com/zhuangxiaoyan/athena/ware/service/PurchaseService.java
2462612540/Athena
0ad4ed2d8261574e715565b0c06264274832d9cb
[ "Apache-2.0" ]
null
null
null
21.857143
67
0.771242
675
package com.zhuangxiaoyan.athena.ware.service; import com.baomidou.mybatisplus.extension.service.IService; import com.zhuangxiaoyan.athena.ware.entity.PurchaseEntity; import com.zhuangxiaoyan.common.utils.PageUtils; import java.util.Map; /** * 采购信息 * * @author xjl * @email [email protected] * @date 2022-03-10 22:38:27 */ public interface PurchaseService extends IService<PurchaseEntity> { PageUtils queryPage(Map<String, Object> params); }
3e0199ee9ff653d76dc2d211941065817da73332
212,916
java
Java
sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
1,350
2015-01-17T05:22:05.000Z
2022-03-29T21:00:37.000Z
sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
16,834
2015-01-07T02:19:09.000Z
2022-03-31T23:29:10.000Z
sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/IotDpsResourcesClientImpl.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
1,586
2015-01-02T01:50:28.000Z
2022-03-31T11:25:34.000Z
51.194037
120
0.664581
676
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.deviceprovisioningservices.implementation; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; import com.azure.core.annotation.Post; import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.deviceprovisioningservices.fluent.IotDpsResourcesClient; import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.AsyncOperationResultInner; import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.GroupIdInformationInner; import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.IotDpsSkuDefinitionInner; import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.NameAvailabilityInfoInner; import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateEndpointConnectionInner; import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.PrivateLinkResourcesInner; import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.ProvisioningServiceDescriptionInner; import com.azure.resourcemanager.deviceprovisioningservices.fluent.models.SharedAccessSignatureAuthorizationRuleInner; import com.azure.resourcemanager.deviceprovisioningservices.models.ErrorDetailsException; import com.azure.resourcemanager.deviceprovisioningservices.models.IotDpsSkuDefinitionListResult; import com.azure.resourcemanager.deviceprovisioningservices.models.OperationInputs; import com.azure.resourcemanager.deviceprovisioningservices.models.ProvisioningServiceDescriptionListResult; import com.azure.resourcemanager.deviceprovisioningservices.models.SharedAccessSignatureAuthorizationRuleListResult; import com.azure.resourcemanager.deviceprovisioningservices.models.TagsResource; import java.nio.ByteBuffer; import java.util.List; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in IotDpsResourcesClient. */ public final class IotDpsResourcesClientImpl implements IotDpsResourcesClient { private final ClientLogger logger = new ClientLogger(IotDpsResourcesClientImpl.class); /** The proxy service used to perform REST calls. */ private final IotDpsResourcesService service; /** The service client containing this operation class. */ private final IotDpsClientImpl client; /** * Initializes an instance of IotDpsResourcesClientImpl. * * @param client the instance of the service client containing this operation class. */ IotDpsResourcesClientImpl(IotDpsClientImpl client) { this.service = RestProxy.create(IotDpsResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** * The interface defining all the services for IotDpsClientIotDpsResources to be used by the proxy service to * perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "IotDpsClientIotDpsRe") private interface IotDpsResourcesService { @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{provisioningServiceName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<ProvisioningServiceDescriptionInner>> getByResourceGroup( @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("subscriptionId") String subscriptionId, @PathParam("provisioningServiceName") String provisioningServiceName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{provisioningServiceName}") @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<Flux<ByteBuffer>>> createOrUpdate( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("provisioningServiceName") String provisioningServiceName, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") ProvisioningServiceDescriptionInner iotDpsDescription, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Patch( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{provisioningServiceName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono<Response<Flux<ByteBuffer>>> update( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("provisioningServiceName") String provisioningServiceName, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") TagsResource provisioningServiceTags, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Delete( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{provisioningServiceName}") @ExpectedResponses({200, 202, 204, 404}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<Flux<ByteBuffer>>> delete( @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("subscriptionId") String subscriptionId, @PathParam("provisioningServiceName") String provisioningServiceName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<ProvisioningServiceDescriptionListResult>> list( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<ProvisioningServiceDescriptionListResult>> listByResourceGroup( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{provisioningServiceName}/operationresults/{operationId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<AsyncOperationResultInner>> getOperationResult( @HostParam("$host") String endpoint, @PathParam("operationId") String operationId, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("provisioningServiceName") String provisioningServiceName, @QueryParam("asyncinfo") String asyncinfo, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{provisioningServiceName}/skus") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<IotDpsSkuDefinitionListResult>> listValidSkus( @HostParam("$host") String endpoint, @PathParam("provisioningServiceName") String provisioningServiceName, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<NameAvailabilityInfoInner>> checkProvisioningServiceNameAvailability( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") OperationInputs arguments, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Post( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{provisioningServiceName}/listkeys") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<SharedAccessSignatureAuthorizationRuleListResult>> listKeys( @HostParam("$host") String endpoint, @PathParam("provisioningServiceName") String provisioningServiceName, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Post( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<SharedAccessSignatureAuthorizationRuleInner>> listKeysForKeyName( @HostParam("$host") String endpoint, @PathParam("provisioningServiceName") String provisioningServiceName, @PathParam("keyName") String keyName, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{resourceName}/privateLinkResources") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<PrivateLinkResourcesInner>> listPrivateLinkResources( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{resourceName}/privateLinkResources/{groupId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<GroupIdInformationInner>> getPrivateLinkResources( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, @PathParam("groupId") String groupId, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{resourceName}/privateEndpointConnections") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<List<PrivateEndpointConnectionInner>>> listPrivateEndpointConnections( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<PrivateEndpointConnectionInner>> getPrivateEndpointConnection( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<Flux<ByteBuffer>>> createOrUpdatePrivateEndpointConnection( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, @BodyParam("application/json") PrivateEndpointConnectionInner privateEndpointConnection, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Delete( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices" + "/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<Flux<ByteBuffer>>> deletePrivateEndpointConnection( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<ProvisioningServiceDescriptionListResult>> listBySubscriptionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<ProvisioningServiceDescriptionListResult>> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<IotDpsSkuDefinitionListResult>> listValidSkusNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ErrorDetailsException.class) Mono<Response<SharedAccessSignatureAuthorizationRuleListResult>> listKeysNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** * Get the metadata of the provisioning service without SAS keys. * * @param resourceGroupName Resource group name. * @param provisioningServiceName Name of the provisioning service to retrieve. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the metadata of the provisioning service without SAS keys. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<ProvisioningServiceDescriptionInner>> getByResourceGroupWithResponseAsync( String resourceGroupName, String provisioningServiceName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .getByResourceGroup( this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(), provisioningServiceName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the metadata of the provisioning service without SAS keys. * * @param resourceGroupName Resource group name. * @param provisioningServiceName Name of the provisioning service to retrieve. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the metadata of the provisioning service without SAS keys. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<ProvisioningServiceDescriptionInner>> getByResourceGroupWithResponseAsync( String resourceGroupName, String provisioningServiceName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .getByResourceGroup( this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(), provisioningServiceName, this.client.getApiVersion(), accept, context); } /** * Get the metadata of the provisioning service without SAS keys. * * @param resourceGroupName Resource group name. * @param provisioningServiceName Name of the provisioning service to retrieve. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the metadata of the provisioning service without SAS keys. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<ProvisioningServiceDescriptionInner> getByResourceGroupAsync( String resourceGroupName, String provisioningServiceName) { return getByResourceGroupWithResponseAsync(resourceGroupName, provisioningServiceName) .flatMap( (Response<ProvisioningServiceDescriptionInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * Get the metadata of the provisioning service without SAS keys. * * @param resourceGroupName Resource group name. * @param provisioningServiceName Name of the provisioning service to retrieve. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the metadata of the provisioning service without SAS keys. */ @ServiceMethod(returns = ReturnType.SINGLE) public ProvisioningServiceDescriptionInner getByResourceGroup( String resourceGroupName, String provisioningServiceName) { return getByResourceGroupAsync(resourceGroupName, provisioningServiceName).block(); } /** * Get the metadata of the provisioning service without SAS keys. * * @param resourceGroupName Resource group name. * @param provisioningServiceName Name of the provisioning service to retrieve. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the metadata of the provisioning service without SAS keys. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<ProvisioningServiceDescriptionInner> getByResourceGroupWithResponse( String resourceGroupName, String provisioningServiceName, Context context) { return getByResourceGroupWithResponseAsync(resourceGroupName, provisioningServiceName, context).block(); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (iotDpsDescription == null) { return Mono .error(new IllegalArgumentException("Parameter iotDpsDescription is required and cannot be null.")); } else { iotDpsDescription.validate(); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .createOrUpdate( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, provisioningServiceName, this.client.getApiVersion(), iotDpsDescription, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (iotDpsDescription == null) { return Mono .error(new IllegalArgumentException("Parameter iotDpsDescription is required and cannot be null.")); } else { iotDpsDescription.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .createOrUpdate( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, provisioningServiceName, this.client.getApiVersion(), iotDpsDescription, accept, context); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<ProvisioningServiceDescriptionInner>, ProvisioningServiceDescriptionInner> beginCreateOrUpdateAsync( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdateWithResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription); return this .client .<ProvisioningServiceDescriptionInner, ProvisioningServiceDescriptionInner>getLroResult( mono, this.client.getHttpPipeline(), ProvisioningServiceDescriptionInner.class, ProvisioningServiceDescriptionInner.class, Context.NONE); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<ProvisioningServiceDescriptionInner>, ProvisioningServiceDescriptionInner> beginCreateOrUpdateAsync( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription, Context context) { context = this.client.mergeContext(context); Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdateWithResponseAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context); return this .client .<ProvisioningServiceDescriptionInner, ProvisioningServiceDescriptionInner>getLroResult( mono, this.client.getHttpPipeline(), ProvisioningServiceDescriptionInner.class, ProvisioningServiceDescriptionInner.class, context); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<ProvisioningServiceDescriptionInner>, ProvisioningServiceDescriptionInner> beginCreateOrUpdate( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).getSyncPoller(); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<ProvisioningServiceDescriptionInner>, ProvisioningServiceDescriptionInner> beginCreateOrUpdate( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context) .getSyncPoller(); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<ProvisioningServiceDescriptionInner> createOrUpdateAsync( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<ProvisioningServiceDescriptionInner> createOrUpdateAsync( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public ProvisioningServiceDescriptionInner createOrUpdate( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription) { return createOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).block(); } /** * Create or update the metadata of the provisioning service. The usual pattern to modify a property is to retrieve * the provisioning service metadata and security metadata, and then combine them with the modified values in a new * body to update the provisioning service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param iotDpsDescription Description of the provisioning service to create or update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public ProvisioningServiceDescriptionInner createOrUpdate( String resourceGroupName, String provisioningServiceName, ProvisioningServiceDescriptionInner iotDpsDescription, Context context) { return createOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, context).block(); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (provisioningServiceTags == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceTags is required and cannot be null.")); } else { provisioningServiceTags.validate(); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .update( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, provisioningServiceName, this.client.getApiVersion(), provisioningServiceTags, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (provisioningServiceTags == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceTags is required and cannot be null.")); } else { provisioningServiceTags.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .update( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, provisioningServiceName, this.client.getApiVersion(), provisioningServiceTags, accept, context); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<ProvisioningServiceDescriptionInner>, ProvisioningServiceDescriptionInner> beginUpdateAsync( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { Mono<Response<Flux<ByteBuffer>>> mono = updateWithResponseAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags); return this .client .<ProvisioningServiceDescriptionInner, ProvisioningServiceDescriptionInner>getLroResult( mono, this.client.getHttpPipeline(), ProvisioningServiceDescriptionInner.class, ProvisioningServiceDescriptionInner.class, Context.NONE); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<ProvisioningServiceDescriptionInner>, ProvisioningServiceDescriptionInner> beginUpdateAsync( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags, Context context) { context = this.client.mergeContext(context); Mono<Response<Flux<ByteBuffer>>> mono = updateWithResponseAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context); return this .client .<ProvisioningServiceDescriptionInner, ProvisioningServiceDescriptionInner>getLroResult( mono, this.client.getHttpPipeline(), ProvisioningServiceDescriptionInner.class, ProvisioningServiceDescriptionInner.class, context); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<ProvisioningServiceDescriptionInner>, ProvisioningServiceDescriptionInner> beginUpdate( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).getSyncPoller(); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<ProvisioningServiceDescriptionInner>, ProvisioningServiceDescriptionInner> beginUpdate( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags, Context context) { return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context) .getSyncPoller(); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<ProvisioningServiceDescriptionInner> updateAsync( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<ProvisioningServiceDescriptionInner> updateAsync( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags, Context context) { return beginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public ProvisioningServiceDescriptionInner update( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags) { return updateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).block(); } /** * Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to create or update. * @param provisioningServiceTags Updated tag information to set into the provisioning service instance. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the description of the provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public ProvisioningServiceDescriptionInner update( String resourceGroupName, String provisioningServiceName, TagsResource provisioningServiceTags, Context context) { return updateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, context).block(); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync( String resourceGroupName, String provisioningServiceName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .delete( this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(), provisioningServiceName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync( String resourceGroupName, String provisioningServiceName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(), provisioningServiceName, this.client.getApiVersion(), accept, context); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<Void>, Void> beginDeleteAsync( String resourceGroupName, String provisioningServiceName) { Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, provisioningServiceName); return this .client .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<Void>, Void> beginDeleteAsync( String resourceGroupName, String provisioningServiceName, Context context) { context = this.client.mergeContext(context); Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, provisioningServiceName, context); return this .client .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String provisioningServiceName) { return beginDeleteAsync(resourceGroupName, provisioningServiceName).getSyncPoller(); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<Void>, Void> beginDelete( String resourceGroupName, String provisioningServiceName, Context context) { return beginDeleteAsync(resourceGroupName, provisioningServiceName, context).getSyncPoller(); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Void> deleteAsync(String resourceGroupName, String provisioningServiceName) { return beginDeleteAsync(resourceGroupName, provisioningServiceName) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Void> deleteAsync(String resourceGroupName, String provisioningServiceName, Context context) { return beginDeleteAsync(resourceGroupName, provisioningServiceName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String provisioningServiceName) { deleteAsync(resourceGroupName, provisioningServiceName).block(); } /** * Deletes the Provisioning Service. * * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service to delete. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String provisioningServiceName, Context context) { deleteAsync(resourceGroupName, provisioningServiceName, context).block(); } /** * List all the provisioning services for a given subscription id. * * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProvisioningServiceDescriptionInner>> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context)) .<PagedResponse<ProvisioningServiceDescriptionInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * List all the provisioning services for a given subscription id. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProvisioningServiceDescriptionInner>> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .list( this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** * List all the provisioning services for a given subscription id. * * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<ProvisioningServiceDescriptionInner> listAsync() { return new PagedFlux<>( () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** * List all the provisioning services for a given subscription id. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<ProvisioningServiceDescriptionInner> listAsync(Context context) { return new PagedFlux<>( () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); } /** * List all the provisioning services for a given subscription id. * * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<ProvisioningServiceDescriptionInner> list() { return new PagedIterable<>(listAsync()); } /** * List all the provisioning services for a given subscription id. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<ProvisioningServiceDescriptionInner> list(Context context) { return new PagedIterable<>(listAsync(context)); } /** * Get a list of all provisioning services in the given resource group. * * @param resourceGroupName Resource group identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of all provisioning services in the given resource group. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProvisioningServiceDescriptionInner>> listByResourceGroupSinglePageAsync( String resourceGroupName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .listByResourceGroup( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) .<PagedResponse<ProvisioningServiceDescriptionInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get a list of all provisioning services in the given resource group. * * @param resourceGroupName Resource group identifier. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of all provisioning services in the given resource group. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProvisioningServiceDescriptionInner>> listByResourceGroupSinglePageAsync( String resourceGroupName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByResourceGroup( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** * Get a list of all provisioning services in the given resource group. * * @param resourceGroupName Resource group identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of all provisioning services in the given resource group. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<ProvisioningServiceDescriptionInner> listByResourceGroupAsync(String resourceGroupName) { return new PagedFlux<>( () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** * Get a list of all provisioning services in the given resource group. * * @param resourceGroupName Resource group identifier. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of all provisioning services in the given resource group. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<ProvisioningServiceDescriptionInner> listByResourceGroupAsync( String resourceGroupName, Context context) { return new PagedFlux<>( () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** * Get a list of all provisioning services in the given resource group. * * @param resourceGroupName Resource group identifier. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of all provisioning services in the given resource group. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<ProvisioningServiceDescriptionInner> listByResourceGroup(String resourceGroupName) { return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); } /** * Get a list of all provisioning services in the given resource group. * * @param resourceGroupName Resource group identifier. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of all provisioning services in the given resource group. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<ProvisioningServiceDescriptionInner> listByResourceGroup( String resourceGroupName, Context context) { return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); } /** * Gets the status of a long running operation, such as create, update or delete a provisioning service. * * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service that the operation is running on. * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long * running operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the status of a long running operation, such as create, update or delete a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<AsyncOperationResultInner>> getOperationResultWithResponseAsync( String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (operationId == null) { return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (asyncinfo == null) { return Mono.error(new IllegalArgumentException("Parameter asyncinfo is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .getOperationResult( this.client.getEndpoint(), operationId, this.client.getSubscriptionId(), resourceGroupName, provisioningServiceName, asyncinfo, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Gets the status of a long running operation, such as create, update or delete a provisioning service. * * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service that the operation is running on. * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long * running operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the status of a long running operation, such as create, update or delete a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<AsyncOperationResultInner>> getOperationResultWithResponseAsync( String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (operationId == null) { return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (asyncinfo == null) { return Mono.error(new IllegalArgumentException("Parameter asyncinfo is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .getOperationResult( this.client.getEndpoint(), operationId, this.client.getSubscriptionId(), resourceGroupName, provisioningServiceName, asyncinfo, this.client.getApiVersion(), accept, context); } /** * Gets the status of a long running operation, such as create, update or delete a provisioning service. * * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service that the operation is running on. * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long * running operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the status of a long running operation, such as create, update or delete a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<AsyncOperationResultInner> getOperationResultAsync( String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { return getOperationResultWithResponseAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo) .flatMap( (Response<AsyncOperationResultInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * Gets the status of a long running operation, such as create, update or delete a provisioning service. * * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service that the operation is running on. * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long * running operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the status of a long running operation, such as create, update or delete a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public AsyncOperationResultInner getOperationResult( String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo) { return getOperationResultAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo).block(); } /** * Gets the status of a long running operation, such as create, update or delete a provisioning service. * * @param operationId Operation id corresponding to long running operation. Use this to poll for the status. * @param resourceGroupName Resource group identifier. * @param provisioningServiceName Name of provisioning service that the operation is running on. * @param asyncinfo Async header used to poll on the status of the operation, obtained while creating the long * running operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the status of a long running operation, such as create, update or delete a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<AsyncOperationResultInner> getOperationResultWithResponse( String operationId, String resourceGroupName, String provisioningServiceName, String asyncinfo, Context context) { return getOperationResultWithResponseAsync( operationId, resourceGroupName, provisioningServiceName, asyncinfo, context) .block(); } /** * Gets the list of valid SKUs and tiers for a provisioning service. * * @param provisioningServiceName Name of provisioning service. * @param resourceGroupName Name of resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of valid SKUs and tiers for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<IotDpsSkuDefinitionInner>> listValidSkusSinglePageAsync( String provisioningServiceName, String resourceGroupName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .listValidSkus( this.client.getEndpoint(), provisioningServiceName, this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) .<PagedResponse<IotDpsSkuDefinitionInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Gets the list of valid SKUs and tiers for a provisioning service. * * @param provisioningServiceName Name of provisioning service. * @param resourceGroupName Name of resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of valid SKUs and tiers for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<IotDpsSkuDefinitionInner>> listValidSkusSinglePageAsync( String provisioningServiceName, String resourceGroupName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listValidSkus( this.client.getEndpoint(), provisioningServiceName, this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** * Gets the list of valid SKUs and tiers for a provisioning service. * * @param provisioningServiceName Name of provisioning service. * @param resourceGroupName Name of resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of valid SKUs and tiers for a provisioning service. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<IotDpsSkuDefinitionInner> listValidSkusAsync( String provisioningServiceName, String resourceGroupName) { return new PagedFlux<>( () -> listValidSkusSinglePageAsync(provisioningServiceName, resourceGroupName), nextLink -> listValidSkusNextSinglePageAsync(nextLink)); } /** * Gets the list of valid SKUs and tiers for a provisioning service. * * @param provisioningServiceName Name of provisioning service. * @param resourceGroupName Name of resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of valid SKUs and tiers for a provisioning service. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<IotDpsSkuDefinitionInner> listValidSkusAsync( String provisioningServiceName, String resourceGroupName, Context context) { return new PagedFlux<>( () -> listValidSkusSinglePageAsync(provisioningServiceName, resourceGroupName, context), nextLink -> listValidSkusNextSinglePageAsync(nextLink, context)); } /** * Gets the list of valid SKUs and tiers for a provisioning service. * * @param provisioningServiceName Name of provisioning service. * @param resourceGroupName Name of resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of valid SKUs and tiers for a provisioning service. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<IotDpsSkuDefinitionInner> listValidSkus( String provisioningServiceName, String resourceGroupName) { return new PagedIterable<>(listValidSkusAsync(provisioningServiceName, resourceGroupName)); } /** * Gets the list of valid SKUs and tiers for a provisioning service. * * @param provisioningServiceName Name of provisioning service. * @param resourceGroupName Name of resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of valid SKUs and tiers for a provisioning service. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<IotDpsSkuDefinitionInner> listValidSkus( String provisioningServiceName, String resourceGroupName, Context context) { return new PagedIterable<>(listValidSkusAsync(provisioningServiceName, resourceGroupName, context)); } /** * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if * the name is usable. * * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service * to check. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of name availability. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<NameAvailabilityInfoInner>> checkProvisioningServiceNameAvailabilityWithResponseAsync( OperationInputs arguments) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (arguments == null) { return Mono.error(new IllegalArgumentException("Parameter arguments is required and cannot be null.")); } else { arguments.validate(); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .checkProvisioningServiceNameAvailability( this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), arguments, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if * the name is usable. * * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service * to check. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of name availability. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<NameAvailabilityInfoInner>> checkProvisioningServiceNameAvailabilityWithResponseAsync( OperationInputs arguments, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (arguments == null) { return Mono.error(new IllegalArgumentException("Parameter arguments is required and cannot be null.")); } else { arguments.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .checkProvisioningServiceNameAvailability( this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), arguments, accept, context); } /** * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if * the name is usable. * * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service * to check. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of name availability. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<NameAvailabilityInfoInner> checkProvisioningServiceNameAvailabilityAsync(OperationInputs arguments) { return checkProvisioningServiceNameAvailabilityWithResponseAsync(arguments) .flatMap( (Response<NameAvailabilityInfoInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if * the name is usable. * * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service * to check. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of name availability. */ @ServiceMethod(returns = ReturnType.SINGLE) public NameAvailabilityInfoInner checkProvisioningServiceNameAvailability(OperationInputs arguments) { return checkProvisioningServiceNameAvailabilityAsync(arguments).block(); } /** * Check if a provisioning service name is available. This will validate if the name is syntactically valid and if * the name is usable. * * @param arguments Set the name parameter in the OperationInputs structure to the name of the provisioning service * to check. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of name availability. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<NameAvailabilityInfoInner> checkProvisioningServiceNameAvailabilityWithResponse( OperationInputs arguments, Context context) { return checkProvisioningServiceNameAvailabilityWithResponseAsync(arguments, context).block(); } /** * List the primary and secondary keys for a provisioning service. * * @param provisioningServiceName The provisioning service name to get the shared access keys for. * @param resourceGroupName resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of shared access keys. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<SharedAccessSignatureAuthorizationRuleInner>> listKeysSinglePageAsync( String provisioningServiceName, String resourceGroupName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .listKeys( this.client.getEndpoint(), provisioningServiceName, this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) .<PagedResponse<SharedAccessSignatureAuthorizationRuleInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * List the primary and secondary keys for a provisioning service. * * @param provisioningServiceName The provisioning service name to get the shared access keys for. * @param resourceGroupName resource group name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of shared access keys. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<SharedAccessSignatureAuthorizationRuleInner>> listKeysSinglePageAsync( String provisioningServiceName, String resourceGroupName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listKeys( this.client.getEndpoint(), provisioningServiceName, this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** * List the primary and secondary keys for a provisioning service. * * @param provisioningServiceName The provisioning service name to get the shared access keys for. * @param resourceGroupName resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of shared access keys. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<SharedAccessSignatureAuthorizationRuleInner> listKeysAsync( String provisioningServiceName, String resourceGroupName) { return new PagedFlux<>( () -> listKeysSinglePageAsync(provisioningServiceName, resourceGroupName), nextLink -> listKeysNextSinglePageAsync(nextLink)); } /** * List the primary and secondary keys for a provisioning service. * * @param provisioningServiceName The provisioning service name to get the shared access keys for. * @param resourceGroupName resource group name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of shared access keys. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux<SharedAccessSignatureAuthorizationRuleInner> listKeysAsync( String provisioningServiceName, String resourceGroupName, Context context) { return new PagedFlux<>( () -> listKeysSinglePageAsync(provisioningServiceName, resourceGroupName, context), nextLink -> listKeysNextSinglePageAsync(nextLink, context)); } /** * List the primary and secondary keys for a provisioning service. * * @param provisioningServiceName The provisioning service name to get the shared access keys for. * @param resourceGroupName resource group name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of shared access keys. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<SharedAccessSignatureAuthorizationRuleInner> listKeys( String provisioningServiceName, String resourceGroupName) { return new PagedIterable<>(listKeysAsync(provisioningServiceName, resourceGroupName)); } /** * List the primary and secondary keys for a provisioning service. * * @param provisioningServiceName The provisioning service name to get the shared access keys for. * @param resourceGroupName resource group name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of shared access keys. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<SharedAccessSignatureAuthorizationRuleInner> listKeys( String provisioningServiceName, String resourceGroupName, Context context) { return new PagedIterable<>(listKeysAsync(provisioningServiceName, resourceGroupName, context)); } /** * List primary and secondary keys for a specific key name. * * @param provisioningServiceName Name of the provisioning service. * @param keyName Logical key name to get key-values for. * @param resourceGroupName The name of the resource group that contains the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of the shared access key. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<SharedAccessSignatureAuthorizationRuleInner>> listKeysForKeyNameWithResponseAsync( String provisioningServiceName, String keyName, String resourceGroupName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (keyName == null) { return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .listKeysForKeyName( this.client.getEndpoint(), provisioningServiceName, keyName, this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * List primary and secondary keys for a specific key name. * * @param provisioningServiceName Name of the provisioning service. * @param keyName Logical key name to get key-values for. * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of the shared access key. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<SharedAccessSignatureAuthorizationRuleInner>> listKeysForKeyNameWithResponseAsync( String provisioningServiceName, String keyName, String resourceGroupName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (provisioningServiceName == null) { return Mono .error( new IllegalArgumentException("Parameter provisioningServiceName is required and cannot be null.")); } if (keyName == null) { return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listKeysForKeyName( this.client.getEndpoint(), provisioningServiceName, keyName, this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context); } /** * List primary and secondary keys for a specific key name. * * @param provisioningServiceName Name of the provisioning service. * @param keyName Logical key name to get key-values for. * @param resourceGroupName The name of the resource group that contains the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of the shared access key. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<SharedAccessSignatureAuthorizationRuleInner> listKeysForKeyNameAsync( String provisioningServiceName, String keyName, String resourceGroupName) { return listKeysForKeyNameWithResponseAsync(provisioningServiceName, keyName, resourceGroupName) .flatMap( (Response<SharedAccessSignatureAuthorizationRuleInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * List primary and secondary keys for a specific key name. * * @param provisioningServiceName Name of the provisioning service. * @param keyName Logical key name to get key-values for. * @param resourceGroupName The name of the resource group that contains the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of the shared access key. */ @ServiceMethod(returns = ReturnType.SINGLE) public SharedAccessSignatureAuthorizationRuleInner listKeysForKeyName( String provisioningServiceName, String keyName, String resourceGroupName) { return listKeysForKeyNameAsync(provisioningServiceName, keyName, resourceGroupName).block(); } /** * List primary and secondary keys for a specific key name. * * @param provisioningServiceName Name of the provisioning service. * @param keyName Logical key name to get key-values for. * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return description of the shared access key. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<SharedAccessSignatureAuthorizationRuleInner> listKeysForKeyNameWithResponse( String provisioningServiceName, String keyName, String resourceGroupName, Context context) { return listKeysForKeyNameWithResponseAsync(provisioningServiceName, keyName, resourceGroupName, context) .block(); } /** * List private link resources for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the available private link resources for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<PrivateLinkResourcesInner>> listPrivateLinkResourcesWithResponseAsync( String resourceGroupName, String resourceName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .listPrivateLinkResources( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * List private link resources for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the available private link resources for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<PrivateLinkResourcesInner>> listPrivateLinkResourcesWithResponseAsync( String resourceGroupName, String resourceName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listPrivateLinkResources( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, accept, context); } /** * List private link resources for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the available private link resources for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PrivateLinkResourcesInner> listPrivateLinkResourcesAsync( String resourceGroupName, String resourceName) { return listPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName) .flatMap( (Response<PrivateLinkResourcesInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * List private link resources for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the available private link resources for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public PrivateLinkResourcesInner listPrivateLinkResources(String resourceGroupName, String resourceName) { return listPrivateLinkResourcesAsync(resourceGroupName, resourceName).block(); } /** * List private link resources for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the available private link resources for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<PrivateLinkResourcesInner> listPrivateLinkResourcesWithResponse( String resourceGroupName, String resourceName, Context context) { return listPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, context).block(); } /** * Get the specified private link resource for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param groupId The name of the private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified private link resource for the given provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<GroupIdInformationInner>> getPrivateLinkResourcesWithResponseAsync( String resourceGroupName, String resourceName, String groupId) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (groupId == null) { return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .getPrivateLinkResources( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, groupId, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the specified private link resource for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param groupId The name of the private link resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified private link resource for the given provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<GroupIdInformationInner>> getPrivateLinkResourcesWithResponseAsync( String resourceGroupName, String resourceName, String groupId, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (groupId == null) { return Mono.error(new IllegalArgumentException("Parameter groupId is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .getPrivateLinkResources( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, groupId, accept, context); } /** * Get the specified private link resource for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param groupId The name of the private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified private link resource for the given provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<GroupIdInformationInner> getPrivateLinkResourcesAsync( String resourceGroupName, String resourceName, String groupId) { return getPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, groupId) .flatMap( (Response<GroupIdInformationInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * Get the specified private link resource for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param groupId The name of the private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified private link resource for the given provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public GroupIdInformationInner getPrivateLinkResources( String resourceGroupName, String resourceName, String groupId) { return getPrivateLinkResourcesAsync(resourceGroupName, resourceName, groupId).block(); } /** * Get the specified private link resource for the given provisioning service. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param groupId The name of the private link resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified private link resource for the given provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<GroupIdInformationInner> getPrivateLinkResourcesWithResponse( String resourceGroupName, String resourceName, String groupId, Context context) { return getPrivateLinkResourcesWithResponseAsync(resourceGroupName, resourceName, groupId, context).block(); } /** * List private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of private endpoint connections for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<List<PrivateEndpointConnectionInner>>> listPrivateEndpointConnectionsWithResponseAsync( String resourceGroupName, String resourceName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .listPrivateEndpointConnections( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * List private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of private endpoint connections for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<List<PrivateEndpointConnectionInner>>> listPrivateEndpointConnectionsWithResponseAsync( String resourceGroupName, String resourceName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listPrivateEndpointConnections( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, accept, context); } /** * List private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of private endpoint connections for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<List<PrivateEndpointConnectionInner>> listPrivateEndpointConnectionsAsync( String resourceGroupName, String resourceName) { return listPrivateEndpointConnectionsWithResponseAsync(resourceGroupName, resourceName) .flatMap( (Response<List<PrivateEndpointConnectionInner>> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * List private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of private endpoint connections for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public List<PrivateEndpointConnectionInner> listPrivateEndpointConnections( String resourceGroupName, String resourceName) { return listPrivateEndpointConnectionsAsync(resourceGroupName, resourceName).block(); } /** * List private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the list of private endpoint connections for a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<List<PrivateEndpointConnectionInner>> listPrivateEndpointConnectionsWithResponse( String resourceGroupName, String resourceName, Context context) { return listPrivateEndpointConnectionsWithResponseAsync(resourceGroupName, resourceName, context).block(); } /** * Get private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private endpoint connection properties. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<PrivateEndpointConnectionInner>> getPrivateEndpointConnectionWithResponseAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (privateEndpointConnectionName == null) { return Mono .error( new IllegalArgumentException( "Parameter privateEndpointConnectionName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .getPrivateEndpointConnection( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, privateEndpointConnectionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private endpoint connection properties. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<PrivateEndpointConnectionInner>> getPrivateEndpointConnectionWithResponseAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (privateEndpointConnectionName == null) { return Mono .error( new IllegalArgumentException( "Parameter privateEndpointConnectionName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .getPrivateEndpointConnection( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, privateEndpointConnectionName, accept, context); } /** * Get private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private endpoint connection properties. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PrivateEndpointConnectionInner> getPrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName) { return getPrivateEndpointConnectionWithResponseAsync( resourceGroupName, resourceName, privateEndpointConnectionName) .flatMap( (Response<PrivateEndpointConnectionInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } /** * Get private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private endpoint connection properties. */ @ServiceMethod(returns = ReturnType.SINGLE) public PrivateEndpointConnectionInner getPrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName) { return getPrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) .block(); } /** * Get private endpoint connection properties. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return private endpoint connection properties. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response<PrivateEndpointConnectionInner> getPrivateEndpointConnectionWithResponse( String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { return getPrivateEndpointConnectionWithResponseAsync( resourceGroupName, resourceName, privateEndpointConnectionName, context) .block(); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> createOrUpdatePrivateEndpointConnectionWithResponseAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (privateEndpointConnectionName == null) { return Mono .error( new IllegalArgumentException( "Parameter privateEndpointConnectionName is required and cannot be null.")); } if (privateEndpointConnection == null) { return Mono .error( new IllegalArgumentException( "Parameter privateEndpointConnection is required and cannot be null.")); } else { privateEndpointConnection.validate(); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .createOrUpdatePrivateEndpointConnection( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> createOrUpdatePrivateEndpointConnectionWithResponseAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (privateEndpointConnectionName == null) { return Mono .error( new IllegalArgumentException( "Parameter privateEndpointConnectionName is required and cannot be null.")); } if (privateEndpointConnection == null) { return Mono .error( new IllegalArgumentException( "Parameter privateEndpointConnection is required and cannot be null.")); } else { privateEndpointConnection.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .createOrUpdatePrivateEndpointConnection( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, accept, context); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<PrivateEndpointConnectionInner>, PrivateEndpointConnectionInner> beginCreateOrUpdatePrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdatePrivateEndpointConnectionWithResponseAsync( resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection); return this .client .<PrivateEndpointConnectionInner, PrivateEndpointConnectionInner>getLroResult( mono, this.client.getHttpPipeline(), PrivateEndpointConnectionInner.class, PrivateEndpointConnectionInner.class, Context.NONE); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<PrivateEndpointConnectionInner>, PrivateEndpointConnectionInner> beginCreateOrUpdatePrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, Context context) { context = this.client.mergeContext(context); Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdatePrivateEndpointConnectionWithResponseAsync( resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context); return this .client .<PrivateEndpointConnectionInner, PrivateEndpointConnectionInner>getLroResult( mono, this.client.getHttpPipeline(), PrivateEndpointConnectionInner.class, PrivateEndpointConnectionInner.class, context); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<PrivateEndpointConnectionInner>, PrivateEndpointConnectionInner> beginCreateOrUpdatePrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { return beginCreateOrUpdatePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) .getSyncPoller(); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<PrivateEndpointConnectionInner>, PrivateEndpointConnectionInner> beginCreateOrUpdatePrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, Context context) { return beginCreateOrUpdatePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) .getSyncPoller(); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PrivateEndpointConnectionInner> createOrUpdatePrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { return beginCreateOrUpdatePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PrivateEndpointConnectionInner> createOrUpdatePrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, Context context) { return beginCreateOrUpdatePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection) { return createOrUpdatePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) .block(); } /** * Create or update the status of a private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param privateEndpointConnection The private endpoint connection with updated properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public PrivateEndpointConnectionInner createOrUpdatePrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName, PrivateEndpointConnectionInner privateEndpointConnection, Context context) { return createOrUpdatePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, context) .block(); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> deletePrivateEndpointConnectionWithResponseAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (privateEndpointConnectionName == null) { return Mono .error( new IllegalArgumentException( "Parameter privateEndpointConnectionName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .deletePrivateEndpointConnection( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, privateEndpointConnectionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Flux<ByteBuffer>>> deletePrivateEndpointConnectionWithResponseAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (privateEndpointConnectionName == null) { return Mono .error( new IllegalArgumentException( "Parameter privateEndpointConnectionName is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .deletePrivateEndpointConnection( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, privateEndpointConnectionName, accept, context); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<PrivateEndpointConnectionInner>, PrivateEndpointConnectionInner> beginDeletePrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName) { Mono<Response<Flux<ByteBuffer>>> mono = deletePrivateEndpointConnectionWithResponseAsync( resourceGroupName, resourceName, privateEndpointConnectionName); return this .client .<PrivateEndpointConnectionInner, PrivateEndpointConnectionInner>getLroResult( mono, this.client.getHttpPipeline(), PrivateEndpointConnectionInner.class, PrivateEndpointConnectionInner.class, Context.NONE); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<PrivateEndpointConnectionInner>, PrivateEndpointConnectionInner> beginDeletePrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { context = this.client.mergeContext(context); Mono<Response<Flux<ByteBuffer>>> mono = deletePrivateEndpointConnectionWithResponseAsync( resourceGroupName, resourceName, privateEndpointConnectionName, context); return this .client .<PrivateEndpointConnectionInner, PrivateEndpointConnectionInner>getLroResult( mono, this.client.getHttpPipeline(), PrivateEndpointConnectionInner.class, PrivateEndpointConnectionInner.class, context); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<PrivateEndpointConnectionInner>, PrivateEndpointConnectionInner> beginDeletePrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName) { return beginDeletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) .getSyncPoller(); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<PrivateEndpointConnectionInner>, PrivateEndpointConnectionInner> beginDeletePrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { return beginDeletePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, context) .getSyncPoller(); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PrivateEndpointConnectionInner> deletePrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName) { return beginDeletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PrivateEndpointConnectionInner> deletePrivateEndpointConnectionAsync( String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { return beginDeletePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public PrivateEndpointConnectionInner deletePrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName) { return deletePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName) .block(); } /** * Delete private endpoint connection with the specified name. * * @param resourceGroupName The name of the resource group that contains the provisioning service. * @param resourceName The name of the provisioning service. * @param privateEndpointConnectionName The name of the private endpoint connection. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private endpoint connection of a provisioning service. */ @ServiceMethod(returns = ReturnType.SINGLE) public PrivateEndpointConnectionInner deletePrivateEndpointConnection( String resourceGroupName, String resourceName, String privateEndpointConnectionName, Context context) { return deletePrivateEndpointConnectionAsync( resourceGroupName, resourceName, privateEndpointConnectionName, context) .block(); } /** * Get the next page of items. * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProvisioningServiceDescriptionInner>> listBySubscriptionNextSinglePageAsync( String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) .<PagedResponse<ProvisioningServiceDescriptionInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the next page of items. * * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProvisioningServiceDescriptionInner>> listBySubscriptionNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** * Get the next page of items. * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProvisioningServiceDescriptionInner>> listByResourceGroupNextSinglePageAsync( String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) .<PagedResponse<ProvisioningServiceDescriptionInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the next page of items. * * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of provisioning service descriptions. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ProvisioningServiceDescriptionInner>> listByResourceGroupNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** * Get the next page of items. * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of available SKUs. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<IotDpsSkuDefinitionInner>> listValidSkusNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext(context -> service.listValidSkusNext(nextLink, this.client.getEndpoint(), accept, context)) .<PagedResponse<IotDpsSkuDefinitionInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the next page of items. * * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of available SKUs. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<IotDpsSkuDefinitionInner>> listValidSkusNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listValidSkusNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** * Get the next page of items. * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of shared access keys. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<SharedAccessSignatureAuthorizationRuleInner>> listKeysNextSinglePageAsync( String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext(context -> service.listKeysNext(nextLink, this.client.getEndpoint(), accept, context)) .<PagedResponse<SharedAccessSignatureAuthorizationRuleInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get the next page of items. * * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of shared access keys. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<SharedAccessSignatureAuthorizationRuleInner>> listKeysNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listKeysNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } }
3e019b6651d76ec427891de7b6f99b456e635e6f
11,364
java
Java
src/main/java/com/echobox/api/linkedin/types/IndustryCode.java
eddspencer/ebx-linkedin-sdk
3ce5a8feaaa211d9fe661128c68e90e0a80313c1
[ "Apache-2.0" ]
null
null
null
src/main/java/com/echobox/api/linkedin/types/IndustryCode.java
eddspencer/ebx-linkedin-sdk
3ce5a8feaaa211d9fe661128c68e90e0a80313c1
[ "Apache-2.0" ]
null
null
null
src/main/java/com/echobox/api/linkedin/types/IndustryCode.java
eddspencer/ebx-linkedin-sdk
3ce5a8feaaa211d9fe661128c68e90e0a80313c1
[ "Apache-2.0" ]
null
null
null
48.152542
99
0.732137
677
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.echobox.api.linkedin.types; import lombok.Getter; /** * Industry code * @author Joanna * */ public enum IndustryCode implements CodeType<Integer> { ACCOUNTING(47, "Accounting", Group.CORP, Group.FIN), ARLINES_AVIATION(94, "Airlines/Aviation", Group.MAN, Group.TECH, Group.TRAN), ALTERNATIVE_DISPUTE_RESOLUTION(120, "Alternative Dispute Resolution", Group.LEG, Group.ORG), ALTERNATIVE_MEDICINE(125, "Alternative Medicine", Group.HLTH), ANIMATION(127, "Animation", Group.ART, Group.MED), APPAREL_FASHION(19, "Apparel & Fashion", Group.GOOD), ARCHITECTURE_PLANNING(50, "Architecture & Planning", Group.CONS), ARTS_CRAFTS(111, "Arts and Crafts", Group.ART, Group.MED, Group.REC), AUTOMOTIVE(53, "Automotive", Group.MAN), AVIATION_AREOSPACE(52, "Aviation & Aerospace", Group.GOV, Group.MAN), BANKING(14, "Banking", Group.FIN), BIOTECHNOLOGY(12, "Biotechnology", Group.GOV, Group.HLTH, Group.TECH), BROADCAST_MEDIA(36, "Broadcast Media", Group.MED, Group.REC), BUILDING_MATERIALS(49, "Building Materials", Group.CONS), BUSINESS_SUPPLIES_EQUIPMENT(138, "Business Supplies and Equipment", Group.CORP, Group.MAN), CAPITAL_MARKETS(129, "Capital Markets", Group.FIN), CHEMICALS(54, "Chemicals", Group.MAN), CIVIC_SOCIAL_ORGANISATION(90, "Civic & Social Organization", Group.ORG, Group.SERV), CIVIL_ENGINEERING(51, "Civil Engineering", Group.CONS, Group.GOV), COMMERCIAL_REAL_ESTATE(128, "Commercial Real Estate", Group.CONS, Group.CORP, Group.FIN), COMPUTER_NETWORK_SECURITY(118, "Computer & Network Security", Group.TECH), COMPUTER_GAMES(109, "Computer Games", Group.MED, Group.REC), COMPUTER_HARDWARE(3, "Computer Hardware", Group.TECH), COMPUTER_NETWORKING(5, "Computer Networking", Group.TECH), COMPUTER_SOFTWARE(4, "Computer Software", Group.TECH), CONSTRUCTION(48, "Construction", Group.CONS), CONSUMER_ELECTRONICS(24, "Consumer Electronics", Group.GOOD, Group.MAN), CNSUMER_GOODS(25, "Consumer Goods", Group.GOOD, Group.MAN), CONSUMER_SERVICES(91, "Consumer Services", Group.ORG, Group.SERV), COSMETICS(18, "Cosmetics", Group.GOOD), DAIRY(65, "Dairy", Group.AGR), DEFENSE_SPACE(1, "Defense & Space", Group.GOV, Group.TECH), DESIGN(99, "Design", Group.ART, Group.MED), EDUCATIONAL_MANAGEMENT(69, "Education Management", Group.EDU), E_LEARNING(132, "E-Learning", Group.EDU, Group.MAN), ELECTRONICAL_ELECTRONIC_MANUFACTORING(112, "Electrical/Electronic Manufacturing", Group.GOOD, Group.MAN), ENTERTAINMENT(28, "Entertainment", Group.MED, Group.REC), ENVIRONMENTAL_SERVICES(86, "Environmental Services", Group.ORG, Group.SERV), EVENTS_SERVICES(110, "Events Services", Group.CORP, Group.REC, Group.SERV), EXECUTIVE_OFFICE(76, "Executive Office", Group.GOV), FACILITIES_SERVICES(122, "Facilities Services", Group.CORP, Group.SERV), FARMING(63, "Farming", Group.AGR), FINANCIAL_SERVICES(43, "Financial Services", Group.FIN), FINE_ART(38, "Fine Art", Group.ART, Group.MED, Group.REC), FISHERY(66, "Fishery", Group.AGR), FOOD_BEVERAGES(34, "Food & Beverages", Group.REC, Group.SERV), FOOD_PRODUCTION(23, "Food Production", Group.GOOD, Group.MAN, Group.SERV), FUND_RAISING(101, "Fund-Raising", Group.AGR), FURNITURE(26, "Furniture", Group.GOOD, Group.MAN), GAMBLING_CASINOS(29, "Gambling & Casinos", Group.REC), GLASS_CERMAICS_CONCRETE(145, "Glass, Ceramics & Concrete", Group.CONS, Group.MAN), GOVENMENT_ADMINISTRATION(75, "Government Administration", Group.GOV), GOVERNMENT_RELATIONS(148, "Government Relations", Group.GOV), GRAPHIC_DESIGN(140, "Graphic Design", Group.GOV), HEALTH_WELLNESS_FITNESS(124, "Health, Wellness and Fitness", Group.HLTH, Group.REC), HIGHER_EDUCATION(68, "Higher Education", Group.EDU), HOSPITAL_HEALTH_CARE(14, "Hospital & Health Care", Group.HLTH), HOSPITALITY(31, "Hospitality", Group.REC, Group.SERV, Group.TRAN), HUMAN_RESOURCES(137, "Human Resources", Group.CORP), IMPORT_EXPORT(134, "Import and Export", Group.CORP, Group.GOOD, Group.TRAN), INDIVIDUAL_FAMILY_SERVICES(88, "Individual & Family Services", Group.ORG, Group.SERV), INDUSTRIAL_AUTOMATION(147, "Industrial Automation", Group.CONS, Group.MAN), INFORMATIONAL_SERVICES(84, "Information Services", Group.MED, Group.SERV), INFORMATIONAL_TECHNOLOGY_SERVICES(96, "Information Technology and Services", Group.TECH), INSURANCE(42, "Insurance", Group.FIN), INTERNATIONAL_AFFAIRS(74, "International Affairs", Group.GOV), INTERNATIONAL_TRADE_DEVELOPMENT(141, "International Trade and Development", Group.GOV, Group.ORG, Group.TRAN), INTERNET(6, "Internet", Group.TECH), INVESTMENT_BANKING(45, "Investment Banking", Group.FIN), INVESTMENT_MANAGEMENT(46, "Investment Management", Group.FIN), JUDICIARY(73, "Judiciary", Group.GOV, Group.LEG), LAW_INFORCEMENT(77, "Law Enforcement", Group.GOV, Group.LEG), LAW_PRACTICE(9, "Law Practice", Group.LEG), LEGAL_SERVICES(10, "Legal Services", Group.LEG), LEGISLATIVE_OFFICE(72, "Legislative Office", Group.GOV, Group.LEG), LESUIRE_TRAVEL_TOURISM(30, "Leisure, Travel & Tourism", Group.GOV, Group.LEG), LIBRARIES(85, "Libraries", Group.MED, Group.REC, Group.SERV), LOGISTICS_SUPPLY_CHAIN(116, "Logistics and Supply Chain", Group.CORP, Group.TRAN), LUXURY_GOODS_JEWELRY(143, "Luxury Goods & Jewelry", Group.GOOD), MACHINERY(55, "Machinery", Group.MAN), MANAGEMENT_CONSULTING(11, "Management Consulting", Group.CORP), MARITIME(95, "Maritime", Group.TRAN), MARKET_RESEARCH(97, "Market Research", Group.CORP), MARKETING_ADVERTISING(80, "Marketing and Advertising", Group.CORP, Group.MED), MECHANICAL_INDUSTRIAL_ENGINEERING(135, "Mechanical or Industrial Engineering", Group.CONS, Group.GOV, Group.MAN), MEDIA_PRODUCTION(126, "Media Production", Group.MED, Group.REC), MEDICAL_DEVICES(17, "Medical Devices", Group.HLTH), MEDICAL_PRACTICIES(13, "Medical Practice", Group.HLTH), MENTAL_HEALTH_CARE(139, "Medical Practice", Group.HLTH), MILITARY(71, "Military", Group.GOV), MINING_MATERIALS(56, "Mining & Metals", Group.MAN), MOTION_PICTURES_FILM(35, "Motion Pictures and Film", Group.ART, Group.MED, Group.REC), MUSEUMS_INSTITUTIONS(37, "Museums and Institutions", Group.ART, Group.MED, Group.REC), MUSIC(115, "Music", Group.ART, Group.REC), NANOTECHNOLOGY(114, "Nanotechnology", Group.GOV, Group.MAN, Group.TECH), NEWSPAPERS(81, "Newspapers", Group.MED, Group.REC), NON_PROFIT_ORGANIZATION_MANAGEMENT(100, "Non-Profit Organization Management", Group.ORG), OIL_ENERGY(57, "Oil & Energy", Group.MAN), ONLINE_MEDIA(113, "Online Media", Group.MED), OUTSOURCING_OFFSHORING(123, "Outsourcing/Offshoring", Group.CORP), PACKAGE_FREIGHT_DELIVERY(87, "Package/Freight Delivery", Group.SERV, Group.TRAN), PACKAGING_CONTAINERS(146, "Packaging and Containers", Group.GOOD, Group.MAN), PAPER_FOREST_PRODUCTS(61, "Paper & Forest Products", Group.MAN), PERFORMING_ARTS(39, "Performing Arts", Group.ART, Group.MED, Group.REC), PHARMACEUTICALS(15, "Pharmaceuticals", Group.HLTH, Group.TECH), PHILANTHROPY(131, "Philanthropy", Group.ORG), PHOTOGRAPHY(136, "Photography", Group.ART, Group.MED, Group.REC), PLASTICS(117, "Plastics", Group.MAN), POLITICAL_ORGANIZATION(107, "Political Organization", Group.GOV, Group.ORG), PRIMARY_SECONDARY_EDUCATION(67, "Primary/Secondary Education", Group.EDU), PRINTING(83, "Printing", Group.MED, Group.REC), PROFESSIONAL_TRAINING_COACHING(105, "Professional Training & Coaching", Group.CORP), PROGRAM_DEVELOPMENT(102, "Program Development", Group.CORP, Group.ORG), PUBLIC_POLICY(79, "Public Policy", Group.GOV), PUBLIC_RELATIONS_COMMUNICATIONS(98, "Public Relations and Communications", Group.CORP), PUBLIC_SAFETY(78, "Public Safety", Group.GOV), PUBLISHING(82, "Publishing", Group.MED, Group.REC), RAILROAD_MANUFACTURE(62, "Railroad Manufacture", Group.MAN), RANCHING(64, "Ranching", Group.AGR), REAL_ESTATE(44, "Real Estate", Group.CONS, Group.FIN, Group.GOOD), RECREATIONAL_FACILITIES_SERVICES(40, "Recreational Facilities and Services", Group.REC, Group.SERV), RELIGIOUS_INSTITUTIONS(89, "Religious Institutions", Group.ORG, Group.SERV), RENEWABLES_ENVIRONMENT(144, "Renewables & Environment", Group.GOV, Group.MAN, Group.ORG), RESEARCH(70, "Research", Group.EDU, Group.GOV), RESTAURANTS(32, "Restaurants", Group.REC, Group.SERV), RETAIL(27, "Retail", Group.GOOD, Group.MAN), SECURITY_INVESTIGATIONS(121, "Security and Investigations", Group.CORP, Group.ORG, Group.SERV), SEIMCONDUCTORS(7, "Semiconductors", Group.TECH), SHIPBUILDING(58, "Shipbuilding", Group.MAN), SPORTING_GOODS(20, "Sporting Goods", Group.GOOD, Group.REC), SPORTS(33, "Sports", Group.REC), STAFFING_RECRUITING(104, "Staffing and Recruiting", Group.CORP), SUPERMARKETS(22, "Supermarkets", Group.GOOD), TELECOMMUNICATIONS(8, "Telecommunications", Group.GOV, Group.TECH), TEXTILES(60, "Textiles", Group.MAN), THINK_TANKS(130, "Think Tanks", Group.GOV, Group.ORG), TOBACCO(21, "Tobacco", Group.GOOD), TRANSLATION_LOCALIZATION(108, "Translation and Localization", Group.CORP, Group.GOV, Group.SERV), TRANSPORTATION_TRUCKING_RAILROAD(92, "Transportation/Trucking/Railroad", Group.TRAN), UTILITIES(59, "Utilities", Group.MAN), VENTURE_CAPITAL_PRIVATE_EQUITY(106, "Venture Capital & Private Equity", Group.FIN, Group.TECH), VETERINARY(16, "Veterinary", Group.HLTH), WAREHOUSING(93, "Warehousing", Group.TRAN), WHOLESALE(133, "Wholesale", Group.GOOD), WINE_SPIRITS(142, "Wine and Spirits", Group.GOOD, Group.MAN, Group.REC), WIRELESS(119, "Wireless", Group.TECH), WRITING_EDITING(103, "Writing and Editing", Group.ART, Group.MED, Group.REC); @Getter private final Integer code; @Getter final String name; @Getter private final Group[] groups; IndustryCode(Integer code, String name, Group... groups) { this.code = code; this.name = name; this.groups = groups; } /** * Convert the provided code into a status type * * @param code the code * @return if successful the desired status type otherwise null */ public static IndustryCode fromCode(Integer code) { for (IndustryCode industryCode : IndustryCode.values()) { if (industryCode.getCode().equals(code)) { return industryCode; } } return null; } /** * Group enum * @author Joanna * */ public enum Group { CORP, FIN, MAN, TECH, TRAN, LEG, ORG, HLTH, ART, MED, GOOD, CONS, REC, GOV, SERV, AGR, EDU; } }
3e019c8e03114a2006b452a16322c0ef13dca581
2,094
java
Java
MVP/MVPDemo3/src/main/java/jp/sinya/mvpdemo3/mvp/proxy/fragment/FragmentMvpImpl.java
KoizumiSinya/DemoProject
01aae447bdc02b38b73b2af085e3e28e662764be
[ "Apache-2.0" ]
null
null
null
MVP/MVPDemo3/src/main/java/jp/sinya/mvpdemo3/mvp/proxy/fragment/FragmentMvpImpl.java
KoizumiSinya/DemoProject
01aae447bdc02b38b73b2af085e3e28e662764be
[ "Apache-2.0" ]
null
null
null
MVP/MVPDemo3/src/main/java/jp/sinya/mvpdemo3/mvp/proxy/fragment/FragmentMvpImpl.java
KoizumiSinya/DemoProject
01aae447bdc02b38b73b2af085e3e28e662764be
[ "Apache-2.0" ]
null
null
null
19.211009
123
0.662846
678
package jp.sinya.mvpdemo3.mvp.proxy.fragment; import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import jp.sinya.mvpdemo3.mvp.presenter.base.BasePresenter; import jp.sinya.mvpdemo3.mvp.proxy.MvpCallBack; import jp.sinya.mvpdemo3.mvp.proxy.MvpCallBackImpl; import jp.sinya.mvpdemo3.mvp.view.base.BaseView; /** * @author Koizumi Sinya * @date 2018/01/23. 11:52 * @edithor * @date */ public class FragmentMvpImpl<V extends BaseView, P extends BasePresenter<V>> implements FragmentMvpInterface<V, P> { private MvpCallBack<V, P> callBack; private MvpCallBackImpl<V, P> impl; public FragmentMvpImpl(MvpCallBack<V, P> callBack) { this.callBack = callBack; } public MvpCallBackImpl<V, P> getImpl() { if (callBack != null) { impl = new MvpCallBackImpl<>(callBack); } return impl; } @Override public void onAttach(Context context) { } @Override public void onCreate(Bundle savedInstanceState) { } @Override public void onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { } @Override public void onActivityCreated(Bundle savedInstanceState) { getImpl().createPresenter(); getImpl().createMvpView(); getImpl().attachView(); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { } @Override public void onStart() { } @Override public void onPause() { } @Override public void onResume() { } @Override public void onStop() { } @Override public void onDestroyView() { } @Override public void onDestroy() { getImpl().detachView(); } @Override public void onDetach() { } @Override public void onSaveInstanceState(Bundle outState) { } @Override public void setUserVisibleHint() { } }
3e019cac7ca07555e7c168d0f2938e535d6414e7
2,495
java
Java
src/java/org/bhavaya/collection/TransactionalObservableList.java
cmzfusion/OpenAdaptorBhavaya
c1c4b815c0982b3ea9b6a3f075f3edd39eeb2e16
[ "MIT" ]
null
null
null
src/java/org/bhavaya/collection/TransactionalObservableList.java
cmzfusion/OpenAdaptorBhavaya
c1c4b815c0982b3ea9b6a3f075f3edd39eeb2e16
[ "MIT" ]
null
null
null
src/java/org/bhavaya/collection/TransactionalObservableList.java
cmzfusion/OpenAdaptorBhavaya
c1c4b815c0982b3ea9b6a3f075f3edd39eeb2e16
[ "MIT" ]
null
null
null
39.603175
84
0.755511
679
/* Copyright (C) 2000-2003 The Software Conservancy as Trustee. * All rights reserved. * * 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. * * Nothing in this notice shall be deemed to grant any rights to trademarks, * copyrights, patents, trade secrets or any other intellectual property of the * licensor or any contributor except as expressly stated herein. No patent * license is granted separate from the Software, for code that you delete from * the Software, or for combinations of the Software with other software or * hardware. */ package org.bhavaya.collection; import java.util.Collection; /** * @author Parwinder Sekhon * @version $Revision: 1.3 $ */ public interface TransactionalObservableList<E> extends ObservableList<E> { public void add(int index, E element, boolean fireCommit); public boolean add(E value, boolean fireCommit); public boolean addAll(Collection<? extends E> c, boolean fireCommit); public boolean addAll(int index, Collection<? extends E> c, boolean fireCommit); public Object remove(int index, boolean fireCommit); public boolean remove(Object value, boolean fireCommit); public boolean removeAll(Collection<?> c, boolean fireCommit); public boolean retainAll(Collection<?> c, boolean fireCommit); public Object set(int index, E element, boolean fireCommit); public void clear(boolean fireCommit); public void fireCommit(); public Object getTransactionLock(); }
3e019d8a95e181b1543ad9ae65de73739134a2d1
2,031
java
Java
java/src/hype/layout/HGridLayout.java
russtheaerialist-retired-projects/HYPE_Processing
fc7bbc3b9cc75cba3e59e543ac7bfb5e711e10ba
[ "BSD-3-Clause" ]
1
2016-08-08T13:51:05.000Z
2016-08-08T13:51:05.000Z
java/src/hype/layout/HGridLayout.java
russtheaerialist-retired-projects/HYPE_Processing
fc7bbc3b9cc75cba3e59e543ac7bfb5e711e10ba
[ "BSD-3-Clause" ]
null
null
null
java/src/hype/layout/HGridLayout.java
russtheaerialist-retired-projects/HYPE_Processing
fc7bbc3b9cc75cba3e59e543ac7bfb5e711e10ba
[ "BSD-3-Clause" ]
null
null
null
17.358974
61
0.695224
680
package hype.layout; import hype.drawable.HDrawable; import hype.util.H; import processing.core.PVector; public class HGridLayout implements HLayout { protected int _currentIndex, _numCols; protected float _startX, _startY, _xSpace, _ySpace; public HGridLayout() { _xSpace = _ySpace = _numCols = 16; } public HGridLayout(int numOfColumns) { this(); _numCols = numOfColumns; } public HGridLayout currentIndex(int i) { _currentIndex = i; return this; } public int currentIndex() { return _currentIndex; } public HGridLayout resetIndex() { _currentIndex = 0; return this; } public HGridLayout cols(int numOfColumns) { _numCols = numOfColumns; return this; } public int cols() { return _numCols; } public PVector startLoc() { return new PVector(_startX, _startY); } public HGridLayout startLoc(float x, float y) { _startX = x; _startY = y; return this; } public float startX() { return _startX; } public HGridLayout startX(float x) { _startX = x; return this; } public float startY() { return _startY; } public HGridLayout startY(float y) { _startY = y; return this; } public PVector spacing() { return new PVector(_xSpace, _ySpace); } public HGridLayout spacing(float xSpacing, float ySpacing) { _xSpace = xSpacing; _ySpace = ySpacing; return this; } public float spacingX() { return _xSpace; } public HGridLayout spacingX(float xSpacing) { _xSpace = xSpacing; return this; } public float spacingY() { return _ySpace; } public HGridLayout spacingY(float ySpacing) { _ySpace = ySpacing; return this; } @Override @SuppressWarnings("static-access") public PVector getNextPoint() { int currentRow = H.app().floor(_currentIndex / _numCols); int currentCol = _currentIndex % _numCols; ++_currentIndex; return new PVector( currentCol*_xSpace + _startX, currentRow*_ySpace + _startY ); } @Override public void applyTo(HDrawable target) { target.loc(getNextPoint()); } }
3e019dada530dd3f80bf152041d79f56d522b237
16,625
java
Java
marketing-api-kuaishou/src/main/java/com/hyq0719/mktapi/kuaishou/api/AdServingApi.java
Hyq0719/marketing-api-java-sdks
e70b52d96845e9a25eaacd39398baef319ed20a0
[ "Apache-2.0" ]
41
2022-01-30T14:26:15.000Z
2022-03-24T08:17:06.000Z
marketing-api-kuaishou/src/main/java/com/hyq0719/mktapi/kuaishou/api/AdServingApi.java
Hyq0719/marketing-api-java-sdks
e70b52d96845e9a25eaacd39398baef319ed20a0
[ "Apache-2.0" ]
null
null
null
marketing-api-kuaishou/src/main/java/com/hyq0719/mktapi/kuaishou/api/AdServingApi.java
Hyq0719/marketing-api-java-sdks
e70b52d96845e9a25eaacd39398baef319ed20a0
[ "Apache-2.0" ]
8
2022-02-10T06:35:51.000Z
2022-03-25T08:43:32.000Z
36.699779
131
0.740391
681
package com.hyq0719.mktapi.kuaishou.api; import com.hyq0719.mktapi.common.ApiClient; import com.hyq0719.mktapi.common.RetryStrategy; import com.hyq0719.mktapi.common.annotation.ApiRequestMapping; import com.hyq0719.mktapi.common.constant.RequestConstants; import com.hyq0719.mktapi.common.executor.parameter.Pair; import com.hyq0719.mktapi.common.util.JsonUtil; import com.hyq0719.mktapi.kuaishou.KshApiRequest; import com.hyq0719.mktapi.kuaishou.bean.ad_unit.*; import com.hyq0719.mktapi.kuaishou.bean.advertiser.AdvertiserBudgetGetRequest; import com.hyq0719.mktapi.kuaishou.bean.advertiser.AdvertiserBudgetGetResponseStruct; import com.hyq0719.mktapi.kuaishou.bean.advertiser.AdvertiserUpdateBudgetRequest; import com.hyq0719.mktapi.kuaishou.bean.campaign.*; import com.hyq0719.mktapi.kuaishou.bean.common.KshResponse; import com.hyq0719.mktapi.kuaishou.bean.common.PageResponseData; import com.hyq0719.mktapi.kuaishou.bean.creative.*; import com.hyq0719.mktapi.kuaishou.bean.tool.ToolAudiencePredictionRequest; import com.hyq0719.mktapi.kuaishou.bean.tool.ToolAudiencePredictionResponseStruct; import com.hyq0719.mktapi.kuaishou.bean.tool.ToolOperationRecordListRequest; import com.hyq0719.mktapi.kuaishou.bean.tool.ToolOperationRecordListResponseStruct; import java.util.List; /** * 磁力引擎-广告投放 */ public class AdServingApi extends AbstractKshApi { /** * 获取各层级信息 */ private volatile CampaignList campaignList; private volatile AdUnitList adUnitList; private volatile CreativeList creativeList; private volatile CreativeAdvancedProgramList creativeAdvancedProgramList; private volatile CreativeAdvancedProgramReviewDetail creativeAdvancedProgramReviewDetail; private volatile ToolOperationRecordList toolOperationRecordList; private volatile ToolAudiencePrediction toolAudiencePrediction; /** * 账户层级 */ private volatile AdvertiserBudgetGet advertiserBudgetGet; private volatile AdvertiserUpdateBudget advertiserUpdateBudget; /** * 广告计划 */ private volatile CampaignCreate campaignCreate; private volatile CampaignUpdate campaignUpdate; private volatile CampaignUpdateStatus campaignUpdateStatus; /** * 广告组 */ private volatile AdUnitCreate adUnitCreate; private volatile AdUnitUpdate adUnitUpdate; private volatile AdUnitUpdateDayBudget adUnitUpdateDayBudget; private volatile AdUnitUpdateStatus adUnitUpdateStatus; private volatile AdUnitUpdateBid adUnitUpdateBid; /** * 广告创意 */ private volatile CreativeCreate creativeCreate; private volatile CreativeBatchUpdate creativeBatchUpdate; private volatile CreativeUpdate creativeUpdate; private volatile CreativeUpdateStatus creativeUpdateStatus; private volatile CreativeCreatePreview creativeCreatePreview; private volatile CreativeCreateCreativeTagAdvise creativeCreateCreativeTagAdvise; public AdServingApi(ApiClient apiClient, RetryStrategy retryStrategy) { super(apiClient, retryStrategy); } public CampaignList campaignList() { if (campaignList == null) { synchronized (CampaignList.class) { if (campaignList == null) { campaignList = (CampaignList) init(CampaignList.class); } } } return campaignList; } public AdUnitList adUnitList() { if (adUnitList == null) { synchronized (AdUnitList.class) { if (adUnitList == null) { adUnitList = (AdUnitList) init(AdUnitList.class); } } } return adUnitList; } public CreativeList creativeList() { if (creativeList == null) { synchronized (CreativeList.class) { if (creativeList == null) { creativeList = (CreativeList) init(CreativeList.class); } } } return creativeList; } public CreativeAdvancedProgramList creativeAdvancedProgramList() { if (creativeAdvancedProgramList == null) { synchronized (CreativeAdvancedProgramList.class) { if (creativeAdvancedProgramList == null) { creativeAdvancedProgramList = (CreativeAdvancedProgramList) init(CreativeAdvancedProgramList.class); } } } return creativeAdvancedProgramList; } public CreativeAdvancedProgramReviewDetail creativeAdvancedProgramReviewDetail() { if (creativeAdvancedProgramReviewDetail == null) { synchronized (CreativeAdvancedProgramReviewDetail.class) { if (creativeAdvancedProgramReviewDetail == null) { creativeAdvancedProgramReviewDetail = (CreativeAdvancedProgramReviewDetail) init( CreativeAdvancedProgramReviewDetail.class); } } } return creativeAdvancedProgramReviewDetail; } public ToolOperationRecordList toolOperationRecordList() { if (toolOperationRecordList == null) { synchronized (ToolOperationRecordList.class) { if (toolOperationRecordList == null) { toolOperationRecordList = (ToolOperationRecordList) init(ToolOperationRecordList.class); } } } return toolOperationRecordList; } public ToolAudiencePrediction toolAudiencePrediction() { if (toolAudiencePrediction == null) { synchronized (ToolAudiencePrediction.class) { if (toolAudiencePrediction == null) { toolAudiencePrediction = (ToolAudiencePrediction) init(ToolAudiencePrediction.class); } } } return toolAudiencePrediction; } public AdvertiserBudgetGet advertiserBudgetGet() { if (advertiserBudgetGet == null) { synchronized (AdvertiserBudgetGet.class) { if (advertiserBudgetGet == null) { advertiserBudgetGet = (AdvertiserBudgetGet) init(AdvertiserBudgetGet.class); } } } return advertiserBudgetGet; } public AdvertiserUpdateBudget advertiserUpdateBudget() { if (advertiserUpdateBudget == null) { synchronized (AdvertiserUpdateBudget.class) { if (advertiserUpdateBudget == null) { advertiserUpdateBudget = (AdvertiserUpdateBudget) init(AdvertiserUpdateBudget.class); } } } return advertiserUpdateBudget; } public CampaignCreate campaignCreate() { if (campaignCreate == null) { synchronized (CampaignCreate.class) { if (campaignCreate == null) { campaignCreate = (CampaignCreate) init(CampaignCreate.class); } } } return campaignCreate; } public CampaignUpdate campaignUpdate() { if (campaignUpdate == null) { synchronized (CampaignUpdate.class) { if (campaignUpdate == null) { campaignUpdate = (CampaignUpdate) init(CampaignUpdate.class); } } } return campaignUpdate; } public CampaignUpdateStatus campaignUpdateStatus() { if (campaignUpdateStatus == null) { synchronized (CampaignUpdateStatus.class) { if (campaignUpdateStatus == null) { campaignUpdateStatus = (CampaignUpdateStatus) init(CampaignUpdateStatus.class); } } } return campaignUpdateStatus; } public AdUnitCreate adUnitCreate() { if (adUnitCreate == null) { synchronized (AdUnitCreate.class) { if (adUnitCreate == null) { adUnitCreate = (AdUnitCreate) init(AdUnitCreate.class); } } } return adUnitCreate; } public AdUnitUpdate adUnitUpdate() { if (adUnitUpdate == null) { synchronized (AdUnitUpdate.class) { if (adUnitUpdate == null) { adUnitUpdate = (AdUnitUpdate) init(AdUnitUpdate.class); } } } return adUnitUpdate; } public AdUnitUpdateDayBudget adUnitUpdateDayBudget() { if (adUnitUpdateDayBudget == null) { synchronized (AdUnitUpdateDayBudget.class) { if (adUnitUpdateDayBudget == null) { adUnitUpdateDayBudget = (AdUnitUpdateDayBudget) init(AdUnitUpdateDayBudget.class); } } } return adUnitUpdateDayBudget; } public AdUnitUpdateStatus adUnitUpdateStatus() { if (adUnitUpdateStatus == null) { synchronized (AdUnitUpdateStatus.class) { if (adUnitUpdateStatus == null) { adUnitUpdateStatus = (AdUnitUpdateStatus) init(AdUnitUpdateStatus.class); } } } return adUnitUpdateStatus; } public AdUnitUpdateBid adUnitUpdateBid() { if (adUnitUpdateBid == null) { synchronized (AdUnitUpdateBid.class) { if (adUnitUpdateBid == null) { adUnitUpdateBid = (AdUnitUpdateBid) init(AdUnitUpdateBid.class); } } } return adUnitUpdateBid; } public CreativeCreate creativeCreate() { if (creativeCreate == null) { synchronized (CreativeCreate.class) { if (creativeCreate == null) { creativeCreate = (CreativeCreate) init(CreativeCreate.class); } } } return creativeCreate; } public CreativeBatchUpdate creativeBatchUpdate() { if (creativeBatchUpdate == null) { synchronized (CreativeBatchUpdate.class) { if (creativeBatchUpdate == null) { creativeBatchUpdate = (CreativeBatchUpdate) init(CreativeBatchUpdate.class); } } } return creativeBatchUpdate; } public CreativeUpdate creativeUpdate() { if (creativeUpdate == null) { synchronized (CreativeUpdate.class) { if (creativeUpdate == null) { creativeUpdate = (CreativeUpdate) init(CreativeUpdate.class); } } } return creativeUpdate; } public CreativeUpdateStatus creativeUpdateStatus() { if (creativeUpdateStatus == null) { synchronized (CreativeUpdateStatus.class) { if (creativeUpdateStatus == null) { creativeUpdateStatus = (CreativeUpdateStatus) init(CreativeUpdateStatus.class); } } } return creativeUpdateStatus; } public CreativeCreatePreview creativeCreatePreview() { if (creativeCreatePreview == null) { synchronized (CreativeCreatePreview.class) { if (creativeCreatePreview == null) { creativeCreatePreview = (CreativeCreatePreview) init(CreativeCreatePreview.class); } } } return creativeCreatePreview; } public CreativeCreateCreativeTagAdvise creativeCreateCreativeTagAdvise() { if (creativeCreateCreativeTagAdvise == null) { synchronized (CreativeCreateCreativeTagAdvise.class) { if (creativeCreateCreativeTagAdvise == null) { creativeCreateCreativeTagAdvise = (CreativeCreateCreativeTagAdvise) init( CreativeCreateCreativeTagAdvise.class); } } } return creativeCreateCreativeTagAdvise; } @ApiRequestMapping(value = "/campaign/list", method = RequestConstants.POST) public class CampaignList extends KshApiRequest<CampaignListRequest, KshResponse<PageResponseData<CampaignListResponseStruct>>> { } @ApiRequestMapping(value = "/ad_unit/list", method = RequestConstants.POST) public class AdUnitList extends KshApiRequest<AdUnitListRequest, KshResponse<PageResponseData<AdUnitListResponseStruct>>> { } @ApiRequestMapping(value = "/creative/list", method = RequestConstants.POST) public class CreativeList extends KshApiRequest<CreativeListRequest, KshResponse<PageResponseData<CreativeListResponseStruct>>> { } @ApiRequestMapping(value = "/creative/advanced/program/list", method = RequestConstants.POST, version = "v2") public class CreativeAdvancedProgramList extends KshApiRequest<CreativeAdvancedProgramListRequest, KshResponse<PageResponseData<CreativeAdvancedProgramListResponseStruct>>> { } @ApiRequestMapping(value = "/creative/advanced/program/review_detail", method = RequestConstants.GET, usePostBody = false, contentTypes = {RequestConstants.CONTENT_TYPE_TEXT_PLAIN}, version = "v2") public class CreativeAdvancedProgramReviewDetail extends KshApiRequest<CreativeAdvancedProgramReviewDetailRequest, KshResponse<CreativeAdvancedProgramReviewDetailResponseStruct>> { @Override public void setRequestParam(List<Pair> localVarQueryParams, List<Pair> localVarCollectionQueryParams, CreativeAdvancedProgramReviewDetailRequest creativeAdvancedProgramReviewDetailRequest) { Long advertiserId = creativeAdvancedProgramReviewDetailRequest.getAdvertiserId(); if (advertiserId != null) { localVarQueryParams.addAll(parameterToPair("advertiser_id", advertiserId)); } List<Long> unitIds = creativeAdvancedProgramReviewDetailRequest.getUnitIds(); if (unitIds != null) { localVarQueryParams.addAll(parameterToPair("unit_ids", JsonUtil.toJsonString(unitIds))); } } } @ApiRequestMapping(value = "/tool/operation_record/list", method = RequestConstants.POST) public class ToolOperationRecordList extends KshApiRequest<ToolOperationRecordListRequest, KshResponse<PageResponseData<ToolOperationRecordListResponseStruct>>> { } @ApiRequestMapping(value = "/tool/audience/prediction", method = RequestConstants.POST) public class ToolAudiencePrediction extends KshApiRequest<ToolAudiencePredictionRequest, KshResponse<ToolAudiencePredictionResponseStruct>> { } @ApiRequestMapping(value = "/advertiser/budget/get", method = RequestConstants.POST) public class AdvertiserBudgetGet extends KshApiRequest<AdvertiserBudgetGetRequest, KshResponse<AdvertiserBudgetGetResponseStruct>> { } @ApiRequestMapping(value = "/advertiser/update/budget", method = RequestConstants.POST) public class AdvertiserUpdateBudget extends KshApiRequest<AdvertiserUpdateBudgetRequest, KshResponse> { } @ApiRequestMapping(value = "/campaign/create", method = RequestConstants.POST) public class CampaignCreate extends KshApiRequest<CampaignCreateRequest, KshResponse<CampaignCreateResponseStruct>> { } @ApiRequestMapping(value = "/campaign/update", method = RequestConstants.POST) public class CampaignUpdate extends KshApiRequest<CampaignUpdateRequest, KshResponse<CampaignUpdateResponseStruct>> { } @ApiRequestMapping(value = "/campaign/update/status", method = RequestConstants.POST, version = "v2") public class CampaignUpdateStatus extends KshApiRequest<CampaignUpdateStatusRequest, KshResponse<CampaignUpdateStatusResponseStruct>> { } @ApiRequestMapping(value = "/ad_unit/create", method = RequestConstants.POST, version = "v2") public class AdUnitCreate extends KshApiRequest<AdUnitCreateRequest, KshResponse<AdUnitCreateResponseStruct>> { } @ApiRequestMapping(value = "/ad_unit/update", method = RequestConstants.POST, version = "v2") public class AdUnitUpdate extends KshApiRequest<AdUnitUpdateRequest, KshResponse<AdUnitUpdateResponseStruct>> { } @ApiRequestMapping(value = "/ad_unit/update/day_budget", method = RequestConstants.POST) public class AdUnitUpdateDayBudget extends KshApiRequest<AdUnitUpdateDayBudgetRequest, KshResponse> { } @ApiRequestMapping(value = "/ad_unit/update/status", method = RequestConstants.POST) public class AdUnitUpdateStatus extends KshApiRequest<AdUnitUpdateStatusRequest, KshResponse<AdUnitUpdateStatusResponseStruct>> { } @ApiRequestMapping(value = "/ad_unit/update/bid", method = RequestConstants.POST) public class AdUnitUpdateBid extends KshApiRequest<AdUnitUpdateBidRequest, KshResponse> { } @ApiRequestMapping(value = "/creative/create", method = RequestConstants.POST, version = "v2") public class CreativeCreate extends KshApiRequest<CreativeCreateRequest, KshResponse<CreativeCreateResponseStruct>> { } @ApiRequestMapping(value = "/creative/batch/update", method = RequestConstants.POST, version = "v2") private class CreativeBatchUpdate extends KshApiRequest<CreativeBatchUpdateRequest, KshResponse<CreativeBatchUpdateResponseStruct>> { } @ApiRequestMapping(value = "/creative/update", method = RequestConstants.POST, version = "v2") private class CreativeUpdate extends KshApiRequest<CreativeUpdateRequest, KshResponse<CreativeUpdateResponseStruct>> { } @ApiRequestMapping(value = "/creative/update/status", method = RequestConstants.POST) private class CreativeUpdateStatus extends KshApiRequest<CreativeUpdateStatusRequest, KshResponse<CreativeUpdateStatusResponseStruct>> { } @ApiRequestMapping(value = "/creative/create/preview", method = RequestConstants.POST) public class CreativeCreatePreview extends KshApiRequest<CreativeCreatePreviewRequest, KshResponse> { } @ApiRequestMapping(value = "/creative/create/creative_tag/advise", method = RequestConstants.POST) public class CreativeCreateCreativeTagAdvise extends KshApiRequest<CreativeCreateCreativeTagAdviseRequest, KshResponse<CreativeCreateCreativeTagAdviseResponseStruct>> { } }
3e019e3cc2464c8b77908d74b66e0bede7b72675
6,386
java
Java
hazelcast/src/main/java/com/hazelcast/internal/locksupport/LockStore.java
ldziedziul-gh-tests/hazelcast
3a7382ac8164bc17836fc9b1f852b2667e7bef96
[ "ECL-2.0", "Apache-2.0" ]
4,283
2015-01-02T03:56:10.000Z
2022-03-29T23:07:45.000Z
hazelcast/src/main/java/com/hazelcast/internal/locksupport/LockStore.java
ldziedziul-gh-tests/hazelcast
3a7382ac8164bc17836fc9b1f852b2667e7bef96
[ "ECL-2.0", "Apache-2.0" ]
14,014
2015-01-01T04:29:38.000Z
2022-03-31T21:47:55.000Z
hazelcast/src/main/java/com/hazelcast/internal/locksupport/LockStore.java
ldziedziul-gh-tests/hazelcast
3a7382ac8164bc17836fc9b1f852b2667e7bef96
[ "ECL-2.0", "Apache-2.0" ]
1,608
2015-01-04T09:57:08.000Z
2022-03-31T12:05:26.000Z
36.491429
128
0.665362
682
/* * Copyright (c) 2008-2021, Hazelcast, Inc. 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. * 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.hazelcast.internal.locksupport; import com.hazelcast.internal.serialization.Data; import com.hazelcast.spi.properties.ClusterProperty; import java.util.Set; import java.util.UUID; /** * A container for multiple locks. Each lock is differentiated by a different {@code key}. */ public interface LockStore { /** * Lock a specific key. * * @param key the key to lock * @param caller the identifier for the caller * @param threadId the identifier for the thread on the caller * @param referenceId the identifier for the invocation of the caller (e.g. operation call ID) * @param leaseTime the lease duration in milliseconds * @return if the lock was successfully acquired */ boolean lock(Data key, UUID caller, long threadId, long referenceId, long leaseTime); /** * Lock a specific key on a local partition only. Does not observe LOCK_MAX_LEASE_TIME_SECONDS * * @param key the key to lock * @param caller the identifier for the caller * @param threadId the identifier for the thread on the caller * @param referenceId the identifier for the invocation of the caller (e.g. operation call ID) * @param leaseTime the lease duration in milliseconds * @return if the lock was successfully acquired * @see ClusterProperty#LOCK_MAX_LEASE_TIME_SECONDS */ boolean localLock(Data key, UUID caller, long threadId, long referenceId, long leaseTime); /** * Lock a specific key for use inside a transaction. * * @param key the key to lock * @param caller the identifier for the caller * @param threadId the identifier for the thread on the caller * @param referenceId the identifier for the invocation of the caller (e.g. operation call ID) * @param leaseTime the lease duration in milliseconds * @param blockReads whether reads for the key should be blocked (e.g. for map and multimap) * @return if the lock was successfully acquired */ boolean txnLock(Data key, UUID caller, long threadId, long referenceId, long leaseTime, boolean blockReads); /** * Extend the lease time for an already locked key. * * @param key the locked key * @param caller the identifier for the caller * @param threadId the identifier for the thread on the caller * @param leaseTime time in milliseconds for the lease to be extended * @return if the lease was extended */ boolean extendLeaseTime(Data key, UUID caller, long threadId, long leaseTime); /** * Unlock a specific key. * * @param key the locked key * @param caller the identifier for the caller * @param threadId the identifier for the thread on the caller * @param referenceId the identifier for the invocation of the caller (e.g. operation call ID) * @return if the key was unlocked */ boolean unlock(Data key, UUID caller, long threadId, long referenceId); /** * Check if a key is locked by any caller and thread ID. * * @param key the key * @return if the key is locked */ boolean isLocked(Data key); /** * Check if a key is locked by a specific caller and thread ID. * * @param key the locked key * @param caller the identifier for the caller * @param threadId the identifier for the thread on the caller * @return if the key is locked */ boolean isLockedBy(Data key, UUID caller, long threadId); /** * Return the number of times a key was locked by the same owner (re-entered). * * @param key the key * @return the reentry count */ int getLockCount(Data key); /** * Return the number of locks this store holds. * * @return the lock count */ int getLockedEntryCount(); /** * Return the remaining lease time for a specific key. * * @param key the key * @return the lease time in milliseconds, -1 if there is no lock, {@value Long#MAX_VALUE} if the key is locked indefinitely */ long getRemainingLeaseTime(Data key); /** * Return if the key can be locked by the caller and thread ID. * * @param key the locked key * @param caller the identifier for the caller * @param threadId the identifier for the thread on the caller * @return if the key can be locked. Returns false if the key is already locked by a different caller or thread ID */ boolean canAcquireLock(Data key, UUID caller, long threadId); /** * Return whether the reads for the specific key should be blocked * (see {@link #txnLock(Data, UUID, long, long, long, boolean)}). * * @param key the lock key * @return if the reads should be blocked */ boolean shouldBlockReads(Data key); /** * Return all locked keys for this store. A lock may be expired when this method returns. * * @return all locked keys */ Set<Data> getLockedKeys(); /** * Unlock the key regardless of the owner. May return {@code true} if the key is already unlocked but has * waiters/signals/expired operations. * * @param dataKey the lock key * @return {@code false} if there is no lock for the given {@code key} and {@code true} otherwise */ boolean forceUnlock(Data dataKey); /** * Return a string representation of the owner of the lock for a specific key. If the key is not locked returns * a default string depicting no owner. * * @param dataKey the key * @return a string description/representation of the owner */ String getOwnerInfo(Data dataKey); }
3e019e3ce95eb5fb490316f354cadcd6d37ef738
1,984
java
Java
gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/EmptyTraversalSideEffects.java
davidcrouch/tinkerpop3
4a2f05516f9fdfb3fa7d9079f0cc79e365a8282b
[ "Apache-2.0" ]
null
null
null
gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/EmptyTraversalSideEffects.java
davidcrouch/tinkerpop3
4a2f05516f9fdfb3fa7d9079f0cc79e365a8282b
[ "Apache-2.0" ]
null
null
null
gremlin-core/src/main/java/com/tinkerpop/gremlin/process/util/EmptyTraversalSideEffects.java
davidcrouch/tinkerpop3
4a2f05516f9fdfb3fa7d9079f0cc79e365a8282b
[ "Apache-2.0" ]
null
null
null
22.804598
109
0.701109
683
package com.tinkerpop.gremlin.process.util; import com.tinkerpop.gremlin.process.TraversalSideEffects; import com.tinkerpop.gremlin.structure.Vertex; import java.util.Collections; import java.util.Optional; import java.util.Set; import java.util.function.Supplier; import java.util.function.UnaryOperator; /** * @author Marko A. Rodriguez (http://markorodriguez.com) */ public final class EmptyTraversalSideEffects implements TraversalSideEffects { private static final EmptyTraversalSideEffects INSTANCE = new EmptyTraversalSideEffects(); private EmptyTraversalSideEffects() { } @Override public void set(final String key, final Object value) { } @Override public <V> V get(final String key) throws IllegalArgumentException { throw TraversalSideEffects.Exceptions.sideEffectDoesNotExist(key); } @Override public void remove(final String key) { } @Override public Set<String> keys() { return Collections.emptySet(); } @Override public void registerSupplier(final String key, final Supplier supplier) { } @Override public <V> Optional<Supplier<V>> getRegisteredSupplier(final String key) { return Optional.empty(); } @Override public <S> void setSack(final Supplier<S> initialValue, final Optional<UnaryOperator<S>> splitOperator) { } @Override public <S> Optional<Supplier<S>> getSackInitialValue() { return Optional.empty(); } @Override public <S> Optional<UnaryOperator<S>> getSackSplitOperator() { return Optional.empty(); } @Override public void setLocalVertex(final Vertex vertex) { } @Override public TraversalSideEffects clone() throws CloneNotSupportedException { return this; } @Override public void mergeInto(final TraversalSideEffects sideEffects) { } public static EmptyTraversalSideEffects instance() { return INSTANCE; } }
3e019e7a6ff7bc95b820dc652df0569d73fd7c3d
668
java
Java
minimarket/src/main/java/com/minimarket/service/MissionService.java
Derrickers/mini-market
a489ca37bc663bb733e0fbeb5fdfce3742a6c315
[ "MIT" ]
5
2019-03-04T11:54:52.000Z
2022-02-21T03:27:20.000Z
minimarket/src/main/java/com/minimarket/service/MissionService.java
Derrickers/mini-market
a489ca37bc663bb733e0fbeb5fdfce3742a6c315
[ "MIT" ]
3
2020-05-15T21:49:24.000Z
2021-12-09T21:37:30.000Z
minimarket/src/main/java/com/minimarket/service/MissionService.java
Derrickers/mini-market
a489ca37bc663bb733e0fbeb5fdfce3742a6c315
[ "MIT" ]
4
2019-03-04T11:54:55.000Z
2019-11-05T09:59:08.000Z
21.548387
55
0.775449
684
package com.minimarket.service; import com.minimarket.model.Mission; import com.minimarket.model.ReturnMsg; import com.minimarket.model.User; import com.minimarket.model.userMission; /** * @author ronjod * @create 2019-09-27 15:07 */ public interface MissionService { ReturnMsg selectReceiver(userMission userMission); ReturnMsg selectMissionListAll(); ReturnMsg selectMissionListUpload(Mission mission); ReturnMsg selectMissionListGet(User user); ReturnMsg selectMissionInfo(Mission mission); ReturnMsg insertMission(Mission mission); ReturnMsg deleteMission(Mission mission); ReturnMsg updateMission(Mission mission); }
3e019f5f82bee233a5b435e2c0d7c8c4bf14b4d9
162
java
Java
app/src/main/java/git/lirui/practice/factory/defaultfactroy/ExportFile.java
xx394984678/git-first-practice
a3e42e0f6102b912723b5ae6286c0ed7b84d4528
[ "Apache-2.0" ]
null
null
null
app/src/main/java/git/lirui/practice/factory/defaultfactroy/ExportFile.java
xx394984678/git-first-practice
a3e42e0f6102b912723b5ae6286c0ed7b84d4528
[ "Apache-2.0" ]
null
null
null
app/src/main/java/git/lirui/practice/factory/defaultfactroy/ExportFile.java
xx394984678/git-first-practice
a3e42e0f6102b912723b5ae6286c0ed7b84d4528
[ "Apache-2.0" ]
null
null
null
14.727273
50
0.716049
685
package git.lirui.practice.factory.defaultfactroy; /** * Created by lirui on 2018/3/9. */ public interface ExportFile { String export(String content); }
3e019fe24f8939f1df0bb1049ddfe2236afbbe79
3,975
java
Java
src/FourSum.java
flacosun/LeetCode
102c34bd97a241e2b9c3461d6641595ec862a5e0
[ "MIT" ]
null
null
null
src/FourSum.java
flacosun/LeetCode
102c34bd97a241e2b9c3461d6641595ec862a5e0
[ "MIT" ]
null
null
null
src/FourSum.java
flacosun/LeetCode
102c34bd97a241e2b9c3461d6641595ec862a5e0
[ "MIT" ]
null
null
null
33.661017
119
0.425982
686
import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * 4Sum * https://leetcode.com/problems/4sum/ * Created by Xiangqing Sun <[email protected]> on 4/15/2016. */ public class FourSum { public class Solution { public List<List<Integer>> fourSum(int[] nums, int target) { ArrayList<List<Integer>> res = new ArrayList<List<Integer>>(); int len = nums.length; if (len < 4) return res; Arrays.sort(nums); int max = nums[len - 1]; if (4 * nums[0] > target || 4 * max < target) return res; for (int i = 0; i < len; i++) { int z = nums[i]; if (i > 0 && z == nums[i - 1])// avoid duplicate continue; if (z + 3 * max < target) // z is too small continue; if (4 * z > target) // z is too large break; if (4 * z == target) { // z is the boundary if (i + 3 < len && nums[i + 3] == z) res.add(Arrays.asList(z, z, z, z)); break; } threeSumForFourSum(nums, target - z, i + 1, len - 1, res, z); } return res; } /* * Find all possible distinguished three numbers adding up to the target * in sorted array nums[] between indices low and high. If there are, * add all of them into the ArrayList fourSumList, using * fourSumList.add(Arrays.asList(z1, the three numbers)) */ public void threeSumForFourSum(int[] nums, int target, int low, int high, ArrayList<List<Integer>> fourSumList, int z1) { if (low + 1 >= high) return; int max = nums[high]; if (3 * nums[low] > target || 3 * max < target) return; for (int i = low; i < high - 1; i++) { int z = nums[i]; if (i > low && z == nums[i - 1]) // avoid duplicate continue; if (z + 2 * max < target) // z is too small continue; if (3 * z > target) // z is too large break; if (3 * z == target) { // z is the boundary if (i + 1 < high && nums[i + 2] == z) fourSumList.add(Arrays.asList(z1, z, z, z)); break; } twoSumForFourSum(nums, target - z, i + 1, high, fourSumList, z1, z); } } /* * Find all possible distinguished two numbers adding up to the target * in sorted array nums[] between indices low and high. If there are, * add all of them into the ArrayList fourSumList, using * fourSumList.add(Arrays.asList(z1, z2, the two numbers)) */ public void twoSumForFourSum(int[] nums, int target, int low, int high, ArrayList<List<Integer>> fourSumList, int z1, int z2) { if (low >= high) return; if (2 * nums[low] > target || 2 * nums[high] < target) return; int i = low, j = high, sum, x; while (i < j) { sum = nums[i] + nums[j]; if (sum == target) { fourSumList.add(Arrays.asList(z1, z2, nums[i], nums[j])); x = nums[i]; while (++i < j && x == nums[i]) // avoid duplicate ; x = nums[j]; while (i < --j && x == nums[j]) // avoid duplicate ; } if (sum < target) i++; if (sum > target) j--; } } } }
3e01a093f1ef03cd9b54566ee681bf245495923d
3,178
java
Java
JavaPOO-CursoEmVideo/src/main/java/b07b08/Fighter.java
eduardojnr/JavaPOO-CursoEmVideo
e3f0ab7a8dc4ec9c857a263a891400753b0cd2c6
[ "MIT" ]
null
null
null
JavaPOO-CursoEmVideo/src/main/java/b07b08/Fighter.java
eduardojnr/JavaPOO-CursoEmVideo
e3f0ab7a8dc4ec9c857a263a891400753b0cd2c6
[ "MIT" ]
null
null
null
JavaPOO-CursoEmVideo/src/main/java/b07b08/Fighter.java
eduardojnr/JavaPOO-CursoEmVideo
e3f0ab7a8dc4ec9c857a263a891400753b0cd2c6
[ "MIT" ]
null
null
null
23.716418
127
0.562618
687
package b07b08; public class Fighter { private String name; private String nationality; private int age; private int height; private float weight; private String category; private int victories; private int defeats; private int draws; public void introduce(){ System.out.println("Fighter: " + this.getName()); System.out.println("Nationality: " + this.getNationality()); System.out.println("Age: " + this.getAge()); System.out.println("Height: " + this.getHeight()); System.out.println("Weight: " + this.getWeight()); System.out.println("Category: " + this.getCategory()); System.out.println("============="); } public void status(){ System.out.println("Wins: " + this.getVictories()); System.out.println("Draws: " + this.getDraws()); System.out.println("Defeats: " + this.getDefeats()); System.out.println("============="); } public void winFight(){ this.setVictories(this.getVictories() + 1); } public void loseFight(){ this.setDefeats(this.getDefeats() + 1); } public void drawFight(){ this.setDraws(this.getDraws() + 1); } // Constructor public Fighter(String name, String nationality, int age, int height, float weight, int victories, int defeats, int draws) { this.name = name; this.nationality = nationality; this.age = age; this.height = height; this.setWeight(weight); this.victories = victories; this.defeats = defeats; this.draws = draws; } // Getters and Setters public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNationality() { return nationality; } public void setNationality(String nationality) { this.nationality = nationality; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public float getWeight() { return weight; } public void setWeight(float weight) { this.weight = weight; this.setCategory(); } public String getCategory() { return category; } public void setCategory() { if (this.weight < 50){ this.category = "Feather"; } else if (this.weight >= 50 & this.weight < 70){ this.category = "Normal"; } else { this.category = "Monster"; } } public int getVictories() { return victories; } public void setVictories(int victories) { this.victories = victories; } public int getDefeats() { return defeats; } public void setDefeats(int defeats) { this.defeats = defeats; } public int getDraws() { return draws; } public void setDraws(int draws) { this.draws = draws; } }
3e01a1156ce8c7c6e2ce909c17c08b9a1f962afa
22,321
java
Java
kie-remote/kie-remote-services/src/main/java/org/kie/remote/services/rest/RuntimeResourceImpl.java
cristianonicolai/droolsjbpm-integration
d8163f1f3737c8fb46da2e1a95b7e7da12e1da4e
[ "Apache-2.0" ]
null
null
null
kie-remote/kie-remote-services/src/main/java/org/kie/remote/services/rest/RuntimeResourceImpl.java
cristianonicolai/droolsjbpm-integration
d8163f1f3737c8fb46da2e1a95b7e7da12e1da4e
[ "Apache-2.0" ]
null
null
null
kie-remote/kie-remote-services/src/main/java/org/kie/remote/services/rest/RuntimeResourceImpl.java
cristianonicolai/droolsjbpm-integration
d8163f1f3737c8fb46da2e1a95b7e7da12e1da4e
[ "Apache-2.0" ]
null
null
null
45.739754
149
0.680391
688
/* * Copyright 2015 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kie.remote.services.rest; import static org.kie.internal.remote.PermissionConstants.REST_PROCESS_ROLE; import static org.kie.internal.remote.PermissionConstants.REST_PROCESS_RO_ROLE; import static org.kie.internal.remote.PermissionConstants.REST_ROLE; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import javax.annotation.security.RolesAllowed; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.namespace.QName; import org.drools.core.command.runtime.process.AbortProcessInstanceCommand; import org.drools.core.command.runtime.process.AbortWorkItemCommand; import org.drools.core.command.runtime.process.CompleteWorkItemCommand; import org.drools.core.command.runtime.process.GetProcessIdsCommand; import org.drools.core.command.runtime.process.GetProcessInstanceCommand; import org.drools.core.command.runtime.process.GetWorkItemCommand; import org.drools.core.command.runtime.process.SignalEventCommand; import org.drools.core.command.runtime.process.StartCorrelatedProcessCommand; import org.drools.core.command.runtime.process.StartProcessCommand; import org.drools.core.process.instance.WorkItem; import org.drools.core.util.StringUtils; import org.jbpm.process.audit.VariableInstanceLog; import org.jbpm.process.audit.command.FindVariableInstancesCommand; import org.jbpm.services.api.DefinitionService; import org.jbpm.services.api.DeploymentNotFoundException; import org.jbpm.services.api.ProcessInstanceNotFoundException; import org.jbpm.services.api.RuntimeDataService; import org.jbpm.services.api.model.ProcessDefinition; import org.kie.api.command.Command; import org.kie.api.runtime.process.ProcessInstance; import org.kie.internal.KieInternalServices; import org.kie.internal.process.CorrelationKey; import org.kie.remote.common.rest.RestEasy960Util; import org.kie.remote.services.rest.exception.KieRemoteRestOperationException; import org.kie.remote.services.util.FormURLGenerator; import org.kie.services.client.serialization.jaxb.impl.JaxbRequestStatus; import org.kie.services.client.serialization.jaxb.impl.process.JaxbProcessDefinition; import org.kie.services.client.serialization.jaxb.impl.process.JaxbProcessInstanceFormResponse; import org.kie.services.client.serialization.jaxb.impl.process.JaxbProcessInstanceResponse; import org.kie.services.client.serialization.jaxb.impl.process.JaxbProcessInstanceWithVariablesResponse; import org.kie.services.client.serialization.jaxb.impl.process.JaxbWorkItemResponse; import org.kie.services.client.serialization.jaxb.rest.JaxbGenericResponse; /** * This resource is responsible for providin operations to manage process instances. */ @Path("/runtime/{deploymentId: [\\w\\.-]+(:[\\w\\.-]+){2,2}(:[\\w\\.-]*){0,2}}") @RequestScoped public class RuntimeResourceImpl extends ResourceBase { /* REST information */ @Context protected HttpHeaders headers; @PathParam("deploymentId") protected String deploymentId; /* KIE information and processing */ @Inject private RuntimeDataService runtimeDataService; @Inject private DefinitionService bpmn2DataService; @Inject private FormURLGenerator formURLGenerator; // Rest methods -------------------------------------------------------------------------------------------------------------- @GET @Path("/process/{processDefId: [a-zA-Z0-9-:\\._]+}/") @RolesAllowed({REST_ROLE, REST_PROCESS_RO_ROLE, REST_PROCESS_ROLE}) public Response getProcessDefinitionInfo(@PathParam("processDefId") String processId) { ProcessDefinition processAssetDescList = runtimeDataService.getProcessesByDeploymentIdProcessId(deploymentId, processId); JaxbProcessDefinition jaxbProcDef = convertProcAssetDescToJaxbProcDef(processAssetDescList); Map<String, String> variables = bpmn2DataService.getProcessVariables(deploymentId, processId); jaxbProcDef.setVariables(variables); return createCorrectVariant(jaxbProcDef, headers); } @POST @Path("/process/{processDefId: [a-zA-Z0-9-:\\._]+}/start") @RolesAllowed({REST_ROLE, REST_PROCESS_ROLE}) public Response startProcessInstance(@PathParam("processDefId") String processId) { Map<String, String[]> requestParams = getRequestParams(); String oper = getRelativePath(); Map<String, Object> params = extractMapFromParams(requestParams, oper); List<String> correlationKeyProps = getCorrelationKeyProperties(requestParams); ProcessInstance result = startProcessInstance(processId, params, correlationKeyProps); JaxbProcessInstanceResponse responseObj = new JaxbProcessInstanceResponse(result, getRequestUri()); return createCorrectVariant(responseObj, headers); } @GET @Path("/process/{processDefId: [a-zA-Z0-9-:\\._]+}/startform") @RolesAllowed({REST_ROLE, REST_PROCESS_RO_ROLE, REST_PROCESS_ROLE}) public Response getProcessInstanceStartForm(@PathParam("processDefId") String processId) { Map<String, String[]> requestParams = getRequestParams(); List<String> correlationKeyProps = getCorrelationKeyProperties(requestParams); List<String> result = processRequestBean.doKieSessionOperation( new GetProcessIdsCommand(), deploymentId, correlationKeyProps, null); if (result != null && result.contains(processId)) { String opener = ""; List<String> openers = headers.getRequestHeader("host"); if (openers.size() == 1) { opener = openers.get(0); } String formUrl = formURLGenerator.generateFormProcessURL(getBaseUri(), processId, deploymentId, opener); if (!StringUtils.isEmpty(formUrl)) { JaxbProcessInstanceFormResponse response = new JaxbProcessInstanceFormResponse(formUrl, getRequestUri()); return createCorrectVariant(response, headers); } } throw KieRemoteRestOperationException.notFound("Process " + processId + " is not available."); } @GET @Path("/process/instance/{procInstId: [0-9]+}") @RolesAllowed({REST_ROLE, REST_PROCESS_RO_ROLE, REST_PROCESS_ROLE}) public Response getProcessInstance(@PathParam("procInstId") Long procInstId) { ProcessInstance procInst = getProcessInstance(procInstId, true); JaxbProcessInstanceResponse response = new JaxbProcessInstanceResponse(procInst); if( procInst == null ) { response.setStatus(JaxbRequestStatus.NOT_FOUND); } return createCorrectVariant(response, headers); } @POST @Path("/process/instance/{procInstId: [0-9]+}/abort") @RolesAllowed({REST_ROLE, REST_PROCESS_ROLE}) public Response abortProcessInstance(@PathParam("procInstId") Long procInstId) { Map<String, String[]> requestParams = getRequestParams(); List<String> correlationKeyProps = getCorrelationKeyProperties(requestParams); Command<?> cmd = new AbortProcessInstanceCommand(); ((AbortProcessInstanceCommand) cmd).setProcessInstanceId(procInstId); try { processRequestBean.doKieSessionOperation( cmd, deploymentId, correlationKeyProps, procInstId); } catch( IllegalArgumentException iae ) { if( iae.getMessage().startsWith("Could not find process instance") ) { throw KieRemoteRestOperationException.notFound("Process instance " + procInstId + " is not available."); } throw KieRemoteRestOperationException.internalServerError("Unable to abort process instance '" + procInstId + "'", iae ); } return createCorrectVariant(new JaxbGenericResponse(getRequestUri()), headers); } @POST @Path("/process/instance/{procInstId: [0-9]+}/signal") @RolesAllowed({REST_ROLE, REST_PROCESS_ROLE}) public Response signalProcessInstance(@PathParam("procInstId") Long procInstId) { String oper = getRelativePath(); Map<String, String[]> requestParams = getRequestParams(); String eventType = getStringParam("signal", true, requestParams, oper); Object event = getObjectParam("event", false, requestParams, oper); List<String> correlationKeyProps = getCorrelationKeyProperties(requestParams); Command<?> cmd = new SignalEventCommand(procInstId, eventType, event); processRequestBean.doKieSessionOperation(cmd, deploymentId, correlationKeyProps, procInstId); return createCorrectVariant(new JaxbGenericResponse(getRequestUri()), headers); } private static final boolean wrapJsonValues = Boolean.getBoolean("org.kie.remote.wrap.json"); @GET @Path("/process/instance/{procInstId: [0-9]+}/variable/{varName: [\\w\\.-]+}") @RolesAllowed({REST_ROLE, REST_PROCESS_RO_ROLE, REST_PROCESS_ROLE}) public Response getProcessInstanceVariableByProcInstIdByVarName(@PathParam("procInstId") Long procInstId, @PathParam("varName") String varName) { Object procVar; try { procVar = processRequestBean.getVariableObjectInstanceFromRuntime(deploymentId, procInstId, varName); } catch( ProcessInstanceNotFoundException pinfe ) { throw KieRemoteRestOperationException.notFound(pinfe.getMessage(), pinfe); } catch( DeploymentNotFoundException dnfe ) { throw new DeploymentNotFoundException(dnfe.getMessage()); } // only wrap if json property set or JAXB/XML if( wrapJsonValues || RestEasy960Util.getVariant(headers).getMediaType().equals(MediaType.APPLICATION_XML_TYPE) ) { procVar = wrapObjectIfNeeded(procVar); } // return return createCorrectVariant(procVar, headers); } @POST @Path("/signal") @RolesAllowed({REST_ROLE, REST_PROCESS_ROLE}) public Response signalProcessInstances() { String oper = getRelativePath(); Map<String, String[]> requestParams = getRequestParams(); String eventType = getStringParam("signal", true, requestParams, oper); Object event = getObjectParam("event", false, requestParams, oper); List<String> correlationKeyProps = getCorrelationKeyProperties(requestParams); processRequestBean.doKieSessionOperation( new SignalEventCommand(eventType, event), deploymentId, correlationKeyProps, (Long) getNumberParam(PROC_INST_ID_PARAM_NAME, false, requestParams, oper, true)); return createCorrectVariant(new JaxbGenericResponse(getRequestUri()), headers); } @GET @Path("/workitem/{workItemId: [0-9-]+}") @RolesAllowed({REST_ROLE, REST_PROCESS_RO_ROLE, REST_PROCESS_ROLE}) public Response getWorkItem(@PathParam("workItemId") Long workItemId) { String oper = getRelativePath(); Map<String, String[]> requestParams = getRequestParams(); List<String> correlationKeyProps = getCorrelationKeyProperties(requestParams); WorkItem workItem = processRequestBean.doKieSessionOperation( new GetWorkItemCommand(workItemId), deploymentId, correlationKeyProps, (Long) getNumberParam(PROC_INST_ID_PARAM_NAME, false, getRequestParams(), oper, true)); if( workItem == null ) { throw KieRemoteRestOperationException.notFound("WorkItem " + workItemId + " does not exist."); } return createCorrectVariant(new JaxbWorkItemResponse(workItem), headers); } @POST @Path("/workitem/{workItemId: [0-9-]+}/{oper: [a-zA-Z]+}") @RolesAllowed({REST_ROLE, REST_PROCESS_ROLE}) public Response doWorkItemOperation(@PathParam("workItemId") Long workItemId, @PathParam("oper") String operation) { String oper = getRelativePath(); Map<String, String[]> requestParams = getRequestParams(); List<String> correlationKeyProps = getCorrelationKeyProperties(requestParams); Command<?> cmd = null; if ("complete".equalsIgnoreCase((operation.trim()))) { Map<String, Object> results = extractMapFromParams(requestParams, operation); cmd = new CompleteWorkItemCommand(workItemId, results); } else if ("abort".equalsIgnoreCase(operation.toLowerCase())) { cmd = new AbortWorkItemCommand(workItemId); } else { throw KieRemoteRestOperationException.badRequest("Unsupported operation: " + oper); } // Will NOT throw an exception if the work item does not exist!! processRequestBean.doKieSessionOperation( cmd, deploymentId, correlationKeyProps, (Long) getNumberParam(PROC_INST_ID_PARAM_NAME, false, requestParams, oper, true)); return createCorrectVariant(new JaxbGenericResponse(getRequestUri()), headers); } /** * WithVars methods */ @POST @Path("/withvars/process/{processDefId: [a-zA-Z0-9-:\\._]+}/start") @RolesAllowed({REST_ROLE, REST_PROCESS_ROLE}) public Response withVarsStartProcessInstance(@PathParam("processDefId") String processId) { Map<String, String[]> requestParams = getRequestParams(); String oper = getRelativePath(); Map<String, Object> params = extractMapFromParams(requestParams, oper ); List<String> corrKeyProps = getCorrelationKeyProperties(requestParams); ProcessInstance procInst = startProcessInstance(processId, params, corrKeyProps); Map<String, String> vars = getVariables(procInst.getId(), corrKeyProps); JaxbProcessInstanceWithVariablesResponse resp = new JaxbProcessInstanceWithVariablesResponse(procInst, vars, getRequestUri()); return createCorrectVariant(resp, headers); } @GET @Path("/withvars/process/instance/{procInstId: [0-9]+}") @RolesAllowed({REST_ROLE, REST_PROCESS_RO_ROLE, REST_PROCESS_ROLE}) public Response withVarsGetProcessInstance(@PathParam("procInstId") Long procInstId) { Map<String, String[]> requestParams = getRequestParams(); List<String> corrKeyProps = getCorrelationKeyProperties(requestParams); ProcessInstance procInst = getProcessInstance(procInstId, true); Map<String, String> vars = getVariables(procInstId, corrKeyProps); JaxbProcessInstanceWithVariablesResponse responseObj = new JaxbProcessInstanceWithVariablesResponse(procInst, vars, getRequestUri()); return createCorrectVariant(responseObj, headers); } @POST @Path("/withvars/process/instance/{procInstId: [0-9]+}/signal") @RolesAllowed({REST_ROLE, REST_PROCESS_ROLE}) public Response withVarsSignalProcessInstance(@PathParam("procInstId") Long procInstId) { String oper = getRelativePath(); Map<String, String[]> requestParams = getRequestParams(); String eventType = getStringParam("signal", true, requestParams, oper); Object event = getObjectParam("event", false, requestParams, oper); List<String> correlationKeyProps = getCorrelationKeyProperties(requestParams); processRequestBean.doKieSessionOperation( new SignalEventCommand(procInstId, eventType, event), deploymentId, correlationKeyProps, procInstId); ProcessInstance processInstance = getProcessInstance(procInstId, false); Map<String, String> vars = getVariables(procInstId, correlationKeyProps); return createCorrectVariant(new JaxbProcessInstanceWithVariablesResponse(processInstance, vars), headers); } // Helper methods -------------------------------------------------------------------------------------------------------------- private ProcessInstance getProcessInstance(long procInstId, boolean throwEx ) { Map<String, String[]> params = getRequestParams(); List<String> correlationKeyProps = getCorrelationKeyProperties(params); Command<?> cmd = new GetProcessInstanceCommand(procInstId); ((GetProcessInstanceCommand) cmd).setReadOnly(true); Object procInstResult = processRequestBean.doKieSessionOperation( cmd, deploymentId, correlationKeyProps, procInstId); if (procInstResult != null) { return (ProcessInstance) procInstResult; } else if( throwEx ) { throw KieRemoteRestOperationException.notFound("Unable to retrieve process instance " + procInstId + " which may have been completed. Please see the history operations."); } else { return null; } } private Map<String, String> getVariables(long processInstanceId, List<String> corrKeyProps) { List<VariableInstanceLog> varInstLogList = processRequestBean.doKieSessionOperation( new FindVariableInstancesCommand(processInstanceId), deploymentId, corrKeyProps, processInstanceId); Map<String, String> vars = new HashMap<String, String>(); if( varInstLogList.isEmpty() ) { return vars; } Map<String, VariableInstanceLog> varLogMap = new HashMap<String, VariableInstanceLog>(); for( VariableInstanceLog varLog: varInstLogList ) { String varId = varLog.getVariableId(); VariableInstanceLog prevVarLog = varLogMap.put(varId, varLog); if( prevVarLog != null ) { if( prevVarLog.getDate().after(varLog.getDate()) ) { varLogMap.put(varId, prevVarLog); } } } for( Entry<String, VariableInstanceLog> varEntry : varLogMap.entrySet() ) { vars.put(varEntry.getKey(), varEntry.getValue().getValue()); } return vars; } private ProcessInstance startProcessInstance(String processId, Map<String, Object> params, List<String> corrKeyProps) { ProcessInstance result = null; Command<ProcessInstance> cmd = null; if( corrKeyProps != null && ! corrKeyProps.isEmpty() ) { CorrelationKey key = KieInternalServices.Factory.get().newCorrelationKeyFactory().newCorrelationKey(corrKeyProps); cmd = new StartCorrelatedProcessCommand(processId, key); } else { cmd = new StartProcessCommand(processId, params); } try { result = processRequestBean.doKieSessionOperation( cmd, deploymentId, corrKeyProps, null); } catch( IllegalArgumentException iae ) { if( iae.getMessage().startsWith("Unknown process ID")) { throw KieRemoteRestOperationException.notFound("Process '" + processId + "' is not known to this deployment."); } throw KieRemoteRestOperationException.internalServerError("Unable to start process instance '" + processId + "'", iae); } return result; } protected QName getRootElementName(Object object) { boolean xmlRootElemAnnoFound = false; Class<?> objClass = object.getClass(); // This usually doesn't work in the kie-wb/bpms environment, see comment below XmlRootElement xmlRootElemAnno = objClass.getAnnotation(XmlRootElement.class); logger.debug("Getting XML root element annotation for " + object.getClass().getName()); if( xmlRootElemAnno != null ) { xmlRootElemAnnoFound = true; return new QName(xmlRootElemAnno.name()); } else { /** * There seem to be weird classpath issues going on here, probably related * to the fact that kjar's have their own classloader.. * (The XmlRootElement class can't be found in the same classpath as the * class from the Kjar) */ for( Annotation anno : objClass.getAnnotations() ) { Class<?> annoClass = anno.annotationType(); // we deliberately compare *names* and not classes because it's on a different classpath! if( XmlRootElement.class.getName().equals(annoClass.getName()) ) { xmlRootElemAnnoFound = true; try { Method nameMethod = annoClass.getMethod("name"); Object nameVal = nameMethod.invoke(anno); if( nameVal instanceof String ) { return new QName((String) nameVal); } } catch (Exception e) { throw KieRemoteRestOperationException.internalServerError("Unable to retrieve XmlRootElement info via reflection", e); } } } if( ! xmlRootElemAnnoFound ) { String errorMsg = "Unable to serialize " + object.getClass().getName() + " instance " + "because it is missing a " + XmlRootElement.class.getName() + " annotation with a name value."; throw KieRemoteRestOperationException.internalServerError(errorMsg); } return null; } } }
3e01a1e50b634065ac5f9cd58ef5f79063e1d282
853
java
Java
java/java-tests/testSrc/com/intellij/java/codeInspection/apiUse/Java16With17APIUsageInspectionTest.java
06needhamt/intellij-community
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
[ "Apache-2.0" ]
null
null
null
java/java-tests/testSrc/com/intellij/java/codeInspection/apiUse/Java16With17APIUsageInspectionTest.java
06needhamt/intellij-community
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
[ "Apache-2.0" ]
null
null
null
java/java-tests/testSrc/com/intellij/java/codeInspection/apiUse/Java16With17APIUsageInspectionTest.java
06needhamt/intellij-community
63d7b8030e4fdefeb4760e511e289f7e6b3a5c5b
[ "Apache-2.0" ]
null
null
null
27.516129
158
0.76905
689
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.codeInspection.apiUse; import com.intellij.JavaTestUtil; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.pom.java.LanguageLevel; import org.jetbrains.annotations.NotNull; public final class Java16With17APIUsageInspectionTest extends BaseApiUsageTestCase { public void testLanguageLevel16() { doTest(); } @Override protected String getTestDataPath() { return JavaTestUtil.getJavaTestDataPath() + "/inspection/api_usage/use17api_on_16"; } @Override protected @NotNull Sdk getSdk() { return JAVA_17.getSdk(); } @Override protected @NotNull LanguageLevel getLanguageLevel() { return LanguageLevel.JDK_16; } }
3e01a22ce3adbf00b199830659888e305b7c45f9
1,159
java
Java
src/main/java/com/senac/musicstore/model/ItemPedido.java
magnumveras/piecommerce
1e81817d56a9183ee01514ca27c0e6da7ea8e7c4
[ "MIT" ]
null
null
null
src/main/java/com/senac/musicstore/model/ItemPedido.java
magnumveras/piecommerce
1e81817d56a9183ee01514ca27c0e6da7ea8e7c4
[ "MIT" ]
null
null
null
src/main/java/com/senac/musicstore/model/ItemPedido.java
magnumveras/piecommerce
1e81817d56a9183ee01514ca27c0e6da7ea8e7c4
[ "MIT" ]
null
null
null
19.316667
54
0.59189
690
package com.senac.musicstore.model; /** * * @author geoinformacao */ public class ItemPedido { private int codigo; private int codigopedido; private int codigoproduto; private int quantidade; public ItemPedido() { super(); } public int getCodigo() { return codigo; } public void setCodigo(int codigo) { this.codigo = codigo; } public int getCodigoProduto() { return codigoproduto; } public void setCodigoProduto(int codigoproduto) { this.codigoproduto = codigoproduto; } public int getQuantidade() { return quantidade; } public void setQuantidade(int quantidade) { this.quantidade = quantidade; } public int getCodigopedido() { return codigopedido; } public void setCodigopedido(int codigopedido) { this.codigopedido = codigopedido; } public int getCodigoproduto() { return codigoproduto; } public void setCodigoproduto(int codigoproduto) { this.codigoproduto = codigoproduto; } }
3e01a3cf9ef9d620252e76283805c3dffb85dc83
1,045
java
Java
VolleyDemo/app/src/main/java/com/example/innf/volleydemo/util/JSONParser.java
InnoFang/Android-Code
de4f56df690259d097910c5266cdd055af6b8a92
[ "Apache-2.0" ]
46
2017-03-05T05:29:26.000Z
2021-11-02T07:49:13.000Z
VolleyDemo/app/src/main/java/com/example/innf/volleydemo/util/JSONParser.java
InnoFang/Android-Code
de4f56df690259d097910c5266cdd055af6b8a92
[ "Apache-2.0" ]
null
null
null
VolleyDemo/app/src/main/java/com/example/innf/volleydemo/util/JSONParser.java
InnoFang/Android-Code
de4f56df690259d097910c5266cdd055af6b8a92
[ "Apache-2.0" ]
21
2017-05-17T20:40:10.000Z
2022-03-24T12:26:50.000Z
30.735294
68
0.704306
691
package com.example.innf.volleydemo.util; import android.util.Log; import com.example.innf.volleydemo.bean.PhoneNumberInfo; import com.example.innf.volleydemo.bean.Response; import com.google.gson.Gson; /** * Author: Inno Fang * Time: 2016/12/24 10:04 * Description: */ public class JSONParser { private static final String TAG = "JSONParser"; public static PhoneNumberInfo parseJSON(String jsonData){ Gson gson = new Gson(); Response response = gson.fromJson(jsonData, Response.class); Log.i(TAG, response.toString()); PhoneNumberInfo phoneNumberInfo = new PhoneNumberInfo(); Response.Result result = response.getResult(); phoneNumberInfo.setProvince(result.getProvince()); phoneNumberInfo.setCity(result.getCity()); phoneNumberInfo.setAreacode(result.getAreacode()); phoneNumberInfo.setZip(result.getZip()); phoneNumberInfo.setCompany(result.getCompany()); Log.i(TAG, phoneNumberInfo.toString()); return phoneNumberInfo; } }
3e01a402d966f4020d2373789f5d46f27c1cf188
469
java
Java
src/main/java/com/github/games647/scoreboardstats/pvpstats/StatsSaver.java
ktaraso/Score
9fce9687cd28999a6f66d28e3319e32ec107b125
[ "MIT" ]
null
null
null
src/main/java/com/github/games647/scoreboardstats/pvpstats/StatsSaver.java
ktaraso/Score
9fce9687cd28999a6f66d28e3319e32ec107b125
[ "MIT" ]
null
null
null
src/main/java/com/github/games647/scoreboardstats/pvpstats/StatsSaver.java
ktaraso/Score
9fce9687cd28999a6f66d28e3319e32ec107b125
[ "MIT" ]
null
null
null
22.333333
67
0.697228
692
package com.github.games647.scoreboardstats.pvpstats; /** * Saves the player stats to the database system. */ public class StatsSaver implements Runnable { private final PlayerStats stats; private final Database statsDatabase; public StatsSaver(PlayerStats toSave, Database statsDatabase) { this.stats = toSave; this.statsDatabase = statsDatabase; } @Override public void run() { statsDatabase.save(stats); } }
3e01a41b432231185567d323df2adbcfc6bab353
1,390
java
Java
uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldShortcutTest.java
jforge/vaadin
66df157ecfe9cea75c3c01e43ca6f37ed6ef0671
[ "Apache-2.0" ]
null
null
null
uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldShortcutTest.java
jforge/vaadin
66df157ecfe9cea75c3c01e43ca6f37ed6ef0671
[ "Apache-2.0" ]
null
null
null
uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldShortcutTest.java
jforge/vaadin
66df157ecfe9cea75c3c01e43ca6f37ed6ef0671
[ "Apache-2.0" ]
null
null
null
34.75
78
0.723741
693
package com.vaadin.tests.components.datefield; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.testbench.elements.NotificationElement; import com.vaadin.tests.tb3.SingleBrowserTest; import static org.junit.Assert.assertEquals; public class DateFieldShortcutTest extends SingleBrowserTest { private static final String DATEFIELD_VALUE_ORIGINAL = "11/01/2018"; private static final String DATEFIELD_VALUE_MODIFIED = "21/01/2018"; @Test public void modifyValueAndPressEnter() { openTestURL(); DateFieldElement dateField = $(DateFieldElement.class).first(); WebElement dateFieldText = dateField.findElement(By.tagName("input")); assertEquals("DateField value should be \"" + DATEFIELD_VALUE_ORIGINAL + "\"", DATEFIELD_VALUE_ORIGINAL, dateField.getValue()); dateFieldText.click(); dateFieldText.sendKeys(Keys.HOME, Keys.DELETE, "2"); dateFieldText.sendKeys(Keys.ENTER); assertEquals("DateField value should be \"" + DATEFIELD_VALUE_MODIFIED + "\"", DATEFIELD_VALUE_MODIFIED, dateField.getValue()); assertEquals(DATEFIELD_VALUE_MODIFIED, $(NotificationElement.class).first().getCaption()); } }
3e01a4abc265f0eb96109b7dae6a6ebe3cf2b0ce
973
java
Java
assessment-system/src/main/java/com/assessment/system/mapper/SysUserOnlineMapper.java
Zednight-622/Assessment-information-management-system
7abc61e0967ae5a22d3f6411eca8d2072ea0ad58
[ "MIT" ]
null
null
null
assessment-system/src/main/java/com/assessment/system/mapper/SysUserOnlineMapper.java
Zednight-622/Assessment-information-management-system
7abc61e0967ae5a22d3f6411eca8d2072ea0ad58
[ "MIT" ]
null
null
null
assessment-system/src/main/java/com/assessment/system/mapper/SysUserOnlineMapper.java
Zednight-622/Assessment-information-management-system
7abc61e0967ae5a22d3f6411eca8d2072ea0ad58
[ "MIT" ]
null
null
null
18.358491
78
0.609455
694
package com.assessment.system.mapper; import java.util.List; import com.assessment.system.domain.SysUserOnline; /** * 在线用户 数据层 * * @author jiangyi xu */ public interface SysUserOnlineMapper { /** * 通过会话序号查询信息 * * @param sessionId 会话ID * @return 在线用户信息 */ public SysUserOnline selectOnlineById(String sessionId); /** * 通过会话序号删除信息 * * @param sessionId 会话ID * @return 在线用户信息 */ public int deleteOnlineById(String sessionId); /** * 保存会话信息 * * @param online 会话信息 * @return 结果 */ public int saveOnline(SysUserOnline online); /** * 查询会话集合 * * @param userOnline 会话参数 * @return 会话集合 */ public List<SysUserOnline> selectUserOnlineList(SysUserOnline userOnline); /** * 查询过期会话集合 * * @param lastAccessTime 过期时间 * @return 会话集合 */ public List<SysUserOnline> selectOnlineByExpired(String lastAccessTime); }
3e01a5b920ee29ba60e575016d776143ccc3436d
1,002
java
Java
src/main/java/org/minimallycorrect/modpatcher/api/tweaker/ModPatcherTweaker.java
LXGaming/ModPatcher
288d4b08d976e803b7ebfc5765592e13cfa4538c
[ "MIT" ]
4
2015-03-26T22:45:47.000Z
2017-05-09T07:33:47.000Z
src/main/java/org/minimallycorrect/modpatcher/api/tweaker/ModPatcherTweaker.java
LXGaming/ModPatcher
288d4b08d976e803b7ebfc5765592e13cfa4538c
[ "MIT" ]
8
2017-07-24T02:09:13.000Z
2020-03-28T21:15:41.000Z
src/main/java/org/minimallycorrect/modpatcher/api/tweaker/ModPatcherTweaker.java
MinimallyCorrect/ModPatcher
3a538a5b574546f68d927f3551bf9e61fda4a334
[ "MIT" ]
3
2020-02-16T14:55:25.000Z
2020-10-25T23:56:55.000Z
27.081081
96
0.788423
695
package org.minimallycorrect.modpatcher.api.tweaker; import net.minecraft.launchwrapper.ITweaker; import net.minecraft.launchwrapper.Launch; import net.minecraft.launchwrapper.LaunchClassLoader; import org.minimallycorrect.modpatcher.api.LaunchClassLoaderUtil; import java.io.*; import java.util.*; public class ModPatcherTweaker implements ITweaker { @SuppressWarnings("unchecked") public static void add() { ((List<String>) Launch.blackboard.get("TweakClasses")).add(ModPatcherTweaker.class.getName()); } @Override public void acceptOptions(List<String> list, File file, File file1, String s) { LaunchClassLoaderUtil.removeRedundantExclusions(); ModPatcherTweaker2.add(); } @Override public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) { } @Override public String getLaunchTarget() { throw new UnsupportedOperationException("ModPatcherTweaker is not a primary tweaker."); } @Override public String[] getLaunchArguments() { return new String[0]; } }
3e01a5c1dfc63cc513e42c4771890e633de6c9a8
330
java
Java
src/main/java/ca/airspeed/tsheets/client/TsheetsClient.java
bschalme/tsheets-proxy
1b94d2867feaf1952f7d335766224af2b2ed04d2
[ "Apache-2.0" ]
null
null
null
src/main/java/ca/airspeed/tsheets/client/TsheetsClient.java
bschalme/tsheets-proxy
1b94d2867feaf1952f7d335766224af2b2ed04d2
[ "Apache-2.0" ]
null
null
null
src/main/java/ca/airspeed/tsheets/client/TsheetsClient.java
bschalme/tsheets-proxy
1b94d2867feaf1952f7d335766224af2b2ed04d2
[ "Apache-2.0" ]
null
null
null
27.5
65
0.818182
696
package ca.airspeed.tsheets.client; import ca.airspeed.tsheets.TsheetsConfiguration; import io.micronaut.http.annotation.Header; import io.micronaut.http.client.annotation.Client; @Client(TsheetsConfiguration.TSHEETS_API_URL) @Header(name="Authorization", value="Bearer ${tsheet.api-token}") public interface TsheetsClient { }
3e01a6670b3845733f97ff9292f675385d562a29
222
java
Java
design-pattern-practice/src/main/java/com/trvajjala/observer/ObserverTwo.java
tvajjala/interview-preparation
8002b9bcfa6c3e09f31da52b5fe755796b52b0a0
[ "Apache-2.0" ]
2
2016-03-31T13:14:55.000Z
2017-04-04T04:23:15.000Z
design-pattern-practice/src/main/java/com/trvajjala/observer/ObserverTwo.java
tvajjala/interview-preparation
8002b9bcfa6c3e09f31da52b5fe755796b52b0a0
[ "Apache-2.0" ]
4
2020-03-04T22:01:22.000Z
2021-12-09T20:30:36.000Z
design-pattern-practice/src/main/java/com/trvajjala/observer/ObserverTwo.java
tvajjala/java-applications
8002b9bcfa6c3e09f31da52b5fe755796b52b0a0
[ "Apache-2.0" ]
null
null
null
22.2
74
0.707207
697
package com.trvajjala.observer; public class ObserverTwo implements Observer { @Override public void updateColor(String color) { System.out.println("ObserverTwo notified about color : " + color); } }
3e01a6b5be973a98ced52a17d8904240608bfe84
4,896
java
Java
src/main/java/com/tencentcloudapi/ecm/v20190719/models/ZoneInstanceCountISP.java
victoryckl/tencentcloud-sdk-java
73a6e6632e0273cfdebd5487cc7ecff920c5e89c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/tencentcloudapi/ecm/v20190719/models/ZoneInstanceCountISP.java
victoryckl/tencentcloud-sdk-java
73a6e6632e0273cfdebd5487cc7ecff920c5e89c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/tencentcloudapi/ecm/v20190719/models/ZoneInstanceCountISP.java
victoryckl/tencentcloud-sdk-java
73a6e6632e0273cfdebd5487cc7ecff920c5e89c
[ "Apache-2.0" ]
1
2021-03-23T03:19:20.000Z
2021-03-23T03:19:20.000Z
27.661017
118
0.670547
698
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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. * 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.tencentcloudapi.ecm.v20190719.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class ZoneInstanceCountISP extends AbstractModel{ /** * 创建实例的可用区。 */ @SerializedName("Zone") @Expose private String Zone; /** * 在当前可用区欲创建的实例数目。 */ @SerializedName("InstanceCount") @Expose private Long InstanceCount; /** * 运营商,CTCC电信,CUCC联通,CMCC移动,多个运营商用英文分号连接";"。多运营商需要开通白名单,请直接联系腾讯云客服。 */ @SerializedName("ISP") @Expose private String ISP; /** * 指定私有网络编号,SubnetId与VpcId必须同时指定或不指定 */ @SerializedName("VpcId") @Expose private String VpcId; /** * 指定子网编号,SubnetId与VpcId必须同时指定或不指定 */ @SerializedName("SubnetId") @Expose private String SubnetId; /** * 指定主网卡内网IP。条件:SubnetId与VpcId必须同时指定,并且IP数量与InstanceCount相同,多IP主机副网卡内网IP在相同子网内通过DHCP获取。 */ @SerializedName("PrivateIpAddresses") @Expose private String [] PrivateIpAddresses; /** * Get 创建实例的可用区。 * @return Zone 创建实例的可用区。 */ public String getZone() { return this.Zone; } /** * Set 创建实例的可用区。 * @param Zone 创建实例的可用区。 */ public void setZone(String Zone) { this.Zone = Zone; } /** * Get 在当前可用区欲创建的实例数目。 * @return InstanceCount 在当前可用区欲创建的实例数目。 */ public Long getInstanceCount() { return this.InstanceCount; } /** * Set 在当前可用区欲创建的实例数目。 * @param InstanceCount 在当前可用区欲创建的实例数目。 */ public void setInstanceCount(Long InstanceCount) { this.InstanceCount = InstanceCount; } /** * Get 运营商,CTCC电信,CUCC联通,CMCC移动,多个运营商用英文分号连接";"。多运营商需要开通白名单,请直接联系腾讯云客服。 * @return ISP 运营商,CTCC电信,CUCC联通,CMCC移动,多个运营商用英文分号连接";"。多运营商需要开通白名单,请直接联系腾讯云客服。 */ public String getISP() { return this.ISP; } /** * Set 运营商,CTCC电信,CUCC联通,CMCC移动,多个运营商用英文分号连接";"。多运营商需要开通白名单,请直接联系腾讯云客服。 * @param ISP 运营商,CTCC电信,CUCC联通,CMCC移动,多个运营商用英文分号连接";"。多运营商需要开通白名单,请直接联系腾讯云客服。 */ public void setISP(String ISP) { this.ISP = ISP; } /** * Get 指定私有网络编号,SubnetId与VpcId必须同时指定或不指定 * @return VpcId 指定私有网络编号,SubnetId与VpcId必须同时指定或不指定 */ public String getVpcId() { return this.VpcId; } /** * Set 指定私有网络编号,SubnetId与VpcId必须同时指定或不指定 * @param VpcId 指定私有网络编号,SubnetId与VpcId必须同时指定或不指定 */ public void setVpcId(String VpcId) { this.VpcId = VpcId; } /** * Get 指定子网编号,SubnetId与VpcId必须同时指定或不指定 * @return SubnetId 指定子网编号,SubnetId与VpcId必须同时指定或不指定 */ public String getSubnetId() { return this.SubnetId; } /** * Set 指定子网编号,SubnetId与VpcId必须同时指定或不指定 * @param SubnetId 指定子网编号,SubnetId与VpcId必须同时指定或不指定 */ public void setSubnetId(String SubnetId) { this.SubnetId = SubnetId; } /** * Get 指定主网卡内网IP。条件:SubnetId与VpcId必须同时指定,并且IP数量与InstanceCount相同,多IP主机副网卡内网IP在相同子网内通过DHCP获取。 * @return PrivateIpAddresses 指定主网卡内网IP。条件:SubnetId与VpcId必须同时指定,并且IP数量与InstanceCount相同,多IP主机副网卡内网IP在相同子网内通过DHCP获取。 */ public String [] getPrivateIpAddresses() { return this.PrivateIpAddresses; } /** * Set 指定主网卡内网IP。条件:SubnetId与VpcId必须同时指定,并且IP数量与InstanceCount相同,多IP主机副网卡内网IP在相同子网内通过DHCP获取。 * @param PrivateIpAddresses 指定主网卡内网IP。条件:SubnetId与VpcId必须同时指定,并且IP数量与InstanceCount相同,多IP主机副网卡内网IP在相同子网内通过DHCP获取。 */ public void setPrivateIpAddresses(String [] PrivateIpAddresses) { this.PrivateIpAddresses = PrivateIpAddresses; } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "Zone", this.Zone); this.setParamSimple(map, prefix + "InstanceCount", this.InstanceCount); this.setParamSimple(map, prefix + "ISP", this.ISP); this.setParamSimple(map, prefix + "VpcId", this.VpcId); this.setParamSimple(map, prefix + "SubnetId", this.SubnetId); this.setParamArraySimple(map, prefix + "PrivateIpAddresses.", this.PrivateIpAddresses); } }
3e01a6ba4729f554feaf470075c73029575a519e
749
java
Java
src/Cas4/OOP.04.klase/src/z_dodatno02SingleLinkedList/Node.java
MilovanTomasevic/OOP-JAVA
07d3ced582e098cd9b2e08ebb7007dee56095931
[ "MIT" ]
null
null
null
src/Cas4/OOP.04.klase/src/z_dodatno02SingleLinkedList/Node.java
MilovanTomasevic/OOP-JAVA
07d3ced582e098cd9b2e08ebb7007dee56095931
[ "MIT" ]
null
null
null
src/Cas4/OOP.04.klase/src/z_dodatno02SingleLinkedList/Node.java
MilovanTomasevic/OOP-JAVA
07d3ced582e098cd9b2e08ebb7007dee56095931
[ "MIT" ]
null
null
null
17.022727
63
0.656876
699
package z_dodatno02SingleLinkedList; /* Klasa opisuje element (cvor) povezane liste */ public class Node { // sadrzaj elementa (npr. celobrojna vrednost) private int data; // referenca na sledeci element private Node next; // konstruktor public Node(int n) { data = n; next = null; } // get*() public int getData() { return data; } // hasNext() - da li postoji sledeci element? public boolean hasNext() { if (next == null) return false; else return true; } // getNext() - daj mi sledeci element (tj. referencu na njega) public Node getNext() { return next; } // set*() public void setNext(Node n) { next = n; } // stringovna reprezentacija elementa public String toString() { return "" + data; } }
3e01a70dcb10452cfd3171e712b8668f1f23e7e3
412
java
Java
BioMightWeb/src/biomight/cell/misc/Clasmatocytes.java
SurferJim/BioMight
3dc2c2b21bc6ece2ca9ac44f0727a433ae9f9430
[ "Apache-2.0" ]
2
2020-05-03T07:43:18.000Z
2020-11-28T21:02:26.000Z
BioMightWeb/src/biomight/cell/misc/Clasmatocytes.java
SurferJim/BioMight
3dc2c2b21bc6ece2ca9ac44f0727a433ae9f9430
[ "Apache-2.0" ]
null
null
null
BioMightWeb/src/biomight/cell/misc/Clasmatocytes.java
SurferJim/BioMight
3dc2c2b21bc6ece2ca9ac44f0727a433ae9f9430
[ "Apache-2.0" ]
1
2020-11-07T01:36:49.000Z
2020-11-07T01:36:49.000Z
22.888889
73
0.699029
700
/* * Created on Jul 6, 2006 * * To change the template for this generated file go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ package biomight.cell.misc; /** * @author SurferJim * * To change the template for this generated type comment go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ public class Clasmatocytes { }