blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
005f8d8076a2f18f6f87aad7824937e0819d7683 | bae4750e69f026cedae261df9344739788ff8e2f | /src/main/java/com/singular/core/SingularSpecification.java | 8bb6cb9eaf40d6310791169fb5a06570ee88782d | []
| no_license | brahul/singular_bro | a7143d2099c887e2dda9694d075a1ab323a26bb1 | c4eadfbfd41c0d2394476ddcc199955b0ed84a21 | refs/heads/master | 2023-07-26T23:36:29.343049 | 2021-08-19T17:16:05 | 2021-08-19T17:16:05 | 398,023,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package com.singular.core;
/**
* @author Rahul Bhattacharjee
*/
public class SingularSpecification {
private int no;
public SingularSpecification(int no) {
this.no = no;
}
public int getNumberOfContainers(){
return this.no;
}
}
| [
"[email protected]"
]
| |
1078f888881845bab67d9ef31dd41e177b09ea79 | 1c9a80533fa46de64ebe85f468fa62bfec4706de | /src/org/mt4j/util/camera/IFrustum.java | 4d5d1af3184495e5085ba89334a06f60620e0ad7 | []
| no_license | hector/Cube-Orchestra | 58666f02a52602e59b11d3d424fc09c8d8102210 | 16c98128b9aa9c326e3f87094e0db5e98f8457f8 | refs/heads/master | 2021-01-22T14:28:54.034347 | 2019-01-03T17:45:33 | 2019-01-03T17:53:35 | 3,778,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | /***********************************************************************
* mt4j Copyright (c) 2008 - 2009 C.Ruff, Fraunhofer-Gesellschaft All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
***********************************************************************/
package org.mt4j.util.camera;
import org.mt4j.util.math.Vector3D;
/**
* The Interface IFrustum.
* @author Christopher Ruff
*/
public interface IFrustum {
/** The Constant OUTSIDE. */
public static final int OUTSIDE = 0;
/** The Constant INTERSECT. */
public static final int INTERSECT = 1;
/** The Constant INSIDE. */
public static final int INSIDE = 2;
/**
* Checks if sphere is in frustum.
*
* @param p the p
* @param radius the radius
*
* @return the int
*/
public int isSphereInFrustum(Vector3D p, float radius);
/**
* Checks if point is in frustum.
*
* @param p the p
*
* @return the int
*/
public int isPointInFrustum(Vector3D p) ;
}
| [
"[email protected]"
]
| |
7c0caf1b7ad7e474354010863530d966a787c998 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XCOMMONS-928-1-14-FEMO-WeightedSum:TestLen:CallDiversity/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository_ESTest_scaffolding.java | 750e9d083da0e1a0e65076763a1fc1a8206ee83e | []
| no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Apr 03 16:01:31 UTC 2020
*/
package org.xwiki.extension.repository.internal.installed;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class DefaultInstalledExtensionRepository_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
]
| |
42857ac8b5caf9ddaaa32ca386ef015a772ac8ff | 7281de6aaf2c91b50a23ddf9b453bfe3324e7f7a | /spring-cloud-config-server/src/main/java/com/microservice/training/springcloudconfigserver/SpringCloudConfigServerApplication.java | b07be24834ce7baf90f476523f3e17615d98f7bc | []
| no_license | piyush-panda/spring-cloud | 858ec59637b906f78fbd80b9f84a74916e93c696 | a296645c443ee654cdd3981e326561c0031089eb | refs/heads/master | 2020-04-20T06:28:41.862384 | 2019-02-01T11:04:00 | 2019-02-01T11:04:00 | 168,685,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | package com.microservice.training.springcloudconfigserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
@SpringBootApplication
@EnableConfigServer
public class SpringCloudConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCloudConfigServerApplication.class, args);
int arr = [];
Set<Integer> numbers = new TreeSet<Integer>(Arrays.asList(arr));
int min = 1;
for(int num : numbers) {
if(min < num){
return min;
}
min++;
}
}
}
| [
"[email protected]"
]
| |
7456940b9c5e10be320971b6259662c1d3e2a97f | 1ec9f181cdd2e6612320e2a0bf6479ff015f420d | /src/main/java/br/com/compasso/api/response/PautaFoundResponse.java | 07911ecb4acbec5423b04483f19f061804e8ee33 | []
| no_license | samuelkrieger/Api-Rest-Sicredi-Test | ac5cc908f6e01087ed3c98ee59186a7472850507 | 0168ff8b75fd5c6610de9504543af5ee31381bf1 | refs/heads/main | 2023-06-20T06:35:06.806561 | 2021-07-21T16:56:20 | 2021-07-21T16:56:20 | 384,186,494 | 0 | 0 | null | 2021-07-08T16:58:03 | 2021-07-08T16:29:59 | Java | UTF-8 | Java | false | false | 320 | java | package br.com.compasso.api.response;
import org.springframework.http.HttpStatus;
import br.com.compasso.api.persistence.entity.PautaEntity;
public class PautaFoundResponse extends Response<PautaEntity>{
public PautaFoundResponse( PautaEntity result) {
super("pauta-encontrada", "", HttpStatus.OK, result);
}
}
| [
"[email protected]"
]
| |
75d6de485d906f279eb4c038ee08b6d705c4947f | d3a440dd33a574c1585942836261e49975f84444 | /app/src/main/java/com/example/zjeff/whatsfordinner/LandscapeFragment.java | a360ddee50ba7434ee7c153c2a1bc56c5ea2885f | []
| no_license | SJSU-Spring2018-CS175/whats-for-dinner-zjeffreyl | 4bb0ff6439c433e7bb139dc4b1effa60df528186 | 8587247f8e0bc26165afb17cc03f886000c07361 | refs/heads/master | 2021-09-09T16:07:46.698754 | 2018-03-17T18:49:41 | 2018-03-17T18:49:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,784 | java | package com.example.zjeff.whatsfordinner;
import android.content.Intent;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
*/
public class LandscapeFragment extends Fragment {
ArrayList<RecipeData> savedRecipes;
ArrayList<String> savedRecipesName;
ArrayList<Ingredient> ingredients;
public LandscapeFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Intent intent = getActivity().getIntent();
Bundle bundle = intent.getExtras();
savedRecipesName = new ArrayList<String>();
savedRecipes = (ArrayList<RecipeData>)bundle.getSerializable("savedRecipes");
for(int i = 0; i < savedRecipes.size(); i++){
savedRecipesName.add(savedRecipes.get(i).getName());
}
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_landscape, container, false);
ListView listView = (ListView) view.findViewById(R.id.recipeListLandscape);
ArrayAdapter<String> listViewAdapter = new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,
savedRecipesName
);
listView.setAdapter(listViewAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
TextView ingText = (TextView)getView().findViewById(R.id.LandscapeIngredientList);
TextView descText = (TextView)getView().findViewById(R.id.LandscapeDescription);
TextView nameText = (TextView)getView().findViewById(R.id.LandscapeName);
String ingredDisplay = "";
ingText.setText("");
descText.setText("");
nameText.setText("");
//get the arraylist of a the ingredients
ingredients = savedRecipes.get(i).getIngredients();
//loop through all the ingredients
for(int j = 0 ; j < ingredients.size(); j++){
String ingredTest = ingredients.get(j).getRecipeStringDisplay();
if(ingredients.get(j).getAmount() == 0){
break;
}
ingredDisplay = ingredDisplay + ingredients.get(j).getRecipeStringDisplay() + System.getProperty("line.separator");
}
ingText.setText(ingredDisplay);
descText.setText(savedRecipes.get(i).getDescription());
nameText.setText(savedRecipes.get(i).getName());
}
});
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intentLongClick = new Intent(getActivity(), EditRecipe.class);
Bundle b = new Bundle();
b.putInt("clickedRecipePosition", i);
b.putSerializable("savedRecipes", savedRecipes);
intentLongClick.putExtras(b);
startActivity(intentLongClick);
return false;
}
});
return view;
}
}
| [
"[email protected]"
]
| |
8769eb831e55071274d6ea43944e260a1cfd7ee7 | 8484909fc68e75118d44f42fb8d0ce4172b4a3be | /src/main/java/com/genZmartInternalProject/repository/NetSalesRepository.java | 736c44a326c68d645beb70d40e5a30fcfab7138b | []
| no_license | Suryateja0355/GenZmartInternlProject | 7eb5e0bcc14f313a3d60611cf4aa73e0cc21ca8e | ebeaefd4e45399905d88cad3d0b4af4e9fd2e951 | refs/heads/master | 2022-04-18T06:58:11.983294 | 2020-04-16T09:05:47 | 2020-04-16T09:05:47 | 256,162,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package com.genZmartInternalProject.repository;
import java.util.List;
import org.json.simple.JSONObject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.genZmartInternalProject.modelClasses.OrderModelClass;
@Repository
public interface NetSalesRepository extends JpaRepository<OrderModelClass, Long>{
@Query(value="select item_class.item_name, sum(orders.price-(orders.price*orders.discount_price/100)) as netsales \r\n" +
"from orders inner join item_class on orders.item_id=item_class.item_id\r\n" +
"group by item_class.item_id;",nativeQuery=true)
public List<JSONObject> itemsNetSales();
}
| [
"[email protected]"
]
| |
4160fefd4c0ad7c810bc34284870ba9bb69079ce | 11c1108e755e3c4b81f78d7347d4b50894cb6a8e | /dhis2/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java | 45ae4031faee4cd5c4d51097e5b3db7efb348864 | [
"BSD-3-Clause"
]
| permissive | harsh-a1/trunk | 671f8a90ee444db6b0524086854f61801922258f | ea40ad7d60aa01711528190dd4dcef0686778323 | refs/heads/master | 2021-01-09T21:43:03.334838 | 2016-02-24T09:19:06 | 2016-02-24T09:19:06 | 52,080,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,659 | java | package org.hisp.dhis.fileresource;
/*
* Copyright (c) 2004-2016, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import com.google.common.hash.HashCode;
import com.google.common.io.ByteSource;
import org.apache.commons.io.input.NullInputStream;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.external.conf.ConfigurationKey;
import org.hisp.dhis.external.conf.DhisConfigurationProvider;
import org.hisp.dhis.external.location.LocationManager;
import org.jclouds.ContextBuilder;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.LocalBlobRequestSigner;
import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.internal.RequestSigningUnsupported;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location;
import org.jclouds.filesystem.reference.FilesystemConstants;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponseException;
import org.joda.time.Minutes;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.attribute.UserPrincipalNotFoundException;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Properties;
import java.util.regex.Pattern;
/**
* @author Halvdan Hoem Grelland
*/
public class JCloudsFileResourceContentStore
implements FileResourceContentStore
{
private static final Log log = LogFactory.getLog( JCloudsFileResourceContentStore.class );
private static final Pattern CONTAINER_NAME_PATTERN = Pattern.compile( "^((?!-)[a-zA-Z0-9-]{1,63}(?<!-))+$" );
private static final long FIVE_MINUTES_IN_SECONDS = Minutes.minutes( 5 ).toStandardDuration().getStandardSeconds();
private BlobStore blobStore;
private BlobStoreContext blobStoreContext;
private String container;
// -------------------------------------------------------------------------
// Providers
// -------------------------------------------------------------------------
private static final String JCLOUDS_PROVIDER_KEY_FILESYSTEM = "filesystem";
private static final String JCLOUDS_PROVIDER_KEY_AWS_S3 = "aws-s3";
private static final String JCLOUDS_PROVIDER_KEY_TRANSIENT = "transient";
private static final List<String> SUPPORTED_PROVIDERS = Arrays.asList( JCLOUDS_PROVIDER_KEY_FILESYSTEM, JCLOUDS_PROVIDER_KEY_AWS_S3 );
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
private LocationManager locationManager;
public void setLocationManager( LocationManager locationManager )
{
this.locationManager = locationManager;
}
private DhisConfigurationProvider configurationProvider;
public void setConfigurationProvider( DhisConfigurationProvider configurationProvider )
{
this.configurationProvider = configurationProvider;
}
// -------------------------------------------------------------------------
// Life cycle management
// -------------------------------------------------------------------------
public void init()
{
String provider = configurationProvider.getProperty( ConfigurationKey.FILESTORE_PROVIDER );
String location = configurationProvider.getProperty( ConfigurationKey.FILE_STORE_LOCATION );
String identity = configurationProvider.getProperty( ConfigurationKey.FILE_STORE_IDENTITY );
String secret = configurationProvider.getProperty( ConfigurationKey.FILE_STORE_SECRET );
provider = validateAndSelectProvider( provider );
container = configurationProvider.getProperty( ConfigurationKey.FILE_STORE_CONTAINER );
if ( !isValidContainerName( container ) )
{
if ( container != null )
{
log.warn( "Container name '" + container + "' is illegal." +
"Standard domain name naming conventions apply (and underscores are not allowed). " +
"Using default container name '" + ConfigurationKey.FILE_STORE_CONTAINER.getDefaultValue() + "'." );
}
container = ConfigurationKey.FILE_STORE_CONTAINER.getDefaultValue();
}
Properties overrides = new Properties();
Credentials credentials = new Credentials( "Unused", "Unused" );
// ---------------------------------------------------------------------
// Provider specific configuration
// ---------------------------------------------------------------------
if ( provider.equals( JCLOUDS_PROVIDER_KEY_FILESYSTEM ) && locationManager.externalDirectorySet() )
{
overrides.setProperty( FilesystemConstants.PROPERTY_BASEDIR, locationManager.getExternalDirectoryPath() );
}
else if ( provider.equals( JCLOUDS_PROVIDER_KEY_AWS_S3 ) )
{
credentials = new Credentials( identity, secret );
if ( credentials.identity.isEmpty() || credentials.credential.isEmpty() )
{
log.warn( "AWS S3 store configured with empty credentials, authentication not possible." );
}
}
// ---------------------------------------------------------------------
// Set up JClouds context
// ---------------------------------------------------------------------
blobStoreContext = ContextBuilder.newBuilder( provider )
.credentials( credentials.identity, credentials.credential )
.overrides( overrides ).build( BlobStoreContext.class );
blobStore = blobStoreContext.getBlobStore();
Optional<? extends Location> configuredLocation = blobStore.listAssignableLocations()
.stream().filter( l -> l.getId().equals( location ) ).findFirst();
try
{
blobStore.createContainerInLocation( configuredLocation.isPresent() ? configuredLocation.get() : null, container );
log.info( "File store configured with provider '" + provider + "' and container '" + container + "'. " +
( configuredLocation.isPresent() ? "Provider location: " + configuredLocation.get().getId() : StringUtils.EMPTY ) );
}
catch ( HttpResponseException ex )
{
log.error( "Could not configure file store with provider '" + provider + "' and container '" + container + "'. " +
"Check your internet connectivity. File storage will not be available.", ex );
}
}
public void cleanUp()
{
blobStoreContext.close();
}
// -------------------------------------------------------------------------
// FileResourceContentStore implementation
// -------------------------------------------------------------------------
@Override
public ByteSource getFileResourceContent( String key )
{
final Blob blob = getBlob( key );
if ( blob == null )
{
return null;
}
final ByteSource byteSource = new ByteSource()
{
@Override
public InputStream openStream()
{
try
{
return blob.getPayload().openStream();
}
catch ( IOException e )
{
return new NullInputStream( 0 );
}
}
};
boolean isEmptyOrFailed;
try
{
isEmptyOrFailed = byteSource.isEmpty();
}
catch ( IOException e )
{
isEmptyOrFailed = true;
}
return isEmptyOrFailed ? null : byteSource;
}
@Override
public String saveFileResourceContent( FileResource fileResource, File file )
{
Blob blob = createBlob( fileResource, file );
if ( blob == null )
{
return null;
}
putBlob( blob );
try
{
Files.deleteIfExists( file.toPath() );
}
catch ( IOException ioe )
{
// Intentionally ignored
log.warn( "Temporary file '" + file.toPath() + "' could not be deleted.", ioe );
}
return fileResource.getStorageKey();
}
@Override
public void deleteFileResourceContent( String key )
{
deleteBlob( key );
}
@Override
public boolean fileResourceContentExists( String key )
{
return blobExists( key );
}
@Override
public URI getSignedGetContentUri( String key )
{
BlobRequestSigner signer = blobStoreContext.getSigner();
if ( !requestSigningSupported( signer ) )
{
return null;
}
HttpRequest httpRequest;
try
{
httpRequest = signer.signGetBlob( container, key, FIVE_MINUTES_IN_SECONDS );
}
catch ( UnsupportedOperationException uoe )
{
return null;
}
return httpRequest.getEndpoint();
}
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
private Blob getBlob( String key )
{
return blobStore.getBlob( container, key );
}
private boolean blobExists( String key )
{
return key != null && blobStore.blobExists( container, key );
}
private void deleteBlob( String key )
{
blobStore.removeBlob( container, key );
}
private String putBlob( Blob blob )
{
String etag = null;
try
{
etag = blobStore.putBlob( container, blob );
}
catch ( RuntimeException rte )
{
Throwable cause = rte.getCause();
if ( cause != null && cause instanceof UserPrincipalNotFoundException )
{
// Intentionally ignored exception which occurs with JClouds on localized
// Windows systems while trying to resolve the "Everyone" group.
// See https://issues.apache.org/jira/browse/JCLOUDS-1015
log.debug( "Ignored UserPrincipalNotFoundException. Workaround for JClouds bug 'JCLOUDS-1015'." );
}
else
{
throw rte;
}
}
return etag;
}
private Blob createBlob( FileResource fileResource, File file )
{
return blobStore.blobBuilder( fileResource.getStorageKey() )
.payload( file )
.contentLength( fileResource.getContentLength() )
.contentMD5( HashCode.fromString( fileResource.getContentMd5() ) )
.contentType( fileResource.getContentType() )
.contentDisposition( "filename=" + fileResource.getName() )
.build();
}
private String validateAndSelectProvider( String provider )
{
if ( !SUPPORTED_PROVIDERS.contains( provider ) )
{
log.warn( "Ignored unsupported file store provider '" + provider + "', using file system provider." );
provider = JCLOUDS_PROVIDER_KEY_FILESYSTEM;
}
if ( provider.equals( JCLOUDS_PROVIDER_KEY_FILESYSTEM ) && !locationManager.externalDirectorySet() )
{
log.warn( "File system file store provider could not be configured; external directory is not set. " +
"Falling back to in-memory provider." );
provider = JCLOUDS_PROVIDER_KEY_TRANSIENT;
}
return provider;
}
private boolean isValidContainerName( String containerName )
{
return containerName != null && CONTAINER_NAME_PATTERN.matcher( containerName ).matches();
}
private boolean requestSigningSupported( BlobRequestSigner signer )
{
return !( signer instanceof RequestSigningUnsupported ) && !( signer instanceof LocalBlobRequestSigner );
}
}
| [
"[email protected]"
]
| |
af7ae90f44d835d934c5a886728586061e880e8b | cf892cfcfad3d0891310301c994665acb8e49b77 | /app/src/main/java/ilourenco/com/br/formulariofacil/ui/BaseActivity.java | c0f72bd1aa75797d41261fa4aa783c26d6c59a38 | []
| no_license | ItamarLourenco/FormularioFacil | dc862c4599743c1df0d44df88eca477a795eb65d | 4425a0ba1dbd40d95bc904888190e297377ffd86 | refs/heads/master | 2016-09-06T06:59:13.257777 | 2015-02-19T17:41:24 | 2015-02-19T17:41:24 | 29,832,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,055 | java | package ilourenco.com.br.formulariofacil.ui;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBarDrawerToggle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import ilourenco.com.br.formulariofacil.FormularioFacilApp;
import ilourenco.com.br.formulariofacil.R;
import static ilourenco.com.br.formulariofacil.R.array;
import static ilourenco.com.br.formulariofacil.R.id;
/**
* Created by webx on 25/01/15.
*/
public class BaseActivity extends ActionBarActivity {
public static final int NAV_FORMS = 0;
public static final int NAV_CREATE_FORM = 1;
public static final int NAV_SETTING = 2;
public static DrawerLayout mDrawerLayout;
public static ListView mListView;
public String[] mNavigationDrawerAdapter;
public ActionBarDrawerToggle mActionBarDrawerToggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setUpNavigationEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.action_bar_menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mActionBarDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
switch (item.getItemId()) {
case android.R.id.home:
return true;
case R.id.menu_reload:
displayView(NAV_CREATE_FORM);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
protected void setUpNavigationEnabled(boolean upNavEnabled) {
ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(upNavEnabled);
actionBar.setDisplayHomeAsUpEnabled(upNavEnabled);
}
@Override
public void setContentView(int layoutResID) {
super.setContentView(layoutResID);
}
@Override
public void setContentView(View view) {
super.setContentView(view);
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
super.addContentView(view, params);
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
return super.onPrepareOptionsMenu(menu);
}
public void drawableMenu() {
mListView = (ListView) findViewById(id.list_navigation);
mDrawerLayout = (DrawerLayout) findViewById(id.drawer_layout);
mNavigationDrawerAdapter = getResources().getStringArray(array.navigation_drawer_adapter);
mListView.setAdapter(new NavigationDrawerAdapter(FormularioFacilApp.getContext(), mNavigationDrawerAdapter));
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
onItemClickMenu(parent, view, position, id);
}
});
mActionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_launcher, R.drawable.ic_launcher){
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
invalidateOptionsMenu();
}
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
invalidateOptionsMenu();
}
};
mDrawerLayout.setDrawerListener(mActionBarDrawerToggle);
//Start Fragments
displayView(NAV_FORMS);
}
private void onItemClickMenu(AdapterView<?> parent, View view, int position, long id) {
displayView(position);
}
public void displayView(int position) {
Fragment fragment = null;
switch (position){
case NAV_FORMS:
fragment = FormsFragment.newInstance();
break;
case NAV_CREATE_FORM:
fragment = CreateFormFragment.newInstance();
break;
case NAV_SETTING:
fragment = SettingFragment.newInstance();
break;
}
if (fragment != null) {
replaceFragment(getSupportFragmentManager().beginTransaction(), fragment);
mListView.setItemChecked(position, true);
mListView.setSelection(position);
mDrawerLayout.closeDrawer(mListView);
}
}
public static void replaceFragment(FragmentTransaction fragmentTransaction, Fragment fragment){
fragmentTransaction.replace(id.frame_container, fragment);
fragmentTransaction.commit();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mActionBarDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mActionBarDrawerToggle.onConfigurationChanged(newConfig);
}
}
| [
"[email protected]"
]
| |
25a071afc9da121f186d4a519e1d4ab87baf6215 | c9b4e3dd7ef80ac7e1fdf3ccae818ba0d57246eb | /stock-day/src/main/java/com/stock/stockday/service/function/DayScience6008Function.java | 748419955978330286713991cf2fbcba0c1c6cf1 | []
| no_license | wuxingle/stock-day | 104259d3583a5ddbb32d0c79b695999bf1938ab2 | 95ce8201479d3f330fb182ae8b299cabcb171a16 | refs/heads/master | 2022-06-27T21:45:17.085292 | 2020-04-13T07:45:36 | 2020-04-13T07:45:36 | 188,746,226 | 0 | 0 | null | 2022-06-21T01:10:29 | 2019-05-27T00:37:23 | Java | UTF-8 | Java | false | false | 16,929 | java | package com.stock.stockday.service.function;
import com.stock.apicommon.entity.BIASEntity;
import com.stock.apicommon.entity.BOLLEntity;
import com.stock.apicommon.entity.CCIEntity;
import com.stock.apicommon.entity.KDJEntity;
import com.stock.apicommon.entity.MacdEntity;
import com.stock.apicommon.entity.MakeQuantityEntity;
import com.stock.apicommon.entity.PriceEntity;
import com.stock.apicommon.entity.RSIEntity;
import com.stock.apicommon.entity.WREntity;
import com.stock.apicommon.utils.BIASUtil;
import com.stock.apicommon.utils.BOLLUtil;
import com.stock.apicommon.utils.CCIUtil;
import com.stock.apicommon.utils.KDJUtil;
import com.stock.apicommon.utils.MACDUtil;
import com.stock.apicommon.utils.MakeQuantityMAUtil;
import com.stock.apicommon.utils.PriceMAUtil;
import com.stock.apicommon.utils.RSIUtil;
import com.stock.apicommon.utils.WRUtil;
import com.stock.apicommon.vo.BIASVo;
import com.stock.apicommon.vo.BOLLVo;
import com.stock.apicommon.vo.CCIVo;
import com.stock.apicommon.vo.KDJVo;
import com.stock.apicommon.vo.MacdVo;
import com.stock.apicommon.vo.MakeQuantityVo;
import com.stock.apicommon.vo.PriceVo;
import com.stock.apicommon.vo.RSIVo;
import com.stock.apicommon.vo.WRVo;
import com.stock.stockday.entity.StockCode;
import com.stock.stockday.entity.StockDay6008;
import com.stock.stockday.entity.StockDayScience6008;
import com.stock.stockday.service.StockDay6008Service;
import com.stock.stockday.service.StockDayScience6008Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@Service
public class DayScience6008Function {
@Autowired
private StockDayScience6008Service stockDayScience6008Service;
@Autowired
private StockDay6008Service stockDay6008Service;
public boolean dayScience6008Function(StockCode stockCode){
List<StockDay6008> stockDay6008List = stockDay6008Service.selectByCodeAndEx(stockCode.getId(), stockCode.getEx());
List<StockDayScience6008> stockDayScience6008List = new ArrayList<>();
if (stockDay6008List == null || stockDay6008List.size() == 0) {
return false;
}
//排序
Collections.sort(stockDay6008List, new Comparator<StockDay6008>() {
@Override
public int compare(StockDay6008 o1, StockDay6008 o2) {
long i=o1.getDate().getTime() - o2.getDate().getTime();
if (i>0){
return 1;
}else if (i<0){
return -1;
}
return 0;
}
});
List<MacdEntity> macdEntityList = new ArrayList<>();
List<KDJEntity> kdjEntityList = new ArrayList<>();
List<RSIEntity> rsiEntityList = new ArrayList<>();
List<BIASEntity> biasEntityList = new ArrayList<>();
List<CCIEntity> cciEntityList = new ArrayList<>();
List<WREntity> wrEntityList = new ArrayList<>();
List<BOLLEntity> bollEntityList = new ArrayList<>();
List<MakeQuantityEntity> makeQuantityEntityList = new ArrayList<>();
List<PriceEntity> priceEntityList = new ArrayList<>();
MacdEntity macdEntity1 = new MacdEntity();
KDJEntity kdjEntity1 = new KDJEntity();
KDJEntity kdjEntity2 = new KDJEntity();
for (StockDay6008 stockDay6008 : stockDay6008List) {
if (stockDay6008.getOpeningPrice() == null || stockDay6008.getOpeningPrice().compareTo(BigDecimal.ZERO) == 0) {
continue;
}
//macd
MacdEntity macdEntity = new MacdEntity();
StockDayScience6008 stockDayScience6008 = new StockDayScience6008();
stockDayScience6008.setCodeId(stockDay6008.getCodeId());
stockDayScience6008.setCodeEx(stockDay6008.getCodeEx());
stockDayScience6008.setDate(stockDay6008.getDate());
macdEntity.setClosingPrice(stockDay6008.getClosingPrice());
macdEntityList.add(macdEntity);
if (macdEntityList.size() == 26) {
MacdVo macdVo = MACDUtil.getMacd(macdEntityList);
if (macdVo != null) {
stockDayScience6008.setMacd(macdVo.getMACD());
stockDayScience6008.setDiff(macdVo.getDIF());
stockDayScience6008.setDea(macdVo.getDEA());
stockDayScience6008.setEma12(macdVo.getEMA12());
stockDayScience6008.setEma26(macdVo.getEMA26());
macdEntity1.setBeforeDea(macdVo.getDEA());
macdEntity1.setBeforeEma12(macdVo.getEMA12());
macdEntity1.setBeforeEma26(macdVo.getEMA26());
}
}
if (macdEntityList.size() > 26) {
macdEntity.setBeforeEma26(macdEntity1.getBeforeEma26());
macdEntity.setBeforeDea(macdEntity1.getBeforeDea());
macdEntity.setBeforeEma12(macdEntity1.getBeforeEma12());
MacdVo macdVo = MACDUtil.getMacd1(macdEntity);
if (macdVo != null) {
stockDayScience6008.setMacd(macdVo.getMACD());
stockDayScience6008.setDiff(macdVo.getDIF());
stockDayScience6008.setDea(macdVo.getDEA());
stockDayScience6008.setEma12(macdVo.getEMA12());
stockDayScience6008.setEma26(macdVo.getEMA26());
macdEntity1.setBeforeDea(macdVo.getDEA());
macdEntity1.setBeforeEma12(macdVo.getEMA12());
macdEntity1.setBeforeEma26(macdVo.getEMA26());
}
}
//kdj
KDJEntity kdjEntity = new KDJEntity();
kdjEntity.setClosingPrice(stockDay6008.getClosingPrice());
kdjEntity.setFoot(stockDay6008.getFoot());
kdjEntity.setTopside(stockDay6008.getTopside());
kdjEntity.setDate(stockDay6008.getDate());
kdjEntityList.add(kdjEntity);
if (kdjEntityList.size() == 9) {
kdjEntity1 = kdjEntity2;
Collections.sort(kdjEntityList, new Comparator<KDJEntity>() {
@Override
public int compare(KDJEntity o1, KDJEntity o2) {
return o1.getFoot().compareTo(o2.getFoot());
}
});
kdjEntity1.setFoot(kdjEntityList.get(0).getFoot());
Collections.sort(kdjEntityList, new Comparator<KDJEntity>() {
@Override
public int compare(KDJEntity o1, KDJEntity o2) {
return o2.getTopside().compareTo(o1.getTopside());
}
});
kdjEntity1.setTopside(kdjEntityList.get(0).getTopside());
kdjEntity1.setClosingPrice(stockDay6008.getClosingPrice());
KDJVo kdjVo = KDJUtil.getKDJ(kdjEntity1);
stockDayScience6008.setK(kdjVo.getK());
stockDayScience6008.setD(kdjVo.getD());
stockDayScience6008.setJ(kdjVo.getJ());
stockDayScience6008.setRsv(kdjVo.getRSV());
kdjEntity2.setBeforeRSV(kdjVo.getRSV());
kdjEntity2.setBeforeK(kdjVo.getK());
kdjEntity2.setBeforeD(kdjVo.getD());
Collections.sort(kdjEntityList, new Comparator<KDJEntity>() {
@Override
public int compare(KDJEntity o1, KDJEntity o2) {
long i = o1.getDate().getTime() - o2.getDate().getTime();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
}
return 0;
}
});
kdjEntityList.remove(0);
}
//RSI
RSIEntity rsiEntity = new RSIEntity();
if (stockDay6008.getChangePoints() == null) {
rsiEntity.setChangePoints(new BigDecimal(0));
} else {
rsiEntity.setChangePoints(stockDay6008.getChangePoints());
}
rsiEntity.setDate(stockDay6008.getDate());
rsiEntityList.add(rsiEntity);
if (rsiEntityList.size() == 24) {
Collections.sort(rsiEntityList, new Comparator<RSIEntity>() {
@Override
public int compare(RSIEntity o1, RSIEntity o2) {
long i = o2.getDate().getTime() - o1.getDate().getTime();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
}
return 0;
}
});
RSIVo rsiVo = RSIUtil.getRSI(rsiEntityList);
stockDayScience6008.setRsi1(rsiVo.getRSI6());
stockDayScience6008.setRsi2(rsiVo.getRSI12());
stockDayScience6008.setRsi3(rsiVo.getRSI24());
rsiEntityList.remove(kdjEntityList.size() - 1);
}
//BIAS
BIASEntity biasEntity = new BIASEntity();
biasEntity.setClosingPrice(stockDay6008.getClosingPrice());
biasEntity.setDate(stockDay6008.getDate());
biasEntityList.add(biasEntity);
if (biasEntityList.size() == 30) {
Collections.sort(biasEntityList, new Comparator<BIASEntity>() {
@Override
public int compare(BIASEntity o1, BIASEntity o2) {
long i = o2.getDate().getTime() - o1.getDate().getTime();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
}
return 0;
}
});
BIASVo biasVo = BIASUtil.getBIAS(biasEntityList);
stockDayScience6008.setBias1(biasVo.getBIAS5());
stockDayScience6008.setBias2(biasVo.getBIAS10());
stockDayScience6008.setBias3(biasVo.getBIAS30());
biasEntityList.remove(biasEntityList.size() - 1);
}
//CCI
CCIEntity cciEntity = new CCIEntity();
cciEntity.setDate(stockDay6008.getDate());
cciEntity.setClosingPrice(stockDay6008.getClosingPrice());
cciEntity.setFoot(stockDay6008.getFoot());
cciEntity.setTopside(stockDay6008.getTopside());
cciEntityList.add(cciEntity);
if (cciEntityList.size() == 14) {
Collections.sort(cciEntityList, new Comparator<CCIEntity>() {
@Override
public int compare(CCIEntity o1, CCIEntity o2) {
long i = o1.getDate().getTime() - o2.getDate().getTime();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
}
return 0;
}
});
CCIVo cciVo = CCIUtil.getCCI(cciEntityList);
stockDayScience6008.setCci(cciVo.getCCI());
cciEntityList.remove(0);
}
//WR
WREntity wrEntity = new WREntity();
wrEntity.setDate(stockDay6008.getDate());
wrEntity.setClosingPrice(stockDay6008.getClosingPrice());
wrEntity.setFoot(stockDay6008.getFoot());
wrEntity.setTopside(stockDay6008.getTopside());
wrEntityList.add(wrEntity);
if (wrEntityList.size() == 42) {
Collections.sort(wrEntityList, new Comparator<WREntity>() {
@Override
public int compare(WREntity o1, WREntity o2) {
long i = o2.getDate().getTime() - o1.getDate().getTime();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
}
return 0;
}
});
WRVo wrVo = WRUtil.getWR(wrEntityList);
stockDayScience6008.setWr1(wrVo.getWR21());
stockDayScience6008.setWr2(wrVo.getWR42());
wrEntityList.remove(wrEntityList.size() - 1);
}
//BOLL
BOLLEntity bollEntity = new BOLLEntity();
bollEntity.setDate(stockDay6008.getDate());
bollEntity.setClosingPrice(stockDay6008.getClosingPrice());
bollEntityList.add(bollEntity);
if (bollEntityList.size() == 20) {
Collections.sort(bollEntityList, new Comparator<BOLLEntity>() {
@Override
public int compare(BOLLEntity o1, BOLLEntity o2) {
long i = o2.getDate().getTime() - o1.getDate().getTime();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
}
return 0;
}
});
BOLLVo bollVo = BOLLUtil.getBOLL(bollEntityList);
stockDayScience6008.setUpp(bollVo.getUP());
stockDayScience6008.setMid(bollVo.getMB());
stockDayScience6008.setLow(bollVo.getDN());
bollEntityList.remove(bollEntityList.size() - 1);
}
//均量
MakeQuantityEntity makeQuantityEntity = new MakeQuantityEntity();
makeQuantityEntity.setDate(stockDay6008.getDate());
makeQuantityEntity.setMakeQuantity(stockDay6008.getMakeQuantity());
makeQuantityEntityList.add(makeQuantityEntity);
if (makeQuantityEntityList.size() == 30) {
Collections.sort(makeQuantityEntityList, new Comparator<MakeQuantityEntity>() {
@Override
public int compare(MakeQuantityEntity o1, MakeQuantityEntity o2) {
long i = o2.getDate().getTime() - o1.getDate().getTime();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
}
return 0;
}
});
MakeQuantityVo makeQuantityVo = MakeQuantityMAUtil.getMakeQuantity(makeQuantityEntityList);
stockDayScience6008.setMakeQuantityMa5(makeQuantityVo.getMakeQuantity5());
stockDayScience6008.setMakeQuantityMa10(makeQuantityVo.getMakeQuantity10());
stockDayScience6008.setMakeQuantityMa20(makeQuantityVo.getMakeQuantity20());
stockDayScience6008.setMakeQuantityMa30(makeQuantityVo.getMakeQuantity30());
makeQuantityEntityList.remove(makeQuantityEntityList.size() - 1);
}
//均价
PriceEntity priceEntity = new PriceEntity();
priceEntity.setDate(stockDay6008.getDate());
priceEntity.setClosingPrice(stockDay6008.getClosingPrice());
priceEntityList.add(priceEntity);
if (priceEntityList.size() == 60) {
Collections.sort(priceEntityList, new Comparator<PriceEntity>() {
@Override
public int compare(PriceEntity o1, PriceEntity o2) {
long i = o2.getDate().getTime() - o1.getDate().getTime();
if (i > 0) {
return 1;
} else if (i < 0) {
return -1;
}
return 0;
}
});
PriceVo priceVo = PriceMAUtil.getPriceMA(priceEntityList);
stockDayScience6008.setPriceMa5(priceVo.getPriceMa5());
stockDayScience6008.setPriceMa10(priceVo.getPriceMa10());
stockDayScience6008.setPriceMa20(priceVo.getPriceMa20());
stockDayScience6008.setPriceMa30(priceVo.getPriceMa30());
stockDayScience6008.setPriceMa60(priceVo.getPriceMa60());
priceEntityList.remove(priceEntityList.size() - 1);
}
//量
stockDayScience6008.setQuantity(stockDay6008.getMakeQuantity());
stockDayScience6008Service.save(stockDayScience6008);
}
return true;
}
}
| [
"[email protected]"
]
| |
dc98a03cc381a257b9d2ced3206e4533852a2803 | 0013cbdcf5cd99ca0574786561efcebd6f30ec3f | /src/model/Predmet.java | 6b175bf589a8f2bbece785b3c4f7beccc2140170 | []
| no_license | BLigart/vava-webova | c49ab0bbea4bebad2c1ca29aabe88a5d832f7365 | 98eea980e0787cfd1f318c86dd4c89b56836096f | refs/heads/master | 2021-01-19T00:41:12.408433 | 2017-05-07T13:38:27 | 2017-05-07T13:38:27 | 87,199,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package model;
public class Predmet {
private int id;
private String nazov;
private String kod;
public Predmet() {
this.kod = "";
this.nazov = "";
}
public Predmet(int id, String kod, String nazov) {
this.setId(id);
this.setKod(kod);
this.setNazov(nazov);
}
public Predmet(int id, String nazov) {
setId(id);
setNazov(nazov);
}
public Predmet(String kod, String nazov) {
setKod(kod);
setNazov(nazov);
}
public Predmet(String nazov) {
setNazov(nazov);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNazov() {
return nazov;
}
public void setNazov(String nazov) {
this.nazov = nazov;
}
public String getKod() {
return kod;
}
public void setKod(String kod) {
this.kod = kod;
}
public String toString() {
return this.getKod() + " " + this.getNazov();
}
}
| [
"[email protected]"
]
| |
e891b953f787c118af15d41274c30b69a080a983 | 166757bcfba4b8b76111768c1c61340ea7e36212 | /app/src/main/java/com/pszemek/betterfy/misc/Utils.java | f8ed0a1b6d8dcbb26b26945dfa68d5e677663809 | [
"MIT",
"Apache-2.0"
]
| permissive | przemek-jablonski/Betterfy | d85b367f29e2cef595ab6faea02be6f8e5de6a47 | e09789c9c9f649af46e9e75419e53fc9ea2af899 | refs/heads/master | 2021-10-11T23:18:16.253738 | 2016-09-13T17:57:22 | 2016-09-13T17:57:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,489 | java | package com.pszemek.betterfy.misc;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.annotation.StringRes;
import com.pszemek.betterfy.DoubleStringSeparatorObject;
import com.pszemek.betterfy.R;
import com.pszemek.betterfy.backend.models.ArtistFullObject;
import com.pszemek.betterfy.backend.models.PlaylistObject;
import com.pszemek.betterfy.backend.models.PlaylistTrackObject;
import com.pszemek.betterfy.backend.models.TrackFullObject;
import com.pszemek.betterfy.backend.models.UserPublicObject;
import com.pszemek.betterfy.backend.models.simplified.ArtistSimpleObject;
import java.net.InetAddress;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* Created by Ciemek on 23/06/16.
*/
public class Utils {
public static String getSpotifyAccessToken(final Context context) {
return getSharedPreferences(context, R.string.sharedpreferences_global).getString(
context.getString(R.string.spotifyAccessToken_value),
null
);
}
public static String getStringFromSharedPreferences(final Context context, int sharedPrefsId, String key) {
return getStringFromSharedPreferences(context, sharedPrefsId, key, null);
}
public static String getStringFromSharedPreferences(final Context context, int sharedPrefsId, String key, String defValue) {
return getSharedPreferences(context, sharedPrefsId).getString(key, defValue);
}
public static SharedPreferences getSharedPreferences(final Context context, int sharedPrefsId) {
return getSharedPreferences(context, sharedPrefsId, Context.MODE_PRIVATE);
}
public static SharedPreferences getSharedPreferences(final Context context, int sharedPrefsId, int mode) {
return context.getSharedPreferences(context.getString(sharedPrefsId), mode);
}
public static int checkInternetConnection(final Context context) {
ConnectivityManager connectivityManager =
(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
if (activeNetwork != null && activeNetwork.isConnectedOrConnecting()) {
return activeNetwork.getType();
}
return -1;
}
public static String checkInternetConnectionString(final Context context) {
int connectivityType = checkInternetConnection(context);
if (connectivityType == -1)
return "NO INTERNET CONNECTION!";
else if (connectivityType == ConnectivityManager.TYPE_WIFI)
return "Internet connection: WIFI";
else if (connectivityType == ConnectivityManager.TYPE_MOBILE)
return "Internet connection: CELLULAR";
else
return "UNDEFINED INTERNET CONNECTION";
}
public static String createStringPlaylistAuxiliary(PlaylistObject playlist) {
StringBuilder builder = new StringBuilder();
builder.append(playlist.tracks.totalTracks).append(" tracks, ");
if (playlist.user.displayName != null)
builder.append(playlist.user.displayName).append(", ");
if (playlist.isPublic)
builder.append("public").append(", ");
else
builder.append("private").append(", ");
if (!playlist.collaborative)
builder.append("non");
builder.append("collaborative");
return builder.toString();
}
public static String createStringTrackArtists(PlaylistTrackObject track) {
StringBuilder builder = new StringBuilder();
for (int i=0; i < track.track.artists.size(); ++i) {
builder.append(track.track.artists.get(i).name);
if (i != track.track.artists.size()-1)
builder.append(", ");
}
return builder.toString();
}
public static String createStringTrackArtists(List<ArtistSimpleObject> tracks) {
StringBuilder builder = new StringBuilder();
for (int i=0; i < tracks.size(); ++i) {
builder.append(tracks.get(i).name);
if (i != tracks.size()-1)
builder.append(", ");
}
return builder.toString();
}
public static String createStringHype(int popularity) {
return popularity + "%";
}
public static String convertMsToDurationString(int durationMs) {
long hours = TimeUnit.MILLISECONDS.toHours(durationMs);
durationMs -= TimeUnit.HOURS.toMillis(hours);
long min = TimeUnit.MILLISECONDS.toMinutes(durationMs);
durationMs -= TimeUnit.MINUTES.toMillis(min);
long second = TimeUnit.MILLISECONDS.toSeconds(durationMs);
String minString;
String secondsString;
if (min < 10) {
minString = String.format("0%d", min);
} else {
minString = String.valueOf(min);
}
if (second < 10) {
secondsString = String.format("0%d", second);
} else {
secondsString = String.valueOf(second);
}
if (hours > 0) {
return String.format("%d:%s:%s", hours, minString, secondsString);
} else {
return String.format("%s:%s", minString, secondsString);
}
}
public static String createStringGenre(ArtistFullObject topObject) {
if (topObject.genres.size() == 0)
return "unknown genre";
StringBuilder builder = new StringBuilder();
for (int i=0; i < topObject.genres.size(); ++i) {
builder.append(topObject.genres.get(i));
if (i != topObject.genres.size()-1)
builder.append(", ");
}
return builder.toString();
}
//todo: create method instantiate() or whatever, and create builder there (instead in every method)
//builder could be cleaned upon running new method
public static String createStringFollowers(ArtistFullObject topObject) {
return "Followers " + Integer.toString(topObject.followers.totalFollowers);
}
public static DoubleStringSeparatorObject createSeparatorFromStrings(Context context, @StringRes int leftStringResId, @StringRes int rightStringResId) {
return new DoubleStringSeparatorObject(
context.getString(leftStringResId),
context.getString(rightStringResId)
);
}
}
| [
"[email protected]"
]
| |
705bd2bdf6a03bc5a600c8e9947f19fedd07e19c | 0e1de9e04de6c4c74b6b30596c8f200caf758976 | /src/elements/PointLight.java | 3b9142c18fdd85adc18e5e49f3ed46bb26fbbb79 | []
| no_license | rivki770/projectJava | e63ddb874065d99f81652bea66ae9f7563392e91 | 3e1b34f902cc29bafb00a76f03416eadc0ba6e36 | refs/heads/master | 2022-11-19T08:24:15.929469 | 2020-07-07T15:55:28 | 2020-07-07T15:55:28 | 250,068,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,908 | java | package elements;
import primitives.*;
/**
* Camera: class for representing a PointLight on a model
* @author rivki_kanterovich
*/
public class PointLight extends Light implements LightSource{
protected Point3D _position;
protected double _kC;
protected double _kL;
protected double _kQ;
/*************** Constructor ********************/
/**
* Constructor for creating a pointLight
*
* @param colorintensity is color intensity
* @param _position is point of a lights.
* @param _kC is exclusion factor
* @param _kL is exclusion factor
* @param _kQ is exclusion factor
*/
public PointLight(Color colorIntensity, Point3D _position, double _kC, double _kL, double _kQ) {
this._intensity = colorIntensity;
this._position = new Point3D(_position);
this._kC = _kC;
this._kL = _kL;
this._kQ = _kQ;
}
public PointLight(Color colorIntensity, Point3D _position) {
this(colorIntensity, _position, 1d, 0d, 0d);
}
/**
* @param p the geometries point
* @return the color in point of geometries
*/
@Override
public Color getIntensity(Point3D p) {
double dsquared = p.distanceSquared(_position);
double d = p.distance(_position);
Color IL = _intensity.reduce(_kC + d *_kL + dsquared* _kQ);
return IL;
}
/**
* @param p the geometries point
* @return a vector from light to geometries
*/
@Override
public Vector getL(Point3D p) {
if (p.equals(_position)) {
return null;
} else {
return p.subtract(_position).normalize();
}
}
/**
* @param point the geometries point
* @return the distance from a light to geometry point
*/
@Override
public double getDistance(Point3D point) {
return point.distance(_position);
}
}
| [
"[email protected]"
]
| |
1f5f2f92e3005a459df7d781d895d9770c04baae | 251df747f7a3226ca32914f100bed99bc2f91a1c | /src/app/utility/viewUtils/Mediator.java | 27d34ba5e20f6eb526c8b81186ad2485d7e9936b | []
| no_license | Nhom5CNPM20201/7Houses | 6868064f05ab6bbcabb74f2cf0298f4da7fcc910 | a9edaa6a4c0120e9c0ed4adf9ac419811f045d7e | refs/heads/main | 2023-02-06T20:55:23.521480 | 2020-12-23T18:59:43 | 2020-12-23T18:59:43 | 304,909,326 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,610 | java | package app.utility.viewUtils;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class Mediator {
private static HashMap<String, List<EventHandler<ActionEvent>>> action_dict =
new HashMap<String, List<EventHandler<ActionEvent>>>();
public static void unSubscribe(String token, EventHandler<ActionEvent> callBack) {
if (action_dict.containsKey(token))
action_dict.get(token).remove(callBack);
}
public static void unSubscribe(String token) {
if (action_dict.containsKey(token))
action_dict.remove(token);
}
public static void subscribe(String token, EventHandler<ActionEvent> callBack) {
if (!action_dict.containsKey(token)) {
var list = new ArrayList<EventHandler<ActionEvent>>();
list.add(callBack);
action_dict.put(token, list);
}
else
{
boolean found = false;
for (var item : action_dict.get(token)) {
if (item.toString().equals(callBack.toString()))
found = true;
}
if (!found)
action_dict.get(token).add(callBack);
}
}
public static void Notify(String token)
{
Notify(token, null);
}
public static void Notify(String token, ActionEvent obj)
{
if (action_dict.containsKey(token))
for (EventHandler<ActionEvent> callBack : action_dict.get(token))
callBack.handle(obj);
}
}
| [
"[email protected]"
]
| |
cc974aca6f3339c396ac4e94991a7d3c5407bfa9 | 62b27ffb9d320335d5149ecfb97642ce9cf60a53 | /spring-study/ch19/src/main/java/edu/nf/ch19/demo1/MyEvent.java | 5c49447810cf7a46dba9c1e103139a77ed99c690 | []
| no_license | twx31420/s3s160-2 | 51035103f7c17ac6d46d1b35bf2961db4f90498d | d2ed1ffbbd983b611d643c220711c4027a6705c0 | refs/heads/master | 2023-02-26T09:27:19.904797 | 2021-02-03T05:47:51 | 2021-02-03T05:47:51 | 335,522,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package edu.nf.ch19.demo1;
import org.springframework.context.ApplicationEvent;
/**
* @author 天文学
* @date 2020/12/9
* 自定义事件对象,继承ApplicationEvent
*
*/
public class MyEvent extends ApplicationEvent {
/**
* @param source 事件源
*/
public MyEvent(Object source) {
super(source);
}
}
| [
"[email protected]"
]
| |
3a3cce7a56c171904c71e00e942fc7f0152be4f5 | 4f1e7ce3a0553a898dba35cd551878c622945286 | /spring-asm-repack/src/main/java/org/springframework/asm/AnnotationVisitor.java | f36dd87606ffe9dc8549104011a681c574acd292 | []
| no_license | facingsea/spring-framework | 4e318a9cea575543208ad642b32073921ceb4ca5 | d9f3b9eef58cedcca94787121779f03a9937ae33 | refs/heads/3.2.6 | 2023-01-21T02:00:09.052112 | 2016-07-31T09:06:14 | 2016-07-31T09:06:14 | 64,474,223 | 1 | 2 | null | 2023-01-02T21:51:40 | 2016-07-29T11:00:28 | Java | UTF-8 | Java | false | false | 6,036 | java | /***
* ASM: a very small and fast Java bytecode manipulation framework
* Copyright (c) 2000-2011 INRIA, France Telecom
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.springframework.asm;
/**
* A visitor to visit a Java annotation. The methods of this class must be
* called in the following order: ( <tt>visit</tt> | <tt>visitEnum</tt> |
* <tt>visitAnnotation</tt> | <tt>visitArray</tt> )* <tt>visitEnd</tt>.
*
* @author Eric Bruneton
* @author Eugene Kuleshov
*/
public abstract class AnnotationVisitor {
/**
* The ASM API version implemented by this visitor. The value of this field
* must be one of {@link Opcodes#ASM4}.
*/
protected final int api;
/**
* The annotation visitor to which this visitor must delegate method calls.
* May be null.
*/
protected AnnotationVisitor av;
/**
* Constructs a new {@link AnnotationVisitor}.
*
* @param api the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}.
*/
public AnnotationVisitor(final int api) {
this(api, null);
}
/**
* Constructs a new {@link AnnotationVisitor}.
*
* @param api the ASM API version implemented by this visitor. Must be one
* of {@link Opcodes#ASM4}.
* @param av the annotation visitor to which this visitor must delegate
* method calls. May be null.
*/
public AnnotationVisitor(final int api, final AnnotationVisitor av) {
/*if (api != Opcodes.ASM4) {
throw new IllegalArgumentException();
}*/
this.api = api;
this.av = av;
}
/**
* Visits a primitive value of the annotation.
*
* @param name the value name.
* @param value the actual value, whose type must be {@link Byte},
* {@link Boolean}, {@link Character}, {@link Short}, {@link Integer}
* , {@link Long}, {@link Float}, {@link Double}, {@link String} or
* {@link Type} or OBJECT or ARRAY sort. This value can also be an
* array of byte, boolean, short, char, int, long, float or double
* values (this is equivalent to using {@link #visitArray visitArray}
* and visiting each array element in turn, but is more convenient).
*/
public void visit(String name, Object value) {
if (av != null) {
av.visit(name, value);
}
}
/**
* Visits an enumeration value of the annotation.
*
* @param name the value name.
* @param desc the class descriptor of the enumeration class.
* @param value the actual enumeration value.
*/
public void visitEnum(String name, String desc, String value) {
if (av != null) {
av.visitEnum(name, desc, value);
}
}
/**
* Visits a nested annotation value of the annotation.
*
* @param name the value name.
* @param desc the class descriptor of the nested annotation class.
* @return a visitor to visit the actual nested annotation value, or
* <tt>null</tt> if this visitor is not interested in visiting
* this nested annotation. <i>The nested annotation value must be
* fully visited before calling other methods on this annotation
* visitor</i>.
*/
public AnnotationVisitor visitAnnotation(String name, String desc) {
if (av != null) {
return av.visitAnnotation(name, desc);
}
return null;
}
/**
* Visits an array value of the annotation. Note that arrays of primitive
* types (such as byte, boolean, short, char, int, long, float or double)
* can be passed as value to {@link #visit visit}. This is what
* {@link ClassReader} does.
*
* @param name the value name.
* @return a visitor to visit the actual array value elements, or
* <tt>null</tt> if this visitor is not interested in visiting
* these values. The 'name' parameters passed to the methods of this
* visitor are ignored. <i>All the array values must be visited
* before calling other methods on this annotation visitor</i>.
*/
public AnnotationVisitor visitArray(String name) {
if (av != null) {
return av.visitArray(name);
}
return null;
}
/**
* Visits the end of the annotation.
*/
public void visitEnd() {
if (av != null) {
av.visitEnd();
}
}
}
| [
"[email protected]"
]
| |
afbed3fd3cc743bfd201c0a4f84395105cb2e6e0 | 09e1937d4916df3ecc8c17770afafa9c629668d2 | /services/classicmodels/src/com/test_vcs123/classicmodels/TempTimeCheck.java | e1513b6baedd25c84dcddbf33eeca787a36fef93 | []
| no_license | Sushma-M/test_vcs123 | 9396ebbde264280ab34a9385836a196d7340bcaf | 058f1f1b57ee651ea4f525761cd97aceef6f75c8 | refs/heads/master | 2020-03-23T07:08:45.862900 | 2018-07-17T07:41:44 | 2018-07-17T07:41:44 | 141,250,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,484 | java | /*Copyright (c) 2018-2019 wavemaker.com All Rights Reserved.
This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance
with the terms of the source code license agreement you entered into with wavemaker.com*/
package com.test_vcs123.classicmodels;
/*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/
import java.io.Serializable;
import java.sql.Date;
import java.sql.Time;
import java.time.LocalDateTime;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* TempTimeCheck generated by WaveMaker Studio.
*/
@Entity
@Table(name = "`TempTimeCheck`")
public class TempTimeCheck implements Serializable {
private Integer id;
private String name;
private Date date;
private Time time;
private LocalDateTime dateTime;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "`ID`", nullable = false, scale = 0, precision = 10)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "`name`", nullable = true, length = 255)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "`date`", nullable = true)
public Date getDate() {
return this.date;
}
public void setDate(Date date) {
this.date = date;
}
@Column(name = "`time`", nullable = true)
public Time getTime() {
return this.time;
}
public void setTime(Time time) {
this.time = time;
}
@Column(name = "`dateTime`", nullable = true)
public LocalDateTime getDateTime() {
return this.dateTime;
}
public void setDateTime(LocalDateTime dateTime) {
this.dateTime = dateTime;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TempTimeCheck)) return false;
final TempTimeCheck tempTimeCheck = (TempTimeCheck) o;
return Objects.equals(getId(), tempTimeCheck.getId());
}
@Override
public int hashCode() {
return Objects.hash(getId());
}
} | [
"[email protected]"
]
| |
d3ecc4aac8434a3f94180a54d144f5e239192301 | 5e18d8bbc6e3b795a4e3a4556922a40c14765988 | /app/src/test/java/com/lweynant/yearly/test_helpers/StubbedBundle.java | cf9848a907201367cfb8cb6340f18b0a8b58437a | []
| no_license | lweynant/Yearly | 176440b10ed81685fb153e09101694f5f7963acc | 99ce60d57914af866106361eaf7f1a6159d169df | refs/heads/master | 2020-04-12T02:31:45.203946 | 2018-02-11T20:50:39 | 2018-02-11T20:50:39 | 44,444,624 | 0 | 0 | null | 2017-02-19T19:27:42 | 2015-10-17T16:15:28 | Java | UTF-8 | Java | false | false | 1,290 | java | package com.lweynant.yearly.test_helpers;
import android.os.Bundle;
import com.lweynant.yearly.model.Date;
import com.lweynant.yearly.model.IEvent;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class StubbedBundle {
static public Bundle createBundleForEvent(String name, @Date.Month int month, int day) {
Bundle args = mock(Bundle.class);
stubBundleForEvent(name, month, day, args);
return args;
}
public static void stubBundleForEvent(String name, @Date.Month int month, int day, Bundle args) {
when(args.containsKey(IEvent.KEY_NAME)).thenReturn(true);
when(args.getString(IEvent.KEY_NAME)).thenReturn(name);
when(args.containsKey(IEvent.KEY_MONTH)).thenReturn(true);
when(args.getInt(IEvent.KEY_MONTH)).thenReturn(month);
when(args.containsKey(IEvent.KEY_DAY)).thenReturn(true);
when(args.getInt(IEvent.KEY_DAY)).thenReturn(day);
}
static public Bundle createBundleForEvent(String name, int year, @Date.Month int month, int day) {
Bundle args = createBundleForEvent(name, month, day);
when(args.containsKey(IEvent.KEY_YEAR)).thenReturn(true);
when(args.getInt(IEvent.KEY_YEAR)).thenReturn(year);
return args;
}
}
| [
"[email protected]"
]
| |
35b49deb3c0672326dbe5aa66083aa64d99dd0d4 | 2cf79a745b7f0b9d272155a3946146534fa3697c | /src/main/java/com/gdms/controller/user/AdminController.java | 074a6174e978e5c17c465edc5e081ec68f178a95 | []
| no_license | HackerStudy/gdms | fd30f95c1aedbcfd7a77385142f567fba673a8a4 | 915e42eb5d929145261eee8a7aa59e1a3a8e45a0 | refs/heads/master | 2020-03-14T01:29:44.196997 | 2018-06-22T12:18:48 | 2018-06-22T12:18:48 | 131,378,627 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 13,214 | java | package com.gdms.controller.user;
import cc.openkit.common.KitUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gdms.model.*;
import com.gdms.service.admin.AdminService;
import com.gdms.service.g.GGroupLimitService;
import com.gdms.service.g.GGroupService;
import com.gdms.service.web.WebSettingService;
import com.gdms.util.InData;
import com.gdms.util.OutData;
import com.gdms.util.StaticFinalVar;
import com.gdms.vo.LimitVo;
import org.apache.log4j.Logger;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 后台管理员类的方法
*
* @author bigben
* @date 2018.2.5
*/
@Controller
@Scope("prototype")
@RequestMapping("/admin")
public class AdminController {
private Logger log = Logger.getLogger(AdminController.class);
@Resource
private AdminService adminService;
@Resource
private WebSettingService webSettingService;
@Resource
private GGroupLimitService gGroupLimitService;
@Resource
private GGroupService gGroupService;
/**
* 用户后台登录页面跳转
* @return
*/
@RequestMapping(value = "/index", method = RequestMethod.GET)
@ResponseBody
public ModelAndView index(HttpSession session){
log.info("用户登录跳转方法");
log.debug("测试debug");
WebSetting webSetting = webSettingService.queryById(1);
System.out.println(webSetting.toString());
// 新建返回值对象
ModelAndView mv = new ModelAndView();
mv.setViewName("/view/login");
session.setAttribute("kitWeb",webSetting);
return mv;
}
/**
* 登录验证方法
* @param request
* @param session
* @return
*/
@RequestMapping(value = "/tologin", method = RequestMethod.POST)
@ResponseBody
public ModelAndView tologin(HttpServletRequest request, HttpSession session){
log.info("开始登陆了");
// 新建返回值对象
ModelAndView mv = new ModelAndView();
// 取值
String username = request.getParameter("username");
String password = request.getParameter("password");
int identity=Integer.valueOf(request.getParameter("identityid"));
// 组装对象
Admin admin = new Admin();
admin.setKitAdminUsername(username);
admin.setKitAdminPassword(password);
Admin returnAdmin = adminService.getModelByUsernameAndPassword(admin);
// System.out.println(returnAdmin.toString());
// 查询
// Admin returnAdmin = adminService.getModelByUsernameAndPassword(admin);
if(returnAdmin==null){
// 如果为空,跳转到登录页面
mv.setViewName("/view/login");
mv.addObject("msg", StaticFinalVar.USERNAME_OR_PWD_ERR);
return mv;
}
// 得到他的权限
List<LimitVo> limitVoList = gGroupLimitService.getModelByGroupId(returnAdmin.getGroupId());
log.info("他的权限有 "+limitVoList.size()+" 个!");
System.out.println("该用户的权限有:"+limitVoList.size());
// 获取他的功能模块
mv.setViewName("/view/index");
session.setAttribute("admin",returnAdmin);
session.setAttribute("limitList",limitVoList);
return mv;
}
/**
* 后台用户退出方法
* @param session
* @return
*/
@RequestMapping(value = "/uplogin", method = RequestMethod.GET)
@ResponseBody
public ModelAndView uplogin(HttpSession session){
log.info("后台退出");
// 新建返回值对象
ModelAndView mv = new ModelAndView();
WebSetting webSetting = webSettingService.queryById(1);
// 新建返回值对象
session.setAttribute("kitWeb",webSetting);
session.removeAttribute("admin");
session.removeAttribute("limitList");
mv.setViewName("/view/login");
return mv;
}
/**
* 获取所有管理员用户
*
* @param
* @return
*/
@RequestMapping(value = "/getAll", method = RequestMethod.GET)
public ModelAndView getAll(HttpSession session){
ModelAndView mv=new ModelAndView();
List<Admin> adminList=adminService.getAlladmin();
List<GGroup> groupList=gGroupService.queryAllAdminGroup();
// 取值
mv.setViewName("/view/admin/list");
mv.addObject("groupList",groupList);
mv.addObject("adminlist",adminList);
return mv;
}
// /**
// * 当跳转到列表页面开始渲染数据
// *
// * @param request
// * @return
// */
// @RequestMapping(value = "/getAllJson", method = RequestMethod.POST)
// @ResponseBody
// public Object getAllJson(HttpServletRequest request){
// log.info("查看所有的管理员,返回 json");
//
// Map<String,Object> map = new HashMap<String,Object>();
//
// String page = request.getParameter("page");// 获得页数
// String limit = request.getParameter("limit");// 获得每页显示条数
// String search = request.getParameter("search");// 获取搜索条件
//
//// 封装数据
// Admin user = new Admin();
// if(KitUtil.feikong(search)){
// user.setKitAdminName(search);
// }
//
// // 分页查询
// List<Admin> adminList = adminService.queryPageListByWhere(user, Integer.valueOf(page), Integer.valueOf(limit));
// int size = adminService.queryCount(user);
//
// List<GGroup> gGroupList = gGroupService.queryAll();
// // 封装返回数据
// List<AdminVo> adminVoList = new ArrayList<AdminVo>();
// for(int i=0; i<adminList.size(); i++){
// AdminVo adminVo = new AdminVo(adminList.get(i));
// for(int j=0; j<gGroupList.size(); j++){
// if(adminList.get(i).getGroupId().equals(gGroupList.get(j).getGroupId())){
// adminVo.setGroupName(gGroupList.get(j).getGroupName());
// }
// }
// adminVoList.add(adminVo);
// }
//
// System.out.println("抓到的数据总数:"+adminVoList.size());
//
// // 返回数据
// map.put("code",0);
// map.put("msg","");
// map.put("count",size);
// map.put("data",adminVoList);
//
// return JSONObject.toJSON(map);
// }
/**
* 跳转到添加管理员页面
* @param request
* @return
*/
@RequestMapping(value = "/toAdd", method = RequestMethod.GET)
@ResponseBody
public ModelAndView toAdd(HttpServletRequest request){
log.info("用户 》 添加 》 跳转");
ModelAndView mv = new ModelAndView();
List<GGroup> groupList= gGroupService.queryAllAdminGroup();
mv.setViewName("/view/admin/add");
mv.addObject("groupList",groupList);
return mv;
}
/**
* 去添加页面
*
* @param request
* @return
*/
@RequestMapping(value = "/goAdd", method = RequestMethod.GET)
@ResponseBody
public ModelAndView goAdd(HttpServletRequest request){
log.info("用户 》 添加 》 跳转");
ModelAndView mv = new ModelAndView();
List<GGroup> groups = gGroupService.queryAll();
mv.setViewName("/view/group/add");
mv.addObject("kitList",groups);
return mv;
}
/**
* 添加
*
* @param request
* @return
*/
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Object add(HttpServletRequest request){
log.info("用户 》 添加 》 保存");
String kitAdminName = request.getParameter("kitAdminName");
String imgurl = request.getParameter("imgurl");
String kitAdminUsername = request.getParameter("kitAdminUsername");
String kitAdminPassword = request.getParameter("kitAdminPassword");
Admin admin = new Admin();
int i= (int)(Math.random() * 1000000);
String id=String.valueOf(i);
admin.setKitAdminId(id);
admin.setKitAdminName(kitAdminName);
admin.setKitAdminUsername(kitAdminUsername);
admin.setKitAdminImgUrl(imgurl);
admin.setKitAdminPassword(kitAdminPassword);
admin.setGroupId(5);
Admin admin1=adminService.queryAdminByKitAdminUsername(kitAdminUsername);
if(admin1==null) {
Boolean b = adminService.insertAdmin(admin);
if (b) {
return JSONObject.toJSON(KitUtil.returnMap("200", StaticFinalVar.ADD_OK));
} else {
return JSONObject.toJSON(KitUtil.returnMap("101", StaticFinalVar.ADD_ERR));
}
}else{
return JSONObject.toJSON(KitUtil.returnMap("101", StaticFinalVar.USERHAVE_ERR));
}
}
/**
* 删除
*
* @param request
* @return
*/
@RequestMapping(value = "/del", method = RequestMethod.POST)
@ResponseBody
public Object del(HttpServletRequest request){
log.info("用户 》 删除");
String id = request.getParameter("id");
int i = adminService.deleteByUUId(id);
return i==1?KitUtil.returnMap("200",StaticFinalVar.DEL_OK):KitUtil.returnMap("101",StaticFinalVar.DEL_ERR);
}
/**
* 去修改页面
*
* @param request
* @return
*/
@RequestMapping(value = "/goUpdate", method = RequestMethod.GET)
@ResponseBody
public ModelAndView goUpdate(HttpServletRequest request){
log.info("用户 》 修改 》 跳转");
ModelAndView mv = new ModelAndView();
String kitAdminId = request.getParameter("kitAdminId");
Admin admin = adminService.selectAdminById(kitAdminId);
mv.setViewName("/view/admin/update");
mv.addObject("updateAdmin",admin);
return mv;
}
/**
* 查询管理员
* @param
* @return
*/
@RequestMapping(value = "/search", method = RequestMethod.POST)
@ResponseBody
public Object search(@RequestBody InData inData,HttpSession session){
log.info("用户 》查询 》 保存");
Map<String, Object> map = inData.getInmap();
String kitAdminUserName=(String) map.get("searchContent");
List<GGroup> groupList=gGroupService.queryAllAdminGroup();
User user =(User) session.getAttribute("user");
List<Admin> adminList=adminService.searchAdminByAdminUsername(kitAdminUserName);
Map<String,Object> smap=new HashMap<String, Object>();
smap.put("adminList",adminList);
smap.put("groupList",groupList);
smap.put("user",user);
// String data = JSON.toJSONString(adminList);
if(adminList.size()>0) {
return JSONObject.toJSON(OutData.outData(StaticFinalVar.SEARCH_OK,smap,200));
}else{
return JSON.toJSONString(OutData.outData(StaticFinalVar.SEARCH_ERR,"",101));
}
}
/**
* 修改
*
* @param request
* @return
*/
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
public Object update(HttpServletRequest request){
log.info("用户 》 修改 》 保存");
String kitAdminId = request.getParameter("kitAdminId");
String kitAdminName = request.getParameter("kitAdminName");
String kitAdminUsername = request.getParameter("kitAdminUsername");
// String groupId = request.getParameter("groupId");
// String data = request.getParameter("data");
// JSONObject jsonObj = JSONObject.parseObject(data);
// String id=jsonObj.getString("kitAdminId");
Admin user = new Admin();
user.setKitAdminId(kitAdminId);
user.setKitAdminName(kitAdminName);
user.setKitAdminUsername(kitAdminUsername);
user.setGroupId(5);
Admin admin2=adminService.queryByUUID(kitAdminId);
if(admin2.getKitAdminUsername().equals(kitAdminUsername)) {
int i = adminService.updateByAdminId(user);
return JSONObject.toJSON(i == 1 ? KitUtil.returnMap("200", StaticFinalVar.UPDATE_OK) : KitUtil.returnMap("101", StaticFinalVar.UPDATE_ERR));
}else{
Admin admin1 = adminService.queryAdminByKitAdminUsername(kitAdminUsername);
if (admin1 == null) {
int i = adminService.updateByAdminId(user);
return JSONObject.toJSON(i == 1 ? KitUtil.returnMap("200", StaticFinalVar.UPDATE_OK) : KitUtil.returnMap("101", StaticFinalVar.UPDATE_ERR));
} else {
return JSONObject.toJSON(KitUtil.returnMap("101", StaticFinalVar.USERHAVE_ERR));
}
}
}
}
| [
"[email protected]"
]
| |
8919b4eae3708b026eac5e2a855f0dd6cc799ffb | 8e9eafa1d6b6c76f418c9e010a51f28904e057c8 | /Menus.java | a528a8afc06097454b1847ec941895276b2a97b3 | []
| no_license | CowKeyMan/Kingdom-Hearts-Rumble | eca7a9b6f2cd91d741ae3699a582dfd67762166e | 2f3093b956710470c88c20c28aca7a4a1117d0a2 | refs/heads/master | 2020-04-08T00:34:49.809819 | 2018-11-23T17:00:41 | 2018-11-23T17:00:41 | 158,857,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,911 | java | //To use buttons
import java.awt.*;
//To use action listener
import java.awt.event.*;
//To use arraylists
import java.util.*;
public class Menus implements ActionListener{
//Parameters for button placements
int screenWidth, screenHeight;
//The current buttons being
//state: 0 = Nothing, 1 = Main Menu, 2 = Difficulty Selection, 3 = New/Load Game
int state = 0;
//Main Menu
Menu mm = new Menu();
//Difficulty Selection
Menu ds = new Menu();
//Choose between New/Load game
Menu nl = new Menu();
//The filename where the main level is stored
String mainFilename;
//Buttons used for scrolling up or down during selection
Button btnUp = new Button("UP");
Button btnDown = new Button("DOWN");
//Items used for level selection
ArrayList<Label> lblLevelName = new ArrayList<Label>();
//Items for saved user selection
ArrayList<Label> lblUserName = new ArrayList<Label>();
//Buttons used for deleting and choosing a saved level/User
ArrayList<Button> btnChoose = new ArrayList<Button>();
ArrayList<Button> btnDelete = new ArrayList<Button>();
public Menus(int widthLimit, int heightLimit){
//Set the names of the main menu buttons
mm.addButton("Main Level");
mm.addButton("Custom Level");
mm.addButton("Create Level");
mm.addButton("Instructions");
mm.addButton("Credits");
for(int i = 0; i < mm.btn.size(); i++){
mm.btn.get(i).addActionListener(this);
}
//Set the names of the Difficulty Selection buttons
ds.addButton("Beginner");
ds.addButton("Standard");
ds.addButton("Proud");
ds.addBackButton(heightLimit, 100, 40);
for(int i = 0; i < ds.btn.size(); i++){
ds.btn.get(i).addActionListener(this);
}
ds.btnBack.addActionListener(this);
//Set the Loading selection buttons
nl.addButton("New Game");
nl.addButton("Load Game");
nl.addBackButton(heightLimit, 100, 40);
for(int i = 0; i < nl.btn.size(); i++){
nl.btn.get(i).addActionListener(this);
}
nl.btnBack.addActionListener(this);
//Give a value to screen width and height
screenWidth = widthLimit;
screenHeight = heightLimit;
hideMainMenu();
}
void showMainMenu(){
mm.showButtons(screenWidth, screenHeight, 175, 50, 100, 30);
state = 1;
}
void hideMainMenu(){
mm.hideButtons();
state = 0;
}
void showDifficultySelection(){
ds.showButtons(screenWidth, screenHeight, 175, 50, 100, 30);
state = 2;
}
void hideDifficultySelection(){
ds.hideButtons();
state = 0;
}
void showNewLoad(){
nl.showButtons(screenWidth, screenHeight, 175, 50, 100, 30);
state = 3;
}
void hideNewLoad(){
nl.hideButtons();
state = 0;
}
public void paint(Graphics g){
g.setFont(new Font("Times New Roman", Font.BOLD, 90));
if(state == 1){
g.drawString("MAIN MENU", 400, 130);
}else if(state == 2){
g.setFont(new Font("Times New Roman", Font.BOLD, 50));
g.drawString("CHOOSE A DIFFICULTY", 410, 150);
}else if(state == 3){
g.setFont(new Font("Times New Roman", Font.BOLD, 50));
g.drawString("NEW OR RETURNING PLAYER?", 320, 150);
}
}
public void actionPerformed(ActionEvent e){
hideMainMenu();
hideDifficultySelection();
hideNewLoad();
if(e.getSource() == mm.btn.get(0)){
showNewLoad();
}else if(e.getSource() == nl.btn.get(0)){
showDifficultySelection();
}else if(e.getSource() == ds.btnBack){
showNewLoad();
}
}
} | [
"[email protected]"
]
| |
148a3e0c1c280a91a567dddc3d520c26337ad93f | 09ac16e3e68b1ac24202baecb98e5edb72739bf5 | /Jms2MqHello/src/com/study/produce/Produce.java | a127bb9be21da41f38a37cd66d4296f5e94077e2 | [
"Apache-2.0"
]
| permissive | a18792721831/MQ | 50c72d0bf28c056a2a7dbff4e966906c966c5457 | 0c213d92d6430c61cd822638124bd3815d4cb59d | refs/heads/master | 2020-06-02T23:47:36.971610 | 2019-07-23T12:45:58 | 2019-07-23T12:45:58 | 191,349,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package com.study.produce;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import javax.jms.JMSContext;
/**
* @author jiayq
*/
public class Produce {
public static void main(String[] args){
ActiveMQJMSConnectionFactory factory = new ActiveMQJMSConnectionFactory();
try (
JMSContext jmsContext = factory.createContext()
) {
jmsContext.createProducer().send(jmsContext.createQueue("jms") ,"jms2.0:produce");
}
}
}
| [
"[email protected]"
]
| |
e836f623eb15318e9cf8b59ac2372f37e2ee4ffa | 0c0b7575c6170b3268caf35813e460f2969f81fe | /src/test/java/com/netease/nos/test/mulitpart/DataProvidedForInitiateMulitPart.java | a96e4f4fc95afb2ce97e98fd8c816a3e18a22cd5 | []
| no_license | 163yun/nos-java-sdk | 4e3d1c2a5c90fef28b0e75c2e6ea599cac0ee192 | 7ae61efab9bfa141bab36ca5f93a663cdc957769 | refs/heads/master | 2021-01-17T02:43:23.777098 | 2016-08-16T08:24:40 | 2016-08-16T08:24:40 | 66,336,348 | 2 | 0 | null | 2016-08-23T05:36:31 | 2016-08-23T05:36:30 | null | UTF-8 | Java | false | false | 1,937 | java | package com.netease.nos.test.mulitpart;
import java.io.File;
import org.testng.annotations.DataProvider;
import com.netease.cloud.services.nos.model.CreateBucketRequest;
import com.netease.cloud.services.nos.model.InitiateMultipartUploadRequest;
import com.netease.cloud.services.nos.model.PutObjectRequest;
import com.netease.nos.test.utils.TestHostConfig;
public class DataProvidedForInitiateMulitPart {
public static String bucketfortestmulitupload = "bucketfortestmulitupload"+TestHostConfig.region.toLowerCase();
public static String bucketnotexisted = "bucketnotexisted";
public static String objectname = "objectkey1";
@DataProvider
public static Object[][] putBucket() {
return new Object[][] { { new CreateBucketRequest(bucketfortestmulitupload, TestHostConfig.region) } };
}
@DataProvider
public static Object[][] putObject() {
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketfortestmulitupload, objectname, new File(
"TestFile" + File.separator + "123.txt"));
return new Object[][] { { putObjectRequest } };
}
@DataProvider
public static Object[][] initiateNotExistedBucket() {
return new Object[][] { { new InitiateMultipartUploadRequest(bucketnotexisted, "key") } };
}
@DataProvider
public static Object[][] initiateObjectHasExisted() {
return new Object[][] { { new InitiateMultipartUploadRequest(bucketfortestmulitupload, objectname) } };
}
@DataProvider
public static Object[][] initiateNormal() {
return new Object[][] { { new InitiateMultipartUploadRequest(bucketfortestmulitupload, "normalkey") } };
}
@DataProvider
public static Object[][] initiateWithObjNameToLong() {
int maxLen = 1000;
StringBuilder longObjectName = new StringBuilder("");
for(int i=0; i<(maxLen+1); i++){
longObjectName.append("a");
}
return new Object[][] { { new InitiateMultipartUploadRequest(bucketfortestmulitupload, longObjectName.toString()) } };
}
}
| [
"[email protected]"
]
| |
04ee6dd31fd65f8ce9520ebccf8e276f57c0d510 | ee4cdb5fb1422d3f706066a81b749f4e83a47381 | /jms/src/main/java/com/findshen/jms/demo/ActiveMQClient.java | ad86fb52bd392a29fa15a12dbddab91947958254 | [
"Apache-2.0"
]
| permissive | Easzz/easycloud | 55ed90499b5922c8e14a61a96e2f76fe09bf5f18 | 89e7cf56dabe86d10c5205f40b32ab02f4df816e | refs/heads/master | 2023-03-06T12:17:22.445573 | 2022-05-31T03:45:55 | 2022-05-31T03:45:55 | 156,560,243 | 0 | 0 | null | 2023-02-22T05:21:33 | 2018-11-07T14:39:40 | JavaScript | UTF-8 | Java | false | false | 409 | java | //package com.findshen.jms.demo;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.jms.core.JmsTemplate;
//import org.springframework.stereotype.Component;
//
//@Component
//public class ActiveMQClient {
// @Autowired
// private JmsTemplate jmsTemplate;
// public void send(String msg){
// jmsTemplate.convertAndSend("zhangsan",msg);
// }
//}
| [
"[email protected]"
]
| |
0cc78908ca1dc1a6660f2b85aa23319772a406d9 | 0e457dbc10b8a5f4eda5e78f8613805f2b2c8d62 | /listaenlazadaclient/src/generated/cl/maraneda/listaenlazadaservice/ObjectFactory.java | 81404f389d0884b30d1faf1f966e2dd05ca316d4 | []
| no_license | mrcoar/listasenlazadas | be309ecb42641909ea2ee3c3e18977ac6c9eb1b4 | f55d040f5c2ae2f91c79d8065883d220bfeb0c2c | refs/heads/master | 2020-04-15T18:09:54.001230 | 2019-01-09T17:19:27 | 2019-01-09T17:19:27 | 164,903,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java |
package cl.maraneda.listaenlazadaservice;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the cl.maraneda.listaenlazadaservice package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: cl.maraneda.listaenlazadaservice
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ServiceResponse }
*
*/
public ServiceResponse createServiceResponse() {
return new ServiceResponse();
}
/**
* Create an instance of {@link LeNodo }
*
*/
public LeNodo createLeNodo() {
return new LeNodo();
}
/**
* Create an instance of {@link ListaEnlazada }
*
*/
public ListaEnlazada createListaEnlazada() {
return new ListaEnlazada();
}
}
| [
"[email protected]"
]
| |
bf15c8930f9c1118ac37dd9a47bd23f5fe2dbb34 | 192f6f463850a06bd58c2508654be62c432caa29 | /src/main/java/com/tabeldata/controller/PendapatanDptController.java | 786e3896ddccaa6485f8030e100b642e51bad5a6 | [
"Apache-2.0"
]
| permissive | arraisi/resource-api-blud | 5b7c9eb02ebc79959c132601e1746aa88f2eeadd | e992ab0f2dc323db34ad4eee0c4e7be62fec5209 | refs/heads/master | 2020-07-20T03:14:51.414837 | 2019-08-30T08:10:53 | 2019-08-30T08:10:53 | 206,561,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,697 | java | package com.tabeldata.controller;
import com.tabeldata.entity.LoadDptEntity;
import com.tabeldata.entity.PendapatanDptEntity;
import com.tabeldata.entity.RincianPendapatanEntity;
import com.tabeldata.service.PendapatanDptService;
import com.tabeldata.service.RincianPendapatanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/api/pendapatan")
public class PendapatanDptController {
@Autowired
private PendapatanDptService service;
@Autowired
private RincianPendapatanService rincianPendapatanService;
@PostMapping("/save")
public ResponseEntity<PendapatanDptEntity> savePendapatan(@RequestBody LoadDptEntity loadDptEntity, Principal principal) {
PendapatanDptEntity value = new PendapatanDptEntity();
try {
value = service.savePendapatan(loadDptEntity, principal);
return new ResponseEntity<>(value, HttpStatus.CREATED);
} catch (EmptyResultDataAccessException e) {
e.printStackTrace();
log.info("Error Catch : {}", e);
return new ResponseEntity<>(value, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@GetMapping("/rincian/load/{idDpt}")
public ResponseEntity<List<RincianPendapatanEntity>> getRincianPendapatanByDptID(@PathVariable Integer idDpt) {
List<RincianPendapatanEntity> value = rincianPendapatanService.getListRincianPendapatanBydptId(idDpt);
if (!value.isEmpty()) {
return new ResponseEntity<>(value, HttpStatus.OK);
} else {
return new ResponseEntity<>(new ArrayList<>(), HttpStatus.NO_CONTENT);
}
}
@GetMapping("/{id}")
public ResponseEntity<PendapatanDptEntity> getListPendapatanById(@PathVariable Integer id) {
PendapatanDptEntity value = service.getPendapatanById(id);
if (value != null) {
return new ResponseEntity<>(value, HttpStatus.OK);
} else {
return new ResponseEntity<>(null, HttpStatus.NO_CONTENT);
}
}
@PostMapping("/akb/save")
public ResponseEntity<PendapatanDptEntity> saveAkb(@RequestBody PendapatanDptEntity pendapatanDptEntity, Principal principal) {
PendapatanDptEntity value = service.updateAkbPendapatan(pendapatanDptEntity, principal);
return new ResponseEntity<>(value, HttpStatus.OK);
}
}
| [
"[email protected]"
]
| |
47b00b6375732e4d3b4430c79653b4e7e6fe9d44 | bb8a2e03a863dfdf42912becac2dc61dafda44bd | /Tree/314. Binary Tree Vertical Order Traversal.java | e9bde097d4e6343a18a8139d9b00f6608eaeb0f0 | [
"MIT"
]
| permissive | aspineon/Algorithms-in-Java-Swift-CPP | ce58058bc6a6735c2c4b1b7f78081e8c46f94ef8 | da3e776db08c386cc6b593e8a6f9c28519fa6181 | refs/heads/master | 2021-06-12T07:40:58.725251 | 2017-03-08T05:50:19 | 2017-03-08T05:50:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,669 | java | public class Solution {
public List<List<Integer>> verticalOrder(TreeNode root) {
List<List<Integer>> res = new ArrayList<>();
if (root == null) return res;
Map<Integer, ArrayList<Integer>> map = new HashMap<>();
Queue<TreeNode> q = new ArrayDeque<>();
Queue<Integer> cols = new ArrayDeque<>();
q.add(root);
cols.add(0);
// use min and max to get the map.values
int min = 0, max = 0;
while (!q.isEmpty()) {
TreeNode node = q.poll();
int col = cols.poll();
// use map to record the node.val at the same col
if (!map.containsKey(col)) {
map.put(col, new ArrayList<Integer>());
}
map.get(col).add(node.val);
if (node.left != null) {
q.add(node.left);
cols.add(col - 1);
min = Math.min(col - 1, min);
}
if (node.right != null) {
q.add(node.right);
cols.add(col + 1);
max = Math.max(col + 1, max);
}
}
for (int i = min; i <= max; i++) {
res.add(map.get(i));
}
return res;
}
}
//// faster
public class Solution {
private int min = 0, max = 0;
public List<List<Integer>> verticalOrder(TreeNode root) {
List<List<Integer>> res = new ArrayList<>();
if (root == null) return res;
// compute the range using dfs
computeRange(root, 0);
// initialize the res list;
for (int i = min; i <= max; i++) res.add(new ArrayList<Integer>());
Queue<TreeNode> q = new ArrayDeque<>();
Queue<Integer> cols = new ArrayDeque<>();
q.add(root);
// -min is root
cols.add(-min);
while (!q.isEmpty()) {
TreeNode node = q.poll();
int col = cols.poll();
res.get(col).add(node.val);
if (node.left != null) {
q.add(node.left);
cols.add(col - 1);
}
if (node.right != null) {
q.add(node.right);
cols.add(col + 1);
}
}
return res;
}
private void computeRange(TreeNode root, int i) {
if (root == null) return;
min = Math.min(min, i);
max = Math.max(max, i);
computeRange(root.left, i - 1);
computeRange(root.right, i + 1);
}
}
| [
"[email protected]"
]
| |
61bb8fb77db77882889f2a3ec6c818fc2ce8fc3c | a6883b7d091f58c6519fde48580dc95fbfcd6a2e | /iVote-project/src/edu/csupomona/cs356/iVote/IVote.java | 762614d190de9db7e2c2350495e78a23848d3546 | []
| no_license | Jonjy/iVote-project | b59b81aa2adf38954b98972dd3bb5638cb319cff | 764af2696ea81e1353edb8c47c804106ea95f551 | refs/heads/master | 2021-01-11T11:08:31.427801 | 2015-08-13T11:09:24 | 2015-08-13T11:09:24 | 40,648,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,450 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.csupomona.cs356.iVote;
import edu.csupomona.cs356.iVote.libraries.*;
import java.util.Scanner;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException;
/**
*
* @author Jon
*/
public class IVote {
/**
* the project is divided into 2 packages. The first which contains the
* main serves as the basis for what can become the student user interface,
* a portal where they can vote and see the results of the questions.
* The second package contains most of the backend work. Its divided into 2
* primary classes. Question contains all of the data about the question
* and the voting. Teacher serves as an access point to write and manipulate
* the question.
*
* The interfaces used in the design are set up in a way that they could be
* used in any voting/polling scenario. The implementation of those
* interfaces is designed to shift the use to a class room setting
* @param args
*/
public static void main(String[] args){
Admin creater= new teacher();
Question grade = creater.createQuestion();
grade.printQuestion();
studentAccess(grade);
grade.printOut();
}
/**
* This method simulates a portal where students can login to vote
* in a more complete implementation the login id could be handled
* through various methods, like ip address or device information
* For the current set up all logins are accepted, and the login id number
* is used as the tracking method for the votes
* @param question
*/
public static void studentAccess(Question question){
try{
InputStream fis = new FileInputStream("votes.txt");
Scanner input = new Scanner(fis);
while(input.hasNext()){
int id = input.nextInt();
Voter current = new Student(id);
String answerChoice = input.nextLine();
question.newVote(current.Voting(answerChoice));
}
}
catch(IOException x) {
System.out.println("Error reading file");
}
}
}
| [
"[email protected]"
]
| |
6ce73d5b01e930e55747866610c55a7cd5a13ddd | 2bee2242975514187c27ee64620f84a451fe9659 | /src/com/obriand/android_contentprovider/MainActivity.java | a5b6b99d870e0761b4ee8c36e5e2760f833fe4b3 | []
| no_license | obriand/android-contentprovider | b1fe7022846871d6ff4d162e9dcc695956d0d62a | d90b567b5638c8a969d9c4398c7c10ac7cc52df5 | refs/heads/master | 2016-09-11T03:17:49.416995 | 2013-01-17T17:35:22 | 2013-01-17T17:35:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,797 | java | package com.obriand.android_contentprovider;
import com.obriand.android_contentprovider.R;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.ContentValues;
import android.database.Cursor;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends Activity {
private static final String TAG = "com.obriand.android_contentprovider.MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.i(TAG, "onCreate");
// Get Items from Content Provider
String columns[] = new String[] { Item.ITEM_ID,
Item.ITEM_NAME, Item.ITEM_DESC };
Uri mItems = ItemProvider.CONTENT_URI;
Cursor cur = getContentResolver().query(mItems, columns, null, null, null);
Toast.makeText(this, cur.getCount() + "", Toast.LENGTH_LONG).show();
}
public void btAddItem(View view) {
Log.i(TAG, "add item");
// Add Item to Content Provider
// Defines a new Uri object that receives the result of the insertion
Uri mNewUri;
// Defines an object to contain the new values to insert
ContentValues mNewValues = new ContentValues();
//Sets the values of each column and inserts the word. The arguments to the "put"
//method are "column name" and "value"
mNewValues.put(Item.ITEM_NAME, "name0");
mNewValues.put(Item.ITEM_DESC, "description0");
mNewUri = getContentResolver().insert(
ItemProvider.CONTENT_URI, // the content URI
mNewValues // the values to insert
);
Toast.makeText(this, "insert 0 item", Toast.LENGTH_LONG).show();
}
public void btGetCount(View view) {
Log.i(TAG, "get count");
// Get Count Items from Content Provider
String columns[] = new String[] { Item.ITEM_ID,
Item.ITEM_NAME, Item.ITEM_DESC };
Uri mItems = ItemProvider.CONTENT_URI;
Cursor cur = getContentResolver().query(mItems, columns, null, null, null);
Toast.makeText(this, cur.getCount() + "", Toast.LENGTH_LONG).show();
}
public void btGetItem(View view) {
Log.i(TAG, "get item");
// Get Last Item from Content Provider
String columns[] = new String[] { Item.ITEM_ID,
Item.ITEM_NAME, Item.ITEM_DESC };
Uri mItems = ItemProvider.CONTENT_URI;
Cursor cur = getContentResolver().query(mItems, columns, null, null, null);
cur.moveToFirst();
int index = cur.getColumnIndex(Item.ITEM_NAME);
Toast.makeText(this, cur.getString(index) + "", Toast.LENGTH_LONG).show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
| [
"[email protected]"
]
| |
fab9bf33a1eb1caa3820f6a2db7f320366db3922 | 4c2f5cc96e2acd38157fc01e41b6439f394dc909 | /src/main/java/com/plahotin/copsboot/repository/user/UserRepositoryImpl.java | 25683ed9e4dcfe78400db1f22f360f036302385f | []
| no_license | praddx/copsboot | 42b240d7921bba6b8174185c71a67ea73760179d | bfc91b3eb9475b47931f024396eb354f6fdcebf4 | refs/heads/master | 2020-05-17T02:17:59.535557 | 2019-05-05T20:57:45 | 2019-05-05T20:57:45 | 183,451,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | package com.plahotin.copsboot.repository.user;
import com.plahotin.copsboot.model.user.User;
import com.plahotin.copsboot.model.user.UserId;
import lombok.AllArgsConstructor;
import java.util.Optional;
import java.util.UUID;
@AllArgsConstructor
public class UserRepositoryImpl implements UserRepositoryCustom {
private final UniqueIdGenerator<UUID> generator;
// public UserRepositoryImpl(UniqueIdGenerator<UUID> generator) {
// this.generator = generator;
// }
@Override
public UserId nextId() {
return new UserId(generator.getNextUniqueId());
}
}
| [
"[email protected]"
]
| |
894df0f8f92bceee40daaacae30d4f2f864f63d6 | e32948e22efc6004c5ddae46aea42ba2dc31cfbb | /FlooringMasteryLou/src/main/java/com/mycompany/flooringmasterylou/dao/AuditDao.java | ff18544b1dd9b5682c7b42b4a653ef92b49a63e3 | []
| no_license | JCLogsdon34/Chris-Logsdon-Java-Lou-Projects | ec5860b4474a2e2c75c9c1fecdbf3072f76d9bed | 0c6dd74d679685461a82ec7fadedc28070987b51 | refs/heads/master | 2020-03-10T09:44:30.866614 | 2018-07-19T21:15:59 | 2018-07-19T21:15:59 | 129,317,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package com.mycompany.flooringmasterylou.dao;
/**
*
* @author JCLog
*/
public interface AuditDao {
public void writeAuditEntry(String entry)
throws FlooringPersistenceException;
}
| [
"[email protected]"
]
| |
2ae526b03eab89c1885c43638cc2bc7222d64a54 | 7b13eb2d4ef022219a54321342c5e3db707c87cf | /cat/src/main/java/roy/github/learn/cat/dao/mapper/CityMapper.java | cb91cf25cdc8dce7b1d537db55fcc0ab369e9337 | []
| no_license | staconfree/roy-github-learn | 8adcc0a462a287fcdb7eca8e4fff3c03ac89a4dd | bd7a6027d9b8cbb2c0b7af46cac81cbab5e114a7 | refs/heads/master | 2020-04-03T11:31:57.534081 | 2018-12-21T03:46:21 | 2018-12-21T03:46:21 | 155,224,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package roy.github.learn.cat.dao.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* Created by roy on 2018/11/20.
*/
@Mapper
public interface CityMapper {
@Select("select * from city")
List<Map<String, Object>> queryCitys();
}
| [
"Kingdom1"
]
| Kingdom1 |
498c39d4bcdeec64a8fe62e3af29c978a70c3b2e | 13d23fd2af2f35d010b69d7573d934f92b9a563d | /emily-spring-boot-context/src/main/java/com/emily/boot/context/httpclient/interceptor/HttpClientInterceptor.java | b326c72c3087b2e795c6d53c8a0e9ae620eb7751 | []
| no_license | jiubaK/spring-parent | 554b97aff1d7a90ddf77767121d7dc8c413baac2 | 5e18d07d4a42b633bd51ae5f6a850193c62b926e | refs/heads/master | 2023-02-03T13:38:51.957141 | 2020-12-18T08:06:11 | 2020-12-18T08:06:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,934 | java | package com.emily.boot.context.httpclient.interceptor;
import com.emily.boot.common.utils.RequestUtils;
import com.emily.boot.common.utils.calculation.ObjectSizeUtil;
import com.emily.boot.common.utils.constant.CharacterUtils;
import com.emily.boot.context.httpclient.service.AsyncLogHttpClientService;
import com.emily.boot.context.httpclient.po.AsyncLogHttpClientRequest;
import com.emily.boot.context.httpclient.po.AsyncLogHttpClientResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.springframework.http.HttpRequest;
import org.springframework.http.MediaType;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.util.StreamUtils;
import java.io.IOException;
import java.util.Date;
import java.util.Objects;
/**
* @program: spring-parent
* @description: RestTemplate拦截器
* @create: 2020/08/17
*/
public class HttpClientInterceptor implements ClientHttpRequestInterceptor {
private AsyncLogHttpClientService asyncLogHttpClientService;
public HttpClientInterceptor(AsyncLogHttpClientService asyncLogHttpClientService) {
this.asyncLogHttpClientService = asyncLogHttpClientService;
}
/**
* RestTemplate拦截方法
*
* @param request
* @param body
* @param execution
* @return
* @throws IOException
*/
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
//创建拦截日志信息
AsyncLogHttpClientRequest asyncLogHttpClientRequest = new AsyncLogHttpClientRequest();
//生成事物流水号
asyncLogHttpClientRequest.setTraceId(RequestUtils.getRequest().getAttribute("T_ID") == null ? null : String.valueOf(RequestUtils.getRequest().getAttribute("T_ID")));
//请求时间
asyncLogHttpClientRequest.setRequestTime(new Date());
//请求URL
asyncLogHttpClientRequest.setRequestUrl(StringUtils.substringBefore(request.getURI().toString(), CharacterUtils.ASK_SIGN_EN));
//请求方法
asyncLogHttpClientRequest.setMethod(request.getMethodValue());
//请求参数
asyncLogHttpClientRequest.setRequestParams(ArrayUtils.isNotEmpty(body) ? RequestUtils.getParameterMap(body) : RequestUtils.convertParameterToMap(StringUtils.substringAfter(request.getURI().toString(), CharacterUtils.ASK_SIGN_EN)));
//请求类型 ContentType
asyncLogHttpClientRequest.setContentType(Objects.nonNull(request.getHeaders().getContentType()) ? request.getHeaders().getContentType().toString() : MediaType.APPLICATION_JSON_VALUE);
//请求协议
asyncLogHttpClientRequest.setProtocol(RequestUtils.getRequest().getProtocol());
//记录请求日志
asyncLogHttpClientService.traceRequest(asyncLogHttpClientRequest);
try {
//新建计时器并开始计时
StopWatch stopWatch = StopWatch.createStarted();
//调用接口
ClientHttpResponse response = execution.execute(request, body);
//暂停计时
stopWatch.stop();
//响应数据
Object responseBody = RequestUtils.getResponseBody(StreamUtils.copyToByteArray(response.getBody()));
AsyncLogHttpClientResponse asyncLogHttpClientResponse = new AsyncLogHttpClientResponse();
//设置基础数据
asyncLogHttpClientResponse.setBaseLog(asyncLogHttpClientRequest);
//耗时
asyncLogHttpClientResponse.setSpentTime(stopWatch.getTime());
//响应时间
asyncLogHttpClientResponse.setResponseTime(new Date());
//响应结果
asyncLogHttpClientResponse.setResponseBody(responseBody);
//
asyncLogHttpClientResponse.setDataSize(ObjectSizeUtil.getObjectSizeUnit(responseBody));
//记录响应日志
asyncLogHttpClientService.traceResponse(asyncLogHttpClientResponse);
return response;
} catch (IOException e) {
AsyncLogHttpClientResponse asyncLogHttpClientResponse = new AsyncLogHttpClientResponse();
//设置基础数据
asyncLogHttpClientResponse.setBaseLog(asyncLogHttpClientRequest);
//耗时
asyncLogHttpClientResponse.setSpentTime(0);
//响应时间
asyncLogHttpClientResponse.setResponseTime(new Date());
//响应结果
asyncLogHttpClientResponse.setResponseBody(e.getMessage());
//记录响应日志
asyncLogHttpClientService.traceResponse(asyncLogHttpClientResponse);
throw e;
}
}
}
| [
"[email protected]"
]
| |
19a9b00e245f46b081e1a89003e05ea09d554642 | b61296555d47ab1c0b258d0c5326a38c8c18a4f2 | /test/com/facebook/buck/rules/modern/impl/AbstractValueVisitorTest.java | ca3244d6ea803fa08b350586178a7f426c1491f2 | [
"Apache-2.0"
]
| permissive | lyft/buck | 0abe826d62ac1d046aba4518b9c6c2a69358462a | 5543d7236fb4ba932a692a67926c404f33676ac2 | refs/heads/master | 2023-08-20T12:09:30.454709 | 2019-08-15T15:28:18 | 2019-08-15T16:36:13 | 110,744,548 | 1 | 1 | Apache-2.0 | 2020-10-28T16:27:03 | 2017-11-14T21:04:49 | Java | UTF-8 | Java | false | false | 16,482 | java | /*
* Copyright 2018-present Facebook, 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 com.facebook.buck.rules.modern.impl;
import com.facebook.buck.core.build.context.BuildContext;
import com.facebook.buck.core.model.BuildTarget;
import com.facebook.buck.core.model.BuildTargetFactory;
import com.facebook.buck.core.model.ConfigurationForConfigurationTargets;
import com.facebook.buck.core.model.EmptyTargetConfiguration;
import com.facebook.buck.core.model.TargetConfiguration;
import com.facebook.buck.core.model.UnconfiguredBuildTargetFactoryForTests;
import com.facebook.buck.core.model.impl.HostTargetConfiguration;
import com.facebook.buck.core.model.impl.ImmutableDefaultTargetConfiguration;
import com.facebook.buck.core.rulekey.AddToRuleKey;
import com.facebook.buck.core.rulekey.AddsToRuleKey;
import com.facebook.buck.core.rulekey.DefaultFieldInputs;
import com.facebook.buck.core.rulekey.DefaultFieldSerialization;
import com.facebook.buck.core.rulekey.ExcludeFromRuleKey;
import com.facebook.buck.core.rulekey.IgnoredFieldInputs;
import com.facebook.buck.core.sourcepath.DefaultBuildTargetSourcePath;
import com.facebook.buck.core.sourcepath.ExplicitBuildTargetSourcePath;
import com.facebook.buck.core.sourcepath.FakeSourcePath;
import com.facebook.buck.core.sourcepath.NonHashableSourcePathContainer;
import com.facebook.buck.core.sourcepath.SourcePath;
import com.facebook.buck.core.util.immutables.BuckStyleImmutable;
import com.facebook.buck.core.util.immutables.BuckStyleTuple;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.io.filesystem.impl.FakeProjectFilesystem;
import com.facebook.buck.rules.args.AddsToRuleKeyFunction;
import com.facebook.buck.rules.modern.BuildCellRelativePathFactory;
import com.facebook.buck.rules.modern.Buildable;
import com.facebook.buck.rules.modern.EmptyMemoizerDeserialization;
import com.facebook.buck.rules.modern.OutputPath;
import com.facebook.buck.rules.modern.OutputPathResolver;
import com.facebook.buck.rules.modern.PublicOutputPath;
import com.facebook.buck.step.Step;
import com.facebook.buck.util.Memoizer;
import com.facebook.buck.util.MoreSuppliers;
import com.facebook.buck.util.types.Either;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ImmutableSortedSet;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.function.Supplier;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
import org.immutables.value.Value;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public abstract class AbstractValueVisitorTest {
private static final Path absoluteRoot = Paths.get(".").toAbsolutePath();
protected static final ProjectFilesystem rootFilesystem =
new FakeProjectFilesystem(absoluteRoot.resolve(Paths.get("project/root")));
protected static final ProjectFilesystem otherFilesystem =
new FakeProjectFilesystem(absoluteRoot.resolve(Paths.get("project/other")));
private static final TargetConfiguration TARGET_CONFIGURATION =
ImmutableDefaultTargetConfiguration.of(
BuildTargetFactory.newInstance(otherFilesystem.getRootPath(), "//platform:platform"));
protected static final BuildTarget someBuildTarget =
UnconfiguredBuildTargetFactoryForTests.newInstance(
otherFilesystem.getRootPath(), "other//some:target#flavor1,flavor2")
.configure(TARGET_CONFIGURATION);
@Rule public ExpectedException expectedException = ExpectedException.none();
@Test
public abstract void outputPath() throws Exception;
@Test
public abstract void sourcePath() throws Exception;
@Test
public abstract void set() throws Exception;
@Test
public abstract void sortedSet() throws Exception;
@Test
public abstract void list() throws Exception;
@Test
public abstract void optional() throws Exception;
@Test
public abstract void simple() throws Exception;
@Test
public abstract void superClass() throws Exception;
@Test
public abstract void empty() throws Exception;
@Test
public abstract void addsToRuleKey() throws Exception;
@Test
public abstract void complex() throws Exception;
@Test
public abstract void buildTarget() throws Exception;
@Test
public abstract void buildTargetWithEmptyConfiguration() throws Exception;
@Test
public abstract void buildTargetWithConfigurationForConfigurationTargets() throws Exception;
@Test
public abstract void buildTargetWithHostConfiguration() throws Exception;
@Test
public abstract void pattern() throws Exception;
@Test
public abstract void anEnum() throws Exception;
@Test
public abstract void nonHashableSourcePathContainer() throws Exception;
@Test
public abstract void map() throws Exception;
@Test
public abstract void sortedMap() throws Exception;
@Test
public abstract void supplier() throws Exception;
@Test
public abstract void nullable() throws Exception;
@Test
public abstract void either() throws Exception;
@Test
public abstract void excluded() throws Exception;
@Test
public abstract void stringified() throws Exception;
@Test
public abstract void immutables() throws Exception;
@Test
public abstract void wildcards() throws Exception;
@Test
public abstract void withExcludeFromRuleKey() throws Exception;
public interface FakeBuildable extends Buildable {
@Override
default ImmutableList<Step> getBuildSteps(
BuildContext buildContext,
ProjectFilesystem filesystem,
OutputPathResolver outputPathResolver,
BuildCellRelativePathFactory buildCellPathFactory) {
return ImmutableList.of();
}
}
public static class WithExcludeFromRuleKey implements FakeBuildable {
@ExcludeFromRuleKey(
serialization = DefaultFieldSerialization.class,
inputs = DefaultFieldInputs.class)
final SourcePath sourcePath = FakeSourcePath.of(rootFilesystem, "some.path");
@ExcludeFromRuleKey(
serialization = EmptyMemoizerDeserialization.class,
inputs = IgnoredFieldInputs.class)
final Memoizer<SourcePath> otherPath = new Memoizer<>();
}
public static class WithExcluded implements FakeBuildable {
final String excluded = "excluded";
final String nullNotAnnoted = null;
}
public static class WithStringified implements FakeBuildable {
@AddToRuleKey(stringify = true)
final Optional<String> stringified = Optional.of("value");
}
public static class WithEither implements FakeBuildable {
@AddToRuleKey final Either<String, SourcePath> leftString = Either.ofLeft("left");
@AddToRuleKey
final Either<String, SourcePath> rightPath =
Either.ofRight(FakeSourcePath.of(rootFilesystem, "some.path"));
}
public static class WithNullable implements FakeBuildable {
@AddToRuleKey @Nullable final String nullString = null;
@AddToRuleKey @Nullable final SourcePath nullPath = null;
@AddToRuleKey @Nullable
final SourcePath nonNullPath = FakeSourcePath.of(rootFilesystem, "some.path");
}
public static class WithSupplier implements FakeBuildable {
@AddToRuleKey final Supplier<String> stringSupplier = Suppliers.ofInstance("string");
@AddToRuleKey
final Supplier<SourcePath> weakPath =
MoreSuppliers.memoize(() -> FakeSourcePath.of(rootFilesystem, "some.path"));
}
public static class WithMap implements FakeBuildable {
@AddToRuleKey final ImmutableMap<String, String> emptyMap = ImmutableMap.of();
@AddToRuleKey
final ImmutableMap<String, SourcePath> pathMap =
ImmutableMap.of(
"path",
FakeSourcePath.of(rootFilesystem, "some/path"),
"target",
ExplicitBuildTargetSourcePath.of(someBuildTarget, Paths.get("other.path")));
}
public static class WithSortedMap implements FakeBuildable {
@AddToRuleKey final ImmutableSortedMap<String, String> emptyMap = ImmutableSortedMap.of();
@AddToRuleKey
final ImmutableSortedMap<String, SourcePath> pathMap =
ImmutableSortedMap.of(
"path",
FakeSourcePath.of(rootFilesystem, "some/path"),
"target",
ExplicitBuildTargetSourcePath.of(someBuildTarget, Paths.get("other.path")));
}
public static class WithBuildTarget implements FakeBuildable {
@AddToRuleKey final BuildTarget target = someBuildTarget;
}
public static class WithBuildTargetWithEmptyConfiguration implements FakeBuildable {
@AddToRuleKey
final BuildTarget target =
someBuildTarget
.getUnconfiguredBuildTargetView()
.configure(EmptyTargetConfiguration.INSTANCE);
}
public static class WithBuildTargetWithConfigurationForConfigurationTargets
implements FakeBuildable {
@AddToRuleKey
final BuildTarget target =
someBuildTarget
.getUnconfiguredBuildTargetView()
.configure(ConfigurationForConfigurationTargets.INSTANCE);
}
public static class WithBuildTargetWithHostConfiguration implements FakeBuildable {
@AddToRuleKey
final BuildTarget target =
someBuildTarget
.getUnconfiguredBuildTargetView()
.configure(HostTargetConfiguration.INSTANCE);
}
public static class WithOutputPath implements FakeBuildable {
@AddToRuleKey final OutputPath output = new OutputPath("some/path");
@AddToRuleKey
final PublicOutputPath publicOutput =
new PublicOutputPath(rootFilesystem.getPath("public.path"));
@AddToRuleKey
final OutputPath publicAsOutputPath =
new PublicOutputPath(rootFilesystem.getPath("other.public.path"));
}
public static class WithSourcePath implements FakeBuildable {
@AddToRuleKey final SourcePath path = FakeSourcePath.of(rootFilesystem, "some/path");
}
public static class WithNonHashableSourcePathContainer implements FakeBuildable {
@AddToRuleKey
final NonHashableSourcePathContainer container =
new NonHashableSourcePathContainer(FakeSourcePath.of(rootFilesystem, "some/path"));
}
public static class WithSet implements FakeBuildable {
@AddToRuleKey
private final ImmutableSet<String> present = ImmutableSet.of("hello", "world", "!");
@AddToRuleKey private final ImmutableSet<Integer> empty = ImmutableSet.of();
}
public static class WithSortedSet implements FakeBuildable {
@AddToRuleKey
private final ImmutableSortedSet<String> present =
ImmutableSortedSet.of("3hello", "1world", "2!");
@AddToRuleKey private final ImmutableSortedSet<Integer> empty = ImmutableSortedSet.of();
}
public static class WithList implements FakeBuildable {
@AddToRuleKey
private final ImmutableList<String> present = ImmutableList.of("hello", "world", "!");
@AddToRuleKey private final ImmutableList<Integer> empty = ImmutableList.of();
}
public static class WithOptional implements FakeBuildable {
@AddToRuleKey private final Optional<String> present = Optional.of("hello");
@AddToRuleKey private final Optional<String> empty = Optional.empty();
}
public static class Simple implements FakeBuildable {
@AddToRuleKey private final String string = "string";
@AddToRuleKey private final int integer = 1;
@AddToRuleKey private final Character character = 'c';
@AddToRuleKey private final float value = 2.50f;
@AddToRuleKey private final ImmutableList<Double> doubles = ImmutableList.of(1.1, 2.2, 3.3);
}
public static class Derived extends Simple {
@AddToRuleKey private final double number = 2.3;
}
public static class TwiceDerived extends Derived {
@AddToRuleKey private final int number = 3;
}
public static class Empty implements FakeBuildable {}
public static class Appendable implements AddsToRuleKey {
@AddToRuleKey final SourcePath sp = FakeSourcePath.of(rootFilesystem, "appendable.path");
}
public static class NestedAppendable implements AddsToRuleKey {
@AddToRuleKey final Optional<Appendable> appendable = Optional.of(new Appendable());
}
public static class WithAddsToRuleKey implements FakeBuildable {
@AddToRuleKey final NestedAppendable nested = new NestedAppendable();
@AddToRuleKey @Nullable final AddsToRuleKeyFunction<String, String> function = null;
@AddToRuleKey
private final ImmutableList<AddsToRuleKey> list =
ImmutableList.of(new Appendable(), new Appendable());
}
public static class WithPattern implements FakeBuildable {
@AddToRuleKey final Pattern pattern = Pattern.compile("abcd");
}
enum Type {
GOOD,
BAD
}
public static class WithEnum implements FakeBuildable {
@AddToRuleKey final Type type = Type.GOOD;
@AddToRuleKey final Optional<Type> otherType = Optional.of(Type.BAD);
}
public static class Complex implements FakeBuildable {
@AddToRuleKey
final Optional<ImmutableList<ImmutableSortedSet<SourcePath>>> value =
Optional.of(
ImmutableList.of(
ImmutableSortedSet.of(),
ImmutableSortedSet.of(
FakeSourcePath.of(rootFilesystem, "some/path"),
DefaultBuildTargetSourcePath.of(
BuildTargetFactory.newInstance(
rootFilesystem.getRootPath(), "//some/build:target")))));
@AddToRuleKey private final String string = "hello";
@AddToRuleKey private final int number = 0;
@AddToRuleKey
final ImmutableList<OutputPath> outputs =
ImmutableList.of(new OutputPath("hello.txt"), new OutputPath("world.txt"));
@AddToRuleKey final OutputPath otherOutput = new OutputPath("other.file");
@AddToRuleKey final AddsToRuleKey appendable = new Appendable();
}
@BuckStyleTuple
@Value.Immutable
interface AbstractTupleInterfaceData extends AddsToRuleKey {
@AddToRuleKey
SourcePath getFirst();
@AddToRuleKey
String getSecond();
}
@BuckStyleImmutable
@Value.Immutable
interface AbstractImmutableInterfaceData extends AddsToRuleKey {
@AddToRuleKey
SourcePath getFirst();
@AddToRuleKey
String getSecond();
}
@BuckStyleTuple
@Value.Immutable
abstract static class AbstractTupleClassData implements AddsToRuleKey {
@AddToRuleKey
abstract SourcePath getFirst();
@AddToRuleKey
abstract String getSecond();
}
@BuckStyleImmutable
@Value.Immutable
abstract static class AbstractImmutableClassData implements AddsToRuleKey {
@AddToRuleKey
abstract SourcePath getFirst();
@AddToRuleKey
abstract String getSecond();
}
static class WithImmutables implements FakeBuildable {
@AddToRuleKey
private final TupleInterfaceData tupleInterfaceData =
TupleInterfaceData.of(FakeSourcePath.of(rootFilesystem, "first.path"), "world");
@AddToRuleKey
private final ImmutableInterfaceData immutableInterfaceData =
ImmutableInterfaceData.builder()
.setFirst(FakeSourcePath.of(rootFilesystem, "second.path"))
.setSecond("world")
.build();
@AddToRuleKey
private final TupleClassData tupleClassData =
TupleClassData.of(FakeSourcePath.of(rootFilesystem, "third.path"), "world");
@AddToRuleKey
private final ImmutableClassData immutableClassData =
ImmutableClassData.builder()
.setFirst(FakeSourcePath.of(rootFilesystem, "fourth.path"))
.setSecond("world")
.build();
}
static class WithWildcards implements FakeBuildable {
@AddToRuleKey private final Optional<? extends SourcePath> path = Optional.empty();
@AddToRuleKey
private final ImmutableList<? extends AddsToRuleKey> appendables =
ImmutableList.of(new Appendable());
}
}
| [
"[email protected]"
]
| |
917e0fd92f3104b257cb607affe5effd111cad23 | 2d64e59c56fc80598af75e7b7f42dca8d009b164 | /java-concurrent/src/main/java/wrx/xing/Demo1.java | 1b57174e5580e646ab0f9484552927c17287c80e | []
| no_license | jonay930128/java-base | e36744533ecdd9e45f6144bdbd8a2c137ebb4208 | 4b6bc0d2a43606693199253260d0b913eb510184 | refs/heads/master | 2021-07-05T07:34:53.138173 | 2020-02-22T08:40:18 | 2020-02-22T08:40:18 | 180,376,195 | 0 | 0 | null | 2020-10-13T12:46:22 | 2019-04-09T13:43:34 | Java | UTF-8 | Java | false | false | 859 | java | package wrx.xing;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 请填写类的描述
*
* @author wangruxing
* @date 2020-02-06 14:24
*/
public class Demo1 {
public static void main(String[] args) throws InterruptedException {
CountDownLatch latch = new CountDownLatch(10);
Ticket ticket = new Ticket();
for (int i = 0; i < 10; i++) {
new Thread(() -> {
while (ticket.bugTicket()) {}
latch.countDown();
},i + "").start();
}
latch.await();
System.out.println("票卖光了");
}
}
class Ticket {
private AtomicInteger tickets = new AtomicInteger(1000);
boolean bugTicket() {
if (tickets.get() == 0) {
return false;
}
System.out.println(Thread.currentThread().getName() + "抢到了票,剩余票是:" + tickets.decrementAndGet());
return true;
}
} | [
"[email protected]"
]
| |
6a6b1644e38aa325854a9e0a9ce1618a3c13d6bb | 3db9e445576ba4926c48de2b02b2c5949c51a443 | /app/src/main/java/com/example/assignment3/ReportClassJavaDB/Report.java | 3b6893b74f6b0b39674fe22193c6f26724397d56 | []
| no_license | hongdaxie/FIT5046AndroidClientSide | b36adccb1540fdc3af6e293d6064893d7a7dd3ca | 7a5819498e37086152a8c8668da3e184afb39a60 | refs/heads/master | 2020-06-17T16:38:53.072125 | 2019-11-18T07:21:25 | 2019-11-18T07:21:25 | 195,977,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,609 | java | package com.example.assignment3.ReportClassJavaDB;
import com.example.assignment3.Users;
import java.util.Date;
public class Report {
private Integer id;
private Date date;
private Integer totalCaloriesConsumed;
private Integer totalCaloriesBurned;
private Integer totalStepsTaken;
private Integer calorieGoal;
private Users userId;
public Report() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Integer getTotalCaloriesConsumed() {
return totalCaloriesConsumed;
}
public void setTotalCaloriesConsumed(Integer totalCaloriesConsumed) {
this.totalCaloriesConsumed = totalCaloriesConsumed;
}
public Integer getTotalCaloriesBurned() {
return totalCaloriesBurned;
}
public void setTotalCaloriesBurned(Integer totalCaloriesBurned) {
this.totalCaloriesBurned = totalCaloriesBurned;
}
public Integer getTotalStepsTaken() {
return totalStepsTaken;
}
public void setTotalStepsTaken(Integer totalStepsTaken) {
this.totalStepsTaken = totalStepsTaken;
}
public Integer getCalorieGoal() {
return calorieGoal;
}
public void setCalorieGoal(Integer calorieGoal) {
this.calorieGoal = calorieGoal;
}
public Users getUserId() {
return userId;
}
public void setUserId(Users userId) {
this.userId = userId;
}
}
| [
"[email protected]"
]
| |
ee32d4c17fb506c53c187ed14e9533e6854b8f92 | e4093f88e161820d2b97fb5ec4e3257fe51c48fa | /src/main/java/org/jrapidoc/example/exception/AirserviceException.java | 77d49645a4903f53866b224cbae4047e4b1c77d5 | [
"Apache-2.0"
]
| permissive | sarzwest/jrapidoc-example-app | 53c99a05d356acab12ee81fb7d9a251a56f33cd2 | 736adad817d06bbb7e26f8f5011e6e3c00bfe962 | refs/heads/master | 2020-04-07T05:51:16.190499 | 2015-07-22T20:10:41 | 2015-07-22T20:10:41 | 35,078,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package org.jrapidoc.example.exception;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* Created by papa on 3.2.15.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MyException", propOrder = {
"message"
})
public class AirserviceException {
protected String message;
public String getMessage() {
return message;
}
public AirserviceException setMessage(String value) {
this.message = value;
return this;
}
}
| [
"[email protected]"
]
| |
aec2922370b17d226ed6fdf86fa31f94b8ad0841 | 89704a5509c1e57ad9a96c12fffafc7c7306762a | /app/src/main/java/com/mingmen/canting/util/DESUtil.java | 27e702ad428bd9459fce5582e875096f1cc2994d | []
| no_license | yuanchongzhang/0803Canchengxiang | 2f8e0deb7c3fa677af7158a132ad69e4b5cb5b70 | 28d0d01c37258487c10428ab4c898e6ad57009f5 | refs/heads/master | 2022-11-27T07:46:25.629181 | 2020-08-03T09:32:53 | 2020-08-03T09:32:53 | 284,658,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,416 | java | package com.mingmen.canting.util;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.Key;
import java.security.SecureRandom;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
public class DESUtil {
/**
* 加密
* @param datasource byte[]
* @param password String
* @return byte[]
*/
public static byte[] encrypt(byte[] datasource, String password) {
try{
SecureRandom random = new SecureRandom();
DESKeySpec desKey = new DESKeySpec(password.getBytes());
//创建一个密匙工厂,然后用它把DESKeySpec转换成
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey securekey = keyFactory.generateSecret(desKey);
//Cipher对象实际完成加密操作
Cipher cipher = Cipher.getInstance("DES");
//用密匙初始化Cipher对象
cipher.init(Cipher.ENCRYPT_MODE, securekey, random);
//现在,获取数据并加密
//正式执行加密操作
return cipher.doFinal(datasource);
}catch(Throwable e){
e.printStackTrace();
}
return null;
}
/**
* 解密
* @param src byte[]
* @param password String
* @return byte[]
* @throws Exception
*/
public static byte[] decrypt(byte[] src, String password) throws Exception {
// DES算法要求有一个可信任的随机数源
SecureRandom random = new SecureRandom();
// 创建一个DESKeySpec对象
DESKeySpec desKey = new DESKeySpec(password.getBytes());
// 创建一个密匙工厂
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
// 将DESKeySpec对象转换成SecretKey对象
SecretKey securekey = keyFactory.generateSecret(desKey);
// Cipher对象实际完成解密操作
Cipher cipher = Cipher.getInstance("DES");
// 用密匙初始化Cipher对象
cipher.init(Cipher.DECRYPT_MODE, securekey, random);
// 真正开始解密操作
return cipher.doFinal(src);
}
}
| [
"[email protected]"
]
| |
59c2b30be22f35617e3be894a94c6f6985b2b92f | 2e607cfdcaf6b170b42d1277a9eae6a8943c582f | /app/src/main/java/olyapps/sathv/fbla2020/CalendarCallback.java | 31efa50ebde8cda27316ab62bec78d479610eda2 | []
| no_license | sathviknallamalli/FBLA2020 | 59340e70db9a9642ee672fadee4c34d2e439c5a1 | 87f925ea51758af6e38824b55f812b62f60f6a5e | refs/heads/master | 2023-03-24T11:31:52.500595 | 2021-03-19T06:44:42 | 2021-03-19T06:44:42 | 251,445,372 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 113 | java | package olyapps.sathv.fbla2020;
public interface CalendarCallback {
void onCallback(Boolean canofficer);
}
| [
"[email protected]"
]
| |
93ce503d9307ca5bcd5177f159541b65c86c0729 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_e66b7bfa1bcc3f7374c0adfd47c15ef7f3e4bc37/LdifSearchLogger/11_e66b7bfa1bcc3f7374c0adfd47c15ef7f3e4bc37_LdifSearchLogger_t.java | fc214153cf4850d5dbf6f8826b4ac91bd83c62db | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 21,900 | java | /*
* 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.directory.studio.connection.core.io.jndi;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.Control;
import org.apache.commons.lang.StringUtils;
import org.apache.directory.shared.ldap.model.message.Referral;
import org.apache.directory.shared.ldap.model.url.LdapUrl;
import org.apache.directory.shared.util.DateUtils;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
import org.apache.directory.studio.connection.core.ConnectionManager;
import org.apache.directory.studio.connection.core.IJndiLogger;
import org.apache.directory.studio.connection.core.Utils;
import org.apache.directory.studio.ldifparser.LdifFormatParameters;
import org.apache.directory.studio.ldifparser.model.container.LdifContentRecord;
import org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifCommentLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifLineBase;
import org.apache.directory.studio.ldifparser.model.lines.LdifSepLine;
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
/**
* The LdifSearchLogger is used to log searches into a file.
*
* @author <a href="mailto:[email protected]">Apache Directory Project</a>
*/
public class LdifSearchLogger implements IJndiLogger
{
/** The ID. */
private String id;
/** The name. */
private String name;
/** The description. */
private String description;
/** The file handlers. */
private Map<String, FileHandler> fileHandlers = new HashMap<String, FileHandler>();
/** The loggers. */
private Map<String, Logger> loggers = new HashMap<String, Logger>();
/**
* Creates a new instance of LdifSearchLogger.
*/
public LdifSearchLogger()
{
ConnectionCorePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(
new IPropertyChangeListener()
{
public void propertyChange( PropertyChangeEvent event )
{
if ( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT.equals( event.getProperty() )
|| ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE.equals( event.getProperty() ) )
{
// dispose all loggers/handlers
for ( Logger logger : loggers.values() )
{
for ( Handler handler : logger.getHandlers() )
{
handler.close();
}
}
// delete files with index greater than new file count
for ( FileHandler fh : fileHandlers.values() )
{
try
{
File[] logFiles = getLogFiles( fh );
for ( int i = getFileCount(); i < logFiles.length; i++ )
{
if ( logFiles[i] != null && logFiles[i].exists() )
{
logFiles[i].delete();
}
}
}
catch ( Exception e )
{
}
}
loggers.clear();
}
}
} );
}
/**
* Inits the search logger.
*/
private void initSearchLogger( Connection connection )
{
Logger logger = Logger.getAnonymousLogger();
loggers.put( connection.getId(), logger );
logger.setLevel( Level.ALL );
String logfileName = ConnectionManager.getSearchLogFileName( connection );
try
{
FileHandler fileHandler = new FileHandler( logfileName, getFileSizeInKb() * 1000, getFileCount(), true );
fileHandlers.put( connection.getId(), fileHandler );
fileHandler.setFormatter( new Formatter()
{
public String format( LogRecord record )
{
return record.getMessage();
}
} );
logger.addHandler( fileHandler );
}
catch ( SecurityException e )
{
e.printStackTrace();
}
catch ( IOException e )
{
e.printStackTrace();
}
}
/**
* Disposes the search logger of the given connection.
*
* @param connection the connection
*/
public void dispose( Connection connection )
{
String id = connection.getId();
if ( loggers.containsKey( id ) )
{
Handler[] handlers = loggers.get( id ).getHandlers();
for ( Handler handler : handlers )
{
handler.close();
}
loggers.remove( id );
}
}
/**
* Logs the given text to the search logger of the given connection.
*
* @param text the text to log
* @param type the type, either SEARCH REQUEST or SEARCH RESULT
* @param ex the naming exception if an error occurred, null otherwise
* @param connection the connection
*/
private void log( String text, String type, NamingException ex, Connection connection )
{
String id = connection.getId();
if ( !loggers.containsKey( id ) )
{
if ( connection.getName() != null )
{
initSearchLogger( connection );
}
}
if ( loggers.containsKey( id ) )
{
Logger logger = loggers.get( id );
DateFormat df = new SimpleDateFormat( ConnectionCoreConstants.DATEFORMAT );
df.setTimeZone( DateUtils.UTC_TIME_ZONE );
if ( ex != null )
{
logger.log( Level.ALL, LdifCommentLine
.create( "#!" + type + " ERROR" ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
else
{
logger.log( Level.ALL, LdifCommentLine
.create( "#!" + type + " OK" ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$ //$NON-NLS-2$
}
logger
.log(
Level.ALL,
LdifCommentLine
.create( "#!CONNECTION ldap://" + connection.getHost() + ":" + connection.getPort() ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$ //$NON-NLS-2$
logger.log( Level.ALL, LdifCommentLine
.create( "#!DATE " + df.format( new Date() ) ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$
if ( ex != null )
{
String errorComment = "#!ERROR " + ex.getMessage(); //$NON-NLS-1$
errorComment = errorComment.replaceAll( "\r", " " ); //$NON-NLS-1$ //$NON-NLS-2$
errorComment = errorComment.replaceAll( "\n", " " ); //$NON-NLS-1$ //$NON-NLS-2$
LdifCommentLine errorCommentLine = LdifCommentLine.create( errorComment );
logger.log( Level.ALL, errorCommentLine.toFormattedString( LdifFormatParameters.DEFAULT ) );
}
logger.log( Level.ALL, text );
}
}
/**
* {@inheritDoc}
*/
public void logChangetypeAdd( Connection connection, final String dn, final Attributes attributes,
final Control[] controls, NamingException ex )
{
// don't log changetypes
}
/**
* {@inheritDoc}
*/
public void logChangetypeDelete( Connection connection, final String dn, final Control[] controls,
NamingException ex )
{
// don't log changetypes
}
/**
* {@inheritDoc}
*/
public void logChangetypeModify( Connection connection, final String dn,
final ModificationItem[] modificationItems, final Control[] controls, NamingException ex )
{
// don't log changetypes
}
/**
* {@inheritDoc}
*/
public void logChangetypeModDn( Connection connection, final String oldDn, final String newDn,
final boolean deleteOldRdn, final Control[] controls, NamingException ex )
{
// don't log changetypes
}
/**
* {@inheritDoc}
*/
public void logSearchRequest( Connection connection, String searchBase, String filter,
SearchControls searchControls, AliasDereferencingMethod aliasesDereferencingMethod, Control[] controls,
long requestNum, NamingException ex )
{
if ( !isSearchRequestLogEnabled() )
{
return;
}
String scopeAsString = searchControls.getSearchScope() == SearchControls.SUBTREE_SCOPE ? "wholeSubtree (2)" //$NON-NLS-1$
: searchControls.getSearchScope() == SearchControls.ONELEVEL_SCOPE ? "singleLevel (1)" : "baseObject (0)"; //$NON-NLS-1$ //$NON-NLS-2$
String attributesAsString = searchControls.getReturningAttributes() == null ? "*" : searchControls //$NON-NLS-1$
.getReturningAttributes().length == 0 ? "1.1" : StringUtils.join( searchControls.getReturningAttributes(), //$NON-NLS-1$
" " ); //$NON-NLS-1$
String aliasAsString = aliasesDereferencingMethod == AliasDereferencingMethod.ALWAYS ? "derefAlways (3)" //$NON-NLS-1$
: aliasesDereferencingMethod == AliasDereferencingMethod.FINDING ? "derefFindingBaseObj (2)" //$NON-NLS-1$
: aliasesDereferencingMethod == AliasDereferencingMethod.SEARCH ? "derefInSearching (1)" //$NON-NLS-1$
: "neverDerefAliases (0)"; //$NON-NLS-1$
// build LDAP URL
LdapUrl url = Utils.getLdapURL( connection, searchBase, searchControls.getSearchScope(), filter, searchControls
.getReturningAttributes() );
// build command line
String cmdLine = Utils.getLdapSearchCommandLine( connection, searchBase, searchControls.getSearchScope(),
aliasesDereferencingMethod, searchControls.getCountLimit(), searchControls.getTimeLimit(), filter,
searchControls.getReturningAttributes() );
// build
Collection<LdifLineBase> lines = new ArrayList<LdifLineBase>();
lines.add( LdifCommentLine.create( "# LDAP URL : " + url.toString() ) ); //$NON-NLS-1$
lines.add( LdifCommentLine.create( "# command line : " + cmdLine.toString() ) ); //$NON-NLS-1$
lines.add( LdifCommentLine.create( "# baseObject : " + searchBase ) ); //$NON-NLS-1$
lines.add( LdifCommentLine.create( "# scope : " + scopeAsString ) ); //$NON-NLS-1$
lines.add( LdifCommentLine.create( "# derefAliases : " + aliasAsString ) ); //$NON-NLS-1$
lines.add( LdifCommentLine.create( "# sizeLimit : " + searchControls.getCountLimit() ) ); //$NON-NLS-1$
lines.add( LdifCommentLine.create( "# timeLimit : " + searchControls.getTimeLimit() ) ); //$NON-NLS-1$
lines.add( LdifCommentLine.create( "# typesOnly : " + "False" ) ); //$NON-NLS-1$ //$NON-NLS-2$
lines.add( LdifCommentLine.create( "# filter : " + filter ) ); //$NON-NLS-1$
lines.add( LdifCommentLine.create( "# attributes : " + attributesAsString ) ); //$NON-NLS-1$
if ( controls != null )
{
for ( Control control : controls )
{
lines.add( LdifCommentLine.create( "# control : " + control.getID() ) ); //$NON-NLS-1$
}
}
lines.add( LdifSepLine.create() );
String formattedString = ""; //$NON-NLS-1$
for ( LdifLineBase line : lines )
{
formattedString += line.toFormattedString( LdifFormatParameters.DEFAULT );
}
log( formattedString, "SEARCH REQUEST (" + requestNum + ")", ex, connection ); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void logSearchResultEntry( Connection connection, StudioSearchResult studioSearchResult, long requestNum,
NamingException ex )
{
if ( !isSearchResultEntryLogEnabled() )
{
return;
}
try
{
String formattedString;
if ( studioSearchResult != null )
{
String dn = studioSearchResult.getNameInNamespace();
Attributes attributes = studioSearchResult.getAttributes();
LdifContentRecord record = new LdifContentRecord( LdifDnLine.create( dn ) );
NamingEnumeration<? extends Attribute> attributeEnumeration = attributes.getAll();
while ( attributeEnumeration.hasMore() )
{
Attribute attribute = attributeEnumeration.next();
String attributeName = attribute.getID();
NamingEnumeration<?> valueEnumeration = attribute.getAll();
while ( valueEnumeration.hasMore() )
{
Object o = valueEnumeration.next();
if ( o instanceof String )
{
record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) );
}
if ( o instanceof byte[] )
{
record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) );
}
}
}
record.finish( LdifSepLine.create() );
formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT );
}
else
{
formattedString = LdifFormatParameters.DEFAULT.getLineSeparator();
}
log( formattedString, "SEARCH RESULT ENTRY (" + requestNum + ")", ex, connection ); //$NON-NLS-1$ //$NON-NLS-2$
}
catch ( NamingException e )
{
}
}
/**
* {@inheritDoc}
*/
public void logSearchResultReference( Connection connection, Referral referral,
ReferralsInfo referralsInfo, long requestNum, NamingException ex )
{
if ( !isSearchResultEntryLogEnabled() )
{
return;
}
Collection<LdifLineBase> lines = new ArrayList<LdifLineBase>();
lines.add( LdifCommentLine.create( "# reference : " + ( referral != null ? referral.getLdapUrls() : "null" ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
lines.add( LdifSepLine.create() );
String formattedString = ""; //$NON-NLS-1$
for ( LdifLineBase line : lines )
{
formattedString += line.toFormattedString( LdifFormatParameters.DEFAULT );
}
log( formattedString, "SEARCH RESULT REFERENCE (" + requestNum + ")", ex, connection ); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* {@inheritDoc}
*/
public void logSearchResultDone( Connection connection, long count, long requestNum, NamingException ex )
{
if ( !isSearchRequestLogEnabled() )
{
return;
}
Collection<LdifLineBase> lines = new ArrayList<LdifLineBase>();
lines.add( LdifCommentLine.create( "# numEntries : " + count ) ); //$NON-NLS-1$
lines.add( LdifSepLine.create() );
String formattedString = ""; //$NON-NLS-1$
for ( LdifLineBase line : lines )
{
formattedString += line.toFormattedString( LdifFormatParameters.DEFAULT );
}
log( formattedString, "SEARCH RESULT DONE (" + requestNum + ")", ex, connection ); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* Gets the files.
*
* @param connection the connection
*
* @return the files
*/
public File[] getFiles( Connection connection )
{
String id = connection.getId();
if ( !loggers.containsKey( id ) )
{
if ( connection.getName() != null )
{
initSearchLogger( connection );
}
}
try
{
return getLogFiles( fileHandlers.get( id ) );
}
catch ( Exception e )
{
return new File[0];
}
}
/**
* Gets the log files.
*
* @param fileHandler the file handler
*
* @return the log files
*
* @throws Exception the exception
*/
private static File[] getLogFiles( FileHandler fileHandler ) throws Exception
{
Field field = getFieldFromClass( "java.util.logging.FileHandler", "files" ); //$NON-NLS-1$ //$NON-NLS-2$
field.setAccessible( true );
File[] files = ( File[] ) field.get( fileHandler );
return files;
}
/**
* Gets the field from class.
*
* @param className the class name
* @param fieldName the field name
*
* @return the field from class
*
* @throws Exception the exception
*/
private static Field getFieldFromClass( String className, String fieldName ) throws Exception
{
Class<?> clazz = Class.forName( className );
Field[] fields = clazz.getDeclaredFields();
for ( int i = 0; i < fields.length; i++ )
{
if ( fields[i].getName().equals( fieldName ) )
return fields[i];
}
return null;
}
/**
* Checks if search request log is enabled.
*
* @return true, if search request log is enabled
*/
private boolean isSearchRequestLogEnabled()
{
return ConnectionCorePlugin.getDefault().getPluginPreferences().getBoolean(
ConnectionCoreConstants.PREFERENCE_SEARCHREQUESTLOGS_ENABLE );
}
/**
* Checks if search result entry log is enabled.
*
* @return true, if search result log is enabled
*/
private boolean isSearchResultEntryLogEnabled()
{
return ConnectionCorePlugin.getDefault().getPluginPreferences().getBoolean(
ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE );
}
/**
* Gets the number of log files to use.
*
* @return the number of log files to use
*/
private int getFileCount()
{
return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT );
}
/**
* Gets the maximum file size in kB.
*
* @return the maximum file size in kB
*/
private int getFileSizeInKb()
{
return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE );
}
public String getId()
{
return id;
}
public void setId( String id )
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName( String name )
{
this.name = name;
}
public String getDescription()
{
return description;
}
public void setDescription( String description )
{
this.description = description;
}
}
| [
"[email protected]"
]
| |
f6dab435c2764099c9b6ee99676b1f5ba9a6a7bf | 37a53bf477ed3865fb70692d911bf078af85ea1c | /src/com/gxlt/myphoto/entity/User.java | d1aeebd020385ce3dd05dcc39f60670e09855689 | []
| no_license | poler2018/photo | be872745f4a303d9544f2ec68a3fec67eaf0e731 | 1ddfa28df16ddc1eac90c8b55f7bcbe850a8c0fb | refs/heads/master | 2021-04-28T03:48:20.553771 | 2018-04-27T06:01:44 | 2018-04-27T06:01:44 | 122,148,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package com.gxlt.myphoto.entity;
import java.util.ArrayList;
import java.util.List;
public class User {
private long id;
private String name;
private String password;
private List<PhotoSort> sort=new ArrayList<PhotoSort>();
private List<PhotoAlbum> album=new ArrayList<PhotoAlbum>();
public User() {
super();
}
public User(String name, String password) {
super();
this.name = name;
this.password = password;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<PhotoSort> getSort() {
return sort;
}
public void setSort(List<PhotoSort> sort) {
this.sort = sort;
}
public List<PhotoAlbum> getAlbum() {
return album;
}
public void setAlbum(List<PhotoAlbum> album) {
this.album = album;
}
@Override
public String toString() {
return "User [id=" + id + ", name=" + name + ", password=" + password + "]";
}
}
| [
"[email protected]"
]
| |
4e2d88ab74c547d17c142a34e1d9757a46e7fadb | 29af92aa8042f05c124a35c0df3fadd807787462 | /src/main/java/com/andymitchell/donationtracker/presentation/DonationFormInput.java | eb376b1a663def0e6640b93f1a702da4a11d48a2 | []
| no_license | amitchell94/donation-tracker | db7fa49f9e43d2f85fa46f79cb0285b9c3a2c704 | 63c4024e56f48bf651a55b21ae479effe0dbfec2 | refs/heads/master | 2020-04-04T21:20:34.128657 | 2018-11-06T20:16:44 | 2018-11-06T20:16:44 | 156,282,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,977 | java | package com.andymitchell.donationtracker.presentation;
import com.andymitchell.donationtracker.logic.Donation;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.time.Period;
public class DonationFormInput {
private int id;
private double amount;
private String charity;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate date;
private String currency;
private boolean recurring;
private int donationFrequency;
private String recurringPeriod;
private LocalDate endDate;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public String getCharity() {
return charity;
}
public void setCharity(String charity) {
this.charity = charity;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public boolean isRecurring() {
return recurring;
}
public void setRecurring(boolean recurring) {
this.recurring = recurring;
}
public int getDonationFrequency() {
return donationFrequency;
}
public void setDonationFrequency(int donationFrequency) {
this.donationFrequency = donationFrequency;
}
public String getRecurringPeriod() {
return recurringPeriod;
}
public void setRecurringPeriod(String recurringPeriod) {
this.recurringPeriod = recurringPeriod;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
}
| [
"[email protected]"
]
| |
0cd45f9015c4bfa33caa4f533123caeb80b72c37 | 4c0292f02334ba7ed85dfe6ce915842445a67866 | /src/com/github/miachm/sods/OdsWritter.java | 2a7e7080d6c0c67d225914c1e030dd263ae0542d | [
"Apache-2.0"
]
| permissive | charphi/SODS | 92c34bf06b5b88af09dd7ee9d7a464acf0ccf447 | 30824b66a805d491fb4f25eeb8432abb8a783d7e | refs/heads/master | 2020-07-21T08:45:53.138471 | 2019-08-03T12:19:51 | 2019-08-03T12:19:51 | 206,802,289 | 0 | 0 | Apache-2.0 | 2019-09-06T13:41:51 | 2019-09-06T13:41:51 | null | UTF-8 | Java | false | false | 13,648 | java | package com.github.miachm.sods;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/**
* Internal class for generate ODS files.
*/
class OdsWritter {
private final static String office = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
private final static String table_namespace = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
private final static String text_namespace = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
private final static String font_namespace = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0";
private final static String style_namespace = "urn:oasis:names:tc:opendocument:xmlns:style:1.0";
private SpreadSheet spread;
private Compressor out;
private Map<Style, String> stylesUsed = new HashMap<>();
private Map<ColumnStyle, String> columnStyleStringMap = new HashMap<>();
private Map<RowStyle, String> rowStyleStringMap = new HashMap<>();
private final String MIMETYPE= "application/vnd.oasis.opendocument.spreadsheet";
private OdsWritter(OutputStream o, SpreadSheet spread) {
this.spread = spread;
this.out = new Compressor(o);
}
public static void save(OutputStream out,SpreadSheet spread) throws IOException {
new OdsWritter(out,spread).save();
}
private void save() throws IOException {
writeManifest();
writeMymeType();
try {
writeSpreadsheet();
} catch (XMLStreamException e) {
throw new GenerateOdsException(e);
}
out.close();
}
private void writeManifest() {
try {
ByteArrayOutputStream output = new ByteArrayOutputStream(1024);
XMLStreamWriter out = XMLOutputFactory.newInstance().createXMLStreamWriter(
new OutputStreamWriter(output, "utf-8"));
final String namespace = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0";
out.writeStartDocument("UTF-8", "1.0");
out.writeStartElement("manifest:manifest");
out.writeAttribute("xmlns:manifest", namespace);
out.writeAttribute("manifest:version", "1.2");
out.writeStartElement("manifest:file-entry");
out.writeAttribute("manifest:full-path", "/");
out.writeAttribute("manifest:version", "1.2");
out.writeAttribute("manifest:media-type", MIMETYPE);
out.writeEndElement();
out.writeStartElement("manifest:file-entry");
out.writeAttribute("manifest:full-path", "content.xml");
out.writeAttribute("manifest:media-type", "text/xml");
out.writeEndElement();
out.writeEndElement();
out.writeEndDocument();
out.close();
byte[] bytes = output.toByteArray();
this.out.addEntry(bytes, "META-INF/manifest.xml");
} catch (XMLStreamException | IOException pce) {
throw new GenerateOdsException(pce);
}
}
private void writeMymeType() throws IOException {
out.addEntry(MIMETYPE.getBytes(),"mimetype");
}
private void writeSpreadsheet() throws UnsupportedEncodingException, XMLStreamException {
ByteArrayOutputStream output = new ByteArrayOutputStream(1024);
XMLStreamWriter out = XMLOutputFactory.newInstance().createXMLStreamWriter(
new OutputStreamWriter(output, "utf-8"));
out.writeStartDocument("UTF-8", "1.0");
out.writeStartElement( "office:document-content");
out.writeAttribute("xmlns:office", office);
out.writeAttribute("xmlns:table", table_namespace);
out.writeAttribute("xmlns:text",text_namespace);
out.writeAttribute("xmlns:fo",font_namespace);
out.writeAttribute("xmlns:style", style_namespace);
out.writeAttribute("office:version", "1.2");
writeStyles(out);
writeContent(out);
out.writeEndElement();
out.writeEndDocument();
out.close();
try {
this.out.addEntry(output.toByteArray(),"content.xml");
} catch (IOException e) {
throw new GenerateOdsException(e);
}
}
private void writeContent(XMLStreamWriter out) throws XMLStreamException {
out.writeStartElement("office:body");
out.writeStartElement("office:spreadsheet");
for (Sheet sheet : spread.getSheets()) {
out.writeStartElement("table:table");
out.writeAttribute("table:name", sheet.getName());
writeColumnsStyles(out, sheet);
writeContent(out, sheet);
out.writeEndElement();
}
out.writeEndElement();
out.writeEndElement();
}
private void writeColumnsStyles(XMLStreamWriter out, Sheet sheet) throws XMLStreamException {
for (int i = 0;i < sheet.getMaxColumns();i++){
out.writeStartElement("table:table-column");
Double width = sheet.getColumnWidth(i);
if (width != null) {
ColumnStyle columnStyle = new ColumnStyle();
columnStyle.setWidth(width);
String name = columnStyleStringMap.get(columnStyle);
if (name != null)
out.writeAttribute("table:style-name", name);
}
out.writeEndElement();
}
}
private void writeContent(XMLStreamWriter out, Sheet sheet) throws XMLStreamException {
for (int i = 0;i < sheet.getMaxRows();i++) {
out.writeStartElement("table:table-row");
writeRowHeight(out, sheet, i);
for (int j = 0; j < sheet.getMaxColumns();j++) {
Range cell = sheet.getRange(i, j);
writeCell(out, cell);
}
out.writeEndElement();
}
}
private void writeCell(XMLStreamWriter out, Range range) throws XMLStreamException {
Object v = range.getValue();
String formula = range.getFormula();
Style style = range.getStyle();
Range mergedCells[] = range.getMergedCells();
if (mergedCells.length > 0) {
if (mergedCells[0].getColumn() != range.getColumn() || mergedCells[0].getRow() != range.getRow()) {
out.writeStartElement("table:covered-table-cell");
out.writeEndElement();
return;
}
}
out.writeStartElement("table:table-cell");
if (mergedCells.length > 0) {
if (mergedCells[0].getNumColumns() > 1)
out.writeAttribute("table:number-columns-spanned", "" + mergedCells[0].getNumColumns());
if (mergedCells[0].getNumRows() > 1)
out.writeAttribute("table:number-rows-spanned", "" + mergedCells[0].getNumRows());
}
if (formula != null)
out.writeAttribute("table:formula", formula);
setCellStyle(out, style);
writeValue(out, v);
out.writeEndElement();
}
private void setCellStyle(XMLStreamWriter out, Style style) throws XMLStreamException {
if (!style.isDefault()) {
String key = stylesUsed.get(style);
if (key == null) {
key = "cel" + stylesUsed.size();
stylesUsed.put(style, key);
}
out.writeAttribute("table:style-name", key);
}
}
private void writeValue(XMLStreamWriter out, Object v) throws XMLStreamException {
if (v != null) {
String valueType = getValueType(v);
out.writeAttribute("office:value-type", valueType);
if (!valueType.equals("string"))
out.writeAttribute("office:value", ""+ v);
out.writeStartElement("text:p");
String text = v.toString();
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == ' ') {
out.writeStartElement("text:s");
int cnt = 0;
while (i+cnt < text.length() && text.charAt(i + cnt) == ' ') {
cnt++;
}
if (cnt > 1)
out.writeAttribute("text:c", "" + cnt);
i += cnt - 1 ;
out.writeEndElement();
}
else if (text.charAt(i) == '\t') {
out.writeEmptyElement("text:tab");
}
else if (text.charAt(i) == '\n') {
out.writeEndElement();
out.writeStartElement("text:p");
}
else
out.writeCharacters("" + text.charAt(i));
}
out.writeEndElement();
}
}
private void writeRowHeight(XMLStreamWriter out, Sheet sheet, int i) throws XMLStreamException {
Double height = sheet.getRowHeight(i);
if (height != null) {
RowStyle rowStyle = new RowStyle();
rowStyle.setHeight(height);
String name = rowStyleStringMap.get(rowStyle);
if (name != null)
out.writeAttribute("table:style-name", name);
}
}
private void writeStyles(XMLStreamWriter out) throws XMLStreamException {
out.writeStartElement("office:automatic-styles");
for (Sheet sheet : spread.getSheets()) {
for (int i = 0; i < sheet.getMaxRows(); i++) {
for (int j = 0; j < sheet.getMaxColumns(); j++) {
Range range = sheet.getRange(i,j);
Style style = range.getStyle();
if (!style.isDefault()) {
writeCellStyle(out, style);
}
Double width = sheet.getColumnWidth(j);
if (width != null) {
writeColumnStyle(out, width);
}
}
Double height = sheet.getRowHeight(i);
if (height != null) {
writeRowStyle(out, height);
}
}
}
out.writeEndElement();
}
private void writeCellStyle(XMLStreamWriter out, Style style) throws XMLStreamException {
String key = stylesUsed.get(style);
if (key == null)
{
key = "cel" + stylesUsed.size();
out.writeStartElement("style:style");
out.writeAttribute("style:family", "table-cell");
out.writeAttribute("style:name", key);
if (style.getBackgroundColor() != null) {
out.writeStartElement("style:table-cell-properties");
out.writeAttribute("fo:background-color", style.getBackgroundColor().toString());
out.writeEndElement();
}
out.writeStartElement("style:text-properties");
if (style.isItalic())
out.writeAttribute("fo:font-style", "italic");
if (style.isBold())
out.writeAttribute("fo:font-weight", "bold");
if (style.isUnderline()) {
out.writeAttribute("style:text-underline-style", "solid");
out.writeAttribute("style:text-underline-type", "single");
out.writeAttribute("style:text-underline-width", "auto");
out.writeAttribute("style:text-underline-color", "font-color");
}
if (style.getFontSize() != -1)
out.writeAttribute("fo:font-size", "" + style.getFontSize() + "pt");
if (style.getFontColor() != null)
out.writeAttribute("fo:color", style.getFontColor().toString());
out.writeEndElement();
out.writeEndElement();
stylesUsed.put(style, key);
}
}
private void writeColumnStyle(XMLStreamWriter out, Double width) throws XMLStreamException {
ColumnStyle columnStyle = new ColumnStyle();
columnStyle.setWidth(width);
if (!columnStyleStringMap.containsKey(columnStyle)) {
String key = "co" + columnStyleStringMap.size();
out.writeStartElement("style:style");
out.writeAttribute("style:family", "table-column");
out.writeAttribute("style:name", key);
out.writeStartElement("style:table-column-properties");
out.writeAttribute("style:column-width", width.toString() + "mm");
out.writeEndElement();
out.writeEndElement();
columnStyleStringMap.put(columnStyle, key);
}
}
private void writeRowStyle(XMLStreamWriter out, Double height) throws XMLStreamException {
RowStyle rowStyle = new RowStyle();
rowStyle.setHeight(height);
if (!rowStyleStringMap.containsKey(rowStyle)) {
String key = "ro" + rowStyleStringMap.size();
out.writeStartElement("style:style");
out.writeAttribute("style:family", "table-row");
out.writeAttribute("style:name", key);
out.writeStartElement("style:table-row-properties");
out.writeAttribute("style:row-height", height.toString() + "mm");
out.writeEndElement();
out.writeEndElement();
rowStyleStringMap.put(rowStyle, key);
}
}
private String getValueType(Object v) {
if (v instanceof Integer || v instanceof Float || v instanceof Double) {
return "float";
}
else {
return "string";
}
}
}
| [
"[email protected]"
]
| |
b5388921a60e14e2b604b1a42c90f559c6f4cea5 | 6663000d4bec4f51e1d31ff3534387a298d05eb6 | /db2.java | de6517435b74e077a9256427cc8d6db4524eae3a | []
| no_license | krypto94/CharNet | 966539031ac8442ec717671754c56d04871b1380 | 56ebab73231fda97749840388c0b201688e621e0 | refs/heads/master | 2020-12-24T06:04:12.127515 | 2017-09-04T12:42:02 | 2017-09-04T12:42:02 | 73,231,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java |
public class validator {
boolean val_alphanum(String str,int mandatory_flag,int size)
{
if(str == null && mandatory_flag == 1)
{
return false;
}
else if(str == null){return true;}
else if(str.length() > size)
{
return false;
}
// else if(!str.matches("[a-zA-Z0-9\\s\\,][-]+"))
// {
//
// return false;
// }
else
{
return true;
}
}
boolean val_number(String str,int size,int mandatory_flag)
{
if(str.equals(null) && mandatory_flag == 1)
{
return false;
}
else if(str.length() > size)
{
return false;
}
else if(!str.matches("[0-9]+"))
{
return false;
}
else
{
return true;
}
}
boolean val_email(String str,int size,int mandatory_flag)
{
if(str.equals(null) && mandatory_flag == 1)
{
return false;
}
else if(str.length() > size)
{
return false;
}
else if(!str.matches("[a-zA-Z0-9@.]+"))
{
return false;
}
else
{
return true;
}
}
boolean val_status(String str,int mandatory_flag)
{
if(str.equals(null) && mandatory_flag == 1)
{
return false;
}
else if(!(str.equals("N")||str.equals("M")||str.equals("D")||str.equals("A")||str.equals("R")))
{
return false;
}
else
{
return true;
}
}
boolean val_flag(String str,int mandatory_flag)
{
if(str.equals(null) && mandatory_flag == 1)
{
return false;
}
else if(!(str.equals("A")||str.equals("I")))
{
return false;
}
else
{
return true;
}
}
boolean val_date(String str,int size,int mandatory_flag)
{
if(str == null && mandatory_flag == 1)
{
return false;
}
else if(str == null){return true;}
else if(str.length() > size)
{
return false;
}
else if(false)// write regex for date validation
{
return false;
}
return true;
}
}
| [
"[email protected]"
]
| |
dbb953c554cd2a9a9af555637fea9243fd79d82b | c2d26e961d2725cb11a03f4830d9eccb7aaf09b6 | /src/ar/com/brave/boardgame/CubicBoard.java | 9d83c0377fd38ef6b483e90f3a85163d0e22916d | []
| no_license | mcatalano54/Board-Game-Web | 41846e06abbdc591ad58cc095c138b1b3cecbb3c | 54bef318f5acfeeb497388632e85eaf50a07df39 | refs/heads/master | 2021-01-18T01:56:07.823015 | 2015-08-18T18:56:46 | 2015-08-18T18:56:46 | 40,991,634 | 0 | 0 | null | 2015-08-18T18:55:15 | 2015-08-18T18:55:14 | Java | UTF-8 | Java | false | false | 352 | java | package ar.com.brave.boardgame;
public class CubicBoard extends QuadraticBoard {
private Integer height;
public CubicBoard(Integer length, Integer width, Integer height) {
super(length, width);
this.height = height;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
}
| [
"[email protected]"
]
| |
465a5fb70686ee3187983b96e260e5c59df2d666 | 1071a2ea295613e3f14c4ca58a635171df0238e2 | /APCS-A-2020/src/CelebrityGame/CelebrityGame.java | 5adbf1bdebd71f06b6af88fc31ae32bc3bbefb03 | []
| no_license | Syu125/APCS-A-2020 | 19a800f044775f4c7c372080d2b753a75bb46e47 | d67a0b3a97c96ab253459669839fde76d0b2e774 | refs/heads/master | 2020-12-23T21:34:57.355805 | 2020-05-29T16:49:53 | 2020-05-29T16:49:53 | 237,280,734 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,736 | java | package CelebrityGame;
import java.util.ArrayList;
/**
* The framework for the Celebrity Game project
*
* @author cody.henrichsen
* @version 2.3 25/09/2018 refactored the prepareGame and play methods
*/
public class CelebrityGame {
/**
* A reference to a Celebrity or subclass instance.
*/
private Celebrity gameCelebrity;
/**
* The GUI frame for the Celebrity game.
*/
private CelebrityFrame gameWindow;;
/**
* The ArrayList of Celebrity values that make up the game
*/
private ArrayList<Celebrity> celebGameList;
/**
* Builds the game and starts the GUI
*/
public CelebrityGame() {
prepareGame();
}
/**
* Prepares the game to start by re-initializing the celebGameList and having
* the gameFrame open the start screen.
*/
public void prepareGame() {
celebGameList = new ArrayList<Celebrity>();
gameWindow = new CelebrityFrame(this);
}
/**
* Determines if the supplied guess is correct.
*
* @param guess The supplied String
* @return Whether it matches regardless of case or extraneous external spaces.
*/
public boolean processGuess(String guess) {
return guess.contentEquals(gameCelebrity.getAnswer());
}
/**
* Asserts that the list is initialized and contains at least one Celebrity.
* Sets the current celebrity as the first item in the list. Opens the game play
* screen.
*/
public void play() {
if (celebGameList.size() > 0 && celebGameList != null) {
gameCelebrity = celebGameList.get(0);
gameWindow.replaceScreen("GAME");
}
}
public ArrayList<Celebrity> getCelebList() {
return celebGameList;
}
/**
* Adds a Celebrity of specified type to the game list
*
* @param name The name of the celebrity
* @param guess The clue(s) for the celebrity
* @param type What type of celebrity
*/
public void addCelebrity(String name, String guess, String type) {
switch (type) {
case "Literature":
celebGameList.add(new LiteratureCelebrity(name, guess));
gameCelebrity = new LiteratureCelebrity(name, guess);
break;
case "Sports":
celebGameList.add(new SportsCelebrity(name, guess));
gameCelebrity = new SportsCelebrity(name, guess);
break;
case "Celebrity":
celebGameList.add(new Celebrity(name, guess));
gameCelebrity = new Celebrity(name, guess);
break;
}
}
/**
* Validates the name of the celebrity. It must have at least 4 characters.
*
* @param name The name of the Celebrity
* @return If the supplied Celebrity is valid
*/
public boolean validateCelebrity(String name) {
name = name.trim();
if (name.length() >= 4) {
return true;
}
return false;
}
/**
* Checks that the supplied clue has at least 10 characters or is a series of
* clues This method would be expanded based on your subclass of Celebrity.
*
* @param clue The text of the clue(s)
* @param type Supports a subclass of Celebrity
* @return If the clue is valid.
*/
public boolean validateClue(String clue, String type) {
clue = clue.trim();
if (clue.length() >= 10 || clue.contains(",")) {
return true;
}
return false;
}
/**
* Accessor method for the current size of the list of celebrities
*
* @return Remaining number of celebrities
*/
public int getCelebrityGameSize() {
return celebGameList.size();
}
/**
* Accessor method for the games clue to maintain low coupling between classes
*
* @return The String clue from the current celebrity.
*/
public String sendClue() {
return gameCelebrity.getClue();
}
/**
* Accessor method for the games answer to maintain low coupling between classes
*
* @return The String answer from the current celebrity.
*/
public String sendAnswer() {
return gameCelebrity.getAnswer();
}
}
| [
"[email protected]"
]
| |
b97ba335094058968adc3e4f7e4902475fd07c8a | 33702ccccb04507ac85c13d9ab89583b117e2c32 | /src/controller/UndoCommand.java | 4907a706e19d7dedf60adbcc78f840cf52b1a9ef | []
| no_license | AlfredYan/SE450-final-project-JPaint | 455599d59080437b5c07e1a4bc1c08b15246ee5a | 15a24665312989250d3cc12de66d3a76aa122e6f | refs/heads/master | 2021-01-01T06:56:09.009158 | 2017-08-18T23:25:23 | 2017-08-18T23:25:23 | 97,551,901 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package controller;
import ControllerInterfaces.ICommand;
public class UndoCommand implements ICommand{
@Override
public void run() {
CommandHistory.undo();
}
}
| [
"[email protected]"
]
| |
7157ed3c575db25e9f21511524eefee679018b23 | a964597ecfd756ce27702f8ac4b135c718667308 | /src/main/java/com/arpanet/pickerman/socialboot/twitter/document/struct/TwitterVideo.java | e709f423796c25d567cc282796ac8577fbac95c0 | []
| no_license | beyzince/twitter | a4a2ae35574c0f7b9cde486c4fe1b432698dc154 | fa3916a7b4cd0254e1e06c136c120780400ab73c | refs/heads/main | 2023-06-20T20:35:12.354679 | 2021-08-04T14:58:59 | 2021-08-04T14:58:59 | 377,740,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package com.arpanet.pickerman.socialboot.twitter.document.struct;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
@Document
@Data
public class TwitterVideo {
@Id
private Long id;
private String type;
private String mediaUrl;
private Long durationMillis;
private List<TwitterVideoVariant> twitterVideoVariant;
}
| [
"[email protected]"
]
| |
50221614974b12333bc417b390ea45c246942cb9 | b6eb0ecadbb70ed005d687268a0d40e89d4df73e | /feilong-io/src/test/java/com/feilong/io/ioreaderutil/ResolverFileAndLineNumberReaderTest.java | b2148e7ac6f7f23a72428c72fb06283adeeec4ca | [
"Apache-2.0"
]
| permissive | ifeilong/feilong | b175d02849585c7b12ed0e9864f307ed1a26e89f | a0d4efeabc29503b97caf0c300afe956a5caeb9f | refs/heads/master | 2023-08-18T13:08:46.724616 | 2023-08-14T04:30:34 | 2023-08-14T04:30:34 | 252,767,655 | 97 | 28 | Apache-2.0 | 2023-04-17T17:47:44 | 2020-04-03T15:14:35 | Java | UTF-8 | Java | false | false | 1,726 | java | /*
* Copyright (C) 2008 feilong
*
* 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.feilong.io.ioreaderutil;
import java.io.File;
import org.junit.Test;
import com.feilong.core.lang.SystemUtil;
import com.feilong.io.IOReaderUtil;
import com.feilong.io.LineNumberReaderResolver;
/**
*
* @author <a href="https://github.com/ifeilong/feilong">feilong</a>
* @since 1.11.5
*/
public class ResolverFileAndLineNumberReaderTest{
private final LineNumberReaderResolver lineNumberReaderResolver = new LineNumberReaderResolver(){
@Override
public boolean resolve(int lineNumber,String line){
return false;
}
};
//---------------------------------------------------------------
@Test(expected = NullPointerException.class)
public void testReadFileToStringFilePathAndCharsetNameTestNull(){
IOReaderUtil.resolverFile((File) null, lineNumberReaderResolver);
}
//---------------------------------------------------------------
@Test(expected = NullPointerException.class)
public void testReadFileToStringFilePathNull(){
IOReaderUtil.resolverFile(new File(SystemUtil.USER_HOME + "/work/build.xml"), null);
}
}
| [
"[email protected]"
]
| |
c13ced07becb9dc92d1c1db021ea695c685ef28e | 920fa60b64f5ea9d8b0223266d3f5fd85ef5d403 | /Project 3/GameBoard.java | 38212aab3f66f0b3f2051013febd2e2347ec3174 | []
| no_license | hvluu/CS420 | 163ed1507b34abd1c45f35ce4f899ecd655c4b61 | a4349e56fbcfbf3ee88955aa0781dc1a289bf1d5 | refs/heads/master | 2021-09-08T02:27:04.034201 | 2018-03-06T01:16:28 | 2018-03-06T01:16:28 | 119,492,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 851 | java |
public final class GameBoard {
protected char[][] board = new char[8][8];
public GameBoard() {
initializeBoard();
}
/**
* Initializes an empty board full of '-'.
*/
public void initializeBoard() {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
board[i][j] = '-';
}
}
}
/**
* Allows player to make a move from input.
*/
public void makeMove(char i, char j) {
int col = (int) j - 49;
i = Character.toUpperCase(i);
int row = (int) i - 65;
board[row][col] = 'O';
}
/**
* Prints game board to the screen.
*/
public void printBoard() {
System.out.println(" 1 2 3 4 5 6 7 8");
for (int i = 0; i < 8; i++) {
System.out.print((char) (i + 65) + " ");
for (int j = 0; j < 8; j++) {
System.out.print(board[i][j] + " ");
}
System.out.println();
}
System.out.println();
}
}
| [
"[email protected]"
]
| |
571e2ff8fe7b02fa7fce573343ff48e335e1b6c5 | 4e3ad3a6955fb91d3879cfcce809542b05a1253f | /schema/ab-products/bldgops/common/src/main/com/archibus/eventhandler/helpdesk/CommonHandler.java | a62a2c2aa7a56d9ccca78cfe54aa4d1653a76935 | []
| no_license | plusxp/ARCHIBUS_Dev | bee2f180c99787a4a80ebf0a9a8b97e7a5666980 | aca5c269de60b6b84d7871d79ef29ac58f469777 | refs/heads/master | 2021-06-14T17:51:37.786570 | 2017-04-07T16:21:24 | 2017-04-07T16:21:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,753 | java | package com.archibus.eventhandler.helpdesk;
import java.sql.*;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
import com.archibus.context.ContextStore;
import com.archibus.datasource.*;
import com.archibus.datasource.data.DataRecord;
import com.archibus.jobmanager.EventHandlerContext;
import com.archibus.utility.*;
/**
* <p>
* Handles common workflowrules for helpdesk, such as saving and deleting a record.
*
*/
public class CommonHandler extends HelpdeskEventHandlerBase {
/**
* <p>
* Save record given in fields.
* </p>
* <p>
* <b>Inputs:</b>
* <ul>
* <li>fields : form values submitted</li>
* <li>tableName : table</li>
* <li>pkeyName : primary key field</li>
* </ul>
* </p>
* <p>
* <b>Outputs:</b>
* <ul>
* <li>message: primary key value of saved record</li>
* </ul>
* </p>
* <p>
* <b>Pseudo-code:</b>
* <ol>
* <li>Get inputs from context</li>
* <li>Save record to database in the given table</li>
* <li>if pkeyName is given, retrieve pkey value for saved record</li>
* <li>Create and return message with pkey value</li>
* </ol>
* </p>
* <p>
*
* @param context Workflow rule execution context
* </p>
*/
public void saveRecord(EventHandlerContext context) {
// get input parameters from context
String tableName = (String) context.getParameter("tableName");
String pkeyName = null;
if (context.parameterExists("pkeyName")) {
pkeyName = (String) context.getParameter("pkeyName");
}
Map fieldValues = context.getParameters("fields");
Map values = stripPrefix(fieldValues);
// create or update record
executeDbSave(context, tableName, values);
//executeDbCommit(context);
// if requested, retrieve new object pkey value and attach it to the response as "message"
if (pkeyName != null) {
Double pkeyDouble = retrieveStatistic(context, "max", null, tableName, pkeyName);
Integer pkeyInt = new Integer(pkeyDouble.intValue());
context.addResponseParameter("message", pkeyInt);
}
}
/**
* <p>
* Retrieve statistic from the database.
* <p>
* <b>Inputs:</b>
* <ul>
* <li>field: field in statistic</li>
* <li>table: table to retrieve record from</li>
* <li>stat: statistic(max,count,min,...)</li>
* <li>whereSql: where condition</li>
* </ul>
* </p>
* <p>
* <b>Outputs:</b>
* <ul>
* <li>jsonExpression: JSONObject with statistic<br />
* <code>{statistic : ?}</code></li>
* </ul>
* </p>
* <p>
* <b>Pseudo-code:</b>
* <ol>
* <li>Get context object for using in the selectDbRecords method</li>
* <li>Create sql query</li>
* <li>Get query results</li>
* <li>Create and return jsonExpression</li>
* </ol>
* </p>
* <p>
* <b>SQL:</b> <div>SELECT <i>stat</i>(<i>field</i>) FROM <i>table</i> WHERE <i>sql</i></div>
* </p>
* @param String field
* @param String table
* @param String stat
* @param String whereSql
*/
public void getStatistic(String field,String table,String stat,String whereSql) {
EventHandlerContext context = ContextStore.get().getEventHandlerContext();
// select
String sql = "SELECT " + stat + "(" + field + ")" + " FROM " + table + " WHERE "
+ whereSql;
List statistics = selectDbRecords(context, sql);
Object[] rec = (Object[]) statistics.get(0);
JSONObject result = new JSONObject();
result.put("statistic", rec[0]);
context.addResponseParameter("jsonExpression", result.toString());
}
/**
*
* <p>
* Retrieve single value from the database.
* <p>
* <b>Inputs:</b>
* <ul>
* <li>table: table to retrieve record from</li>
* <li>field_name: field to select</li>
* <li>sql: where condition</li>
* </ul>
* </p>
* <p>
* <b>Outputs:</b>
* <ul>
* <li>jsonExpression: JSONObject with field name-value pair<br />
* <code>{<i>field</i>:?}</code> </li>
* </ul>
* </p>
* <p>
* <b>Pseudo-code:</b>
* <ol>
* <li>Get context object</li>
* <li>Select value from database</li>
* <li>Create and return jsonExpression</li>
* </ol>
* </p>
* <p>
* <b>SQL:</b> <div> SELECT <i>field</i> FROM <i>table</i> WHERE <i>sql</i> </div>
* </p>
* <p>
* @param String table
* @param String field_name
* @param String sql
*/
public void getValue(String table,String field_name,String sql) {
EventHandlerContext context = ContextStore.get().getEventHandlerContext();
//KB3051080 - check sql injection
final SqlInjectionHandler handler =
(SqlInjectionHandler) ContextStore.get().getBean("sqlInjectionHandler");
if (StringUtil.notNullOrEmpty(sql)) {
handler.checkString(sql);
}
// SELECT field FROM table WHERE sql;
Object value = selectDbValue(context, table, field_name, sql);
JSONObject results = new JSONObject();
try {
String field_value = notNull(value);
results.put(field_name, field_value);
} catch (NullPointerException e) {
results.put(field_name, "");
}
context.addResponseParameter("jsonExpression", results.toString());
}
/**
*
* <p>
* Retrieve values from the database.
* <p>
* <b>Inputs:</b>
* <ul>
* <li>table: table to retrieve record from</li>
* <li>fieldnames: ;-separated list of fields to select</li>
* <li>sql: where condition</li>
* </ul>
* </p>
* <p>
* <b>Outputs:</b>
* <ul>
* <li>jsonExpression: JSONObject with field name-value pairs<br />
* <code>{<i>field</i>:?}</code> </li>
* </ul>
* </p>
* <p>
* <b>Pseudo-code:</b>
* <ol>
* <li>Get inputs from context</li>
* <li>Select value from database</li>
* <li>Create and return jsonExpression</li>
* </ol>
* </p>
* <p>
* <b>SQL:</b> <div> SELECT <i>fields</i> FROM <i>table</i> WHERE <i>sql</i> </div>
* </p>
* <p>
*
* @param context Workflow rule execution context
* </p>
*/
public void getValues(EventHandlerContext context) {
String tmp = context.getString("fieldnames");
String[] field_names = tmp.split(";");
// SELECT fields FROM table WHERE sql;
Object[] values = selectDbValues(context, context.getString("table"), field_names, context
.getString("sql"));
JSONObject results = new JSONObject();
for (int i = 0; i < field_names.length; i++) {
try {
String field_value = notNull(values[i]);
results.put(field_names[i], field_value);
} catch (NullPointerException e) {
results.put(field_names[i], "");
}
}
context.addResponseParameter("jsonExpression", results.toString());
}
/**
*
* <p>
* Get a list to populate a select drop down field in a form.
* <p>
* <b>Inputs:</b>
* <ul>
* <li>tableName : table to retrieve records from</li>
* <li>valueField : field of table for (html) value attribute in select list</li>
* <li>textField : field of table for (html) text attribute in select list</li>
* <li>where : sql where condition</li>
* </ul>
* </p>
* <p>
* <b>Outputs:</b>
* <ul>
* <li>jsonExpression : JSONObject with JSONArray of JSONObjects with value-text
* pairs<br />
* <code>{items : [{value: ?, text: ?}]}</code> </li>
* </ul>
* </p>
* <p>
* <b>Pseudo-code:</b>
* <ol>
* <li>Get context object</li>
* <li>Retrieve records from database</li>
* <li>Create and return jsonExpression</li>
* </ol>
* </p>
* <p>
* <b>SQL:</b> <div>SELECT <i>valueField</i> as value, <i>textField</i> as text
* FROM <i>tableName</i> WHERE <i>where</i></div>
* </p>
* @param String tableName
* @param String valueField
* @param String textField
* @param String where
*
*/
public void getSelectList(String tableName,String valueField,String textField,String where) {
EventHandlerContext context = ContextStore.get().getEventHandlerContext();
if (isOracle(context)) {
valueField = StringUtil.replace(valueField, "+", "||");
textField = StringUtil.replace(textField, "+", "||");
}
JSONArray items = new JSONArray();
List<DataRecord> records = null;
final DataSource ds =
DataSourceFactory.createDataSourceForFields(tableName, new String[] { valueField,
textField });
//KB3050920 for mssql, add top to make sure 'order by' in where work
if(SqlUtils.isSqlServer()) {
ds.addQuery("SELECT DISTINCT TOP 99999" + valueField + " AS value, " + textField + " as text from "
+ tableName + " where (${sql.vpaRestriction}) AND " + where);
}else {
ds.addQuery("SELECT DISTINCT " + valueField + " AS value, " + textField + " as text from "
+ tableName + " where (${sql.vpaRestriction}) AND " + where);
}
ds.addVirtualField(tableName, "value", DataSource.DATA_TYPE_TEXT);
ds.addVirtualField(tableName, "text", DataSource.DATA_TYPE_TEXT);
ds.setApplyVpaRestrictions(false);
records = ds.getRecords();
for (final DataRecord record : records) {
final JSONObject json = new JSONObject();
json.put("value", notNull(record.getValue(tableName + ".value")));
json.put("text", notNull(record.getValue(tableName + ".text" )));
items.put(json);
}
JSONObject result = new JSONObject();
result.put("items", items);
context.addResponseParameter("jsonExpression", result.toString());
}
/**
*
* <p>
* Get a year list to populate a select drop down field in a form.
* <p>
* <b>Inputs:</b>
* <ul>
* <li>tableName : table to retrieve records from</li>
* <li>dateField : field to retrieve values </li>
* <li>where : sql where condition</li>
* </ul>
* </p>
* <p>
* <b>Pseudo-code:</b>
* <ol>
* <li>Get context object</li>
* <li>Create SQL statement according to the input parameters</li>
* <li>Get the records and assemble the results</li>
* </ol>
* </p>
* @param final String tableName
* @param final String dateField
* @param final String where
*/
public void getYearSelectList(final String tableName,final String dateField,final String where) {
EventHandlerContext context = ContextStore.get().getEventHandlerContext();
JSONArray items = new JSONArray();
List records = null;
StringBuffer query = new StringBuffer("SELECT DISTINCT ");
String selectField = dateField;
if (isOracle(context)) {
selectField = "TO_CHAR(" + dateField + ", 'YYYY')";
} else {
selectField = "datepart(year," + dateField + ")";
}
query.append(selectField);
query.append(" FROM " + tableName);
if (!where.equals("") && !where.equals("null")) {
query.append(" WHERE " + where);
}
query.append(" ORDER BY " + selectField);
records = selectDbRecords(context, query.toString());
if (!records.isEmpty()) {
for (Iterator it = records.iterator(); it.hasNext();) {
Object[] record = (Object[]) it.next();
JSONObject json = new JSONObject();
json.put("value", record[0]);
json.put("text", record[0]);
items.put(json);
}
}
JSONObject result = new JSONObject();
result.put("items", items);
context.addResponseParameter("jsonExpression", result.toString());
}
/**
*
* <p>
* Delete selected records.
*
* <p>
* <b>Inputs:</b>
* <ul>
* <li>records : JSONArray of JSONObjects for records to delete</li>
* <li>tableName : table to delete record from</li>
* </ul>
* </p>
* <p>
* <b>Pseudo-code:</b>
* <ol>
* <li>Get context object</li>
* <li>Get the JSONObject from array and convert it to a map </li>
* <li>Delete records from the given table in the database</li>
* </ol>
* </p>
* <p>
*
* </p>
* @param JSONArray records
* @param String tableName
*/
public void deleteRecords(JSONArray records,String tableName) {
//fix KB3031078 - Update Help Desk WFRs to use DataSource API instead of executeDbDelete(Guo 2011/4/18)
//EventHandlerContext context = ContextStore.get().getEventHandlerContext();
DataSource dataSource = null;
if (records.length() > 0) {
dataSource = DataRecord.createDataSourceForRecord(records.getJSONObject(0));
dataSource.addTable(tableName);
for (int i = 0; i < records.length(); i++) {
JSONObject record = records.getJSONObject(i);
Map values = fromJSONObject(record);
dataSource.deleteRecord(values);
//values = stripPrefix(values);
//executeDbDelete(context, tableName, values);
//executeDbCommit(context);
}
} // end if
}
/**
* Get current local date and time.
* @param tableName wo, wr, activity_log
* @param fieldName wo_id, wr_id, activity_log_id
* @param pkValue wo_id, wr_id, activity_log_id
*/
public void getCurrentLocalDateTime(String tableName, String fieldName, String pkValue) {
Map<String, String> siteBuildingMap = Common.getSiteBuildingIds(tableName, fieldName, pkValue);
JSONObject json = new JSONObject();
Date currentLocalDate = LocalDateTimeStore.get().currentLocalDate(null, null, siteBuildingMap.get("siteId"), siteBuildingMap.get("blId"));
Time currentLocalTime = LocalDateTimeStore.get().currentLocalTime(null, null, siteBuildingMap.get("siteId"), siteBuildingMap.get("blId"));
json.put("date", currentLocalDate.toString());
json.put("time", currentLocalTime.toString());
EventHandlerContext context = ContextStore.get().getEventHandlerContext();
context.addResponseParameter("jsonExpression", json.toString());
}
/**
*
* @param siteId site id
* @param blId building id.
*/
public void getCurrentLocalDateTimeSiteAndBl(String siteId, String blId) {
JSONObject json = new JSONObject();
Date currentLocalDate = LocalDateTimeStore.get().currentLocalDate(null, null, siteId, blId);
Time currentLocalTime = LocalDateTimeStore.get().currentLocalTime(null, null, siteId, blId);
json.put("date", currentLocalDate.toString());
json.put("time", currentLocalTime.toString());
EventHandlerContext context = ContextStore.get().getEventHandlerContext();
context.addResponseParameter("jsonExpression", json.toString());
}
}
| [
"[email protected]"
]
| |
02148097f7fe6ee9f3192c553bee586d68f148b4 | 9beee66ba5d80f1c217c6de0b586e37acb80d031 | /src/com/module/service/electricLicencePermit/apply/comm/impl/DxxzspInformationSecurityMeasuresProServiceImpl.java | 6be017821f711d0c4004bc14b6d1578d2b8aa329 | []
| no_license | lishihui/test | aa310a9311083f767f4bc505b49349e481e501bb | 0c5459c3ecda2999e0325d10b0aeb74744835219 | refs/heads/master | 2020-09-29T13:20:14.295650 | 2019-12-10T07:44:48 | 2019-12-10T07:44:48 | 227,045,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,721 | java | package com.module.service.electricLicencePermit.apply.comm.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.module.dao.base.CommonMapper;
import com.module.dao.electricLicencePermit.apply.comm.DxxzspKqyxksqggbMapper;
import com.module.domain.electricLicencePermit.apply.comm.DxxzspKqyxksqggbWithBLOBs;
import com.module.service.common.ItemUserApplyService;
import com.module.service.electricLicencePermit.apply.comm.DxxzspInformationSecurityMeasuresProService;
import com.util.AppException;
@Service("DxxzspInformationSecurityMeasuresProService")
public class DxxzspInformationSecurityMeasuresProServiceImpl implements DxxzspInformationSecurityMeasuresProService {
@Resource
private CommonMapper commonMapper;
@Resource
private DxxzspKqyxksqggbMapper dxxzspKqyxksqggbMapper;
@Resource
private ItemUserApplyService itemUserApplyService;
@Override
public Map<String, Object> getRow(String id, String flowrunid)throws AppException {
String itemid=itemUserApplyService.getProcessId(id);
Map<String,Object> ret = new HashMap<String,Object>();
Map<String,Object> list_InformationSecurityMeasuresPro = commonMapper.findOneData("select * from DXXZSP_KQYXKSQGGB where itemid = '"+itemid+"'");
if(list_InformationSecurityMeasuresPro != null){
String ywid = (String) list_InformationSecurityMeasuresPro.get("ID");
String parentid = (String) list_InformationSecurityMeasuresPro.get("ID");
List<DxxzspKqyxksqggbWithBLOBs> list_ret = new ArrayList<DxxzspKqyxksqggbWithBLOBs>();
List<Map<String,Object>> list_DxxzspKqyxksqggb = commonMapper.findManyData("select * from DXXZSP_KQYXKSQGGB where id = '"+ywid+"'");
for(Map<String,Object> tmp : list_DxxzspKqyxksqggb ){
DxxzspKqyxksqggbWithBLOBs blob = dxxzspKqyxksqggbMapper.selectByPrimaryKey((String)tmp.get("ID"));
list_ret.add(blob);
}
List<Map<String,Object>> list_DxxzspGgbgqjg = commonMapper.findManyData("select * from DXXZSP_GGBGQJG where PARENTID = '"+parentid+"'");
List<Map<String,Object>> list_DxxzspZyjsrymd = commonMapper.findManyData("select * from DXXZSP_ZYJSRYMD where PARENTID = '"+parentid+"'");
List<Map<String,Object>> list_DxxzspZyglrymd = commonMapper.findManyData("select * from DXXZSP_ZYGLRYMD where PARENTID = '"+parentid+"'");
ret.put("DXXZSP_KQYXKSQGGB", list_ret);
ret.put("DXXZSP_GGBGQJG", list_DxxzspGgbgqjg);
ret.put("DXXZSP_ZYJSRYMD", list_DxxzspZyjsrymd);
ret.put("DXXZSP_ZYGLRYMD", list_DxxzspZyglrymd);
}
return ret;
}
}
| [
"[email protected]"
]
| |
a3021247d887e825d270cf79408c3fe71e3ab1f0 | 3ee53dab2793738048f0c765f8d9872e22dec455 | /amall-platform/httpClient-thread/src/main/java/com/alag/agmall/platform/concurrency/InsertNotifyRecord.java | 343b6e7b69f794d66be8a7a9466267d16b2d99e3 | []
| no_license | FeiLeMa/Interview-project | d3182984c87631b13ca043048de38f81dfce866f | 5fd99b0451de159a175fc92243fca91bbcdec468 | refs/heads/master | 2022-11-26T05:43:49.298703 | 2019-09-08T17:21:52 | 2019-09-08T17:21:52 | 207,136,959 | 0 | 0 | null | 2022-11-16T11:57:10 | 2019-09-08T15:59:45 | Java | UTF-8 | Java | false | false | 5,438 | java | package com.alag.agmall.platform.concurrency;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import org.apache.http.HttpEntity;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.CookieStore;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Random;
/**
* 多线程-HttpClient连接池管理HTTP请求实例
*/
public class InsertNotifyRecord {
public static void main(String[] args) throws Exception {
final long min = 100000000000000000L;
final long max = 999999999999999999L;
//连接池对象
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
//将最大连接数增加到200
connectionManager.setMaxTotal(200);
//将每个路由的默认最大连接数增加到20
connectionManager.setDefaultMaxPerRoute(20);
//添加cookie存储
CookieStore cookieStore = new BasicCookieStore();
//HttpClient对象
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(connectionManager)
.build();
/* //URIs to DoGet
String[] urisToGet = {
"http://localhost:8080/alipay/ali_notify_back",
"http://localhost:8091/user/get_user_info",
"http://localhost:8091/user/get_user_info",
"http://localhost:8097/order/get_cart_product"
};
//为每一个URI创建一个线程
GetThread[] threads = new GetThread[urisToGet.length];
for (int i=0;i<threads.length;i++){
HttpGet httpGet = new HttpGet(urisToGet[i]);
threads[i] = new GetThread(httpClient,httpGet);
}*/
//URIs to DoPost
String uriToPost = "http://localhost:9800/notify/create_record";
//线程个数
int threadPool = 100;
// 存放orderNo
List<String> ids = Lists.newArrayList();
List<String> merchantOrderNos = Lists.newArrayList();
for (int i = 0; i < threadPool; i++) {
merchantOrderNos.add(min + ((long)((new Random().nextDouble() * (max - min)))) + "");
ids.add(min + ((long)((new Random().nextDouble() * (max - min)))) + "");
}
PostThread[] threads = new PostThread[threadPool];
for (int i = 0; i < threadPool; i++) {
HttpPost httpPost = new HttpPost(uriToPost);
// 设置请求的参数
JSONObject jsonParam = new JSONObject();
jsonParam.put("id", ids.get(i));
jsonParam.put("version", 1);
jsonParam.put("notifyTimes", 0);
jsonParam.put("limitNotifyTimes", 5);
jsonParam.put("url", "www.alanagou.com/notify");
jsonParam.put("merchantOrderNo", merchantOrderNos.get(i));
jsonParam.put("merchantNo", "3333");
jsonParam.put("status", 100);
jsonParam.put("notifyType", 20);
jsonParam.put("createTime", new Date());
jsonParam.put("updateTime", new Date());
StringEntity entity = new StringEntity(jsonParam.toString(), "utf-8");
entity.setContentEncoding("UTF-8");
entity.setContentType("application/json");
httpPost.setEntity(entity);
threads[i] = new PostThread(httpClient, httpPost);
}
//启动线程
for (int j = 0; j < threads.length; j++) {
threads[j].start();
}
//join 线程
for (int k = 0; k < threads.length; k++) {
try {
threads[k].join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
/**
* 执行Post请求线程
*/
public static class PostThread extends Thread {
private final CloseableHttpClient httpClient;
private final HttpContext context;
private final HttpPost httpPost;
public PostThread(CloseableHttpClient httpClient, HttpPost httpPost) {
this.httpClient = httpClient;
this.context = HttpClientContext.create();
this.httpPost = httpPost;
}
@Override
public void run() {
try {
CloseableHttpResponse response = httpClient.execute(httpPost, context);
try {
HttpEntity entity = response.getEntity();
String content = EntityUtils.toString(entity, "UTF-8");
System.out.println(content);
} finally {
response.close();
}
} catch (ClientProtocolException ex) {
//处理客户端协议异常
} catch (IOException ex) {
//处理客户端IO异常
}
}
}
} | [
"[email protected]"
]
| |
7ec494668a1462dff98ea589a11d9d962368560a | 28bc520f0ec7ef7df387e9e13bd4b331e0e9756f | /SSOSameDomain/WebSSOAuth/src/main/java/com/ssosame/bean/Ticket.java | 8c1f02c05690c4976ad05ef3c4f41333cf8da956 | []
| no_license | qwang1990/Zeus | 3923cde554f20660cfb2d717a83bb6a8b38c72ca | 19bd0555f6175e5b4fdbdbb146d0a54bc4259b94 | refs/heads/master | 2021-01-21T04:50:45.784763 | 2016-07-06T10:14:14 | 2016-07-06T10:14:14 | 55,580,157 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,097 | java | package com.ssosame.bean;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* Created by wangqi on 16/4/20.
*/
public class Ticket implements Serializable {
private static final long serialVersionUID = 1L;
private String username;
private Timestamp createTime;
private Timestamp recoverTime;
public Ticket() {
super();
}
public Ticket(String username, Timestamp createTime, Timestamp recoverTime) {
super();
this.username = username;
this.createTime = createTime;
this.recoverTime = recoverTime;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
public Timestamp getRecoverTime() {
return recoverTime;
}
public void setRecoverTime(Timestamp recoverTime) {
this.recoverTime = recoverTime;
}
}
| [
"[email protected]"
]
| |
faf14b2d0aae72e3301145a94fdd2d73d0ff49a8 | 3858ba81e4cb70ec67854696a6cba882fa3910cf | /core/src/main/java/es/icp/icp_commons/Utils/CommonsUtilsImagenes.java | fd0b742667ea959e50e9b9ef9065ee767d5231ee | []
| no_license | icpmoviles/icp_commons | 2f582fa7c97a745ff7599f124676645c7d4658d9 | a68a34bf68a9f7bc0e8d274746bdc6bf15cf8893 | refs/heads/master | 2023-05-02T14:03:14.048680 | 2023-04-19T07:46:05 | 2023-04-19T07:46:05 | 224,188,844 | 4 | 0 | null | 2023-04-19T07:46:06 | 2019-11-26T12:36:18 | Java | UTF-8 | Java | false | false | 1,843 | java | package es.icp.icp_commons.Utils;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Base64;
import java.io.ByteArrayOutputStream;
import java.io.File;
import es.icp.icp_commons.Objects.ImagenCommons;
public class CommonsUtilsImagenes {
public static String fromFileToBase64Image(File file) {
Bitmap bm = BitmapFactory.decodeFile(file.getAbsolutePath());
return fromBitmaptoBase64Image(bm);
}
public static String fromDrawableToBase64Image(Drawable drawable) {
Bitmap bm = ((BitmapDrawable) drawable).getBitmap();
return fromBitmaptoBase64Image(bm);
}
public static String fromBitmaptoBase64Image(Bitmap bm) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); //bm is the bitmap object
byte[] b = baos.toByteArray();
return Base64.encodeToString(b, Base64.DEFAULT)/* + "|" + degrees*/;
}
public static byte[] convertBase64ToByteArray(ImagenCommons imagenCommons) {
int degrees = imagenCommons.getOrientacion();
byte[] bytes = Base64.decode(imagenCommons.getContenido(), Base64.DEFAULT);
Bitmap storedBitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, null);
Matrix mat = new Matrix();
if (degrees == 90 || degrees == 270) mat.postRotate(degrees);
storedBitmap = Bitmap.createBitmap(storedBitmap, 0, 0, storedBitmap.getWidth(), storedBitmap.getHeight(), mat, true);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
storedBitmap.compress(imagenCommons.getFormato(), 100, stream);
return stream.toByteArray();
}
}
| [
"[email protected]"
]
| |
ddc1663b548324adfbe8fbe04e7cb42cb2c3a255 | 260170debaef929bfd50d4924f108f5739b20016 | /src/main/java/com/adGeneratorApi/Configuracao/SecurityConfiguration.java | da7fa7e015cb629ad2e0dad1c8b2fff5f3e7f133 | []
| no_license | julio16j/adGenerator-api | a57d79caa5df6da260aa5d848078aed673dcdaee | 7bad297f4f89594ae07526c47e79fb8c05520faf | refs/heads/main | 2023-06-25T23:40:23.107655 | 2021-07-25T23:35:24 | 2021-07-25T23:35:24 | 325,150,448 | 1 | 0 | null | 2021-03-15T07:11:38 | 2020-12-29T00:51:57 | Java | UTF-8 | Java | false | false | 457 | java | package com.adGeneratorApi.Configuracao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration
public class SecurityConfiguration {
@Bean
public PasswordEncoder encoder() {
return new BCryptPasswordEncoder();
}
} | [
"[email protected]"
]
| |
d7325de9345deb43a83de64723d8f379aff29ddd | 41ac455af5924afe44c5b4d2122a1e6c9691347b | /PersonalTask.java | 01038f8c306f7a3bbcc02ebe4ed0cd4d1a9ee91b | []
| no_license | IrynaMi/EpamTests | 0050b006e58fef08dba59878641480febf784338 | 65070e744e3d0b784b9be7ecc777d91dc752aa24 | refs/heads/master | 2020-03-13T04:26:09.965360 | 2018-06-04T09:39:34 | 2018-06-04T09:39:34 | 130,962,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 964 | java | package task6;
public class PersonalTask {
public static int findQuantityOfLocalMinimums (double[][] arr) {
int quantityOfElements = 0;
for(int i = 0; i<arr.length; i++) {
for (int j = 1; j < arr[i].length-1; j++) {
if(arr[i][j] < arr[i][j-1] & arr[i][j] < arr[i][j+1]) {
quantityOfElements++;
}
}
}
return quantityOfElements;
}
public static double[] findArrayOfLocalMinimums (double[][] arr) {
double[] arrayOfMinElements = new double[PersonalTask.findQuantityOfLocalMinimums(arr)];
for(int i = 0, k = 0; i<arr.length; i++, k++) {
for (int j = 1; j < arr[i].length-1; j++) {
if(arr[i][j] < arr[i][j-1] & arr[i][j] < arr[i][j+1]) {
arrayOfMinElements[k] = arr[i][j];
}
}
}
return arrayOfMinElements;
}
public static double findMinimum (double []arr) {
double min = arr[0];
for (int i = 0; i < arr.length; i++) {
if(arr[i] < min) {
min = arr[i];
}
}
return min;
}
}
| [
"[email protected]"
]
| |
e6753bdd38bbd30ef4a2fbb9a2adf65ac76ea8e3 | 8747b81118aa6b62dab92db09fef65fff9410150 | /src/test/java/com/seckill/dao/SeckillDaoTest.java | 27f6d7031c1dcf9fd230e27c8fa03b6587c72655 | []
| no_license | yuannauy123/sekill | ce35993748c35e25679c007f9fc2d0dcbed9218b | d88b33468cde5cc00be5a6e23880d59b65584a5f | refs/heads/master | 2020-03-19T05:14:35.963711 | 2018-06-03T15:03:01 | 2018-06-03T15:03:01 | 135,912,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,158 | java | package com.seckill.dao;
import com.seckill.entity.Seckill;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
import java.util.List;
import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring/spring-dao.xml"})
public class SeckillDaoTest {
@Autowired
private SeckillDao seckillDao;
@Test
public void reduceNumber() {
Date date=new Date();
int updateCount=seckillDao.reduceNumber(1000L,date);
System.out.println(updateCount);
}
@Test
public void queryByid() {
long id=1000;
Seckill seckill=seckillDao.queryByid(id);
System.out.println(seckill.getName());
System.out.println(seckill);
}
@Test
public void queryAll() {
List<Seckill> seckills=seckillDao.queryAll(0,100);
for(Seckill seckill:seckills){
System.out.println(seckill);
}
}
} | [
"[email protected]"
]
| |
12bc822855ebd3cfdadfc016c9a54f4bf373a518 | e28dd69cadca0c25ab78d74156813e7bcd53bac9 | /src/by/it/livanovich/jd02_02/Backet.java | 1f168a5be35d6845ff46194e055c08b3218d8306 | []
| no_license | jekson0702/JD2019-05-13 | 4cb1f11a80d26306be9617c8c75c04848ea06b05 | 5184aa81c7b7192841453091f33d85a1f8b30c3a | refs/heads/master | 2020-05-26T03:08:14.573688 | 2019-07-08T01:59:12 | 2019-07-08T01:59:12 | 188,086,194 | 1 | 0 | null | 2019-05-22T17:41:06 | 2019-05-22T17:41:06 | null | UTF-8 | Java | false | false | 178 | java | package by.it.livanovich.jd02_02;
import java.util.List;
public class Backet {
public static void putBacket(List<Good> list, Good good) {
list.add(good);
}
}
| [
"[email protected]"
]
| |
4f128e5d44bf2700b98008067fd1d86380bb8a09 | bfa3cd743bde7cd30956aaf97f6eb33c7267e149 | /src/main/java/com/dipo/mobileappwebservice/io/entity/UserEntity.java | ef126eb31693a84ea388bb87fc06172e084fcefe | []
| no_license | MrDiipo/Mobile-App-WebServices | b219f02df15236e0155508516de250329866db11 | 81f2e1c03f49f65afc95cadd9f06b23660495497 | refs/heads/master | 2023-08-24T01:05:07.299924 | 2021-09-30T23:55:52 | 2021-09-30T23:55:52 | 399,746,000 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,673 | java | package com.dipo.mobileappwebservice.io.entity;
import org.springframework.data.annotation.Id;
import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Entity
@Table(name = "users")
public class UserEntity implements Serializable {
@Serial
private static final long serialVersionUID = -7849005537474284228L;
@javax.persistence.Id
@GeneratedValue
private long id;
@Column(nullable = false)
private String userId;
@Column(nullable = false, length = 50)
private String firstName;
@Column(nullable = false, length = 50)
private String lastName;
@Column(nullable = false, length = 120)
private String email;
@Column(nullable = false)
private String encryptedPassword;
private String emailVerificationToken;
@Column(nullable = false)
private Boolean emailVerificationStatus = false;
@OneToMany(mappedBy = "userDto", cascade = CascadeType.ALL)
private List<AddressEntity> addressEntities;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getEncryptedPassword() {
return encryptedPassword;
}
public void setEncryptedPassword(String encryptedPassword) {
this.encryptedPassword = encryptedPassword;
}
public String getEmailVerificationToken() {
return emailVerificationToken;
}
public void setEmailVerificationToken(String emailVerificationToken) {
this.emailVerificationToken = emailVerificationToken;
}
public Boolean getEmailVerificationStatus() {
return emailVerificationStatus;
}
public void setEmailVerificationStatus(Boolean emailVerificationStatus) {
this.emailVerificationStatus = emailVerificationStatus;
}
public List<AddressEntity> getAddressEntities() {
return addressEntities;
}
public void setAddressEntities(List<AddressEntity> addressEntities) {
this.addressEntities = addressEntities;
}
}
| [
"[email protected]"
]
| |
6e1eafe11d903d4efc0bc23dd080bc1b9a484889 | 97ec8b04046b71859d42efdb176a6452750dbe24 | /src/Programmers/Hash/BestAlbum.java | d6ed260176c438ddb6f17d36a1c1a3ffa1593292 | []
| no_license | jihyeonmun/codingtest | ee92ac8c1014b6dde67ffb5454d4301227ff9780 | c3ab245d7ad9c9468d85b7556e63eb34a31d4cbf | refs/heads/master | 2023-04-25T00:19:09.335028 | 2021-05-14T13:40:52 | 2021-05-14T13:40:52 | 347,573,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package Programmers.Hash;
public class BestAlbum {
public static int[] solution(String[] genres, int[] plays) {
int[] answer = {};
return answer;
}
public static void main(String[] args){
String[] genres = {"classic","pop","classic","classic","pop"};
int[] plays = {500,600,150,800,2500};
System.out.println(solution(genres,plays));
}
} | [
"[email protected]"
]
| |
6078ca476d647af5fa5b84987c8f9966e1b96038 | a238b2604570b367a0bf23a877c63476038a8191 | /src/main/java/com/arthurzera/social/media/controllers/PostEvaluationController.java | 4d3d233edf6acfef4ffc9b60cb813249c502418f | []
| no_license | artur855/Social-Media | e077e9659e9859b82a237c38b209f463edca585b | 861560415ea5a0a9688a5c30d60f83b60298e360 | refs/heads/master | 2021-09-06T20:24:39.073076 | 2018-02-11T03:37:18 | 2018-02-11T03:37:18 | 118,184,786 | 3 | 0 | null | 2018-02-09T23:45:06 | 2018-01-19T22:16:54 | Java | UTF-8 | Java | false | false | 2,189 | java | package com.arthurzera.social.media.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.arthurzera.social.media.models.EvaluationType;
import com.arthurzera.social.media.models.Post;
import com.arthurzera.social.media.models.PostEvaluation;
import com.arthurzera.social.media.models.User;
@Controller
public class PostEvaluationController extends BasicController {
@RequestMapping("/posts/{id}/upvote")
public ModelAndView upvote(@PathVariable("id") Long id) {
ModelAndView mvc = super.mvc();
Post post = postService.findById(id);
User currentUser = (User) mvc.getModel().get("currentUser");
PostEvaluation postEvaluation = postEvaluationService.findByPostEvaluatedAndPostEvaluator(post, currentUser);
if (postEvaluation != null) {
if (postEvaluation.getEvaluation().name().equals("UP")) {
postEvaluation.setEvaluation(EvaluationType.NONE);
} else {
postEvaluation.setEvaluation(EvaluationType.UP);
}
postEvaluationService.edit(postEvaluation);
} else {
postEvaluation = new PostEvaluation(currentUser, post, EvaluationType.UP);
postEvaluationService.create(postEvaluation);
}
mvc.setViewName("redirect:/");
return mvc;
}
@RequestMapping("/posts/{id}/downvote")
public ModelAndView downvote(@PathVariable("id") Long id) {
ModelAndView mvc = super.mvc();
Post post = postService.findById(id);
User currentUser = (User) mvc.getModel().get("currentUser");
PostEvaluation postEvaluation = postEvaluationService.findByPostEvaluatedAndPostEvaluator(post, currentUser);
if (postEvaluation != null) {
if (postEvaluation.getEvaluation().name().equals("DOWN")) {
postEvaluation.setEvaluation(EvaluationType.NONE);
} else {
postEvaluation.setEvaluation(EvaluationType.DOWN);
}
postEvaluationService.edit(postEvaluation);
} else {
postEvaluation = new PostEvaluation(currentUser, post, EvaluationType.DOWN);
postEvaluationService.create(postEvaluation);
}
mvc.setViewName("redirect:/");
return mvc;
}
}
| [
"[email protected]"
]
| |
573645f1c865b53f03ea7fc38dc3e41bd8862199 | df221f28bbdf47d35ab1f43260408677262b77eb | /backend2AWS/src/main/java/com/les/config/CorsConfig.java | cd90dba60a79ffa51ffb6e29394ad3c625285a34 | [
"Apache-2.0"
]
| permissive | realmiya/ScentSearcher | 471ea2dd875aaba4f319090df9787fb7ebaf5352 | 7b9ace64532caf06eabba45baef1b8b3eda52b5f | refs/heads/main | 2023-07-17T19:20:05.348150 | 2021-08-31T16:12:55 | 2021-08-31T16:12:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package com.les.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
/**
* 由于使用vue + springBoot开发前后端完全分离的项目,因此需要解决跨域问题。
* 此配置类作用:实现允许跨域功能
*/
@Configuration
public class CorsConfig {
private CorsConfiguration buildConfig() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*"); //允许任何域名
corsConfiguration.addAllowedHeader("*"); //允许任何头
corsConfiguration.addAllowedMethod("*"); //允许任何方法
corsConfiguration.setAllowCredentials(true);
return corsConfiguration;
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", buildConfig()); //注册
return new CorsFilter(source);
}
} | [
"[email protected]"
]
| |
e439e7ab59c8c10b8b99ae10db50a23ceaceed2e | 12e2d59706eb6aa3d71ce223cff68945994e7548 | /Servlet Application/src/com/xoriant/ComputerBookServlet.java | 1d7a633054ab57728de6ea645d86468b2ffcc480 | []
| no_license | ab1995/Java2 | 53b999c094222d5be677b82437139d30e39accf5 | c4e2f6190e02115bfa888ceca102a3b5ec6f0146 | refs/heads/master | 2021-01-19T15:11:13.713475 | 2017-08-28T12:04:19 | 2017-08-28T12:04:19 | 100,948,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,369 | java | package com.xoriant;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class ComputerBookServlet extends HttpServlet{
ServletContext ctx;
@Override
public void init(ServletConfig config) throws ServletException{
this.ctx=config.getServletContext();
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out=response.getWriter();
HttpSession session=request.getSession();
out.println("<h2>Welcome "+session.getAttribute("uname")+"</h2>"
+ "<form action='controller?forward=histbooks' method='post'>"
+ " <input type='checkbox' value='c' name='comp'> C<br>"
+ " <input type='checkbox' value='cpp' name='comp'> C++<br>"
+ " <input type='checkbox' value='java' name='comp'> JAVA<br>"
+ " <input type='submit' value='Next'>"
+ "</form>");
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| [
"[email protected]"
]
| |
be64d0bc545c2cb638e3ea91151bbf45ec54eccd | b61885d7b5ec38979746d2269b43148eb739f429 | /projekat/MJCompiler/src/rs/ac/bg/etf/pp1/ast/CondTerm.java | 39454b6aa012175f7aaa5e2c38218c91f280dc87 | []
| no_license | BogdanMicovic/Java---comiler-for-MicroJava-simplified-Java-langague-to-executable-bytecode- | ff6ece51e9a999ab8fd49cdf32ecd4466577e795 | 136d77aa8551170b8a7f85c99e903ee6d6be1199 | refs/heads/master | 2023-04-07T22:00:58.222271 | 2021-04-03T17:30:35 | 2021-04-03T17:30:35 | 354,353,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | // generated with ast extension for cup
// version 0.8
// 19/7/2020 12:19:17
package rs.ac.bg.etf.pp1.ast;
public abstract class CondTerm implements SyntaxNode {
private SyntaxNode parent;
private int line;
public rs.etf.pp1.symboltable.concepts.Obj obj = null;
public SyntaxNode getParent() {
return parent;
}
public void setParent(SyntaxNode parent) {
this.parent=parent;
}
public int getLine() {
return line;
}
public void setLine(int line) {
this.line=line;
}
public abstract void accept(Visitor visitor);
public abstract void childrenAccept(Visitor visitor);
public abstract void traverseTopDown(Visitor visitor);
public abstract void traverseBottomUp(Visitor visitor);
public String toString() { return toString(""); }
public abstract String toString(String tab);
}
| [
"[email protected]"
]
| |
c95f1acbe9e2171f148eb49e9d8bb86539ae67cb | 3328a746fb34c727bf4f451219e7c0ac88a862cf | /core/src/de/morphbit/pong/domain/DoubleBallPowerup.java | 0112086c4ab3980f85f4dd5739131cc1a96253f0 | []
| no_license | Serbroda/pong-port-2011 | dc3ca17222f1ecee573a0771749b3cdf72206245 | 8c09fb584230f933b4b06d46334c3adbea49ad2d | refs/heads/master | 2023-08-14T19:12:53.534637 | 2021-09-17T19:21:46 | 2021-09-17T19:21:46 | 407,655,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package de.morphbit.pong.domain;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
public class DoubleBallPowerup extends Powerup {
private static final long serialVersionUID = 3857326717719311195L;
public DoubleBallPowerup(float fieldWidth, float fieldHeight) {
super(new Texture(Gdx.files.internal("img/pu_double_bw.png")), fieldWidth, fieldHeight);
}
}
| [
"[email protected]"
]
| |
6c5c959be51b43d0925168ccc5afdef6aef7a0ae | 343c79e2c638fe5b4ef14de39d885bc5e1e6aca5 | /MyApplication/app/src/main/java/cmcm/com/myapplication/gk.java | 278ad0b9e9882968c93ed16281e3e3d7113ba3e6 | []
| no_license | Leonilobayang/AndroidDemos | 05a76647b8e27582fa56e2e15d4195c2ff9b9c32 | 6ac06c3752dfa9cebe81f7c796525a17df620663 | refs/heads/master | 2022-04-17T06:56:52.912639 | 2016-07-01T07:48:50 | 2016-07-01T07:48:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package cmcm.com.myapplication;
import android.database.DataSetObserver;
import android.support.v4.view.ViewPager;
public class gk extends DataSetObserver
{
private gk(ViewPager paramViewPager)
{
}
public void onChanged()
{
this.a.dataSetChanged();
}
public void onInvalidated()
{
this.a.dataSetChanged();
}
}
/* Location: classes-dex2jar.jar
* Qualified Name: gk
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
]
| |
dcb8eeed1da30fbbbba67d6050e555ffa68830d3 | e4c6f459f5addf79b0193a1b73447db08e786ad4 | /src/test/java/com/gms/web/exam/Testtest.java | e3d755e21a5fc6a5743c740acf5a2a25acda2212 | []
| no_license | kingofahn/GMS-SPRING5-2 | 49039c01642d2af6949701e65079b0c52f79ebdf | 0a90c580fb328d84943c04cc2660736131607d41 | refs/heads/master | 2020-03-29T02:10:51.628536 | 2018-09-28T11:21:23 | 2018-09-28T11:21:23 | 149,423,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package com.gms.web.exam;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Testtest {
public static void main(String[] args) {
int stf = Integer.valueOf(new SimpleDateFormat("yyyy").format(new Date()))+1-1900;
String x = "850116-2";
String gender = "";
System.out.println("x.substring(7,8)" + x.substring(7,8));
System.out.println(x.substring(0,2));
int a = stf - Integer.parseInt(x.substring(0,2));
System.out.println(a);
gender=(x.substring(7,8).equals("1"))? "man":"woman" ;
System.out.println(stf);
System.out.println(gender);
}
}
| [
"[email protected]"
]
| |
57e16089602218ee285d2c0252d8f67cfc5f4a61 | 7ac92e0c7815b6cee84cdf4840b96d88ec2d3ec8 | /app/src/main/java/com/example/project/MainActivity.java | c2b8f7cdf0476ad6ed04bd2b4e21a7492a785a3d | []
| no_license | magmom7/androidex1 | 05b6e00ecae642c5ed41f02d73a3f944996b33fa | 2080da5871d006cdafdde90e8315e217143b4e2a | refs/heads/master | 2023-05-23T04:21:19.789083 | 2021-06-13T12:29:01 | 2021-06-13T12:29:01 | 376,537,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,006 | java | package com.example.project;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
EditText edit1, edit2;
Button btnAdd, btnSub, btnMul, btnDiv, btnRem;
TextView textResult;
String num1, num2;
Integer result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setTitle("초간단 계산기");
edit1 = (EditText) findViewById(R.id.Edit1);
edit2 = (EditText) findViewById(R.id.Edit2);
btnAdd = (Button) findViewById(R.id.BtnAdd);
btnSub = (Button) findViewById(R.id.BtnSub);
btnMul = (Button) findViewById(R.id.BtnMul);
btnDiv = (Button) findViewById(R.id.BtnDiv);
btnRem = (Button) findViewById(R.id.BtnRem);
textResult = (TextView) findViewById(R.id.TextResult);
btnAdd.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent motionEvent){
switch (motionEvent.getAction()){
case MotionEvent.ACTION_DOWN:
num1 = edit1.getText().toString();
num2 = edit2.getText().toString();
if (num1.isEmpty() || num2.isEmpty()) {
Toast.makeText(getApplicationContext(), "오류입니다.", Toast.LENGTH_SHORT).show();
break;
}
result = Integer.parseInt(num1) + Integer.parseInt(num2);
textResult.setText("결과값 ="+ result.toString());
break;
}
return false;
}
});
btnSub.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent motionEvent){
switch (motionEvent.getAction()){
case MotionEvent.ACTION_DOWN:
num1 = edit1.getText().toString();
num2 = edit2.getText().toString();
if (num1.isEmpty() || num2.isEmpty()) {
Toast.makeText(getApplicationContext(), "오류입니다.", Toast.LENGTH_SHORT).show();
break;
}
result = Integer.parseInt(num1) - Integer.parseInt(num2);
textResult.setText("결과값 ="+ result.toString());
break;
}
return false;
}
});
btnMul.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent motionEvent){
switch (motionEvent.getAction()){
case MotionEvent.ACTION_DOWN:
num1 = edit1.getText().toString();
num2 = edit2.getText().toString();
if (num1.isEmpty() || num2.isEmpty()) {
Toast.makeText(getApplicationContext(), "오류입니다.", Toast.LENGTH_SHORT).show();
break;
}
result = Integer.parseInt(num1) * Integer.parseInt(num2);
textResult.setText("결과값 ="+ result.toString());
break;
}
return false;
}
});
btnDiv.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent motionEvent){
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
num1 = edit1.getText().toString();
num2 = edit2.getText().toString();
if (num1.equals("0") || num2.equals("0")) {
Toast.makeText(getApplicationContext(), "오류입니다.", Toast.LENGTH_SHORT).show();
break;
}else if (num1.isEmpty() || num2.isEmpty()){
Toast.makeText(getApplicationContext(), "오류입니다.", Toast.LENGTH_SHORT).show();
break;
}
result = Integer.parseInt(num1) / Integer.parseInt(num2);
textResult.setText("결과값 =" + result.toString());
break;
}
return false;
}
});
btnRem.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent motionEvent){
switch (motionEvent.getAction()){
case MotionEvent.ACTION_DOWN:
num1 = edit1.getText().toString();
num2 = edit2.getText().toString();
if (num1.equals("0") || num2.equals("0")) {
Toast.makeText(getApplicationContext(), "오류입니다.", Toast.LENGTH_SHORT).show();
break;
}else if (num1.isEmpty() || num2.isEmpty()){
Toast.makeText(getApplicationContext(), "오류입니다.", Toast.LENGTH_SHORT).show();
break;
}
result = Integer.parseInt(num1) % Integer.parseInt(num2);
textResult.setText("결과값 ="+ result.toString());
break;
}
return false;
}
});
}
} | [
"[email protected]"
]
| |
f101d5143dcce85633976ae49735da25b3ceef99 | 2c1efe9b62fa1eb18b758fb34ed4edd2d4775c5d | /Backend/src/main/java/br/com/iverdura/iverdura/handler/ErrorHandler.java | 6a5173ba28622d9039794d7cb2d0cdda6cdacc27 | []
| no_license | RichardHespanholo/iVerdure | 576933dc086f9fb9de307e9cd18ce205c9a3fca0 | a6b2efc82e221d526af7a07e12a150f4bbe2297f | refs/heads/master | 2020-04-12T06:56:47.338815 | 2018-12-18T22:34:45 | 2018-12-18T22:34:45 | 162,352,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,337 | java | package br.com.iverdura.iverdura.handler;
import br.com.iverdura.iverdura.exception.BusinessException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@RestControllerAdvice
public class ErrorHandler {
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(BusinessException.class)
public VerdureErrorResponse businessErrorHandler(BusinessException businessException){
return new VerdureErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR,businessException.getMessage());
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MethodArgumentNotValidException.class)
public VerdureErrorResponse constraintErrorHandler(MethodArgumentNotValidException constraintValidationException){
String error = constraintValidationException.getMessage();
return new VerdureErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, error);
}
}
| [
"[email protected]"
]
| |
021769ae6707997ede13aaeac1a00daca86fbe9e | bd5562090487237b27274d6ad4b0e64c90d70604 | /abc.dao/src/main/java/com/autoserve/abc/dao/dataobject/GovPlainJDO.java | ddce7edb0d164531dc632fc82f5ec7714b6aa5e5 | []
| no_license | haxsscker/abc.parent | 04b0d659958a4c1b91bb41a002e814ea31bd0e85 | 0522c15aed591e755662ff16152b702182692f54 | refs/heads/master | 2020-05-04T20:25:34.863818 | 2019-04-04T05:49:01 | 2019-04-04T05:49:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,377 | java | package com.autoserve.abc.dao.dataobject;
import java.math.BigDecimal;
import java.util.Date;
/**
* 机构信息:包含对应的员工用户名,地区信息(非地区码)等
*
* @author RJQ 2014/12/8 15:13.
*/
public class GovPlainJDO {
/**
* abc_government.gov_id
*/
private Integer govId;
/**
* 用户名(每一个机构有一个员工账户)
* abc_employee_name
*/
private String govUserName;
/**
* 机构名称
* abc_government.gov_name
*/
private String govName;
/**
* 公司邮箱
* abc_government.gov_email
*/
private String govEmail;
/**
* 组织机构代码
* abc_government.gov_no
*/
private String govNo;
/**
* 营业执照号码
* abc_government.gov_business_license
*/
private String govBusinessLicense;
/**
* 企业规模 "0:50人以下
* 1:50~500人
* 2:500人以上"
* abc_government.gov_scale
*/
private Integer govScale;
/**
* 注册资金
* abc_government.gov_register_capital
*/
private BigDecimal govRegisterCapital;
/**
* 资产总额
* abc_government.gov_total_capital
*/
private BigDecimal govTotalCapital;
/**
* 最大借款额度
* abc_government.gov_max_loan_amount
*/
private BigDecimal govMaxLoanAmount;
/**
* 注册地行政区划
* abc_government.gov_register_division
*/
private String govRegisterDivision;
/**
* 注册地址
* abc_government.gov_register_address
*/
private String govRegisterAddress;
/**
* 注册日期
* abc_government.gov_register_date
*/
private Date govRegisterDate;
/**
* 联系人
* abc_government.gov_contact
*/
private String govContact;
/**
* 联系电话
* abc_government.gov_contact_phone
*/
private String govContactPhone;
/**
* 客户经理id
* abc_government.gov_customer_manager
*/
private Integer govCustomerManager;
/**
* 客户经理姓名
*/
private String govCustomerManagerName;
/**
* 法定代表人
* abc_government.gov_corporate
*/
private String govCorporate;
/**
* 证件类型
* abc_government.gov_doc_type
*/
private String govDocType;
/**
* 证件号码
* abc_government.gov_doc_no
*/
private String govDocNo;
/**
* 信用级别
* abc_government.gov_credit_level
*/
private String govCreditLevel;
/**
* 所属地区
* abc_government.gov_area
*/
private String govArea;
/**
* 详细地址
* abc_government.gov_address_detail
*/
private String govAddressDetail;
/**
* 是否提供担保 1:是 0:否
* abc_government.gov_is_offer_guar
*/
private Integer govIsOfferGuar;
/**
* 最大担保额度
* abc_government.gov_max_guar_amount
*/
private BigDecimal govMaxGuarAmount;
/**
* 可用担保额度
* abc_government.gov_sett_guar_amount
*/
private BigDecimal govSettGuarAmount;
/**
* 机构logo图片
* abc_government.gov_logo
*/
private String govLogo;
/**
* 担保机构名称集合
* abc_government.gov_guar_name
*/
private String govGuarName;
/**
* 担保机构ID集合
* abc_government.gov_guar_id
*/
private String govGuarId;
/**
* 是否启用 1:启用 0:停用 2 : 已删除
* abc_government.gov_is_enable
*/
private Integer govIsEnable;
/**
* 机构状态 0:待审核 1:审核已通过 2:审核未通过
* abc_government.gov_state
*/
private Integer govState;
/**
* 审核人
* abc_government.gov_reviewer
*/
private Integer govReviewer;
/**
* 修改时间
*/
public String govModifyDate;
/**
* 审核日期
* abc_government.gov_review_date
*/
private Date govReviewDate;
/**
* 添加人
* abc_government.gov_add_emp
*/
private Integer govAddEmp;
/**
* 添加日期
* abc_government.gov_add_date
*/
private Date govAddDate;
/**
* 公司概况
* abc_government.gov_profile
*/
private String govProfile;
/**
* 团队管理
* abc_government.gov_team_management
*/
private String govTeamManagement;
/**
* 发展历史
* abc_government.gov_development_history
*/
private String govDevelopmentHistory;
/**
* 融资性担保牌照
* abc_government.gov_guar_card
*/
private String govGuarCard;
/**
* 合作机构
* abc_government.gov_partner
*/
private String govPartner;
/**
* 合作协议
* abc_government.gov_cooperate_agreement
*/
private String govCooperateAgreement;
/**
* 外部交易流水號
* abc_government.gov_out_seq_no
*/
private String govOutSeqNo;
private Date govLastModifyTime;
/**
* 后台用户id
*/
private Integer empId;
public Integer getEmpId() {
return empId;
}
public void setEmpId(Integer empId) {
this.empId = empId;
}
public Date getGovLastModifyTime() {
return govLastModifyTime;
}
public void setGovLastModifyTime(Date govLastModifyTime) {
this.govLastModifyTime = govLastModifyTime;
}
public Integer getGovId() {
return govId;
}
public void setGovId(Integer govId) {
this.govId = govId;
}
public String getGovUserName() {
return govUserName;
}
public void setGovUserName(String govUserName) {
this.govUserName = govUserName;
}
public String getGovName() {
return govName;
}
public void setGovName(String govName) {
this.govName = govName;
}
public String getGovEmail() {
return govEmail;
}
public void setGovEmail(String govEmail) {
this.govEmail = govEmail;
}
public String getGovNo() {
return govNo;
}
public void setGovNo(String govNo) {
this.govNo = govNo;
}
public String getGovBusinessLicense() {
return govBusinessLicense;
}
public void setGovBusinessLicense(String govBusinessLicense) {
this.govBusinessLicense = govBusinessLicense;
}
public Integer getGovScale() {
return govScale;
}
public void setGovScale(Integer govScale) {
this.govScale = govScale;
}
public BigDecimal getGovRegisterCapital() {
return govRegisterCapital;
}
public void setGovRegisterCapital(BigDecimal govRegisterCapital) {
this.govRegisterCapital = govRegisterCapital;
}
public BigDecimal getGovTotalCapital() {
return govTotalCapital;
}
public void setGovTotalCapital(BigDecimal govTotalCapital) {
this.govTotalCapital = govTotalCapital;
}
public BigDecimal getGovMaxLoanAmount() {
return govMaxLoanAmount;
}
public void setGovMaxLoanAmount(BigDecimal govMaxLoanAmount) {
this.govMaxLoanAmount = govMaxLoanAmount;
}
public String getGovRegisterDivision() {
return govRegisterDivision;
}
public void setGovRegisterDivision(String govRegisterDivision) {
this.govRegisterDivision = govRegisterDivision;
}
public String getGovRegisterAddress() {
return govRegisterAddress;
}
public void setGovRegisterAddress(String govRegisterAddress) {
this.govRegisterAddress = govRegisterAddress;
}
public Date getGovRegisterDate() {
return govRegisterDate;
}
public void setGovRegisterDate(Date govRegisterDate) {
this.govRegisterDate = govRegisterDate;
}
public String getGovContact() {
return govContact;
}
public void setGovContact(String govContact) {
this.govContact = govContact;
}
public String getGovContactPhone() {
return govContactPhone;
}
public void setGovContactPhone(String govContactPhone) {
this.govContactPhone = govContactPhone;
}
public String getGovCorporate() {
return govCorporate;
}
public void setGovCorporate(String govCorporate) {
this.govCorporate = govCorporate;
}
public String getGovDocType() {
return govDocType;
}
public void setGovDocType(String govDocType) {
this.govDocType = govDocType;
}
public String getGovDocNo() {
return govDocNo;
}
public void setGovDocNo(String govDocNo) {
this.govDocNo = govDocNo;
}
public String getGovCreditLevel() {
return govCreditLevel;
}
public void setGovCreditLevel(String govCreditLevel) {
this.govCreditLevel = govCreditLevel;
}
public String getGovArea() {
return govArea;
}
public void setGovArea(String govArea) {
this.govArea = govArea;
}
public String getGovAddressDetail() {
return govAddressDetail;
}
public void setGovAddressDetail(String govAddressDetail) {
this.govAddressDetail = govAddressDetail;
}
public Integer getGovIsOfferGuar() {
return govIsOfferGuar;
}
public void setGovIsOfferGuar(Integer govIsOfferGuar) {
this.govIsOfferGuar = govIsOfferGuar;
}
public BigDecimal getGovMaxGuarAmount() {
return govMaxGuarAmount;
}
public void setGovMaxGuarAmount(BigDecimal govMaxGuarAmount) {
this.govMaxGuarAmount = govMaxGuarAmount;
}
public BigDecimal getGovSettGuarAmount() {
return govSettGuarAmount;
}
public void setGovSettGuarAmount(BigDecimal govSettGuarAmount) {
this.govSettGuarAmount = govSettGuarAmount;
}
public String getGovLogo() {
return govLogo;
}
public void setGovLogo(String govLogo) {
this.govLogo = govLogo;
}
public String getGovGuarName() {
return govGuarName;
}
public void setGovGuarName(String govGuarName) {
this.govGuarName = govGuarName;
}
public String getGovGuarId() {
return govGuarId;
}
public void setGovGuarId(String govGuarId) {
this.govGuarId = govGuarId;
}
public Integer getGovIsEnable() {
return govIsEnable;
}
public void setGovIsEnable(Integer govIsEnable) {
this.govIsEnable = govIsEnable;
}
public Integer getGovState() {
return govState;
}
public void setGovState(Integer govState) {
this.govState = govState;
}
public Integer getGovReviewer() {
return govReviewer;
}
public void setGovReviewer(Integer govReviewer) {
this.govReviewer = govReviewer;
}
public Date getGovReviewDate() {
return govReviewDate;
}
public void setGovReviewDate(Date govReviewDate) {
this.govReviewDate = govReviewDate;
}
public Integer getGovAddEmp() {
return govAddEmp;
}
public void setGovAddEmp(Integer govAddEmp) {
this.govAddEmp = govAddEmp;
}
public Date getGovAddDate() {
return govAddDate;
}
public void setGovAddDate(Date govAddDate) {
this.govAddDate = govAddDate;
}
public String getGovProfile() {
return govProfile;
}
public void setGovProfile(String govProfile) {
this.govProfile = govProfile;
}
public String getGovTeamManagement() {
return govTeamManagement;
}
public void setGovTeamManagement(String govTeamManagement) {
this.govTeamManagement = govTeamManagement;
}
public String getGovDevelopmentHistory() {
return govDevelopmentHistory;
}
public void setGovDevelopmentHistory(String govDevelopmentHistory) {
this.govDevelopmentHistory = govDevelopmentHistory;
}
public String getGovGuarCard() {
return govGuarCard;
}
public void setGovGuarCard(String govGuarCard) {
this.govGuarCard = govGuarCard;
}
public String getGovPartner() {
return govPartner;
}
public void setGovPartner(String govPartner) {
this.govPartner = govPartner;
}
public String getGovCooperateAgreement() {
return govCooperateAgreement;
}
public void setGovCooperateAgreement(String govCooperateAgreement) {
this.govCooperateAgreement = govCooperateAgreement;
}
public Integer getGovCustomerManager() {
return govCustomerManager;
}
public void setGovCustomerManager(Integer govCustomerManager) {
this.govCustomerManager = govCustomerManager;
}
public String getGovCustomerManagerName() {
return govCustomerManagerName;
}
public void setGovCustomerManagerName(String govCustomerManagerName) {
this.govCustomerManagerName = govCustomerManagerName;
}
public String getGovModifyDate() {
return govModifyDate;
}
public void setGovModifyDate(String govModifyDate) {
this.govModifyDate = govModifyDate;
}
public String getGovOutSeqNo() {
return govOutSeqNo;
}
public void setGovOutSeqNo(String govOutSeqNo) {
this.govOutSeqNo = govOutSeqNo;
}
}
| [
"[email protected]"
]
| |
91aec6d92a91951f22efd40862ecd84827dd921e | 678a3d58c110afd1e9ce195d2f20b2531d45a2e0 | /sources/com/airbnb/android/explore/viewcomponents/viewmodels/InputSuggestionSubRowEpoxyModel.java | c2304006417c515b904c357676347e159938e5ab | []
| no_license | jasonnth/AirCode | d1c37fb9ba3d8087efcdd9fa2103fb85d13735d5 | d37db1baa493fca56f390c4205faf5c9bbe36604 | refs/heads/master | 2020-07-03T08:35:24.902940 | 2019-08-12T03:34:56 | 2019-08-12T03:34:56 | 201,842,970 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,409 | java | package com.airbnb.android.explore.viewcomponents.viewmodels;
import android.view.View.OnClickListener;
import com.airbnb.p027n2.components.InputSuggestionSubRow;
import com.airbnb.p027n2.epoxy.AirEpoxyModel;
public abstract class InputSuggestionSubRowEpoxyModel extends AirEpoxyModel<InputSuggestionSubRow> {
String boldText;
int boldTextRes;
boolean invertColors;
boolean lastSubRow;
OnClickListener onClickListener;
String title;
int titleRes;
public void bind(InputSuggestionSubRow view) {
boolean z = false;
super.bind(view);
if (this.titleRes != 0) {
this.title = view.getResources().getString(this.titleRes);
}
if (this.boldTextRes != 0) {
this.boldText = view.getResources().getString(this.boldTextRes);
}
view.configureText(this.title, this.boldText);
view.setOnClickListener(this.onClickListener);
if (this.onClickListener == null) {
view.setClickable(false);
}
view.invertColors(this.invertColors);
if (!this.lastSubRow) {
z = true;
}
view.showSubRowDivider(z);
view.showDivider(this.lastSubRow);
}
public void unbind(InputSuggestionSubRow view) {
super.unbind(view);
view.setOnClickListener(null);
}
public int getDividerViewType() {
return 0;
}
}
| [
"[email protected]"
]
| |
747403fd42e7cfacc1904abbe7f18c3153d87dd3 | d0d7e8732ac3b5446808ba8416a38ff3f86e8dfc | /src/main/java/dev/sanket/transactionstatistics/service/TransactionServiceImpl.java | a58ed04ae449df1c9bd86af8e9f5db663e95a657 | []
| no_license | sanketmeghani/transaction-statistics | 2f60b17db60f51160fd81fdd9ccfef2aaf5a974a | 5a20f2842fed6760841c2ef7bc79bdf6ef09de0a | refs/heads/master | 2020-03-17T00:29:52.046543 | 2018-05-13T11:01:10 | 2018-05-13T11:01:10 | 133,118,912 | 2 | 0 | null | 2018-05-12T09:30:53 | 2018-05-12T06:05:07 | Java | UTF-8 | Java | false | false | 1,092 | java | package dev.sanket.transactionstatistics.service;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import dev.sanket.transactionstatistics.exception.TransactionServiceException;
import dev.sanket.transactionstatistics.model.Transaction;
public class TransactionServiceImpl implements TransactionService {
@Autowired
private StatisticsService statisticsService;
@Override
public void add(Transaction transaction) throws TransactionServiceException {
long transactionAge = (System.currentTimeMillis() - transaction.getTimestamp()) / 1000;
if (transactionAge > 60) {
ZonedDateTime transactionTime = Instant.ofEpochMilli(transaction.getTimestamp())
.atZone(ZoneId.systemDefault());
throw new TransactionServiceException(
"Transaction is older than 60 seconds. Transaction time - " + transactionTime);
}
this.statisticsService.trackTransaction(transaction);
}
}
| [
"[email protected]"
]
| |
e5a364e361310d8dbda1429f384884c35e64b49b | 46a83616af7ab04e7806bfa3e53879ef31771ec8 | /keyboard-repository/src/main/java/org/ditto/keyboard/repository/PhotoRepository.java | 148bbb733c53eead652f30cce55276f6b62560d7 | []
| no_license | conanchen/hiask-android-keyboard | 058ecab3dc13fcdfed05b23729a30a35b70f0b2a | 2f27e6d39fb08845851bbab43af6ff62c3e3f143 | refs/heads/master | 2021-06-28T13:30:36.954959 | 2017-09-14T12:35:29 | 2017-09-14T12:35:29 | 103,512,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,275 | java | package org.ditto.keyboard.repository;
/**
* Created by admin on 2017/7/28.
*/
import android.arch.lifecycle.LiveData;
import org.ditto.keyboard.apirest.ApirestFascade;
import org.ditto.keyboard.dbroom.RoomFascade;
import org.ditto.keyboard.dbroom.photo.Photo;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;
/**
* Repository that handles Photo objects.
*/
@Singleton
public class PhotoRepository {
private ApirestFascade apirestFascade;
private RoomFascade roomFascade;
private PhotoContentQuery photoContentQuery;
@Inject
public PhotoRepository(ApirestFascade apirestFascade, RoomFascade roomFascade,PhotoContentQuery photoContentQuery) {
this.roomFascade = roomFascade;
this.apirestFascade = apirestFascade;
this.photoContentQuery = photoContentQuery;
}
public LiveData<List<Photo>> listLiveContentQueryPhotosBy(int pageSize, int pageIndex) {
return photoContentQuery.listPhotosBy(pageSize, pageIndex);
}
public LiveData<Long> save(final Photo carousel) {
return new LiveData<Long>() {
{
Observable
.fromCallable(() -> roomFascade.photoDao.save(carousel))
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.computation())
.subscribe(id -> {
postValue(id);
});
}
};
}
public void delete(Photo carousel) {
roomFascade.photoDao.delete(carousel);
}
public List<Photo> listPhotos() {
return roomFascade.photoDao.listPhotos();
}
public LiveData<List<Photo>> listLiveDatabasePhotos() {
return roomFascade.photoDao.listLivePhotos();
}
public LiveData<Long> liveCountPhotoSelected() {
return roomFascade.photoDao.liveCountPhotoSelected();
}
public Flowable<List<Photo>> listFlowableSelectedPhotos() {
return roomFascade.photoDao.listFlowableSelectedPhotos();
}
public void cleanSelectedPhotos() {
roomFascade.photoDao.cleanSelectedPhotos();
}
}
| [
"[email protected]"
]
| |
0d2b3c5eae195cccb88c4a52124299035b636820 | 49ab28401da4c6d6170720e1d38eb5993b84936c | /BankingApp/src/App/Bank.java | 4d56064929334d425fd5c4900a121cc7b3728eb4 | []
| no_license | arjunSharma93/BankingApp | e8d6b4b068cb1e72fbb40d9b9060daa44a154809 | 1279b3fd5b8784d2e143ef9af9412e72b8b1a2ec | refs/heads/main | 2023-01-18T15:37:15.529705 | 2020-11-27T12:10:22 | 2020-11-27T12:10:22 | 315,693,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package App;
public abstract class Bank {
public final double govtAtmCharge = 5.00;
public abstract double calculateInterest(int year);
public abstract boolean isEligibleForLoan();
public abstract void balanceCheck();
public double calculateAtmCharge(int year) {
double ans = govtAtmCharge*year;
return ans;
}
}
| [
"[email protected]"
]
| |
89fb4fbe966fc2b005c1e8716e61d2bf9b645a06 | d7f8b353662f063afb66b18cae558df9b9716d33 | /student/src/it/java/edu/pdx/cs410J/shuping/StudentIT.java | 887322caf0cdb539062de138f50b267ef458829e | [
"Apache-2.0"
]
| permissive | evan0708/ADVJavaSummer2016Project0 | 345f642ad5809096e5313f5123aa34a997752024 | 1286ea279c7a5fc8012dec4d45649ff713fe77a4 | refs/heads/master | 2021-04-30T18:37:53.035750 | 2016-06-28T19:05:28 | 2016-06-28T19:05:28 | 61,764,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 999 | java | package edu.pdx.cs410J.shuping;
import edu.pdx.cs410J.InvokeMainTestCase;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.StringContains.containsString;
/**
* Integration tests for the <code>Student</code> class's main method.
* These tests extend <code>InvokeMainTestCase</code> which allows them
* to easily invoke the <code>main</code> method of <code>Student</code>.
*/
public class StudentIT extends InvokeMainTestCase {
@Test
public void invokingMainWithNoArgumentsHasExitCodeOf1() {
InvokeMainTestCase.MainMethodResult result = invokeMain(Student.class);
assertThat(result.getExitCode(), equalTo(1));
}
@Test
public void invokingMainWithNoArgumentsPrintsMissingArgumentsToStandardError() {
InvokeMainTestCase.MainMethodResult result = invokeMain(Student.class);
assertThat(result.getErr(), containsString("Missing command line arguments"));
}
}
| [
"[email protected]"
]
| |
aa8bf9773db74fe135105f13c9d741edfd9c5514 | 4f4f7f2678bcef75bc202bac372fd066251a74b2 | /gateway/src/main/java/com/stock/gateway/models/JwtResponse.java | affc719c3751dea6634f1d1aa83c8f0f58218c7d | [
"MIT"
]
| permissive | shriramrseee/stock-market-chart | 4ac33418e06efc688ea43b9b5aaab51f13fb9510 | 479efa111502080758e21e9b8ec12c45c8743bae | refs/heads/master | 2022-12-14T22:31:32.553669 | 2020-09-10T04:45:17 | 2020-09-10T04:45:17 | 290,468,389 | 0 | 0 | MIT | 2020-09-09T13:54:57 | 2020-08-26T10:39:01 | Java | UTF-8 | Java | false | false | 454 | java | package com.stock.gateway.models;
import java.io.Serializable;
public class JwtResponse implements Serializable {
private static final long serialVersionUID = -8091879091924046844L;
private final String jwttoken;
private final String type;
public JwtResponse(String jwttoken, String type) {
this.jwttoken = jwttoken;
this.type = type;
}
public String getToken() {
return this.jwttoken;
}
public String getType() {
return type;
}
}
| [
"[email protected]"
]
| |
7484f15feb63ab98eeb6a7698fba790c890b65a7 | b3de8ecd6b7e5ed1e1baebdef44d7b26e7a7e3d8 | /helloworld/hibernate/hibernate-onetoone-day03/src/com/sz/ben/hibernate/onetoone/Person.java | 774cd9206c30a150fdcbed52eb0375f529303025 | []
| no_license | lee-quinnf/quinnfResp | f9a57af8957ebe74be9676d70a1a32871a2a2226 | 0eeb9e2e69079f15e8b45994d48114d318bd3602 | refs/heads/master | 2022-12-21T09:59:37.661630 | 2020-05-03T01:01:39 | 2020-05-03T01:01:39 | 251,167,938 | 5 | 0 | null | 2022-12-15T23:47:28 | 2020-03-30T01:01:21 | Java | UTF-8 | Java | false | false | 716 | java | package com.sz.ben.hibernate.onetoone;
import java.io.Serializable;
import java.util.Set;
public class Person implements Serializable{
private Long pid;
private String name;
private String sex;
private Set<Course> courses;
public Long getPid() {
return pid;
}
public void setPid(Long pid) {
this.pid = pid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Set<Course> getCourses() {
return courses;
}
public void setCourses(Set<Course> courses) {
this.courses = courses;
}
}
| [
"[email protected]"
]
| |
ffe043d64d57cbf5b0ea570388e75fc822629516 | 21eb3fab84d4cbd6a2608edd0386e08d53721e9d | /src/tools/android/java/com/google/devtools/build/android/desugar/nest/CrossMateMainCollector.java | 521e7fb144719f28ce5e2b601258b6f0e033261c | [
"Apache-2.0"
]
| permissive | marcohu/bazel | 77267b22fc2f6e656ead2dbc1aa544bbbab1c9c4 | 9d9e2169c3bbc7b78be061c21da2cda50aefe1f3 | refs/heads/master | 2020-07-10T01:01:24.176408 | 2020-02-03T09:11:20 | 2020-02-03T09:12:16 | 203,660,611 | 0 | 0 | Apache-2.0 | 2019-08-23T21:55:12 | 2019-08-21T20:37:05 | Java | UTF-8 | Java | false | false | 6,832 | java | // Copyright 2019 The Bazel Authors. 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.google.devtools.build.android.desugar.nest;
import com.google.devtools.build.android.desugar.langmodel.ClassAttributeRecord;
import com.google.devtools.build.android.desugar.langmodel.ClassAttributes;
import com.google.devtools.build.android.desugar.langmodel.ClassAttributes.ClassAttributesBuilder;
import com.google.devtools.build.android.desugar.langmodel.ClassMemberKey;
import com.google.devtools.build.android.desugar.langmodel.ClassMemberRecord;
import com.google.devtools.build.android.desugar.langmodel.FieldKey;
import com.google.devtools.build.android.desugar.langmodel.LangModelHelper;
import com.google.devtools.build.android.desugar.langmodel.MethodKey;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
/**
* A visitor that collects declared private members (fields, constructors and methods), and
* delegates to a method visitor to track the references to these members.
*/
final class CrossMateMainCollector extends ClassVisitor {
/** The project-wise class member records. */
private final ClassMemberRecord memberRecord;
private final ClassAttributeRecord classAttributeRecord;
/**
* An class member record to stage member record candidates, merging into the project-wise member
* record during the {@link #visitEnd()} where eligible conditions are specified.
*/
private final ClassMemberRecord stagingMemberRecord = ClassMemberRecord.create();
private final ClassAttributesBuilder classAttributesBuilder = ClassAttributes.builder();
private String className;
private int classAccessCode;
private boolean isInNest;
public CrossMateMainCollector(
ClassMemberRecord memberRecord, ClassAttributeRecord classAttributeRecord) {
super(Opcodes.ASM7);
this.memberRecord = memberRecord;
this.classAttributeRecord = classAttributeRecord;
}
@Override
public void visit(
int version,
int access,
String name,
String signature,
String superName,
String[] interfaces) {
className = name;
classAccessCode = access;
classAttributesBuilder.setClassBinaryName(className);
super.visit(
Math.min(version, NestDesugarConstants.MIN_VERSION),
access,
name,
signature,
superName,
interfaces);
}
@Override
public FieldVisitor visitField(
int access, String name, String descriptor, String signature, Object value) {
if ((access & Opcodes.ACC_PRIVATE) != 0) {
stagingMemberRecord.logMemberDecl(
FieldKey.create(className, name, descriptor), classAccessCode, access);
}
return super.visitField(access, name, descriptor, signature, value);
}
@Override
public MethodVisitor visitMethod(
int access, String name, String descriptor, String signature, String[] exceptions) {
MethodKey methodKey = MethodKey.create(className, name, descriptor);
if ((access & Opcodes.ACC_PRIVATE) != 0 && !isInDeclOmissionList(methodKey)) {
stagingMemberRecord.logMemberDecl(methodKey, classAccessCode, access);
}
return new CrossMateRefCollector(
super.visitMethod(access, name, descriptor, signature, exceptions),
methodKey,
stagingMemberRecord);
}
/**
* The method declaration will be explicitly omitted.
*
* <p>TODO(deltazulu): Refine this list and condition check. e.g. check ACC_SYNTHETIC flag.
*/
private static boolean isInDeclOmissionList(MethodKey methodKey) {
return methodKey.name().startsWith("lambda$") // handled by LambdaDesugaring.
|| methodKey.name().equals("$deserializeLambda$") // handled by LambdaDesugaring.
|| methodKey.name().contains("jacoco$") // handled by InterfaceDesugaring.
|| methodKey.name().contains("$jacoco"); // handled by InterfaceDesugaring.
}
@Override
public void visitNestHost(String nestHost) {
isInNest = true;
classAttributesBuilder.setNestHost(nestHost);
super.visitNestHost(nestHost);
}
@Override
public void visitNestMember(String nestMember) {
isInNest = true;
classAttributesBuilder.addNestMember(nestMember);
super.visitNestMember(nestMember);
}
@Override
public void visitEnd() {
if (isInNest || (classAccessCode & Opcodes.ACC_INTERFACE) != 0) {
memberRecord.mergeFrom(stagingMemberRecord);
}
classAttributeRecord.setClassAttributes(classAttributesBuilder.build());
super.visitEnd();
}
/**
* A visitor that collects privately referenced class members (fields/constructors/methods) within
* a nest.
*/
private static class CrossMateRefCollector extends MethodVisitor {
/** The current enclosing the method. */
private final MethodKey enclosingMethodKey;
/**
* A per-class class member record and will determined to merge or not into the main member
* record at visitEnd of its associated class visitor.
*
* <p>@see CrossMateMainCollector#stagingMemberRecord for more details.
*/
private final ClassMemberRecord memberRecord;
CrossMateRefCollector(
MethodVisitor methodVisitor, MethodKey enclosingMethodKey, ClassMemberRecord memberRecord) {
super(Opcodes.ASM7, methodVisitor);
this.enclosingMethodKey = enclosingMethodKey;
this.memberRecord = memberRecord;
}
@Override
public void visitFieldInsn(int opcode, String owner, String name, String descriptor) {
ClassMemberKey memberKey = FieldKey.create(owner, name, descriptor);
if (LangModelHelper.isCrossMateRefInNest(memberKey, enclosingMethodKey)) {
memberRecord.logMemberUse(memberKey, opcode);
}
super.visitFieldInsn(opcode, owner, name, descriptor);
}
@Override
public void visitMethodInsn(
int opcode, String owner, String name, String descriptor, boolean isInterface) {
ClassMemberKey memberKey = MethodKey.create(owner, name, descriptor);
if (isInterface || LangModelHelper.isCrossMateRefInNest(memberKey, enclosingMethodKey)) {
memberRecord.logMemberUse(memberKey, opcode);
}
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
}
}
}
| [
"[email protected]"
]
| |
ae71cd496e08a0968d9b944bcb1027811331cead | f0d3cea735c5d2d2b475bbdd09f347595f37f0f6 | /buttermilk-core/src/main/java/com/cryptoregistry/rsa/RSAKeyContents.java | 1e09412ffa3d4e821f7665ef99d94426a7bdab10 | []
| no_license | xdel/buttermilk | 3842ed344b51a0569e33a66d0adf595adc00e499 | 2e0e9375af2b3ee484a7bd47162a9829880d81c3 | refs/heads/master | 2021-01-10T01:19:10.023000 | 2015-08-02T06:59:47 | 2015-08-02T06:59:47 | 50,387,981 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,576 | java | /*
* This file is part of Buttermilk
* Copyright 2011-2014 David R. Smith All Rights Reserved.
*
*/
package com.cryptoregistry.rsa;
import java.math.BigInteger;
import com.cryptoregistry.Signer;
import com.cryptoregistry.passwords.Password;
import com.cryptoregistry.pbe.PBEParams;
import x.org.bouncycastle.crypto.params.RSAKeyParameters;
import x.org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
/**
* Output from Key Generation for RSA
*
* @author Dave
*
*/
public class RSAKeyContents extends RSAKeyForPublication implements Signer {
public final BigInteger privateExponent;
public final BigInteger p;
public final BigInteger q;
public final BigInteger dP;
public final BigInteger dQ;
public final BigInteger qInv;
/**
* Use for Mode.Open
*
* @param modulus
* @param publicExponent
* @param privateExponent
* @param p
* @param q
* @param dP
* @param dQ
* @param qInv
*/
public RSAKeyContents(BigInteger modulus, BigInteger publicExponent,
BigInteger privateExponent, BigInteger p, BigInteger q,
BigInteger dP, BigInteger dQ, BigInteger qInv) {
super(RSAKeyMetadata.createDefault(), modulus, publicExponent);
this.privateExponent = privateExponent;
this.p = p;
this.q = q;
this.dP = dP;
this.dQ = dQ;
this.qInv = qInv;
}
/**
* Use for Mode.SEALED
*
* @param password
* @param modulus
* @param publicExponent
* @param privateExponent
* @param p
* @param q
* @param dP
* @param dQ
* @param qInv
*/
public RSAKeyContents(char [] password, BigInteger modulus, BigInteger publicExponent,
BigInteger privateExponent, BigInteger p, BigInteger q,
BigInteger dP, BigInteger dQ, BigInteger qInv) {
super(RSAKeyMetadata.createSecurePBKDF2(password), modulus, publicExponent);
this.privateExponent = privateExponent;
this.p = p;
this.q = q;
this.dP = dP;
this.dQ = dQ;
this.qInv = qInv;
}
public RSAKeyContents(RSAKeyMetadata metadata,
BigInteger modulus, BigInteger publicExponent,
BigInteger privateExponent, BigInteger p, BigInteger q,
BigInteger dP, BigInteger dQ, BigInteger qInv) {
super(metadata, modulus, publicExponent);
this.privateExponent = privateExponent;
this.p = p;
this.q = q;
this.dP = dP;
this.dQ = dQ;
this.qInv = qInv;
}
public final RSAKeyParameters getPrivateKey() {
return new RSAPrivateCrtKeyParameters(modulus, publicExponent, privateExponent, p, q, dP, dQ, qInv);
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((dP == null) ? 0 : dP.hashCode());
result = prime * result + ((dQ == null) ? 0 : dQ.hashCode());
result = prime * result + ((p == null) ? 0 : p.hashCode());
result = prime * result
+ ((privateExponent == null) ? 0 : privateExponent.hashCode());
result = prime * result + ((q == null) ? 0 : q.hashCode());
result = prime * result + ((qInv == null) ? 0 : qInv.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
RSAKeyContents other = (RSAKeyContents) obj;
if (dP == null) {
if (other.dP != null)
return false;
} else if (!dP.equals(other.dP))
return false;
if (dQ == null) {
if (other.dQ != null)
return false;
} else if (!dQ.equals(other.dQ))
return false;
if (p == null) {
if (other.p != null)
return false;
} else if (!p.equals(other.p))
return false;
if (privateExponent == null) {
if (other.privateExponent != null)
return false;
} else if (!privateExponent.equals(other.privateExponent))
return false;
if (q == null) {
if (other.q != null)
return false;
} else if (!q.equals(other.q))
return false;
if (qInv == null) {
if (other.qInv != null)
return false;
} else if (!qInv.equals(other.qInv))
return false;
return true;
}
/**
* If a password is set in the KeyFormat, clean that out. This call can be made once we're done
* with the key materials in this cycle of use.
*/
@Override
public void scrubPassword() {
PBEParams params = this.metadata.format.pbeParams;
if(params != null) {
Password password = params.getPassword();
if(password != null && password.isAlive()) password.selfDestruct();
}
}
}
| [
"[email protected]"
]
| |
02160fdaf5dd95a068592f1165f3ea7d5ca221e3 | 039ea0e76610820255729d94c1c530da40785f9c | /app/src/main/java/com/commonsware/empublite/SimpleContentFragment.java | d03c88ebcd9f820bdc4aa1352564b0fe08c1a634 | []
| no_license | zakame/EmPubLite | 5c90a483b2abcbdc6f1f016cd99510672a9b96ef | 9cffd84f00f73c276094a1af3e44c32b71f2e5dd | refs/heads/master | 2021-01-10T00:58:39.024903 | 2015-11-08T20:47:26 | 2015-11-08T20:47:26 | 45,814,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,497 | java | package com.commonsware.empublite;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebViewFragment;
public class SimpleContentFragment extends WebViewFragment {
private static final String KEY_FILE = "file";
protected static SimpleContentFragment newInstance(String file) {
SimpleContentFragment f = new SimpleContentFragment();
Bundle args = new Bundle();
args.putString(KEY_FILE, file);
f.setArguments(args);
return f;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@SuppressLint("SetJavaScriptEnabled")
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View result = super.onCreateView(inflater,
container,
savedInstanceState);
getWebView().getSettings().setJavaScriptEnabled(true);
getWebView().getSettings().setSupportZoom(true);
getWebView().getSettings().setBuiltInZoomControls(true);
getWebView().loadUrl(getPage());
return result;
}
private String getPage() {
return getArguments().getString(KEY_FILE);
}
}
| [
"[email protected]"
]
| |
dd725d3ba0c68d324067322779c9c2f72c0881b6 | 769850e15400f2b1a3b58a88fd8e8aa3ed23dd77 | /server/src/main/java/com/tradinggames/api/configs/SecurityConfig.java | bb4ea3a4e0b82a3a1b2d1d94bcd5f36f0ad271e5 | []
| no_license | WenderGalan/TradingGames | 20e25d3cee9ff10762b2b661db4781571b3c29eb | 7d8a869e012504cc55d3f469829395af15a3e85e | refs/heads/master | 2021-09-02T19:44:27.926955 | 2018-01-03T20:13:41 | 2018-01-03T20:13:41 | 116,177,679 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package com.tradinggames.api.configs;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
super.configure(http);
http
.authorizeRequests().anyRequest()
.permitAll()
.and()
.csrf().disable();
}
}
| [
"[email protected]"
]
| |
23d8b5bfb650e0311f0e96787d0197fd06af94ec | 125340d2ef1e2e5a9062977773a53c42932b1d63 | /estrutura-de-dados-java/src/base/EstruturaEstatica.java | a820adfc3822d25be4442e66da7ea45dac4fae85 | []
| no_license | HenioJunior/estrutura-de-dados-java | 885226b2fb5aaefe811ef36d034792be1235ac94 | 8e7882929fbe86c9675ddc9c98bbb9e3c0c5e0a4 | refs/heads/main | 2023-04-02T03:47:27.413223 | 2021-04-13T00:01:11 | 2021-04-13T00:01:11 | 351,188,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,256 | java | package base;
public class EstruturaEstatica<T> {
protected T[] elementos;
protected int tamanho;
@SuppressWarnings("unchecked")
public EstruturaEstatica(int capacidade) {
this.elementos = (T[])new Object[capacidade]; //Solução do livro Effective Java
this.tamanho = 0;
}
public EstruturaEstatica() {
this(10);
}
protected boolean adiciona(T elemento) {
aumentaCapacidade();
if(tamanho < elementos.length) {
elementos[tamanho] = elemento;
tamanho++;
return true;
}
return false;
}
//0 1 2 3 4 5 6 => tamanho = 5
//B C E F G + +
protected boolean adiciona(int posicao, T elemento) {
if(!(posicao >=0 && posicao < tamanho)) {
throw new IllegalArgumentException("Posição inválida");
}
aumentaCapacidade();
//mover todos os elementos
for(int i=tamanho - 1; i >= posicao; i--) {
elementos[i + 1] = elementos[i];
}
elementos[posicao] = elemento;
tamanho++;
return false;
}
public void remove(int posicao) {
if(!(posicao >=0 && posicao < tamanho)) {
throw new IllegalArgumentException("Posição inválida");
}
for(int i = posicao; i < tamanho; i++) {
elementos[i] = elementos[i + 1];
}
tamanho--;
}
private void aumentaCapacidade() {
if(tamanho == elementos.length) {
T[] elementosNovos = (T[])new Object[elementos.length * 2];
for (int i = 0 ; i < tamanho; i++) {
elementosNovos[i] = elementos[i];
}
elementos = elementosNovos;
}
}
public int tamanho() {
return tamanho;
}
public boolean estaVazia() {
return tamanho == 0;
}
@Override
public String toString() {
StringBuilder s = new StringBuilder();
s.append("[");
for(int i = 0; i < tamanho - 1; i++) {
s.append(elementos[i]);
s.append(", ");
}
if(this.tamanho >0) {
s.append(elementos[tamanho - 1]);
}
s.append("]");
return s.toString();
}
}
| [
"[email protected]"
]
| |
8548f6c2183c5a1efc06c424ebc46470678d1c68 | 27e6af1e8953416332321aefcdbd16be3cd6ca0c | /android/app/src/main/java/com/doggylife/MainApplication.java | d97233ddbdab7c389583deb450ec1135bcd69f22 | []
| no_license | fabines/DoggyLife | 701c32d3bb85638e9a6133b31f88684cbdd4e7d8 | 2a11a518a574ec0040b8256c3637fdd28466f8fb | refs/heads/master | 2023-01-12T08:04:16.865410 | 2019-08-16T15:31:56 | 2019-08-16T15:31:56 | 202,753,254 | 0 | 0 | null | 2023-01-04T07:23:13 | 2019-08-16T15:31:17 | JavaScript | UTF-8 | Java | false | false | 1,362 | java | package com.doggylife;
import android.app.Application;
import android.util.Log;
import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"github.com/fabines/tapud"
]
| github.com/fabines/tapud |
eb8401d333a802b140f7e03e7c3dcb412299b6a0 | c43bbaf70b3532f0092ad6ce81161aecfdafc6dc | /demo/code/src/main/java/com/hhnz/api/cfcrm/model/cfcrm/PaymentCollectionMO.java | 311657452ec3aba5507924c53ed8e35e089b6fe8 | []
| no_license | heartzeus/wb | c403f7e2e337033061e7872c85b90b028ad77788 | 2ae898c5680e88b8354cbda7e581583dac78902f | refs/heads/master | 2020-12-30T17:10:24.891351 | 2017-07-03T07:07:54 | 2017-07-03T07:07:54 | 91,055,844 | 0 | 1 | null | 2017-05-12T06:56:13 | 2017-05-12T05:48:08 | Java | UTF-8 | Java | false | false | 4,315 | java | package com.hhnz.api.cfcrm.model.cfcrm;
import com.tuhanbao.base.dataservice.ServiceBean;
import com.tuhanbao.base.util.db.table.data.IntValue;
import com.tuhanbao.base.util.db.table.data.LongValue;
import com.tuhanbao.base.util.db.table.data.StringValue;
import com.tuhanbao.base.util.db.table.data.TimeValue;
import com.hhnz.api.cfcrm.constants.TableConstants;
import com.tuhanbao.base.dataservice.MetaObject;
import java.util.List;
import com.hhnz.api.cfcrm.constants.enums.MoneyBackStatus;
import java.util.Date;
public class PaymentCollectionMO extends ServiceBean {
protected PaymentCollectionMO() {
this(new MetaObject(TableConstants.T_PAYMENT_COLLECTION.TABLE));
}
protected PaymentCollectionMO(MetaObject mo) {
super(mo);
}
public long getId() {
LongValue value = (LongValue)getValue(TableConstants.T_PAYMENT_COLLECTION.ID);
if (value == null) return 0;
else return value.getValue();
}
public void setId(Long value) {
setValue(TableConstants.T_PAYMENT_COLLECTION.ID, LongValue.valueOf(value));
}
public long getCustomId() {
LongValue value = (LongValue)getValue(TableConstants.T_PAYMENT_COLLECTION.CUSTOM_ID);
if (value == null) return 0;
else return value.getValue();
}
public void setCustomId(Long value) {
setValue(TableConstants.T_PAYMENT_COLLECTION.CUSTOM_ID, LongValue.valueOf(value));
}
public VipPrimaryInfo getCustom() {
List<? extends ServiceBean> result = this.getFKBean(TableConstants.T_PAYMENT_COLLECTION.CUSTOM_ID);
return result == null || result.isEmpty() ? null : (VipPrimaryInfo)result.get(0);
}
public VipPrimaryInfo removeCustom() {
List<? extends ServiceBean> result = this.removeFKBean(TableConstants.T_PAYMENT_COLLECTION.CUSTOM_ID);
return result == null || result.isEmpty() ? null : (VipPrimaryInfo)result.get(0);
}
public void setCustom(VipPrimaryInfo value) {
this.setFKBean(TableConstants.T_PAYMENT_COLLECTION.CUSTOM_ID, value);
}
public String getProjectName() {
StringValue value = (StringValue)getValue(TableConstants.T_PAYMENT_COLLECTION.PROJECT_NAME);
if (value == null) return null;
else return value.getValue();
}
public void setProjectName(String value) {
setValue(TableConstants.T_PAYMENT_COLLECTION.PROJECT_NAME, StringValue.valueOf(value));
}
public int getCapital() {
IntValue value = (IntValue)getValue(TableConstants.T_PAYMENT_COLLECTION.CAPITAL);
if (value == null) return 0;
else return value.getValue();
}
public void setCapital(Integer value) {
setValue(TableConstants.T_PAYMENT_COLLECTION.CAPITAL, IntValue.valueOf(value));
}
public int getProfit() {
IntValue value = (IntValue)getValue(TableConstants.T_PAYMENT_COLLECTION.PROFIT);
if (value == null) return 0;
else return value.getValue();
}
public void setProfit(Integer value) {
setValue(TableConstants.T_PAYMENT_COLLECTION.PROFIT, IntValue.valueOf(value));
}
public MoneyBackStatus getStatus() {
IntValue value = (IntValue)getValue(TableConstants.T_PAYMENT_COLLECTION.STATUS);
if (value == null) return null;
else return MoneyBackStatus.getMoneyBackStatus(value.getValue());
}
public void setStatus(MoneyBackStatus value) {
setValue(TableConstants.T_PAYMENT_COLLECTION.STATUS, IntValue.valueOf(value.value));
}
public Date getPaymentCollectionDate() {
TimeValue value = (TimeValue)getValue(TableConstants.T_PAYMENT_COLLECTION.PAYMENT_COLLECTION_DATE);
if (value == null) return null;
else return value.getValue();
}
public void setPaymentCollectionDate(Date value) {
setValue(TableConstants.T_PAYMENT_COLLECTION.PAYMENT_COLLECTION_DATE, TimeValue.valueOf(value));
}
public long getPaymentCollection() {
LongValue value = (LongValue)getValue(TableConstants.T_PAYMENT_COLLECTION.PAYMENT_COLLECTION);
if (value == null) return 0;
else return value.getValue();
}
public void setPaymentCollection(Long value) {
setValue(TableConstants.T_PAYMENT_COLLECTION.PAYMENT_COLLECTION, LongValue.valueOf(value));
}
} | [
"[email protected]"
]
| |
1fa00cd52c1a1a09e5fad7bb1923dc9608c09f5a | 96c2fe5f82e839604de435128876b7ec23994108 | /leetcode/p0645/Solution.java | c90ccd04fd27df7efd52ac3748a9f71efcb46d1c | [
"MIT"
]
| permissive | suhwanhwang/problem-solving | d9ed5521fdd670c4793d187116f489a82ee4a90d | cf71bd9545d13959462713bd6eabee05e88f40f3 | refs/heads/master | 2023-08-31T15:29:46.164871 | 2023-08-28T23:12:26 | 2023-08-28T23:12:26 | 199,259,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | class Solution {
public int[] findErrorNums(int[] nums) {
Set<Integer> set = new HashSet<>();
int[] ans = new int[2];
for (int num : nums) {
if (set.contains(num)) {
ans[0] = num;
}
set.add(num);
}
for (int i = 1; i <= nums.length; ++i) {
if (!set.contains(i)) {
ans[1] = i;
break;
}
}
return ans;
}
}
| [
"[email protected]"
]
| |
117df91c8270d3f38d57b7d2cad0e7e1038f4bce | 80e3b47a6031c658a1e9da6b3cba4f404db181b3 | /ast/Type.java | 7526117899f8f7fae6db49f4c5e2a418b091b088 | []
| no_license | sloanchoi1124/jsmm | ab934d8e12f6b289b68b485d98f0890fc52cce5d | f4d8e504569f77dcba3594779c488b94a1bac6d4 | refs/heads/master | 2021-01-10T03:21:47.161079 | 2016-01-11T02:19:33 | 2016-01-11T02:19:33 | 49,396,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | java | package ast;
import java.util.List;
import java.util.ArrayList;
import java.util.SortedMap;
public abstract class Type {
public static final NullType NULL_TYPE = new NullType();
public static class NullType extends Type {
private NullType() { }
}
public static final BooleanType BOOLEAN_TYPE = new BooleanType();
public static class BooleanType extends Type {
private BooleanType() { }
}
public static final IntType INT_TYPE = new IntType();
public static class IntType extends Type {
private IntType() { }
}
public static final StringType STRING_TYPE = new StringType();
public static class StringType extends Type {
private StringType() { }
}
public static final AnyType ANY_TYPE = new AnyType();
public static class AnyType extends Type {
private AnyType() { }
}
public static class TupleType extends Type {
public final List<Type> types;
public TupleType(List<Type> types) {
this.types = types;
}
}
public static final TupleType VOID_TYPE = new TupleType(new ArrayList<Type>());
public static class ArrayType extends Type {
public final Type innerType;
public ArrayType(Type innerType) {
this.innerType = innerType;
}
}
public static class ObjectType extends Type {
public final SortedMap<String, Type> memberTypes;
public ObjectType(SortedMap<String, Type> memberTypes) {
this.memberTypes = memberTypes;
}
}
public static class FunctionType extends Type {
public final Type inType, outType;
public FunctionType(Type inType, Type outType) {
this.inType = inType;
this.outType = outType;
}
}
}
| [
"[email protected]"
]
| |
828b49129677a06b9ca38ffce334a3f31534aa75 | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Log4j/Log4j3004.java | c407a8a90e419acec4e47d6bf875539b1bbbe3ca | []
| no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | private int convertLevel(final Level level) {
switch (level.getStandardLevel()) {
case DEBUG :
return LocationAwareLogger.DEBUG_INT;
case TRACE :
return LocationAwareLogger.TRACE_INT;
case INFO :
return LocationAwareLogger.INFO_INT;
case WARN :
return LocationAwareLogger.WARN_INT;
case ERROR :
return LocationAwareLogger.ERROR_INT;
default :
return LocationAwareLogger.ERROR_INT;
}
}
| [
"[email protected]"
]
| |
d19d6b9e5145c5299be0c5d7f73ba317a246f1df | 83dab28a9dd35220592b7bbf9c655d991bfecdf9 | /src/train/ticket/reservation/system/FileManger.java | f916a232ebc1e221d91270fd6e4468b9c9693d40 | []
| no_license | YoussefRashad/Train-Ticket-Reservation-System | fe9e85bce5608346cca9ebd24fe0078811941a31 | 6629e21eb602675ebc163771be23f2e3baa5e6ea | refs/heads/master | 2020-04-23T10:32:16.651120 | 2019-02-17T10:19:48 | 2019-02-17T10:19:48 | 171,107,770 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,909 | java |
package train.ticket.reservation.system;
import java.io.PrintWriter;
import java.io.FileWriter;
import java.io.File;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public final class FileManger {
public boolean Write (String Query , String FilePath , boolean append)
{
PrintWriter Writter = null;
try{
System.out.print("\nwritting in ! " + FilePath);
Writter = new PrintWriter(new FileWriter(new File(FilePath),append));
Writter.println(Query);
System.out.println(" ... Done ! ");
return true;
}
catch(IOException em)
{
System.out.println("Error in Writting : "+em);
}
finally{
Writter.close();
}
return false;
}
public ArrayList<Object> Read (String FilePath)
{
Scanner Reader= null;
try{
System.out.println("Reading ! From " + FilePath);
Reader = new Scanner(new File(FilePath));
}
catch(FileNotFoundException e)
{
System.out.println("Error in Reading by Youssef : "+e);
}
if(FilePath.equals("Employee.txt")){
ArrayList<Employee>Employees = new ArrayList<Employee>();
Employee emp;
while(Reader.hasNext()){
emp = new Employee();
String line = Reader.nextLine();
String Sepreted []= line.split("`");
// Name ` ID ` Username ` Password ` Qualificaion ` Salary ` Age ` Gender ` PhoneNo ` Email `
emp.SetName(Sepreted[0]);
emp.SetID(Integer.parseInt(Sepreted[1]));
emp.SetUsername(Sepreted[2]);
emp.SetPassword(Sepreted[3]);
emp.SetQualification(Sepreted[4]);
emp.SetSalary(Double.parseDouble(Sepreted[5]));
emp.SetAge(Integer.parseInt(Sepreted[6]));
emp.SetGender(Sepreted[7]);
emp.SetPhoneNo(Sepreted[8]);
emp.SetEmail(Sepreted[9]);
Employees.add(emp);
}
return (ArrayList<Object>) (Object) Employees;
}
else if(FilePath.equals("Train.txt")){
ArrayList<Train>Trains = new ArrayList<Train>();
Train t;
while(Reader.hasNext()){
t = new Train();
String line = Reader.nextLine();
String []Sepreted = line.split("`");
//ID_Train ` Line ` OriginPoint ` EndPoint ` Date `
t.SetID_Train(Integer.parseInt((Sepreted[0])));
t.SetLine(Sepreted[1]);
//t.SetNoOfPassengerInLines(Sepreted[1]);
t.setOriginPoint(Sepreted[2]);
t.setEndPoint(Sepreted[3]);
t.SetDate(Sepreted[4]);
Trains.add(t);
}
return (ArrayList<Object>)(Object)Trains;
}
else if(FilePath.equals("PassengerTicket.txt")){
ArrayList<Ticket>tickets = new ArrayList<Ticket>();
Ticket t;
while(Reader.hasNext()){
t = new Ticket();
String line = Reader.nextLine();
String []Sepreted = line.split("`");
//Name ` PhoneNo ` Email ` ID_Ticket ` Line ` Source ` distnation ` Price ` Date
t.SetName(Sepreted[0]);
t.SetPhoneNo(Sepreted[1]);
t.SetEmail(Sepreted[2]);
t.SetIDTicket(Integer.parseInt(Sepreted[3]));
t.SetLine(Sepreted[4]);
//t.SetNoOfPassengerInLines(Sepreted[4]);
t.SelectSource(Sepreted[5]);
t.SelectDistantion(Sepreted[6]);
t.SetPrice(Integer.parseInt(Sepreted[7]));
t.SetDate(Sepreted[8]);
tickets.add(t);
}
return (ArrayList<Object>)(Object)tickets;
}
else if (FilePath.equals("Admin.txt")){
ArrayList<Admin>admins = new ArrayList<Admin>();
Admin ad ;
while(Reader.hasNext()){
ad = new Admin();
String Line = Reader.nextLine();
String []Sepreted=Line.split("`");
// Name ` ID ` Username ` Password ` Qualificaion ` Salary ` Age ` Gender ` PhoneNo ` Email `
ad.SetName(Sepreted[0]);
ad.SetID(Integer.parseInt(Sepreted[1]));
ad.SetUsername(Sepreted[2]);
ad.SetPassword(Sepreted[3]);
ad.SetQualification(Sepreted[4]);
ad.SetSalary(Double.parseDouble(Sepreted[5]));
ad.SetAge(Integer.parseInt(Sepreted[6]));
ad.SetGender(Sepreted[7]);
ad.SetPhoneNo(Sepreted[8]);
ad.SetEmail(Sepreted[9]);
admins.add(ad);
}
return (ArrayList<Object>)(Object)admins;
}
else if(FilePath.equals("Email.txt")){
ArrayList<Mail> mails = new ArrayList<Mail>();
Mail m ;
while(Reader.hasNext()){
m = new Mail();
String Line = Reader.nextLine();
String Seprated[]=Line.split("`");
// ToEmail ` CcEmail ` Subject ` Emailbody `
m.setToEmail(Seprated[0]);
m.setCcEmail(Seprated[1]);
m.setSubject(Seprated[2]);
m.setEmailbody(Seprated[3]);
mails.add(m);
}
return (ArrayList<Object>)(Object)mails;
}
return null;
}
}
| [
"[email protected]"
]
| |
a343e93f241d2e752ad5cfac076c6105469e3210 | 269aa8a3b179895d38efd11ef02960959e760426 | /CS680_2015/hw5/CS680-HW5-1/src/Policy.java | abb90c191daf8732f46c371ee625ec72708e2ffe | []
| no_license | Yong-Zhuang/Courses | 6bacf58e49d89a8587950cef85c74c7c390c8c11 | 6d94d65fb707f3a0d705d2ecc7612ae73467d731 | refs/heads/master | 2021-05-04T10:45:17.246233 | 2018-03-17T18:43:58 | 2018-03-17T18:43:58 | 51,711,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,336 | java |
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
public class Policy {
private Product product;
private int policyNumber;
private double deductible;
private double annualPremium;
private double monthlyPayment;
private double ytdPayment;
private String agentName;
private String insuredName;
private Date [] policyTerm =new Date [2];
public Policy (Product product, int policyNumber, double deductible, double annualPremium, String agentName, Date start, Date expire){
this.product=product;
this.policyNumber=policyNumber;
this.deductible= deductible;
this.annualPremium=annualPremium;
this.monthlyPayment=annualPremium/12;
this.agentName=agentName;
this.policyTerm [0]=start;
this.policyTerm [1]=expire;
}
public void setInsured(String insured)
{
this.insuredName=insured;
}
public int getPolicyNumber()
{
return this.policyNumber;
}
public double getDeductible()
{
return this.deductible;
}
public double getAnnualPremium()
{
return this.annualPremium;
}
public double getMonthlyPayment()
{
return this.monthlyPayment;
}
public double getYTDPayment()
{
Calendar c = Calendar.getInstance();
this.ytdPayment=monthlyPayment*c.get(Calendar.MONTH);
return this.ytdPayment;
}
public String getAgentName()
{
return this.agentName;
}
public boolean isAvailable()
{
Date now = new Date(System.currentTimeMillis());
if(now.after(this.policyTerm [0]))
{
return now.before(this.policyTerm [1]);
}
return false;
}
public String getInfo(){
StringBuffer buffer = new StringBuffer();
buffer.append("..........\r\n");
buffer.append("Insurer Name: "+ this.product.getInsurerName()+"\r\n");
buffer.append("Product Name: "+ this.product.getProductName()+"\r\n");
buffer.append("Available? "+ this.isAvailable()+"\r\n");
buffer.append("Deductible: "+ this.deductible+"\r\n");
buffer.append("Annual Premium: "+ this.annualPremium+"\r\n");
buffer.append("Monthly Payment: "+ this.monthlyPayment+"\r\n");
buffer.append("Agent Name: "+ this.agentName+"\r\n");
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
buffer.append("Policy Term: from "+ format.format(this.policyTerm [0])+" to "+format.format(this.policyTerm [1])+"\r\n");
buffer.append("..........\r\n");
return buffer.toString();
}
}
| [
"[email protected]"
]
| |
9769f2345f2b4d6f8ab24c2aff5145577d7c84ad | 2d69ab7b41a0e5c49ac0cdd51df83b23a487c221 | /src/main/java/me/thamma/cube/Main.java | 3e5cc22f50e0468869390eda43ce6f1e082f92b0 | []
| no_license | thamma/cube | 229a1a5d4ee6198c67d786edc37f159baee4f23d | a24f51b325bbbe3f49ead5923fa1257c4ba33377 | refs/heads/master | 2021-09-23T10:28:41.493630 | 2021-09-11T11:10:18 | 2021-09-11T11:10:18 | 49,982,608 | 0 | 0 | null | 2016-08-02T19:32:42 | 2016-01-19T20:57:27 | Java | UTF-8 | Java | false | false | 1,460 | java | package me.thamma.cube;
import me.thamma.cube.model.*;
import me.thamma.utils.CubeUtils;
import java.util.ArrayList;
import java.util.List;
import static me.thamma.cube.model.Turn.*;
public class Main {
public static void main(String... args) {
List<Bandage> bandage = new ArrayList<>();
bandage.add(new Bandage(Sticker.UL, Sticker.ULB));
bandage.add(new Bandage(Sticker.U, Sticker.UB));
bandage.add(new Bandage(Sticker.UR, Sticker.UBR));
bandage.add(new Bandage(Sticker.UF, Sticker.URF));
bandage.add(new Bandage(Sticker.F, Sticker.FR));
bandage.add(new Bandage(Sticker.R, Sticker.RB));
bandage.add(new Bandage(Sticker.LDB, Sticker.LB));
bandage.add(new Bandage(Sticker.L, Sticker.LD));
bandage.add(new Bandage(Sticker.FL, Sticker.FDL));
bandage.add(new Bandage(Sticker.FD, Sticker.FRD));
bandage.add(new Bandage(Sticker.RD, Sticker.RBD));
bandage.add(new Bandage(Sticker.B, Sticker.BD));
bandage.add(new Bandage(Sticker.D, Sticker.DB));
// Algorithm that transforms a solved cube into the state of the bandage cube
Algorithm algo = Algorithm.fromScramble(
"[Db'D',F'] F [U'FUF', b] F'");
BandageCube cube = new BandageCube(bandage, algo.inverse());
Algorithm solution = CubeUtils.bfsBandageSolution(cube, new Turn[]{UP, FRONT, RIGHT, LEFT});
System.out.println(solution);
}
} | [
"[email protected]"
]
| |
81a91d1786b2f6a3436210d113172bdf3041b93d | d8ce096990d6571514155ef65813dde3349ac444 | /java/CorrecaoDigitalProject/src/Aluno.java | a1398c7cab003a88281e87db1cd0c5ab202cd6b3 | []
| no_license | DigitalHouseBrasil/MobileAndroid-0219MOACN015O | a25c7dff590c817c7ee2eb37157495208f14878a | 6cf1e5c855a513ec82796a7f0398805d82529f28 | refs/heads/master | 2020-09-03T20:36:21.039333 | 2020-04-25T00:21:20 | 2020-04-25T00:21:20 | 219,563,394 | 3 | 5 | null | 2020-04-25T00:21:21 | 2019-11-04T17:57:25 | Java | UTF-8 | Java | false | false | 848 | java | public class Aluno {
private int RA;
private String nome;
private String sobrenome;
public void assistirAula(){
System.out.println("Assistindo Aula " + this.nome);
}
public void fazendoLicao(){
System.out.println("Fazendo lição " + this.nome);
}
public Aluno(int RA, String nome, String sobrenome) {
this.RA = RA;
this.nome = nome;
this.sobrenome = sobrenome;
}
public int getRA() {
return RA;
}
public void setRA(int RA) {
this.RA = RA;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSobrenome() {
return sobrenome;
}
public void setSobrenome(String sobrenome) {
this.sobrenome = sobrenome;
}
}
| [
"[email protected]"
]
| |
dd041c9e973face8e88fbfece0a2c5432008ceb5 | 4c86b1f11ad9ddb2c4f4db802a65502b1749f919 | /tutorial-examples-master/case-studies/dukes-bookstore/src/main/java/javaeetutorial/dukesbookstore/ejb/BookRequestBean.java | d7a7cea066019383153e2c600a83cecf0acf9533 | [
"BSD-3-Clause-No-Nuclear-License-2014"
]
| permissive | u1069791Natalie/uni | c12e03a6dcfb0e37a2feac51bf01c9e0bf831135 | 04224c6c64de26eb60ec040c51648224ad8b5a83 | refs/heads/master | 2020-08-31T21:11:57.052269 | 2019-10-31T14:41:34 | 2019-10-31T14:41:34 | 218,785,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,258 | java | /**
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
*
* You may not modify, use, reproduce, or distribute this software except in
* compliance with the terms of the License at:
* https://github.com/javaee/tutorial-examples/LICENSE.txt
*/
package javaeetutorial.dukesbookstore.ejb;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javaeetutorial.dukesbookstore.entity.Book;
import javaeetutorial.dukesbookstore.exception.BookNotFoundException;
import javaeetutorial.dukesbookstore.exception.BooksNotFoundException;
import javaeetutorial.dukesbookstore.exception.OrderException;
import javaeetutorial.dukesbookstore.web.managedbeans.ShoppingCart;
import javaeetutorial.dukesbookstore.web.managedbeans.ShoppingCartItem;
import javax.ejb.EJBException;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* <p>Stateful session bean for the bookstore example.</p>
*/
@Stateful
public class BookRequestBean {
@PersistenceContext
private EntityManager em;
private static final Logger logger =
Logger.getLogger("dukesbookstore.ejb.BookRequestBean");
public BookRequestBean() throws Exception {
}
public void createBook(String isbn, String surname, String firstname,
String title, Double price, Boolean onsale, Integer calendarYear,
String description, Integer inventory) {
try {
Book book = new Book(isbn, surname, firstname, title, price,
onsale, calendarYear, description, inventory);
logger.log(Level.INFO, "Created book {0}", isbn);
em.persist(book);
logger.log(Level.INFO, "Persisted book {0}", isbn);
} catch (Exception ex) {
throw new EJBException(ex.getMessage());
}
}
public List<Book> getBooks() throws BooksNotFoundException {
try {
return (List<Book>) em.createNamedQuery("findBooks").getResultList();
} catch (Exception ex) {
throw new BooksNotFoundException(
"Could not get books: " + ex.getMessage());
}
}
public Book getBook(String isbn) throws BookNotFoundException {
Book requestedBook = em.find(Book.class, isbn);
if (requestedBook == null) {
throw new BookNotFoundException("Couldn't find book: " + isbn);
}
return requestedBook;
}
public void buyBooks(ShoppingCart cart) throws OrderException {
Collection<ShoppingCartItem> items = cart.getItems();
Iterator<ShoppingCartItem> i = items.iterator();
try {
while (i.hasNext()) {
ShoppingCartItem sci = (ShoppingCartItem) i.next();
Book bd = (Book) sci.getItem();
String id = bd.getIsbn();
int quantity = sci.getQuantity();
buyBook(id, quantity);
}
} catch (OrderException ex) {
throw new OrderException("Commit failed: " + ex.getMessage());
}
}
public void buyBook(String isbn, int quantity)
throws OrderException {
try {
Book requestedBook = em.find(Book.class, isbn);
if (requestedBook != null) {
int inventory = requestedBook.getInventory();
if ((inventory - quantity) >= 0) {
int newInventory = inventory - quantity;
requestedBook.setInventory(newInventory);
} else {
throw new OrderException(
"Not enough of " + isbn
+ " in stock to complete order.");
}
}
} catch (OrderException ex) {
throw new OrderException(
"Couldn't purchase book: " + isbn + ex.getMessage());
}
}
public void updateInventory(ShoppingCart cart) throws OrderException {
try {
buyBooks(cart);
} catch (OrderException ex) {
throw new OrderException("Inventory update failed: " + ex.getMessage());
}
}
}
| [
"[email protected]"
]
| |
daf86bd590e0d9a21f8972f4b51916fcaaed1890 | e130fa624b0cc46a0612615b3fee7d94942a0098 | /src/agh/powerSim/simulation/actors/environment/WeatherActor.java | 82cc45496d217b67d19909cfbd4385785fb7d420 | []
| no_license | atok/POWERsim | 8fffb8aa9057ece54a467e34db41a8270ced2a2a | f63a5dea5bd7e221ea98701346ccd1e29bcf8835 | refs/heads/master | 2016-09-05T09:22:15.726044 | 2013-07-08T23:24:55 | 2013-07-08T23:24:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,273 | java | package agh.powerSim.simulation.actors.environment;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import org.joda.time.Interval;
import org.joda.time.LocalDateTime;
import agh.powerSim.gui.Context;
import agh.powerSim.simulation.actors.ClockActor;
import agh.powerSim.simulation.actors.House;
import agh.powerSim.simulation.actors.devices.BaseDevice;
import agh.powerSim.simulation.actors.utils.DataRecorder;
import akka.actor.ActorRef;
import akka.actor.UntypedActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;
import com.luckycatlabs.sunrisesunset.SunriseSunsetCalculator;
import com.luckycatlabs.sunrisesunset.dto.Location;
public class WeatherActor extends UntypedActor {
protected LoggingAdapter log = Logging.getLogger(getContext().system(), this);
protected String properties = "weather.properties";
protected final List<ActorRef> houses = new LinkedList<>();
public WeatherElement<Double> sun;
public WeatherElement<Double> clouds;
public WeatherElement<Double> temperature;
public WeatherElement<Boolean> front;
public static boolean logOn = true;
private int viewUpdate = 0;
@Override
public void preStart() {
sun = new Sun(properties);
front = new Front();
clouds = new Clouds();
clouds.setRelatedElement(front);
temperature = new Temperature(properties);
temperature.setRelatedElement(front);
temperature.setRelatedElement(clouds);
super.preStart();
getContext().actorFor("akka://SimSystem/user/clock").tell(new ClockActor.RegisterActorSignal(getSelf(), BaseDevice.class), getSelf());
}
@Override
public void onReceive(Object message) throws Exception {
if (message instanceof NewHouse) {
houses.add(((NewHouse) message).house);
if (logOn)
log.warning("New house added to the WORLD!");
} else if (message instanceof ClockActor.TimeSignal) {
ClockActor.TimeSignal t = (ClockActor.TimeSignal) message;
sun.processTime(t.time, t.deltaTime);
front.processTime(t.time, t.deltaTime);
clouds.processTime(t.time, t.deltaTime);
temperature.processTime(t.time, t.deltaTime);
if (logOn) {
getContext().actorFor("akka://SimSystem/user/recorder")
.tell(new DataRecorder.StatusRecord("Wheather status: SUN=" + sun.getValue() + "; CLOUDS=" + clouds.getValue() + "; TEMP=" + temperature.getValue(), t.time, getSelf()), getSelf());
}
double lightProvided = 10 * (50.0 * sun.getValue() + 50.0 * (sun.getValue() * clouds.getValue()) / (sun.getValue() + clouds.getValue() + 1.0)) / 100.0 * t.deltaTime;
double heatProvided = temperature.getValue() * t.deltaTime;
// log.warning(temperature.getForecast());
for (ActorRef house : houses) {
house.tell(new House.LightSignal(lightProvided), getSelf());
house.tell(new House.HeatSignal(heatProvided, true), getSelf());
}
Context.setWeather((sun.getValue() > 80.0 ? "SUN UP" : "SUN DOWN"), temperature.getValue() + " C", clouds.getValue() + "%");
getSender().tell(new ClockActor.DoneSignal(), getSelf());
} else {
unhandled(message);
}
}
public static class NewHouse {
public ActorRef house;
public NewHouse(ActorRef house) {
this.house = house;
}
}
}
| [
"[email protected]"
]
| |
3ad5dac4add92d01bb16c04a305dda7fcda453db | 5c74f7da48640fc6c90ecdaf880a13f75a56d7e6 | /src/main/java/com/google/code/gwt/threejs/client/materials/ShadowVolumeDynamicMaterial.java | 254581a083672942117c6885b709f2f616e85ed4 | []
| no_license | Yona-Appletree/gwt.threejs | ebfae7f320bec09971a7a604f217dd630189abc3 | e9fd8d437c0c2ab00d790607a1daa92a7518f72a | refs/heads/master | 2021-01-20T15:49:40.915697 | 2012-06-16T08:04:07 | 2012-06-16T08:04:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package com.google.code.gwt.threejs.client.materials;
public final class ShadowVolumeDynamicMaterial {
// TODO implement
}
| [
"[email protected]"
]
| |
840790d838f8d7afbe5e3b111bd8aea896cad1c5 | 800b6e6bfe88be039f540aaa1291cebd62b9c33a | /src/test/TestAudience.java | 7b014fa93d365d624babfafdcae14d15fb4df0c3 | []
| no_license | edwardyulin/PokeCol | 05c15ee72988d4e8936746c37d8862af909851e0 | b9e225cca5ae54ef8b6499b6f53bac6aff641cee | refs/heads/main | 2023-03-13T16:23:40.067581 | 2021-02-26T18:02:34 | 2021-02-26T18:02:34 | 313,567,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | import model.Audience;
import model.Pokemon;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestAudience {
private Audience audience;
private Pokemon pokemon;
private ArrayList<Integer> stats;
@BeforeEach
void sepUp() {
audience = new Audience("Audience");
stats = new ArrayList<>();
stats.add(15);
stats.add(15);
stats.add(15);
pokemon = new Pokemon("Pokemon", stats);
}
@Test
void testUpdate() {
assertEquals("Updated", audience.update(pokemon));
}
}
| [
"[email protected]"
]
| |
b8d8fa3caf7fc98fb5410d48830c5ed7ffe8f072 | df314169735d831aad60ffa16e71a840cfaa6a52 | /src/main/cn/edu/sjtu/software/Circle.java | f2002ca978afbc55cfe5e1718681c988ef6836eb | []
| no_license | Erin513/SoftwareTesting | f1d5051564a4cad2515dc6ace73fcf851ff943d1 | 07f2d572b6c5293cd9d602509e049297d592167a | refs/heads/master | 2021-05-08T01:21:27.325440 | 2018-01-11T15:37:28 | 2018-01-11T15:37:28 | 107,913,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | package cn.edu.sjtu.software;
public class Circle {
Point p;
double radius;
public Circle(Point p, double radius) throws Exception {
if(radius<=0){
throw new Exception();
}
if(p == null){
throw new Exception();
}
this.p = p;
this.radius = radius;
}
public boolean equals(Object o){
if(o instanceof Circle) {
final Circle c = (Circle) o;
return c.radius == radius && c.p.x == p.x && c.p.y == p.y;
}
return false;
};
} | [
"[email protected]"
]
| |
d90132f626f31ebabef7e1278a480dc244de2000 | 25767b558b2aac0be3c8cf618f883ff022c4b958 | /src/main/java/com/ken/wms/dao/CustomerMapper.java | 53c6e802837e70577c004997033e4702abd0d0b3 | []
| no_license | zhangyaoci/SSM_repository | 2776d4e365ca59a14db48a2b8a957ff847772eaf | f30a98d04ccb899acad1d71f58d6a89214a6112f | refs/heads/master | 2021-06-20T10:00:21.808375 | 2017-09-26T01:33:16 | 2017-09-26T01:33:16 | 102,819,895 | 0 | 0 | null | 2020-03-25T02:58:51 | 2017-09-08T05:06:59 | Java | UTF-8 | Java | false | false | 1,720 | java | package com.ken.wms.dao;
import com.ken.wms.domain.Customer;
import java.util.List;
/**
* 客户信息 Customer 映射器
*
*/
public interface CustomerMapper {
/**
* 选择所有的 Customer
* @return 返回所有的 Customer
*/
List<Customer> selectAll();
/**
* 选择指定 id 的 Supplier
* @param id Customer的ID
* @return 返回指定ID对应的Customer
*/
Customer selectById(Integer id);
/**
* 选择指定 Customer name 的 customer
* @param customerName 客户的名称
* @return 返回指定CustomerName对应的Customer
*/
Customer selectByName(String customerName);
/**
* 选择指定 customer name 的 Customer
* 与 selectByName 方法的区别在于本方法将返回相似匹配的结果
* @param customerName Customer 供应商名
* @return 返回模糊匹配指定customerName 对应的Customer
*/
List<Customer> selectApproximateByName(String customerName);
/**
* 插入 Customer 到数据库中
* 不需要指定 Customer 的主键,采用的数据库 AI 方式
* @param customer Customer 实例
*/
void insert(Customer customer);
/**
* 批量插入 Customer 到数据库中
* @param customers 存放 Customer 实例的 List
*/
void insertBatch(List<Customer> customers);
/**
* 更新 Customer 到数据库
* 该 Customer 必须已经存在于数据库中,即已经分配主键,否则将更新失败
* @param customer customer 实例
*/
void update(Customer customer);
/**
* 删除指定 id 的 customer
* @param id customer ID
*/
void deleteById(Integer id);
/**
* 删除指定 customerName 的 customer
* @param customerName 客户名称
*/
void deleteByName(String customerName);
}
| [
"[email protected]"
]
| |
9230da7a78e25df95eabc756588a8086315e6906 | 4136cf01c3e29aa20940329b53cb29c25dfb33b0 | /BookShop/src/main/java/com/cdweb/configuration/SecurityConfiguration.java | e8210996e6ac5217e4c1ae9121c37d86e7e4e9a6 | []
| no_license | TranHanGom/CDWeb_BookShopWebsite | c0196f1575d1f742b2634239223648e4070960f7 | d759f687af09e645d83fece54a66395c8c593d4c | refs/heads/master | 2022-12-13T15:48:07.010098 | 2020-09-06T17:52:05 | 2020-09-06T17:52:05 | 271,712,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,617 | java | package com.cdweb.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import com.cdweb.service.UserService;
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
private UserService userService;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers(
"/**",
"/contact",
"/list-product",
"/registration**",
"/static/**",
"/js/**",
"/fonts/**",
"/css/**",
"/images/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/home")
.permitAll()
.and()
.logout()
.invalidateHttpSession(true)
.clearAuthentication(true)
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/")
.permitAll();
}
@Bean
public BCryptPasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder();
}
@Bean
public DaoAuthenticationProvider authenticationProvider(){
DaoAuthenticationProvider auth = new DaoAuthenticationProvider();
auth.setUserDetailsService(userService);
auth.setPasswordEncoder(passwordEncoder());
return auth;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authenticationProvider());
}
}
| [
"[email protected]"
]
| |
edb593a0d7d54f0a3f87af7c15947d90ab6ffe86 | 208ba847cec642cdf7b77cff26bdc4f30a97e795 | /di/da/src/main/java/org.wp.da/ui/media/MediaGridFragment.java | 4fb85b8bb745e9dff5e7408381b4fa9355335497 | []
| no_license | kageiit/perf-android-large | ec7c291de9cde2f813ed6573f706a8593be7ac88 | 2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8 | refs/heads/master | 2021-01-12T14:00:19.468063 | 2016-09-27T13:10:42 | 2016-09-27T13:10:42 | 69,685,305 | 0 | 0 | null | 2016-09-30T16:59:49 | 2016-09-30T16:59:48 | null | UTF-8 | Java | false | false | 34,135 | java | package org.wp.da.ui.media;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.ActionMode;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AbsListView.RecyclerListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.ImageLoader.ImageContainer;
import com.android.volley.toolbox.ImageLoader.ImageListener;
import org.wp.da.R;
import org.wp.da.WordPress;
import org.wp.da.models.Blog;
import org.wp.da.ui.CheckableFrameLayout;
import org.wp.da.ui.CustomSpinner;
import org.wp.da.ui.EmptyViewMessageType;
import org.wp.da.ui.media.MediaGridAdapter.MediaGridAdapterCallback;
import org.wp.da.util.NetworkUtils;
import org.wp.da.util.ToastUtils;
import org.wp.da.util.ToastUtils.Duration;
import org.wp.da.util.WPActivityUtils;
import org.wp.da.util.helpers.SwipeToRefreshHelper;
import org.wp.da.util.helpers.SwipeToRefreshHelper.RefreshListener;
import org.wp.da.util.widgets.CustomSwipeRefreshLayout;
import org.xmlrpc.da.ApiHelper;
import org.xmlrpc.da.ApiHelper.SyncMediaLibraryTask.Callback;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
/**
* The grid displaying the media items.
*/
public class MediaGridFragment extends Fragment
implements OnItemClickListener, MediaGridAdapterCallback, RecyclerListener {
private static final String BUNDLE_SELECTED_STATES = "BUNDLE_SELECTED_STATES";
private static final String BUNDLE_IN_MULTI_SELECT_MODE = "BUNDLE_IN_MULTI_SELECT_MODE";
private static final String BUNDLE_SCROLL_POSITION = "BUNDLE_SCROLL_POSITION";
private static final String BUNDLE_HAS_RETREIEVED_ALL_MEDIA = "BUNDLE_HAS_RETREIEVED_ALL_MEDIA";
private static final String BUNDLE_FILTER = "BUNDLE_FILTER";
private static final String BUNDLE_EMPTY_VIEW_MESSAGE = "BUNDLE_EMPTY_VIEW_MESSAGE";
private static final String BUNDLE_DATE_FILTER_SET = "BUNDLE_DATE_FILTER_SET";
private static final String BUNDLE_DATE_FILTER_VISIBLE = "BUNDLE_DATE_FILTER_VISIBLE";
private static final String BUNDLE_DATE_FILTER_START_YEAR = "BUNDLE_DATE_FILTER_START_YEAR";
private static final String BUNDLE_DATE_FILTER_START_MONTH = "BUNDLE_DATE_FILTER_START_MONTH";
private static final String BUNDLE_DATE_FILTER_START_DAY = "BUNDLE_DATE_FILTER_START_DAY";
private static final String BUNDLE_DATE_FILTER_END_YEAR = "BUNDLE_DATE_FILTER_END_YEAR";
private static final String BUNDLE_DATE_FILTER_END_MONTH = "BUNDLE_DATE_FILTER_END_MONTH";
private static final String BUNDLE_DATE_FILTER_END_DAY = "BUNDLE_DATE_FILTER_END_DAY";
private Filter mFilter = Filter.ALL;
private String[] mFiltersText;
private GridView mGridView;
private MediaGridAdapter mGridAdapter;
private MediaGridListener mListener;
private boolean mIsRefreshing;
private boolean mHasRetrievedAllMedia;
private boolean mIsMultiSelect;
private String mSearchTerm;
private View mSpinnerContainer;
private TextView mResultView;
private CustomSpinner mSpinner;
private SwipeToRefreshHelper mSwipeToRefreshHelper;
private LinearLayout mEmptyView;
private TextView mEmptyViewTitle;
private EmptyViewMessageType mEmptyViewMessageType = EmptyViewMessageType.NO_CONTENT;
private int mOldMediaSyncOffset = 0;
private boolean mIsDateFilterSet;
private boolean mSpinnerHasLaunched;
private int mStartYear, mStartMonth, mStartDay, mEndYear, mEndMonth, mEndDay;
private AlertDialog mDatePickerDialog;
public interface MediaGridListener {
public void onMediaItemListDownloadStart();
public void onMediaItemListDownloaded();
public void onMediaItemSelected(String mediaId);
public void onRetryUpload(String mediaId);
}
public enum Filter {
ALL, IMAGES, UNATTACHED, CUSTOM_DATE;
public static Filter getFilter(int filterPos) {
if (filterPos > Filter.values().length)
return ALL;
else
return Filter.values()[filterPos];
}
}
private final OnItemSelectedListener mFilterSelectedListener = new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// need this to stop the bug where onItemSelected is called during initialization, before user input
if (!mSpinnerHasLaunched) {
return;
}
if (position == Filter.CUSTOM_DATE.ordinal()) {
mIsDateFilterSet = true;
}
setFilter(Filter.getFilter(position));
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
};
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
mFiltersText = new String[Filter.values().length];
mGridAdapter = new MediaGridAdapter(getActivity(), null, 0, MediaImageLoader.getInstance());
mGridAdapter.setCallback(this);
View view = inflater.inflate(R.layout.media_grid_fragment, container);
mGridView = (GridView) view.findViewById(R.id.media_gridview);
mGridView.setOnItemClickListener(this);
mGridView.setRecyclerListener(this);
mGridView.setMultiChoiceModeListener(new MultiChoiceModeListener());
mGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
mGridView.setAdapter(mGridAdapter);
mEmptyView = (LinearLayout) view.findViewById(R.id.empty_view);
mEmptyViewTitle = (TextView) view.findViewById(R.id.empty_view_title);
mResultView = (TextView) view.findViewById(R.id.media_filter_result_text);
mSpinner = (CustomSpinner) view.findViewById(R.id.media_filter_spinner);
mSpinner.setOnItemSelectedListener(mFilterSelectedListener);
mSpinner.setOnItemSelectedEvenIfUnchangedListener(mFilterSelectedListener);
mSpinnerContainer = view.findViewById(R.id.media_filter_spinner_container);
mSpinnerContainer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!isInMultiSelect()) {
mSpinnerHasLaunched = true;
mSpinner.performClick();
}
}
});
// swipe to refresh setup
mSwipeToRefreshHelper = new SwipeToRefreshHelper(getActivity(),
(CustomSwipeRefreshLayout) view.findViewById(R.id.ptr_layout),
new RefreshListener() {
@Override
public void onRefreshStarted() {
if (!isAdded()) {
return;
}
if (!NetworkUtils.checkConnection(getActivity())) {
updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
mSwipeToRefreshHelper.setRefreshing(false);
return;
}
refreshMediaFromServer(0, false);
}
});
restoreState(savedInstanceState);
setupSpinnerAdapter();
return view;
}
private void restoreState(Bundle savedInstanceState) {
if (savedInstanceState == null)
return;
boolean isInMultiSelectMode = savedInstanceState.getBoolean(BUNDLE_IN_MULTI_SELECT_MODE);
if (savedInstanceState.containsKey(BUNDLE_SELECTED_STATES)) {
ArrayList selectedItems = savedInstanceState.getStringArrayList(BUNDLE_SELECTED_STATES);
mGridAdapter.setSelectedItems(selectedItems);
if (isInMultiSelectMode) {
setFilterSpinnerVisible(mGridAdapter.getSelectedItems().size() == 0);
mSwipeToRefreshHelper.setEnabled(false);
}
}
mGridView.setSelection(savedInstanceState.getInt(BUNDLE_SCROLL_POSITION, 0));
mHasRetrievedAllMedia = savedInstanceState.getBoolean(BUNDLE_HAS_RETREIEVED_ALL_MEDIA, false);
mFilter = Filter.getFilter(savedInstanceState.getInt(BUNDLE_FILTER));
mEmptyViewMessageType = EmptyViewMessageType.getEnumFromString(savedInstanceState.
getString(BUNDLE_EMPTY_VIEW_MESSAGE));
mIsDateFilterSet = savedInstanceState.getBoolean(BUNDLE_DATE_FILTER_SET, false);
mStartDay = savedInstanceState.getInt(BUNDLE_DATE_FILTER_START_DAY);
mStartMonth = savedInstanceState.getInt(BUNDLE_DATE_FILTER_START_MONTH);
mStartYear = savedInstanceState.getInt(BUNDLE_DATE_FILTER_START_YEAR);
mEndDay = savedInstanceState.getInt(BUNDLE_DATE_FILTER_END_DAY);
mEndMonth = savedInstanceState.getInt(BUNDLE_DATE_FILTER_END_MONTH);
mEndYear = savedInstanceState.getInt(BUNDLE_DATE_FILTER_END_YEAR);
boolean datePickerShowing = savedInstanceState.getBoolean(BUNDLE_DATE_FILTER_VISIBLE);
if (datePickerShowing)
showDatePicker();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
saveState(outState);
}
private void saveState(Bundle outState) {
outState.putStringArrayList(BUNDLE_SELECTED_STATES, mGridAdapter.getSelectedItems());
outState.putInt(BUNDLE_SCROLL_POSITION, mGridView.getFirstVisiblePosition());
outState.putBoolean(BUNDLE_HAS_RETREIEVED_ALL_MEDIA, mHasRetrievedAllMedia);
outState.putBoolean(BUNDLE_IN_MULTI_SELECT_MODE, isInMultiSelect());
outState.putInt(BUNDLE_FILTER, mFilter.ordinal());
outState.putString(BUNDLE_EMPTY_VIEW_MESSAGE, mEmptyViewMessageType.name());
outState.putBoolean(BUNDLE_DATE_FILTER_SET, mIsDateFilterSet);
outState.putBoolean(BUNDLE_DATE_FILTER_VISIBLE, (mDatePickerDialog != null && mDatePickerDialog.isShowing()));
outState.putInt(BUNDLE_DATE_FILTER_START_DAY, mStartDay);
outState.putInt(BUNDLE_DATE_FILTER_START_MONTH, mStartMonth);
outState.putInt(BUNDLE_DATE_FILTER_START_YEAR, mStartYear);
outState.putInt(BUNDLE_DATE_FILTER_END_DAY, mEndDay);
outState.putInt(BUNDLE_DATE_FILTER_END_MONTH, mEndMonth);
outState.putInt(BUNDLE_DATE_FILTER_END_YEAR, mEndYear);
}
private void setupSpinnerAdapter() {
if (getActivity() == null || WordPress.getCurrentBlog() == null) {
return;
}
updateFilterText();
Context context = WPActivityUtils.getThemedContext(getActivity());
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, R.layout.spinner_menu_dropdown_item, mFiltersText);
mSpinner.setAdapter(adapter);
mSpinner.setSelection(mFilter.ordinal());
}
public void refreshSpinnerAdapter() {
updateFilterText();
updateSpinnerAdapter();
setFilter(mFilter);
}
void resetSpinnerAdapter() {
setFiltersText(0, 0, 0);
updateSpinnerAdapter();
}
void updateFilterText() {
if (WordPress.currentBlog == null)
return;
String blogId = String.valueOf(WordPress.getCurrentBlog().getLocalTableBlogId());
int countAll = WordPress.wpDB.getMediaCountAll(blogId);
int countImages = WordPress.wpDB.getMediaCountImages(blogId);
int countUnattached = WordPress.wpDB.getMediaCountUnattached(blogId);
setFiltersText(countAll, countImages, countUnattached);
}
private void setFiltersText(int countAll, int countImages, int countUnattached) {
mFiltersText[0] = getResources().getString(R.string.all) + " (" + countAll + ")";
mFiltersText[1] = getResources().getString(R.string.images) + " (" + countImages + ")";
mFiltersText[2] = getResources().getString(R.string.unattached) + " (" + countUnattached + ")";
mFiltersText[3] = getResources().getString(R.string.custom_date) + "...";
}
void updateSpinnerAdapter() {
ArrayAdapter<String> adapter = (ArrayAdapter<String>) mSpinner.getAdapter();
if (adapter != null) {
adapter.notifyDataSetChanged();
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (MediaGridListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement MediaGridListener");
}
}
@Override
public void onResume() {
super.onResume();
refreshSpinnerAdapter();
refreshMediaFromDB();
}
public void refreshMediaFromDB() {
setFilter(mFilter);
if (isAdded() && mGridAdapter.getDataCount() == 0) {
if (NetworkUtils.isNetworkAvailable(getActivity())) {
if (!mHasRetrievedAllMedia) {
refreshMediaFromServer(0, true);
}
} else {
updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
}
}
}
public void refreshMediaFromServer(int offset, final boolean auto) {
if (!NetworkUtils.isNetworkAvailable(getActivity())) {
updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
setRefreshing(false);
return;
}
// do not refresh if custom date filter is shown
if (WordPress.getCurrentBlog() == null || mFilter == Filter.CUSTOM_DATE) {
setRefreshing(false);
return;
}
// do not refresh if in search
if (mSearchTerm != null && mSearchTerm.length() > 0) {
setRefreshing(false);
return;
}
if (offset == 0 || !mIsRefreshing) {
if (offset == mOldMediaSyncOffset) {
// we're pulling the same data again for some reason. Pull from the beginning.
offset = 0;
}
mOldMediaSyncOffset = offset;
mIsRefreshing = true;
updateEmptyView(EmptyViewMessageType.LOADING);
mListener.onMediaItemListDownloadStart();
mGridAdapter.setRefreshing(true);
List<Object> apiArgs = new ArrayList<Object>();
apiArgs.add(WordPress.getCurrentBlog());
Callback callback = new Callback() {
// refresh db from server. If returned count is 0, we've retrieved all the media.
// stop retrieving until the user manually refreshes
@Override
public void onSuccess(int count) {
MediaGridAdapter adapter = (MediaGridAdapter) mGridView.getAdapter();
mHasRetrievedAllMedia = (count == 0);
adapter.setHasRetrievedAll(mHasRetrievedAllMedia);
mIsRefreshing = false;
// the activity may be gone by the time this finishes, so check for it
if (getActivity() != null && MediaGridFragment.this.isVisible()) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
refreshSpinnerAdapter();
updateEmptyView(EmptyViewMessageType.NO_CONTENT);
if (!auto) {
mGridView.setSelection(0);
}
mListener.onMediaItemListDownloaded();
mGridAdapter.setRefreshing(false);
mSwipeToRefreshHelper.setRefreshing(false);
}
});
}
}
@Override
public void onFailure(final ApiHelper.ErrorType errorType, String errorMessage, Throwable throwable) {
if (errorType != ApiHelper.ErrorType.NO_ERROR) {
if (getActivity() != null) {
if (errorType != ApiHelper.ErrorType.NO_UPLOAD_FILES_CAP) {
ToastUtils.showToast(getActivity(), getString(R.string.error_refresh_media),
Duration.LONG);
} else {
if (mEmptyView == null || mEmptyView.getVisibility() != View.VISIBLE) {
ToastUtils.showToast(getActivity(), getString(
R.string.media_error_no_permission));
}
}
}
MediaGridAdapter adapter = (MediaGridAdapter) mGridView.getAdapter();
mHasRetrievedAllMedia = true;
adapter.setHasRetrievedAll(mHasRetrievedAllMedia);
}
// the activity may be cone by the time we get this, so check for it
if (getActivity() != null && MediaGridFragment.this.isVisible()) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
mIsRefreshing = false;
mListener.onMediaItemListDownloaded();
mGridAdapter.setRefreshing(false);
mSwipeToRefreshHelper.setRefreshing(false);
if (errorType == ApiHelper.ErrorType.NO_UPLOAD_FILES_CAP) {
updateEmptyView(EmptyViewMessageType.PERMISSION_ERROR);
} else {
updateEmptyView(EmptyViewMessageType.GENERIC_ERROR);
}
}
});
}
}
};
ApiHelper.SyncMediaLibraryTask getMediaTask = new ApiHelper.SyncMediaLibraryTask(offset, mFilter, callback);
getMediaTask.execute(apiArgs);
}
}
public void search(String searchTerm) {
mSearchTerm = searchTerm;
Blog blog = WordPress.getCurrentBlog();
if (blog != null) {
String blogId = String.valueOf(blog.getLocalTableBlogId());
Cursor cursor = WordPress.wpDB.getMediaFilesForBlog(blogId, searchTerm);
mGridAdapter.changeCursor(cursor);
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Cursor cursor = ((MediaGridAdapter) parent.getAdapter()).getCursor();
String mediaId = cursor.getString(cursor.getColumnIndex("mediaId"));
mListener.onMediaItemSelected(mediaId);
}
public void setFilterVisibility(int visibility) {
if (mSpinner != null) {
mSpinner.setVisibility(visibility);
}
}
private void updateEmptyView(EmptyViewMessageType emptyViewMessageType) {
if (mEmptyView != null) {
if (mGridAdapter.getDataCount() == 0) {
int stringId = 0;
switch (emptyViewMessageType) {
case LOADING:
stringId = R.string.media_fetching;
break;
case NO_CONTENT:
stringId = R.string.media_empty_list;
break;
case NETWORK_ERROR:
// Don't overwrite NO_CONTENT_CUSTOM_DATE message, since refresh is disabled with that filter on
if (mEmptyViewMessageType == EmptyViewMessageType.NO_CONTENT_CUSTOM_DATE) {
mEmptyView.setVisibility(View.VISIBLE);
return;
}
stringId = R.string.no_network_message;
break;
case PERMISSION_ERROR:
stringId = R.string.media_error_no_permission;
break;
case GENERIC_ERROR:
stringId = R.string.error_refresh_media;
break;
case NO_CONTENT_CUSTOM_DATE:
stringId = R.string.media_empty_list_custom_date;
break;
}
mEmptyViewTitle.setText(getText(stringId));
mEmptyViewMessageType = emptyViewMessageType;
mEmptyView.setVisibility(View.VISIBLE);
} else {
mEmptyView.setVisibility(View.GONE);
}
}
}
private void hideEmptyView() {
if (mEmptyView != null) {
mEmptyView.setVisibility(View.GONE);
}
}
public void setFilter(Filter filter) {
mFilter = filter;
Cursor cursor = filterItems(mFilter);
if (filter != Filter.CUSTOM_DATE || cursor == null || cursor.getCount() == 0) {
mResultView.setVisibility(View.GONE);
}
if (cursor != null && cursor.getCount() != 0) {
mGridAdapter.swapCursor(cursor);
hideEmptyView();
} else {
// No data to display. Clear the GridView and display a message in the empty view
mGridAdapter.changeCursor(null);
}
if (filter != Filter.CUSTOM_DATE) {
// Overwrite the LOADING and NO_CONTENT_CUSTOM_DATE messages
if (mEmptyViewMessageType == EmptyViewMessageType.LOADING ||
mEmptyViewMessageType == EmptyViewMessageType.NO_CONTENT_CUSTOM_DATE) {
updateEmptyView(EmptyViewMessageType.NO_CONTENT);
} else {
updateEmptyView(mEmptyViewMessageType);
}
} else {
updateEmptyView(EmptyViewMessageType.NO_CONTENT_CUSTOM_DATE);
}
}
Cursor setDateFilter() {
Blog blog = WordPress.getCurrentBlog();
if (blog == null)
return null;
String blogId = String.valueOf(blog.getLocalTableBlogId());
GregorianCalendar startDate = new GregorianCalendar(mStartYear, mStartMonth, mStartDay);
GregorianCalendar endDate = new GregorianCalendar(mEndYear, mEndMonth, mEndDay);
long one_day = 24 * 60 * 60 * 1000;
Cursor cursor = WordPress.wpDB.getMediaFilesForBlog(blogId, startDate.getTimeInMillis(), endDate.getTimeInMillis() + one_day);
mGridAdapter.swapCursor(cursor);
if (cursor != null && cursor.moveToFirst()) {
mResultView.setVisibility(View.VISIBLE);
hideEmptyView();
DateFormat format = DateFormat.getDateInstance();
String formattedStart = format.format(startDate.getTime());
String formattedEnd = format.format(endDate.getTime());
mResultView.setText(String.format(getString(R.string.media_gallery_date_range), formattedStart,
formattedEnd));
return cursor;
} else {
updateEmptyView(EmptyViewMessageType.NO_CONTENT_CUSTOM_DATE);
}
return null;
}
public void clearSelectedItems() {
mGridAdapter.clearSelection();
}
private Cursor filterItems(Filter filter) {
Blog blog = WordPress.getCurrentBlog();
if (blog == null)
return null;
String blogId = String.valueOf(blog.getLocalTableBlogId());
switch (filter) {
case ALL:
return WordPress.wpDB.getMediaFilesForBlog(blogId);
case IMAGES:
return WordPress.wpDB.getMediaImagesForBlog(blogId);
case UNATTACHED:
return WordPress.wpDB.getMediaUnattachedForBlog(blogId);
case CUSTOM_DATE:
// show date picker only when the user clicks on the spinner, not when we are doing syncing
if (mIsDateFilterSet) {
mIsDateFilterSet = false;
showDatePicker();
} else {
return setDateFilter();
}
break;
}
return null;
}
void showDatePicker() {
// Inflate your custom layout containing 2 DatePickers
LayoutInflater inflater = getActivity().getLayoutInflater();
View customView = inflater.inflate(R.layout.date_range_dialog, null);
// Define your date pickers
final DatePicker dpStartDate = (DatePicker) customView.findViewById(R.id.dpStartDate);
final DatePicker dpEndDate = (DatePicker) customView.findViewById(R.id.dpEndDate);
// Build the dialog
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(customView); // Set the view of the dialog to your custom layout
builder.setTitle("Select start and end date");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mStartYear = dpStartDate.getYear();
mStartMonth = dpStartDate.getMonth();
mStartDay = dpStartDate.getDayOfMonth();
mEndYear = dpEndDate.getYear();
mEndMonth = dpEndDate.getMonth();
mEndDay = dpEndDate.getDayOfMonth();
setDateFilter();
dialog.dismiss();
}
});
// Create and show the dialog
mDatePickerDialog = builder.create();
mDatePickerDialog.show();
}
@Override
public void fetchMoreData(int offset) {
if (!mHasRetrievedAllMedia) {
refreshMediaFromServer(offset, true);
}
}
@Override
public void onMovedToScrapHeap(View view) {
// cancel image fetch requests if the view has been moved to recycler.
View imageView = view.findViewById(R.id.media_grid_item_image);
if (imageView != null) {
// this tag is set in the MediaGridAdapter class
String tag = (String) imageView.getTag();
if (tag != null && tag.startsWith("http")) {
// need a listener to cancel request, even if the listener does nothing
ImageContainer container = WordPress.imageLoader.get(tag, new ImageListener() {
@Override
public void onErrorResponse(VolleyError error) { }
@Override
public void onResponse(ImageContainer response, boolean isImmediate) { }
});
container.cancelRequest();
}
}
CheckableFrameLayout layout = (CheckableFrameLayout) view.findViewById(R.id.media_grid_frame_layout);
if (layout != null) {
layout.setOnCheckedChangeListener(null);
}
}
public void setFilterSpinnerVisible(boolean visible) {
if (visible) {
mSpinner.setEnabled(true);
mSpinnerContainer.setEnabled(true);
mSpinnerContainer.setVisibility(View.VISIBLE);
} else {
mSpinner.setEnabled(false);
mSpinnerContainer.setEnabled(false);
mSpinnerContainer.setVisibility(View.GONE);
}
}
@Override
public void onRetryUpload(String mediaId) {
mListener.onRetryUpload(mediaId);
}
public boolean hasRetrievedAllMediaFromServer() {
return mHasRetrievedAllMedia;
}
/*
* called by activity when blog is changed
*/
protected void reset() {
mGridAdapter.clearSelection();
mGridView.setSelection(0);
mGridView.requestFocusFromTouch();
mGridView.setSelection(0);
mGridAdapter.setImageLoader(MediaImageLoader.getInstance());
mGridAdapter.changeCursor(null);
resetSpinnerAdapter();
mHasRetrievedAllMedia = false;
}
public void removeFromMultiSelect(String mediaId) {
if (isInMultiSelect() && mGridAdapter.isItemSelected(mediaId)) {
mGridAdapter.setItemSelected(mediaId, false);
setFilterSpinnerVisible(mGridAdapter.getSelectedItems().size() == 0);
}
}
public void setRefreshing(boolean refreshing) {
mSwipeToRefreshHelper.setRefreshing(refreshing);
}
public void setSwipeToRefreshEnabled(boolean enabled) {
mSwipeToRefreshHelper.setEnabled(enabled);
}
@Override
public boolean isInMultiSelect() {
return mIsMultiSelect;
}
public class MultiChoiceModeListener implements GridView.MultiChoiceModeListener {
private MenuItem mNewPostButton;
private MenuItem mNewGalleryButton;
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
int selectCount = mGridAdapter.getSelectedItems().size();
mode.setTitle(String.format(getString(R.string.cab_selected), selectCount));
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.media_multiselect, menu);
mNewPostButton = menu.findItem(R.id.media_multiselect_actionbar_post);
mNewGalleryButton = menu.findItem(R.id.media_multiselect_actionbar_gallery);
setSwipeToRefreshEnabled(false);
mIsMultiSelect = true;
updateActionButtons(selectCount);
return true;
}
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return true;
}
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
int i = item.getItemId();
if (i == R.id.media_multiselect_actionbar_post) {
handleNewPost();
return true;
} else if (i == R.id.media_multiselect_actionbar_gallery) {
handleMultiSelectPost();
return true;
} else if (i == R.id.media_multiselect_actionbar_trash) {
handleMultiSelectDelete();
return true;
}
return true;
}
public void onDestroyActionMode(ActionMode mode) {
mGridAdapter.clearSelection();
setSwipeToRefreshEnabled(true);
mIsMultiSelect = false;
setFilterSpinnerVisible(mGridAdapter.getSelectedItems().size() == 0);
}
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
mGridAdapter.setItemSelected(position, checked);
int selectCount = mGridAdapter.getSelectedItems().size();
setFilterSpinnerVisible(selectCount == 0);
mode.setTitle(String.format(getString(R.string.cab_selected), selectCount));
updateActionButtons(selectCount);
}
private void updateActionButtons(int selectCount) {
switch (selectCount) {
case 1:
mNewPostButton.setVisible(true);
mNewGalleryButton.setVisible(false);
break;
default:
mNewPostButton.setVisible(false);
mNewGalleryButton.setVisible(true);
break;
}
}
private void handleNewPost() {
if (!isAdded()) {
return;
}
ArrayList<String> ids = mGridAdapter.getSelectedItems();
Intent i = new Intent(getActivity(), Activity.class);
// i.setAction(EditPostActivity.NEW_MEDIA_POST);
// i.putExtra(EditPostActivity.NEW_MEDIA_POST_EXTRA, ids.iterator().next());
startActivity(i);
}
private void handleMultiSelectDelete() {
if (!isAdded()) {
return;
}
Builder builder = new AlertDialog.Builder(getActivity()).setMessage(R.string.confirm_delete_multi_media)
.setCancelable(true).setPositiveButton(
R.string.delete, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (getActivity() instanceof MediaBrowserActivity) {
((MediaBrowserActivity) getActivity()).deleteMedia(
mGridAdapter.getSelectedItems());
}
refreshSpinnerAdapter();
}
}).setNegativeButton(R.string.cancel, null);
AlertDialog dialog = builder.create();
dialog.show();
}
private void handleMultiSelectPost() {
if (!isAdded()) {
return;
}
Intent i = new Intent(getActivity(), Activity.class);
// i.setAction(EditPostActivity.NEW_MEDIA_GALLERY);
// i.putStringArrayListExtra(EditPostActivity.NEW_MEDIA_GALLERY_EXTRA_IDS,
// mGridAdapter.getSelectedItems());
startActivity(i);
}
}
}
| [
"[email protected]"
]
| |
b14b6730b827e81655b054ff14d33746d5d5dcaf | cd601a25e7f7c2b4e43bddd1b06e717683fc9ba3 | /single-lock/src/main/java/com/jsonyao/singlelock/model/Product.java | 12f9b06ddc85808e17d85042ac32fe37b937e6b4 | []
| no_license | JsonYaoo/lock-test | 21bff5fab54f37bf1b9f40977bb8e86e325fe03f | 1fdb59a9003bc4ab02b3fb20a54eaf275f14105d | refs/heads/master | 2023-03-03T23:37:37.779101 | 2021-02-12T05:29:41 | 2021-02-12T05:29:41 | 337,740,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,518 | java | package com.jsonyao.singlelock.model;
import java.math.BigDecimal;
import java.util.Date;
public class Product {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.id
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.product_name
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private String productName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.price
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private BigDecimal price;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.count
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private Integer count;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.product_desc
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private String productDesc;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.create_time
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.create_user
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private String createUser;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.update_time
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private Date updateTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column product.update_user
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
private String updateUser;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.id
*
* @return the value of product.id
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.id
*
* @param id the value for product.id
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.product_name
*
* @return the value of product.product_name
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public String getProductName() {
return productName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.product_name
*
* @param productName the value for product.product_name
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setProductName(String productName) {
this.productName = productName == null ? null : productName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.price
*
* @return the value of product.price
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public BigDecimal getPrice() {
return price;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.price
*
* @param price the value for product.price
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setPrice(BigDecimal price) {
this.price = price;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.count
*
* @return the value of product.count
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public Integer getCount() {
return count;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.count
*
* @param count the value for product.count
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setCount(Integer count) {
this.count = count;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.product_desc
*
* @return the value of product.product_desc
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public String getProductDesc() {
return productDesc;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.product_desc
*
* @param productDesc the value for product.product_desc
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setProductDesc(String productDesc) {
this.productDesc = productDesc == null ? null : productDesc.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.create_time
*
* @return the value of product.create_time
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.create_time
*
* @param createTime the value for product.create_time
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.create_user
*
* @return the value of product.create_user
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public String getCreateUser() {
return createUser;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.create_user
*
* @param createUser the value for product.create_user
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setCreateUser(String createUser) {
this.createUser = createUser == null ? null : createUser.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.update_time
*
* @return the value of product.update_time
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.update_time
*
* @param updateTime the value for product.update_time
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column product.update_user
*
* @return the value of product.update_user
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public String getUpdateUser() {
return updateUser;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column product.update_user
*
* @param updateUser the value for product.update_user
*
* @mbg.generated Fri Aug 09 11:20:17 CST 2019
*/
public void setUpdateUser(String updateUser) {
this.updateUser = updateUser == null ? null : updateUser.trim();
}
} | [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.