blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
ef4e2f5834d3b0f6784377c8519292471fab69e4
12f3b4b330312a391b8a3cbd4d6d4efcfcc2e2e6
/isomorphic.java
9c4a87ec9d7b2d15794d1b5faa7e0b8d14562646
[]
no_license
vadivukkarasijp/vadivukkarasi1
bc36f879d2af413354149fc10f10fe9ec50a112f
035a7397604e702eab52ea13fed1f6d1c2a5fd1e
refs/heads/master
2020-03-22T20:09:03.464777
2018-08-16T04:43:36
2018-08-16T04:43:36
140,576,454
0
0
null
null
null
null
UTF-8
Java
false
false
581
java
import java.util.Scanner; public class isomorphic { public static void main(String[] args){ Scanner sc=new Scanner(System.in); String a=sc.next(); String b=sc.next(); String d=""; int count=0,count1=0; char ch[]=a.toCharArray(); char ch1[]=b.toCharArray(); for(int i=0;i<ch.length;i++){ for(int j=i+1;j<ch.length;j++){ if(ch[i]==ch[j]){ if(ch1[i]==ch1[j]){ d="yes"; count++; } } } if((a.substring(0,2)).equals(b.substring(0,2))&& count==0){ d="yes"; count1++; } else if(count==0 && count1==0){ d="no"; } } System.out.println(d); } }
5bbb3d950ddff48773fd4225c4d713d86f6d096e
ffcff378e55c917dfaea88b5ee953fb3d9b71665
/gdxtokryo/src/test/java/com/cyphercove/gdx/gdxtokryo/tests/UtilsTest.java
902e136c3cd38e053c52b001b6260dae3b580178
[ "Apache-2.0" ]
permissive
BlueCP/gdx-cclibs
3460313b84f0c006165bed6f5cafb910a3e0dd85
63c03a9fef6be5c60e727b97c1d65c8da3cbc811
refs/heads/master
2020-04-23T16:22:25.021440
2018-03-02T02:05:18
2018-03-02T02:05:18
171,296,171
0
0
Apache-2.0
2019-02-18T14:12:05
2019-02-18T14:12:04
null
UTF-8
Java
false
false
8,450
java
package com.cyphercove.gdx.gdxtokryo.tests; import com.badlogic.gdx.math.*; import com.badlogic.gdx.math.collision.Sphere; import com.badlogic.gdx.utils.*; import com.badlogic.gdx.utils.StringBuilder; public class UtilsTest extends GdxToKryoTest { public static void main(String[] args) { UtilsTest test = new UtilsTest(); try { test.setUp(); } catch (Exception e) { e.printStackTrace(); } test.testCollections(); test.testIdentityMap(); test.testUtils(); } public void testCollections (){ Array topLevel = new Array(); ArrayMap<GridPoint2, Vector2> arrayMap = new ArrayMap<GridPoint2, Vector2>(); for (int i = 0, size = randSize(); i < size; i++) { arrayMap.put(new GridPoint2(randInt(), randInt()), new Vector2(randFloat(), randFloat())); } topLevel.add(arrayMap); Array<GridPoint3> array = new Array<GridPoint3>(); for (int i = 0, size = randSize(); i < size; i++) { array.add(new GridPoint3(randInt(), randInt(), randInt())); } topLevel.add(array); Bits bits = new Bits(); for (int i = 0, size = randSize(); i < size; i++) { if (randBool()) bits.set(i); } topLevel.add(bits); BooleanArray booleanArray = new BooleanArray(); booleanArray.setSize(randSize()); for (int i = 0; i < booleanArray.size; i++) { booleanArray.set(i, randBool()); } topLevel.add(booleanArray); ByteArray byteArray = new ByteArray(); for (int i = 0, size = randSize(); i < size; i++) { byteArray.add((byte)random.nextInt()); } topLevel.add(byteArray); CharArray charArray = new CharArray(); for (int i = 0, size = randSize(); i < size; i++) { charArray.add((char)random.nextInt()); } topLevel.add(charArray); DelayedRemovalArray<Plane> delayedRemovalArray = new DelayedRemovalArray<Plane>(); for (int i = 0, size = randSize(); i < size; i++) { delayedRemovalArray.add(new Plane(new Vector3(randFloat(), randFloat(), randFloat()), randFloat())); } topLevel.add(delayedRemovalArray); FloatArray floatArray = new FloatArray(); for (int i = 0, size = randSize(); i < size; i++) { floatArray.add(randFloat()); } topLevel.add(floatArray); IntArray intArray = new IntArray(); for (int i = 0, size = randSize(); i < size; i++) { intArray.add(random.nextInt()); } topLevel.add(intArray); IntFloatMap intFloatMap = new IntFloatMap(); for (int i = 0, size = randSize(); i < size; i++) { intFloatMap.put(randInt(), randFloat()); } topLevel.add(intFloatMap); IntIntMap intIntMap = new IntIntMap(); for (int i = 0, size = randSize(); i < size; i++) { intIntMap.put(randInt(), randInt()); } topLevel.add(intIntMap); IntMap<Rectangle> intMap = new IntMap<Rectangle>(); for (int i = 0, size = randSize(); i < size; i++) { intMap.put(randInt(), new Rectangle(randFloat(), randFloat(), randFloat(), randFloat())); } topLevel.add(intMap); IntSet intSet = new IntSet(); for (int i = 0, size = randSize(); i < size; i++) { intSet.add(random.nextInt()); } topLevel.add(intSet); LongArray longArray = new LongArray(); for (int i = 0, size = randSize(); i < size; i++) { longArray.add(random.nextLong()); } topLevel.add(longArray); LongMap<Sphere> longMap = new LongMap<Sphere>(); for (int i = 0, size = randSize(); i < size; i++) { longMap.put(random.nextLong(), new Sphere(new Vector3(randFloat(), randFloat(), randFloat()), randFloat())); } topLevel.add(longMap); ObjectFloatMap<GridPoint2> objectFloatMap = new ObjectFloatMap<GridPoint2>(); for (int i = 0, size = randSize(); i < size; i++) { objectFloatMap.put(new GridPoint2(randInt(), randInt()), randFloat()); } topLevel.add(objectFloatMap); ObjectIntMap<Vector2> objectIntMap = new ObjectIntMap<Vector2>(); for (int i = 0, size = randSize(); i < size; i++) { objectIntMap.put(new Vector2(randFloat(), randFloat()), randInt()); } topLevel.add(objectIntMap); ObjectMap<Quaternion, Matrix3> objectMap = new ObjectMap<Quaternion, Matrix3>(); for (int i = 0, size = randSize(); i < size; i++) { objectMap.put(new Quaternion(randFloat(), randFloat(), randFloat(), 1f), new Matrix3().rotate(randFloat()).scl(randFloat()).translate(randFloat(), randFloat())); } topLevel.add(objectMap); ObjectSet<Ellipse> objectSet = new ObjectSet<Ellipse>(); for (int i = 0, size = randSize(); i < size; i++) { objectSet.add(new Ellipse(randFloat(), randFloat(), randFloat(), randFloat())); } topLevel.add(objectSet); OrderedMap<Circle, Affine2> orderedMap = new OrderedMap<Circle, Affine2>(); for (int i = 0, size = randSize(); i < size; i++) { orderedMap.put(new Circle(randFloat(), randFloat(), randFloat()), new Affine2().translate(randFloat(), randFloat()).scale(randFloat(), randFloat()).rotate(randFloat())); } topLevel.add(orderedMap); OrderedSet<Vector2> orderedSet = new OrderedSet<Vector2>(); for (int i = 0, size = randSize(); i < size; i++) { orderedSet.add(new Vector2(randFloat(), randFloat())); } topLevel.add(orderedSet); Queue<GridPoint2> queue = new Queue<GridPoint2>(); for (int i = 0, size = randSize(); i < size; i++) { queue.addLast(new GridPoint2(randInt(), randInt())); } topLevel.add(queue); ShortArray shortArray = new ShortArray(); for (int i = 0, size = randSize(); i < size; i++) { shortArray.add((short)random.nextInt()); } topLevel.add(shortArray); SnapshotArray<Matrix3> snapshotArray = new SnapshotArray<Matrix3>(); for (int i = 0, size = randSize(); i < size; i++) { snapshotArray.add(new Matrix3().rotate(randFloat()).scale(randFloat(), randFloat()).translate(randFloat(), randFloat())); } topLevel.add(snapshotArray); SortedIntList<Vector3> sortedIntList = new SortedIntList<Vector3>(); int size = randSize(); IntArray indices = new IntArray(); for (int i = 0; i < size; i++) { indices.add(i); } indices.shuffle(); for (int i = 0; i < size; i++) { sortedIntList.insert(indices.get(i), new Vector3(randFloat(), randFloat(), randFloat())); } topLevel.add(sortedIntList); simpleRoundTrip(topLevel); } public void testIdentityMap (){ Array topLevel = new Array(); Circle valueCircle = new Circle(randFloat(), randFloat(), randFloat()); topLevel.add(valueCircle); Circle keyCircle = new Circle(randFloat(), randFloat(), randFloat()); topLevel.add(keyCircle); IdentityMap<Circle, Circle> identityMap = new IdentityMap<Circle, Circle>(); for (int i = 0, size = randSize() + 5; i < size; i++) { if (i == 5){ identityMap.put(keyCircle, valueCircle); continue; } identityMap.put(new Circle(randFloat(), randFloat(), randFloat()), new Circle(randFloat(), randFloat(), randFloat())); } topLevel.add(identityMap); Array returnedArray = simpleRoundTrip(topLevel); Circle returnedValueCircle = (Circle) returnedArray.get(0); Circle returnedKeyCircle = (Circle) returnedArray.get(1); IdentityMap<Circle, Circle> returnedMap = (IdentityMap<Circle, Circle>)returnedArray.get(2); assertTrue(returnedValueCircle == returnedMap.get(returnedKeyCircle)); } public void testUtils (){ StringBuilder stringBuilder = new StringBuilder(); for (int i = 0, size = randSize(); i < size; i++) { stringBuilder.append((char)randInt()); } simpleRoundTrip(stringBuilder); } }
7d9fe0408ae4f62dfb4bb8564823174c5dd97f5f
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/branches/apitest1/code/base/dso-common/src/com/tc/object/net/DSOClientMessageChannel.java
772b87dc99081c86f744f10a46cd2c456d942ce9
[]
no_license
sirinath/Terracotta
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
00a7662b9cf530dfdb43f2dd821fa559e998c892
refs/heads/master
2021-01-23T05:41:52.414211
2015-07-02T15:21:54
2015-07-02T15:21:54
38,613,711
1
0
null
null
null
null
UTF-8
Java
false
false
2,380
java
/* * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright * notice. All rights reserved. */ package com.tc.object.net; import com.tc.async.api.Sink; import com.tc.net.GroupID; import com.tc.net.MaxConnectionsExceededException; import com.tc.net.protocol.tcm.ChannelEventListener; import com.tc.net.protocol.tcm.ClientMessageChannel; import com.tc.net.protocol.tcm.TCMessageType; import com.tc.object.ClientIDProvider; import com.tc.object.msg.AcknowledgeTransactionMessageFactory; import com.tc.object.msg.ClientHandshakeMessageFactory; import com.tc.object.msg.CommitTransactionMessageFactory; import com.tc.object.msg.CompletedTransactionLowWaterMarkMessageFactory; import com.tc.object.msg.JMXMessage; import com.tc.object.msg.LockRequestMessageFactory; import com.tc.object.msg.ObjectIDBatchRequestMessageFactory; import com.tc.object.msg.RequestManagedObjectMessageFactory; import com.tc.object.msg.RequestRootMessageFactory; import com.tc.util.TCTimeoutException; import java.io.IOException; import java.net.UnknownHostException; public interface DSOClientMessageChannel { public void addClassMapping(TCMessageType messageType, Class messageClass); public ClientIDProvider getClientIDProvider(); public void addListener(ChannelEventListener listener); public void routeMessageType(TCMessageType messageType, Sink destSink, Sink hydrateSink); public void open() throws MaxConnectionsExceededException, TCTimeoutException, UnknownHostException, IOException; public boolean isConnected(); public void close(); public ClientMessageChannel channel(); public LockRequestMessageFactory getLockRequestMessageFactory(); public CompletedTransactionLowWaterMarkMessageFactory getCompletedTransactionLowWaterMarkMessageFactory(); public RequestRootMessageFactory getRequestRootMessageFactory(); public RequestManagedObjectMessageFactory getRequestManagedObjectMessageFactory(); public ObjectIDBatchRequestMessageFactory getObjectIDBatchRequestMessageFactory(); public CommitTransactionMessageFactory getCommitTransactionMessageFactory(); public ClientHandshakeMessageFactory getClientHandshakeMessageFactory(); public AcknowledgeTransactionMessageFactory getAcknowledgeTransactionMessageFactory(); public JMXMessage getJMXMessage(); public GroupID[] getGroupIDs(); }
[ "amiller@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
amiller@7fc7bbf3-cf45-46d4-be06-341739edd864
9df57cd174f78d6de625fb44a8522a6c6dde9c6f
71ec3c641b3d4bd400039a03ee4929f8cec5100f
/common/import-parsers/blackboard_9_nyu/src/java/org/sakaiproject/importer/impl/Blackboard9NYUFileParser.java
d5db59f3bfcb7471289a84cc415cdf657396f1f1
[ "LicenseRef-scancode-generic-cla", "ECL-2.0", "GPL-1.0-or-later", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
NYUeServ/sakai11
f03020a82c8979e35c161e6c1273e95041f4a10e
35f04da43be735853fac37e0098e111e616f7618
refs/heads/master
2023-05-11T16:54:37.240151
2021-12-21T19:53:08
2021-12-21T19:53:08
57,332,925
3
5
ECL-2.0
2023-04-18T12:41:11
2016-04-28T20:50:33
Java
UTF-8
Java
false
false
36,579
java
package org.sakaiproject.importer.impl; import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.text.Normalizer; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.HashMap; import java.util.zip.ZipInputStream; import java.util.zip.ZipEntry; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Hex; import org.apache.commons.lang.StringUtils; import org.sakaiproject.archive.api.ImportMetadata; import org.sakaiproject.importer.api.IMSResourceTranslator; import org.sakaiproject.importer.api.Importable; import org.sakaiproject.importer.api.ImportFileParser; import org.sakaiproject.importer.impl.importables.FileResource; import org.sakaiproject.importer.impl.importables.Folder; import org.sakaiproject.importer.impl.importables.HtmlDocument; import org.sakaiproject.importer.impl.translators.Bb9NYUAnnouncementTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUAssessmentAttemptFilesTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUAssessmentAttemptTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUCollabSessionTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUCourseMembershipTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUCourseUploadsTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUDiscussionBoardTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUExternalLinkTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUGroupUploadsTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUHTMLDocumentTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUQuestionPoolTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUSurveyTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUTextDocumentTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUSmartTextDocumentTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUStaffInfoTranslator; import org.sakaiproject.importer.impl.translators.Bb9NYUAssessmentTranslator; import org.sakaiproject.util.Validator; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.TrueFileFilter; import org.apache.commons.io.filefilter.IOFileFilter; public class Blackboard9NYUFileParser extends IMSFileParser { public static final String BB_NAMESPACE_URI = "http://www.blackboard.com/content-packaging/"; public static final String WEBCT_NAMESPACE_URI = "http://www.webct.com/IMS"; public static final String ASSESSMENT_GROUP = "Assessments"; public static final String ANNOUNCEMENT_GROUP = "Announcements"; public static final String ASSESSMENT_FILES_DIRECTORY = "TQimages"; public Blackboard9NYUFileParser() { // eventually, this will be spring-injected, // but it's ok to hard-code this for now addResourceTranslator(new Bb9NYUAnnouncementTranslator()); addResourceTranslator(new Bb9NYUAssessmentTranslator()); addResourceTranslator(new Bb9NYUQuestionPoolTranslator()); addResourceTranslator(new Bb9NYUSurveyTranslator()); addResourceTranslator(new Bb9NYUAssessmentAttemptTranslator()); addResourceTranslator(new Bb9NYUStaffInfoTranslator()); addResourceTranslator(new Bb9NYUHTMLDocumentTranslator()); addResourceTranslator(new Bb9NYUTextDocumentTranslator()); addResourceTranslator(new Bb9NYUSmartTextDocumentTranslator()); addResourceTranslator(new Bb9NYUExternalLinkTranslator()); addResourceTranslator(new Bb9NYUCollabSessionTranslator()); addResourceTranslator(new Bb9NYUAssessmentAttemptFilesTranslator()); addResourceTranslator(new Bb9NYUCourseUploadsTranslator()); addResourceTranslator(new Bb9NYUGroupUploadsTranslator()); addResourceTranslator(new Bb9NYUCourseMembershipTranslator()); addResourceTranslator(new Bb9NYUDiscussionBoardTranslator()); resourceHelper = new Bb9NYUResourceHelper(); itemHelper = new Bb9NYUItemHelper(); fileHelper = new Bb9NYUFileHelper(); manifestHelper = new Bb9NYUManifestHelper(); } public ImportFileParser newParser() { return new Blackboard9NYUFileParser(); } public boolean isValidArchive(byte[] fileData) { if (super.isValidArchive(new ByteArrayInputStream(fileData))) { Document manifest = extractFileAsDOM("/imsmanifest.xml", new ByteArrayInputStream(fileData)); if (!hasBb9Version(fileData)) { return false; } if (enclosingDocumentContainsNamespaceDeclaration(manifest, BB_NAMESPACE_URI)) { return true; } else if (enclosingDocumentContainsNamespaceDeclaration(manifest, WEBCT_NAMESPACE_URI)) { return true; } else { return false; } } else return false; } private String readFullInputStream(InputStream stream) throws IOException { InputStreamReader reader = new InputStreamReader(stream); char[] buffer = new char[4096]; StringBuilder sb = new StringBuilder(); int len; while ((len = reader.read(buffer, 0, buffer.length)) >= 0) { sb.append(buffer, 0, len); } return sb.toString(); } private boolean hasBb9Version(byte[] fileData) { ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(fileData)); try { while (true) { ZipEntry entry = (ZipEntry) zipStream.getNextEntry(); if (entry == null) { return false; } if (".bb-package-info".equals(entry.getName())) { String packageInfo = readFullInputStream(zipStream); return (packageInfo.indexOf("app.release.number=9.") >= 0); } } } catch (IOException e) { return false; } } private boolean enclosingDocumentContainsNamespaceDeclaration(Node node, String nameSpaceURI) { return node.lookupPrefix(nameSpaceURI) != null; } protected boolean isCompoundDocument(Node node, Document resourceDescriptor) { // the rule we're observing is that any document of type resource/x-bb-document // that has more than one child will be treated as a compound document return "resource/x-bb-document".equals(XPathHelper.getNodeValue("./@type",node)) && node.hasChildNodes() && (node.getChildNodes().getLength() > 1); } protected Importable getCompanionForCompoundDocument(Document resourceDescriptor, Folder folder) { HtmlDocument html = new HtmlDocument(); StringBuffer content = new StringBuffer(); String bbText = XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", resourceDescriptor); bbText = StringUtils.replace(bbText, "@[email protected]@X@", ""); content.append(" <p>" + bbText + "</p>\n"); List<Node> fileNodes = XPathHelper.selectNodes("/CONTENT/FILES/FILE", resourceDescriptor); content.append(" <table class=\"bb-files\"><tr><th colspan=\"2\">Included Files</th></tr>\n"); int cnt = 1; for (Node fileNode : fileNodes) { String fileName = XPathHelper.getNodeValue("./NAME", fileNode); content.append("<tr><td>" + cnt + ") </td><td><a href=\"" + fileName + "\">" + fileName + "</a></td></tr>\n"); cnt++; } content.append(" </table>\n"); html.setContent(content.toString()); html.setTitle(folder.getTitle()); html.setContextPath(folder.getPath() + folder.getTitle().replaceAll("/", "_") + "/introduction"); html.setLegacyGroup(folder.getLegacyGroup()); // we want the html document to come before the folder in sequence html.setSequenceNum(folder.getSequenceNum() - 1); return html; } protected boolean wantsCompanionForCompoundDocument() { return true; } protected Collection getCategoriesFromArchive(String pathToData) { Collection categories = new ArrayList(); Collection angelCategories = new ArrayList(); ImportMetadata im; ImportMetadata aim; Node topLevelItem; String resourceId; Node resourceNode; String targetType; List topLevelItems = manifestHelper.getTopLevelItemNodes(this.archiveManifest); for(Iterator i = topLevelItems.iterator(); i.hasNext(); ) { topLevelItem = (Node)i.next(); // save FOR ANGEL aim = new BasicImportMetadata(); aim.setId(itemHelper.getId(topLevelItem)); aim.setLegacyTool(itemHelper.getTitle(topLevelItem)); aim.setMandatory(false); aim.setFileName(".xml"); aim.setSakaiServiceName("ContentHostingService"); aim.setSakaiTool("Resources"); angelCategories.add(aim); // Each course TOC item has a target type. // At present, we only handle the CONTENT // and STAFF_INFO target types, // with assessments and announcements being identified // separately below. resourceId = XPathHelper.getNodeValue("./@identifierref", topLevelItem); resourceNode = manifestHelper.getResourceForId(resourceId, this.archiveManifest); targetType = XPathHelper.getNodeValue("/COURSETOC/TARGETTYPE/@value", resourceHelper.getDescriptor(resourceNode)); if (!(("CONTENT".equals(targetType)) || ("STAFF_INFO").equals(targetType))) continue; im = new BasicImportMetadata(); im.setId(itemHelper.getId(topLevelItem)); im.setLegacyTool(itemHelper.getTitle(topLevelItem)); im.setMandatory(false); im.setFileName(".xml"); im.setSakaiServiceName("ContentHostingService"); im.setSakaiTool("Resources"); categories.add(im); } // Figure out if there are assessments if (XPathHelper.selectNodes("//resource[@type='assessment/x-bb-qti-test']", this.archiveManifest).size() + XPathHelper.selectNodes("//resource[@type='assessment/x-bb-qti-pool']", this.archiveManifest).size() + XPathHelper.selectNodes("//resource[@type='assessment/x-bb-qti-survey']", this.archiveManifest).size() > 0) { im = new BasicImportMetadata(); im.setId("assessments"); im.setLegacyTool(ASSESSMENT_GROUP); im.setMandatory(false); im.setFileName(".xml"); im.setSakaiTool("Tests & Quizzes"); categories.add(im); } // Figure out if we need an Announcements category if (XPathHelper.selectNodes("//resource[@type='resource/x-bb-announcement']", this.archiveManifest).size() > 0) { im = new BasicImportMetadata(); im.setId("announcements"); im.setLegacyTool(ANNOUNCEMENT_GROUP); im.setMandatory(false); im.setFileName(".xml"); im.setSakaiTool("Announcements"); categories.add(im); } if (categories.size() == 0) { return angelCategories; } return categories; } protected Collection<Object> translateFromNodeToImportables(Node node, String contextPath, int priority, Importable parent) { Collection<Object> branchOfImportables = new ArrayList<Object>(); String tag = node.getNodeName(); String itemResourceId = null; if ("item".equalsIgnoreCase(tag)) { itemResourceId = itemHelper.getResourceId(node); } else if ("resource".equalsIgnoreCase(tag)) { itemResourceId = resourceHelper.getId(node); } else if ("file".equalsIgnoreCase(tag)) { itemResourceId = resourceHelper.getId(node.getParentNode()); } Document resourceDescriptor = resourceHelper.getDescriptor(manifestHelper.getResourceForId(itemResourceId, this.archiveManifest)); if (resourceHelper.isFolder(resourceDescriptor) || ("item".equalsIgnoreCase(tag) && (XPathHelper.selectNodes("./item", node).size() > 0)) || ( "item".equalsIgnoreCase(tag) && isCompoundDocument(manifestHelper.getResourceForId(itemResourceId, archiveManifest),resourceDescriptor) )) { String folderTitle = getTitleForNode(node); // NYU-7 strip tags from folder name folderTitle = folderTitle.trim().replaceAll("\\<.*?\\>", "").replaceAll("/", "_"); Folder folder = new Folder(); folder.setPath(contextPath); folder.setTitle(folderTitle); folder.setDescription(getDescriptionForNode(node)); folder.setSequenceNum(priority); if (parent != null) { folder.setParent(parent); folder.setLegacyGroup(parent.getLegacyGroup()); } else folder.setLegacyGroup(folderTitle); // BB9 has a bunch of folders called --TOP-- that we're actually not interested in. // // If we see one of those, process its children but set their parent to the --TOP-- node's // parent (cutting --TOP-- out of the hierarchy) Importable childrenParent = folder; // now we take care of the folder's child Nodes // construct a new path and make sure we replace any forward slashes from the resource title String folderPath = contextPath + folderTitle.replaceAll("/", "_") + "/"; if ("--TOP--".equals(folderTitle)) { childrenParent = parent; folderPath = contextPath; } if (isCompoundDocument(manifestHelper.getResourceForId(itemResourceId, archiveManifest),resourceDescriptor)) { if (wantsCompanionForCompoundDocument()) { priority++; folder.setSequenceNum(priority); branchOfImportables.add(getCompanionForCompoundDocument(resourceDescriptor, folder)); } Node nextNode = manifestHelper.getResourceForId(itemResourceId, archiveManifest); if (nextNode != node) { branchOfImportables.addAll(translateFromNodeToImportables(nextNode, folderPath, priority, childrenParent)); } else { System.err.println("WARNING: loop prevented for path: " + folderPath + " itemResourceId: " + itemResourceId); } } else { List<Node> children = XPathHelper.selectNodes("./item", node); int childPriority = 1; for (Iterator<Node> i = children.iterator(); i.hasNext();) { branchOfImportables.addAll( translateFromNodeToImportables((Node)i.next(),folderPath, childPriority, childrenParent)); childPriority++; } } resourceMap.remove(itemResourceId); if (!"--TOP--".equals(folderTitle)) { branchOfImportables.add(folder); } } // node is folder else if("item".equalsIgnoreCase(tag)) { // this item is a leaf, so we handle the resource associated with it Node resourceNode = manifestHelper.getResourceForId(itemResourceId, this.archiveManifest); if (resourceNode != null) { if (parent == null) { parent = new Folder(); parent.setLegacyGroup(itemHelper.getTitle(node)); } branchOfImportables.addAll( translateFromNodeToImportables(resourceNode,contextPath, priority, parent)); } } else if("file".equalsIgnoreCase(tag)) { FileResource file = new FileResource(); try { String fileName = fileHelper.getFilenameForNode(node).replaceAll("\\<.*?\\>", ""); file.setFileName(fileName); // this will get the bb:title (friendly title, not filename) String folderName = fileHelper.getTitle(node); // first try to remove all special characters folderName = Normalizer.normalize(folderName, Normalizer.Form.NFD); folderName = folderName.replaceAll("[^\\p{ASCII}]", ""); // second try to split the folderName with a comma if (StringUtils.contains(folderName, ",")) { String[] splitName = StringUtils.split(folderName, ","); folderName = StringUtils.left(splitName[0], 24); } // custom vars to help put this single file into a subfolder //String fileHolderFolder = fileName.substring(0, fileName.lastIndexOf('.')); boolean putThisFileIntoAFolder = false; if (node.getParentNode().getChildNodes().getLength() > 1) { file.setDescription(""); } else { // BB9: Seems like we don't want an intro file at all // // // Duke: stay consistent and null it // file.setDescription(""); // putThisFileIntoAFolder = true; // String newItemText = resourceHelper.getDescription(node.getParentNode()); // newItemText = StringUtils.replace(newItemText, "@[email protected]@X@", ""); // if (StringUtils.trimToNull(newItemText) != null) { // HtmlDocument introFile = new HtmlDocument(); // String tmpName = contextPath + folderName + "/" + folderName; // introFile.setContextPath(tmpName); // introFile.setTitle(folderName); // introFile.setContent(newItemText); // if (parent != null) { // introFile.setParent(parent); // introFile.setLegacyGroup(parent.getLegacyGroup()); // } // branchOfImportables.add(introFile); // } } file.setInputStream(new ByteArrayInputStream(fileHelper.getFileBytesForNode(node, contextPath))); if (putThisFileIntoAFolder && !((Bb9NYUFileHelper)fileHelper).isPartOfAssessment(node)) { file.setDestinationResourcePath(contextPath + folderName + "/" + fileName); } else { file.setDestinationResourcePath( fileHelper.getFilePathForNode(node, contextPath). replaceAll("//", "/").replaceAll("embedded/", "") /*.replace(fileHolderFolder, fileHolderFolder + "/" + fileHolderFolder) */ ); } file.setContentType(this.mimeTypes.getContentType(fileName)); file.setTitle(fileHelper.getTitle(node)); if(parent != null) { file.setParent(parent); file.setLegacyGroup(parent.getLegacyGroup()); } else file.setLegacyGroup(""); } catch (IOException e) { resourceMap.remove(resourceHelper.getId(node.getParentNode())); return branchOfImportables; } branchOfImportables.add(file); resourceMap.remove(resourceHelper.getId(node.getParentNode())); return branchOfImportables; } else if("resource".equalsIgnoreCase(tag)) { // TODO handle a resource node Importable resource = null; boolean processResourceChildren = true; IMSResourceTranslator translator = (IMSResourceTranslator)translatorMap.get(resourceHelper.getType(node)); if (translator != null) { String title = resourceHelper.getTitle(node); ((Element)node).setAttribute("title", title); ((Element)node).setAttribute("priority", Integer.toString(priority)); resource = translator.translate(node, resourceHelper.getDescriptor(node), contextPath, this.pathToData); processResourceChildren = translator.processResourceChildren(); } if (resource != null) { // make a note of a dependency if there is one. String dependency = resourceHelper.getDependency(node); if (!"".equals(dependency)) { dependencies.put(resourceHelper.getId(node), dependency); } // section to twiddle with the Importable's legacyGroup, // which we only want to do if it hasn't already been set. if ((resource.getLegacyGroup() == null) || ("".equals(resource.getLegacyGroup()))) { // find out if something depends on this. if (dependencies.containsValue(resourceHelper.getId(node))) { resource.setLegacyGroup("mandatory"); } else if (parent != null) { resource.setParent(parent); resource.setLegacyGroup(parent.getLegacyGroup()); } else resource.setLegacyGroup(resourceHelper.getTitle(node)); } branchOfImportables.add(resource); parent = resource; } // processing the child nodes implies that their files can wind up in the Resources tool. // this is not always desirable, such as the QTI files from assessments. if (processResourceChildren) { NodeList children = node.getChildNodes(); for (int i = 0;i < children.getLength();i++) { branchOfImportables.addAll(translateFromNodeToImportables(children.item(i), contextPath, priority, parent)); } } resourceMap.remove(itemResourceId); } return branchOfImportables; } protected class Bb9NYUResourceHelper extends ResourceHelper { public String getTitle(Node resourceNode) { String title = resourceNode.getAttributes().getNamedItem("bb:title").getNodeValue().trim().replaceAll("\\<.*?\\>", "").replaceAll("/", "_"); return TitleUniquifier.uniquify(title, resourceNode); } public String getType(Node resourceNode) { String nodeType = XPathHelper.getNodeValue("./@type", resourceNode); if ("resource/x-bb-document".equals(nodeType)) { /* * Since we've gotten a bb-document, we need to figure out what kind it is. Known possible are: * 1. x-bb-externallink * 2. x-bb-document * a. Plain text * b. Smart text * c. HTML * The reason we have to do this is that all the above types are listed as type "resource/x-bb-document" * in the top level resource node. Their true nature is found with the XML descriptor (.dat file) */ if(resourceNode.hasChildNodes()) { // If it has child-nodes (files, usually) we don't want to parse the actual document return nodeType; } String subType = XPathHelper.getNodeValue("/CONTENT/CONTENTHANDLER/@value", resourceHelper.getDescriptor(resourceNode)); if ("resource/x-bb-externallink".equals(subType)) { nodeType = "resource/x-bb-externallink"; } else if ("resource/x-bb-asmt-test-link".equals(subType)) { nodeType = "resource/x-bb-asmt-test-link"; } else { String docType = XPathHelper.getNodeValue("/CONTENT/BODY/TYPE/@value", resourceHelper.getDescriptor(resourceNode)); if ("H".equals(docType)) { // NYU-2 nodeType = "resource/x-bb-document-smart-text"; } else if ("P".equals(docType)) { nodeType = "resource/x-bb-document-plain-text"; } else if ("S".equals(docType)) { nodeType = "resource/x-bb-document-smart-text"; } } } return nodeType; } public String getId(Node resourceNode) { return XPathHelper.getNodeValue("./@identifier", resourceNode); } public Document getDescriptor(Node resourceNode) { try { String descriptorFilename = resourceNode.getAttributes().getNamedItem("bb:file").getNodeValue(); DocumentBuilder docBuilder; docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputStream fis = new FileInputStream(pathToData + "/" + descriptorFilename); return (Document) docBuilder.parse(fis); } catch (Exception e) { return null; } } public String getDescription(Node resourceNode) { Document descriptor = resourceHelper.getDescriptor(resourceNode); return XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", descriptor); } public boolean isFolder(Document resourceDescriptor) { return "true".equals(XPathHelper.getNodeValue("/CONTENT/FLAGS/ISFOLDER/@value", resourceDescriptor)); } } protected class Bb9NYUItemHelper extends ItemHelper { public String getId(Node itemNode) { return XPathHelper.getNodeValue("./@identifier", itemNode); } private String getTitleHelper(Node itemNode) { String tempString = XPathHelper.getNodeValue("./title",itemNode); if (tempString.equals("content.Assignments.label")) return "Assignments"; if (tempString.equals("content.Documents.label")) return "Documents"; if (tempString.equals("content.Syllabus.label")) return "Syllabus"; if (tempString.equals("staff_information.FacultyInformation.label")) return "Faculty Information"; if (tempString.equals("COURSE_DEFAULT.Assignments.CONTENT_LINK.label")) return "Assignments"; if (tempString.equals("COURSE_DEFAULT.Communication.APPLICATION.label")) return "Communication"; if (tempString.equals("COURSE_DEFAULT.CourseInformation.CONTENT_LINK.label")) return "Course Information"; if (tempString.equals("COURSE_DEFAULT.ExternalLinks.CONTENT_LINK.label")) return "External Links"; if (tempString.equals("COURSE_DEFAULT.CourseDocuments.CONTENT_LINK.label")) return "Documents"; if (tempString.equals("COURSE_DEFAULT.StaffInformation.STAFF.label")) return "Staff"; if (tempString.equals("ORGANIZATION_DEFAULT.Information.CONTENT_LINK.label")) return "Information"; if (tempString.equals("ORGANIZATION_DEFAULT.Documents.CONTENT_LINK.label")) return "Documents"; if (tempString.equals("ORGANIZATION_DEFAULT.ExternalLinks.CONTENT_LINK.label")) return "External Links"; return tempString; } // Wraps the original getTitle (now renamed to getTitleHelper) being careful to make sure titles are unique for the same parent. public String getTitle(Node itemNode) { String title = getTitleHelper(itemNode); return TitleUniquifier.uniquify(title, itemNode); } public String getDescription(Node itemNode) { String resourceId = XPathHelper.getNodeValue("./@identifierref", itemNode); Node resourceNode = manifestHelper.getResourceForId(resourceId, archiveManifest); return resourceHelper.getDescription(resourceNode); } } protected class Bb9NYUManifestHelper extends ManifestHelper { public List getItemNodes(Document manifest) { return XPathHelper.selectNodes("//item", manifest); } public Node getResourceForId(String resourceId, Document manifest) { return XPathHelper.selectNode("//resource[@identifier='" + resourceId + "']",archiveManifest); } public List getResourceNodes(Document manifest) { return XPathHelper.selectNodes("//resource", manifest); } public List getTopLevelItemNodes(Document manifest) { return XPathHelper.selectNodes("//organization/item", manifest); } } protected class Bb9NYUFileHelper extends FileHelper { private File findBB9File(String basePath, Node node) { String linkName = XPathHelper.getNodeValue("./LINKNAME/@value", node); final String name = XPathHelper.getNodeValue("./NAME", node); int extensionPosition = linkName.lastIndexOf("."); if (extensionPosition < 0) { extensionPosition = linkName.length(); } final String extension = linkName.substring(extensionPosition); File baseFile = new File(basePath); if (!baseFile.exists()) { System.out.println("File not found: " + basePath); return null; } Iterator<File> matches = FileUtils.iterateFiles(baseFile, new IOFileFilter() { public boolean accept(File file) { return accept(file.getParentFile(), file.getName()); } public boolean accept(File dir, String filename) { // The filename will contain "name" (an ID) prefixed by // underscores, followed by an optional extension. // // Each data file has a counterpart with the same filename // plus an ".xml" extension, so we want to be careful not // to pick up this file by mistake. return (filename.matches(".*__" + name.substring(1) + "\\b.*") && !filename.toLowerCase().endsWith(".xml")); } }, TrueFileFilter.INSTANCE); if (matches.hasNext()) { return matches.next(); } System.out.println("No file found matching linkName: " + linkName + " with name: " + name); return null; } public byte[] getFileBytesForNode(Node node, String contextPath) throws IOException { //for Bb we ignore the contextPath... String basePath = XPathHelper.getNodeValue("./@identifier",node.getParentNode()); String fileHref = XPathHelper.getNodeValue("./@href", node).replaceAll("\\\\", File.separator); String filePath = basePath + File.separator + fileHref; File f = new File(pathToData + File.separator + filePath); if (!f.exists()) { // if the file doesn't exist in the location filePath = fileHref; f = new File(pathToData + File.separator + filePath); } if (f.exists() && !f.isDirectory()) { System.out.println("Found file directly: " + pathToData + File.separator + filePath + ";exists=" + f.exists()); return getBytesFromFile(f); } // BB9: if this file is a "csfiles" entry, dig it out now. if ("CS".equals(XPathHelper.getNodeValue("./STORAGETYPE/@value", node))) { // f = new File(pathToData + File.separator + // "csfiles" + File.separator + // "home_dir" + File.separator + // generateBB9Filename(node)); f = findBB9File(pathToData + File.separator + "csfiles" + File.separator + "home_dir", node); if (f != null && f.exists()) { return getBytesFromFile(f); } } // now iterate through to explicitly find the file (bad exclamation mark file issue) System.out.println("Folder: " + pathToData + File.separator + basePath + File.separator); File folder = new File(pathToData + File.separator + basePath + File.separator); File[] listOfFiles = folder.listFiles(); if (listOfFiles == null) { System.err.println("Got a null directory for base path: " + basePath + " href: " + fileHref); System.err.println("Context path was: " + contextPath); } try { for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { String fileName = listOfFiles[i].getName(); String thePath = getFileFromStrangePath(fileName, fileHref); System.out.println("Searching for strange path: " + thePath); if (!StringUtils.isEmpty(thePath)) { filePath = basePath + File.separator + thePath; f = new File(pathToData + File.separator + filePath); if (f.exists()) { return getBytesFromFile(f); } } filePath = basePath + File.separator + fileName; } else if (listOfFiles[i].isDirectory()) { File[] subDir = listOfFiles[i].listFiles(); //System.out.println("Directory " + listOfFiles[i].getName()); for (int j = 0; j < subDir.length; j++) { if (subDir[j].isFile()) { String thePath = getFileFromStrangePath(subDir[j].getName(), fileHref); System.out.println("s3:" + listOfFiles[i].getName() + File.separator + subDir[j].getName()); if (!StringUtils.isEmpty(thePath)) { filePath = basePath + File.separator + listOfFiles[i].getName() + File.separator + thePath; System.out.println("sub: " + filePath); f = new File(pathToData + File.separator + filePath); System.out.println("sub2: " + pathToData + File.separator + filePath); if (f.exists()) { return getBytesFromFile(f); } } filePath = basePath + File.separator + listOfFiles[i].getName() + File.separator + subDir[j].getName(); } } } } } catch (Exception exc) { exc.printStackTrace(); System.out.println("Bad folder: " + exc.getMessage()); } System.out.println("never found a matching file so just returning last doc"); return getBytesFromFile(new File(pathToData + File.separator + filePath)); } public boolean isPartOfAssessment(Node node) { String parentType = XPathHelper.getNodeValue("../@type", node); return ("assessment/x-bb-qti-pool".equals(parentType) || "assessment/x-bb-qti-test".equals(parentType)); } public String getFilePathForNode(Node node, String contextPath) { // for files that are part of an assessment, we're going to // tack on an extra container folder to the path. if (isPartOfAssessment(node)) { contextPath = contextPath + "/" + ASSESSMENT_FILES_DIRECTORY; } String fileHref = XPathHelper.getNodeValue("./@href", node); fileHref = fileHref.replaceAll("\\\\", "/"); String parentType = XPathHelper.getNodeValue("../@type", node); if (parentType.equals("webcontent")) { System.out.println("filehref: " + fileHref); if (fileHref.indexOf("/") > -1) { String [] temp = null; temp = fileHref.split("/"); String resourceId = XPathHelper.getNodeValue("./@identifier", node.getParentNode()); System.out.println("resourceId: " + resourceId); Node itemNode = XPathHelper.selectNode("//item[@identifierref='" + resourceId + "']",archiveManifest); String tempString = XPathHelper.getNodeValue("./title",itemNode); tempString = tempString.replaceAll("\\<.*?\\>", ""); // get rid of HTML tags in a title System.out.println("getting title from item: " + tempString); System.out.println("temp2: " + temp[2] + ";length: " + temp[2].length()); if (temp[2].length() == 38) { System.out.println("temp2: " + temp[2] + ";length: " + temp[2].length()); return contextPath + "/" + tempString.replaceAll("\\\\", "/") + "/index.html"; } else { return contextPath + "/" +tempString.replaceAll("\\\\", "/") + "/" + temp[2]; } } } return contextPath + "/" + fileHref.replaceAll("\\\\", "/"); } public String getTitle(Node fileNode) { /* String resourceId = XPathHelper.getNodeValue("./@identifier", fileNode.getParentNode()); System.out.println("resourceId: " + resourceId); Node itemNode = XPathHelper.selectNode("//item[@identifierref='" + resourceId + "']",archiveManifest); String tempString = XPathHelper.getNodeValue("./title",itemNode); System.out.println("getting title from item: " + tempString); */ // if the resource that this file belongs to has multiple files, // we just want to use the filename as the title if (fileNode.getParentNode().getChildNodes().getLength() > 1) { return getFilenameForNode(fileNode); } else { return resourceHelper.getTitle(fileNode.getParentNode()); } } public String getFilenameForNode(Node node) { String linkName = XPathHelper.getNodeValue("./LINKNAME/@value", node); if (linkName != null && !linkName.equals("")) { return linkName; } String sourceFilePath = XPathHelper.getNodeValue("./@href", node).replaceAll("\\\\", "/"); String temp = (sourceFilePath.lastIndexOf("/") < 0) ? sourceFilePath : sourceFilePath.substring(sourceFilePath.lastIndexOf("/") + 1); if (temp.indexOf(".htm") > -1 && temp.length() == 38) { return "index.html"; } else { return temp; } } private String getFileFromStrangePath(String fileName, String fileHref) { String strippedFileName = fileName; String strippedFileExtension = ""; if (fileName.startsWith("!")) { strippedFileName = fileName.substring(1); int suffixPos = strippedFileName.lastIndexOf("."); strippedFileName = strippedFileName.substring(0, suffixPos); strippedFileExtension = fileName.substring(suffixPos+1, fileName.length()); byte[] hexedName = null; try { hexedName = Hex.decodeHex(strippedFileName.toCharArray()); } catch (DecoderException e) { // TODO Auto-generated catch block e.printStackTrace(); } String hexString = new String(hexedName); //System.out.println("sfile: " + strippedFileName + ";extension=" + strippedFileExtension + ";hex=" + hexString); String fileNameWithoutExtension = fileHref; String fileNameExtension = ""; // just get the filename not the whole path if (fileNameWithoutExtension.contains("/")) { fileNameWithoutExtension = fileNameWithoutExtension.substring(fileNameWithoutExtension.lastIndexOf("/")+1, fileNameWithoutExtension.length()); } // find the extension if (fileHref.contains(".")) { fileNameWithoutExtension = fileNameWithoutExtension.substring(0,fileNameWithoutExtension.lastIndexOf(".")); fileNameExtension = fileHref.substring(fileHref.lastIndexOf("."), fileHref.length()); } if (fileNameWithoutExtension.equals(hexString) && strippedFileExtension.equalsIgnoreCase(fileNameExtension)) { System.out.println("found file match: " + fileNameWithoutExtension + "::" + hexString); return fileName; } } return ""; } } }
475d75c0652e3f4ce576396738931184f5545d25
cc03c34962b9994d279cb3abcf53f60655dcddcd
/src/com/TMMS/Main/action/user/ShowUserLoginLogAction.java
f0ac73b83f867e5712a11eecbd4d27965d06b473
[]
no_license
shianqi/TMMS
1d452ce9f12661a717551f028c62b0ac73732847
ec169827eb1dfdba6dc0e97976678154d274262f
refs/heads/master
2021-01-21T04:50:21.614227
2016-06-05T03:22:01
2016-06-05T03:22:01
54,723,050
5
0
null
null
null
null
UTF-8
Java
false
false
994
java
package com.TMMS.Main.action.user; import java.util.List; import java.util.Map; import org.apache.struts2.ServletActionContext; import com.TMMS.Main.bean.Ul; import com.TMMS.Main.service.UsersService; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class ShowUserLoginLogAction extends ActionSupport{ List<Ul> list; public List<Ul> getList() { return list; } public void setList(List<Ul> list) { this.list = list; } @Override public String execute() throws Exception { // TODO Auto-generated method stub Map<String, Object> session= ActionContext.getContext().getSession(); if(session.get("state")==null||session.get("state").equals("0")){ return ERROR; } UsersService usersService = new UsersService(); long username = Long.valueOf(String.valueOf(session.get("U_ID"))); list = usersService.showUserLoginLog(username); ServletActionContext.getRequest().setAttribute("list", list); return SUCCESS; } }
85d386e658f3eb689708f9fdb3bf7c03f5d26f47
a767641ac3d8258a3280f807a1b5329a4c5565e9
/src/test/java/com/miage/altea/tp/pokemon_ui/controller/IndexControllerTest.java
42caaaeac61c395cfccdab0df1c8d6928bc77f90
[]
no_license
ALTEA-2019-2020/game-ui-tchobels
f87800c05c02b6d0545ebbf4b9ce30ebcbba20dc
6102b77645c322db5e6edfd258d1c3f6a595053e
refs/heads/master
2020-12-27T12:51:24.857432
2020-04-04T19:21:21
2020-04-04T19:21:21
237,909,790
0
0
null
2020-02-10T09:32:22
2020-02-03T07:36:35
null
UTF-8
Java
false
false
1,905
java
package com.miage.altea.tp.pokemon_ui.controller; import com.miage.altea.tp.pokemon_ui.trainers.service.impl.TrainerServiceImpl; import org.junit.jupiter.api.Test; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import static org.junit.jupiter.api.Assertions.*; public class IndexControllerTest { @Test void controllerShouldBeAnnotated() { assertNotNull(IndexController.class.getAnnotation(Controller.class)); } @Test void index_shouldReturnTheNameOfTheIndexTemplate() { var indexController = new IndexController(new TrainerServiceImpl()); var viewName = indexController.index(); assertEquals("index", viewName); } @Test void index_shouldBeAnnotated() throws NoSuchMethodException { var indexMethod = IndexController.class.getMethod("index"); var getMapping = indexMethod.getAnnotation(GetMapping.class); assertNotNull(getMapping); assertArrayEquals(new String[]{"/"}, getMapping.value()); } @Test void registerNewTrainer_shouldReturnAModelAndView() { var indexController = new IndexController(new TrainerServiceImpl()); var modelAndView = indexController.registerNewTrainer("Blue"); assertNotNull(modelAndView); assertEquals("register", modelAndView.getViewName()); assertEquals("Blue", modelAndView.getModel().get("name")); } @Test void registerNewTrainer_shouldBeAnnotated() throws NoSuchMethodException { var registerMethod = IndexController.class.getDeclaredMethod("registerNewTrainer", String.class); var getMapping = registerMethod.getAnnotation(PostMapping.class); assertNotNull(getMapping); assertArrayEquals(new String[]{"/registerTrainer"}, getMapping.value()); } }
6d85249513dc305b39f23de1808da4446de5ab1d
3f463152ff01258f4f57fc544b5300ec5c540702
/app/src/main/java/user/test/com/test_android_user/db/CityDao.java
5933931cf4f51018b12e6b67679da724998521d4
[]
no_license
Rocktiger/test_android_user
ee730b0d1408f1164893faf95677485bb043fe96
0ca7df8d0d39555a8de60886090618b94d98c581
refs/heads/master
2020-04-22T14:02:39.121997
2020-04-15T03:34:44
2020-04-15T03:34:44
170,429,744
0
0
null
null
null
null
UTF-8
Java
false
false
6,416
java
package user.test.com.test_android_user.db; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteConstraintException; import android.database.sqlite.SQLiteDatabase; import android.text.TextUtils; import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import user.test.com.test_android_user.bean.City; /** * {@link DataBaseHelper} */ public class CityDao { private static final String TABLE = "t_city"; private final String CITY_ID = "city_id"; private final String CITY_NAME = "city_name"; private final String PINYIN = "pinyin"; private final String SERVICE_OPRN = "service_open"; private DataBaseHelper mDataBaseHelper; private SQLiteDatabase db; public CityDao(Context context) { mDataBaseHelper = new DataBaseHelper(context); } public boolean isEmpty() { db = mDataBaseHelper.getWritableDatabase(); Cursor cursor = db.rawQuery("select count(*) as c from " + TABLE, null); if (cursor.moveToNext()) { int count = cursor.getInt(0); if (count > 0) { return false; } } return true; } public long insert(City city) { db = mDataBaseHelper.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(CITY_ID, city.getCity_id()); values.put(CITY_NAME, city.getName()); values.put(PINYIN, city.getPinyin()); values.put(SERVICE_OPRN, city.getService_open()); long result = db.insert(TABLE, null, values); closeQuietly(db); return result; } public boolean queryCityExist(SQLiteDatabase db, String city_id){ if (db == null){ db = mDataBaseHelper.getReadableDatabase(); } boolean isExist = false; Cursor cursor = null; try{ cursor = db.query(TABLE, new String[]{CITY_ID}, CITY_ID + "=?", new String[]{city_id}, null, null, null, null); if (cursor !=null && cursor.getCount()>0) { isExist = true; } }catch (Exception e){ e.printStackTrace(); }finally { closeQuietly(cursor); } return isExist; } public long insertOrUpdate(List<City> citys) { long result = -1; db = mDataBaseHelper.getWritableDatabase(); db.beginTransaction(); try { for (City city : citys) { if (city != null && city.checkCity()) { ContentValues values = new ContentValues(); values.put(CITY_ID, city.getCity_id()); values.put(CITY_NAME, city.getName()); values.put(PINYIN, city.getPinyin()); values.put(SERVICE_OPRN, city.getService_open()); if (!queryCityExist(db, city.getCity_id()+"")){ result = db.insert(TABLE, null, values); }else { result = db.update(TABLE, values, CITY_ID + "=?", new String[]{ city.getCity_id()+"" }); } } } result = 0; db.setTransactionSuccessful(); } catch (SQLiteConstraintException e) { e.printStackTrace(); return result; } catch (Exception e) { e.printStackTrace(); return result; } finally { db.endTransaction(); closeQuietly(db); } return result; } public List<City> queryAll() { db = mDataBaseHelper.getReadableDatabase(); List<City> cities = new ArrayList<>(); Cursor cursor = db.rawQuery("select * from " + TABLE, null); if (cursor.moveToFirst()) { do { City city = new City(); city.setCity_id(cursor.getInt(cursor.getColumnIndex(CITY_ID))); city.setCity_name(cursor.getString(cursor.getColumnIndex(CITY_NAME))); city.setPinyin(cursor.getString(cursor.getColumnIndex(PINYIN))); city.setService_open(cursor.getInt(cursor.getColumnIndex(SERVICE_OPRN))); cities.add(city); } while (cursor.moveToNext()); } closeQuietly(db); Collections.sort(cities, new CityComparator()); return cities; } public List<City> searchCity(final String keyword) { return searchCity(keyword, true); } public List<City> searchCity(final String keyword, boolean isIncludePinYin) { db = mDataBaseHelper.getReadableDatabase(); String sqlStr = "select * from " + TABLE + " where city_name like \"%" + keyword + "%\"" + (isIncludePinYin ? " or pinyin like \"%" + keyword + "%\"" : ""); Cursor cursor = db.rawQuery(sqlStr, null); List<City> result = new ArrayList<>(); City city; while (cursor.moveToNext()) { String name = cursor.getString(cursor.getColumnIndex(CITY_NAME)); String pinyin = cursor.getString(cursor.getColumnIndex(PINYIN)); city = new City(name, pinyin); city.setService_open(cursor.getInt(cursor.getColumnIndex(SERVICE_OPRN))); city.setCity_id(cursor.getInt(cursor.getColumnIndex(CITY_ID))); result.add(city); } cursor.close(); db.close(); Collections.sort(result, new CityComparator()); return result; } private void closeQuietly(Closeable closeable) { if (null != closeable) { try { closeable.close(); } catch (IOException e) { e.printStackTrace(); } } } /** * sort by a-z */ private class CityComparator implements Comparator<City> { @Override public int compare(City lhs, City rhs) { if (lhs == null || rhs == null || TextUtils.isEmpty(lhs.getPinyin()) || TextUtils.isEmpty(rhs.getPinyin())) { return 0; } String a = lhs.getPinyin().substring(0, 1); String b = rhs.getPinyin().substring(0, 1); return a.compareTo(b); } } }
[ "" ]
d85615197349eec061cd3d414eb8a258f682a1ea
136264d27911b54402406f35c041fc7a3f6210cc
/jeeweb-web/jeeweb-admin/src/main/java/cn/jeeweb/web/ebp/schedule/DayReportScheduleService.java
8f9a429278457273889d16cf26a255b3fb867d7b
[ "Apache-2.0" ]
permissive
iteryijiang/jeeweb
41e525dd240c6855bf3fca5fd9105a0a8b0abd40
bf540eb4daf1b8889514b4f135e4820e2ebcb1fc
refs/heads/master
2022-11-26T03:52:03.372666
2019-08-01T12:45:05
2019-08-01T12:45:05
162,131,820
2
1
Apache-2.0
2022-11-24T02:52:51
2018-12-17T13:05:47
Java
UTF-8
Java
false
false
801
java
package cn.jeeweb.web.ebp.schedule; import java.util.Date; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import cn.jeeweb.common.utils.DateUtils; import cn.jeeweb.web.ebp.report.service.DayReportService; /** * 每天运行一次生成平台的日报汇总数据 * * @author ytj * */ @Component("dayReportScheduleService") public class DayReportScheduleService { @Autowired private DayReportService dayReportService; public void run() { //即将生成日报的日期 Date currentDate=DateUtils.getCurrentDate(); Date sourceDate=DateUtils.dateAddDay(currentDate,-1); try { dayReportService.addDayReportForCreate(sourceDate); } catch (Exception e) { e.printStackTrace(); } } }
54cf69b4e9b5872c076ba273f1beb8ebdf4717b4
217572a4cede0cb431a89d96e2525233f7fdcde9
/callback/src/com/xiaodu/callback/d/AsyncInterfaceCallback.java
85acdeb607f355dd1609b96465c8ddd41f908d96
[]
no_license
greatestrabit/AdvancedJava
903f56bbff4a20aca17bcbd4895c0a9a5cf5204f
976932a33f60ed72779af5585cec7bfbf32e8523
refs/heads/master
2021-01-17T14:46:12.873769
2016-06-23T07:57:59
2016-06-23T07:57:59
54,872,440
2
1
null
null
null
null
UTF-8
Java
false
false
986
java
package com.xiaodu.callback.d; /** * 基于接口的异步回调,每次建立新的线程 * @author [email protected] * */ public class AsyncInterfaceCallback { /** * 使用内部类的实现方式,此处可见回调地狱 * @author [email protected] */ private static void innerMain() { Server server = new Server(); new Thread(new Runnable() { @Override public void run() { server.answer(new IClient() { @Override public void recvAnswer(final String answer) { System.out.println(answer); } }, "What is the answer to life, the universe and everything?"); } }).start(); System.out.println("asked ! waiting for the answer..."); } public static void main(final String[] args) { Server server = new Server(); ClientAsync client = new ClientAsync(server); client.ask("What is the answer to life, the universe and everything?"); System.out.println("asked ! waiting for the answer..."); innerMain(); } }
4b7b77a11da4e11987484e2e0343cb7592dda208
ab8a3756a6d0580376deb3cf3cd1c3321f071343
/src/com/vositor/vositor/Element.java
671af1ae6f05f545a3b84935a9d1db183aa549d6
[]
no_license
gongpb/DesignPatterns
427e51159b3513fc05040bd32d7197d85251e043
4a7888a40396a61326bb88d07bb29a0a3214396e
refs/heads/master
2021-05-02T05:48:17.308084
2020-06-01T13:51:07
2020-06-01T13:51:07
13,065,223
1
1
null
null
null
null
GB18030
Java
false
false
341
java
package com.vositor.vositor; /** * 抽象元素 * 声明有哪一类访问者访问,程序中通过accept方法的参数来定义的 * @author gong_pibao */ public abstract class Element { //定义业务逻辑 public abstract void doSomething(); //允许访问者访问 public abstract void accept(IVisitor visitor); }
1ffc19f159c39946d9305f1a56119e44331dc7ca
c8a63acb2da62ef8bc8d6a7114b9521e45c423a6
/src/main/java/com/zz/police/modules/sys/generator/JdbcGenUtils.java
5ede04aa7cf7fe9ef37801211cfedb4e75cc80fb
[]
no_license
dengkp/police
8e02c03108bb994ec83629f634ba4aeab797151b
a9fda998c4179682fa8ca646ce8324e996331200
refs/heads/master
2020-04-02T03:49:29.731440
2018-10-21T10:56:05
2018-10-21T10:56:05
153,986,448
0
0
null
null
null
null
UTF-8
Java
false
false
9,217
java
package com.zz.police.modules.sys.generator; import com.zz.police.common.utils.CommonUtils; import com.zz.police.common.utils.JdbcUtils; import com.zz.police.common.utils.PropertiesUtils; import com.zz.police.modules.sys.entity.ColumnEntity; import com.zz.police.modules.sys.entity.TableEntity; import org.apache.commons.lang.StringUtils; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * 代码生成工具类(使用jdbc生成本地代码) * @author dengkp */ public class JdbcGenUtils { public static void generatorCode(String jdbcDriver, String jdbcUrl, String jdbcUsername, String jdbcPassword, String tablePrefix, String javaModule, String webModule) throws Exception { String rootPath = ""; String osName = "os.name"; String osWindows = "win"; if(!System.getProperty(osName).toLowerCase().startsWith(osWindows)) { rootPath = "/"; } String tableSql = "SELECT table_name, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = (SELECT DATABASE()) AND table_name LIKE '" + tablePrefix + "_%';"; JdbcUtils jdbcUtils = new JdbcUtils(jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword); List<Map> tableList = jdbcUtils.selectByParams(tableSql, null); TableEntity table = null; List<TableEntity> tables = new ArrayList<>(); Iterator<Map> tableIterator = tableList.iterator(); while(tableIterator.hasNext()) { Map<String, String> currTable = tableIterator.next(); table = new TableEntity(); String tableName = currTable.get("TABLE_NAME"); String className = GenUtils.tableToJava(tableName, ""); table.setTableName(tableName); table.setClassName(className); table.setObjName(StringUtils.uncapitalize(className)); table.setTableComment(currTable.get("TABLE_COMMENT")); String columnSql = "SELECT column_name,data_type,column_comment,column_key,extra FROM information_schema.columns WHERE TABLE_NAME = '"+ tableName + "' AND table_schema = (SELECT DATABASE()) ORDER BY ordinal_position"; ColumnEntity columnEntity = null; List<Map> columnList = jdbcUtils.selectByParams(columnSql,null); Iterator<Map> columnIterator = columnList.iterator(); while(columnIterator.hasNext()){ Map<String, String> currColumn = columnIterator.next(); columnEntity = new ColumnEntity(); columnEntity.setExtra(currColumn.get("EXTRA")); String columnName = currColumn.get("COLUMN_NAME"); String methodName = GenUtils.columnToJava(columnName); columnEntity.setColumnName(columnName); columnEntity.setFieldName(StringUtils.uncapitalize(methodName)); columnEntity.setMethodName(methodName); columnEntity.setColumnKey(currColumn.get("COLUMN_KEY")); columnEntity.setDataType(currColumn.get("DATA_TYPE")); columnEntity.setColumnComment(currColumn.get("COLUMN_COMMENT")); // 属性类型 columnEntity.setFieldType(PropertiesUtils.getInstance("template/config").get(columnEntity.getDataType())); // 主键判断 if ("PRI".equals(columnEntity.getColumnKey()) && table.getPk() == null) { table.setPk(columnEntity); } table.addColumn(columnEntity); } tables.add(table); } // 没主键,则第一个字段为主键 if (table.getPk() == null) { table.setPk(table.getColumns().get(0)); } String projectPath = getProjectPath(); System.out.println("===>>>java generation path:" + projectPath +"/src/main/java"); Map<String, Object> map = null; for (TableEntity tableEntity : tables) { // 封装模板数据 map = new HashMap<>(16); map.put("tableName", tableEntity.getTableName()); map.put("comments", tableEntity.getTableComment()); map.put("pk", tableEntity.getPk()); map.put("className", tableEntity.getClassName()); map.put("objName", tableEntity.getObjName()); map.put("functionCode", webModule); map.put("requestMapping", tableEntity.getTableName().replace("_","/")); map.put("viewPath", webModule + "/" + tableEntity.getClassName().toLowerCase()); map.put("authKey", GenUtils.urlToAuthKey(tableEntity.getTableName().replace("_","/"))); map.put("columns", tableEntity.getColumns()); map.put("hasDecimal", tableEntity.buildHasDecimal().getHasDecimal()); map.put("package", PropertiesUtils.getInstance("template/config").get("package")); map.put("module", javaModule); map.put("author", PropertiesUtils.getInstance("template/config").get("author")); map.put("email", PropertiesUtils.getInstance("template/config").get("email")); System.out.println("============ start table: " + tableEntity.getTableName() + " ================"); for (String template : GenUtils.getTemplates()) { String filePath = getFileName(template, javaModule, webModule, tableEntity.getClassName(), rootPath); String templatePath = rootPath + JdbcUtils.class.getResource("/" + template).getPath().replaceFirst("/", ""); System.out.println(filePath); File dstDir = new File(CommonUtils.getPath(filePath)); //文件夹不存在创建文件夹 if(!dstDir.exists()){ dstDir.mkdirs(); } File dstFile = new File(filePath); //文件不存在则创建 if(!dstFile.exists()){ CommonUtils.generate(templatePath, filePath, map); System.out.println(filePath + "===>>>创建成功!"); } else { System.out.println(filePath + "===>>>文件已存在,未重新生成!"); } } System.out.println("============ finish table: " + tableEntity.getTableName() + " ================\n"); } } public static String getFileName(String template, String javaModule, String webModule, String className, String rootPath) { String packagePath = rootPath + getProjectPath() + "/src/main/java/" + PropertiesUtils.getInstance("template/config").get("package").replace(".","/") + "/modules/" + javaModule + "/"; String resourcePath = rootPath + getProjectPath() + "/src/main/resources/"; String webPath = rootPath + getProjectPath() + "/src/main/webapp/"; if (template.contains(GenConstant.JAVA_ENTITY)) { return packagePath + "entity/" + className + "Entity.java"; } if (template.contains(GenConstant.JAVA_MAPPER)) { return packagePath + "dao/" + className + "Mapper.java"; } if (template.contains(GenConstant.XML_MAPPER)) { return packagePath + "mapper/" + className + "Mapper.xml"; } if (template.contains(GenConstant.JAVA_SERVICE)) { return packagePath + "service/" + className + "Service.java"; } if (template.contains(GenConstant.JAVA_SERVICE_IMPL)) { return packagePath + "service/impl/" + className + "ServiceImpl.java"; } if (template.contains(GenConstant.JAVA_CONTROLLER)) { return packagePath + "controller/" + className + "Controller.java"; } if (template.contains(GenConstant.HTML_LIST)) { return webPath + "WEB-INF/view/" + webModule + "/" + className.toLowerCase() + "/list.html"; } if (template.contains(GenConstant.HTML_ADD)) { return webPath + "WEB-INF/view/" + webModule + "/" + className.toLowerCase() + "/add.html"; } if (template.contains(GenConstant.HTML_EDIT)) { return webPath + "WEB-INF/view/" + webModule + "/" + className.toLowerCase() + "/edit.html"; } if (template.contains(GenConstant.JS_LIST)) { return webPath + "static/js/" + webModule + "/" + className.toLowerCase() + "/list.js"; } if (template.contains(GenConstant.JS_ADD)) { return webPath + "static/js/" + webModule + "/" + className.toLowerCase() + "/add.js"; } if (template.contains(GenConstant.JS_EDIT)) { return webPath + "static/js/" + webModule + "/" + className.toLowerCase() + "/edit.js"; } if (template.contains(GenConstant.SQL_MENU)) { return resourcePath + "sqls/" + className.toLowerCase() + "_menu.sql"; } return null; } public static String getProjectPath() { String basePath = JdbcUtils.class.getResource("/").getPath().replace("/target/classes/", "").replaceFirst("/", ""); return basePath; } }
e9e52689b5e99a62f12bbd0d89ef297c7fdb89be
701d94cab20cd243a067936e22787387e2e1ef76
/DataStrProject/src/application/AlbumViewerController.java
973841b27d43491774c2845f11a09ad1287b7e61
[]
no_license
gc01873/FINALLY
c47a8b0ff5eb338fa07594d8cf35f6b08207a098
d3e94576979582d77b3b7a0e069a765912793f10
refs/heads/master
2020-05-17T21:04:04.538496
2019-04-28T22:01:02
2019-04-28T22:01:02
183,963,056
0
0
null
null
null
null
UTF-8
Java
false
false
1,909
java
package application; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.ResourceBundle; //import Home.MYPlayer; import Home.Playlist; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.embed.swing.JFXPanel; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.ListView; import javafx.scene.input.MouseEvent; import javafx.stage.Stage; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaPlayer.Status; public class AlbumViewerController implements Initializable { public void MenuScreen(ActionEvent event) throws IOException{ Parent MenuView = FXMLLoader.load(getClass().getResource("MenuViewer.fxml")); Scene MenuScene = new Scene(MenuView); Stage Window = (Stage)((Node)event.getSource()).getScene().getWindow(); Window.setScene(MenuScene); Window.show(); } public ObservableList<String> list = FXCollections.observableArrayList(); @FXML public ListView <String>AlbumsListBox; public ArrayList<String> Albums = Main.itunes.displayAlbums(); @Override public void initialize(URL location, ResourceBundle resources) { // TODO Auto-generated method stub loadData(); } public void loadData() { list.removeAll(list); list.addAll(Albums); AlbumsListBox.getItems().addAll(list); } public void playAlbum(MouseEvent event) throws InterruptedException { String Guy = AlbumsListBox.getSelectionModel().getSelectedItem(); //Main.itunes.playStream(Main.itunes.AlbumMap.get(Guy)); //MYPlayer.playStreamer(Main.itunes.AlbumMap.get(Guy)); } }
3477ea0560ebd1ff4185eb6661d280f72987a0f2
5b353b1f09f1c5140bfb729afb930ddead3ab436
/src/test/java/unit/BuyerControllerTest.java
8601e2580ee01a9075edb2909f52144dacd585fc
[]
no_license
eduriol/buyer-manager
e70703ef392a4aab50c1687d0a39f5d0bacd30f1
9b7b9dc168ee7f3a8c171530eb25ae3008bd4cfe
refs/heads/master
2020-04-27T18:59:35.085675
2019-06-07T21:47:56
2019-06-07T21:47:56
174,596,798
0
0
null
null
null
null
UTF-8
Java
false
false
1,445
java
package unit; import buyer.entities.Buyer; import buyer.BuyerController; import org.junit.Before; import org.junit.Test; import java.io.IOException; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; public class BuyerControllerTest { private BuyerController buyerController; @Before public void setUp() throws IOException { buyerController = new BuyerController(); } @Test public void testGetAllBuyersFirstBuyer() throws IOException { assertThat(buyerController.getAllBuyers().get(0), is(equalTo(Buyer.fromFile("src/main/resources/buyer1.json")))); } @Test public void testGetBuyerById() throws IOException { assertThat(buyerController.getBuyer(1L), is(equalTo(Buyer.fromFile("src/main/resources/buyer1.json")))); } @Test public void testGetBuyerByInexistentId() { assertThat(buyerController.getBuyer(0L), is(nullValue())); } @Test(expected = IllegalArgumentException.class) public void testAddItemExistingId() throws IOException { buyerController.addBuyer(Buyer.fromFile("src/main/resources/buyer1.json")); } @Test public void testAddBuyerDistinctId() throws IOException { buyerController.addBuyer(Buyer.fromFile("src/test/resources/buyer3.json")); assertThat(buyerController.getBuyer(3L), is(equalTo(Buyer.fromFile("src/test/resources/buyer3.json")))); } }
283a5fd934ed4fb6580dc7a2cddf9309fb46e1e0
777067dff55d5194c9b08e871a277ecbae8ae279
/spring3_myspringframework/src/main/java/com/yc/bean/HelloWorld.java
63decac1b253d707bec2c47d6295e70f90efe18a
[]
no_license
zyw0205/spring-test1
7d77bc7cbfb8e8c027146f4bbe1c9a219558fd97
f3fce0b5683f0b85dc105fb15a31dad2a291f33f
refs/heads/main
2023-04-02T15:07:04.286132
2021-04-15T03:54:11
2021-04-15T03:54:11
358,112,066
0
0
null
null
null
null
UTF-8
Java
false
false
510
java
package com.yc.bean; import com.yc.springframework.stereotype.MyPostConstruct; import com.yc.springframework.stereotype.MyPreDestroy; public class HelloWorld { @MyPostConstruct public void setup(){ System.out.println("MyPostConstruct"); } @MyPreDestroy public void destroy(){ System.out.println("MyPreDestroy"); } public HelloWorld(){ System.out.println("hello world 构造"); } public void show(){ System.out.println("show"); } }
a3e31620abb8de5cf2d3a44414dc64f5df53071d
e68d1d911d72d9b56ad142ee1cbde1bd31def4e1
/app/src/main/java/mx/cetys/jorgepayan/whatsonsale/Controllers/Activities/LocationDetailsActivity.java
f2de99d466943edcd3249279bc6b1da911c052f2
[]
no_license
jpayan/WhatsOnSale
fdce2a566697c98b2fc591d75b457239061f98b2
5d9634daaf4073dba8d775b60c4f38fcbba32f14
refs/heads/master
2021-08-23T18:05:30.958079
2017-12-06T00:59:52
2017-12-06T00:59:52
111,599,209
0
1
null
null
null
null
UTF-8
Java
false
false
6,830
java
package mx.cetys.jorgepayan.whatsonsale.Controllers.Activities; import android.content.Intent; import android.support.v4.app.FragmentManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.ui.PlacePicker; import java.util.ArrayList; import java.util.HashMap; import mx.cetys.jorgepayan.whatsonsale.Controllers.Fragments.LocationHomeFragment; import mx.cetys.jorgepayan.whatsonsale.Models.BusinessLocation; import mx.cetys.jorgepayan.whatsonsale.Utils.DB.Helpers.LocationHelper; import mx.cetys.jorgepayan.whatsonsale.Utils.SimpleDialog; import mx.cetys.jorgepayan.whatsonsale.R; import mx.cetys.jorgepayan.whatsonsale.Utils.Utils; public class LocationDetailsActivity extends AppCompatActivity { int PLACE_PICKER_REQUEST = 1; EditText editTextLocationAddress; EditText editTextLocationName; Button btnSaveLocation; Button btnDeleteLocation; LocationHelper locationHelper; BusinessLocation businessLocation = new BusinessLocation(); boolean edit = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_location_details); locationHelper = new LocationHelper(getApplicationContext()); editTextLocationAddress = (EditText) findViewById(R.id.edit_text_locationAddress); editTextLocationName = (EditText) findViewById(R.id.edit_txt_locationName); btnSaveLocation = (Button) findViewById(R.id.btn_saveLocation); btnDeleteLocation = (Button) findViewById(R.id.btn_deleteLocation); Intent fromActivity = getIntent(); int callingActivity = fromActivity.getIntExtra(LocationHomeFragment.CALLING_ACTIVITY, 0); if (callingActivity == 0) { btnDeleteLocation.setVisibility(View.INVISIBLE); btnDeleteLocation.setClickable(false); } else { edit = true; businessLocation = fromActivity.getParcelableExtra(LocationHomeFragment.LOCATION); System.out.println("BusinessLocation"); System.out.println(businessLocation); editTextLocationName.setText(businessLocation.getName()); editTextLocationAddress.setText(businessLocation.getAddress()); } final FragmentManager fm = getSupportFragmentManager(); editTextLocationAddress.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); Intent intent; try { intent = builder.build(LocationDetailsActivity.this); startActivityForResult(intent, PLACE_PICKER_REQUEST); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } } } ); btnSaveLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { businessLocation.setName(editTextLocationName.getText().toString()); if(businessLocation.getName().length() > 0 && businessLocation.getAddress().length() > 0) { final String locationId = (edit) ? businessLocation.getLocationId() : locationHelper.addLocation("", businessLocation.getName(), BusinessHomeActivity.currentBusiness.getBusinessId(), businessLocation.getLatitude(), businessLocation.getLongitude(), businessLocation.getAddress()); if (edit) { locationHelper.updateLocation(businessLocation); } Utils.post("location", getApplicationContext(), new HashMap<String, String>(){{ put("address", businessLocation.getAddress()); put("location_name", businessLocation.getName()); put("latitude", String.valueOf(businessLocation.getLatitude())); put("longitude", String.valueOf(businessLocation.getLongitude())); put("business_id", BusinessHomeActivity.currentBusiness.getBusinessId()); put("location_id", locationId); }}); Intent data = new Intent(); data.putExtra(LocationHomeFragment.SUCCESS, "saved."); setResult(RESULT_OK, data); finish(); } else { SimpleDialog emptyFieldsDialog = new SimpleDialog( "Fill up all the fields before saving the businessLocation.", "Ok"); emptyFieldsDialog.show(fm, "Alert Dialog Fragment"); } } }); btnDeleteLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { locationHelper.deleteLocation(businessLocation.getLocationId()); Utils.delete("businessLocation", getApplicationContext(), new ArrayList<String>() {{ add(businessLocation.getLocationId()); }}, fm); Intent data = new Intent(); data.putExtra(LocationHomeFragment.SUCCESS, "deleted."); setResult(RESULT_OK, data); finish(); } }); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST) { if (resultCode == RESULT_OK) { Place place = PlacePicker.getPlace(data, this); businessLocation.setAddress((String) place.getAddress()); businessLocation.setLatitude(place.getLatLng().latitude); businessLocation.setLongitude(place.getLatLng().longitude); editTextLocationAddress.setText(businessLocation.getAddress()); } } } @Override public void onBackPressed() { finish(); } }
da7fb0e5f97b61e88ee00f11e7ed6c3203616101
af6dc32485bc2a89b5f86c1ce7a34fedd1d06fe1
/app/src/main/java/com/sundeepnarang/myfirstapp/Hum.java
ac2d6be2502f67bf611dcf496f29166010a48cab
[]
no_license
sundeepnarang/MyFirstApp
77374d49ff12147ea1ab01f2a2d41f534cf3f555
0eea5643d9146e91350396c8893005cdd9316169
refs/heads/master
2020-05-18T09:23:18.469806
2015-08-27T01:43:38
2015-08-27T01:43:38
41,459,229
0
0
null
null
null
null
UTF-8
Java
false
false
1,119
java
package com.sundeepnarang.myfirstapp; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class Hum extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_hum); } /* @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_hum, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }*/ }
01d2c3272057453ba93c9b925d7a4f31c6a57f9c
fa63fa8fea6dfd24f369d69f39f322f78143077c
/mall-ware/src/main/java/com/scut/mall/ware/entity/WareOrderTaskDetailEntity.java
69e0a76c804d1f99a4b0132db929486ac70da2dd
[]
no_license
laizikeng/mall
4741f36ba872a673210c1f75b2da8abe2e505083
70f1ead689b4101f3e796438d8200285d0b32fcf
refs/heads/main
2023-07-05T02:36:05.184978
2021-08-21T02:42:33
2021-08-21T02:42:33
387,080,581
0
0
null
null
null
null
UTF-8
Java
false
false
843
java
package com.scut.mall.ware.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import lombok.Data; /** * 库存工作单 * * @author lzk * @email [email protected] * @date 2021-08-05 15:09:33 */ @Data @TableName("wms_ware_order_task_detail") public class WareOrderTaskDetailEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private Long id; /** * sku_id */ private Long skuId; /** * sku_name */ private String skuName; /** * 购买个数 */ private Integer skuNum; /** * 工作单id */ private Long taskId; /** * 仓库id */ private Long wareId; /** * 1-已锁定 2-已解锁 3-扣减 */ private Integer lockStatus; }
c9fac3d37fc9ae4a7e2125953c92f0017fdb42b5
a4fbaba4bc6d2b6ba8922aa52765e6f4a9689245
/app/src/main/java/com/rharshit/stocker/base/widgets/IncludeExtendedFloatingActionButton.java
1cb278a15d5876a926e37100727b809e747d874d
[]
no_license
rharshit/StockerApp
3e53dcf315eea1a937824bf9e1618b081320780d
8a47fa72acda0bbdbf51c696b2d7accf2f35552a
refs/heads/master
2023-02-06T12:21:46.356435
2021-01-01T11:40:10
2021-01-01T11:40:10
313,230,973
0
0
null
2021-01-01T11:40:11
2020-11-16T08:08:00
Java
UTF-8
Java
false
false
264
java
package com.rharshit.stocker.base.widgets; import android.view.View; public interface IncludeExtendedFloatingActionButton { boolean isExtendedFabRequired(); void onExtendedFabClickListener(View v); boolean onExtendedFabLongClickListener(View v); }
01e718bce28e6d78bbba8084348af100e767913f
a0fe0337f1c7534dc58d77e44b716a85eb0f1fd2
/src/test/java/org/hsqldb/TestOdbcTypes.java
3a702a461305871785c255ce1442084fa0437136
[]
no_license
sluk3r/hsqldbSrc
124f7c0b6d88fc5e0b65adcae5bfe1f80cbe8fc5
541d8933fdf616c49e52112ab42ec7bc6f0259de
refs/heads/master
2016-09-06T16:24:51.902115
2014-07-15T01:11:38
2014-07-15T01:11:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
64,326
java
/* Copyright (c) 2001-2011, The HSQL Development Group * 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 HSQL Development Group 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 HSQL DEVELOPMENT GROUP, HSQLDB.ORG, * 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.hsqldb; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.Time; import java.sql.Timestamp; /** * See AbstractTestOdbc for more general ODBC hsqldb information. * * @see AbstractTestOdbc */ public class TestOdbcTypes extends AbstractTestOdbc { /* HyperSQL types to be tested: * * Exact Numeric * TINYINT * SMALLINT * INTEGER * BIGINT * NUMERIC(p?,s?) = DECIMAL() (default for decimal literals) * Approximate Numeric * FLOAT(p?) * DOUBLE = REAL (default for literals with exponent) * BOOLEAN * Character Strings * CHARACTER(1l)* = CHAR() * CHARACTER VARYING(1l) = VARCHAR() = LONGVARCHAR() * CLOB(1l) = CHARACTER LARGE OBJECT(1) * Binary Strings * BINARY(1l)* * BINARY VARYING(1l) = VARBINARY() * BLOB(1l) = BINARY LARGE OBJECT() * Bits * BIT(1l) * BIT VARYING(1l) * OTHER (for holding serialized Java objects) * Date/Times * DATE * TIME(p?,p?) * TIMESTAMP(p?,p?) * INTERVAL...(p2,p0) */ public TestOdbcTypes() {} /** * Accommodate JUnit's hsqldb-runner conventions. */ public TestOdbcTypes(String s) { super(s); } protected void populate(Statement st) throws SQLException { st.executeUpdate("DROP TABLE alltypes IF EXISTS"); st.executeUpdate("CREATE TABLE alltypes (\n" + " id INTEGER,\n" + " ti TINYINT,\n" + " si SMALLINT,\n" + " i INTEGER,\n" + " bi BIGINT,\n" + " n NUMERIC(5,2),\n" + " f FLOAT(5),\n" + " r DOUBLE,\n" + " b BOOLEAN,\n" + " c CHARACTER(3),\n" + " cv CHARACTER VARYING(3),\n" + " bt BIT(9),\n" + " btv BIT VARYING(3),\n" + " d DATE,\n" + " t TIME(2),\n" + " tw TIME(2) WITH TIME ZONE,\n" + " ts TIMESTAMP(2),\n" + " tsw TIMESTAMP(2) WITH TIME ZONE,\n" + " bin BINARY(4),\n" + " vb VARBINARY(4),\n" + " dsival INTERVAL DAY(5) TO SECOND(6),\n" + " sival INTERVAL SECOND(6,4)\n" + ')'); /** TODO: This hsqldb class can't handle testing unlmited VARCHAR, since * we set up with strict size setting, which prohibits unlimited * VARCHARs. Need to write a standalone hsqldb class to hsqldb that. */ // Would be more elegant and efficient to use a prepared statement // here, but our we want this setup to be as simple as possible, and // leave feature testing for the actual unit tests. st.executeUpdate("INSERT INTO alltypes VALUES (\n" + " 1, 3, 4, 5, 6, 7.8, 8.9, 9.7, true, 'ab', 'cd',\n" + " b'10', b'10', current_date, '13:14:00',\n" + " '15:16:00', '2009-02-09 16:17:18', '2009-02-09 17:18:19',\n" + " x'A103', x'A103', " + "INTERVAL '145 23:12:19.345' DAY TO SECOND,\n" + " INTERVAL '1000.345' SECOND\n" + ')' ); st.executeUpdate("INSERT INTO alltypes VALUES (\n" + " 2, 3, 4, 5, 6, 7.8, 8.9, 9.7, true, 'ab', 'cd',\n" + " b'10', b'10', current_date, '13:14:00',\n" + " '15:16:00', '2009-02-09 16:17:18', '2009-02-09 17:18:19',\n" + " x'A103', x'A103', " + " INTERVAL '145 23:12:19.345' DAY TO SECOND,\n" + " INTERVAL '1000.345' SECOND\n" + ')' ); } public void testIntegerSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Integer.class, rs.getObject("i").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(5, rs.getInt("i")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testTinyIntSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Integer.class, rs.getObject("ti").getClass()); // Nb. HyperSQL purposefully returns an Integer for this type assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals((byte) 3, rs.getByte("ti")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testSmallIntSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Integer.class, rs.getObject("si").getClass()); // Nb. HyperSQL purposefully returns an Integer for this type assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals((short) 4, rs.getShort("si")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBigIntSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Long.class, rs.getObject("bi").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(6, rs.getLong("bi")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } /* public void testNumericSimpleRead() { // This is failing. // Looks like we inherited a real bug with numerics from psqlodbc, // because the problem exists with Postresql-supplied psqlodbc // connecting to a Postgresql server. ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(BigDecimal.class, rs.getObject("n").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(new BigDecimal(7.8), rs.getBigDecimal("n")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } */ public void testFloatSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Double.class, rs.getObject("f").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(8.9D, rs.getDouble("f"), 0D); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testDoubleSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Double.class, rs.getObject("r").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(9.7D, rs.getDouble("r"), 0D); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBooleanSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Boolean.class, rs.getObject("b").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertTrue(rs.getBoolean("b")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testCharSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(String.class, rs.getObject("c").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("ab ", rs.getString("c")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testVarCharSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(String.class, rs.getObject("cv").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("cd", rs.getString("cv")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testFixedStringSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT i, 'fixed str' fs, cv\n" + "FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(String.class, rs.getObject("fs").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("fixed str", rs.getString("fs")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testDerivedStringSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT i, cv || 'appendage' app, 4\n" + "FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(String.class, rs.getObject("app").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("cdappendage", rs.getString("app")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testDateSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(java.sql.Date.class, rs.getObject("d").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals( new java.sql.Date(new java.util.Date().getTime()).toString(), rs.getDate("d").toString()); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testTimeSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(java.sql.Time.class, rs.getObject("t").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(Time.valueOf("13:14:00"), rs.getTime("t")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } /* public void testTimeWSimpleRead() { // This hsqldb is failing because the JDBC Driver is returning a // String instead of a Time oject for rs.getTime(). ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(java.sql.Time.class, rs.getObject("tw").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(Time.valueOf("15:16:00"), rs.getTime("tw")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } */ public void testTimestampSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Timestamp.class, rs.getObject("ts").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(Timestamp.valueOf("2009-02-09 16:17:18"), rs.getTimestamp("ts")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testTimestampWSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals(Timestamp.class, rs.getObject("tsw").getClass()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals(Timestamp.valueOf("2009-02-09 17:18:19"), rs.getTimestamp("tsw")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBitSimpleRead() { // This hsqldb is failing because of a BIT padding bug in the engine. ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("100000000", rs.getString("bt")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBitVaryingSimpleRead() { ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertTrue("Got only one row with id in (1, 2)", rs.next()); assertEquals("10", rs.getString("btv")); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testBinarySimpleRead() { ResultSet rs = null; Statement st = null; byte[] expectedBytes = new byte[] { (byte) 0xa1, (byte) 0x03, (byte) 0, (byte) 0 }; byte[] ba; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals("A1030000", rs.getString("bin")); assertTrue("Got only one row with id in (1, 2)", rs.next()); ba = rs.getBytes("bin"); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } assertEquals("Retrieved bye array length wrong", expectedBytes.length, ba.length); for (int i = 0; i < ba.length; i++) { assertEquals("Byte " + i + " wrong", expectedBytes[i], ba[i]); } } public void testVarBinarySimpleRead() { ResultSet rs = null; Statement st = null; byte[] expectedBytes = new byte[] { (byte) 0xa1, (byte) 0x03 }; byte[] ba; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals("A103", rs.getString("vb")); assertTrue("Got only one row with id in (1, 2)", rs.next()); ba = rs.getBytes("vb"); assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } assertEquals("Retrieved bye array length wrong", expectedBytes.length, ba.length); for (int i = 0; i < ba.length; i++) { assertEquals("Byte " + i + " wrong", expectedBytes[i], ba[i]); } } public void testDaySecIntervalSimpleRead() { /* Since our client does not support the INTERVAL precision * constraints, the returned value will always be toString()'d to * precision of microseconds. */ ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals("145 23:12:19.345000", rs.getString("dsival")); assertTrue("Got only one row with id in (1, 2)", rs.next()); // Can't hsqldb the class, because jdbc:odbc or the driver returns // a String for getObject() for interval values. assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testSecIntervalSimpleRead() { /* Since our client does not support the INTERVAL precision * constraints, the returned value will always be toString()'d to * precision of microseconds. */ ResultSet rs = null; Statement st = null; try { st = netConn.createStatement(); rs = st.executeQuery("SELECT * FROM alltypes WHERE id in (1, 2)"); assertTrue("Got no rows with id in (1, 2)", rs.next()); assertEquals("1000.345000", rs.getString("sival")); assertTrue("Got only one row with id in (1, 2)", rs.next()); // Can't hsqldb the class, because jdbc:odbc or the driver returns // a String for getObject() for interval values. assertFalse("Got too many rows with id in (1, 2)", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } } catch(Exception e) { } } } public void testIntegerComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, i) VALUES(?, ?)"); ps.setInt(1, 3); ps.setInt(2, 495); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE i = ?"); ps.setInt(1, 495); rs = ps.executeQuery(); assertTrue("Got no rows with i = 495", rs.next()); assertEquals(Integer.class, rs.getObject("i").getClass()); assertTrue("Got only one row with i = 495", rs.next()); assertEquals(495, rs.getInt("i")); assertFalse("Got too many rows with i = 495", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testTinyIntComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, ti) VALUES(?, ?)"); ps.setInt(1, 3); ps.setByte(2, (byte) 200); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE ti = ?"); ps.setByte(1, (byte) 200); rs = ps.executeQuery(); assertTrue("Got no rows with ti = 200", rs.next()); assertEquals(Integer.class, rs.getObject("ti").getClass()); assertTrue("Got only one row with ti = 200", rs.next()); assertEquals((byte) 200, rs.getByte("ti")); assertFalse("Got too many rows with ti = 200", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testSmallIntComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, si) VALUES(?, ?)"); ps.setInt(1, 3); ps.setShort(2, (short) 395); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE si = ?"); ps.setShort(1, (short) 395); rs = ps.executeQuery(); assertTrue("Got no rows with si = 395", rs.next()); assertEquals(Integer.class, rs.getObject("si").getClass()); // Nb. HyperSQL purposefully returns an Integer for this type assertTrue("Got only one row with si = 395", rs.next()); assertEquals((short) 395, rs.getShort("si")); assertFalse("Got too many rows with si = 395", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testBigIntComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, bi) VALUES(?, ?)"); ps.setInt(1, 3); ps.setLong(2, 295L); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE bi = ?"); ps.setLong(1, 295L); rs = ps.executeQuery(); assertTrue("Got no rows with bi = 295L", rs.next()); assertEquals(Long.class, rs.getObject("bi").getClass()); assertTrue("Got only one row with bi = 295L", rs.next()); assertEquals(295L, rs.getLong("bi")); assertFalse("Got too many rows with bi = 295L", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } /* TODO: Implement this hsqldb after get testNumericSimpleRead() working. * See that method above. public void testNumericComplex() { */ public void testFloatComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, f) VALUES(?, ?)"); ps.setInt(1, 3); ps.setFloat(2, 98.765F); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE f = ?"); ps.setFloat(1, 98.765F); rs = ps.executeQuery(); assertTrue("Got no rows with f = 98.765F", rs.next()); assertEquals(Double.class, rs.getObject("f").getClass()); assertTrue("Got only one row with f = 98.765F", rs.next()); assertEquals(98.765D, rs.getDouble("f"), .01D); assertFalse("Got too many rows with f = 98.765F", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testDoubleComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, r) VALUES(?, ?)"); ps.setInt(1, 3); ps.setDouble(2, 876.54D); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE r = ?"); ps.setDouble(1, 876.54D); rs = ps.executeQuery(); assertTrue("Got no rows with r = 876.54D", rs.next()); assertEquals(Double.class, rs.getObject("r").getClass()); assertTrue("Got only one row with r = 876.54D", rs.next()); assertEquals(876.54D, rs.getDouble("r"), 0D); assertFalse("Got too many rows with r = 876.54D", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testBooleanComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, b) VALUES(?, ?)"); ps.setInt(1, 3); ps.setBoolean(2, false); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE b = ?"); ps.setBoolean(1, false); rs = ps.executeQuery(); assertTrue("Got no rows with b = false", rs.next()); assertEquals(Boolean.class, rs.getObject("b").getClass()); assertTrue("Got only one row with b = false", rs.next()); assertEquals(false, rs.getBoolean("b")); assertFalse("Got too many rows with b = false", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testCharComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, c) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, "xy"); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE c = ?"); ps.setString(1, "xy "); rs = ps.executeQuery(); assertTrue("Got no rows with c = 'xy '", rs.next()); assertEquals(String.class, rs.getObject("c").getClass()); assertTrue("Got only one row with c = 'xy '", rs.next()); assertEquals("xy ", rs.getString("c")); assertFalse("Got too many rows with c = 'xy '", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testVarCharComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, cv) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, "xy"); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE cv = ?"); ps.setString(1, "xy"); rs = ps.executeQuery(); assertTrue("Got no rows with cv = 'xy'", rs.next()); assertEquals(String.class, rs.getObject("cv").getClass()); assertTrue("Got only one row with cv = 'xy'", rs.next()); assertEquals("xy", rs.getString("cv")); assertFalse("Got too many rows with cv = 'xy'", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } /** * TODO: Find out if there is a way to select based on an expression * using a named derived pseudo-column. public void testDerivedComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "SELECT id, cv || 'app' appendage FROM alltypes\n" + "WHERE appendage = ?"); ps.setString(1, "cvapp"); rs = ps.executeQuery(); assertTrue("Got no rows appendage = 'cvapp'", rs.next()); assertEquals(String.class, rs.getObject("r").getClass()); assertTrue("Got only one row with appendage = 'cvapp'", rs.next()); assertEquals("cvapp", rs.getString("r")); assertFalse("Got too many rows with appendage = 'cvapp'", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } */ public void testDateComplex() { PreparedStatement ps = null; ResultSet rs = null; java.sql.Date tomorrow = new java.sql.Date(new java.util.Date().getTime() + 1000 * 60 * 60 * 24); try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, d) VALUES(?, ?)"); ps.setInt(1, 3); ps.setDate(2, tomorrow); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE d = ?"); ps.setDate(1, tomorrow); rs = ps.executeQuery(); assertTrue("Got no rows with d = tomorrow", rs.next()); assertEquals(java.sql.Date.class, rs.getObject("d").getClass()); assertTrue("Got only one row with d = tomorrow", rs.next()); assertEquals(tomorrow.toString(), rs.getDate("d").toString()); // Compare the Strings since "tomorrow" has resolution to // millisecond, but getDate() is probably to the day. assertFalse("Got too many rows with d = tomorrow", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testTimeComplex() { PreparedStatement ps = null; ResultSet rs = null; Time aTime = Time.valueOf("21:19:27"); try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, t) VALUES(?, ?)"); ps.setInt(1, 3); ps.setTime(2, aTime); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE t = ?"); ps.setTime(1, aTime); rs = ps.executeQuery(); assertTrue("Got no rows with t = aTime", rs.next()); assertEquals(Time.class, rs.getObject("t").getClass()); assertTrue("Got only one row with t = aTime", rs.next()); assertEquals(aTime, rs.getTime("t")); assertFalse("Got too many rows with t = aTime", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } /* TODO: Implement this hsqldb after get testTimeWSimpleRead() working. * See that method above. public void testTimeWComplex() { */ public void testTimestampComplex() { PreparedStatement ps = null; ResultSet rs = null; Timestamp aTimestamp = Timestamp.valueOf("2009-03-27 17:18:19"); try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, ts) VALUES(?, ?)"); ps.setInt(1, 3); ps.setTimestamp(2, aTimestamp); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE ts = ?"); ps.setTimestamp(1, aTimestamp); rs = ps.executeQuery(); assertTrue("Got no rows with ts = aTimestamp", rs.next()); assertEquals(Timestamp.class, rs.getObject("ts").getClass()); assertTrue("Got only one row with ts = aTimestamp", rs.next()); assertEquals(aTimestamp, rs.getTimestamp("ts")); assertFalse("Got too many rows with ts = aTimestamp", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testTimestampWComplex() { PreparedStatement ps = null; ResultSet rs = null; Timestamp aTimestamp = Timestamp.valueOf("2009-03-27 17:18:19"); try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, tsw) VALUES(?, ?)"); ps.setInt(1, 3); ps.setTimestamp(2, aTimestamp); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE tsw = ?"); ps.setTimestamp(1, aTimestamp); rs = ps.executeQuery(); assertTrue("Got no rows with tsw = aTimestamp", rs.next()); assertEquals(Timestamp.class, rs.getObject("tsw").getClass()); assertTrue("Got only one row with tsw = aTimestamp", rs.next()); assertEquals(aTimestamp, rs.getTimestamp("tsw")); assertFalse("Got too many rows with tsw = aTimestamp", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } /* * Driver needs to be modified to transfer bits in byte (binary) fashion, * the same as is done for VARBINARY/bytea type. public void testBitComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, bt) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, "101"); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE bt = ?"); ps.setString(1, "101"); rs = ps.executeQuery(); assertTrue("Got no rows with bt = 101", rs.next()); assertEquals(String.class, rs.getObject("bt").getClass()); assertTrue("Got only one row with bt = 101", rs.next()); assertEquals("101000000", rs.getString("bt")); assertFalse("Got too many rows with bt = 101", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testBitVaryingComplex() { PreparedStatement ps = null; ResultSet rs = null; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, btv) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, "10101"); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE btv = ?"); ps.setString(1, "10101"); rs = ps.executeQuery(); assertTrue("Got no rows with btv = 10101", rs.next()); assertEquals(String.class, rs.getObject("btv").getClass()); assertTrue("Got only one row with btv = 10101", rs.next()); assertEquals("10101", rs.getString("btv")); assertFalse("Got too many rows with btv = 10101", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } */ public void testBinaryComplex() { PreparedStatement ps = null; ResultSet rs = null; byte[] expectedBytes = new byte[] { (byte) 0xaa, (byte) 0x99, (byte) 0, (byte) 0 }; byte[] ba1, ba2; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, bin) VALUES(?, ?)"); ps.setInt(1, 3); ps.setBytes(2, expectedBytes); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE bin = ?"); ps.setBytes(1, expectedBytes); rs = ps.executeQuery(); assertTrue("Got no rows with bin = b'AA99'", rs.next()); ba1 = rs.getBytes("bin"); assertTrue("Got only one row with bin = b'AA99'", rs.next()); ba2 = rs.getBytes("bin"); assertFalse("Got too many rows with bin = b'AA99'", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } assertEquals("Retrieved bye array length wrong (1)", expectedBytes.length, ba1.length); for (int i = 0; i < ba1.length; i++) { assertEquals("Byte " + i + " wrong (1)", expectedBytes[i], ba1[i]); } assertEquals("Retrieved bye array length wrong (2)", expectedBytes.length, ba2.length); for (int i = 0; i < ba2.length; i++) { assertEquals("Byte " + i + " wrong (2)", expectedBytes[i], ba2[i]); } } public void testVarBinaryComplex() { PreparedStatement ps = null; ResultSet rs = null; byte[] expectedBytes = new byte[] { (byte) 0xaa, (byte) 0x99 }; byte[] ba1, ba2; try { ps = netConn.prepareStatement( "INSERT INTO alltypes(id, vb) VALUES(?, ?)"); ps.setInt(1, 3); ps.setBytes(2, expectedBytes); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE vb = ?"); ps.setBytes(1, expectedBytes); rs = ps.executeQuery(); assertTrue("Got no rows with vb = b'AA99'", rs.next()); ba1 = rs.getBytes("vb"); assertTrue("Got only one row with vb = b'AA99'", rs.next()); ba2 = rs.getBytes("vb"); assertFalse("Got too many rows with vb = b'AA99'", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } assertEquals("Retrieved bye array length wrong (1)", expectedBytes.length, ba1.length); for (int i = 0; i < ba1.length; i++) { assertEquals("Byte " + i + " wrong (1)", expectedBytes[i], ba1[i]); } assertEquals("Retrieved bye array length wrong (2)", expectedBytes.length, ba2.length); for (int i = 0; i < ba2.length; i++) { assertEquals("Byte " + i + " wrong (2)", expectedBytes[i], ba2[i]); } } /* * TODO: Learn how to set input params for INTERVAL types. * I don't see how I could set the variant * (HOUR, ...TO SECOND, etc.) with setString() or anything else. public void testDaySecIntervalComplex() { PreparedStatement ps = null; ResultSet rs = null; try { assertEquals("145 23:12:19.345000", rs.getString("dsival")); ps = netConn.prepareStatement( "INSERT INTO alltypes(id, dsival) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, 876.54D); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE dsival = ?"); ps.setString(1, 876.54D); rs = ps.executeQuery(); assertTrue("Got no rows with dsival = 876.54D", rs.next()); assertEquals(String.class, rs.getObject("dsival").getClass()); assertTrue("Got only one row with dsival = 876.54D", rs.next()); assertEquals(876.54D, rs.getString("dsival")); assertFalse("Got too many rows with dsival = 876.54D", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } public void testSecIntervalComplex() { PreparedStatement ps = null; ResultSet rs = null; try { assertEquals("1000.345000", rs.getString("sival")); ps = netConn.prepareStatement( "INSERT INTO alltypes(id, sival) VALUES(?, ?)"); ps.setInt(1, 3); ps.setString(2, 876.54D); assertEquals(1, ps.executeUpdate()); ps.setInt(1, 4); assertEquals(1, ps.executeUpdate()); ps.close(); netConn.commit(); ps = netConn.prepareStatement( "SELECT * FROM alltypes WHERE sival = ?"); ps.setString(1, 876.54D); rs = ps.executeQuery(); assertTrue("Got no rows with sival = 876.54D", rs.next()); assertEquals(String.class, rs.getObject("sival").getClass()); assertTrue("Got only one row with sival = 876.54D", rs.next()); assertEquals(876.54D, rs.getString("sival")); assertFalse("Got too many rows with sival = 876.54D", rs.next()); } catch (SQLException se) { junit.framework.AssertionFailedError ase = new junit.framework.AssertionFailedError(se.getMessage()); ase.initCause(se); throw ase; } finally { try { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } catch(Exception e) { } } } */ public static void main(String[] sa) { staticRunner(TestOdbcTypes.class, sa); } /* static protected boolean closeEnough(Time t1, Time t2, int fudgeMin) { long delta = t1.getTime() - t2.getTime(); if (delta < 0) { delta *= -1; } //System.err.println("Delta " + delta); //System.err.println("exp " + (fudgeMin * 1000 * 60)); return delta < fudgeMin * 1000 * 60; } */ }
13303dffeb861aea77613510ae7d6d55bcb955ff
fe86674d19d06e1d71d3369e0a9bb9d8f6637993
/app/src/main/java/com/example/windows/plink/ForgotPasswordActivity.java
0ae9c5e596b8b95a0f148672d3859c8359ff6c4a
[]
no_license
gopalkrisshna/Plink
029768336e7d74cae3c498cd3e141c7cb488b443
111fbf526f2e1f0184464304dc18e401949b801f
refs/heads/master
2021-05-06T03:39:37.100340
2017-12-20T16:00:44
2017-12-20T16:00:44
114,903,470
0
0
null
null
null
null
UTF-8
Java
false
false
3,951
java
package com.example.windows.plink; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.Toast; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import java.io.IOException; import java.io.UnsupportedEncodingException; public class ForgotPasswordActivity extends AppCompatActivity { EditText txtmob; String ip, mob; ProgressDialog progressDialog; @Override protected void onCreate(Bundle savedInstanceState) { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); super.onCreate(savedInstanceState); setContentView(R.layout.activity_forgot_password); //ipc mechanism getting data from login activity Bundle extras = getIntent().getExtras(); if (extras != null) { ip = extras.getString("ip"); } txtmob = (EditText) findViewById(R.id.fmobile); //creating progress dialog progressDialog = new ProgressDialog(ForgotPasswordActivity.this); progressDialog.setMessage("Please wait..."); progressDialog.setTitle("Forgot Password"); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setCancelable(false); } //called when button pressed //construct the url and call network task public void forget_pass(View view) { mob = txtmob.getText().toString().trim(); if (mob.equals("")) { Toast.makeText(getApplicationContext(), "Please enter registered mobile number", Toast.LENGTH_SHORT).show(); return; } String URL = ip + "/location/getpass.php?mobile=" + mob; URL = URL.trim(); System.out.println(URL); GetXMLTask task = new GetXMLTask(); task.execute(new String[]{URL}); } //network task performed private class GetXMLTask extends AsyncTask<String, Void, String> { //show progress dialog @Override protected void onPreExecute() { super.onPreExecute(); progressDialog.show(); } //perform network operations in background @Override protected String doInBackground(String... urls) { String output = null; for (String url : urls) { output = getOutputFromUrl(url); } return output; } private String getOutputFromUrl(String url) { String output = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); output = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return output; } //read the response @Override protected void onPostExecute(String output) { progressDialog.dismiss(); if (output != null) { output = output.trim(); Toast.makeText(getApplicationContext(), output, Toast.LENGTH_LONG).show(); } else Toast.makeText(getApplicationContext(), "Please try again...", Toast.LENGTH_LONG).show(); } } }
25360dcb6dfacdd1784f28637439cd68c94018c0
66237afc455789e4f6352dcfd40d9f114bb7bad7
/basearchcomponents/src/main/java/com/tanveershafeeprottoy/basearchcomponents/viewmodels/BaseAndroidViewModel.java
d5613f6429ea2407f429459fcf799f808f31de5c
[]
no_license
tanveerprottoy/base-arch-components
4f966862a9c22500ffcad0e69950f6e935fea3b3
87401d237ed7fd5329c9c19f707dd73a6858a146
refs/heads/master
2020-04-08T00:19:19.843975
2019-01-10T10:20:09
2019-01-10T10:20:09
158,847,326
0
0
null
null
null
null
UTF-8
Java
false
false
636
java
package com.tanveershafeeprottoy.basearchcomponents.viewmodels; import android.app.Application; import com.tanveershafeeprottoy.basearchcomponents.livedata.SingleLiveEvent; import androidx.lifecycle.AndroidViewModel; /** * @author Tanveer Shafee Prottoy */ public abstract class BaseAndroidViewModel extends AndroidViewModel { protected SingleLiveEvent<Throwable> throwableSingleLiveEvent = new SingleLiveEvent<>(); public BaseAndroidViewModel(Application application) { super(application); } protected void throwError(Throwable throwable) { throwableSingleLiveEvent.setValue(throwable); } }
5dd876a0bd92e509959dd36c3729c5a39cb2e529
ce85f1a02ee0528e9c48b9a43015c745d219fb82
/InnowhiteRed5/src/com/innowhite/red5/audio/events/UnknownConferenceEvent.java
73013a33f5f5e584ccda1f28c85f2fcbcf30849c
[]
no_license
firemonk9/innowhite-server
36495e11eced76f9217f726ddcb91a2305eadb8c
e9281f02e98e299b0229ef3d5e14ec090e7d1174
refs/heads/master
2020-12-24T15:58:12.003036
2012-09-13T04:37:03
2012-09-13T04:37:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,116
java
/** * ===License Header=== * * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ * * Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below). * * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free Software * Foundation; either version 2.1 of the License, or (at your option) any later * version. * * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. * * ===License Header=== */ package com.innowhite.red5.audio.events; public class UnknownConferenceEvent extends ConferenceEvent { public UnknownConferenceEvent(String participantId, String room) { super(participantId, room); } }
1981377b3d4235fcd35171b80c59c5b365d5f824
ba9ee6fa06ab929eb236cf324dca196bc082c0e9
/src/api/java/com/heisenbugdev/heisenui/api/view/ICharacterView.java
608e118fca11f629884bf98bc708e84765623604
[ "MIT" ]
permissive
HeisenBugDev/Project-U
5ba250e7024104a173daf12eb4f854cfb333488d
8e29c1286e109e21f6b28a15f5e11fb1f049c08f
refs/heads/master
2016-09-06T10:38:27.655684
2014-05-18T09:03:49
2014-05-18T09:03:49
19,553,702
1
1
null
null
null
null
UTF-8
Java
false
false
213
java
package com.heisenbugdev.heisenui.api.view; import net.minecraft.entity.player.EntityPlayer; public interface ICharacterView { public EntityPlayer player(); public void setPlayer(EntityPlayer player); }
db8d56030f4da2def3937dcffbfe2f83292478cc
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE563_Unused_Variable/CWE563_Unused_Variable__unused_public_member_variable_01_good1.java
27f264990306bc3f9765c61e46f47b303eca3e52
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
939
java
/* * @description Unused public class member variable * * */ package testcases.CWE563_Unused_Variable; import testcasesupport.*; public class CWE563_Unused_Variable__unused_public_member_variable_01_good1 extends AbstractTestCaseClassIssueGood { public int intGood1 = 0; private void good1() { /* FIX: Use intGood1 */ IO.writeLine("" + intGood1); } public void good() { good1(); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
2b8902345a9ab9be7a17215021d0d2097aafe150
fd937dd0376e58ce06fa9c2dac68f36f8f439b74
/TrabajoEnClase7/Facultad.java
4ef5c1ac0272e76c9db14064c16b6d17e96fc1c5
[]
no_license
andresrousseau/LabComputacionII
203c04b01ac70f35d07bec0f542c6c3bb6e273a5
c22dbb682f667bc93fff5da54f872530e2edc8f4
refs/heads/master
2020-07-19T10:30:19.557383
2019-12-06T20:36:37
2019-12-06T20:36:37
203,884,069
0
0
null
null
null
null
UTF-8
Java
false
false
2,446
java
package TrabajoEnClase7; import java.util.Scanner; public class Facultad { private String nColegio; private int cantEstudiantes; private Estudiante[] estudiantes; private static int EstudianteActual=0; public Facultad(String nColegio, int cantEstudiantes){ this.nColegio=nColegio; this.cantEstudiantes=cantEstudiantes; this.estudiantes=new Estudiante[cantEstudiantes]; } public void agregarEstudiante(){ Scanner sc=new Scanner(System.in); if (EstudianteActual<cantEstudiantes){ System.out.println("Ingrese el nombre del estudiante"); String nombre=sc.next(); System.out.println("Ingrese nota media del estudiante"); Double nota=sc.nextDouble(); estudiantes[EstudianteActual]=new Estudiante(nombre,nota); EstudianteActual++; } else{ System.out.println("No hay mas cupo en la facultad."); } } public void listarEstudiantes(){ for (int x=0;x<EstudianteActual;x++){ System.out.println(estudiantes[x].getInfo()); } System.out.println(); } public void buscarEstudiante (String nomEstudiante) { for (int x=0;x<EstudianteActual;x++) { if ((estudiantes[x].getNomEstudiante()).equals (nomEstudiante)) { System.out.println(estudiantes[x].getInfo()); return; } } System.out.println("No se encontro el estudiante solicitado"); } public void borrarEstudiante (String nomEstudiante) { int comp=0; for (int x=0;x<EstudianteActual;x++) { if ((estudiantes[x].getNomEstudiante()).equals (nomEstudiante)) { for (int y=x;y<EstudianteActual-1;y++) { estudiantes[y]=estudiantes[y+1]; } EstudianteActual--; comp=1; } } if (comp!=1){ System.out.println("No se encontro el estudiante solicitado"); } } public void modificarNota (String nomEstudiante, double nota) { for (int x=0;x<EstudianteActual;x++) { if ((estudiantes[x].getNomEstudiante()).equals (nomEstudiante)) { estudiantes[x].setNotaMedia(nota); System.out.println(estudiantes[x].getInfo()); return; } } System.out.println("No se encontro el estudiante solicitado"); } }
8e5c17447d05832b2725015f7772a4763654df90
2324fd02d5cc25d80853c329139251145599abb1
/app/src/main/java/com/kickstarter/ui/adapters/RewardsItemAdapter.java
9e86e08a5bb4e9baf80ad73e9b91ec510a85ed94
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "ICU", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-facebook-software-license", "EPL-1.0", "MIT" ]
permissive
appspector/android-oss
4554deffd08924636c4a856bc9f5afa3bd10bae3
3fc542d10a32416338b66ea5e6ac5b8144e5bc2f
refs/heads/master
2020-03-15T12:56:18.640415
2018-05-15T11:25:54
2018-05-15T11:25:54
132,154,951
1
1
Apache-2.0
2018-05-24T14:30:59
2018-05-04T15:04:54
Java
UTF-8
Java
false
false
958
java
package com.kickstarter.ui.adapters; import android.support.annotation.LayoutRes; import android.support.annotation.NonNull; import android.view.View; import com.kickstarter.R; import com.kickstarter.models.RewardsItem; import com.kickstarter.ui.viewholders.KSViewHolder; import com.kickstarter.ui.viewholders.RewardsItemViewHolder; import java.util.List; import static java.util.Collections.emptyList; public final class RewardsItemAdapter extends KSAdapter { public RewardsItemAdapter() { addSection(emptyList()); } public void rewardsItems(final @NonNull List<RewardsItem> rewardsItems) { setSection(0, rewardsItems); notifyDataSetChanged(); } @Override protected int layout(final @NonNull SectionRow sectionRow) { return R.layout.rewards_item_view; } @Override protected @NonNull KSViewHolder viewHolder(final @LayoutRes int layout, final @NonNull View view) { return new RewardsItemViewHolder(view); } }
d5f79674f8a43002d510dd9c8c20720c9f6ded73
550b556e18ffb58e3e55fa8fd2fa5f5331fd8aea
/03_java_array_advance/src/step3_01/arrayAdvance1/ArrayEx26_정답2.java
1935833752e745b20c08efb67cbdd465ec3e93a1
[]
no_license
sojin612/sojin612magait03
a93303f8a3f149308857cc929be1aa5094e2b8e5
7a9e5e0311c487bc0dc57b9a709e11ee2e8400f7
refs/heads/master
2023-02-27T16:49:19.291184
2021-02-09T05:52:41
2021-02-09T05:52:41
325,923,238
0
0
null
null
null
null
UTF-8
Java
false
false
648
java
package step3_01.arrayAdvance1; import java.util.Random; import java.util.Scanner; /* * # 1 to 50[3단계] : 1 to 18 * 1. 구글에서 1 to 50 이라고 검색한다. * 2. 1 to 50 순발력 게임을 선택해 게임을 실습해본다. * 3. 위 게임을 숫자범위를 좁혀 1 to 18로 직접 구현한다. * 4. 숫자 1~9는 front 배열에 저장하고, * 숫자 10~18은 back 배열에 저장한다. */ public class ArrayEx26_정답2 { public static void main(String[] args) { final int SIZE = 9; int[] front = new int[SIZE]; int[] back = new int[SIZE]; } }
[ "sojin kim@DESKTOP-15HF2TJ" ]
sojin kim@DESKTOP-15HF2TJ
6135ddd3b7fdeb7521a5fd6aebb86f0d31509ee9
8e9a5d2539e69e56b3fac2b0b68b4931a9fb78db
/com/creational/builderPattern/product/Sandwich.java
b14774f5f7e99d4fd16bd998cc92be653078823d
[]
no_license
mcdowesj/DesignPatterns_src
ff8df8c7699ecc6eac6159c53c79e4f8b448fb3d
2ea4c5bc47e46562704e10641d7c5e094ed5fd6e
refs/heads/master
2021-01-19T23:33:46.369596
2017-06-30T17:21:49
2017-06-30T17:23:12
88,999,435
0
0
null
null
null
null
UTF-8
Java
false
false
1,333
java
package com.creational.builderPattern.product; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** * This is our Product. */ public class Sandwich { private static Logger log = Logger.getLogger(Sandwich.class.getName()); public BreadType breadType; public boolean isToasted; public CheeseType cheeseType; public MeatType meatType; public boolean hasMustard; public boolean hasMayo; public List<String> vegetables; public void display(){ String nl = "\n"; StringBuilder message = new StringBuilder("Sandwich on " + breadType + " bread \n"); if(isToasted){ message.append("Toasted \n"); } if(hasMayo){ message.append("Has mayo \n"); } if(hasMustard){ message.append("Has mustard \n"); } message.append("Veggies: \n"); for(String veg : vegetables){ message.append(" - ").append(veg).append("\n"); } log.log(Level.INFO, message.toString()); } public enum MeatType{ Turkey, Ham, Chicken, Salami } public enum CheeseType { American, Swiss, Cheddar, Provolone } public enum BreadType{ White, Wheat } }
b70641c7c117f074adc5f39b233a4cd9c51bec76
8d4f7ab43b3883f25936f5b682399df279a0c367
/SS2012_VS_1_1/src/lagern/LagerPackage/exNotFoundHelper.java
afbde8a13407864ce61a2a966d9215d711514d43
[]
no_license
StiggyB/bernieundert
5cb4de8a0eeb9fd242e8661200ce1de40a16bb5a
7e3f180b79428bdd4bcc1d3b9f268143ba202063
refs/heads/master
2016-09-02T03:25:10.657834
2013-01-08T06:58:59
2013-01-08T06:58:59
32,143,925
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,398
java
package lagern.LagerPackage; /** * lagern/LagerPackage/exNotFoundHelper.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from lager.idl * Donnerstag, 29. März 2012 20:04 Uhr MESZ */ abstract public class exNotFoundHelper { private static String _id = "IDL:lagern/Lager/exNotFound:1.0"; public static void insert (org.omg.CORBA.Any a, lagern.LagerPackage.exNotFound that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); a.type (type ()); write (out, that); a.read_value (out.create_input_stream (), type ()); } public static lagern.LagerPackage.exNotFound extract (org.omg.CORBA.Any a) { return read (a.create_input_stream ()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { synchronized (org.omg.CORBA.TypeCode.class) { if (__typeCode == null) { if (__active) { return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); } __active = true; org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [1]; org.omg.CORBA.TypeCode _tcOf_members0 = null; _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); _members0[0] = new org.omg.CORBA.StructMember ( "s", _tcOf_members0, null); __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (lagern.LagerPackage.exNotFoundHelper.id (), "exNotFound", _members0); __active = false; } } } return __typeCode; } public static String id () { return _id; } public static lagern.LagerPackage.exNotFound read (org.omg.CORBA.portable.InputStream istream) { lagern.LagerPackage.exNotFound value = new lagern.LagerPackage.exNotFound (); // read and discard the repository ID istream.read_string (); value.s = istream.read_string (); return value; } public static void write (org.omg.CORBA.portable.OutputStream ostream, lagern.LagerPackage.exNotFound value) { // write the repository ID ostream.write_string (id ()); ostream.write_string (value.s); } }
[ "[email protected]@48955575-598b-d27f-7a68-2b204972dbf9" ]
[email protected]@48955575-598b-d27f-7a68-2b204972dbf9
8ce536e02d772b1045c9f0d9af2ecb0df0fd0837
29ec707b07e26a265242998fa208ea9a8ce56f1a
/elena/Exercitii/src/exercitii/Concatenare2VectoriEx15.java
340eb14e16b0d93b8bc33a5539180a6f9cbdbdee
[]
no_license
elenaanghel90/exercises
40023edebd235a2ea91b61332d8bdb371a7c8c99
61cda902fdb9f7c0cb9ba5abbecde77bae1f8f9f
refs/heads/master
2021-01-05T06:48:16.673926
2020-02-16T16:04:49
2020-02-16T16:04:49
240,919,318
0
0
null
2020-10-13T19:35:35
2020-02-16T15:54:07
Java
UTF-8
Java
false
false
710
java
package exercitii; import java.util.Arrays; public class Concatenare2VectoriEx15 { public static void main(String[] args) { int[] sir1 = {3, 5, 7, 9}; int[] sir2 = {3, 5, 7, 9, 7}; System.out.println("Vectorii concatenati sunt = " + Arrays.toString(concateneazaVectorii(sir1, sir2))); } public static int[] concateneazaVectorii(int[] sirX, int[] sirY) { int[] sirConcatenat = new int[sirX.length + sirY.length]; for (int i = 0; i < sirX.length; i++) { sirConcatenat[i] = sirX[i]; } for (int j = 0; j < sirY.length; j++) { sirConcatenat[j + sirX.length] = sirY[j]; } return sirConcatenat; } }
25952c9bdb528008de1432d1868965079b70f5e6
b1dcbeb3923071fe194dad74d3087c50790ec124
/VetorObjeto/ExemploMatris/src/Telinha/Tela.java
eb9880ca5d2981ae7e7ca40ef08328d8a24e840b
[]
no_license
lucasouza2/exerciciosJAVA
d0f41bf39ee81758168d72e946302627ca79a49c
4dc0e289e03918d4adfc1def1cba5583859846b0
refs/heads/master
2022-12-02T23:52:58.414447
2020-08-21T23:32:44
2020-08-21T23:32:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,862
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 Telinha; import Matris.Matriz; /** * * @author aluno */ public class Tela extends javax.swing.JFrame { Matriz matrix = new Matriz(); public Tela() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jTResultado = new javax.swing.JTextArea(); jBAmostrar = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jTResultado.setColumns(20); jTResultado.setRows(5); jScrollPane1.setViewportView(jTResultado); jBAmostrar.setText("Amostrar"); jBAmostrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBAmostrarActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jBAmostrar) .addContainerGap(11, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGap(38, 38, 38) .addComponent(jBAmostrar) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jBAmostrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAmostrarActionPerformed jTResultado.setText(matrix.getMat()); }//GEN-LAST:event_jBAmostrarActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Tela.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Tela().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jBAmostrar; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTResultado; // End of variables declaration//GEN-END:variables }
69b986e5c686358ed3521a8f1b9769198efa4467
f0591201f9e05a43ae063ec0f3f4b4915e2e4a59
/project-sysmgr-api/src/main/java/com/spirit/project/sysmgr/api/service/ServiceModuleService.java
50c4d70e8e4518d33dbd4412bcd70c330202aa00
[]
no_license
dante7qx/microservice-spirit
d7867237eb499bc4c5b83ad12650aaf658ea72f4
e6a2cd52ac44c12ea6d983430a801a3db43c0e8f
refs/heads/master
2021-01-22T22:20:39.295929
2017-08-08T02:03:56
2017-08-08T02:03:56
85,531,358
0
1
null
null
null
null
UTF-8
Java
false
false
563
java
package com.spirit.project.sysmgr.api.service; import java.util.List; import com.spirit.project.common.api.exception.SpiritAPIServiceException; import com.spirit.project.common.api.template.SpiritAbstractService; import com.spirit.project.sysmgr.api.dto.req.ServiceModuleReqDTO; import com.spirit.project.sysmgr.api.dto.resp.ServiceModuleRespDTO; public interface ServiceModuleService extends SpiritAbstractService<ServiceModuleReqDTO, ServiceModuleRespDTO> { public List<ServiceModuleRespDTO> findServiceModuleResps() throws SpiritAPIServiceException; }
ff65daf60f402a5b7c201c9d6bca3d1922627bdf
1796f63604392ebbe6dc5b7ecd389d6592e507f8
/fundementals4-4challange/src/main/java/com/example/fundementals4_4challange/ui/share/ShareViewModel.java
f41ba2d30cede24c17d563d10987ebb058aa205c
[]
no_license
Perham94/Android_Kursen
3976833f83c175dce9310da4eb966d8a31673075
0fb3492b39c086baa000a6c07f19b36393ec4fec
refs/heads/master
2020-07-29T02:26:27.582011
2019-10-12T12:30:07
2019-10-12T12:30:07
209,631,944
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
package com.example.fundementals4_4challange.ui.share; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; public class ShareViewModel extends ViewModel { private MutableLiveData<String> mText; public ShareViewModel() { mText = new MutableLiveData<>(); mText.setValue("This is share fragment"); } public LiveData<String> getText() { return mText; } }
19e4a9e010835aa8c7d52ba537b8d1e5fca5424b
c177738e2858637978501ad6140fb0aaca2b9096
/src/main/java/lk/ijse/spring/repo/RoleRepository.java
baa7e98cbb141ce44648cab62daa78dcc35127b5
[ "MIT" ]
permissive
GeethMalinda/BackEnd_Spring_Car_Rental_System
f5dd06e5e87b71eb8858189648a316e19b94f386
0d04ea42a3bbba8b0216f632097fc18044b4b8be
refs/heads/main
2023-02-06T17:24:31.638418
2021-01-02T08:34:06
2021-01-02T08:34:06
326,139,882
0
0
null
null
null
null
UTF-8
Java
false
false
229
java
//package lk.ijse.spring.repo; // //import lk.ijse.spring.entity.Role; //import org.springframework.data.jpa.repository.JpaRepository; // // // //public interface RoleRepository extends JpaRepository<Role, Long> { // //}
2d689412ef439f27459681f4964bd275fa37b232
236e1b0ce3a98653366bdfc7c6eebd3e936fc4a7
/src/main/java/com/inti/FirstSonarJenkinsProjectApplication.java
fd76ddc4439c242c35802b1c1d8bd3251af95bf5
[]
no_license
mathieuDevJava/firstSonarJenkinsProject
90e34cb0c7d28b6c37b97c4ba27de54df8254d4e
d7876d0cc58a2c6458491b496d309fcd493c60ff
refs/heads/master
2023-07-17T07:51:54.636792
2021-08-24T09:37:14
2021-08-24T09:37:14
399,398,618
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package com.inti; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class FirstSonarJenkinsProjectApplication { public static void main(String[] args) { SpringApplication.run(FirstSonarJenkinsProjectApplication.class, args); } }
988b5c384045e2e4d458a1352ce6268a61fc72f5
b8acd431174702c81d5edfff4bded41f3e67b3f5
/src/com/mavenjenkns/com/MavenJenkins.java
91b0e1e59581a52fcd30e0e17d4ec72c67b3f30f
[]
no_license
cnspraveen/MavenProject_into_Github
b0079f3e6d2af04e3f0c2a9e0025cb12f1fd220f
0198e6c793f751e090715772cbe1f00eb0a660bc
refs/heads/master
2020-04-03T00:05:03.167690
2016-08-13T13:21:59
2016-08-13T13:21:59
65,078,417
0
0
null
null
null
null
UTF-8
Java
false
false
1,539
java
package com.mavenjenkns.com; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Reporter; import org.testng.annotations.Test; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus; public class MavenJenkins { public ExtentReports e = new ExtentReports(".\\ExtentReport\\ExtentReport.html"); @Test(priority=1) public void MavenJenkinsMethod_Pass() { System.out.println("Hi"); ExtentTest t = e.startTest("MavenJenkinsMethod_Pass");// provide this method name itself WebDriver driver = new FirefoxDriver(); driver.get("https://www.google.com/"); Reporter.log("facebook login", true); Reporter.log("MavenJenkins integration", true); t.log(LogStatus.PASS, "Executing MavenJenkinsMethod successful"); //t.log(LogStatus.ERROR, "Error during execution"); t.log(LogStatus.INFO, "info of exexuting method"); e.endTest(t); } @Test(priority=2) public void MavenJenkinsMethod_Fail() { System.out.println("Bye"); WebDriver driver = new FirefoxDriver(); driver.get("https://www.google.com/"); Reporter.log("facebook login", true); Reporter.log("MavenJenkins integration", true); ExtentTest t = e.startTest("MavenJenkinsMethod_Fail");// provide this method name itself t.log(LogStatus.FAIL, "Executing MavenJenkinsMethod Fail"); e.endTest(t); e.flush(); } }
05a05327eabc5edd5013d914a0adbf0f0644b97e
446a56b68c88df8057e85f424dbac90896f05602
/core/cas-server-core-services-registry/src/test/java/org/apereo/cas/services/resource/DefaultRegisteredServiceResourceNamingStrategyTests.java
28d844ca5a90c7d7cc6ffcb1ac9c9d814a06fee7
[ "Apache-2.0", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
apereo/cas
c29deb0224c52997cbfcae0073a4eb65ebf41205
5dc06b010aa7fd1b854aa1ae683d1ab284c09367
refs/heads/master
2023-09-01T06:46:11.062065
2023-09-01T01:17:22
2023-09-01T01:17:22
2,352,744
9,879
3,935
Apache-2.0
2023-09-14T14:06:17
2011-09-09T01:36:42
Java
UTF-8
Java
false
false
1,545
java
package org.apereo.cas.services.resource; import org.apereo.cas.services.RegisteredService; import lombok.val; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import java.util.regex.Pattern; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; /** * This is {@link DefaultRegisteredServiceResourceNamingStrategyTests}. * * @author Misagh Moayyed * @since 6.2.0 */ @Tag("RegisteredService") class DefaultRegisteredServiceResourceNamingStrategyTests { private static void verifyFileNamePattern(final Pattern pattern, final String name) { val matcher = pattern.matcher(name); assertTrue(matcher.find()); assertNotNull(matcher.group(1)); assertNotNull(matcher.group(2)); } @Test void verifyOperation() { val service = mock(RegisteredService.class); when(service.getId()).thenReturn(1000L); when(service.getName()).thenReturn("Test"); val strategy = new DefaultRegisteredServiceResourceNamingStrategy(); val pattern = strategy.buildNamingPattern("json", "xml", "xyz"); assertNotNull(pattern); val result = strategy.build(service, "json"); assertNotNull(result); assertEquals("Test-1000.json", result); verifyFileNamePattern(pattern, "Test-1000.json"); verifyFileNamePattern(pattern, "Test-1000.json"); verifyFileNamePattern(pattern, "Test-Example-1000.json"); verifyFileNamePattern(pattern, "Multiple-Test-Example-1.xml"); } }
ae867689a214435da77a110737ea1203dd017e2f
51faeaec7f4250b7651885210b2aa6d9dfd81525
/sp04-orderservice/src/main/java/cn/tedu/sp04/order/feign/UserFeignClientFB.java
5d9b7ceee6a1f66e986b1523f500546b07c8757c
[]
no_license
aijavahyf/springcloud1
3e4f01c3e8dcb4ebeaf88b0f3e9bd0838e67cb89
4dcd63070e05cf7be5c61fad7c21ed200df4772b
refs/heads/master
2022-12-06T14:30:00.557794
2020-09-02T08:01:45
2020-09-02T08:01:45
293,072,896
0
0
null
null
null
null
UTF-8
Java
false
false
696
java
package cn.tedu.sp04.order.feign; import cn.tedu.sp01.pojo.User; import cn.tedu.web.util.JsonResult; import org.springframework.stereotype.Component; import java.util.ArrayList; @Component public class UserFeignClientFB implements UserFeignClient { @Override public JsonResult<User> getUser(Integer userId) { if (Math.random()<0.5){ User u=new User(userId,"用户名"+userId,"密码"+userId); return JsonResult.ok().data(u); } return JsonResult.err().msg("获取用户失败"); } @Override public JsonResult addScore(Integer userId, Integer score) { return JsonResult.err().msg("增加用户积分失败"); } }
bd63616ec90e3672b4ba34cb26c0e43cb9ae485f
7aede3eac373f635094dd8fc6f57d9f4a59296a4
/app/src/main/java/com/example/samsung/rentalhousemanager/roomsetting/OnTextChangedCallback.java
60dd4e3f9b4774cd2f4321deff127bf9b971dfc9
[]
no_license
sparrowleung/RentalHouseManager
e18f635a4ff9fbe614be71ea7d2c6af919c4311b
108c09dccf20e04bbd210d2d105311c433df7fdf
refs/heads/master
2020-04-03T11:40:23.614580
2018-11-14T09:16:56
2018-11-14T09:16:56
155,228,583
0
0
null
null
null
null
UTF-8
Java
false
false
253
java
package com.example.samsung.rentalhousemanager.roomsetting; import android.widget.EditText; /** * Created by yuyang.liang on 2018/8/6. */ public interface OnTextChangedCallback { void onTextChanged(EditText editText, String text); }
e773b58582580b63c4f7ffb0a55ec82feced039a
0c3ca83acf7a4bcaf361c74a60ad46da13e0972c
/spring-all/MySpring/src/main/java/com/wangzhen/myspring/aop/advice/AroundAdvice.java
de9b72ceb01522534763d8168f3b8d31a258073d
[]
no_license
1228857713/jvmOnJava
41adb557d4a866ffbc9b3eaa57f36b9acb2ea09b
a3f3f33fe83bdae673da5ff8fca90952d9dab65e
refs/heads/master
2023-03-29T13:01:10.931505
2021-03-30T10:42:07
2021-03-30T10:42:07
296,494,052
237
16
null
null
null
null
UTF-8
Java
false
false
324
java
package com.wangzhen.myspring.aop.advice; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * 环绕通知 */ public interface AroundAdvice extends Advice { Object around(Method method, Object[] args, Object target) throws InvocationTargetException, IllegalAccessException; }
877d7232975541026b536fdeb749dd1a889ed401
551569861431b41e2b3455b268bcd585487c0036
/database/src/main/java/org/seasar/cms/database/identity/impl/PostgreIdentity.java
737581077b3d6edc28fe8f4600c8de30c42d9439
[]
no_license
seasarorg/test-cms-1
dc5066e1a4311036b2ec2480bd2cf183e6d40970
f5431cef37cb8b484e4e71c5a582f7f66ddce960
refs/heads/master
2021-01-21T12:03:11.890874
2013-10-09T03:58:55
2013-10-09T03:58:55
13,432,663
0
1
null
null
null
null
UTF-8
Java
false
false
586
java
package org.seasar.cms.database.identity.impl; /** * <p> * <b>同期化:</b> このクラスはスレッドセーフです。 * </p> * * @author YOKOTA Takehiko */ public class PostgreIdentity extends AbstractIdentity { public String getDatabaseProductId() { return "postgre"; } public boolean isMatched(String productName, String productVersion) { // XXX 実装しよう。 return false; } public String toNumericExpression(String expr) { return "(to_number(" + expr + ",'9999999999')"; } }
b696d34a4b9ee4ccbf487c66f3e47acd84fb853f
e5d43decdcbcce691f862482c0793d31c1bbb956
/src/sample/RegistrationController.java
ffc1badecc3a164ec18a9022e8df4700fecff489
[]
no_license
BilyanaNikiforova/-USP
b3e49435e8bb70f3f5bdebe3c2a7547c3e59b050
34eeb1b674f466dccbd87ef2f7d1627c58f965ec
refs/heads/master
2023-04-12T02:23:15.086234
2021-05-12T10:50:48
2021-05-12T10:50:48
350,987,051
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
package sample; public class RegistrationController { }
5d5d73d635e473c45947a309c80baa42382f1dda
90943ea83b7f46bd4d38a2c86fdfb1d71067cae4
/app/com/harmeetsingh13/custannotations/LoggerAnnotation.java
5cdb06f1235a8908ffe9eb28047f1aaa417205a3
[]
no_license
harmeetsingh0013/play-crud-operations-using-spring
dea269bfee912576ef651f413a7e04fed5fc6b15
6773d291bc2268eb77738720773c96219d5fbdae
refs/heads/master
2021-01-18T14:38:12.739295
2015-03-06T16:44:30
2015-03-06T16:44:30
28,305,295
0
0
null
null
null
null
UTF-8
Java
false
false
632
java
/** * */ package com.harmeetsingh13.custannotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import play.mvc.With; import com.harmeetsingh13.interceptors.LoggerInterceptor; /** * @author james * */ /** The interceptors we can also user as a custom annotations or put @with() annotation direct on action */ @With(value = {LoggerInterceptor.class}) @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface LoggerAnnotation { boolean send() default true; }
75a56b24696787486c58dfae31b1b39f5412620d
e6675123eebe7e3c04d40df5fab10116165c83ee
/水果君/src/com/get/fruit/BmobConstants.java
fd0e9856e5ec57d21bf3495bc935e8e2d40350ea
[]
no_license
getFruit/bigFuit
0936335d6aa9f8660ec26df6a807c6fe5a4a361a
4dece7fedb0342dbd438d5d9eccafa91c855bf4c
refs/heads/master
2021-01-10T11:23:56.523491
2015-10-15T05:52:23
2015-10-15T05:52:23
44,296,669
0
0
null
null
null
null
GB18030
Java
false
false
1,383
java
package com.get.fruit; import android.annotation.SuppressLint; import android.os.Environment; /** * @ClassName: BmobConstants * @Description: TODO * @author smile * @date 2014-6-19 下午2:48:33 */ @SuppressLint("SdCardPath") public class BmobConstants { public static String MyAvatarDir = "/sdcard/水果君/me/"; public static String MyFruitDir = "/sdcard/水果君/fruit/"; public static String MyTempDir = "/sdcard/水果君/ad/"; /** * 拍照回调 */ public static final int REQUESTCODE_TAKE_CAMERA = 0x000001;//拍照 public static final int REQUESTCODE_TAKE_LOCAL = 0x000002;//本地图片 public static final int REQUESTCODE_PICTURE_CROP =0x000003;//系统裁剪头像 public static final int REQUESTCODE_TAKE_LOCATION = 0x000004;//位置选择 public static final int REQUESTCODE_FROM_ADDFRUIT_FORADDRESS = 0x000006;//商品上传位置选择调用 public static final int REQUESTCODE_FROM_ADDFRUIT_FORCATEGORY = 0x000007;//商品上传分类调用 public static final int REQUESTCODE_FROM_MAINACTIVITY_FORADDRESS = 0x000008;// public static final int REQUESTCODE_FROM_FRAGMENT_FORADDRESS = 0x000009;// public static final String EXTRA_STRING = "extra_string"; public static final String ACTION_REGISTER_SUCCESS_FINISH ="register.success.finish";//注册成功之后登陆页面退出 }
fd9847cab59c475f7d71d270b8c93e4564e0ca58
ff81b2617acac09439a8c2b44184d8ac1045abeb
/src/main/java/com/app/server/services/MessageService.java
80d61541ca73cb88d04edf954e354ce52819d3e2
[]
no_license
sathishm07/IdlMeet
8e47ff35922db9f3686ddb574fcf82cc2d7fc523
d5126423a86d618718b52d60f0875a8e24c6eb28
refs/heads/master
2020-04-05T09:52:25.467126
2018-11-08T22:58:44
2018-11-08T22:58:44
156,052,596
0
0
null
null
null
null
UTF-8
Java
false
false
6,110
java
package com.app.server.services; import com.app.server.http.utils.APPResponse; import com.app.server.models.Message; import com.app.server.util.MongoPool; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.mongodb.BasicDBObject; import com.mongodb.client.FindIterable; import com.mongodb.client.MongoCollection; import org.bson.Document; import org.bson.types.ObjectId; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; /** * Services run as singletons */ public class MessageService { private static MessageService self; private ObjectWriter ow; private MongoCollection<Document> messageCollection = null; private MessageService() { this.messageCollection = MongoPool.getInstance().getCollection("messages"); ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); } public static MessageService getInstance(){ if (self == null) self = new MessageService(); return self; } public ArrayList<Message> getAll(String id) { ArrayList<Message> messageList = new ArrayList<Message>(); BasicDBObject query = new BasicDBObject(); query.put("connectionId", id); FindIterable<Document> results = this.messageCollection.find(query); if (results == null) { return messageList; } for (Document item : results) { Message message = convertDocumentToMessage(item); messageList.add(message); } return messageList; } public Message getOne(String id) { BasicDBObject query = new BasicDBObject(); query.put("_id", new ObjectId(id)); Document item = messageCollection.find(query).first(); if (item == null) { return null; } return convertDocumentToMessage(item); } public Message create(String connectionId, Object request) { try { JSONObject json = null; json = new JSONObject(ow.writeValueAsString(request)); Message message = convertJsonToMessage(json, connectionId); Document doc = convertMessageToDocument(message, connectionId); messageCollection.insertOne(doc); ObjectId id = (ObjectId)doc.get( "_id" ); message.setId(id.toString()); message.setConnectionId(connectionId); return message; } catch(JsonProcessingException e) { System.out.println("Failed to create a document"); return null; } } public Object update(String id, String connectionId, Object request) { try { JSONObject json = null; json = new JSONObject(ow.writeValueAsString(request)); BasicDBObject query = new BasicDBObject(); query.put("_id", new ObjectId(id)); query.put("connectionId", new ObjectId(connectionId)); Document doc = new Document(); if (json.has("senderId")) doc.append("senderId",json.getString("senderId")); if (json.has("receiverId")) doc.append("receiverId",json.getString("receiverId")); if (json.has("messageContent")) doc.append("messageContent",json.getString("messageContent")); if (json.has("messageDate")) doc.append("messageDate",json.getString("messageDate")); if (json.has("messageStatus")) doc.append("messageStatus",json.getBoolean("messageStatus")); Document set = new Document("$set", doc); messageCollection.updateOne(query,set); return request; } catch(JSONException e) { System.out.println("Failed to update a document"); return null; } catch(JsonProcessingException e) { System.out.println("Failed to create a document"); return null; } } public Object delete(String id, String connectionId) { BasicDBObject query = new BasicDBObject(); query.put("_id", new ObjectId(id)); query.put("connectionId", new ObjectId(connectionId)); messageCollection.deleteOne(query); return new JSONObject(); } public Object deleteAll(String connectionId) { BasicDBObject query = new BasicDBObject(); query.put("connectionId", new ObjectId(connectionId)); messageCollection.deleteMany(new BasicDBObject()); return new JSONObject(); } private Message convertDocumentToMessage(Document item) { Message message = new Message( item.getString("connectionId"), item.getString("senderId"), item.getString("receiverId"), item.getString("messageContent"), item.getString("messageDate"), item.getBoolean("messageStatus") ); message.setId(item.getObjectId("_id").toString()); return message; } private Document convertMessageToDocument(Message message, String connectionId){ Document doc = new Document("connectionId", message.getconnectionId()) .append("senderId", message.getsenderId()) .append("receiverId", message.getreceiverId()) .append("messageContent", message.getmessageContent()) .append("messageDate", message.getmessageDate()) .append("messageStatus", message.getmessageStatus()); return doc; } private Message convertJsonToMessage(JSONObject json, String connectionId){ Message message = new Message( connectionId, json.getString("senderId"), json.getString("receiverId"), json.getString("messageContent"), json.getString("messageDate"), json.getBoolean("messageStatus")); return message; } } // end of main()
bc97b42fb2ed7490f1af6d2f57315b3c0365db94
0d867bf8bcb71e89b4449903ff8619d0cc3ffd2e
/src/Pojo/ResponseUserLogin.java
e33c6e2add296177663c29f1a74837d361fdbb8c
[]
no_license
rutvikrockers/AndroidEntryManagerSonar
3077f0714765b8b912f0f411df84c3b41f7fa610
d017598aacfd4f500b89a4d9f2c78804d2c7be38
refs/heads/master
2020-04-13T22:19:05.538977
2018-12-29T04:36:58
2018-12-29T04:36:58
163,476,079
0
0
null
null
null
null
UTF-8
Java
false
false
576
java
package Pojo; /** * Created by rockers on 16/3/17. */ public class ResponseUserLogin { public boolean success; public int status; public String msg; public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } }
d3986b5505712308fc2709f6a791f1c088e086dd
a5a7d8a145b389ea043d582f6e3271f453ffc45c
/sificomlib/src/main/java/com/sificomlib/permission/PermissionUtil.java
f22ed4409afff4c3d770311086bbe3af1aba8c2b
[]
no_license
molaith/SiFiComLibDemo
2a1beb3a7d70c4482fba93a7518b5a98bd737b25
d573a6af226b47cb2ad15095fd8c8748f74d63a2
refs/heads/master
2022-04-16T12:21:26.680695
2020-04-16T09:54:05
2020-04-16T09:54:05
253,789,663
0
0
null
null
null
null
UTF-8
Java
false
false
3,023
java
package com.sificomlib.permission; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.provider.Settings; import androidx.core.content.ContextCompat; import java.util.ArrayList; import java.util.List; /** * Created by molaith on 2017/4/11. */ public class PermissionUtil { private static final int OVERLAY_PERMISSION_REQ_CODE = 0x012; public static final int OTHER_PERMISSION_REQ_CODE = 0x013; /** * 请求权限 * * @param context * @param permissions * @param listener */ public static void requestPermissions(final Context context, String[] permissions, PermissionRequestListener listener) { if (context instanceof Activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { ((Activity) context).requestPermissions(permissions, OTHER_PERMISSION_REQ_CODE); } } else { RequestPermissionFragment fragment = new RequestPermissionFragment(); fragment.requestPermission(permissions); fragment.addPermissionRequestListener(listener); FragementAttachActivity.attachLaunch(context, fragment); } } /** * 检测权限 * * @param context * @param permissions * @return */ public static boolean checkPermissions(Context context, String[] permissions) { List<String> grantedPermissions = new ArrayList<>(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { for (String permission : permissions) { if (ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED) { grantedPermissions.add(permission); } } } else { return true; } return grantedPermissions.size() == permissions.length; } /** * 检测权限 * * @param context * @param permission * @return */ public static boolean checkPermission(Context context, String permission) { return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; } public static boolean checkFloatWindowPermission(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return Settings.canDrawOverlays(context); } return true; } /** * Intention please: onActivityResult() must be implimented * * @param context must be Activity * @return requestCode */ public static int requestFloatWindowPermissionForResult(Activity context) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName())); context.startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE); return OVERLAY_PERMISSION_REQ_CODE; } }
fd78bb304016cec4e8b61f65befe6ed5e9ab9816
83d5f2569a2096ef89d059860e13f099419fe4f9
/src/main/java/com/builders/testcase/builder/ClientResponseBuilder.java
c01d97d90cf9c339f4fa507cf3c140f202e1d526
[]
no_license
Arthur-Diego/builders-test-case
b01fb364663ae7a920b5ce90123b489d041ac17c
15eac0b3d09f80c90f722c3ca4515602efe04dbb
refs/heads/master
2023-06-27T08:30:11.320586
2021-08-01T23:40:09
2021-08-01T23:40:09
391,586,008
0
0
null
null
null
null
UTF-8
Java
false
false
1,064
java
package com.builders.testcase.builder; import com.builders.testcase.dto.AddressResponseDTO; import com.builders.testcase.dto.ClientResponseDTO; import com.builders.testcase.model.Client; import org.springframework.stereotype.Component; @Component public class ClientResponseBuilder { public ClientResponseDTO fromEntity(Client dto){ AddressResponseDTO addressResponseDTO = AddressResponseDTO.builder() .city(dto.getAddress().getCity()) .district(dto.getAddress().getDistrict()) .number(dto.getAddress().getNumber()) .state(dto.getAddress().getState()) .zipCode(dto.getAddress().getZipCode()) .publicPlace(dto.getAddress().getPublicPlace()) .build(); return ClientResponseDTO.builder() .id(dto.getId()) .age(dto.getAge()) .address(addressResponseDTO) .documentNumber(dto.getDocumentNumber()) .name(dto.getName()) .build(); } }
5406eacec3ecf0da781cdfad85ca21b64248d516
5f253f9e5a0b50d13377b46ea2613105460c6f67
/src/test/java/rs/htec/apps/sandbox_qa/NegativeLoginTest.java
3b3547c26528b98600999cbc0b069cfee4f1c0e8
[]
no_license
sstefanovic990/Homework
64daa9ab42470cc71f5a0128a408904c10fa3f56
fcb447d1ed1b707e2ed22c0474e04b88372f25e6
refs/heads/master
2023-05-28T19:16:41.457355
2020-01-27T14:53:32
2020-01-27T14:53:32
235,780,338
0
0
null
2023-05-09T18:19:36
2020-01-23T11:23:56
HTML
UTF-8
Java
false
false
1,147
java
package rs.htec.apps.sandbox_qa; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.Assert; import org.testng.annotations.Test; @Test public class NegativeLoginTest { public void negativeData () { System.setProperty("webdriver.chrome.driver", "src/main/resources/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://qa-sandbox.apps.htec.rs/"); WebElement LoginButton = driver.findElement(By.xpath("//a[@class='btn btn-lg btn-secondary']")); LoginButton.click(); WebElement Email = driver.findElement(By.cssSelector("input[name='email']")); Email.sendKeys("[email protected]"); WebElement Password = driver.findElement(By.cssSelector("input[name='password']")); Password.sendKeys("987321"); WebElement Submit = driver.findElement(By.cssSelector("form > .btn.btn-block.btn-primary.mt-4")); Submit.click(); Assert.assertTrue(driver.findElement(By.xpath("//div[@class='invalid-feedback']")).isDisplayed()); driver.close(); } }
ffaa4da11d5689b0c5f58f7a12b1544197ee0505
2f1e51bb1153d2f37b3f68ca2feb0b6f84615fab
/server/src/main/java/org/nexu/outdoors/web/dao/ActivityDao.java
05b5eb9b4770922a6adda1c6bbaf5fe33446b6ef
[ "MIT" ]
permissive
cyrilsx/outdoors
3e5fbc5d3e28b6a06822c9a88d21948e5a1b92d4
5c89f30815321d84c6cfec51ec881b350af0707c
refs/heads/master
2021-01-21T12:06:23.122808
2014-02-20T20:57:44
2014-02-20T20:57:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,910
java
package org.nexu.outdoors.web.dao; import org.jongo.MongoCollection; import org.nexu.outdoors.web.dao.model.CActivity; import org.nexu.outdoors.web.dao.util.MongoCollectionFactory; import org.nexu.outdoors.web.model.Activity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.List; @Component public class ActivityDao { @Autowired private MongoCollectionFactory mongoCollectionFactory; private MongoCollection activityCollection; @PostConstruct private void init() { activityCollection = mongoCollectionFactory.getCollection(CActivity.class); } public Activity createOrUpdatePost(final Activity activity) { CActivity cActivity = new CActivity(activity.getName(), activity.getDescription(), activity.getPicturesUrl(), activity.getVideosUrl(), activity.getCreationDate(), activity.getLatestUpdate(), activity.getCreator(), activity.getContributors(), activity.getPlayers(), activity.getViewsCounter(), activity.getActivityLink()); if(cActivity.getCreationDate() == null) { activityCollection.save(cActivity); } else { activityCollection.update("{_id:#}", activity.getName()).with(cActivity); } return activity; } public Activity getActivityByLink(String name) { CActivity activity = activityCollection.findOne("{activityLink:#}", name).as(CActivity.class); if(activity == null) { throw new IllegalStateException("activityNotFound"); } return new Activity(activity.getName(), activity.getDescription(), activity.getPicturesUrl(), activity.getVideosUrl(), activity.getCreationDate(), activity.getLatestUpdate(), activity.getCreator(), activity.getContributors(),activity.getPlayers(), activity.getViewsCounter(), activity.getActivityLink()); } public List<Activity> findAll(int offset, int limit) { Iterable<CActivity> activities = activityCollection.find().skip(offset).limit(limit).as(CActivity.class); List<Activity> resActivityList = new ArrayList<Activity>(); for(CActivity activity : activities) { resActivityList.add(new Activity(activity.getName(), activity.getDescription(), activity.getPicturesUrl(), activity.getVideosUrl(), activity.getCreationDate(), activity.getLatestUpdate(), activity.getCreator(), activity.getContributors(), activity.getPlayers(), activity.getViewsCounter(), activity.getActivityLink())); } return resActivityList; } public Activity delete(String name) { Activity activity = getActivityByLink(name); activityCollection.remove("{_id:#}", name); return activity; } }
3e1fc8b06d737b4138e93822fa27d9c7a9ad0cc4
085e1b3ccb73ce51b2b055ae881f26aa2f7ae647
/test/plugins/org.talend.designer.core.generic.test/src/main/java/org/talend/designer/core/generic/model/ComponentTest.java
5edc5bca004cb2bac3f76db868678ed6caa9630c
[ "Apache-2.0" ]
permissive
dmuliyil/tdi-studio-se
8cf39d3fc484a4aa0039f1cfa3973f480923e8c2
0c469650cb97037ce37050c23f13dea86b0c2a5e
refs/heads/master
2021-01-11T16:34:40.162654
2017-01-25T02:39:44
2017-01-25T02:39:44
80,113,499
1
0
null
2017-01-26T12:41:42
2017-01-26T12:41:41
null
UTF-8
Java
false
false
2,235
java
// ============================================================================ // // Copyright (C) 2006-2016 Talend Inc. - www.talend.com // // This source code is available under agreement available at // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt // // You should have received a copy of the agreement // along with this program; if not, write to Talend SA // 9 rue Pages 92150 Suresnes, France // // ============================================================================ package org.talend.designer.core.generic.model; import static org.mockito.Mockito.*; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.talend.components.api.component.ComponentDefinition; import org.talend.components.api.properties.ComponentProperties; import org.talend.core.model.process.IElementParameter; import org.talend.core.model.process.INode; /** * created by hcyi on Feb 17, 2016 Detailled comment * */ public class ComponentTest { private Component component; protected Component getComponent() { return component; } @Before public void setUp() throws Exception { initComponent(); } protected void initComponent() throws Exception { component = mock(Component.class); ComponentDefinition componentDefinition = mock(ComponentDefinition.class); when(component.getComponentDefinition()).thenReturn(componentDefinition); component.setPaletteType("DI"); //$NON-NLS-1$ when(component.getName()).thenReturn("tComponentName");//$NON-NLS-1$ when(component.getLongName()).thenReturn("tComponentName");//$NON-NLS-1$ // } @Test public void testGetElementParameterValueFromComponentProperties() { INode iNode = mock(INode.class); ComponentProperties iNodeComponentProperties = mock(ComponentProperties.class); iNode.setComponentProperties(iNodeComponentProperties); IElementParameter param = mock(GenericElementParameter.class); Object obj = component.getElementParameterValueFromComponentProperties(iNode, param); Assert.assertNull(obj); } }
9e123746a681dc64f1a52c413f5297ae3508200f
4f3766aad775198ede997219248904d208f0df37
/workspace_2019-12_maharshi_jinandra_final/Final/src/edu/neu/csye6200/Driver.java
00464e62c169d729541c90bc82586e9cf6547aad
[]
no_license
maharshi-neu/CSYE6200
8561acb43ac3da7b838148b1977b307e65fc247b
f9a48d630b2719bf5c1ffa66f5ae6297b00a144f
refs/heads/master
2023-05-31T07:56:39.424106
2021-06-01T03:38:53
2021-06-01T03:38:53
372,689,143
9
1
null
null
null
null
UTF-8
Java
false
false
147
java
package edu.neu.csye6200; public class Driver { public static void main(String[] args) { TwoAlternatingThreads.demo(); Final.demo(); } }
062ebd6f7ac805e94d45e27c5cac4a59ff5b1bf4
ead79744c2365e4ce067c5098cff4e74066b2dae
/eurekaClient_Provider_silence1/src/main/java/com/etc/renting/dto/HousesInfo.java
2d07447b099656c57eafc3f2f79e10b2c7f15d36
[]
no_license
cassieit/house
1762cf81213f5deb16cb57b965612f04dc7571fe
50a6d039d0bd5620dc9af34411a5ea1aa457a51b
refs/heads/master
2023-04-04T18:57:53.693150
2021-03-26T03:12:43
2021-03-26T03:12:43
351,631,372
0
0
null
null
null
null
UTF-8
Java
false
false
3,677
java
package com.etc.renting.dto; public class HousesInfo { private Integer houses_id; private Integer admin_id; private Integer area_id; private Integer type_id; private String houses_name; private String houses_price; private String houses_style; private String houses_areas; private String houses_toward; private String houses_storey; private String houses_decorate; private String houses_image; private String houses_addr; private String houses_info; private String houses_time; private Integer images_id; private String images_name; public Integer getHouses_id() { return houses_id; } public void setHouses_id(Integer houses_id) { this.houses_id = houses_id; } public Integer getAdmin_id() { return admin_id; } public void setAdmin_id(Integer admin_id) { this.admin_id = admin_id; } public Integer getArea_id() { return area_id; } public void setArea_id(Integer area_id) { this.area_id = area_id; } public Integer getType_id() { return type_id; } public void setType_id(Integer type_id) { this.type_id = type_id; } public String getHouses_name() { return houses_name; } public void setHouses_name(String houses_name) { this.houses_name = houses_name; } public String getHouses_price() { return houses_price; } public void setHouses_price(String houses_price) { this.houses_price = houses_price; } public String getHouses_style() { return houses_style; } public void setHouses_style(String houses_style) { this.houses_style = houses_style; } public String getHouses_areas() { return houses_areas; } public void setHouses_areas(String houses_areas) { this.houses_areas = houses_areas; } public String getHouses_toward() { return houses_toward; } public void setHouses_toward(String houses_toward) { this.houses_toward = houses_toward; } public String getHouses_storey() { return houses_storey; } public void setHouses_storey(String houses_storey) { this.houses_storey = houses_storey; } public String getHouses_decorate() { return houses_decorate; } public void setHouses_decorate(String houses_decorate) { this.houses_decorate = houses_decorate; } public String getHouses_image() { return houses_image; } public void setHouses_image(String houses_image) { this.houses_image = houses_image; } public String getHouses_addr() { return houses_addr; } public void setHouses_addr(String houses_addr) { this.houses_addr = houses_addr; } public String getHouses_info() { return houses_info; } public void setHouses_info(String houses_info) { this.houses_info = houses_info; } public String getHouses_time() { return houses_time; } public void setHouses_time(String houses_time) { this.houses_time = houses_time; } public Integer getImages_id() { return images_id; } public void setImages_id(Integer images_id) { this.images_id = images_id; } public String getImages_name() { return images_name; } public void setImages_name(String images_name) { this.images_name = images_name; } }
11527ee581e3c877173da4f7f86889c12375aa0a
ddb17e110e268e86d0444b0fe7c09a3747b0d561
/NHMP/src/ERP/Dataroom/model/controller/DataroomAdminListServlet.java
92d63cc99ed52bc49ddace8383a1b083a075fcfd
[]
no_license
shinsm0606/TMTS
222a1096826e0d0e0e672e376cbcee12a7b60211
9c8b2bc324b7558970fcb2c20a065dfa6c4fcb7c
refs/heads/master
2020-08-06T05:14:37.467372
2019-11-08T06:31:17
2019-11-08T06:31:17
212,600,131
1
0
null
2019-10-03T17:46:13
2019-10-03T14:25:33
Java
UTF-8
Java
false
false
3,655
java
package ERP.Dataroom.model.controller; import java.io.IOException; import java.util.ArrayList; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import ERP.Dataroom.model.vo.Dataroom; import ERP.notice.model.vo.Notice; import ERP.Dataroom.model.service.DataroomService; import Main.NursingHospital.model.ov.NursingHospital; /** * Servlet implementation class DataroomAdminListServlet */ @WebServlet("/drlist.ad") public class DataroomAdminListServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public DataroomAdminListServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 자료실 관리자페이지 전체 목록보기 출력 처리용 컨트롤러 모델서비스로 요청받고 처리(패이징 처리) //nursinghospital 의 로그인정보 받아오기 NursingHospital loginHospital = (NursingHospital)request.getSession().getAttribute("loginHospital"); int currentPage = 1; if(request.getParameter("page") != null) { currentPage = Integer.parseInt(request.getParameter("page")); } int limit = 10; //한 페이지에 출력할 목록 갯수 DataroomService drservice = new DataroomService(); int listCount = drservice.getListCount(loginHospital); //테이블의 전체 목록 갯수 조회 //총 페이지 수 계산 int maxPage = listCount / limit; if(listCount % limit > 0) maxPage++; //currentPage 가 속한 페이지그룹의 시작페이지숫자와 끝숫자 계산 //예, 현재 34페이지이면 31 ~ 40 이 됨. (페이지그룹의 수를 10개로 한 경우) int beginPage = (currentPage / limit) * limit + 1; int endPage = beginPage + 9; if(endPage > maxPage) endPage = maxPage; //currentPage 에 출력할 목록의 조회할 행 번호 계산 int startRow = (currentPage * limit) - 9; int endRow = currentPage * limit; //조회할 목록의 시작행과 끝행 번호 서비스로 전달하고 결과받기 ArrayList<Dataroom> list = drservice.selectList(startRow, endRow, loginHospital); RequestDispatcher view = null; if(list.size() >= 0) { view = request.getRequestDispatcher("views/ERP/Dataroom/ErpAdminDataroomListView.jsp"); request.setAttribute("list", list); request.setAttribute("maxPage", maxPage); request.setAttribute("currentPage", currentPage); request.setAttribute("beginPage", beginPage); request.setAttribute("endPage", endPage); request.setAttribute("loginHospital", loginHospital); }else { view = request.getRequestDispatcher("views/common/Error.jsp"); request.setAttribute("message", currentPage + "공지사항 관리자화면 전체 목록 조회 실패!"); } view.forward(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "kimbongsoo@DESKTOP-8L9PJN2" ]
kimbongsoo@DESKTOP-8L9PJN2
e7dd93097741dc33b40aa2746478203afe68b418
d7df278878ae7f15ec7596f4fc463cda10352305
/iubar_paghe_logic/src/main/java/it/iubar/paghe/logic/anagrafica/auto/_AnagMap.java
9af437d403ac21c71604b2e57996bb04069b3303
[]
no_license
str4to/paghe-open
6a18602d6b24f14b3f4f0b7aaa341b624a24b6b7
0a79a39596f4a8a7f38ec8062cd2ccc4b87b62c6
refs/heads/master
2021-01-10T03:27:10.073178
2013-04-29T08:20:02
2013-04-29T08:20:02
36,080,742
0
0
null
null
null
null
UTF-8
Java
false
false
1,828
java
package it.iubar.paghe.logic.anagrafica.auto; import java.util.List; import org.apache.cayenne.ObjectContext; import org.apache.cayenne.query.NamedQuery; import it.iubar.paghe.logic.anagrafica.AeNaturagiuridica; import it.iubar.paghe.logic.anagrafica.Comune; import it.iubar.paghe.logic.anagrafica.Provincia; import it.iubar.paghe.logic.anagrafica.Statoestero; /** * This class was generated by Cayenne. * It is probably a good idea to avoid changing this class manually, * since it may be overwritten next time code is regenerated. * If you need to make any customizations, please use subclass. */ public class _AnagMap { public static final String ALL_AE_NATURA_GIURIDICA_QUERYNAME = "AllAeNaturaGiuridica"; public static final String ALL_CITTADINANZE_QUERY_QUERYNAME = "AllCittadinanzeQuery"; public static final String ALL_COMUNI_QUERY_QUERYNAME = "AllComuniQuery"; public static final String ALL_PROVINCE_QUERY_QUERYNAME = "AllProvinceQuery"; public static final String RAW_QUERY_CITTADINANZA_QUERYNAME = "RawQueryCittadinanza"; public static final String RAW_QUERY_TIPO_IMPRESA_PER_AZIENDA_QUERYNAME = "RawQueryTipoImpresaPerAzienda"; public List<AeNaturagiuridica> performAllAeNaturaGiuridica(ObjectContext context ) { return context.performQuery(new NamedQuery("AllAeNaturaGiuridica")); } public List<Statoestero> performAllCittadinanzeQuery(ObjectContext context ) { return context.performQuery(new NamedQuery("AllCittadinanzeQuery")); } public List<Comune> performAllComuniQuery(ObjectContext context ) { return context.performQuery(new NamedQuery("AllComuniQuery")); } public List<Provincia> performAllProvinceQuery(ObjectContext context ) { return context.performQuery(new NamedQuery("AllProvinceQuery")); } }
[ "[email protected]@0a7ddd22-2559-11df-b4a3-2be847837fc9" ]
[email protected]@0a7ddd22-2559-11df-b4a3-2be847837fc9
eda32fb8c919287df32de4c8a23572d5464564fa
812f69b597b1903fbd2fdc19486eaf965710c790
/app/src/main/java/com/abhat/designquotes/network/QuoteInteractor.java
f029736b9ed1ae450fd897b95730605e848901bc
[]
no_license
AnirudhBhat/DesignQuotes
bc27ba2aea2ecc1f25c737ebad493a52c4cb2be6
19d2e87ca608de618e0d7b8e0769f33e67acaf06
refs/heads/master
2021-01-21T09:38:17.072626
2017-05-28T15:46:07
2017-05-28T15:46:07
91,661,513
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.abhat.designquotes.network; /** * Created by cumulations on 23/4/17. */ public interface QuoteInteractor { interface onQuoteFetchFinished { void onSuccess(String quote, String author); void onNetworkError(); } void fetchQuoteFromNetwork(onQuoteFetchFinished listener); }
4831545fe3077cbd058c724860b54ccf23f7ac76
0f23f45c79cc334a57fd851eee17fc3159b54652
/wuyou-music-service/src/main/java/com/service/impl/SongListServiceImpl.java
afd75fd8659687bd4334efd28b8ef20f6b57c001
[]
no_license
wuyou-Frank/wuyou-music
a4cf819a88927f3cf4606107ee6c198ef3cb8b20
63418e4fa8736a9f258794408ff0e618640ed3ca
refs/heads/master
2022-12-22T08:58:03.800769
2020-02-11T19:57:00
2020-02-11T19:57:00
224,414,926
1
0
null
2022-12-15T23:25:05
2019-11-27T11:27:14
Java
UTF-8
Java
false
false
1,286
java
package com.service.impl; import com.dao.SongListDao; import com.entity.SongListEntity; import com.service.SongListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class SongListServiceImpl implements SongListService { @Autowired private SongListDao songListDao; @Override public List<SongListEntity> getAll(int pageNum, int pageSize,int id) { return songListDao.getAll(pageNum,pageSize,id); } @Override public SongListEntity getById(int id){ return songListDao.getById(id); } @Override public List<SongListEntity> getByNmae(int pageNum,int pageSize,String name) { return songListDao.getByName(pageNum,pageSize,name); } @Override public SongListEntity getSong( String slname, String sname, int slid) { return songListDao.getSong( slname, sname, slid); } @Override public void update(SongListEntity songListEntity) { songListDao.update(songListEntity); } @Override public void insert(SongListEntity songListEntity) { songListDao.insert(songListEntity); } @Override public void delete(int id) { songListDao.delete(id); } }
f3ee08b89e49514a8f1f46b36691e62058f71473
9e6b6222dd78584066512673760c4ba0d6cc61f9
/src/main/java/com/xxx/model/base/controller/DdEmailController.java
d34c9e9db18e4fe15c7cb5791ebcb36992a935ef
[]
no_license
TimoYihao/duoduo
3ef043fedef4c54749ecd6605822339ff6839249
824149b30fd5c1c868b3d3020fd6029651f068dd
refs/heads/master
2020-04-14T11:42:15.320672
2019-01-02T09:32:48
2019-01-02T09:32:48
163,821,091
0
1
null
null
null
null
UTF-8
Java
false
false
2,574
java
package com.xxx.model.base.controller; import com.xxx.common.bean.Pager; import com.xxx.common.bean.ResultData; import com.xxx.common.framework.base.BaseController; import com.xxx.common.interfaces.Permission; import com.xxx.model.base.entity.DdEmail; import com.xxx.model.base.service.DdEmailService; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; /** * 邮件通知视图层 */ @Controller @RequestMapping("ddEmail") public class DdEmailController extends BaseController { @Resource private DdEmailService ddEmailService; @ModelAttribute public DdEmail get(@RequestParam(required=false) Long id) { if (id != null){ return ddEmailService.selectById(id); }else{ return new DdEmail(); } } //分页列表 @Permission("base:ddEmail:view") @RequestMapping("page") public String page(DdEmail ddEmail, Pager<DdEmail> pager, Model model){ Pager<DdEmail> page = ddEmailService.selectPage(ddEmail, pager); model.addAttribute("pager",page); model.addAttribute("ddEmail",ddEmail); return "base/ddEmail/ddEmailPage"; } //跳转添加编辑页面 @Permission("base:ddEmail:view") @GetMapping("saveFrom") public String saveFrom(DdEmail ddEmail,Model model){ model.addAttribute("ddEmail",ddEmail); return "base/ddEmail/ddEmailSave"; } //添加编辑操作 @Permission("base:ddEmail:edit") @ResponseBody @PostMapping("save") public ResultData<Object> save(DdEmail ddEmail){ try { ddEmailService.save(ddEmail); return success(); } catch (Exception e) { e.printStackTrace(); return error(); } } //删除 @Permission("base:ddEmail:edit") @ResponseBody @PostMapping("delById") public ResultData<Object> delById(Integer id){ try { ddEmailService.delById(id); ResultData<Object> success = success(); return success; } catch (Exception e) { e.printStackTrace(); return error(); } } }
00f006a6436f22e2ad47abf5e318efb87efece47
96306b9a3f119651c6a29ad43be6c7c999927cfe
/src/main/java/com/github/ljtfreitas/job/scheduler/JobSchedulerApplication.java
913c087205113dad73b5fa9cf693a854cdf5ae8e
[]
no_license
ljtfreitas/job-scheduler-api
cbc90935542ba1b860c0315f8bd1af7768e614b6
294d6177ad27ecca04be714e07d7ca67040f8eb1
refs/heads/master
2021-01-22T01:55:31.843972
2017-02-05T20:57:32
2017-02-05T20:57:32
81,021,045
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package com.github.ljtfreitas.job.scheduler; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class JobSchedulerApplication { public static void main(String[] args) { SpringApplication.run(JobSchedulerApplication.class, args); } }
d80e268f23966bd04c64cdc05b9df2fd7cff8c7b
5ca54db9ac461f04570842c03495d8f9b6ac90a0
/Tarea/src/Logica/Principal.java
bc5a7b08d06ccaab1e81d0262d2589525168eb50
[]
no_license
uykarma/Tareas
08aca72e1bcfa3c94b80ae06c9350c819b752d24
1105ba38ec9e8fd85962b9e5892b47306ae1df3c
refs/heads/master
2023-04-12T16:33:27.705859
2021-05-12T16:05:11
2021-05-12T16:05:11
366,748,305
1
2
null
2021-05-12T23:12:36
2021-05-12T14:41:20
Java
UTF-8
Java
false
false
96
java
package Logica; public class Principal { public static void main (String[] args){ } }
7dcd678e3990faf576ac4b15e5ed3c1c1a5fd6b6
9290dc87ec131f3ef5253224f264875e41b0477d
/Tarun_Day5_Java/Assign/Phone.java
f9c3cee1f713aee2bed35be794d847c32e019030
[]
no_license
TarunSikka/JavaPrograms
3ba83f592953f9f46f6cb95f780ce9b35e4e3e1b
353b6704686a087097db9492baee9b3a4b1c6077
refs/heads/master
2020-03-28T09:43:40.318202
2018-12-13T15:16:43
2018-12-13T15:16:43
148,055,462
0
0
null
null
null
null
UTF-8
Java
false
false
864
java
class Phone { private int internationalAreaCode; private int prefix; private int number; Phone(int iac,int prefix,int number) { this.internationalAreaCode=iac; this.prefix=prefix; this.number=number; } public void setIAC(int iac) { this.internationalAreaCode=iac; } public int getIAC() { return internationalAreaCode; } public void setPrefix(int prefix) { this.prefix=prefix; } public int getPrefix() { return prefix; } public void setNumber(int number) { this.number=number; } public int getNumber() { return number; } /* public void addNumber(int iac,int prefix,int number) { this.internationalAreaCode=iac; this.prefix=prefix; this.number=number; }*/ }
2cc191ad8bb8c00ea56af1e7cb3fd87309327c13
f20af063f99487a25b7c70134378c1b3201964bf
/appengine/src/main/java/com/dereekb/gae/client/api/service/response/error/impl/ClientResponseErrorInfoImpl.java
77af6a96d7e9ee56280597f1095cf98f3a6a4aa8
[]
no_license
dereekb/appengine
d45ad5c81c77cf3fcca57af1aac91bc73106ccbb
d0869fca8925193d5a9adafd267987b3edbf2048
refs/heads/master
2022-12-19T22:59:13.980905
2020-01-26T20:10:15
2020-01-26T20:10:15
165,971,613
0
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package com.dereekb.gae.client.api.service.response.error.impl; import com.dereekb.gae.client.api.service.response.error.ClientResponseErrorInfo; import com.dereekb.gae.utilities.web.error.impl.ErrorInfoImpl; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.JsonNode; /** * {@link ClientResponseErrorInfo} implementation. * * @author dereekb * */ @JsonInclude(Include.NON_EMPTY) @JsonIgnoreProperties(ignoreUnknown = true) public class ClientResponseErrorInfoImpl extends ErrorInfoImpl implements ClientResponseErrorInfo { private JsonNode errorData; @Override public JsonNode getErrorData() { return this.errorData; } public void setErrorData(JsonNode errorData) { this.errorData = errorData; } @Override public String toString() { return "ClientResponseErrorInfoImpl [errorData=" + this.errorData + ", getCode()=" + this.getCode() + ", getTitle()=" + this.getTitle() + ", getDetail()=" + this.getDetail() + "]"; } }
7fd996651438f260b63fae412682949c63882dd6
52644f9ee0f41b9cdffaa299f4baf435e7515c51
/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/chart/mappers/ChartUpdateInputMapper.java
2922d41a5072410037703c2f6ff758e973e346d4
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "MIT" ]
permissive
NathanFaught/datahub
9fc2be8e9b5aa6e07f711a245c56fc24de6d3f8f
f91062d82796cb56909623a5bc4d2d50edbb6a67
refs/heads/master
2023-05-19T01:43:16.569350
2021-06-04T18:30:06
2021-06-04T18:30:06
263,983,041
0
0
Apache-2.0
2020-05-14T17:37:24
2020-05-14T17:37:23
null
UTF-8
Java
false
false
1,862
java
package com.linkedin.datahub.graphql.types.chart.mappers; import com.linkedin.common.GlobalTags; import com.linkedin.common.TagAssociationArray; import com.linkedin.common.urn.Urn; import com.linkedin.dashboard.Chart; import com.linkedin.datahub.graphql.generated.ChartUpdateInput; import com.linkedin.datahub.graphql.types.common.mappers.OwnershipUpdateMapper; import com.linkedin.datahub.graphql.types.mappers.InputModelMapper; import com.linkedin.datahub.graphql.types.tag.mappers.TagAssociationUpdateMapper; import javax.annotation.Nonnull; import java.util.stream.Collectors; public class ChartUpdateInputMapper implements InputModelMapper<ChartUpdateInput, Chart, Urn> { public static final ChartUpdateInputMapper INSTANCE = new ChartUpdateInputMapper(); public static Chart map(@Nonnull final ChartUpdateInput chartUpdateInput, @Nonnull final Urn actor) { return INSTANCE.apply(chartUpdateInput, actor); } @Override public Chart apply(@Nonnull final ChartUpdateInput chartUpdateInput, @Nonnull final Urn actor) { final Chart result = new Chart(); if (chartUpdateInput.getOwnership() != null) { result.setOwnership(OwnershipUpdateMapper.map(chartUpdateInput.getOwnership(), actor)); } if (chartUpdateInput.getGlobalTags() != null) { final GlobalTags globalTags = new GlobalTags(); globalTags.setTags( new TagAssociationArray( chartUpdateInput.getGlobalTags().getTags().stream().map( element -> TagAssociationUpdateMapper.map(element) ).collect(Collectors.toList()) ) ); result.setGlobalTags(globalTags); } return result; } }
72441717d64e88c8ac963ebff853d6988681a0e8
114d409959f07a69e17777fea491e326eed19bfc
/bst-player-api/src/main/java/com/bramosystems/oss/player/core/client/impl/FlashMediaPlayerImpl.java
973d181163a4fe7553abaeaa0562eabc33ebb4d2
[]
no_license
nublic/bst-player
82fa9740d4d0eeb654a466448ae9a439ebfacac0
23188ae7bb771cc380cc34e3e4c2800c1c76a908
refs/heads/master
2020-04-10T08:45:00.570008
2012-05-24T09:37:12
2012-05-24T09:37:12
3,971,266
1
0
null
null
null
null
UTF-8
Java
false
false
6,127
java
/* * Copyright 2009 Sikirulai Braheem * * 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.bramosystems.oss.player.core.client.impl; import com.bramosystems.oss.player.core.client.RepeatMode; import com.bramosystems.oss.player.core.client.ui.FlashMediaPlayer; import com.bramosystems.oss.player.core.event.client.PlayStateEvent; import com.bramosystems.oss.player.core.event.client.PlayStateEvent.State; import com.google.gwt.core.client.JavaScriptObject; /** * Native implementation of the FlashMediaPlayer class. It is not recommended to * interact with this class directly. * * @author Sikirulai Braheem * @see FlashMediaPlayer */ public class FlashMediaPlayerImpl extends JavaScriptObject { protected FlashMediaPlayerImpl() { } public static native FlashMediaPlayerImpl getPlayer(String playerId) /*-{ return $doc.getElementById(playerId); }-*/; public native final String getPluginVersion() /*-{ return this.getPluginVersion(); }-*/; public native final String getPlayerVersion() /*-{ return this.getPlayerVersion(); }-*/; public native final void loadMedia(String url) /*-{ this.load(url); }-*/; public native final void playMedia() /*-{ this.play(); }-*/; public native final boolean playMedia(int index) /*-{ return this.playIndex(index); }-*/; public native final boolean playNext() /*-{ return this.playNext(); }-*/; public native final boolean playPrevious() /*-{ return this.playPrev(); }-*/; public native final void stopMedia() /*-{ this.stop(true); }-*/; public native final void pauseMedia() /*-{ this.stop(false); }-*/; public native final void closeMedia() /*-{ try { this.close(); }catch(err){} }-*/; public native final double getPlayPosition() /*-{ return this.getPlayPosition(); }-*/; public native final void setPlayPosition(double position) /*-{ this.setPlayPosition(position); }-*/; public native final double getMediaDuration() /*-{ return this.getDuration(); }-*/; public native final void addToPlaylist(String mediaURL) /*-{ this.addToPlaylist(mediaURL); }-*/; public native final void removeFromPlaylist(int index) /*-{ this.removeFromPlaylist(index); }-*/; public native final void clearPlaylist() /*-{ this.clearPlaylist(); }-*/; public native final void insertIntoPlaylist(int index, String mediaURL) /*-{ this.insertIntoPlaylist(index, mediaURL); }-*/; public native final void reorderPlaylist(int from, int to) /*-{ this.reorderPlaylist(from, to); }-*/; public native final int getPlaylistIndex() /*-{ return this.getPlaylistIndex(); }-*/; public final State getState() { switch (_getState()) { case 2: // play started... return State.Started; case 3: // play stopped... return State.Stopped; case 4: // play paused... return State.Paused; case 9: // play finished... return State.Finished; default: return null; } } public native final int _getState() /*-{ this.getState(); }-*/; public native final int getPlaylistCount() /*-{ return this.getPlaylistSize(); }-*/; public native final double getVolume() /*-{ return this.getVolume(); }-*/; public native final void setVolume(double volume) /*-{ this.setVolume(volume); }-*/; public native final void setLoopCount(int count) /*-{ this.setLoopCount(count); }-*/; public native final int getLoopCount() /*-{ this.getLoopCount(); }-*/; public native final boolean isShuffleEnabled() /*-{ return this.isShuffleEnabled(); }-*/; public native final void setShuffleEnabled(boolean enable) /*-{ this.setShuffleEnabled(enable); }-*/; public native final int getVideoHeight() /*-{ return this.getVideoHeight(); }-*/; public native final int getVideoWidth() /*-{ return this.getVideoWidth(); }-*/; public native final String getMatrix() /*-{ return this.getMatrix(); }-*/; public native final void setMatrix(double a, double b, double c, double d, double tx, double ty) /*-{ this.setMatrix(a, b, c, d, tx, ty); }-*/; public native final boolean isControllerVisible() /*-{ return this.isControllerVisible(); }-*/; public native final void setControllerVisible(boolean visible) /*-{ this.setControllerVisible(visible); }-*/; public final RepeatMode getRepeatMode() { try { return RepeatMode.valueOf("REPEAT_" + getRepeatModeImpl().toUpperCase()); } catch (Exception e) { return RepeatMode.REPEAT_OFF; } } public final void setRepeatMode(RepeatMode mode) { switch(mode) { case REPEAT_ALL: setRepeatModeImpl("all"); break; case REPEAT_OFF: setRepeatModeImpl("off"); break; case REPEAT_ONE: setRepeatModeImpl("one"); } } private native String getRepeatModeImpl() /*-{ return this.getRepeatMode(); }-*/; private native void setRepeatModeImpl(String mode) /*-{ this.setRepeatMode(mode); }-*/; public native final boolean isAutoHideController() /*-{ return this.isAutoHideController(); }-*/; public native final void setAutoHideController(boolean autohide) /*-{ this.setAutoHideController(autohide); }-*/; }
85afaad87a51b7870671250cd05c6365dda43730
e5213d01474fd8dc75b746e34a97925990e8568c
/Decrypting a character/Main.java
6e3623f001ecce59358a1411f02aee9cc7fd286c
[]
no_license
singhaman092/Playground
692f0c03d52bdf2aec53baaf0d753a60099a3fe2
f7eed4f81d1d74e32fc897a6b97ce9d203a5e102
refs/heads/master
2020-04-14T14:48:36.705416
2019-11-06T17:03:00
2019-11-06T17:03:00
163,907,639
0
0
null
null
null
null
UTF-8
Java
false
false
594
java
import java.util.Scanner; public class Main{ public static void main(String args[]) { // Type your code here Scanner in = new Scanner(System.in); char ch = in.next().charAt(0); int key = in.nextInt(); int offset = 0; if (Character.isUpperCase(ch)) { offset = ch - 'A'; if (key>offset) ch = (char)(90-key+offset+1); else ch = (char)(ch - key); } else { offset = ch - 'a'; if (key>offset) ch = (char)(122-key+offset+1); else ch = (char)(ch - key); } System.out.println(ch); } }
162b8937738ff516073027c93aca2fecbfd25554
224bb074aabf48782ce50a36769dfad1f5488f9c
/week8/hangman/hangman2/Hangman4.java
5e14c7d51f2fd2e55cf7c763923ba214a35643d8
[]
no_license
cravenormality/Java---CSE110
cfc06e4f77a7b370860203eb64ebecab1e1fbce9
0f9bf63d2299a991225b8bb3582713027333ae4c
refs/heads/master
2020-07-23T19:32:39.188189
2019-12-19T19:40:10
2019-12-19T19:40:10
207,683,222
0
0
null
null
null
null
UTF-8
Java
false
false
2,338
java
import java.util.Scanner; import java.util.ArrayList; import java.io.File; import java.io.FileNotFoundException; public class Hangman4 { public static void main(String[] args) throws FileNotFoundException { ArrayList<String> words = readWords(); String word = pickWord(words); String guesses = ""; Scanner in = new Scanner(System.in); System.out.println("\nHangman - E. Eckert"); do { printWord(word, guesses); guesses = guesses + getUniqueGuess(in, guesses); } while (!guesses(word, guesses)); printWord(word, guesses); System.out.println("\nYou guessed it in " + guesses.length() + " tries."); in.close(); } private static ArrayList<String> readWords() throws FileNotFoundException { ArrayList<String> words = new ArrayList<String>(); File inputFile = new File("words.txt"); Scanner in = new Scanner(inputFile); while (in.hasNext()) { words.add(in.next()); } System.out.println("I know " + words.size() + " words."); in.close(); return words; } static String pickWord(ArrayList<String> list) { int choice = (int) (Math.random() * list.size()); return list.get(choice).toUpperCase(); } private static boolean guesses(String word, String guesses) { int cnt = 0; for (int i = 0; i < word.length(); i++) { if (guesses.indexOf(word.charAt(i)) >= 0) { cnt += 1; } } if (cnt == word.length()) { return true; } else { return false; } } private static char getUniqueGuess(Scanner in, String guesses) { char guess; do { System.out.print("Enter a letter"); guess = in.next().charAt(0); } while (guesses.indexOf(guess) >= 0); return Character.toUpperCase(guess); } private static void printWord(String word, String guesses) { System.out.print("\n"); for (int i = 0; i < word.length(); i++) { if (guesses.indexOf(word.charAt(i)) >= 0) { System.out.print(word.toUpperCase().charAt(i)); } else { System.out.print(guesses); } } } }
4b04a87872e37229de97ed0217fba226062e4c69
5fff175cd026ac0b586e1ec6b91944fd3582510f
/src/main/java/com/cc/yhzt/service/IPlayersService.java
7ac91c0bf27a8b6cfee38b4fffab774ce171f2e1
[]
no_license
fengyuan2020/YHZT
5ec69d4e7ab144d28a68a03e19c354eac417a119
5a4c78eb68bb692ef0a8e2e3f3e2b038eb843455
refs/heads/master
2021-02-23T12:24:57.060903
2020-07-01T23:56:37
2020-07-01T23:56:37
245,400,319
0
0
null
2020-03-06T11:17:10
2020-03-06T11:17:10
null
UTF-8
Java
false
false
266
java
package com.cc.yhzt.service; import com.baomidou.mybatisplus.extension.service.IService; import com.cc.yhzt.entity.Players; /** * <p> * 服务类 * </p> * * @author CC * @since 2019-05-16 */ public interface IPlayersService extends IService<Players> { }
c3689097dfd94d6da4170311983b9f013618f21f
5991802ece60a70cce60d0fcd82bcdb8700b6438
/app/src/main/java/com/example/all_news/businessadapter.java
fd6fefc0eec4232fd3f43efeb23692946be2a7f0
[]
no_license
sauravkumar-2002/the-news-app
37de01e9d63a7ccd2407af83ab686243681bea97
d0ebcb5c7f4fc087aaa2a8f4fef13e69ff0edee1
refs/heads/master
2023-07-09T21:42:10.606842
2021-08-09T15:52:26
2021-08-09T15:52:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,425
java
package com.example.all_news; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import java.util.List; public class businessadapter extends RecyclerView.Adapter<businessadapter.viewholder> { List<modelarticles> listnew; Context context; public businessadapter(List<modelarticles> listnew, Context context) { this.listnew = listnew; this.context = context; } @NonNull @Override public businessadapter.viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View v= LayoutInflater.from(context).inflate(R.layout.singlerow_general,parent,false); return new businessadapter.viewholder(v); } @Override public void onBindViewHolder(@NonNull businessadapter.viewholder holder, int position) { holder.title.setText(listnew.get(position).getTitle()); holder.time.setText(listnew.get(position).getPublishedAt()); holder.author.setText(listnew.get(position).getAuthor()); Glide.with(context) .load(listnew.get(position).urlToImage) .into(holder.imageView); holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(context,webview.class); intent.putExtra("url",listnew.get(position).getUrl()); context.startActivity(intent); } }); } @Override public int getItemCount() { return listnew.size(); } public class viewholder extends RecyclerView.ViewHolder { TextView title,time,author; ImageView imageView; CardView cardView; public viewholder(@NonNull View itemView) { super(itemView); time=itemView.findViewById(R.id.timepgeneral); title=itemView.findViewById(R.id.titlegeneral); author=itemView.findViewById(R.id.authorgeneral); imageView=itemView.findViewById(R.id.img); cardView=itemView.findViewById(R.id.cvgeneral); } } }
[ "https://github.com/sauravkumar-2002/Health-Companion" ]
https://github.com/sauravkumar-2002/Health-Companion
83e125978e2861407928d0d0fbad9e5f7178e1f1
0d6ea46c83a6f28b9751ad3cf1ace7bb4e777a5d
/sibad_repo_cert_sibad/src/main/java/gob/osinergmin/sibad/domain/builder/UbigeoDPDBuilder.java
fa438182dfd7c29f56371b8109bfa9e7b627441b
[]
no_license
stevecerdan/SIGUO
00c08830aaba7f60e11f208123deb77979b45093
6566ab0dbeeccd767536ecc40c9fdc7c3b5d7069
refs/heads/master
2020-03-08T06:23:28.151263
2018-07-15T02:39:23
2018-07-15T02:39:23
127,970,819
0
0
null
null
null
null
UTF-8
Java
false
false
1,700
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gob.osinergmin.sibad.domain.builder; import gob.osinergmin.sibad.domain.MdiUbigeoDPD; import gob.osinergmin.sibad.domain.dto.UbigeodpdDTO; import java.util.ArrayList; import java.util.List; /** * * @author jpiro */ public class UbigeoDPDBuilder { public static List<UbigeodpdDTO> toListUbigeoDPDDto(List<MdiUbigeoDPD> lista) { UbigeodpdDTO registroDTO; List<UbigeodpdDTO> retorno = new ArrayList<UbigeodpdDTO>(); if (lista != null) { for (MdiUbigeoDPD maestro : lista) { registroDTO = toUbigeoDPDDto(maestro); retorno.add(registroDTO); } } return retorno; } public static UbigeodpdDTO toUbigeoDPDDto(MdiUbigeoDPD registro) { UbigeodpdDTO registroDTO = new UbigeodpdDTO(); registroDTO.setIdDepartamento(registro.getIdDepartamento()); registroDTO.setIdProvincia(registro.getIdProvincia()); registroDTO.setIdDistrito(registro.getIdDistrito()); registroDTO.setNombre(registro.getNombre()); return registroDTO; } public static MdiUbigeoDPD getUbigeoDPD(UbigeodpdDTO registroDTO) { MdiUbigeoDPD registro = null; if(registroDTO!=null){ registro=new MdiUbigeoDPD(); registro.setIdDepartamento(registroDTO.getIdDepartamento()); registro.setIdProvincia(registroDTO.getIdProvincia()); registro.setIdDistrito(registroDTO.getIdDistrito()); registro.setNombre(registroDTO.getNombre()); } return registro; } }
[ "steve@steve-HP-Pavilion-g4-Notebook-PC" ]
steve@steve-HP-Pavilion-g4-Notebook-PC
d941953971c5cc79a4e8dd56bb83cc6b2877b78c
0c2ecc879948b47d549ce2c5c4bd848a0e8916db
/interview/src/main/java/practice/MoveZero.java
2429219d32a3d24ac0de9b70d29fee3bcd71fa5e
[]
no_license
javaguruji/playground
bf6c1bb168a12a59ca77624d73ff0941fffe9400
909a0dd9e01d9edfcb49df49d1c5b1352431569f
refs/heads/master
2020-12-04T14:33:02.578192
2020-07-19T19:57:49
2020-07-19T19:57:49
231,801,901
0
0
null
2020-10-13T18:47:34
2020-01-04T17:27:37
Java
UTF-8
Java
false
false
939
java
package practice; /** * @author badrikant.soni */ public class MoveZero { public static void main(String[] args) { int[] arr = {0,1,0, 3, 12}; int[] moves = move(arr); for(int move : moves){ System.out.print(move + ","); } } private static int[] move(int[] arr) { // iterate through the array. // if you find non zero element, then move them in temp array with same new index // if you find zero element, increase the counter by 1 // at last add the number zero in last. int count = 0; int temp = 0; for(int i = 0; i < arr.length ; i++){ if(arr[i] != 0){ arr[temp] = arr[i]; temp++; }else { count++; } } for(int j = 0; j < count; j++){ arr[temp] = 0; temp++; } return arr; } }
2093a04a3150d2d3dac107d64ab43b2608ef2720
22132fd803e28eba37a452b74a5915810525fe87
/IntelligentSdkAndriod/Vision/src/main/java/com/microsoft/projectoxford/vision/contract/FaceRectangle.java
798e83eeec4855794d1f1a323bbfa31e00211c43
[]
no_license
ada-qijia/oxford-intelligent-sdk
c105d11a5a8260f70dc0fae965a8bd9b3a052ffa
dc945e8db428bda11c5b4fee0c0c6385a59ea045
refs/heads/master
2021-01-22T15:04:01.541144
2015-07-30T05:47:44
2015-07-30T05:47:44
39,886,177
1
0
null
2015-07-29T09:52:14
2015-07-29T09:52:14
null
UTF-8
Java
false
false
174
java
package com.microsoft.projectoxford.vision.contract; public class FaceRectangle { public int width; public int height; public int left; public int top; }
c9f901511994a7834843a7f44d504a2094c24f61
3cf01ecc5d511b9454918bf3a9f0b66a02b9f3e4
/jdk17/src/main/java/com/parthirecipes/apps/ImmutableTest.java
6b97c9ef54e3b65280a77633e4a4380ff39a0a0d
[]
no_license
parthirecipes/jdk17
cdcc76dffe6cb644decd8df1ba12159de3190055
f028c96b3499914aa1a7330f9b904d6180c8dc00
refs/heads/master
2020-12-24T12:39:41.394064
2016-11-08T16:53:04
2016-11-08T16:53:04
72,970,222
0
0
null
null
null
null
UTF-8
Java
false
false
458
java
package com.parthirecipes.apps; public class ImmutableTest { public static void main(String[] args) { Immutable obj1 = new Immutable("Hello"); System.out.println("Immutable value : " + obj1.getName()); } } /** * Immutable class should be * * 1. class should be final 2. No setter methods. */ final class Immutable { private String name; public Immutable(String name) { this.name = name; } public String getName() { return name; } }
c7051f7924078dfb42f297c667298fbb8b05cc33
6fbe9087bc1b0e7f6757209141e762bec91b21af
/app/src/test/java/com/rianer/secondapp/ExampleUnitTest.java
9415897ed76b170063fdc61093588a6f2d647e8a
[]
no_license
RianerJacinto/SecondApp
7157c9390169292f662b8e4e7671f0175a015b6e
ba00760803d98cc0e970407b28cdf69ce440c5b0
refs/heads/master
2021-01-23T05:55:54.804320
2017-09-05T13:14:59
2017-09-05T13:14:59
102,483,134
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package com.rianer.secondapp; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
7f96b7194ded3aa76a268d0c644060d2d79a1043
63e6d8eb15a9aebbb085b1bff3466e5603d86d5d
/src/main/java/joy/todont/repository/TodoRepositoryCustom.java
82693f737d0954b9877b1b3de1b34de57d0b1962
[]
no_license
firatgursoy/todont
ea031e47bccb5ba63107fa78d1e4c203c5aa77b7
c2d033e925624635511d15c1e8391287caccf7fd
refs/heads/master
2021-01-23T10:07:42.957496
2017-06-07T16:11:54
2017-06-07T16:11:54
93,040,096
0
0
null
null
null
null
UTF-8
Java
false
false
148
java
package joy.todont.repository; import joy.todont.domain.Todo; /** * = TodoRepositoryCustom TODO * */ public interface TodoRepositoryCustom { }
9fc61e39b6fdb0509725d9651b84b3781706f260
ebbf6f3ef6ce004d1f36bffef01cc747120fa93b
/src/main/java/com/stc/thamquan/entities/KetQuaKhaoSatCongTacVien.java
de5559186101a3862fdc2415cb1389a45438488d
[]
no_license
minhuongquang/khoa-luan-tot-nghiep-be
59ad872c84ee90c71897675e16a69c0976c08d0d
e4ff09aaca1a499b4f135f41c5529b1809c35c40
refs/heads/master
2023-06-17T07:25:22.249247
2021-07-17T05:04:17
2021-07-17T05:04:17
386,841,668
0
0
null
null
null
null
UTF-8
Java
false
false
1,511
java
package com.stc.thamquan.entities; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.springframework.data.annotation.*; import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; import java.util.Date; import java.util.List; /** * Created by: IntelliJ IDEA * User : truc * Date : 6/4/21 * Time : 14:54 * Filename : KetQuaKhaoSatCongTacVien */ @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Document(collection = "ket-qua-khao-sat-cong-tac-vien") public class KetQuaKhaoSatCongTacVien { @Id private String id; @DBRef private ChuyenThamQuan chuyenThamQuan; @DBRef private CongTacVien userKhaoSat; private CauHoiKhaoSatCongTacVien cauHoi; //Embedded private Date thoiGianTraLoi; // now private List<String> cauTraLoi; // với câu chọn CHON_MOT hoặc NHAP_LIEU thì là 1 mảng có 1 phần tử // với câu SAP_XEP: là mảng đươc sắp xếp theo thứ tự ưu tiên giảm dần (vị trí 0 là ưu tiên) private boolean trangThai = true; @JsonIgnore @CreatedBy private String createdBy; @JsonIgnore @LastModifiedBy private String lastModifiedBy; @JsonIgnore @CreatedDate private Date createdDate; @JsonIgnore @LastModifiedDate private Date lastModifiedDate; }
cbff11ac4268c8138a885be75e283725074f9ab8
5ae62c18ae9767b02497eff0f075564b638e5110
/src/io/github/SebastianDanielFrenz/WorldEconomyPlugin/gui/guis/BankAccountsGUI.java
b61fc3ce3a6b822dd92dd2479ba13c1b1e9177d0
[]
no_license
Gogolinolett/WorldEconomyPlugin
5288321947a9d88e58c4d8b3ac9bda42c411511c
f4e75f5dcc54a26039b3957eef312fceedaae682
refs/heads/master
2021-01-14T20:48:09.292127
2020-02-29T10:15:29
2020-02-29T10:15:29
242,754,665
0
0
null
2020-02-24T14:16:45
2020-02-24T14:16:44
null
WINDOWS-1252
Java
false
false
1,679
java
package io.github.SebastianDanielFrenz.WorldEconomyPlugin.gui.guis; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryClickEvent; import io.github.SebastianDanielFrenz.WorldEconomyPlugin.WEDB; import io.github.SebastianDanielFrenz.WorldEconomyPlugin.banking.BankAccount; import io.github.SebastianDanielFrenz.WorldEconomyPlugin.gui.BlockLib; import io.github.SebastianDanielFrenz.WorldEconomyPlugin.gui.GUIItem; import io.github.SebastianDanielFrenz.WorldEconomyPlugin.gui.WEGUI; public class BankAccountsGUI extends WEGUI { public BankAccountsGUI(WEGUI parent, Player player) { super(parent, new GUIItem[] {}, "Bank Accounts"); BankAccountsGUI out = this; List<GUIItem> items = new ArrayList<GUIItem>(); int slot = 9; items.add(new GUIItem(0, 4, mkItem(Material.OAK_SIGN, "Bank Accounts")) { @Override public void event(InventoryClickEvent event) { } }); try { List<BankAccount> bank_accounts = WEDB.getAllBankAccounts(player); for (BankAccount bank_account : bank_accounts) { items.add(new GUIItem(slot, mkItem(BlockLib.BANK_ACCOUNT, bank_account.getName(), new String[] { "§f" + WEDB.getBank(bank_account.getBankID()).name, String.valueOf(bank_account.getBalance()) })) { @Override public void event(InventoryClickEvent event) { new BankAccountGUI(out, bank_account).openInventory((Player) event.getWhoClicked()); } }); slot++; } setItems(convert(items)); } catch (SQLException e) { e.printStackTrace(); setErrorGUI(); } } }
ebbf19582e9fbe6b354e5fa8d51715965854bdc2
71ed92aa367cec2c793d85f42d8be2031d1fedb9
/src/jp/archesporeadventure/main/controllers/ChaosStormController.java
cb9958519712934680b9c74a0bdf47545aa3f7ee
[]
no_license
Archespore/ArchesporeAdventure
5086244ae6facc58050f722157f4ac96472afcbf
927fbb5d37440d399e535411fefe3987d8d1c667
refs/heads/master
2021-07-08T02:47:25.600374
2019-02-26T20:51:26
2019-02-26T20:51:26
141,615,079
0
0
null
null
null
null
UTF-8
Java
false
false
3,482
java
package jp.archesporeadventure.main.controllers; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ThreadLocalRandom; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import jp.archesporeadventure.main.utils.ParticleUtil; import jp.archesporeadventure.main.utils.PotionEffectUtil; public class ChaosStormController { //How many ticks per effect of chaos storm. private final static int CHAOS_STORM_EFFECT_TICKS_CYCLE = 50; //How many ticks per particle refresh. private final static int CHAOS_STORM_PARTICLE_TICKS_CYCLE = 20; //Chaos storm effect radius private final static int CHAOS_STORM_EFFECT_RADIUS = 8; private static Map<Location, Integer> chaosStormMap = new HashMap<>(); /** * Adds a chaos storm in the world at the specified location for the specified duration. * @param location the center of the storm. * @param duration amount of times the effect should go */ public static void addStormEffect(Location location, int duration) { chaosStormMap.put(location, duration); } /** * Removes the chaos storm effect with the center at the specified location. * @param location the center of the storm to remove. */ public static void removeStormEffect(Location location) { chaosStormMap.remove(location); } /** * Runs the chaos storm effects, creates particles and strikes lightning. * @param tickCount Used to determine if effects should run. */ public static void stormEffect(int tickCount) { if (tickCount % CHAOS_STORM_PARTICLE_TICKS_CYCLE == 0) { chaosStormMap.forEach( (location, duration) -> { for (int loopValue = 0; loopValue < 50; loopValue++) { double particleAngle = Math.toRadians((360.0 / 50.0) * loopValue); ParticleUtil.spawnWorldParticles(Particle.VILLAGER_ANGRY, location.clone().add(Math.cos(particleAngle) * CHAOS_STORM_EFFECT_RADIUS, 0, Math.sin(particleAngle) * CHAOS_STORM_EFFECT_RADIUS), 1, .1, 0, .1); } for (Entity entity : location.getWorld().getNearbyEntities(location, CHAOS_STORM_EFFECT_RADIUS, CHAOS_STORM_EFFECT_RADIUS, CHAOS_STORM_EFFECT_RADIUS)) { if (entity instanceof LivingEntity && location.distance(entity.getLocation()) <= CHAOS_STORM_EFFECT_RADIUS) { LivingEntity entityLiving = (LivingEntity) entity; PotionEffect newPotionEffect = PotionEffectUtil.comparePotionEffect(new PotionEffect(PotionEffectType.SLOW, 30, 1), entityLiving); entityLiving.addPotionEffect(newPotionEffect, true); } } }); } if (tickCount % CHAOS_STORM_EFFECT_TICKS_CYCLE == 0) { chaosStormMap.forEach( (location, duration) -> { double offsetAngle = Math.toRadians(ThreadLocalRandom.current().nextDouble(360)); double offsetLength = ThreadLocalRandom.current().nextDouble(CHAOS_STORM_EFFECT_RADIUS); Location stormEffect = location.clone().add(Math.cos(offsetAngle) * offsetLength, 0, Math.sin(offsetAngle) * offsetLength); World stormWorld = stormEffect.getWorld(); stormWorld.spigot().strikeLightning(stormEffect, true); stormWorld.createExplosion(stormEffect.getX(), stormEffect.getY(), stormEffect.getZ(), 1.5f, false, false); chaosStormMap.put(location, duration - 1); }); chaosStormMap.entrySet().removeIf( entry -> entry.getValue() <= 0); } } }
deb6f3863a47a219dc1758a53db2fb1e9b907817
ca115e90fea786d3ccf87cda3cf9fcafaf0c709a
/cascading-hadoop/src/main/shared/cascading/tap/hadoop/Dfs.java
3baa0c14de71e0723beea373067066dcd17a42f6
[ "Apache-2.0" ]
permissive
tdyas/cascading
b82d8eebbbac2f071de6441de41ae872b7ef4b0b
05720bf78c05d80606f0f81c3e68cc37139b8bda
refs/heads/wip-3.0
2021-01-18T00:00:39.486664
2015-02-25T05:34:29
2015-02-25T05:34:29
31,339,199
0
0
null
2015-02-25T22:29:51
2015-02-25T22:29:51
null
UTF-8
Java
false
false
3,762
java
/* * Copyright (c) 2007-2014 Concurrent, Inc. All Rights Reserved. * * Project and contact information: http://www.cascading.org/ * * This file is part of the Cascading project. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cascading.tap.hadoop; import java.beans.ConstructorProperties; import java.io.IOException; import java.net.URI; import cascading.scheme.Scheme; import cascading.tap.SinkMode; import cascading.tap.TapException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; /** * Class Dfs is a {@link cascading.tap.Tap} class that provides access to the Hadoop Distributed File System. * <p/> * Use the {@link URI} constructors to specify a different HDFS cluster than the default. */ public class Dfs extends Hfs { /** * Constructor Dfs creates a new Dfs instance. * * @param scheme of type Scheme * @param uri of type URI */ @ConstructorProperties( {"scheme", "uri"} ) public Dfs( Scheme scheme, URI uri ) { super( scheme, uri.getPath() ); init( uri ); } /** * Constructor Dfs creates a new Dfs instance. * * @param scheme of type Scheme * @param uri of type URI * @param sinkMode of type SinkMode */ @ConstructorProperties( {"scheme", "uri", "sinkMode"} ) public Dfs( Scheme scheme, URI uri, SinkMode sinkMode ) { super( scheme, uri.getPath(), sinkMode ); init( uri ); } /** * Constructor Dfs creates a new Dfs instance. * * @param scheme of type Scheme * @param stringPath of type String */ @ConstructorProperties( {"scheme", "stringPath"} ) public Dfs( Scheme scheme, String stringPath ) { super( scheme, stringPath ); } /** * Constructor Dfs creates a new Dfs instance. * * @param scheme of type Scheme * @param stringPath of type String * @param sinkMode of type SinkMode */ @ConstructorProperties( {"scheme", "stringPath", "sinkMode"} ) public Dfs( Scheme scheme, String stringPath, SinkMode sinkMode ) { super( scheme, stringPath, sinkMode ); } private void init( URI uri ) { if( !uri.getScheme().equalsIgnoreCase( "hdfs" ) ) throw new IllegalArgumentException( "uri must use the hdfs scheme" ); setUriScheme( URI.create( uri.getScheme() + "://" + uri.getAuthority() ) ); } protected void setStringPath( String stringPath ) { if( stringPath.matches( ".*://.*" ) && !stringPath.startsWith( "hdfs://" ) ) throw new IllegalArgumentException( "uri must use the hdfs scheme" ); super.setStringPath( stringPath ); } @Override protected FileSystem getDefaultFileSystem( Configuration configuration ) { String name = configuration.get( "fs.default.name", "hdfs://localhost:5001/" ); if( name.equals( "local" ) || name.matches( ".*://.*" ) && !name.startsWith( "hdfs://" ) ) name = "hdfs://localhost:5001/"; else if( name.indexOf( '/' ) == -1 ) name = "hdfs://" + name; try { return FileSystem.get( URI.create( name ), configuration ); } catch( IOException exception ) { throw new TapException( "unable to get handle to get filesystem for: " + name, exception ); } } }
6a37d7033ef1776d4b399e0a8445d17169fbfd4e
208af5d2219a18e2249178591e30f59dc9ade3d6
/src/test/java/com/cosium/vet/gerrit/DefaultPatchSetCommitMessageFactoryTest.java
42a655b5076fe990bd0b050d08818ccf53c9bb52
[ "MIT" ]
permissive
morristech/vet
ccc646aa3e373c9c131613d4a8633594a0a67091
2aa297004b5f882195ba76e1612c3f9605f12d43
refs/heads/master
2020-03-22T09:05:29.984791
2018-06-30T11:05:28
2018-06-30T11:05:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,788
java
package com.cosium.vet.gerrit; import com.cosium.vet.VetVersion; import com.cosium.vet.git.CommitMessage; import com.cosium.vet.git.GitClient; import org.junit.Before; import org.junit.Test; import java.util.regex.Matcher; import java.util.regex.Pattern; import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * Created on 08/05/18. * * @author Reda.Housni-Alaoui */ public class DefaultPatchSetCommitMessageFactoryTest { private static final String HELLO_WORLD = "Hello World"; private static final String HELLO_WORLD_MULTI_LINES = "Hello\n\nWorld\n!"; private GitClient git; private DefaultPatchSetCommitMessageFactory tested; @Before public void before() { git = mock(GitClient.class); tested = new DefaultPatchSetCommitMessageFactory(git); } @Test public void GIVEN_no_existing_changeid_WHEN_build_commitmessage_THEN_the_change_id_is_part_of_the_message() { when(git.getLastCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD)); CommitMessage commitMessage = tested.build(null); String rawMessage = commitMessage.toString(); Pattern pattern = Pattern.compile(Pattern.compile("Change-Id: ") + "I(.*)"); Matcher matcher = pattern.matcher(rawMessage); assertThat(matcher.find()).isTrue(); assertThat(matcher.group(1)).isNotBlank(); } @Test public void WHEN_last_commit_message_hello_world_THEN_commit_message_should_contain_hello_world() { when(git.getLastCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD)); CommitMessage commitMessage = tested.build(null); assertThat(commitMessage.toString()).contains(HELLO_WORLD); } @Test public void GIVEN_existing_change_WHEN_existing_message_contains_blank_lines_THEN_the_new_message_should_preserve_them() { when(git.getLastCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD_MULTI_LINES)); CommitMessage commitMessage = tested.build(null); assertThat(commitMessage.toString()).contains(HELLO_WORLD_MULTI_LINES); } @Test public void WHEN_changeid_I1234_THEN_commit_message_should_end_with_I1234() { Patch patch = mock(Patch.class); when(patch.getCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD + "\nChange-Id: I1234")); CommitMessage commitMessage = tested.build(patch); assertThat(commitMessage.toString()).endsWith("\nChange-Id: I1234"); } @Test public void WHEN_existing_change_THEN_commit_message_contains_VET_VERSION() { when(git.getLastCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD)); CommitMessage commitMessage = tested.build(null); assertThat(commitMessage.toString()).contains("\nVet-Version: " + VetVersion.getValue()); } }
3920c25769f6871541de2e7cfc5de552a06b8fb1
8dd0f424ba16b49518566e4982d2ceb6ded19ee3
/target/generated-sources/annotations/entity/MenuDelDia_.java
75ee7095e6f84b0a4ad1a8e99a77e600523a2e57
[]
no_license
unabroder/RestauranteBongustaio
80fae8eb05dcb25daceafa02a35fcf5a554ba268
539392a9d7bad47f2cb0349f69f598c9537a8ee5
refs/heads/master
2022-07-14T02:59:39.778799
2020-01-16T19:08:14
2020-01-16T19:08:14
234,337,929
0
0
null
2022-06-30T20:22:40
2020-01-16T14:27:13
HTML
UTF-8
Java
false
false
648
java
package entity; import entity.Plato_Completo; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2020-01-15T09:33:56") @StaticMetamodel(MenuDelDia.class) public class MenuDelDia_ { public static volatile SingularAttribute<MenuDelDia, Integer> estado; public static volatile SingularAttribute<MenuDelDia, Double> descuento; public static volatile SingularAttribute<MenuDelDia, Integer> idmenu; public static volatile SingularAttribute<MenuDelDia, Plato_Completo> plato_Completo; }
fab890c60d4e42609a1c97f1483c4880644de287
8238160ccf1059953ee026a387798ae92c40a5e2
/src/main/java/com/akos/sphero/common/internal/ids/RobotCommandId.java
79a592ca60e3dd71afd421d9bec52487900d11a9
[]
no_license
eranor/bcpraca
65a38b9a24e186abd0c70982aa2edc36d9aeb86b
555f6f74bffe502aa2b847d217c6e1705e0ad9c4
refs/heads/master
2021-01-15T08:37:18.514461
2016-07-17T13:43:14
2016-07-17T13:43:14
59,164,353
0
0
null
2016-07-17T11:55:19
2016-05-19T01:39:20
Java
UTF-8
Java
false
false
1,660
java
package com.akos.sphero.common.internal.ids; /** * @author: Orbotix * @author: Ákos Hervay([email protected]) (modifier) */ public enum RobotCommandId implements Id { CALIBRATE(1), SET_HEADING(1), STABILIZATION(2), ROTATION_RATE(3), GET_CHASSIS_ID(7), SELF_LEVEL(9), SET_DATA_STREAMING(17), CONFIGURE_COLLISION_DETECTION(18), CONFIGURE_LOCATOR(19), READ_LOCATOR(21), RGB_LED_OUTPUT(32), BACK_LED_OUTPUT(33), GET_LED_COLOR(34), ROLL(48), BOOST(49), RAW_MOTOR(51), SET_MOTION_TIMEOUT(52), SET_OPTION_FLAGS(53), GET_OPTION_FLAGS(54), SET_TEMPORARY_OPTION_FLAGS(55), GET_TEMPORARY_OPTION_FLAGS(56), GET_SKU(58), GET_CONFIGURATION_BLOCK(64), COMMIT_RAM_TO_FLASH(65), SET_DEVICE_MODE(66), GET_DEVICE_MODE(68), RUN_MACRO(80), SAVE_TEMPORARY_MACRO(81), SAVE_MACRO(82), INIT_MACRO_EXECUTIVE(84), ABORT_MACRO(85), SAVE_TEMPORARY_MACRO_CHUNK(88), ORB_BASIC_ERASE_STORAGE(96), ORB_BASIC_APPEND_FRAGMENT(97), ORB_BASIC_EXECUTE_PROGRAM(98), ORB_BASIC_ABORT_PROGRAM(99), SUBMIT_VALUE_TO_INPUT_STATEMENT(100), APPEND_OVAL_COMPLETE(128), RESET_OVM(129), APPEND_OVAL_FRAGMENT(131), GET_ODOMETER(117); private byte value; RobotCommandId(int value) { this.value = (byte) value; } public byte getValue() { return this.value; } public static RobotCommandId getRobotCommandId(int value) { for (RobotCommandId id : values()) { if (id.value == value) return id; } throw new RuntimeException("Illegal Argument - no such id"); } }
b5d995b54ad10e9741f422868e60096dfcbd5320
b292097d67449381fcfe36cd21fbba477f0e1ae9
/src/test/java/store/CommonApplyTest.java
d569f02f72e2b6bd4fecbc09e7b7cf4939a18475
[]
no_license
QM-Developers/interface-test
5860fe5bd4f2e925a02ead33bb6b39179cc9ea97
1a55b4a064fc775688b6c1ea7336c822f0a167ef
refs/heads/master
2021-07-25T12:00:16.635252
2017-11-03T10:13:00
2017-11-03T10:13:00
107,392,714
0
0
null
null
null
null
UTF-8
Java
false
false
11,987
java
package store; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import constant.CoreConstant; import okhttp3.*; import util.IDGenerator; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; public class CommonApplyTest { private static String BASE_URL = CoreConstant.URL_BASE_LOCAL; public static void main(String[] args) { try { // String result = findDepartmentList(); // String result = findMemberList(); // String result = saveCommonApply(); // String result = saveCommonApplyImage(); // String result = listCommonApplyByProposer(); // String result = listCommonApplyByApprove(); // String result = updateCommonApplyAccept(); // String result = updateCommonApplyRefuse(); String result = getCommonApply(); System.out.println(result); } catch (IOException e) { e.printStackTrace(); } } private static String getCommonApply() throws IOException { String url = BASE_URL + "/s/getCommonApply" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build(); JSONObject params = new JSONObject(); params.put("userId", "9f6bc79d769342f1b90ed0b532b870f2"); params.put("myTeamId", "10001"); params.put("token", "1"); params.put("applyId", "af2b01d9792a4f9db1c6c4dd2e4a8505"); System.out.println(params.toJSONString()); FormBody.Builder builder = new FormBody.Builder(); for (String key : params.keySet()) builder.add(key, params.get(key).toString()); Request request = new Request.Builder().post(builder.build()).url(url).build(); Call call = okHttpClient.newCall(request); Response response = call.execute(); if (response.isSuccessful()) return response.body().string(); else return String.valueOf(response.code()); } private static String updateCommonApplyRefuse() throws IOException { String url = BASE_URL + "/s/updateCommonApplyRefuse" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build(); JSONObject params = new JSONObject(); params.put("userId", "9f6bc79d769342f1b90ed0b532b870f2"); params.put("myTeamId", "10001"); params.put("token", "1"); params.put("applyId", "223b5684a88c4875a69291f38a3e3fa1"); params.put("approveAdvice", "建议"); params.put("approveSequence", "2"); System.out.println(params.toJSONString()); FormBody.Builder builder = new FormBody.Builder(); for (String key : params.keySet()) builder.add(key, params.get(key).toString()); Request request = new Request.Builder().post(builder.build()).url(url).build(); Call call = okHttpClient.newCall(request); Response response = call.execute(); if (response.isSuccessful()) return response.body().string(); else return String.valueOf(response.code()); } private static String listCommonApplyByApprove() throws IOException { String url = BASE_URL + "/s/listCommonApplyByApprove" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build(); JSONObject params = new JSONObject(); params.put("userId", "0420cb22c06b43a488c39967779eecec"); params.put("myTeamId", "10001"); params.put("token", "1"); params.put("pageNum", "1"); params.put("pageSize", "10"); // params.put("applyResult", "10"); System.out.println(params.toJSONString()); FormBody.Builder builder = new FormBody.Builder(); for (String key : params.keySet()) builder.add(key, params.get(key).toString()); Request request = new Request.Builder().post(builder.build()).url(url).build(); Call call = okHttpClient.newCall(request); Response response = call.execute(); if (response.isSuccessful()) return response.body().string(); else return String.valueOf(response.code()); } private static String updateCommonApplyAccept() throws IOException { String url = BASE_URL + "/s/updateCommonApplyAccept" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build(); JSONObject params = new JSONObject(); params.put("userId", "5a27d0f892cd48a482622f8b76fd239c"); params.put("myTeamId", "10001"); params.put("token", "1"); params.put("applyId", "223b5684a88c4875a69291f38a3e3fa1"); params.put("approveAdvice", "意见"); params.put("approveSequence", "1"); System.out.println(params.toJSONString()); FormBody.Builder builder = new FormBody.Builder(); for (String key : params.keySet()) builder.add(key, params.get(key).toString()); Request request = new Request.Builder().post(builder.build()).url(url).build(); Call call = okHttpClient.newCall(request); Response response = call.execute(); if (response.isSuccessful()) return response.body().string(); else return String.valueOf(response.code()); } private static String listCommonApplyByProposer() throws IOException { String url = BASE_URL + "/s/listCommonApplyByProposer" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build(); JSONObject params = new JSONObject(); params.put("userId", "89d9317fb3834353bcf2a507bee2eb82"); params.put("myTeamId", "10001"); params.put("token", "1"); params.put("pageNum", "1"); params.put("pageSize", "10"); params.put("applyResult", "13"); System.out.println(params.toJSONString()); FormBody.Builder builder = new FormBody.Builder(); for (String key : params.keySet()) builder.add(key, params.get(key).toString()); Request request = new Request.Builder().post(builder.build()).url(url).build(); Call call = okHttpClient.newCall(request); Response response = call.execute(); if (response.isSuccessful()) return response.body().string(); else return String.valueOf(response.code()); } private static String saveCommonApplyImage() throws IOException { String url = BASE_URL + "/s/saveCommonApplyImage" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient(); File file = new File("C:\\Users\\Administrator\\Desktop\\temp\\wallhaven-513297.jpg"); JSONObject params = new JSONObject(); params.put("userId", "9f6bc79d769342f1b90ed0b532b870f2"); params.put("token", IDGenerator.generator()); params.put("myTeamId", "10001"); params.put("img", "图片"); System.out.println(params.toJSONString()); params.remove("img"); MultipartBody.Builder builder = new MultipartBody.Builder(); builder.setType(MultipartBody.FORM); for (String key : params.keySet()) builder.addFormDataPart(key, params.get(key).toString()); builder.addFormDataPart("img", file.getName(), RequestBody.create(MediaType.parse("image/png"), file)); RequestBody requestBody = builder.build(); Request request = new Request.Builder().url(url).post(requestBody).build(); Response response = okHttpClient.newCall(request).execute(); return response.body().string(); } private static String saveCommonApply() throws IOException { String url = BASE_URL + "/s/saveCommonApply" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build(); JSONObject params = new JSONObject(); JSONArray approve = new JSONArray(); JSONArray img = new JSONArray(); JSONObject app1 = new JSONObject(); JSONObject app2 = new JSONObject(); JSONObject img1 = new JSONObject(); app1.put("approveId","5a27d0f892cd48a482622f8b76fd239c"); app1.put("approveName","王舞欣"); app1.put("approveSequence","1"); app2.put("approveId","9f6bc79d769342f1b90ed0b532b870f2"); app2.put("approveName","李思思"); app2.put("approveSequence","2"); img1.put("imageId","a3ad0592c5324e2b8f9fe46aa8047f31"); approve.add(app1); approve.add(app2); img.add(img1); params.put("userId", "89d9317fb3834353bcf2a507bee2eb82"); params.put("myTeamId", "10001"); params.put("token", "1"); params.put("applyTitle", "1"); params.put("beginDate", "1"); params.put("endDate", "1"); params.put("applyReason", "1"); params.put("commonApplyApprove", approve.toJSONString()); params.put("commonApplyImage", img.toJSONString()); System.out.println(params.toJSONString()); FormBody.Builder builder = new FormBody.Builder(); for (String key : params.keySet()) builder.add(key, params.get(key).toString()); Request request = new Request.Builder().post(builder.build()).url(url).build(); Call call = okHttpClient.newCall(request); Response response = call.execute(); if (response.isSuccessful()) return response.body().string(); else return String.valueOf(response.code()); } private static String findMemberList() throws IOException { String url = BASE_URL + "/s/findMemberList" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build(); JSONObject params = new JSONObject(); params.put("userId", "89d9317fb3834353bcf2a507bee2eb82"); params.put("myTeamId", "10001"); params.put("token", "1"); params.put("departmentId", "4bc0ec2d68a444e7a584b9f8d03cbc44"); System.out.println(params.toJSONString()); FormBody.Builder builder = new FormBody.Builder(); for (String key : params.keySet()) builder.add(key, params.get(key).toString()); Request request = new Request.Builder().post(builder.build()).url(url).build(); Call call = okHttpClient.newCall(request); Response response = call.execute(); if (response.isSuccessful()) return response.body().string(); else return String.valueOf(response.code()); } private static String findDepartmentList() throws IOException { String url = BASE_URL + "/s/findDepartmentList" + CoreConstant.URL_SUFFIX; OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build(); JSONObject params = new JSONObject(); params.put("userId", "89d9317fb3834353bcf2a507bee2eb82"); params.put("myTeamId", "10001"); params.put("token", "1"); System.out.println(params.toJSONString()); FormBody.Builder builder = new FormBody.Builder(); for (String key : params.keySet()) builder.add(key, params.get(key).toString()); Request request = new Request.Builder().post(builder.build()).url(url).build(); Call call = okHttpClient.newCall(request); Response response = call.execute(); if (response.isSuccessful()) return response.body().string(); else return String.valueOf(response.code()); } }
e808a1f9aa2ecd98c95286c9aa2012a4ee44f233
1dafd0cf9f5ac87e56af1b10448e16c540aacbb5
/src/test/java/com/springboot/core/SumOfTwoNumbersApplicationTests.java
8a177578144d50f10e487789b62af51f2c5e3f93
[]
no_license
dmvali/SumOfTwoNumbersWithSpringBoot
75ca1c25c927cd0299a686a5f54114be51ee5a71
fd928e0601c4d4875017e1c66184743910cd8de5
refs/heads/master
2022-04-16T15:45:53.242653
2020-04-10T18:39:11
2020-04-10T18:39:11
254,706,425
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package com.springboot.core; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import com.springboot.core.beans.SumExample; @SpringBootTest class SumOfTwoNumbersApplicationTests { @Autowired private SumExample sumExample; @Test void testSumOfTwoNumbers() { assertEquals(10, sumExample.add(5, 5)); } }
2817b302188c20e78d35dbd2db180a242d15fc68
7d5e26f10f07ee1c415200391893a3e23d410e0a
/KnightingaleWeek2/LoopingConstruct.java
6d21fd2ccfa31fc5b2c5238ef66e3821571194a1
[]
no_license
syed747/FullStackJava
82398b876900d2755a0d30969f0f2012ea44e551
7348cc682537abb3374cea8ad3deb22a99c0dfbe
refs/heads/main
2023-08-14T15:45:38.585555
2021-10-02T10:09:18
2021-10-02T10:09:18
397,739,555
0
0
null
null
null
null
UTF-8
Java
false
false
1,204
java
package KnightingaleWeek2; import java.util.Scanner; public class LoopingConstruct { public static void main(String[] args) { //My objective is to print n even numbers. Scanner scan=new Scanner(System.in); System.out.println("Enter a n number..:"); int n=scan.nextInt(); System.out.println("looping starts.............."); while(n>0) {//untill the expression returns true the loop will continue...while is a precheck loop if(n%2==0) { System.out.println(n+" is even number...."); } --n; } System.out.println("looping ends............."); n=10; do { if(n%2!=0) { System.out.println(n+" is odd number...."); } --n; }while(n>0); for(int i=0;i<10;i++) { if(i%2==0) { System.out.println("Even number...."+i); } } n=10; for(;n>0;n--) { if(n%2!=0) { System.out.println("Odd number...."+n); } } for(int i=0;i<10;i++) { if(i%2==0) { System.out.println("Even number...."+i); } } n=10; for(;n>0;n--) { if(n%2!=0) { System.out.println("Odd number...."+n); } } for(int x=0,y=10; x<10 && y>0; x++,y--) { System.out.println(x+":"+y); } } }
a2c8381ff93eccad606acd2604f0fe0191f81f0b
9cf44473699b3bfd7c9d7ca7ecc49e315f59b362
/app/src/main/java/me/xiezefan/easyim/common/FriendHelper.java
993600eeab2e8c7eda5294222c4dcb1504bbb5e7
[]
no_license
dlsyj/EasyIM-Android
a1595d65e1354dc1bbfb34ac662e5c49cde8a29d
a271fa3323682b06ea8b1bce5c96a5fa872e4ece
refs/heads/master
2021-01-18T12:36:42.513528
2015-07-16T13:49:17
2015-07-16T13:49:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package me.xiezefan.easyim.common; import android.text.TextUtils; import me.xiezefan.easyim.dao.Friend; /** * Friend Entity Helper * Created by xiezefan on 15/5/16. */ public class FriendHelper { public String getDisplayName(Friend friend) { if (TextUtils.isEmpty(friend.getNickname())) { return friend.getUsername(); } else { return friend.getNickname(); } } }
7805df93b6db942f1bdbb7a70ff37107ad1da0f2
71071f98d05549b67d4d6741e8202afdf6c87d45
/files/Spring_Data_Redis/DATAREDIS-314/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisZSet.java
c900ecb78de680b11ac3522c8d072c4259df72d2
[]
no_license
Sun940201/SpringSpider
0adcdff1ccfe9ce37ba27e31b22ca438f08937ad
ff2fc7cea41e8707389cb62eae33439ba033282d
refs/heads/master
2022-12-22T09:01:54.550976
2018-06-01T06:31:03
2018-06-01T06:31:03
128,649,779
1
0
null
2022-12-16T00:51:27
2018-04-08T14:30:30
Java
UTF-8
Java
false
false
6,720
java
/* * Copyright 2011-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.data.redis.support.collections; import java.util.Collection; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Set; import org.springframework.data.redis.connection.DataType; import org.springframework.data.redis.core.BoundZSetOperations; import org.springframework.data.redis.core.RedisOperations; import org.springframework.data.redis.core.ZSetOperations.TypedTuple; /** * Default implementation for {@link RedisZSet}. Note that the collection support works only with normal, * non-pipeline/multi-exec connections as it requires a reply to be sent right away. * * @author Costin Leau */ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements RedisZSet<E> { private final BoundZSetOperations<String, E> boundZSetOps; private double defaultScore = 1; private class DefaultRedisSortedSetIterator extends RedisIterator<E> { public DefaultRedisSortedSetIterator(Iterator<E> delegate) { super(delegate); } protected void removeFromRedisStorage(E item) { DefaultRedisZSet.this.remove(item); } } /** * Constructs a new <code>DefaultRedisZSet</code> instance with a default score of '1'. * * @param key * @param operations */ public DefaultRedisZSet(String key, RedisOperations<String, E> operations) { this(key, operations, 1); } /** * Constructs a new <code>DefaultRedisSortedSet</code> instance. * * @param key * @param operations * @param defaultScore */ public DefaultRedisZSet(String key, RedisOperations<String, E> operations, double defaultScore) { super(key, operations); boundZSetOps = operations.boundZSetOps(key); this.defaultScore = defaultScore; } /** * Constructs a new <code>DefaultRedisZSet</code> instance with a default score of '1'. * * @param boundOps */ public DefaultRedisZSet(BoundZSetOperations<String, E> boundOps) { this(boundOps, 1); } /** * Constructs a new <code>DefaultRedisZSet</code> instance. * * @param boundOps * @param defaultScore */ public DefaultRedisZSet(BoundZSetOperations<String, E> boundOps, double defaultScore) { super(boundOps.getKey(), boundOps.getOperations()); this.boundZSetOps = boundOps; this.defaultScore = defaultScore; } public RedisZSet<E> intersectAndStore(RedisZSet<?> set, String destKey) { boundZSetOps.intersectAndStore(set.getKey(), destKey); return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore()); } public RedisZSet<E> intersectAndStore(Collection<? extends RedisZSet<?>> sets, String destKey) { boundZSetOps.intersectAndStore(CollectionUtils.extractKeys(sets), destKey); return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore()); } public Set<E> range(long start, long end) { return boundZSetOps.range(start, end); } public Set<E> reverseRange(long start, long end) { return boundZSetOps.reverseRange(start, end); } public Set<E> rangeByScore(double min, double max) { return boundZSetOps.rangeByScore(min, max); } public Set<E> reverseRangeByScore(double min, double max) { return boundZSetOps.reverseRangeByScore(min, max); } public Set<TypedTuple<E>> rangeByScoreWithScores(double min, double max) { return boundZSetOps.rangeByScoreWithScores(min, max); } public Set<TypedTuple<E>> rangeWithScores(long start, long end) { return boundZSetOps.rangeWithScores(start, end); } public Set<TypedTuple<E>> reverseRangeByScoreWithScores(double min, double max) { return boundZSetOps.reverseRangeByScoreWithScores(min, max); } public Set<TypedTuple<E>> reverseRangeWithScores(long start, long end) { return boundZSetOps.reverseRangeWithScores(start, end); } public RedisZSet<E> remove(long start, long end) { boundZSetOps.removeRange(start, end); return this; } public RedisZSet<E> removeByScore(double min, double max) { boundZSetOps.removeRangeByScore(min, max); return this; } public RedisZSet<E> unionAndStore(RedisZSet<?> set, String destKey) { boundZSetOps.unionAndStore(set.getKey(), destKey); return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore()); } public RedisZSet<E> unionAndStore(Collection<? extends RedisZSet<?>> sets, String destKey) { boundZSetOps.unionAndStore(CollectionUtils.extractKeys(sets), destKey); return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore()); } public boolean add(E e) { Boolean result = add(e, getDefaultScore()); checkResult(result); return result; } public boolean add(E e, double score) { Boolean result = boundZSetOps.add(e, score); checkResult(result); return result; } public void clear() { boundZSetOps.removeRange(0, -1); } public boolean contains(Object o) { return (boundZSetOps.rank(o) != null); } public Iterator<E> iterator() { Set<E> members = boundZSetOps.range(0, -1); checkResult(members); return new DefaultRedisSortedSetIterator(members.iterator()); } public boolean remove(Object o) { Long result = boundZSetOps.remove(o); checkResult(result); return result == 1; } public int size() { Long result = boundZSetOps.size(); checkResult(result); return result.intValue(); } public Double getDefaultScore() { return defaultScore; } public E first() { Set<E> members = boundZSetOps.range(0, 0); checkResult(members); Iterator<E> iterator = members.iterator(); if (iterator.hasNext()) return iterator.next(); throw new NoSuchElementException(); } public E last() { Set<E> members = boundZSetOps.reverseRange(0, 0); checkResult(members); Iterator<E> iterator = members.iterator(); if (iterator.hasNext()) return iterator.next(); throw new NoSuchElementException(); } public Long rank(Object o) { return boundZSetOps.rank(o); } public Long reverseRank(Object o) { return boundZSetOps.reverseRank(o); } public Double score(Object o) { return boundZSetOps.score(o); } public DataType getType() { return DataType.ZSET; } }
5e45c575e1673f4b968014e022daaf7edbd4b4af
2e9c822c22e48dee0d6a1f6f8d7759980b093b6c
/src/main/java/kr/or/ddit/payment/dao/IPaymentDao.java
a375df0d897e2f6f3a197e2cc3d1c9425210325b
[]
no_license
RockPotato/EndoRPhin
631ff5233f05957f3602a9f0df6bc9161979e9cb
67c7651341517854a8216631f36716963bf42b14
refs/heads/master
2020-05-23T15:07:14.427856
2019-05-15T13:06:19
2019-05-15T13:06:19
186,819,659
0
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
package kr.or.ddit.payment.dao; import java.util.List; import java.util.Map; import kr.or.ddit.payment.model.PaymentVo; import kr.or.ddit.util.model.PageVo; public interface IPaymentDao { int insertPayment(PaymentVo paymentVo); int updatePayment(PaymentVo paymentVo); List<PaymentVo> getAllPayment(); PaymentVo selectPayment(String paycode); int deletePayment(String paycode); List<PaymentVo> getPayment_u(String userId); List<PaymentVo> getPaymentList(PageVo pageVo); List<PaymentVo> getPaymentListByUserNm(String usernm); String getMaxPayment(); String searchPaymentDupl(PaymentVo paymentVo); List<PaymentVo> selectTotalSalaryByDay(String payDay); List<PaymentVo> selectPersonalPaymentList(Map<String, Object> payDay); List<PaymentVo> selectYearPaymentList(Map<String, Object> payDay); List<PaymentVo> selectYearPaymentListDetail(Map<String, Object> payDay); String paycodeByIdnDay(PaymentVo paymentVo); String selectincometax(String divsalary); List<PaymentVo> selectDeptNPayment(String paydayMonth); int getPaymentCnt(); List<PaymentVo> getPaymentForAdjust(String payDay); }
e9d90fa66540756cbade4b3d0f9803e2074fa931
3b1d9380af6b08a15c932b8aad0d5a34d78a8826
/src/main/java/com/brweber2/term/Numeric.java
59c2b6700ab1025f6f83fdca0790dd99f02f65a4
[]
no_license
brweber2/naive-java-unification
55f6b9810f0b5ede779366f9d94cb055dbb21e7d
712b1370b9118dba72d603d5b1e80067d0539ec0
refs/heads/master
2020-06-02T08:36:52.946920
2012-01-28T21:01:16
2012-01-28T21:01:16
3,130,409
0
2
null
null
null
null
UTF-8
Java
false
false
812
java
package com.brweber2.term; /** * @author brweber2 * Copyright: 2012 */ public class Numeric implements Term { private final String number; public Numeric(String number) { this.number = number; } @Override public String prettyPrint() { return number; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Numeric numeric = (Numeric) o; if (!number.equals(numeric.number)) return false; return true; } @Override public int hashCode() { return number.hashCode(); } @Override public String toString() { return "Numeric{" + "number='" + number + '\'' + '}'; } }
82a9d74153404157154237e8ce7dc1b14f6f1f7e
a8268f79846f6337884ba231b05051b02bc5e8ee
/ego-parent/egoparent/ego-order/src/main/java/com/ego/order/controller/OrderController.java
0227c45d825f9711b3e9604a48573636b8363ede
[]
no_license
auberge/ego
cbee3314454a002af4ad7159677b1a3fc86fcf42
f781e6dd55fa008e44d178bda889129e2a5e96ef
refs/heads/master
2022-12-18T18:35:39.141145
2020-02-28T19:37:56
2020-02-28T19:37:56
240,576,262
0
0
null
2022-12-16T05:46:59
2020-02-14T18:43:01
CSS
UTF-8
Java
false
false
1,347
java
package com.ego.order.controller; import com.ego.commons.pojo.EgoResult; import com.ego.order.pojo.MyOrderParam; import com.ego.order.service.TbOrderService; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.List; @Controller public class OrderController { @Resource private TbOrderService tbOrderServiceImpl; /** * 显示订单确认页面 */ @RequestMapping("order/order-cart.html") public String showOrder(@RequestParam("id") List<Long> ids, Model model, HttpServletRequest request) { model.addAttribute("cartList", tbOrderServiceImpl.showOrderCart(ids, request)); return "order-cart"; } /** * 创建订单 */ @RequestMapping("order/create.html") public String createOrder(MyOrderParam param, HttpServletRequest request) { EgoResult result = tbOrderServiceImpl.create(param, request); if (result.getStatus() == 200) { return "my-orders"; } else { request.setAttribute("message", "订单创建失败!"); return "error/exception"; } } }
fd7a8f9296f1b6e223a1e018a64a82f5f15ac353
3fe0ddeae2eae9fcc06c9cfac4acf220f6222c48
/src/test/java/com/test/ip_test/IpTestApplicationTests.java
01ac87a83dd64f6dd83743f699340567e7b9590d
[]
no_license
yangjiamu/ip_test
3356317c2bff2280ac8be14614ee4cbb173f564e
791c566d779f33973a1441d5a5849aa571690846
refs/heads/master
2020-03-19T11:25:07.715147
2018-06-07T09:51:48
2018-06-07T09:51:48
136,454,942
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.test.ip_test; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class IpTestApplicationTests { @Test public void contextLoads() { } }
d8b7fdd9fc7efd3969a408c450b885ecc7d535ab
a934ca8a86094e47b61893559b16eea38b0cd5e2
/S05D02/vjezbeTask2/Main.java
bafa1d31174c0cc4e259d5b8e44bb2193b8377a1
[]
no_license
dinkohodzic/Zadace
bd56e8900c3161157352aaa2a2e7842fc7d5e6db
3e033fa03d9ce7ea8af36f85e56b5b6356995351
refs/heads/master
2016-08-03T22:18:21.752457
2015-06-16T21:38:46
2015-06-16T21:38:46
36,193,432
0
0
null
null
null
null
UTF-8
Java
false
false
629
java
package ba.bitcamp.vjezbeTask2; import java.io.ObjectInputStream.GetField; public class Main { public static void main(String[] args) { Glass g1 = new Glass(100); System.out.println("The current liquid is: "+g1.getLiquid()); System.out.println("The max capacity is: "+ g1.getMaxCapacity()); g1.addLiquid("Coca Cola", 35); System.out.println("The current capacity is: " + g1.getCurrentCapacity()); g1.addLiquid("Coca Cola", 70); System.out.println("The current capacity is: " + g1.getCurrentCapacity()); g1.emtyGlass(); System.out.println("The current capacity is: " + g1.getCurrentCapacity()); } }
bcd56713a227f2449f9b568649195218d359d93f
f7453885a521e776ec53a47f8c18e2509eb6578f
/src/com/ruslanito/Core/Core_Collection/ArrayListCopyToArrayList.java
9314ae89096025c2205a00867cb5658909613e3d
[]
no_license
Ruslanito/JavaX
e22953b2e091c5f6835ea0baf32772f4c31ffd8e
c1598c30c13c08e9c1f950a76e2c334afc69fd86
refs/heads/master
2020-03-21T08:27:31.952745
2018-08-24T14:07:27
2018-08-24T14:07:27
138,344,964
1
0
null
null
null
null
UTF-8
Java
false
false
821
java
package com.ruslanito.Core.Core_Collection; import java.util.ArrayList; import java.util.Collections; public class ArrayListCopyToArrayList { public static void main(String[] args) { ArrayList<String> arrayList1 = new ArrayList<String>(); arrayList1.add("1"); arrayList1.add("2"); arrayList1.add("3"); ArrayList<String> arrayList2 = new ArrayList<String>(); arrayList2.add("One"); arrayList2.add("Two"); arrayList2.add("Three"); arrayList2.add("Four"); arrayList2.add("Five"); arrayList2.add("Six"); System.out.println("arrayList1: "+arrayList1); System.out.println("arrayList2: "+arrayList2); Collections.copy(arrayList2,arrayList1); System.out.println("arrsyList2: "+ arrayList2); } }
37761f0988288796d681f3c086efbf08b9388104
f445b28c950b29fa4ec13d3c2d53a67bce997dd3
/src/main/java/com/strongloop/android/loopback/Container.java
8eb6e9203eeb028c387adce5b6f52ef8674fa7f5
[ "MIT" ]
permissive
gmxtian/loopback-android
7a015b9ec54acf825b8a466b0a3105ab5b2d6513
d52142cc1b1a274a9686afdf9c7e883462d5175b
refs/heads/master
2021-01-21T02:52:40.181534
2014-02-09T22:03:02
2014-02-09T22:03:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,091
java
package com.strongloop.android.loopback; import org.json.JSONObject; import com.strongloop.android.remoting.adapters.Adapter; public class Container extends Model { private String name; public void setName(String name) { this.name = name; } public String getName() { return name; } public void delete(final Callback callback) { invokeMethod("remove", toMap(), new Adapter.JsonObjectCallback() { @Override public void onError(Throwable t) { callback.onError(t); } @Override public void onSuccess(JSONObject response) { callback.onSuccess(); } }); } public void getFile( String fileName, final FileRepository.FileCallback callback) { ContainerRepository containerRepo = (ContainerRepository) getRepository(); FileRepository fileRepo = containerRepo.getFileRepository(); fileRepo.get(getName(), fileName, callback); } }
e32517b8b782c7d7320e808f3e00b92ee6f1ee74
fdbb904342397735024f130e1965b966cc3e7a01
/src/main/java/io/github/yutoeguma/app/LoginCheckAction.java
76044090d10b6cf62f1b18257beb0f8dda0e3532
[]
no_license
YutoEguma/SampleWebbServer
fb4084fb1a8cdeca850ecdc449f207c3a7cc1fcb
ca61adb8944aee967ac9176b11d2158d6adc7b6f
refs/heads/master
2020-05-26T06:21:22.600585
2018-05-25T15:06:59
2018-05-25T15:08:30
82,468,268
0
0
null
null
null
null
UTF-8
Java
false
false
1,723
java
package io.github.yutoeguma.app; import io.github.yutoeguma.contents.ContentsLoader; import io.github.yutoeguma.dummy.SessionStorage; import io.github.yutoeguma.enums.HttpStatus; import io.github.yutoeguma.http.message.HttpRequest; import io.github.yutoeguma.http.message.HttpResponse; import org.apache.log4j.Logger; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author cabos */ public class LoginCheckAction { private static final Logger logger = Logger.getLogger(LoginCheckAction.class); private static ContentsLoader loader = ContentsLoader.get(); private static SessionStorage storage = SessionStorage.get(); static public HttpResponse check$get(HttpRequest request) { logger.info(request); String sessionId = getSessionId(request); if (sessionId == null) { return new HttpResponse(HttpStatus.BAD_REQUEST, loader.loadContents("/ng.html")); } return new HttpResponse(HttpStatus.OK, loader.loadContents("/ok.html")); } private static String getSessionId(HttpRequest request) { String cookie = request.getRequestHeaderAttr().get("Cookie"); logger.info(cookie); if (cookie == null) { return null; } Map<String, String> map = new HashMap<>(); List<String> strings = Arrays.asList(cookie.split(";")); strings.stream().map(c -> c.trim()).forEach(c -> { List<String> cookieKeyValue = Arrays.asList(c.split("=")); if (cookieKeyValue.size() == 2) { map.put(cookieKeyValue.get(0), cookieKeyValue.get(1)); } }); return map.get("CABOSESSIONID"); } }
f5af13e81ae8226c2fb3b3745badd2830a061f9d
96a24b3d53f0d6d3a95ec2db6a419f1828ee3ddf
/server/src/main/java/ru/hsHelper/api/services/impl/UserServiceImpl.java
b24c916e7dd18dd599caa15b24bba1c8f442a25e
[ "MIT" ]
permissive
HSHelper/HSHelper
ae29fb82a6edc42f7d961f6373f8d75c5d94ba93
8ad2f5227325a4da263209b0fcd7ab6f89ae7780
refs/heads/main
2023-07-17T05:22:48.988453
2021-09-08T12:26:40
2021-09-08T12:26:40
344,596,407
2
5
MIT
2021-06-17T09:53:14
2021-03-04T20:09:31
Java
UTF-8
Java
false
false
17,465
java
package ru.hsHelper.api.services.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import ru.hsHelper.api.entities.Course; import ru.hsHelper.api.entities.CoursePart; import ru.hsHelper.api.entities.Group; import ru.hsHelper.api.entities.Notification; import ru.hsHelper.api.entities.Partition; import ru.hsHelper.api.entities.User; import ru.hsHelper.api.entities.UserCoursePartRole; import ru.hsHelper.api.entities.UserCourseRole; import ru.hsHelper.api.entities.UserGroupRole; import ru.hsHelper.api.entities.UserToPartition; import ru.hsHelper.api.entities.UserWork; import ru.hsHelper.api.entities.Work; import ru.hsHelper.api.repositories.CoursePartRepository; import ru.hsHelper.api.repositories.CourseRepository; import ru.hsHelper.api.repositories.GroupRepository; import ru.hsHelper.api.repositories.NotificationRepository; import ru.hsHelper.api.repositories.PartitionRepository; import ru.hsHelper.api.repositories.UserCoursePartRoleRepository; import ru.hsHelper.api.repositories.UserCourseRoleRepository; import ru.hsHelper.api.repositories.UserGroupRoleRepository; import ru.hsHelper.api.repositories.UserRepository; import ru.hsHelper.api.repositories.UserToPartitionRepository; import ru.hsHelper.api.repositories.UserWorkRepository; import ru.hsHelper.api.repositories.WorkRepository; import ru.hsHelper.api.requests.update.UserUpdateRequest; import ru.hsHelper.api.requests.update.UserWorkUpdateRequest; import ru.hsHelper.api.services.UserService; import ru.hsHelper.api.services.impl.util.UserCoursePartService; import ru.hsHelper.api.services.impl.util.UserCourseService; import ru.hsHelper.api.services.impl.util.UserGroupService; import ru.hsHelper.api.services.impl.util.UserPartitionService; import ru.hsHelper.api.services.impl.util.UserWorkService; import java.util.Date; import java.util.Set; import java.util.Map; import java.util.stream.Collectors; @Service public class UserServiceImpl implements UserService { private final UserRepository userRepository; private final GroupRepository groupRepository; private final UserGroupRoleRepository userGroupRoleRepository; private final PartitionRepository partitionRepository; private final UserToPartitionRepository userToPartitionRepository; private final CourseRepository courseRepository; private final UserCourseRoleRepository userCourseRoleRepository; private final CoursePartRepository coursePartRepository; private final UserCoursePartRoleRepository userCoursePartRoleRepository; private final WorkRepository workRepository; private final UserWorkRepository userWorkRepository; private final UserGroupService userGroupService; private final UserCourseService userCourseService; private final UserCoursePartService userCoursePartService; private final UserPartitionService userPartitionService; private final UserWorkService userWorkService; private final NotificationRepository notificationRepository; @Autowired public UserServiceImpl(UserRepository userRepository, GroupRepository groupRepository, UserGroupRoleRepository userGroupRoleRepository, PartitionRepository partitionRepository, UserToPartitionRepository userToPartitionRepository, CourseRepository courseRepository, UserCourseRoleRepository userCourseRoleRepository, CoursePartRepository coursePartRepository, UserCoursePartRoleRepository userCoursePartRoleRepository, WorkRepository workRepository, UserWorkRepository userWorkRepository, UserGroupService userGroupService, UserCourseService userCourseService, UserCoursePartService userCoursePartService, UserPartitionService userPartitionService, UserWorkService userWorkService, NotificationRepository notificationRepository) { this.userRepository = userRepository; this.groupRepository = groupRepository; this.userGroupRoleRepository = userGroupRoleRepository; this.userCoursePartService = userCoursePartService; this.partitionRepository = partitionRepository; this.userToPartitionRepository = userToPartitionRepository; this.courseRepository = courseRepository; this.userCourseRoleRepository = userCourseRoleRepository; this.coursePartRepository = coursePartRepository; this.userCoursePartRoleRepository = userCoursePartRoleRepository; this.workRepository = workRepository; this.userWorkRepository = userWorkRepository; this.userGroupService = userGroupService; this.userCourseService = userCourseService; this.userPartitionService = userPartitionService; this.userWorkService = userWorkService; this.notificationRepository = notificationRepository; } @Transactional @Override public User createUser(User user) { return userRepository.save(user); } @Transactional @Override public void deleteUser(long userId) { User user = getUserById(userId); Set<UserGroupRole> userGroupRoles = userGroupRoleRepository.findAllByUser(user); for (UserGroupRole userGroupRole : userGroupRoles) { userGroupRole.removeUserGroupAndRoles(); } userGroupRoleRepository.deleteAllByUser(user); Set<UserToPartition> userToPartitions = userToPartitionRepository.findAllByUser(user); for (UserToPartition userToPartition : userToPartitions) { userToPartition.removePartitionAndUser(); } userToPartitionRepository.deleteAllByUser(user); Set<UserCourseRole> userCourseRoles = userCourseRoleRepository.findAllByUser(user); for (UserCourseRole userCourseRole : userCourseRoles) { userCourseRole.removeUserCourseAndRoles(); } userCourseRoleRepository.deleteAllByUser(user); Set<UserCoursePartRole> userCoursePartRoles = userCoursePartRoleRepository.findAllByUser(user); for (UserCoursePartRole userCoursePartRole : userCoursePartRoles) { userCoursePartRole.removeUserCoursePartAndRoles(); } userCoursePartRoleRepository.deleteAllByUser(user); Set<UserWork> userWorks = userWorkRepository.findAllByUser(user); for (UserWork userWork : userWorks) { userWork.removeUserAndWork(); } userWorkRepository.deleteAll(userWorks); for (Notification notification : user.getNotifications()) { notification.removeUser(user); } userRepository.delete(user); } @Transactional @Override public User updateUser(long userId, UserUpdateRequest updateRequest) { User user = userRepository.findById(userId).orElseThrow(() -> new IllegalArgumentException("No user with such id")); user.setFirstName(updateRequest.getFirstName()); user.setLastName(updateRequest.getLastName()); user.setEmail(updateRequest.getEmail()); user.setFirebaseMessagingToken(updateRequest.getToken()); return userRepository.save(user); } @Transactional(readOnly = true) @Override public User getUserById(long userId) { return userRepository.findById(userId).orElseThrow(() -> new IllegalArgumentException("No user with such id")); } @Transactional @Override public User addGroups(long userId, Set<Long> groupIds, Map<Long, Set<Long>> roleIds) { User user = getUserById(userId); Set<Group> groups = groupRepository.findAllByIdIn(groupIds); for (Group group : groups) { userGroupService.createUserGroupRole(user, group, roleIds.get(group.getId())); } return user; } @Transactional @Override public User deleteGroups(long userId, Set<Long> groupIds) { User user = getUserById(userId); Set<Group> groups = groupRepository.findAllByIdIn(groupIds); Set<UserGroupRole> userGroupRoles = userGroupRoleRepository.findAllByUserAndGroupIn(user, groups); for (UserGroupRole userGroupRole : userGroupRoles) { userGroupRole.removeUserGroupAndRoles(); } userGroupRoleRepository.deleteAllByUserAndGroupIn(user, groups); return user; } @Transactional @Override public User addToPartitions(long userId, Set<Long> partitionIds, Map<Long, Integer> userParts) { User user = getUserById(userId); Set<Partition> partitions = partitionRepository.findAllByIdIn(partitionIds); for (Partition partition : partitions) { UserToPartition userToPartition = userToPartitionRepository.save( new UserToPartition(user, partition, userParts.get(partition.getId()))); partition.addUser(userToPartition); user.addPartition(userToPartition); } return user; } @Transactional @Override public User deletePartitions(long userId, Set<Long> partitionIds) { User user = getUserById(userId); Set<Partition> partitions = partitionRepository.findAllByIdIn(partitionIds); Set<UserToPartition> userToPartitions = userToPartitionRepository.findAllByUserAndPartitionIn(user, partitions); for (UserToPartition userToPartition : userToPartitions) { userToPartition.removePartitionAndUser(); } userToPartitionRepository.deleteAllByUserAndPartitionIn(user, partitions); return user; } @Transactional @Override public User addCourses(long userId, Set<Long> courseIds, Map<Long, Set<Long>> roleIds) { User user = getUserById(userId); Set<Course> courses = courseRepository.findAllByIdIn(courseIds); for (Course course : courses) { userCourseService.createUserCourseRole(user, course, roleIds.get(course.getId())); } return user; } @Transactional @Override public User deleteCourses(long userId, Set<Long> courseIds) { User user = getUserById(userId); Set<Course> courses = courseRepository.findAllByIdIn(courseIds); Set<UserCourseRole> userCourseRoles = userCourseRoleRepository.findAllByUserAndCourseIn(user, courses); for (UserCourseRole userCourseRole : userCourseRoles) { userCourseRole.removeUserCourseAndRoles(); } userCourseRoleRepository.deleteAllByUserAndCourseIn(user, courses); return user; } @Transactional @Override public User addCourseParts(long userId, Set<Long> coursePartIds, Map<Long, Set<Long>> roleIds) { User user = getUserById(userId); Set<CoursePart> courseParts = coursePartRepository.findAllByIdIn(coursePartIds); for (CoursePart coursePart : courseParts) { userCoursePartService.createUserCoursePartRole(user, coursePart, roleIds.get(coursePart.getId())); } return user; } @Transactional @Override public User deleteCourseParts(long userId, Set<Long> coursePartIds) { User user = getUserById(userId); Set<CoursePart> coursesParts = coursePartRepository.findAllByIdIn(coursePartIds); Set<UserCoursePartRole> userCoursePartRoles = userCoursePartRoleRepository.findAllByUserAndCoursePartIn(user, coursesParts); for (UserCoursePartRole userCoursePartRole : userCoursePartRoles) { userCoursePartRole.removeUserCoursePartAndRoles(); } userCoursePartRoleRepository.deleteAllByUserAndCoursePartIn(user, coursesParts); return user; } @Transactional @Override public User addWorks(long userId, Set<Long> workIds, Map<Long, String> solutions) { User user = getUserById(userId); Set<Work> works = workRepository.findAllByIdIn(workIds); for (Work work : works) { UserWork userWork = userWorkRepository.save(new UserWork(user, work, new Date(), solutions.get(work.getId()))); user.addWork(userWork); work.addUser(userWork); } return user; } @Transactional @Override public User deleteWorks(long userId, Set<Long> workIds) { User user = getUserById(userId); Set<Work> works = workRepository.findAllByIdIn(workIds); Set<UserWork> userWorks = userWorkRepository.findAllByUserAndWorkIn(user, works); for (UserWork userWork : userWorks) { userWork.removeUserAndWork(); } userWorkRepository.deleteAll(userWorks); return user; } @Transactional(readOnly = true) @Override public Set<User> getAllUsers() { return userRepository.findAll(); } @Transactional(readOnly = true) @Override public User getUserByEmail(String email) { return userRepository.findByEmail(email).orElseThrow( () -> new IllegalArgumentException("No user with such email") ); } @Transactional(readOnly = true) @Override public UserGroupRole getUserGroupRole(long userId, long groupId) { return userGroupService.getUserGroupRole(userId, groupId); } @Transactional(readOnly = true) @Override public Set<UserGroupRole> getAllUserGroupRoles(long userId) { return userGroupRoleRepository.findAllByUser(getUserById(userId)); } @Transactional(readOnly = true) @Override public UserToPartition getUserToPartition(long userId, long partitionId) { return userPartitionService.getUserToPartition(userId, partitionId); } @Transactional(readOnly = true) @Override public Set<UserToPartition> getAllUserToPartitions(long userId) { return userToPartitionRepository.findAllByUser(getUserById(userId)); } @Transactional(readOnly = true) @Override public UserCourseRole getUserCourseRole(long userId, long courseId) { return userCourseService.getUserCourseRole(userId, courseId); } @Transactional(readOnly = true) @Override public Set<UserCourseRole> getAllUserCourseRoles(long userId) { return userCourseRoleRepository.findAllByUser(getUserById(userId)); } @Transactional(readOnly = true) @Override public UserCoursePartRole getUserCoursePartRole(long userId, long coursePartId) { return userCoursePartService.getUserCoursePartRole(userId, coursePartId); } @Transactional(readOnly = true) @Override public Set<UserCoursePartRole> getAllUserCoursePartRoles(long userId) { return userCoursePartRoleRepository.findAllByUser(getUserById(userId)); } @Transactional(readOnly = true) @Override public UserWork getUserWork(long userId, long workId) { return userWorkService.getUserWork(userId, workId); } @Transactional(readOnly = true) @Override public Set<UserWork> getAllUserWorks(long userId) { return userWorkRepository.findAllByUser(getUserById(userId)); } @Override public UserWork updateUserWork(long userId, long workId, UserWorkUpdateRequest userWorkUpdateRequest) { return userWorkService.updateUserWork(userId, workId, userWorkUpdateRequest); } @Transactional @Override public User addNotifications(long userId, Set<Long> notificationsIds) { User user = getUserById(userId); Set<Notification> notifications = notificationRepository.findAllByIdIn(notificationsIds); for (Notification notification : notifications) { notification.addUser(user); user.addNotification(notification); } return user; } @Transactional @Override public User deleteNotifications(long userId, Set<Long> notificationIds) { User user = getUserById(userId); Set<Notification> notifications = notificationRepository.findAllByIdIn(notificationIds); for (Notification notification : notifications) { notification.removeUser(user); user.removeNotification(notification); } return user; } @Transactional(readOnly = true) @Override public Set<Notification> getAllNotifications(long userId) { return getUserById(userId).getNotifications(); } @Transactional(readOnly = true) @Override public Set<UserWork> getAllUserWorksByGroup(long userId, long groupId) { return getAllUserWorks(userId).stream(). filter(userWork -> userWork.getWork().getCoursePart().getCourse().getGroup().getId() == groupId). collect(Collectors.toSet()); } @Transactional(readOnly = true) @Override public Set<UserWork> getAllUserWorksByCourse(long userId, long courseId) { return getAllUserWorks(userId).stream(). filter(userWork -> userWork.getWork().getCoursePart().getCourse().getId() == courseId). collect(Collectors.toSet()); } @Transactional(readOnly = true) @Override public Set<UserWork> getAllUserWorksByCoursePart(long userId, long coursePartId) { return getAllUserWorks(userId).stream(). filter(userWork -> userWork.getWork().getCoursePart().getId() == coursePartId). collect(Collectors.toSet()); } }
6fd427d5ef31a109a733406e143d140a5e4c796c
f410795b586b88d5e58e2e0e3f21e6dcefd7843b
/src/java/servlets/srv/buscar.java
9974eff79266dbad0b73e64a266dc4e94b5bb807
[]
no_license
miguelfreelancer56577/SistemaControlEscolar
99fac5c30391fc2e6ff82db7f6e4bfc81bda05eb
e06bb3070db477a919acdec04ada2253d5a7875d
refs/heads/master
2021-01-09T20:09:33.064901
2016-07-19T15:18:50
2016-07-19T15:18:50
63,705,290
0
0
null
null
null
null
UTF-8
Java
false
false
2,868
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package servlets.srv; import beans.bean.operacion; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author ATENA */ @WebServlet(name="buscar", urlPatterns={"/buscar"}) public class buscar extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String opcion=request.getParameter("opcion"); if (opcion.equals("nombre")){ operacion registro=new operacion(); out.print(registro.busca(request.getParameter("texto"))); } else{ operacion registro=new operacion(); out.print(registro.busca_matricula(request.getParameter("texto"))); } //String tipo=registro.busca(matricula); } finally { out.close(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
96143b05f775256586f1b34563956732cf13f23f
addd4150ca62c6fee6834ec55469712c47f4fc50
/ctk-domain/src/main/java/org/ga4gh/ctk/testcategories/WIP.java
db989a401ebdca13087ad92a55b110878a012373
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
ga4gh/compliance
7813f02f9f1fdada5a855b9c071fb2881703b9f4
26a7643975ad5e7e307f4538bbdc53ab17132361
refs/heads/master
2020-04-03T21:28:33.296863
2018-01-24T11:00:29
2018-01-24T11:00:29
23,127,683
8
31
null
2017-10-03T11:50:13
2014-08-19T22:22:15
Java
UTF-8
Java
false
false
705
java
package org.ga4gh.ctk.testcategories; /** * <p>Marker interface for tests which are somehow "work in progress" * (whether that's the test itself, or thing being tested, is up to you).</p> * <p>This is a handy test-tag; when you're working on something, add * the WIP category tag {@code @Categories(WIP.class)} to the test class or * test method signature, and then the WIPTestSuite will pick up only your tagged tests.</p> * <p>If no tests are WIP-categorized, you'll get a {@code NoTestsRemainException} * from the WIPTestSuite execution</p> * * <h2>Remove this tag when all your tests pass!</h2> * * Created by Wayne Stidolph on 6/7/2015. */ public interface WIP { /* category marker */ }
f5ad7c2f2a4509068ae5781822d5893ed5db2982
d7159f4a42e2a56717e508f192b92dd3dff12843
/src/main/java/com/zhihui/order/partner/plateno/service/book/ArrayOfQuota.java
6512ecfdfd53e7381e80da023a50b58c99246a27
[]
no_license
liangyongsheng/zhihui-order-partner-plateno
d431b8c3020a9ad01c0504cce826458b32849a96
40f95c81e67596398a4c39681945af97ba97cba2
refs/heads/master
2021-01-10T08:43:43.714565
2016-02-18T11:25:32
2016-02-18T11:25:32
52,002,050
0
0
null
null
null
null
GB18030
Java
false
false
1,882
java
package com.zhihui.order.partner.plateno.service.book; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>ArrayOfQuota complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType name="ArrayOfQuota"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Quota" type="{http://www.7daysinn.cn/booking}Quota" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ArrayOfQuota", propOrder = { "quota" }) public class ArrayOfQuota { @XmlElement(name = "Quota", nillable = true) protected List<Quota> quota; /** * Gets the value of the quota property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the quota property. * * <p> * For example, to add a new item, do as follows: * <pre> * getQuota().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Quota } * * */ public List<Quota> getQuota() { if (quota == null) { quota = new ArrayList<Quota>(); } return this.quota; } }
16e544d2b9b9c9ffd20f1c1faf27390b6bf17a44
c5ff7727d29d6a67d1f62998b21281eb3cdab4fe
/client/platforms/android/app/build/generated/source/buildConfig/debug/com/lab/turborrow/BuildConfig.java
8e95abcf7b7d2fde936af740c51b17114d2b248d
[]
no_license
arenibProjects/turborrow
1ac0aa9c5d680e6cff1c00369dbf1ee2d1c0bf92
b34f07c393902f56bfc107b2b6962875fc46fee1
refs/heads/master
2020-03-12T08:58:41.204028
2018-04-22T07:40:07
2018-04-22T07:40:07
130,541,489
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
/** * Automatically generated file. DO NOT MODIFY */ package com.lab.turborrow; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.lab.turborrow"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 10000; public static final String VERSION_NAME = "1.0.0"; }
acfcd505475bb75d1f4a62e9c4621d931da48b84
5dfa02a3d2ba797f7fb4519464b77423480bca5d
/src/main/java/ml/bootcode/springrestsecurityjwt/bootstrap/InitialDataLoader.java
0c4a91637155b3f97ba072421d0b9b31b3a96275
[]
no_license
sunnybatabyal/spring-rest-security-jwt
ecc2649a8c2054dfae29c57d8c088f1507336441
1d5080827908d96bb0beeb501c8a6a8244618bed
refs/heads/master
2023-04-13T09:49:45.667406
2023-04-04T17:57:52
2023-04-04T17:57:52
195,734,782
0
0
null
null
null
null
UTF-8
Java
false
false
3,392
java
/** * */ package ml.bootcode.springrestsecurityjwt.bootstrap; import java.util.Arrays; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; import ml.bootcode.springrestsecurityjwt.models.Authority; import ml.bootcode.springrestsecurityjwt.models.Role; import ml.bootcode.springrestsecurityjwt.models.User; import ml.bootcode.springrestsecurityjwt.repositories.AuthorityRepository; import ml.bootcode.springrestsecurityjwt.repositories.RoleRepository; import ml.bootcode.springrestsecurityjwt.repositories.UserRepository; /** * @author sunnyb * */ @Component public class InitialDataLoader implements ApplicationListener<ContextRefreshedEvent> { private boolean done = false; private AuthorityRepository authorityRepository; private RoleRepository roleRepository; private UserRepository userRepository; private PasswordEncoder passwordEncoder; /** * @param authorityRepository * @param roleRepository * @param userRepository * @param passwordEncoder */ public InitialDataLoader(AuthorityRepository authorityRepository, RoleRepository roleRepository, UserRepository userRepository, PasswordEncoder passwordEncoder) { this.authorityRepository = authorityRepository; this.roleRepository = roleRepository; this.userRepository = userRepository; this.passwordEncoder = passwordEncoder; } @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (done) return; // Create authorities. Authority viewAuthority = new Authority(); viewAuthority.setName("VIEW"); Authority downloadAuthority = new Authority(); downloadAuthority.setName("DOWNLOAD"); Authority editAuthority = new Authority(); editAuthority.setName("EDIT"); Authority uploadAuthority = new Authority(); uploadAuthority.setName("UPLOAD"); authorityRepository.save(viewAuthority); authorityRepository.save(downloadAuthority); authorityRepository.save(editAuthority); authorityRepository.save(uploadAuthority); // Create roles. Role adminRole = new Role(); adminRole.setName("ADMIN"); adminRole.setAuthorities(Arrays.asList(viewAuthority, downloadAuthority, editAuthority, uploadAuthority)); Role userRole = new Role(); userRole.setName("USER"); userRole.setAuthorities(Arrays.asList(viewAuthority)); Role artistRole = new Role(); artistRole.setName("ARTIST"); artistRole.setAuthorities(Arrays.asList(viewAuthority, uploadAuthority)); Role customerRole = new Role(); customerRole.setName("CUSTOMER"); customerRole.setAuthorities(Arrays.asList(viewAuthority, downloadAuthority)); adminRole = roleRepository.save(adminRole); userRole = roleRepository.save(userRole); artistRole = roleRepository.save(artistRole); customerRole = roleRepository.save(customerRole); // Create users. User adminUser = new User(); adminUser.setEmail("sunny"); adminUser.setPassword(passwordEncoder.encode("sunny")); adminUser.setRoles(Arrays.asList(adminRole)); User testUser = new User(); testUser.setEmail("test"); testUser.setPassword(passwordEncoder.encode("test")); testUser.setRoles(Arrays.asList(artistRole, customerRole)); adminUser = userRepository.save(adminUser); testUser = userRepository.save(testUser); } }