blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 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 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f162baba7549b8cd9b140bf0aaf4302784dc619b | 54a7300afab27530225d1b0d97edc3b98559a191 | /src/oliver/neuron/distortedletters/DistortedLettersChoice.java | 1638525f3f730f75d720a3a81f8ac87520db1279 | [] | no_license | olivermcccarthy/neuralnetworks | cc99f3c1e58cf4f672d78dbb48b3c663f603be6f | fd500bf6c951c36a7365c8b162e415d852fc0b16 | refs/heads/master | 2020-04-17T08:22:42.450088 | 2019-03-29T13:48:34 | 2019-03-29T13:48:34 | 166,409,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,213 | java | package oliver.neuron.distortedletters;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import oliver.neuron.Cost;
import oliver.neuron.ui.DrawNeuralNetwork;
/**
* Display a Distorted(Distorted) Letter and ask user to select which Letter it is
*/
public class DistortedLettersChoice extends JPanel {
/**
*
*/
private static final long serialVersionUID = -985471666659201980L;
/**
* Choice of letters
*/
static String[] LETTERS = new String[] { "E", "F", "H" };
/**
* Wait for user to choose
*/
Object waitForMe = "";
/**
* Group of buttons ( User Choose the letter)
*/
ButtonGroup group = new ButtonGroup();
/**
* Panel displaying the distorted Letter
*/
DistortedLetters innerPanel = new DistortedLetters();
//JTextPane resultPane = new JTextPane();
/**
* Which Letter did the user choose
*/
int selectedCoice = -1;
/**
* Preferred width of this panel
*/
static int preferedWidth = 200;
public DistortedLettersChoice() {
this.setLayout(null);
this.add(innerPanel);
this.setPreferredSize(new Dimension(preferedWidth, 280));
this.setLayout(null);
int w = 0;
int id = 0;
for (String letter : LETTERS) {
JButton but = new JButton(letter);
final int oID = id;
but.setBounds(w, 230, 50, 30);
this.add(but);
group.add(but);
but.addActionListener(new ActionListener() {
int ourID = oID;
@Override
public void actionPerformed(ActionEvent e) {
synchronized (waitForMe) {
waitForMe.notifyAll();
selectedCoice = ourID;
}
}
});
id++;
w += 50;
}
innerPanel.setBounds(0, 0, preferedWidth, 200);
}
/**
* User agrees we set expected[neuronChoce] to 1 and all others to 0 User
* changes choice we set expected[userChoice] to 1 and all others to 0 User does
* nothing we set expected to in for all values and nothing is learned
*
* @param overallPanel
* @param in
* @return
*/
public double[] like(Cost theCost,DistortedLetterTrial trial, DrawNeuralNetwork overallPanel, double[] in) {
//resultPane.setBackground(this.getBackground());
double[] expected = new double[in.length];
int neuronChoice = -1;
double max = 0;
for (int x = 0; x < in.length; x++) {
if (in[x] > max) {
max = in[x];
neuronChoice = x;
}
}
String gotLetter = LETTERS[neuronChoice];
//this.resultPane.setText(text);
//this.resultPane.setFont(this.resultPane.getFont().deriveFont(18.0f));
selectedCoice = -1;
synchronized (waitForMe) {
try {
waitForMe.wait(overallPanel.controlPanel.getSleepTime());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (selectedCoice != -1) {
if(selectedCoice == -2) {
this.selectedCoice= neuronChoice;
}
if (this.selectedCoice != neuronChoice) {
theCost.incNumWrong();
}
neuronChoice = this.selectedCoice;
for (int x = 0; x < in.length; x++) {
expected[x] = 0;
if (x == neuronChoice) {
expected[x] = 1;
}
}
} else {
// No choice nothing to learn
for (int x = 0; x < in.length; x++) {
expected[x] = in[x];
}
}
String expectedLetter = LETTERS[neuronChoice];
overallPanel.waitForUserClick(trial, String.format("%s, %s", expectedLetter,gotLetter),false,true);
return expected;
}
protected void newLetter() {
this.innerPanel.newLetter();
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
}
public static void main(String[] args) {
JFrame frame = new JFrame("test");
frame.setSize(200, 200);
DistortedLettersChoice panel = new DistortedLettersChoice();
frame.add(panel);
frame.setVisible(true);
}
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
Enumeration<AbstractButton> enumk =group.getElements();
while (enumk.hasMoreElements()) {
enumk.nextElement().setEnabled(enabled);
}
}
}
| [
"OLIVERMC@IE.IBM.COM"
] | OLIVERMC@IE.IBM.COM |
2be4ebe2339913fee8c892f8067e639d452e4b50 | da0e99192662fecbb951a032e4b9a7a9c39348d7 | /asaimagelibrary/src/main/java/technited/minds/asaimagelibrary/MediaLoader.java | 577b001c3b0813d8dfe5f0e6c6a540fa736a7ae2 | [] | no_license | sahuadarsh0/BigBannerIndiaApp | 7aff246f9b0aeed61c9230bb4fc1d0c9b39a076c | 75909403bd1e382334426a3b5e09fb4e66814bd9 | refs/heads/master | 2023-06-08T01:21:29.631721 | 2021-06-27T01:30:59 | 2021-06-27T01:30:59 | 249,540,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package technited.minds.asaimagelibrary;
import android.content.Context;
import android.widget.ImageView;
public interface MediaLoader {
boolean isImage();
void loadMedia(Context context, ImageView imageView, SuccessCallback callback);
interface SuccessCallback {
void onSuccess();
}
} | [
"sahuadarsh0@gmail.com"
] | sahuadarsh0@gmail.com |
b2ee05f923c9613b77bd8136118a23952e1073f8 | 4f8dfcdd6f1494b59684438b8592c6c5c2e63829 | /DiffTGen-result/output/patch1-Lang-45-Jaid-plausible/Lang_45_1-plausible_jaid/target/0/25/evosuite-tests/org/apache/commons/lang/WordUtils_ESTest_scaffolding.java | 70cdc38c1f33ec694ce2febaf47dca91c8801c24 | [] | no_license | IntHelloWorld/Ddifferent-study | fa76c35ff48bf7a240dbe7a8b55dc5a3d2594a3b | 9782867d9480e5d68adef635b0141d66ceb81a7e | refs/heads/master | 2021-04-17T11:40:12.749992 | 2020-03-31T23:58:19 | 2020-03-31T23:58:19 | 249,439,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,441 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Mar 30 02:49:04 GMT 2020
*/
package org.apache.commons.lang;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class WordUtils_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.lang.WordUtils";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("file.encoding", "UTF-8");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
java.lang.System.setProperty("user.country", "US");
java.lang.System.setProperty("user.dir", "/home/hewitt/work/DiffTGen-master/output/patch1-Lang-45-Jaid-plausible/Lang_45_1-plausible_jaid/target/0/25");
java.lang.System.setProperty("user.home", "/home/hewitt");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "hewitt");
java.lang.System.setProperty("user.timezone", "Asia/Chongqing");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(WordUtils_ESTest_scaffolding.class.getClassLoader() ,
"org.apache.commons.lang.StringUtils",
"org.apache.commons.lang.SystemUtils",
"org.apache.commons.lang.WordUtils"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(WordUtils_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.apache.commons.lang.WordUtils",
"org.apache.commons.lang.SystemUtils",
"org.apache.commons.lang.StringUtils"
);
}
}
| [
"1009479460@qq.com"
] | 1009479460@qq.com |
300e824d59530ee1a9776a0ffb444f9a0a4dbb7d | 436e88127327f6511ae03327b4924f6eeaa5ea45 | /common/src/main/java/com/easycompany/trappd/cache/StateCache.java | 2a14bc3e75063df5417ba8b417f106604d9266c9 | [] | no_license | princebansal/trappd | 11d35b4d022bba7f893e7e3d0b82d5d8b8d0848f | 58dce86a03c6dbcb2843ec9779f94f15cf2ef5c3 | refs/heads/master | 2021-05-25T15:20:50.096853 | 2020-04-20T16:14:54 | 2020-04-20T16:14:54 | 253,805,561 | 1 | 0 | null | 2020-04-19T14:32:16 | 2020-04-07T13:44:31 | Java | UTF-8 | Java | false | false | 1,570 | java | package com.easycompany.trappd.cache;
import com.easycompany.trappd.model.entity.StateEntity;
import com.easycompany.trappd.repository.StateRepository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Component
public final class StateCache {
private static Map<String, StateEntity> stateCodeToStateEntityMap = new HashMap<>();
private final StateRepository stateRepository;
@Autowired
public StateCache(StateRepository stateRepository) {
this.stateRepository = stateRepository;
}
@PostConstruct
public void init() {
List<StateEntity> stateEntityList = stateRepository.findAll();
stateCodeToStateEntityMap =
stateEntityList.stream()
.collect(
Collectors.toMap(
stateEntity -> stateEntity.getCode().toLowerCase(),
stateEntity -> stateEntity));
}
public Optional<StateEntity> getStateEntity(String code) {
if (stateCodeToStateEntityMap.containsKey(code.toLowerCase())) {
return Optional.ofNullable(stateCodeToStateEntityMap.get(code.toLowerCase()));
} else {
return Optional.empty();
}
}
public StateEntity getStateEntity(String code1, String code2) {
return getStateEntity(code1).orElseGet(() -> getStateEntity(code2).orElse(null));
}
}
| [
"prince.bansal@traveloka.com"
] | prince.bansal@traveloka.com |
a54b693dc26a23e1c6666aefae7986c5be650343 | ab37af792507e7fb65b1d482293ae9086f83a56e | /src/com/crypto/classes/Listener.java | 57e801bb6542880f30f7cf1e1c3a6c72f7d4672a | [] | no_license | seyitaliyaman/observer-pattern-encryption-algorithms | b0ecd11d556b16d06109c05ae2f210d0d6142fa1 | 7345c74456e0451abd5d4241a2b76349c42a7075 | refs/heads/master | 2023-02-02T15:29:31.979908 | 2020-12-25T15:09:20 | 2020-12-25T15:09:20 | 324,383,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 96 | java | package com.crypto.classes;
public interface Listener {
void update(String s, byte key);
}
| [
"seyitaliyaman@Seyit-MacBook-Pro.local"
] | seyitaliyaman@Seyit-MacBook-Pro.local |
bc71191a8c360331a32b6d8e1e62865e38011212 | 127140ce7439c3aec962e13ded2183c2d1a644d8 | /src/main/java/com/music/app/constraint/PasswordConstraint.java | e51eb9dce588fd19cdf4209f12d3b55becf060e5 | [] | no_license | PinkFuryAlpha/Licenta | c54ec40e04dd21d3c2f2a63e5b1797e14a779273 | 5af16e5e6e384aafc755844aae1f04e3f18641b5 | refs/heads/main | 2023-05-30T04:05:46.511807 | 2021-06-26T16:14:30 | 2021-06-26T16:14:30 | 342,834,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package com.music.app.constraint;
import com.music.app.validators.PasswordValidator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Constraint(validatedBy = PasswordValidator.class)
@Target({ElementType.METHOD,ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface PasswordConstraint {
String message() default "Invalid password. It should contain one special character, one upper case letter, one number at least.";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
| [
"tinteanu.tudor@gmail.com"
] | tinteanu.tudor@gmail.com |
f24daaa0674057d4be02b6e31d14e5a492e128c5 | a69922d3f552ac5a22e5a92bfcb8a6a27a97b8a4 | /src/test/java/com/renz/amaysim/cart/service/UserShoppingCartTest.java | 7a47d5952a3fb481c3fb07b3ce6d3bf3e7860bb5 | [] | no_license | renzrollon/shopping-cart | 63ffbcfc67207ece8073c1f407694af461f7c691 | 9a864081b48b62e4f822d272c1058622c3c56e74 | refs/heads/master | 2021-07-12T19:23:26.867997 | 2021-03-07T05:40:22 | 2021-03-07T05:40:22 | 73,008,175 | 0 | 0 | null | 2021-03-07T05:40:39 | 2016-11-06T17:49:27 | Java | UTF-8 | Java | false | false | 3,880 | java | package com.renz.amaysim.cart.service;
import com.renz.amaysim.cart.decorator.*;
import com.renz.amaysim.cart.domain.Product;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import static org.junit.Assert.assertEquals;
/**
* Created by renz on 11/6/16.
*/
@RunWith(BlockJUnit4ClassRunner.class)
public class UserShoppingCartTest {
private UserShoppingCart shoppingCart;
private final String USER_ID = "helloWorldUser";
@Before
public void setup() {
shoppingCart = new UserShoppingCart(USER_ID);
Set<ShoppingCartDecorator> decoratorList = new HashSet<>();
decoratorList.add(UnliSmall3For2DealDecorator.getInstance());
decoratorList.add(UnliLargeBulkDiscountDecorator.getInstance());
decoratorList.add(Free1GBDataDecorator.getInstance());
decoratorList.add(PromoCode10PercentDiscountDecorator.getInstance());
shoppingCart.setPriceDecorators(decoratorList);
}
@Test
public void unliSmallTotal() {
shoppingCart.add(Product.getUnliSmallInstance());
BigDecimal expected = Product.UNLI_SMALL_PRICE;
BigDecimal actual = shoppingCart.total();
assertEquals(expected, actual);
}
@Test
public void unliSmallMediumLargeAnd1GBTotal() {
shoppingCart.add(Product.getUnliSmallInstance());
shoppingCart.add(Product.getUnliMediumInstance());
shoppingCart.add(Product.getUnliLargeInstance());
shoppingCart.add(Product.get1GbDataPackInstance());
BigDecimal expected = Product.UNLI_SMALL_PRICE
.add(Product.UNLI_MEDIUM_PRICE)
.add(Product.UNLI_LARGE_PRICE)
.add(Product._1GB_DATA_PACK_PRICE);
BigDecimal actual = shoppingCart.total();
assertEquals(expected, actual);
}
@Test
public void scenario1Total() {
shoppingCart.add(Product.getUnliSmallInstance());
shoppingCart.add(Product.getUnliSmallInstance());
shoppingCart.add(Product.getUnliSmallInstance());
shoppingCart.add(Product.getUnliLargeInstance());
BigDecimal expected = new BigDecimal("94.70");
BigDecimal actual = shoppingCart.total();
assertEquals(expected, actual);
}
@Test
public void scenario2Total() {
shoppingCart.add(Product.getUnliSmallInstance());
shoppingCart.add(Product.getUnliSmallInstance());
shoppingCart.add(Product.getUnliLargeInstance());
shoppingCart.add(Product.getUnliLargeInstance());
shoppingCart.add(Product.getUnliLargeInstance());
shoppingCart.add(Product.getUnliLargeInstance());
BigDecimal expected = new BigDecimal("209.40");
BigDecimal actual = shoppingCart.total();
assertEquals(expected, actual);
}
@Test
public void scenario3Total() {
shoppingCart.add(Product.getUnliSmallInstance());
shoppingCart.add(Product.getUnliMediumInstance());
shoppingCart.add(Product.getUnliMediumInstance());
BigDecimal expectedPrice = new BigDecimal("84.70");
BigDecimal actualPrice = shoppingCart.total();
assertEquals(expectedPrice, actualPrice);
int expectedItemSize = 5;
int actualItemSize = shoppingCart.items().size();
assertEquals(expectedItemSize, actualItemSize);
}
@Test
public void scenario4Total() {
String discountCode = "I<3AMAYSIM";
shoppingCart.add(Product.getUnliSmallInstance());
shoppingCart.add(Product.get1GbDataPackInstance(), discountCode);
BigDecimal expectedPrice = new BigDecimal("31.32");
BigDecimal actualPrice = shoppingCart.total();
assertEquals(expectedPrice, actualPrice);
}
}
| [
"carl@ideyatech.com"
] | carl@ideyatech.com |
301df9b366fe66c5f0544d96d0bfe668d967a8d5 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/28/28_7f51db0d946c9b46c8efd673cb3ff8e6eb3f2b85/Pattern/28_7f51db0d946c9b46c8efd673cb3ff8e6eb3f2b85_Pattern_t.java | c17b4eff44ff0461c718dd68205b21d7ed999d99 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 11,415 | java | package org.freeplane.features.mindmapnode.pattern;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import org.freeplane.core.util.LogTool;
import org.freeplane.n3.nanoxml.IXMLParser;
import org.freeplane.n3.nanoxml.IXMLReader;
import org.freeplane.n3.nanoxml.StdXMLReader;
import org.freeplane.n3.nanoxml.XMLElement;
import org.freeplane.n3.nanoxml.XMLException;
import org.freeplane.n3.nanoxml.XMLParserFactory;
import org.freeplane.n3.nanoxml.XMLWriter;
public class Pattern implements Cloneable {
public static Pattern unMarshall(final String patternString) {
try {
final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
final IXMLReader xmlReader = new StdXMLReader(new StringReader(patternString));
parser.setReader(xmlReader);
final XMLElement xml = (XMLElement) parser.parse();
return Pattern.unMarshall(xml);
}
catch (final XMLException e) {
LogTool.severe(e);
return null;
}
}
public static Pattern unMarshall(final XMLElement xmlPattern) {
final Pattern pattern = new Pattern();
pattern.unMarshallImpl(xmlPattern);
return pattern;
}
private String name;
private PatternProperty patternChild;
private PatternProperty patternCloud;
private PatternProperty patternCloudColor;
private PatternProperty patternEdgeColor;
private PatternProperty patternEdgeStyle;
private PatternProperty patternEdgeWidth;
private PatternProperty patternIcon;
private PatternProperty patternNodeBackgroundColor;
private PatternProperty patternNodeColor;
private PatternProperty patternNodeFontBold;
private PatternProperty patternNodeFontItalic;
private PatternProperty patternNodeFontName;
private PatternProperty patternNodeFontSize;
private PatternProperty patternNodeStyle;
private PatternProperty patternNodeText;
private PatternProperty patternScript;
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public String getName() {
return name;
}
public PatternProperty getPatternChild() {
return patternChild;
}
public PatternProperty getPatternCloud() {
return patternCloud;
}
public PatternProperty getPatternCloudColor() {
return patternCloudColor;
}
public PatternProperty getPatternEdgeColor() {
return patternEdgeColor;
}
public PatternProperty getPatternEdgeStyle() {
return patternEdgeStyle;
}
public PatternProperty getPatternEdgeWidth() {
return patternEdgeWidth;
}
public PatternProperty getPatternIcon() {
return patternIcon;
}
public PatternProperty getPatternNodeBackgroundColor() {
return patternNodeBackgroundColor;
}
public PatternProperty getPatternNodeColor() {
return patternNodeColor;
}
public PatternProperty getPatternNodeFontBold() {
return patternNodeFontBold;
}
public PatternProperty getPatternNodeFontItalic() {
return patternNodeFontItalic;
}
public PatternProperty getPatternNodeFontName() {
return patternNodeFontName;
}
public PatternProperty getPatternNodeFontSize() {
return patternNodeFontSize;
}
public PatternProperty getPatternNodeStyle() {
return patternNodeStyle;
}
public PatternProperty getPatternNodeText() {
return patternNodeText;
}
public PatternProperty getPatternScript() {
return patternScript;
}
private void marschall(final XMLElement xml, final String string, final PatternProperty pattern) {
if (pattern == null) {
return;
}
final XMLElement property = new XMLElement(string);
final String value = pattern.getValue();
if (value != null) {
property.setAttribute("value", value);
}
xml.addChild(property);
}
public String marshall() {
final XMLElement xml = new XMLElement("pattern");
xml.setAttribute("name", name);
marschall(xml, "pattern_node_background_color", patternNodeBackgroundColor);
marschall(xml, "pattern_node_color", patternNodeColor);
marschall(xml, "pattern_node_style", patternNodeStyle);
marschall(xml, "pattern_node_text", patternNodeText);
marschall(xml, "pattern_node_font_name", patternNodeFontName);
marschall(xml, "pattern_node_font_bold", patternNodeFontBold);
marschall(xml, "pattern_node_font_italic", patternNodeFontItalic);
marschall(xml, "pattern_node_font_size", patternNodeFontSize);
marschall(xml, "pattern_icon", patternIcon);
marschall(xml, "pattern_cloud", patternCloud);
marschall(xml, "pattern_cloud_color", patternCloudColor);
marschall(xml, "pattern_edge_color", patternEdgeColor);
marschall(xml, "pattern_edge_style", patternEdgeStyle);
marschall(xml, "pattern_edge_width", patternEdgeWidth);
marschall(xml, "pattern_child", patternChild);
marschall(xml, "pattern_script", patternScript);
final StringWriter string = new StringWriter();
final XMLWriter writer = new XMLWriter(string);
try {
writer.write(xml, true);
return string.toString();
}
catch (final IOException e) {
LogTool.severe(e);
return null;
}
}
public void setName(final String name) {
this.name = name;
}
public void setPatternChild(final PatternProperty patternChild) {
this.patternChild = patternChild;
}
public void setPatternEdgeColor(final PatternProperty patternEdgeColor) {
this.patternEdgeColor = patternEdgeColor;
}
public void setPatternCloud(final PatternProperty patternCloud) {
this.patternCloud = patternCloud;
}
public void setPatternCloudColor(final PatternProperty patternEdgeColor) {
this.patternCloudColor = patternEdgeColor;
}
public void setPatternEdgeStyle(final PatternProperty patternEdgeStyle) {
this.patternEdgeStyle = patternEdgeStyle;
}
public void setPatternEdgeWidth(final PatternProperty patternEdgeWidth) {
this.patternEdgeWidth = patternEdgeWidth;
}
public void setPatternIcon(final PatternProperty patternIcon) {
this.patternIcon = patternIcon;
}
public void setPatternNodeBackgroundColor(final PatternProperty patternNodeBackgroundColor) {
this.patternNodeBackgroundColor = patternNodeBackgroundColor;
}
public void setPatternNodeColor(final PatternProperty patternNodeColor) {
this.patternNodeColor = patternNodeColor;
}
public void setPatternNodeFontBold(final PatternProperty patternNodeFontBold) {
this.patternNodeFontBold = patternNodeFontBold;
}
public void setPatternNodeFontItalic(final PatternProperty patternNodeFontItalic) {
this.patternNodeFontItalic = patternNodeFontItalic;
}
public void setPatternNodeFontName(final PatternProperty patternNodeFontName) {
this.patternNodeFontName = patternNodeFontName;
}
public void setPatternNodeFontSize(final PatternProperty patternNodeFontSize) {
this.patternNodeFontSize = patternNodeFontSize;
}
public void setPatternNodeStyle(final PatternProperty patternNodeStyle) {
this.patternNodeStyle = patternNodeStyle;
}
public void setPatternNodeText(final PatternProperty patternNodeText) {
this.patternNodeText = patternNodeText;
}
public void setPatternScript(final PatternProperty patternScript) {
this.patternScript = patternScript;
}
private void unMarshallImpl(final XMLElement xmlPattern) {
name = xmlPattern.getAttribute("name", null);
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_node_background_color");
if (xmlProperty != null) {
patternNodeBackgroundColor = new PatternProperty();
patternNodeBackgroundColor.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_node_color");
if (xmlProperty != null) {
patternNodeColor = new PatternProperty();
patternNodeColor.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_node_style");
if (xmlProperty != null) {
patternNodeStyle = new PatternProperty();
patternNodeStyle.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_node_text");
if (xmlProperty != null) {
patternNodeText = new PatternProperty();
patternNodeText.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_node_font_name");
if (xmlProperty != null) {
patternNodeFontName = new PatternProperty();
patternNodeFontName.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_node_font_bold");
if (xmlProperty != null) {
patternNodeFontBold = new PatternProperty();
patternNodeFontBold.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_node_font_italic");
if (xmlProperty != null) {
patternNodeFontItalic = new PatternProperty();
patternNodeFontItalic.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_node_font_size");
if (xmlProperty != null) {
patternNodeFontSize = new PatternProperty();
patternNodeFontSize.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_icon");
if (xmlProperty != null) {
patternIcon = new PatternProperty();
patternIcon.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_cloud");
if (xmlProperty != null) {
patternCloud = new PatternProperty();
patternCloud.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_cloud_color");
if (xmlProperty != null) {
patternCloudColor = new PatternProperty();
patternCloudColor.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_edge_color");
if (xmlProperty != null) {
patternEdgeColor = new PatternProperty();
patternEdgeColor.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_edge_style");
if (xmlProperty != null) {
patternEdgeStyle = new PatternProperty();
patternEdgeStyle.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_edge_width");
if (xmlProperty != null) {
patternEdgeWidth = new PatternProperty();
patternEdgeWidth.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_child");
if (xmlProperty != null) {
patternChild = new PatternProperty();
patternChild.value = xmlProperty.getAttribute("value", null);
}
}
{
final XMLElement xmlProperty = xmlPattern.getFirstChildNamed("pattern_script");
if (xmlProperty != null) {
patternScript = new PatternProperty();
patternScript.value = xmlProperty.getAttribute("value", null);
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
454b1d19e9f62703b797dab350124191492aa533 | bbe560f89d40bbcedf97d744e115d699fecf9af8 | /ViaThinkSoft Distributed/src/de/viathinksoft/marschall/raumplan/formula/InvalidValException.java | e81e5810c852ee15d4680c91ad8eda29a6a195d2 | [] | no_license | danielmarschall/distributed | fde861b299744e21c0098075dfb75cc7a61aa9f6 | 342512bcb3fb91178c572cd4dea10cbd8233522e | refs/heads/master | 2022-11-30T04:00:03.521247 | 2010-12-13T20:28:52 | 2010-12-13T20:28:52 | 287,919,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package de.viathinksoft.marschall.raumplan.formula;
public class InvalidValException extends Exception {
private static final long serialVersionUID = 7819713196701732155L;
}
| [
"info@daniel-marschall.de"
] | info@daniel-marschall.de |
967caa4b8401d7cf7c9299b7ccb79a9ef58cc035 | 54c8cdd8c9a998a7769ebce175ec6c21dc8a0f6c | /GoGreen CustomerApp v1.1/app/src/main/java/com/cscodetech/supermarket/model/Register.java | 5bb062ea522fe2cbc1d10625a1f3097c1be3f779 | [] | no_license | luuuuuuuul/BytmCustomerApp | 53a16b892cf5e8c7007470989aa7339c3a7f14d3 | 7a0a15dec34561d48b8a633dafc44a7a054ca562 | refs/heads/main | 2023-01-28T14:08:59.449464 | 2020-12-10T14:57:40 | 2020-12-10T14:57:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,030 | java |
package com.cscodetech.supermarket.model;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class Register {
@SerializedName("userid")
private String userid;
@SerializedName("ResponseCode")
private String mResponseCode;
@SerializedName("ResponseMsg")
private String mResponseMsg;
@SerializedName("Result")
private String mResult;
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getResponseCode() {
return mResponseCode;
}
public void setResponseCode(String responseCode) {
mResponseCode = responseCode;
}
public String getResponseMsg() {
return mResponseMsg;
}
public void setResponseMsg(String responseMsg) {
mResponseMsg = responseMsg;
}
public String getResult() {
return mResult;
}
public void setResult(String result) {
mResult = result;
}
}
| [
"sunilkumararava@gmail.com"
] | sunilkumararava@gmail.com |
f734dca3dd1d29e4c1b384c1de60b60baae55b6e | c2e7f3b27536240cafcb4bef59d02292daadaf73 | /src/main/java/com/springapp/mvc/service/PetStateService.java | 2f022f4ab9c9b4bb35cca74da366e561d9af64e3 | [] | no_license | AlyonaV/PetMonitor | e73e81b287638463902d87054c2eadc11ea77c83 | bbc9ef811cf4688d5b1c0d51bd09471d7f9cbc3b | refs/heads/master | 2021-01-19T04:33:27.906754 | 2016-06-01T13:22:29 | 2016-06-01T13:22:29 | 60,178,794 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 277 | java | package com.springapp.mvc.service;
import com.springapp.mvc.persistence.model.PetState;
/**
* Created by Alona on 22.05.2016.
*/
public interface PetStateService {
PetState getById(Integer id);
void save(PetState petState);
void update(PetState petState);
}
| [
"Alona Vit"
] | Alona Vit |
bd43f6e5a9115163219bef057d71b88d3198923f | 2bbef9d5ae067c0327d915e7cd9ca0bf8d1a3108 | /src/main/java/View/HelpInfo/StartInfo.java | 1eb2aed29a48e711e542320ae466804e1116875d | [] | no_license | memphis8/w_info | 63c56dff0d29972f309ae02962007f0fe8b7ce13 | de5805f0c02f5fead4e29de71a6cfe31ba54852e | refs/heads/master | 2022-06-25T13:44:49.669347 | 2019-06-21T09:14:09 | 2019-06-21T09:14:09 | 193,065,261 | 1 | 0 | null | 2022-06-20T22:42:59 | 2019-06-21T08:54:41 | Java | UTF-8 | Java | false | false | 2,116 | java | package View.HelpInfo;
public class StartInfo {
public static void showStartInfo(){
System.out.println(" .----------------. .----------------. .-----------------. .----------------. .----------------. \n" +
"| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |\n" +
"| | _____ _____ | || | _____ | || | ____ _____ | || | _________ | || | ____ | |\n" +
"| ||_ _||_ _|| || | |_ _| | || ||_ \\|_ _| | || | |_ ___ | | || | .' `. | |\n" +
"| | | | /\\ | | | || | | | | || | | \\ | | | || | | |_ \\_| | || | / .--. \\ | |\n" +
"| | | |/ \\| | | || | | | | || | | |\\ \\| | | || | | _| | || | | | | | | |\n" +
"| | | /\\ | | || | _| |_ | || | _| |_\\ |_ | || | _| |_ | || | \\ `--' / | |\n" +
"| | |__/ \\__| | || | |_____| | || ||_____|\\____| | || | |_____| | || | `.____.' | |\n" +
"| | | || | | || | | || | | || | v1.0 | |\n" +
"| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |\n" +
" '----------------' '----------------' '----------------' '----------------' '----------------' ");
System.out.println("====================================================================================================");
System.out.println("☼ Welcome to weather application winfo !");
System.out.println("☼ Current weather : \"winfo -c YourCity\"");
System.out.println("☼ Weather forecast for 5 days : \"winfo -f YourCity\"");
System.out.println("☼ All weather info : \"winfo -a YourCity\"");
System.out.println("☼ Help information : \"winfo -h\"");
System.out.println("====================================================================================================");
}
}
| [
"uplmatches@gmail.com"
] | uplmatches@gmail.com |
52cae68efd39ea78a25395076f374b0c240c734a | 5ed389c1f3fc175aa73478fc3dcba4101520b80b | /java/src/main/java/com/spoonacular/client/ProgressResponseBody.java | fd9baf8e16ab0d8f09ae63c60a15b1b1cc4c194d | [
"MIT"
] | permissive | jvenlin/spoonacular-api-clients | fae17091722085017cae5d84215d3b4af09082aa | 63f955ceb2c356fefdd48ec634deb3c3e16a6ae7 | refs/heads/master | 2023-08-04T01:51:19.615572 | 2021-10-03T13:30:26 | 2021-10-03T13:30:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,938 | java | /*
* spoonacular API
* The spoonacular Nutrition, Recipe, and Food API allows you to access over 380,000 recipes, thousands of ingredients, 800,000 food products, and 100,000 menu items. Our food ontology and semantic recipe search engine makes it possible to search for recipes using natural language queries, such as \"gluten free brownies without sugar\" or \"low fat vegan cupcakes.\" You can automatically calculate the nutritional information for any recipe, analyze recipe costs, visualize ingredient lists, find recipes for what's in your fridge, find recipes based on special diets, nutritional requirements, or favorite ingredients, classify recipes into types and cuisines, convert ingredient amounts, or even compute an entire meal plan. With our powerful API, you can create many kinds of food and especially nutrition apps. Special diets/dietary requirements currently available include: vegan, vegetarian, pescetarian, gluten free, grain free, dairy free, high protein, whole 30, low sodium, low carb, Paleo, ketogenic, FODMAP, and Primal.
*
* The version of the OpenAPI document: 1.0
* Contact: mail@spoonacular.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.spoonacular.client;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import java.io.IOException;
import okio.Buffer;
import okio.BufferedSource;
import okio.ForwardingSource;
import okio.Okio;
import okio.Source;
public class ProgressResponseBody extends ResponseBody {
private final ResponseBody responseBody;
private final ApiCallback callback;
private BufferedSource bufferedSource;
public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) {
this.responseBody = responseBody;
this.callback = callback;
}
@Override
public MediaType contentType() {
return responseBody.contentType();
}
@Override
public long contentLength() {
return responseBody.contentLength();
}
@Override
public BufferedSource source() {
if (bufferedSource == null) {
bufferedSource = Okio.buffer(source(responseBody.source()));
}
return bufferedSource;
}
private Source source(Source source) {
return new ForwardingSource(source) {
long totalBytesRead = 0L;
@Override
public long read(Buffer sink, long byteCount) throws IOException {
long bytesRead = super.read(sink, byteCount);
// read() returns the number of bytes read, or -1 if this source is exhausted.
totalBytesRead += bytesRead != -1 ? bytesRead : 0;
callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
return bytesRead;
}
};
}
}
| [
"davidurbansky@gmail.com"
] | davidurbansky@gmail.com |
5baab3adaad612c779900e4ff92a4d9c92f63454 | 22d8379d28e037f537b27f598f79564b93d9163f | /sample-facade/src/main/java/in/hocg/sample/facade/api/IndexController.java | 2891a921783568ca54c9e33dcb3e27b3f2abe9b7 | [] | no_license | service-mesh-projects/spring-cloud-sample | dac9d65c21b6117736a995bf583357509bdd1e9f | ce41775515eac026b3cac66df4c3d54103cb0406 | refs/heads/master | 2022-06-26T20:58:23.504469 | 2019-06-09T01:56:17 | 2019-06-09T01:56:17 | 190,943,910 | 0 | 0 | null | 2022-06-17T02:12:34 | 2019-06-08T23:16:01 | Java | UTF-8 | Java | false | false | 367 | java | package in.hocg.sample.facade.api;
import in.hocg.sample.facade.domain.Example;
import java.util.List;
/**
* Created by hocgin on 2019/6/9.
* email: hocgin@gmail.com
*
* @author hocgin
*/
public interface IndexController {
/**
* Hi
*/
void hi();
void insert();
Example queryOne();
List<Example> queryAll();
}
| [
"hocgin@gmail.com"
] | hocgin@gmail.com |
e48dd16fd5df4e78213fa3535c26fb66febc20ce | 0715559d773bba23c1376a7217a6f8c5dce36c65 | /Plugins/TNT-TAG/src/main/java/org/jpwilliamson/sumoarena/ArenaPlugin.java | cd416f8ae0b6ab836dcad7e20c09764c26fd37dc | [] | no_license | kaushal-gawri9899/Advanced_MC_Plugins | df3d87b99550930129ef7ddb61303cb7e245d32b | bac456f4fb91a3f4822126ba429bc151e893ca04 | refs/heads/main | 2023-02-13T22:56:58.287525 | 2020-12-30T14:00:51 | 2020-12-30T14:00:51 | 324,824,559 | 0 | 0 | null | 2020-12-30T13:56:52 | 2020-12-27T18:33:13 | null | UTF-8 | Java | false | false | 3,604 | java | package org.jpwilliamson.sumoarena;
import lombok.Getter;
import org.jpwilliamson.sumoarena.command.ArenaCommandGroup;
import org.jpwilliamson.sumoarena.model.*;
import org.jpwilliamson.sumoarena.model.TestArena.TestArena;
import org.jpwilliamson.sumoarena.model.dm.DeathmatchArena;
import org.jpwilliamson.sumoarena.model.eggwars.EggWarsArena;
//import org.jpwilliamson.sumoarena.model.hideAndSeek.HideAndSeekArena;
import org.jpwilliamson.sumoarena.model.monster.MobArena;
import org.jpwilliamson.sumoarena.model.sumo.SumoArena;
import org.jpwilliamson.sumoarena.model.survival.SurvivalArena;
import org.jpwilliamson.sumoarena.model.team.ctf.CaptureTheFlagArena;
import org.jpwilliamson.sumoarena.model.team.tdm.TeamDeathmatchArena;
import org.jpwilliamson.sumoarena.model.tnt.TntTagArena;
import org.jpwilliamson.sumoarena.settings.Settings;
import org.jpwilliamson.sumoarena.task.EscapeTask;
import org.mineacademy.fo.Common;
import org.mineacademy.fo.command.SimpleCommand;
import org.mineacademy.fo.command.SimpleCommandGroup;
import org.mineacademy.fo.plugin.SimplePlugin;
import org.mineacademy.fo.settings.YamlStaticConfig;
import java.util.Arrays;
import java.util.List;
/**
* The core plugin class for Arena
*/
public final class ArenaPlugin extends SimplePlugin {
/**
* The main arena command
*/
@Getter
private final SimpleCommandGroup mainCommand = new ArenaCommandGroup();
/**
* Register arena types early
*/
@Override
protected void onPluginPreStart() {
// Register our arenas
ArenaManager.registerArenaType(MobArena.class);
ArenaManager.registerArenaType(DeathmatchArena.class);
ArenaManager.registerArenaType(TeamDeathmatchArena.class);
ArenaManager.registerArenaType(CaptureTheFlagArena.class);
ArenaManager.registerArenaType(EggWarsArena.class);
ArenaManager.registerArenaType(SumoArena.class);
//ArenaManager.registerArenaType(HideAndSeekArena.class);
ArenaManager.registerArenaType(SurvivalArena.class);
ArenaManager.registerArenaType(TntTagArena.class);
ArenaManager.registerArenaType(TestArena.class);
}
/**
* Load the plugin and its configuration
*/
@Override
protected void onPluginStart() {
// Connect to MySQL
// ArenaDatabase.start("mysql57.websupport.sk", 3311, "projectorion", "projectorion", "Te7=cXvxQI");
// Enable messages prefix
Common.ADD_TELL_PREFIX = true;
// Use themed messages in commands
SimpleCommand.USE_MESSENGER = true;
Common.runLater(() -> ArenaManager.loadArenas()); // Uncomment this line if your arena world is loaded by a third party plugin such as Multiverse
}
/**
* Called on startup and reload, load arenas
*/
@Override
protected void onReloadablesStart() {
//ArenaManager.loadArenas(); // Comment this line if your arena world is loaded by a third party plugin such as Multiverse
ArenaClass.loadClasses();
ArenaTeam.loadTeams();
ArenaReward.getInstance(); // Loads the file
ArenaPlayer.clearAllData();
registerEvents(new ArenaListener());
Common.runTimer(20, new EscapeTask());
}
/**
* Stop arenas on server stop
*/
@Override
protected void onPluginStop() {
ArenaManager.stopArenas(ArenaStopReason.PLUGIN);
}
/**
* Stop arenas on reload
*/
@Override
protected void onPluginReload() {
ArenaManager.stopArenas(ArenaStopReason.RELOAD);
ArenaManager.loadArenas(); // Uncomment this line if your arena world is loaded by a third party plugin such as Multiverse
}
/**
* Load the global settings classes
*/
@Override
public List<Class<? extends YamlStaticConfig>> getSettings() {
return Arrays.asList(Settings.class);
}
}
| [
"gawrikaushal9899@gmail.com"
] | gawrikaushal9899@gmail.com |
0dd858f75d12cc92ea1e2d71568db5079297ba0d | e23e239b54b9d3aa227ba5ef0e3d56c8bc24c0d2 | /src/test/java/com/catalystone/mbs/controller/AdminControllerTest.java | 6765956c00f7f28e87b6dc36bde0c13bbd18ae52 | [] | no_license | sdhawan27/mbs | f744236fa2239f9b12b049e8dc59f0221d75e7d8 | 617064412663d9b38a872c24ef910ed50bd003ff | refs/heads/master | 2020-06-29T01:50:18.114845 | 2019-08-04T16:29:39 | 2019-08-04T16:29:39 | 200,339,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,039 | java | package com.catalystone.mbs.controller;
import com.catalystone.mbs.entity.Theater;
import com.catalystone.mbs.exception.AdminException;
import com.catalystone.mbs.repository.TheaterRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class AdminControllerTest {
@Mock
TheaterRepository trepo;
@InjectMocks
AdminController controller;
@Test(expected= AdminException.class)
public void testDeleteTheaterWithException() throws AdminException {
controller.deleteTheater(new String("1"));
Mockito.when(trepo.findByTid(1L)).thenReturn(null);
}
@Test
public void testDeleteTheater() throws AdminException{
Theater t = new Theater();
Mockito.when(trepo.findByTid(1L)).thenReturn(t);
controller.deleteTheater(new String("1"));
Mockito.verify(trepo).delete(t);
}
}
| [
"53635699+sdhawan27@users.noreply.github.com"
] | 53635699+sdhawan27@users.noreply.github.com |
c9a0836c04ea0429ffe1b7093c435e7a30d3d433 | c2fa8970c5b0295bcbecb903175057d588311a2f | /src/main/java/SeleniumMethods/LanchBrowserConcept.java | ac048475a92d36532829d049801c4b687633ec80 | [] | no_license | ademkaragoz/SeleniumCodeStudies | 95cc95a23edbc1acd20dfee3ab64edd3a3d388b1 | 1da50ba00d72b52bc2d0d2695168b56f83ba8e0e | refs/heads/master | 2023-04-16T16:34:36.007628 | 2020-07-25T07:31:39 | 2020-07-25T07:31:39 | 282,394,047 | 0 | 0 | null | 2021-04-26T20:31:26 | 2020-07-25T07:27:58 | Java | UTF-8 | Java | false | false | 1,035 | java | package SeleniumMethods;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.opera.OperaDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class LanchBrowserConcept {
public static WebDriver driver;
public static void main(String[] args) {
String browser = "chrome";
if (browser.equals("chrome")) {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}else if(browser.equals("firefox")){
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver();
}else if (browser.equals("IE")) {
WebDriverManager.iedriver().setup();
driver = new InternetExplorerDriver();
} else if(browser.equals("opera")) {
WebDriverManager.operadriver().setup();
driver = new OperaDriver();
}else {
System.out.println("no defined browser");
}
driver.get("https://learnsdet.com/");
}
}
| [
"newuser@newusers-MacBook-Pro.local"
] | newuser@newusers-MacBook-Pro.local |
a4add1f865275ce0865fae5a9479192b3431aa45 | 2254def0c4f67f53e46d1e7fa17c58a59b507e13 | /app/src/main/java/com/util/ActionBarUtil.java | 4c4e786d3b232aa19d83193b202d9843fa74ce09 | [] | no_license | PurpleFrontPvtLtd/Kriddr_Pet_Parent_Share | 77e535d187050259837323eeaba1ede0092c9de8 | 3d0786ec0f9ab825872d8be0bde6e23e011905b3 | refs/heads/master | 2020-03-29T19:21:39.635382 | 2018-09-25T12:11:39 | 2018-09-25T12:11:39 | 150,259,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,792 | java | package com.util;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.telephony.PhoneNumberFormattingTextWatcher;
import android.view.Gravity;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import purplefront.com.kriddrpetparent.R;
/**
* Created by Niranjan Reddy on 12-02-2018.
*/
public class ActionBarUtil {
AppCompatActivity CallActivity;
ImageView imgBack, imgSettings, imgSearch,imgNotify,imgSharePet;
TextView txtTitle;
EditText edtSearch;
ActionBar actionBar;
public ActionBarUtil(AppCompatActivity activity) {
CallActivity = activity;
actionBar = CallActivity.getSupportActionBar();
SetView();
setViewInvisible();
}
public void setViewInvisible(){
imgSettings.setVisibility(View.INVISIBLE);
imgBack.setVisibility(View.INVISIBLE);
imgSearch.setVisibility(View.INVISIBLE);
imgNotify.setVisibility(View.INVISIBLE);
edtSearch.setVisibility(View.INVISIBLE);
txtTitle.setVisibility(View.INVISIBLE);
imgSharePet.setVisibility(View.INVISIBLE);
edtSearch.setText("");
txtTitle.setClickable(false);
txtTitle.setGravity(Gravity.CENTER_VERTICAL);
}
public void setActionBarVisible() {
actionBar.show();
}
public void SetActionBarHide() {
actionBar.hide();
}
public void SetView() {
actionBar.setCustomView(R.layout.actionbar_view);
actionBar.setDisplayShowCustomEnabled(true);
View v = actionBar.getCustomView();
txtTitle = (TextView) v.findViewById(R.id.textBarTitle);
imgBack = (ImageView) v.findViewById(R.id.img_actionBarBack);
imgSettings = (ImageView) v.findViewById(R.id.img_settings_menu);
edtSearch = (EditText) v.findViewById(R.id.edtSearchText);
imgSearch = (ImageView) v.findViewById(R.id.imgSearch);
imgNotify= (ImageView) v.findViewById(R.id.img_Notify);
imgSharePet=(ImageView)v.findViewById(R.id.imgSharePet);
edtSearch.addTextChangedListener(new PhoneNumberFormattingTextWatcher("US"));
}
public void setTitle(String title) {
txtTitle.setText(title);
}
public EditText getEdtSearch(){
return edtSearch;
}
public TextView getTitle(){
return txtTitle;
}
public ImageView getImgBack() {
return imgBack;
}
public ImageView getImgSharePet(){
return imgSharePet;
}
public ImageView getImgSettings() {
return imgSettings;
}
public ImageView getImgNotify(){
return imgNotify;
}
public ImageView getImgSearch() {
return imgSearch;
}
}
| [
"shankarmegha4@gmail.com"
] | shankarmegha4@gmail.com |
db54a635c9e9846755c1dd48ba369de52e79a503 | 117db017c2e7c8e2c0803f85cb8e66625a07b4b4 | /src/com/example/watchwaterpollution/WaterManager.java | 4df88aae4549072d25069d69ed797690fb5fa78b | [] | no_license | sausame/water | 7a8d7e2527a5fdf4e6eabe386479cbb7e31001bc | 9bdff60924a55459ce961b8d4fa6e856948ce02b | refs/heads/master | 2016-09-06T09:29:39.257670 | 2013-10-21T09:01:01 | 2013-10-21T09:01:01 | 13,644,764 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,434 | java | package com.example.watchwaterpollution;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class WaterManager {
private static final String TAG = "WaterManager";
private JSONArray mJsonArray = null;
private int mCurrentIndex = 0;
private String mPathname;
public void setPathname(String path) {
mPathname = path;
}
public int getSize() {
return mJsonArray == null ? 0 : mJsonArray.length();
}
public void load() {
try {
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(mPathname)));
String line = null;
while ((line = br.readLine()) != null) {
sb.append(line + "\n");
}
br.close();
setWaterBuffer(sb.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
public void save() {
if (null == mJsonArray || 0 == mJsonArray.length()) {
Log.e(TAG, "Nothing is needed to save.");
return;
}
try {
String jsonString = mJsonArray.toString();
OutputStreamWriter osw = new OutputStreamWriter(
new FileOutputStream(mPathname));
osw.write(jsonString, 0, jsonString.length());
osw.flush();
osw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
private void setWaterBuffer(String buffer) {
try {
mJsonArray = new JSONArray(buffer);
mCurrentIndex = 0;
if (0 == mJsonArray.length()) {
mJsonArray = null;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public void reset() {
mCurrentIndex = 0;
}
public boolean add(Water water) {
reset();
if (mJsonArray == null) {
mJsonArray = new JSONArray();
}
mJsonArray.put(water.toJSONObject());
return true;
}
public boolean del(int id) {
reset();
JSONArray array = new JSONArray();
Water water = null;
for (; null != (water = getWater()); id--) {
if (0 == id) {
continue;
}
array.put(water.toJSONObject());
}
mJsonArray = array;
return true;
}
public boolean modify(int id, Water water) {
if (!del(id)) {
return false;
}
return add(water);
}
public Water getWater() {
if (null == mJsonArray || mCurrentIndex >= mJsonArray.length()) {
Log.d(TAG, (mJsonArray == null) ? "NO array" : "" + mCurrentIndex
+ " >= " + mJsonArray.length());
return null;
}
try {
JSONObject obj = mJsonArray.getJSONObject(mCurrentIndex++);
return Water.parseWater(obj);
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
public String toString() {
String str = "\n-------------------------------------------------------------------------------\n";
str += "Pathname: " + mPathname + "\n";
try {
str += mJsonArray.toString(2);
} catch (JSONException e) {
e.printStackTrace();
} catch (RuntimeException e) {
e.printStackTrace();
}
str += "\n-------------------------------------------------------------------------------\n";
return str;
}
public static void test() {
WaterManager manager = new WaterManager();
manager.setPathname("/sdcard/water.json");
manager.load();
Log.i(TAG, manager.toString());
manager.add(Water.createRandomWater());
manager.save();
Log.i(TAG, manager.toString());
}
}
| [
"b015@borqs.com"
] | b015@borqs.com |
4145a5a129ffb068da0b5e043c361dcd050cdd0a | 4fa264697620bcb1bba06a0cff1c2b4ed4bb1ec4 | /Care.Android/app/src/androidTest/java/com/example/care/ApplicationTest.java | 2ae047e37bfb1d8d3a9585a0524dcc894d3ee9d3 | [] | no_license | Akshshr/care | c4b16d509592256634fc1f59c8b0eb4b13405596 | f322efcf71460c9e26170914d48710f8c32f2bb4 | refs/heads/master | 2021-01-24T23:11:29.477236 | 2015-06-27T14:30:56 | 2015-06-27T14:30:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.example.care;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"zika.mancev@gmail.com"
] | zika.mancev@gmail.com |
e6b248e9edd561381f7592ada76d33c14bdbbcdb | 0dea2f104f1b0b01149ba5e25ca8e125d1fe8404 | /codeforces/1519/D.java | cc6cacfa35c4f4b92821e38b94dbebf82feb3faa | [] | no_license | sudhanshu-mallick/All-My-Submissions | d14f82c38515d6140338daf5b77bdf2675c8aab6 | 68a97691fad0368a4ba4c39576e45ba8462ad3ae | refs/heads/master | 2023-06-22T16:01:20.872407 | 2021-07-03T13:07:00 | 2021-07-26T08:25:14 | 377,220,272 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,053 | java | import java.util.*;
import java.io.*;
public class Maximum_Sum_Of_Products {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static void shuffle(int[] a) {
Random r = new Random();
for (int i = 0; i <= a.length - 2; i++) {
int j = i + r.nextInt(a.length - i);
swap(a, i, j);
}
Arrays.sort(a);
}
public static void swap(int[] a, int i, int j) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
FastReader t = new FastReader();
PrintWriter o = new PrintWriter(System.out);
int n = t.nextInt();
long[] a = new long[n];
long[] b = new long[n];
long max = 0, total = 0;
for (int i = 0; i < n; ++i)
a[i] = t.nextLong();
for (int i = 0; i < n; ++i) {
b[i] = t.nextLong();
total += a[i] * b[i];
}
max = total;
for (int i = 0; i < n; ++i) {
int x = i - 1, y = i + 1;
long cur = total;
while (x >= 0 && y < n) {
cur = cur - a[x] * b[x] - a[y] * b[y] + a[x] * b[y] + a[y] * b[x];
--x;
++y;
max = Math.max(max, cur);
}
}
for (int i = 0; i < n; ++i) {
long cur = total;
int x = i, y = i + 1;
while (x >= 0 && y < n) {
cur = cur - a[x] * b[x] - a[y] * b[y] + a[x] * b[y] + a[y] * b[x];
--x;
++y;
max = Math.max(max, cur);
}
}
o.println(max);
o.flush();
o.close();
}
} | [
"sudhanshumallick9@gmail.com"
] | sudhanshumallick9@gmail.com |
fd22018ed17b79a68b86660df00c13accd15a61b | ccaa535498e3daa911985bc3fc0e396eaf56e226 | /spider-55haitao-realtime/src/main/java/com/haitao55/spider/realtime/service/impl/RealtimeStatisticsServiceImpl.java | a82cefa0bba3f52014be4fd68cb608412903e895 | [] | no_license | github4n/spider-55ht | d871aad6e51f7cf800032351137b4b3f12d6e86e | 7c59cda6b5b514139bd69cff2b914e0815f53cd6 | refs/heads/master | 2020-03-29T22:44:38.527732 | 2018-02-01T07:53:30 | 2018-02-01T07:53:30 | 150,438,349 | 1 | 0 | null | 2018-09-26T14:19:14 | 2018-09-26T14:19:14 | null | UTF-8 | Java | false | false | 1,969 | java | package com.haitao55.spider.realtime.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.haitao55.spider.common.dao.RealtimeStatisticsDAO;
import com.haitao55.spider.common.dos.RealtimeStatisticsDO;
import com.haitao55.spider.common.service.impl.BaseService;
import com.haitao55.spider.realtime.service.RealtimeStatisticsService;
/**
* RealtimeStatistics Service 实现类
* Title:
* Description:
* Company: 55海淘
* @author zhaoxl
* @date 2017年1月19日 下午2:23:55
* @version 1.0
*/
@Service("realtimeStatisticsService")
public class RealtimeStatisticsServiceImpl extends BaseService<RealtimeStatisticsDO> implements RealtimeStatisticsService {
@Autowired
private RealtimeStatisticsDAO realtimeStatisticsDAO;
/**
* save or update
*/
@Override
public void saveOrUpdate(RealtimeStatisticsDO realtimeStatisticsDO) {
String realtimeTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
realtimeStatisticsDO.setRealtimeTime(realtimeTime);
RealtimeStatisticsDO selectByKey = realtimeStatisticsDAO.findByPrimaryKey(realtimeStatisticsDO.getTaskId(),realtimeTime);
if(null == selectByKey){
this.save(realtimeStatisticsDO);
}else{
int crawler = selectByKey.getCrawler();
if(0 != realtimeStatisticsDO.getCrawler()){
crawler = crawler +1;
}
int mongo = selectByKey.getMongo();
if(0 != realtimeStatisticsDO.getMongo()){
mongo = mongo+1;
}
int redis = selectByKey.getRedis();
if(0 != realtimeStatisticsDO.getRedis()){
redis = redis+1;
}
int exception = selectByKey.getException();
if(0 != realtimeStatisticsDO.getException()){
exception = exception+1;
}
selectByKey.setCrawler(crawler);
selectByKey.setMongo(mongo);
selectByKey.setRedis(redis);
selectByKey.setException(exception);
this.updateNotNull(selectByKey);
}
}
}
| [
"liusz_ok@126.com"
] | liusz_ok@126.com |
557d1f2a057e1f550b89ad92e0e979aa4eabba3e | 2d66a5012b7f7763eb58bd93e9a71241614123c8 | /ezcloud-wechat/src/main/java/com/ezcloud/framework/weixin/service/BaseWeiXinProcessWervice.java | d889f062078c6242d8025bcf431c0fd089692714 | [] | no_license | javakaka/ezcloud-dev | 98c8f1e6fc9125fce597ad52e6c24ce11d933e03 | e67643aa609c0f095825881bff7a27afa9a919f0 | refs/heads/master | 2020-04-12T09:35:16.702707 | 2017-01-27T05:20:09 | 2017-01-27T05:20:09 | 62,430,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,820 | java | package com.ezcloud.framework.weixin.service;
import com.ezcloud.framework.weixin.model.Message;
import com.ezcloud.framework.weixin.model.OutMessage;
public abstract class BaseWeiXinProcessWervice {
/**
* 对微信请求进行业务处理
* @author Administrator
*/
/****接收微信发来的请求消息类型**/
//接收的文本消息
public static final String REQUEST_MSG_TYPE_TEXT ="text";
//接收的图片消息
public static final String REQUEST_MSG_TYPE_IMAGE ="image";
//接收的语音消息
public static final String REQUEST_MSG_TYPE_VOICE ="voice";
//接收的语音识别消息
public static final String REQUEST_MSG_TYPE_VOICE_RECOGNITION ="voice_recognition";
//接收的视频消息
public static final String REQUEST_MSG_TYPE_VIDEO ="video";
//接收的地理位置消息
public static final String REQUEST_MSG_TYPE_LOCATION ="location";
//接收的链接消息
public static final String REQUEST_MSG_TYPE_LINK ="link";
//接收的事件消息
public static final String REQUEST_MSG_TYPE_EVENT ="event";
//接收的关注事件消息
public static final String REQUEST_MSG_TYPE_EVENT_SUBSCRIBE ="subscribe";
//接收的取消关注事件消息
public static final String REQUEST_MSG_TYPE_EVENT_UNSUBSCRIBE ="unsubscribe";
//接收的未关注时扫描二维码消息
public static final String REQUEST_MSG_TYPE_EVENT_SCAN_UNSUBSCRIBE ="scan_unsubscribe";
//接收的已关注公众号时扫描二维码的消息
public static final String REQUEST_MSG_TYPE_EVENT_SCAN_SUBSCRIBE ="scan_subscribe";
//接收的上报地理位置事件消息
public static final String REQUEST_MSG_TYPE_EVENT_LOCATION ="LOCATION";
//接收的用户点击事件消息
public static final String REQUEST_MSG_TYPE_EVENT_CLICK ="CLICK";
//接收用户的自定义菜单点击事件消息
public static final String REQUEST_MSG_TYPE_EVENT_VIEW ="VIEW";
//接收用户的自定义菜单点击 scancode_push:扫码推事件的事件推送
public static final String REQUEST_MSG_TYPE_EVENT_SCANCODE_PUSH ="scancode_push";
//接收用户的自定义菜单点击 scancode_waitmsg:扫码推事件且弹出“消息接收中”提示框的事件推送
public static final String REQUEST_MSG_TYPE_EVENT_SCANCODE_WAITMSG ="scancode_waitmsg";
//自定义菜单点击 pic_sysphoto:弹出系统拍照发图的事件推送
public static final String REQUEST_MSG_TYPE_EVENT_PIC_SYSPHOTO ="pic_sysphoto";
//自定义菜单点击 pic_photo_or_album:弹出拍照或者相册发图的事件推送
public static final String REQUEST_MSG_TYPE_EVENT_PIC_PHOTO_OR_ALBUM ="pic_photo_or_album";
//自定义菜单点击 pic_weixin:弹出微信相册发图器的事件推送
public static final String REQUEST_MSG_TYPE_EVENT_PIC_WEIXIN ="pic_weixin";
//自定义菜单点击 location_select:弹出地理位置选择器的事件推送
public static final String REQUEST_MSG_TYPE_EVENT_LOCATION_SELECT ="location_select";
/***返回的被动响应消息类型**/
//返回文本消息
public static final String RESPONSE_MESSAGE_TYPE_TEXT = "text";
//返回图片消息
public static final String RESPONSE_MESSAGE_TYPE_IMAGE = "image";
//返回语音消息
public static final String RESPONSE_MESSAGE_TYPE_VOICE = "voice";
//返回视频消息
public static final String RESPONSE_MESSAGE_TYPE_VIDEO = "video";
//返回音乐消息
public static final String RESPONSE_MESSAGE_TYPE_MUSIC = "music";
//返回图文消息
public static final String RESPONSE_MESSAGE_TYPE_NEWS = "news";
/***返回的客服消息类型**/
//客服文本消息
public static final String RESPONSE_CUSTOM_MESSAGE_TYPE_TEXT = "text";
//客服图片消息
public static final String RESPONSE_CUSTOM_MESSAGE_TYPE_IMAGE = "image";
//客服语音消息
public static final String RESPONSE_CUSTOM_MESSAGE_TYPE_VOICE = "voice";
//客服视频消息
public static final String RESPONSE_CUSTOM_MESSAGE_TYPE_VIDEO = "video";
//客服音乐消息
public static final String RESPONSE_CUSTOM_MESSAGE_TYPE_MUSIC = "music";
//客服图文消息
public static final String RESPONSE_CUSTOM_MESSAGE_TYPE_NEWS = "news";
private Message outMsg;
//处理文本请求
public abstract OutMessage handleTextMsgRequest(Object msg);
//处理图片请求
public abstract OutMessage handleImageMsgRequest(Object msg);
//处理普通语音请求
public abstract OutMessage handleVoiceMsgRequest(Object msg);
//处理普通语音请求
public abstract OutMessage handleVoiceRecognitionMsgRequest(Object msg);
//处理视频请求
public abstract OutMessage handleVideoMsgRequest(Object msg);
//处理位置信息请求
public abstract OutMessage handleLocationMsgRequest(Object msg);
//处理链接信息请求
public abstract OutMessage handleLinkMsgRequest(Object msg);
//处理事件
public abstract OutMessage handleEventMsgRequest(Object msg);
//已关注时扫描二维码事件
public abstract OutMessage handleScanSubscribeEventMsgRequest(Object msg);
//未关注时扫描二维码事件
public abstract OutMessage handleScanUnSubscribeEventMsgRequest(Object msg);
//处理上报地理位置事件
public abstract OutMessage handleLocationEventMsgRequest(Object msg);
//处理自定义菜单点击拉取消息事件
public abstract OutMessage handleClickEventMsgRequest(Object msg);
//处理自定义菜单点击拉取消息事件
public abstract OutMessage handleClickViewEventMsgRequest(Object msg);
//处理自定义菜单点击拉取消息事件
public abstract OutMessage handleClickScancodePushEventMsgRequest(Object msg);
//自定义菜单点击 scancode_waitmsg:扫码推事件且弹出“消息接收中”提示框的事件推送
public abstract OutMessage handleClickScancodeWaitmsgEventMsgRequest(Object msg);
//自定义菜单点击 pic_sysphoto:弹出系统拍照发图的事件推送
public abstract OutMessage handleClickPicSysphotoEventMsgRequest(Object msg);
//自定义菜单点击 pic_photo_or_album:弹出拍照或者相册发图的事件推送
public abstract OutMessage handleClickPicPhotoOrAlbumEventMsgRequest(Object msg);
//自定义菜单点击 pic_weixin:弹出微信相册发图器的事件推送
public abstract OutMessage handleClickPicWeixinEventMsgRequest(Object msg);
//自定义菜单点击 location_select:弹出地理位置选择器的事件推送
public abstract OutMessage handleClickLocationSelectEventMsgRequest(Object msg);
//处理关注事件
public abstract OutMessage handleSubscribeEventMsgRequest(Object msg);
//处理取消关注事件
public abstract OutMessage handleUnSubscribeEventMsgRequest(Object msg);
} | [
"510836102@qq.com"
] | 510836102@qq.com |
be5b0edfb33ce72b80606c651e9326f36efe32aa | 8fddc4db622a5a9e6e5075bcf76decfe35220afe | /src/gui/Transaction.java | 31cf5dfeb35f7aa28d087156ae57fd4f9288e00b | [] | no_license | richlim16/oop-ordering-system | 523c31cb56f008a4508ba85fbc08c8907ac4ca68 | e9810a81b18b18bbd541e1d736ca3b5c91a11f69 | refs/heads/main | 2023-02-08T00:03:54.162614 | 2020-12-30T14:34:11 | 2020-12-30T14:34:11 | 316,720,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | 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 gui;
/**
*
* @author Rich Tristan Lim
*/
interface Transaction {
public void send(String msg);
}
| [
"richlim16@gmail.com"
] | richlim16@gmail.com |
7df9a232a1cf1b4a4522717b3575eb650ec9182c | 419e0607d4bb1ff298faca921447ee4b35e5b894 | /plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/RussianStemTokenFilterFactory.java | 24bb509530c1b22d70a09c22995954893a75b970 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | crate/crate | 7af793e2f709b77a5addc617d6e9dbba452d4e68 | 8acb044a7cdbab048b045854d0466fccc2492550 | refs/heads/master | 2023-08-31T07:17:42.891453 | 2023-08-30T15:09:09 | 2023-08-30T17:13:14 | 9,342,529 | 3,540 | 639 | Apache-2.0 | 2023-09-14T21:00:43 | 2013-04-10T09:17:16 | Java | UTF-8 | Java | false | false | 1,548 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.analysis.common;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.snowball.SnowballFilter;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.analysis.AbstractTokenFilterFactory;
public class RussianStemTokenFilterFactory extends AbstractTokenFilterFactory {
public RussianStemTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
super(indexSettings, name, settings);
}
@Override
public TokenStream create(TokenStream tokenStream) {
return new SnowballFilter(tokenStream, "Russian");
}
} | [
"f.mathias@zignar.net"
] | f.mathias@zignar.net |
093b75e2c479bc11c026c071ccc1218494da1323 | 145071f8d7e82d12fc12f857888c8d4ce024966c | /ODE_Metamodel/ode.concept.deis/src/artifact/util/Artifact_Switch.java | d69ffca8b79f4d995f18793c2ec3695e88ad959a | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | declan-whiting/DDI-Scripting-Tools | dd65032caf9bb579176218a85c7ea100858bcd63 | 90464c02f64c00ea0a77a158bebca14e7cb4f12b | refs/heads/master | 2020-08-22T10:11:27.005879 | 2019-05-17T23:04:21 | 2019-05-17T23:04:21 | 216,372,168 | 1 | 0 | MIT | 2019-10-20T14:10:21 | 2019-10-20T14:10:21 | null | UTF-8 | Java | false | false | 18,952 | java | /**
*/
package artifact.util;
import artifact.*;
import base.ArtifactElement;
import base.Element;
import base.ModelElement;
import base.SACMElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.Switch;
/**
* <!-- begin-user-doc -->
* The <b>Switch</b> for the model's inheritance hierarchy.
* It supports the call {@link #doSwitch(EObject) doSwitch(object)}
* to invoke the <code>caseXXX</code> method for each class of the model,
* starting with the actual class of the object
* and proceeding up the inheritance hierarchy
* until a non-null result is returned,
* which is the result of the switch.
* <!-- end-user-doc -->
* @see artifact.Artifact_Package
* @generated
*/
public class Artifact_Switch<T> extends Switch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static Artifact_Package modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Artifact_Switch() {
if (modelPackage == null) {
modelPackage = Artifact_Package.eINSTANCE;
}
}
/**
* Checks whether this is a switch for the given package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param ePackage the package in question.
* @return whether this is a switch for the given package.
* @generated
*/
@Override
protected boolean isSwitchFor(EPackage ePackage) {
return ePackage == modelPackage;
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
@Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case Artifact_Package.ARTIFACT_GROUP: {
ArtifactGroup artifactGroup = (ArtifactGroup)theEObject;
T result = caseArtifactGroup(artifactGroup);
if (result == null) result = caseArtifactElement(artifactGroup);
if (result == null) result = caseModelElement(artifactGroup);
if (result == null) result = caseSACMElement(artifactGroup);
if (result == null) result = caseElement(artifactGroup);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.ARTIFACT_PACKAGE: {
ArtifactPackage artifactPackage = (ArtifactPackage)theEObject;
T result = caseArtifactPackage(artifactPackage);
if (result == null) result = caseArtifactElement(artifactPackage);
if (result == null) result = caseModelElement(artifactPackage);
if (result == null) result = caseSACMElement(artifactPackage);
if (result == null) result = caseElement(artifactPackage);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.ARTIFACT_PACKAGE_BINDING: {
ArtifactPackageBinding artifactPackageBinding = (ArtifactPackageBinding)theEObject;
T result = caseArtifactPackageBinding(artifactPackageBinding);
if (result == null) result = caseArtifactPackage(artifactPackageBinding);
if (result == null) result = caseArtifactElement(artifactPackageBinding);
if (result == null) result = caseModelElement(artifactPackageBinding);
if (result == null) result = caseSACMElement(artifactPackageBinding);
if (result == null) result = caseElement(artifactPackageBinding);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.ARTIFACT_PACKAGE_INTERFACE: {
ArtifactPackageInterface artifactPackageInterface = (ArtifactPackageInterface)theEObject;
T result = caseArtifactPackageInterface(artifactPackageInterface);
if (result == null) result = caseArtifactPackage(artifactPackageInterface);
if (result == null) result = caseArtifactElement(artifactPackageInterface);
if (result == null) result = caseModelElement(artifactPackageInterface);
if (result == null) result = caseSACMElement(artifactPackageInterface);
if (result == null) result = caseElement(artifactPackageInterface);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.ARTIFACT_ASSET: {
ArtifactAsset artifactAsset = (ArtifactAsset)theEObject;
T result = caseArtifactAsset(artifactAsset);
if (result == null) result = caseArtifactElement(artifactAsset);
if (result == null) result = caseModelElement(artifactAsset);
if (result == null) result = caseSACMElement(artifactAsset);
if (result == null) result = caseElement(artifactAsset);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.PROPERTY: {
Property property = (Property)theEObject;
T result = caseProperty(property);
if (result == null) result = caseArtifactAsset(property);
if (result == null) result = caseArtifactElement(property);
if (result == null) result = caseModelElement(property);
if (result == null) result = caseSACMElement(property);
if (result == null) result = caseElement(property);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.TECHNIQUE: {
Technique technique = (Technique)theEObject;
T result = caseTechnique(technique);
if (result == null) result = caseArtifactAsset(technique);
if (result == null) result = caseArtifactElement(technique);
if (result == null) result = caseModelElement(technique);
if (result == null) result = caseSACMElement(technique);
if (result == null) result = caseElement(technique);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.PARTICIPANT: {
Participant participant = (Participant)theEObject;
T result = caseParticipant(participant);
if (result == null) result = caseArtifactAsset(participant);
if (result == null) result = caseArtifactElement(participant);
if (result == null) result = caseModelElement(participant);
if (result == null) result = caseSACMElement(participant);
if (result == null) result = caseElement(participant);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.ACTIVITY: {
Activity activity = (Activity)theEObject;
T result = caseActivity(activity);
if (result == null) result = caseArtifactAsset(activity);
if (result == null) result = caseArtifactElement(activity);
if (result == null) result = caseModelElement(activity);
if (result == null) result = caseSACMElement(activity);
if (result == null) result = caseElement(activity);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.EVENT: {
Event event = (Event)theEObject;
T result = caseEvent(event);
if (result == null) result = caseArtifactAsset(event);
if (result == null) result = caseArtifactElement(event);
if (result == null) result = caseModelElement(event);
if (result == null) result = caseSACMElement(event);
if (result == null) result = caseElement(event);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.RESOURCE: {
Resource resource = (Resource)theEObject;
T result = caseResource(resource);
if (result == null) result = caseArtifactAsset(resource);
if (result == null) result = caseArtifactElement(resource);
if (result == null) result = caseModelElement(resource);
if (result == null) result = caseSACMElement(resource);
if (result == null) result = caseElement(resource);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.ARTIFACT: {
Artifact artifact = (Artifact)theEObject;
T result = caseArtifact(artifact);
if (result == null) result = caseArtifactAsset(artifact);
if (result == null) result = caseArtifactElement(artifact);
if (result == null) result = caseModelElement(artifact);
if (result == null) result = caseSACMElement(artifact);
if (result == null) result = caseElement(artifact);
if (result == null) result = defaultCase(theEObject);
return result;
}
case Artifact_Package.ARTIFACT_ASSET_RELATIONSHIP: {
ArtifactAssetRelationship artifactAssetRelationship = (ArtifactAssetRelationship)theEObject;
T result = caseArtifactAssetRelationship(artifactAssetRelationship);
if (result == null) result = caseArtifactAsset(artifactAssetRelationship);
if (result == null) result = caseArtifactElement(artifactAssetRelationship);
if (result == null) result = caseModelElement(artifactAssetRelationship);
if (result == null) result = caseSACMElement(artifactAssetRelationship);
if (result == null) result = caseElement(artifactAssetRelationship);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Artifact Group</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Artifact Group</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArtifactGroup(ArtifactGroup object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Artifact Package</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Artifact Package</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArtifactPackage(ArtifactPackage object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Artifact Package Binding</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Artifact Package Binding</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArtifactPackageBinding(ArtifactPackageBinding object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Artifact Package Interface</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Artifact Package Interface</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArtifactPackageInterface(ArtifactPackageInterface object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Artifact Asset</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Artifact Asset</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArtifactAsset(ArtifactAsset object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Property</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Property</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseProperty(Property object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Technique</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Technique</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTechnique(Technique object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Participant</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Participant</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseParticipant(Participant object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Activity</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Activity</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseActivity(Activity object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Event</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Event</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEvent(Event object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Resource</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Resource</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseResource(Resource object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Artifact</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Artifact</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArtifact(Artifact object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Artifact Asset Relationship</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Artifact Asset Relationship</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArtifactAssetRelationship(ArtifactAssetRelationship object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Element</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseElement(Element object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>SACM Element</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>SACM Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSACMElement(SACMElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Model Element</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Model Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseModelElement(ModelElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Artifact Element</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Artifact Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArtifactElement(ArtifactElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch, but this is the last case anyway.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>EObject</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
@Override
public T defaultCase(EObject object) {
return null;
}
} //Artifact_Switch
| [
"josh.frey89@gmail.com"
] | josh.frey89@gmail.com |
f10a7747505ec9230746f8e806e4141019fc03f3 | b3942abc20b7b6a46c249de1c6bc7320c592b65f | /java/eclipse-workspace/hellowMaven/src/test/java/com/AndyYUE/maven/HellowMavenTest.java | c51b510366017300883d5af81b90e6fcaf537d42 | [] | no_license | dbyqs21/My_Code | b093da2a953d8f3d200a61cf1101994bfb698c3c | c14bc4e6b01855cbf1376d417918df84f1c1bdd3 | refs/heads/master | 2021-07-17T10:07:52.856835 | 2017-10-08T13:17:57 | 2017-10-08T13:17:57 | 100,031,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package com.AndyYUE.maven;
import org.junit.Test;
import static junit.framework.Assert.*;
public class HellowMavenTest
{
@Test
public void sayHellowTest()
{
HellowMaven hm = new HellowMaven();
String result = hm.sayHellow("zhangsan");
assertEquals("hellow zhangsan",result);
}
} | [
"dbyqs21@126.com"
] | dbyqs21@126.com |
8c67118eced94ba31453e841c5756a4e33e8ec92 | 76daa024dc7e129ea719502853dc523e9fcea7e8 | /starter/app/build/tmp/kapt3/stubs/debug/com/raywenderlich/android/redditclone/models/Post.java | 4175986c99ded91fb9f7dd92a729224d9ac7a227 | [] | no_license | begarss/AdvancedAndroidLabs | 99987e03bb6fcb84af1b075b363491966d590de2 | 553b99290e82281e07a61558a68767551c9c118f | refs/heads/master | 2023-01-19T19:03:45.888970 | 2020-11-29T21:05:22 | 2020-11-29T21:05:22 | 297,145,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,685 | java | package com.raywenderlich.android.redditclone.models;
import java.lang.System;
@kotlin.Metadata(mv = {1, 4, 0}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u001a\b\u0086\b\u0018\u00002\u00020\u0001B=\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\u0007\u0012\u0006\u0010\t\u001a\u00020\n\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\r\u001a\u00020\u0007\u00a2\u0006\u0002\u0010\u000eJ\t\u0010\u001a\u001a\u00020\u0003H\u00c6\u0003J\t\u0010\u001b\u001a\u00020\u0005H\u00c6\u0003J\t\u0010\u001c\u001a\u00020\u0007H\u00c6\u0003J\t\u0010\u001d\u001a\u00020\u0007H\u00c6\u0003J\t\u0010\u001e\u001a\u00020\nH\u00c6\u0003J\t\u0010\u001f\u001a\u00020\fH\u00c6\u0003J\t\u0010 \u001a\u00020\u0007H\u00c6\u0003JO\u0010!\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\b\b\u0002\u0010\u0004\u001a\u00020\u00052\b\b\u0002\u0010\u0006\u001a\u00020\u00072\b\b\u0002\u0010\b\u001a\u00020\u00072\b\b\u0002\u0010\t\u001a\u00020\n2\b\b\u0002\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\r\u001a\u00020\u0007H\u00c6\u0001J\u0013\u0010\"\u001a\u00020\f2\b\u0010#\u001a\u0004\u0018\u00010\u0001H\u00d6\u0003J\t\u0010$\u001a\u00020\nH\u00d6\u0001J\t\u0010%\u001a\u00020\u0007H\u00d6\u0001R\u0011\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\u0010R\u0011\u0010\u0004\u001a\u00020\u0005\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\u0012R\u0011\u0010\u0006\u001a\u00020\u0007\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0013\u0010\u0014R\u0011\u0010\b\u001a\u00020\u0007\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0015\u0010\u0014R\u0011\u0010\t\u001a\u00020\n\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0016\u0010\u0017R\u0011\u0010\u000b\u001a\u00020\f\u00a2\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\u0018R\u0011\u0010\r\u001a\u00020\u0007\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\u0014\u00a8\u0006&"}, d2 = {"Lcom/raywenderlich/android/redditclone/models/Post;", "", "author", "Lcom/raywenderlich/android/redditclone/models/Author;", "category", "Lcom/raywenderlich/android/redditclone/models/Category;", "date", "", "description", "id", "", "is_published", "", "title", "(Lcom/raywenderlich/android/redditclone/models/Author;Lcom/raywenderlich/android/redditclone/models/Category;Ljava/lang/String;Ljava/lang/String;IZLjava/lang/String;)V", "getAuthor", "()Lcom/raywenderlich/android/redditclone/models/Author;", "getCategory", "()Lcom/raywenderlich/android/redditclone/models/Category;", "getDate", "()Ljava/lang/String;", "getDescription", "getId", "()I", "()Z", "getTitle", "component1", "component2", "component3", "component4", "component5", "component6", "component7", "copy", "equals", "other", "hashCode", "toString", "app_debug"})
public final class Post {
@org.jetbrains.annotations.NotNull()
private final com.raywenderlich.android.redditclone.models.Author author = null;
@org.jetbrains.annotations.NotNull()
private final com.raywenderlich.android.redditclone.models.Category category = null;
@org.jetbrains.annotations.NotNull()
private final java.lang.String date = null;
@org.jetbrains.annotations.NotNull()
private final java.lang.String description = null;
private final int id = 0;
private final boolean is_published = false;
@org.jetbrains.annotations.NotNull()
private final java.lang.String title = null;
@org.jetbrains.annotations.NotNull()
public final com.raywenderlich.android.redditclone.models.Author getAuthor() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final com.raywenderlich.android.redditclone.models.Category getCategory() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String getDate() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String getDescription() {
return null;
}
public final int getId() {
return 0;
}
public final boolean is_published() {
return false;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String getTitle() {
return null;
}
public Post(@org.jetbrains.annotations.NotNull()
com.raywenderlich.android.redditclone.models.Author author, @org.jetbrains.annotations.NotNull()
com.raywenderlich.android.redditclone.models.Category category, @org.jetbrains.annotations.NotNull()
java.lang.String date, @org.jetbrains.annotations.NotNull()
java.lang.String description, int id, boolean is_published, @org.jetbrains.annotations.NotNull()
java.lang.String title) {
super();
}
@org.jetbrains.annotations.NotNull()
public final com.raywenderlich.android.redditclone.models.Author component1() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final com.raywenderlich.android.redditclone.models.Category component2() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String component3() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String component4() {
return null;
}
public final int component5() {
return 0;
}
public final boolean component6() {
return false;
}
@org.jetbrains.annotations.NotNull()
public final java.lang.String component7() {
return null;
}
@org.jetbrains.annotations.NotNull()
public final com.raywenderlich.android.redditclone.models.Post copy(@org.jetbrains.annotations.NotNull()
com.raywenderlich.android.redditclone.models.Author author, @org.jetbrains.annotations.NotNull()
com.raywenderlich.android.redditclone.models.Category category, @org.jetbrains.annotations.NotNull()
java.lang.String date, @org.jetbrains.annotations.NotNull()
java.lang.String description, int id, boolean is_published, @org.jetbrains.annotations.NotNull()
java.lang.String title) {
return null;
}
@org.jetbrains.annotations.NotNull()
@java.lang.Override()
public java.lang.String toString() {
return null;
}
@java.lang.Override()
public int hashCode() {
return 0;
}
@java.lang.Override()
public boolean equals(@org.jetbrains.annotations.Nullable()
java.lang.Object p0) {
return false;
}
} | [
"bsailaukul@gmail.com"
] | bsailaukul@gmail.com |
4d1f04ec41d1fc4d8f2fe2e51850bfa06515286d | c4448babb35c52c97c28e7666b2dcd0751315658 | /app/src/main/java/com/anlida/smartlock/utils/RxTimerUtil.java | 4e1129c787d519167a159cf75975458414112ffd | [] | no_license | 425296516/smartlock | 1d4ec3bd8c00cbfede364240b28448e7cbb3a40c | 3b25f9fe501e35d7d0ae6bbfc3292f65e97d78cf | refs/heads/master | 2020-06-05T03:05:37.139149 | 2019-10-23T09:19:03 | 2019-10-23T09:19:03 | 192,291,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,883 | java | package com.anlida.smartlock.utils;
/**
* Created by zhangcirui on 2018/9/7.
*/
import android.support.annotation.NonNull;
import com.orhanobut.logger.Logger;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
/**
* Rxjava2.x实现轮询定时器.
*
*/
public class RxTimerUtil {
private static Disposable mDisposable;
/**
* milliseconds毫秒后执行next操作
*/
public static void timer(long milliseconds, final IRxNext next) {
Observable.timer(milliseconds, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Long>() {
@Override
public void onSubscribe(@NonNull Disposable disposable) {
mDisposable = disposable;
}
@Override
public void onNext(@NonNull Long number) {
if (next != null) {
next.doNext(number);
}
}
@Override
public void onError(@NonNull Throwable e) {
//取消订阅
cancel();
}
@Override
public void onComplete() {
//取消订阅
cancel();
}
});
}
/**
* 每隔milliseconds毫秒后执行next操作
*/
public static void interval(long milliseconds, final IRxNext next) {
Observable.interval(milliseconds, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Long>() {
@Override
public void onSubscribe(@NonNull Disposable disposable) {
mDisposable = disposable;
}
@Override
public void onNext(@NonNull Long number) {
if (next != null) {
next.doNext(number);
}
}
@Override
public void onError(@NonNull Throwable e) {
}
@Override
public void onComplete() {
}
});
}
/**
* 取消订阅
*/
public static void cancel() {
if (mDisposable != null && !mDisposable.isDisposed()) {
mDisposable.dispose();
Logger.d("====Rx定时器取消======");
}
}
public interface IRxNext {
void doNext(long number);
}
}
| [
"425296516@qq.com"
] | 425296516@qq.com |
28c1ee4fcce13998ec189951db191b4e87955d88 | 6be09f2a0e021e5834af02a5235ae9ccceff06a4 | /SIGCP/src/pe/com/pacasmayo/sgcp/bean/factory/BeanFactory.java | d23bc1e564f1a3f7f6b165fb205bbcdbfcdc4644 | [] | no_license | fbngeldres/sigcp | 60e4f556c0c5555c136639a06bea85f0b1cad744 | fc7d94c1e0d5b6abb5004d92a031355941884718 | refs/heads/master | 2021-01-11T22:33:13.669537 | 2017-03-07T16:19:41 | 2017-03-07T16:20:14 | 78,987,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44,857 | java | package pe.com.pacasmayo.sgcp.bean.factory;
/*
* SGCP (Sistema de Gestión y Control de la Producción)
* Archivo: BeanFactory.java
* Modificado: Mar 17, 2010 10:13:34 AM
* Autor: andy.nunez
*
* Copyright (C) DBAccess, 2010. All rights reserved.
*
* Developed by: DBAccess. http://www.dbaccess.com
*/
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import pe.com.pacasmayo.sgcp.bean.*;
import pe.com.pacasmayo.sgcp.excepciones.AplicacionException;
import pe.com.pacasmayo.sgcp.excepciones.LogicaException;
import pe.com.pacasmayo.sgcp.persistencia.dataObjects.*;
public interface BeanFactory {
/**
* @param actividades
* @return
*/
public abstract List<ActividadBean> transformarListaActividad(
List<Actividad> actividades);
public abstract List<ActividadBean> transformarListaActividadBasico(
List<Actividad> actividades);
/**
* @param actividad
* @return
*/
public abstract ActividadBean transformarActividad(Actividad actividad);
/**
* @param actividad
* @return
*/
public abstract ActividadBean transformarActividadBasico(Actividad actividad);
/**
* @param almacen
* @return
*/
public abstract AlmacenBean transformarAlmacen(Almacen almacen);
/**
* @param almacenes
* @return
*/
public abstract List<AlmacenBean> transformarListaAlmacen(
List<Almacen> almacenes);
/**
* @param clasificacionTipoMovimiento
* @return
*/
public abstract ClasificacionTipoMovimientoBean transformarClasificacionTipoMovimiento(
Clasificaciontipomovimiento clasificacionTipoMovimiento);
/**
* @param listaClasificacionTipoMovimiento
* @return
*/
public abstract List<ClasificacionTipoMovimientoBean> transformarListaClasificacionTipoMovimiento(
List<Clasificaciontipomovimiento> listaClasificacionTipoMovimiento);
/**
* @param componente
* @return
*/
public abstract ComponenteBean transformarComponente(Componente componente);
/**
* Método para tranformar un componente sin tomar en cuenta el factor de
* dosificacion
*
* @param componente
* Componente a transformar
* @return Componente Bean
*/
public abstract ComponenteBean transformarComponenteSinFactorDosificacion(
Componente componente);
/**
* @param componenteLista
* @return
*/
public abstract List<ComponenteBean> transformarListaComponente(
List<Componente> componenteLista);
/**
* @param division
* @return
*/
public abstract DivisionBean transformarDivision(Division division);
/**
* @param divisionBeans
* @return
*/
public abstract List<DivisionBean> transformarListaDivision(
List<Division> divisionBeans);
/**
* @param listaEstadoActividad
* @return
*/
public abstract List<EstadoActividadBean> transformarListaEstadoActividad(
List<Estadoactividad> listaEstadoActividad);
public abstract List<EstadoPrivilegioBean> transformarListaEstadoPrivilegio(
List<Estadoprivilegio> listaEstadoPrivilegio);
/**
* @param estadoActividad
* @return
*/
public abstract EstadoActividadBean transformarEstadoActividad(
Estadoactividad estadoActividad);
/**
* @param estadoNotificacion
* @return
*/
public abstract EstadoNotificacionBean transformarEstadoNotificacion(
Estadonotificacion estadoNotificacion);
/**
* @param listaEstadoNotificacion
* @return
*/
public abstract List<EstadoNotificacionBean> transformarListaEstadoNotificacion(
List<Estadonotificacion> listaEstadoNotificacion);
/**
* @param estadoHohaRuta
* @return
*/
public abstract EstadoHojaRutaBean transformarEstadoHojaRuta(
Estadohojaruta estadoHohaRuta);
/**
* @param listaEstadosHojaRuta
* @return
*/
public abstract List<EstadoHojaRutaBean> transformarListaEstadoHojaRuta(
List<Estadohojaruta> listaEstadosHojaRuta);
/**
* @param estadoProductoBeans
* @return
*/
public abstract List<EstadoProductoBean> transformarListaEstadoProducto(
List<Estadoproducto> estadoProductoBeans);
/**
* @param estadoProducto
* @return
*/
public abstract EstadoProductoBean transformarEstadoProducto(
Estadoproducto estadoProducto);
/**
* @param estadoPuestoTrabajos
* @return
*/
public abstract List<EstadoPuestoTrabajoBean> transformarListaEstadoPuestoTrabajo(
List<Estadopuestotrabajo> estadoPuestoTrabajos);
/**
* @param estadoPuestoTrabajo
* @return
*/
public abstract EstadoPuestoTrabajoBean transformarEstadoPuestoTrabajo(
Estadopuestotrabajo estadoPuestoTrabajo);
/**
* @param estadoUsuario
* @return
*/
public abstract EstadoUsuarioBean transformarEstadoUsuario(
Estadousuario estadoUsuario);
/**
* @param estadoPrivilegio
* @return
*/
public abstract EstadoPrivilegioBean transformarEstadoPrivilegio(
Estadoprivilegio estadoPrivilegio);
/**
* @param grupousuario
* @param agregarGrupoPrivilegios
* @return
*/
public abstract GrupoUsuarioBean transformarGrupoUsuario(
Grupousuario grupousuario, boolean agregarGrupoPrivilegios);
/**
* @param usuariogrupousuario
* @return
*/
public abstract UsuarioGrupoUsuarioBean transformarUsuarioGrupoUsuario(
Usuariogrupousuario usuariogrupousuario);
/**
* @param accion
* @return
*/
public abstract AccionBean transformarAccion(Accion accion);
/**
* @param opcion
* @return
*/
public abstract OpcionBean transformarOpcion(Opcion opcion);
public abstract List<OpcionBean> transformarListaOpcionParaCombo(
List<Opcion> opcionList);
public abstract OpcionAccionBean transformarOpcionAccion(
Opcionaccion opcionaccion);
public abstract List<OpcionAccionBean> transformarListaOpcionAccionParaCombo(
List<Opcionaccion> opcionaccionList);
/**
* @param nivelCargo
* @return
*/
public abstract NivelCargoBean transformarNivelCargo(Nivelcargo nivelCargo);
public abstract List<NivelCargoBean> transformarListaNivelCargo(
List<Nivelcargo> listaNivelCargo);
/**
* @param privilegio
* @return
*/
public abstract PrivilegioBean transformarPrivilegio(Privilegio privilegio);
public abstract List<PrivilegioBean> transformarListaPrivilegios(
List<Privilegio> listaPrivilegio);
public abstract NivelMenuBean transformarNivelMenu(Nivelmenu nivelmenu);
public abstract List<NivelMenuBean> transformarListaNivelMenu(
List<Nivelmenu> nivelesMenu);
/**
* @param grupoUsuarioPrivilegioList
* @return
*/
public abstract List<GrupoUsuarioPrivilegioBean> transformarListaGrupoUsuarioPrivilegio(
Set<Grupousuarioprivilegio> grupoUsuarioPrivilegioList);
/**
* @param grupoUsuarioPrivilegioList
* @return
*/
public abstract List<GrupoUsuarioPrivilegioBean> transformarListaGrupoUsuarioPrivilegio(
List<Grupousuarioprivilegio> grupoUsuarioPrivilegioList);
/**
* @param menu
* @param nivel
* @return
*/
public abstract MenuBean transformarMenu(Menu menu, Short nivel);
public abstract List<MenuBean> transformarListaMenu(List<Menu> menuList,
Short nivel);
public abstract MenuBean transformarMenuMantenimiento(Menu menu);
/**
* @param unidadCargo
* @return
*/
public abstract UnidadCargoBean transformarUnidadCargo(
Unidadcargo unidadCargo);
/**
* @param unidadCargoList
* @return
*/
public abstract List<UnidadBean> transformarListaUnidadCargo(
Set<Unidadcargo> unidadCargoList);
/**
* @param divisionCargo
* @return
*/
public abstract DivisionCargoBean transformarDivisionCargo(
Divisioncargo divisionCargo);
/**
* @param divisionCargoList
* @return
*/
public abstract List<DivisionBean> transformarListaDivisionCargo(
Set<Divisioncargo> divisionCargoList);
/**
* @param sociedadCargo
* @return
*/
public abstract SociedadCargoBean transformarSociedadCargo(
Sociedadcargo sociedadCargo);
/**
* @param sociedadCargoList
* @return
*/
public abstract List<SociedadBean> transformarListaSociedadCargo(
Set<Sociedadcargo> sociedadCargoList);
/**
* @param cargo
* @return
*/
public abstract CargoBean transformarCargo(Cargo cargo);
/**
* @param grupousuarioprivilegio
* @return
*/
public abstract GrupoUsuarioPrivilegioBean transformarGrupoUsuarioPrivilegio(
Grupousuarioprivilegio grupousuarioprivilegio);
/**
* @param factorDosificacion
* @return
*/
public abstract FactorDosificacionBean transformarFactordosificacion(
Factordosificacion factorDosificacion);
/**
* @param listaFactorDosificacion
* @return
*/
public abstract List<FactorDosificacionBean> transformarListaFactordosificacionParaConsulta(
List<Factordosificacion> listaFactorDosificacion);
/**
* @param factorDosificacionBeans
* @return
*/
public abstract List<FactorDosificacionBean> transformarListaFactordosificacion(
List<Factordosificacion> factorDosificacionBeans);
/**
* @param factorDosificacionBeans
* @return
*/
public abstract List<FactorDosificacionBean> transformarListaFactordosificacion(
Set<Factordosificacion> factorDosificacionBeans);
/**
* @param factorDosificacionRegistroMensual
* @return
*/
public abstract FactorDosificacionRegistroMensualBean transformarFactordosificacionregistromensu(
Factordosificacionregistromensu factorDosificacionRegistroMensual);
/**
* @param factorDosificacionRegistroMensualBeans
* @return
*/
public abstract List<FactorDosificacionRegistroMensualBean> transformarListaFactordosificacionregistromensu(
List<Factordosificacionregistromensu> factorDosificacionRegistroMensualBeans);
/**
* @param factorDosificacionRegistroMensualBeans
* @return
*/
public abstract FactorDosificacionRegistroMensualBean[] transformarListaFactorDosificacionRegistroMensual(
Set<Factordosificacionregistromensu> factorDosificacionRegistroMensualBeans);
/**
* @param hojaRuta
* @return
*/
public abstract HojaRutaBean transformarHojaRuta(Hojaruta hojaRuta);
public abstract HojaRutaBean transformarHojaRutaParaConsultaOrdenProduccion(
Hojaruta hojaRuta);
/**
* @param listaHojaRuta
* @return
*/
public abstract List<HojaRutaBean> transformarListaHojaRuta(
List<Hojaruta> listaHojaRuta);
public abstract List<HojaRutaBean> transformarListaHojaRutaParaCombo(
List<Hojaruta> listaHojaRuta);
/**
* @param listaHojaruta
* @return
*/
public abstract List<HojaRutaBean> transformarListaHojaRutaConFactoresDosificacion(
List<Hojaruta> listaHojaruta);
/**
* @param hojaRutaComponente
* @return
*/
public abstract HojaRutaComponenteBean transformarHojaRutaComponente(
Hojarutacomponente hojaRutaComponente);
/**
* @param listaHojaRutaComponente
* @return
*/
public abstract List<HojaRutaComponenteBean> transformarListaHojaRutaComponente(
List<Hojarutacomponente> listaHojaRutaComponente);
/**
* @param listaHojaRutaComponente
* @return
*/
public abstract List<HojaRutaComponenteBean> transformarListaHojaRutaComponente(
Set<Hojarutacomponente> listaHojaRutaComponente);
/**
* @param lineaNegocio
* @return
*/
public abstract LineaNegocioBean transformarLineaNegocio(
Lineanegocio lineaNegocio);
/**
* @param listaLineaNegocio
* @return
*/
public abstract List<LineaNegocioBean> transformarListaLineaNegocio(
List<Lineanegocio> listaLineaNegocio);
/**
* @param lineaNegocio
* @return
*/
public abstract LineaNegocioBean transformarLineaNegocioBasico(
Lineanegocio lineaNegocio);
/**
* @param listaLineaNegocio
* @return
*/
public abstract List<LineaNegocioBean> transformarListaLineaNegocioBasico(
List<Lineanegocio> listaLineaNegocio);
/**
* @param operacion
* @return
*/
public abstract OperacionBean transformarOperacion(Operacion operacion);
public abstract OperacionBean transformarOperacionParaPlanAnual(
Operacion operacion);
/**
* @param listaOperacion
* @return
*/
public abstract List<OperacionBean> transformarListaOperacion(
List<Operacion> listaOperacion);
public abstract List<OperacionBean> transformarListaOperacionParaPlanAnual(
List<Operacion> listaOperacion);
public abstract OperacionComponenteBean transformarOperacionComponente(
Operacioncomponente operacionComponente);
/**
* @param listaOperacionComponente
* @return
*/
public abstract List<OperacionComponenteBean> transformarListaOperacionComponente(
Set<Operacioncomponente> listaOperacionComponente);
/**
* @param operacionRecurso
* @return
*/
public abstract OperacionRecursoBean transformarOperacionRecurso(
Operacionrecurso operacionRecurso);
/**
* @param listaOperacionComponente
* @return
*/
public abstract List<OperacionRecursoBean> transformarListaOperacionRecurso(
Set<Operacionrecurso> listaOperacionComponente);
/**
* @param proceso
* @return
*/
public abstract ProcesoBean transformarProceso(Proceso proceso);
/**
* @param procesos
* @return
*/
public abstract List<ProcesoBean> transformarListaProceso(
List<Proceso> procesos);
/**
* @param procesos
* @return
*/
public abstract List<ProcesoBean> transformarListaProcesoBasico(
List<Proceso> procesos);
/**
* @param produccion
* @return
*/
public abstract ProduccionBean transformarProduccion(Produccion produccion);
/**
* @param produccionsBeans
* @return
*/
public abstract List<ProduccionBean> transformarListaProduccion(
List<Produccion> produccionsBeans);
/**
* @param producto
* @return
*/
public abstract ProductoBean transformarProducto(Producto producto);
/**
* @param producto
* @return
*/
public abstract ProductoBean transformarProductoBasico(Producto producto);
/**
* @param productosBeans
* @return
*/
public abstract List<ProductoBean> transformarListaProductos(
List<Producto> productosBeans);
/**
* @param produccionesBeans
* @return
*/
public abstract Set<ProduccionBean> transformarListaProducciones(
Set<Produccion> produccionesBeans);
/**
* @param puestosTrabajo
* @return
*/
public abstract List<PuestoTrabajoBean> transformarListaPuestoTrabajo(
List<Puestotrabajo> puestosTrabajo);
/**
* @param puestoTrabajo
* @return
*/
public abstract PuestoTrabajoBean transformarPuestoTrabajo(
Puestotrabajo puestoTrabajo);
/**
* @param recurso
* @return
*/
public abstract RecursoBean transformarRecurso(Recurso recurso);
/**
* @param recursoLista
* @return
*/
public abstract List<RecursoBean> transformarListaRecurso(
List<Recurso> recursoLista);
/**
* @param listaRecursosRM
* @return
*/
public RecursoRegistroMensualBean[] transformarListaRecursosRM(
Set<Recursoregistromensual> listaRecursosRM);
/**
* @param sociedad
* @return
*/
public abstract SociedadBean transformarSociedad(Sociedad sociedad);
/**
* @param sociedadBeans
* @return
*/
public abstract List<SociedadBean> transformarListaSociedad(
List<Sociedad> sociedadBeans);
/**
* @param tipoComponente
* @return
*/
public abstract TipoComponenteBean transformarTipoComponente(
Tipocomponente tipoComponente);
/**
* @param listaTipoComponentes
* @return
*/
public abstract List<TipoComponenteBean> transformarListaTipoComponentes(
List<Tipocomponente> listaTipoComponentes);
/**
* @param tipoMedioAlmacenamiento
* @return
*/
public abstract TipoMedioAlmacenamientoBean transformarTipoMedioAlmacenamiento(
Tipomedioalmacenamiento tipoMedioAlmacenamiento);
public abstract List<TipoMedioAlmacenamientoBean> transformarListaTipoMedioAlmacenamiento(
List<Tipomedioalmacenamiento> tipoMedioAlmacenamientoBeans);
/**
* @param tipoMovimiento
* @return
*/
public abstract TipoMovimientoBean transformarTipoMovimiento(
Tipomovimiento tipoMovimiento);
/**
* @param listaTipoMovimientoBeans
* @return
*/
public abstract List<TipoMovimientoBean> transformarListaTipoMovimiento(
List<Tipomovimiento> listaTipoMovimientoBeans);
/**
* @param tipoProductoBeans
* @return
*/
public abstract List<TipoProductoBean> transformarListaTipoProducto(
List<Tipoproducto> tipoProductoBeans);
/**
* @param tipoProducto
* @return
*/
public abstract TipoProductoBean transformarTipoProducto(
Tipoproducto tipoProducto);
/**
* @param tipoPuestoTrabajo
* @return
*/
public abstract TipoPuestoTrabajoBean transformarTipoPuestoTrabajo(
Tipopuestotrabajo tipoPuestoTrabajo);
/**
* @param puestosTrabajo
* @return
*/
public abstract List<TipoPuestoTrabajoBean> transformarListaTipoPuestoTrabajo(
List<Tipopuestotrabajo> puestosTrabajo);
/**
* @param puestosTrabajo
* @return
*/
public abstract List<UbicacionBean> transformarListaUbicaciones(
List<Ubicacion> puestosTrabajo);
/**
* @param ubicacion
* @return
*/
public abstract UbicacionBean transformarUbicacion(Ubicacion ubicacion);
/**
* @param unidad
* @return
*/
public abstract UnidadBean transformarUnidad(Unidad unidad);
/**
* @param unidad
* @return
*/
public abstract UnidadBean transformarUnidadBasico(Unidad unidad);
/**
* @param unidadBeans
* @return
*/
public abstract List<UnidadBean> transformarListaUnidad(
List<Unidad> unidadBeans);
/**
* @param unidadBeans
* @return
*/
public abstract List<UnidadBean> transformarListaUnidadBasico(
List<Unidad> unidadBeans);
/**
* @param unidadMedidaBeans
* @return
*/
public abstract List<UnidadMedidaBean> transformarListaUnidadMedida(
List<Unidadmedida> unidadMedidaBeans);
/**
* @param unidadMedida
* @return
*/
public abstract UnidadMedidaBean transformarUnidadMedida(
Unidadmedida unidadMedida);
/**
* @param persona
* @return
*/
public abstract PersonaBean transformarPersona(Persona persona);
/**
* @param personas
* @return
*/
public abstract List<PersonaBean> transformarListaPersona(
List<Persona> personas);
/**
* @param usuarios
* @return
*/
public abstract List<UsuarioBean> transformarListaUsuario(
List<Usuario> usuarios);
/**
* @param usuario
* @return
*/
public abstract UsuarioBean transformarUsuario(Usuario usuario);
/**
* Toma los datos de un objeto de persistencia Ordenproduccion y crea el
* objeto bean de la orden de produccion
*
* @param ordenproduccion
* objeto de persistencia
* @return OrdenProduccionBeanImpl
*/
public abstract OrdenProduccionBean transformarOrdenProduccion(
Ordenproduccion ordenproduccion);
/**
* @param ordenproduccion
* @return
*/
public abstract OrdenProduccionBean transformarOrdenProduccionBasico(
Ordenproduccion ordenproduccion);
/**
* Toma los datos de un objeto bean de orden de produccion y crea el objeto
* de persistencia Ordenproduccion
*
* @param ordenproduccionBean
* OrdenProduccionBeanImpl
* @return Ordenproduccion objeto de persistencia
*/
public abstract Ordenproduccion transformarOrdenProduccionBean(
OrdenProduccionBean ordenProduccionBean);
/**
* Toma una lista de objetos de persistencia Ordenproduccion y retorna un
* ArrayList de objetos q implenentan la interfaz OrdenProduccionBean
*
* @param listOrdenProduccion
* @return
*/
public abstract List<OrdenProduccionBean> transformarListaOrdenProduccion(
List<Ordenproduccion> listOrdenProduccion);
/**
* @param listOrdenProduccion
* @return
*/
public abstract List<OrdenProduccionBean> transformarListaOrdenProduccionBasico(
List<Ordenproduccion> listOrdenProduccion);
/**
* Método para transformar el objeto Plananual en objeto de negocio
* PlanAnualBean
*
* @param plananual
* @return Data Object tranformado
*/
public abstract PlanAnualBean transformarPlanAnual(Plananual plananual);
/**
* Método para transformar el objeto Plananual en objeto de negocio
* PlanAnualBean, asi como las tablas asociadas al plan anual: - Plan de
* Comercializacion
*
* @param plananual
* @return Data Object tranformado
*/
public abstract List<PlanComercializacionBean> transformarListaPlanComercializacion(
Set<Plancomercializacion> plancomercializacions);
/**
* @param planAnualBeans
* @return
*/
public abstract List<PlanAnualBean> transformarListaPlanAnual(
List<Plananual> planAnualBeans);
/**
* @param estadoPlanList
* @return
*/
public abstract List<EstadoPlanBean> transformarListaEstadoPlanAnual(
List<Estadoplananual> estadoPlanList);
/**
* @param estadoplananual
* @return
*/
public abstract EstadoPlanBean transformarEstadoPlan(
Estadoplananual estadoplananual);
/**
* @param plananual
* @return
*/
public abstract PlanAnualBean transformarPlanAnualCompleto(
Plananual plananual);
/**
* @param concepto
* @return
*/
public abstract ConceptoBean transformarConcepto(Concepto concepto);
/**
* @param concepto
* @return
*/
public abstract List<ConceptoBean> transformarListaConcepto(
List<Concepto> concepto);
/**
* @param medioalmacenamiento
* @return
*/
public abstract MedioAlmacenamientoBean transformarMedioAlmacenamiento(
Medioalmacenamiento medioalmacenamiento);
/**
* @param mediosAlmacenamiento
* @return
*/
public abstract List<MedioAlmacenamientoBean> transformarListaMedioAlmacenamiento(
List<Medioalmacenamiento> mediosAlmacenamiento);
/**
* @param dosificacionRegistroMensual
* @return
*/
public abstract DosificacionRegistroMensualBean transformarDosificacionRegistroMensual(
Dosificacionregistromensual dosificacionRegistroMensual);
/**
* @param dosificacionRegistroMensuals
* @return
*/
public abstract DosificacionRegistroMensualBean[] transformarListaDosificacionRegistroMensual(
Collection<Dosificacionregistromensual> dosificacionRegistroMensuals);
/**
* @param listaTemporalPlan
* @return
*/
public abstract List<PlanNecesidadBean> transformarListaPlanNecesidad(
List<Plannecesidad> listaTemporalPlan);
/**
* @param plannecesidad
* @return
*/
public abstract PlanNecesidadBean transformarPlanNecesidad(
Plannecesidad plannecesidad);
/**
* @param listaConceptoRegistroMensual
* @return
*/
public abstract ConceptoRegistroMensualBean[] transformarListaConceptoRegistroMensual(
Collection<Conceptoregistromensual> listaConceptoRegistroMensual);
/**
* @param conceptoRegistroMensual
* @return
*/
public abstract ConceptoRegistroMensualBean transformarConceptoRegistroMensual(
Conceptoregistromensual conceptoRegistroMensual);
/**
* @param conceptoMensual
* @return
*/
public abstract ConceptoMensualBean transformarConceptoMensual(
Conceptomensual conceptoMensual);
/**
* @param tasarealproduccionregmen
* @return
*/
public abstract TasaRealProduccionRegistroMensualBean[] transformarTasaRealProduccionRegMen(
Set<Tasarealprodregistromensual> tasarealproduccionregmen);
/**
* @param tasarealprod
* @return
*/
public abstract TasaRealProduccionBean transformarTasaRealProduccion(
Tasarealproduccion tasarealprod);
/**
* @param tasarealprodregmen
* @return
*/
public abstract TasaRealProduccionRegistroMensualBean transformarTasaRealProduccionRegistroMensual(
Tasarealprodregistromensual tasarealprodregmen);
/**
* @param listaTasaRealProduccion
* @return
*/
public abstract List<TasaRealProduccionBean> transformarListaTasaRealProduccion(
List<Tasarealproduccion> listaTasaRealProduccion);
/**
* @param capacidadoperativaregistromensus
* @return
*/
public abstract CapacidadOperativaRegistroMensualBean[] transformarListaCapacidadOperativaRM(
Set<Capacidadoperativaregistromensu> capacidadoperativaregistromensus);
/**
* @param listaCapOperRegMen
* @return
*/
public abstract List<CapacidadOperativaRegistroMensualBean> transformarListaCapacidadOperativaRegistroMensual(
Set<Capacidadoperativaregistromensu> listaCapOperRegMen);
/**
* @param movimientos
* @return
*/
public abstract List<MovimientoBean> transformarListaMovimiento(
List<Movimiento> movimientos);
/**
* @param capacidadOperativa
* @return
*/
public abstract CapacidadOperativaBean transformarCapacidadOperativa(
Capacidadoperativa capacidadOperativa);
/**
* @param tipoCapacidadOperativa
* @return
*/
public abstract TipoCapacidadOperativaBean transformarTipoCapacidadOperativa(
Tipocapacidadoperativa tipoCapacidadOperativa);
/**
* @param movimiento
* @return
*/
public abstract MovimientoBean transformarMovimiento(Movimiento movimiento);
/**
* @param estadoMovimientos
* @return
*/
public abstract List<EstadoMovimientoBean> transformarListaEstadoMovimiento(
List<Estadomovimiento> estadoMovimientos);
/**
* @param estadomovimiento
* @return
*/
public abstract EstadoMovimientoBean transformarEstadoMovimiento(
Estadomovimiento estadomovimiento);
/**
* @param documentomateriales
* @return
*/
public abstract List<DocumentoMaterialBean> transformarListaDocumentoMaterial(
List<Documentomaterial> documentomateriales);
/**
* @param documentomaterial
* @return
*/
public abstract DocumentoMaterialBean transformarDocumentoMaterial(
Documentomaterial documentomaterial);
/**
* @param tipoDocuentomateriales
* @return
*/
public abstract List<TipoDocumentoMaterialBean> transformarListaTipoDocumentoMaterial(
List<Tipodocumentomaterial> tipoDocuentomateriales);
/**
* @param tipodocumentomaterial
* @return
*/
public abstract TipoDocumentoMaterialBean transformarTipoDocumentoMaterial(
Tipodocumentomaterial tipodocumentomaterial);
/**
* @param periodosContables
* @return
*/
public abstract List<PeriodoContableBean> transformarListaPeriodoContable(
List<Periodocontable> periodosContables);
/**
* @param periodoContable
* @return
*/
public abstract PeriodoContableBean transformarPeriodoContable(
Periodocontable periodoContable);
/**
* @param movimientoAjustes
* @return
*/
public abstract List<MovimientoAjusteBean> transformarListaMovimientoAjuste(
List<Movimientoajuste> movimientoAjustes);
/**
* @param movimientoajuste
* @return
*/
public abstract MovimientoAjusteBean transformarMovimientoAjuste(
Movimientoajuste movimientoajuste);
/**
* @param consumoComponentePuestoTrabajos
* @return
*/
public abstract List<ConsumoComponentePuestoTrabajoBean> transformarListaConsumoComponentePuestoTrabajo(
List<Consumocomponentepuestotrabajo> consumoComponentePuestoTrabajos);
/**
* @param consumoComponentePuestoTrabajo
* @return
*/
public abstract ConsumoComponentePuestoTrabajoBean transformarConsumoComponentePuestoTrabajo(
Consumocomponentepuestotrabajo consumoComponentePuestoTrabajo);
/**
* @param listaDataObjects
* @return
*/
public abstract List<ConsumoComponenteAjusteBean> transformarListaConsumoComponenteAjuste(
List<Consumocomponenteajuste> listaDataObjects);
/**
* @param dataObject
* @return
*/
public abstract ConsumoComponenteAjusteBean transformarConsumoComponenteAjuste(
Consumocomponenteajuste dataObject);
/**
* @param listaDataObjects
* @return
*/
public abstract List<PuestoTrabajoProduccionBean> transformarListaPuestoTrabajoProduccion(
List<Puestotrabajoproduccion> listaDataObjects);
/**
* @param dataObject
* @return
*/
public abstract PuestoTrabajoProduccionBean transformarPuestoTrabajoProduccion(
Puestotrabajoproduccion dataObject);
/**
* @param ajusteProductos
* @return
*/
public abstract List<AjusteProductoBean> transformarListaAjusteProducto(
List<Ajusteproducto> ajusteProductos);
/**
* @param ajusteProducto
* @return
*/
public abstract AjusteProductoBean transformarAjusteProducto(
Ajusteproducto ajusteProducto);
/**
* @param estadoAjusteProductos
* @return
*/
public abstract List<EstadoAjusteProductoBean> transformarListaEstadoAjusteProducto(
List<Estadoajusteproducto> estadoAjusteProductos);
/**
* @param estadoAjusteProducto
* @return
*/
public abstract EstadoAjusteProductoBean transformarEstadoAjusteProducto(
Estadoajusteproducto estadoAjusteProducto);
/**
* @param balanceProductos
* @return
*/
public abstract List<BalanceProductoBean> transformarListaBalanceProducto(
List<Balanceproducto> balanceProductos);
/**
* @param balanceProducto
* @return
*/
public abstract BalanceProductoBean transformarBalanceProducto(
Balanceproducto balanceProducto);
/**
* @param tipoBalances
* @return
*/
public abstract List<TipoBalanceBean> transformarListaTipoBalance(
List<Tipobalance> tipoBalances);
/**
* @param tipoBalance
* @return
*/
public abstract TipoBalanceBean transformarTipoBalance(
Tipobalance tipoBalance);
/**
* @param plantillaGrupoAjustes
* @return
*/
public abstract List<PlantillaGrupoAjusteBean> transformarListaPlantillaGrupoAjuste(
List<Plantillagrupoajuste> plantillaGrupoAjustes);
/**
* @param plantillaGrupoAjuste
* @return
*/
public abstract PlantillaGrupoAjusteBean transformarPlantillaGrupoAjuste(
Plantillagrupoajuste plantillaGrupoAjuste);
/**
* @param plantillaAjusteProductos
* @return
*/
public abstract List<PlantillaAjusteProductoBean> transformarListaPlantillaAjusteProducto(
List<Plantillaajusteproducto> plantillaAjusteProductos);
/**
* @param plantillaAjusteProducto
* @return
*/
public abstract PlantillaAjusteProductoBean transformarPlantillaAjusteProducto(
Plantillaajusteproducto plantillaAjusteProducto);
/**
* @param parteDiarios
* @return
*/
public abstract List<ParteDiarioBean> transformarListaParteDiario(
List<Partediario> parteDiarios);
/**
* @param parteDiario
* @return
*/
public abstract ParteDiarioBean transformarParteDiario(
Partediario parteDiario);
/**
* @param produccionPuestoTrabajos
* @return
*/
public abstract List<ProduccionPuestoTrabajoBean> transformarListaProduccionPuestoTrabajos(
ArrayList<Produccionpuestotrabajo> produccionPuestoTrabajos);
/**
* @param produccionPuestoTrabajo
* @return
*/
public abstract ProduccionPuestoTrabajoBean transformarProduccionPuestoTrabajo(
Produccionpuestotrabajo produccionPuestoTrabajo);
/**
* @param tablasOperaciones
* @return
*/
public abstract List<TablaOperacionBean> transformarListaTablaOperaciones(
ArrayList<Tablaoperacion> tablasOperaciones);
/**
* @param tablaOperacion
* @return
*/
public abstract TablaOperacionBean transformarTablaOperaciones(
Tablaoperacion tablaOperacion);
/**
* @param productosGenerados
* @return
*/
public abstract List<ProductoGeneradoBean> transformarListaProductosGenerados(
ArrayList<Productogenerado> productosGenerados);
/**
* @param productoGenerado
* @return
*/
public abstract ProductoGeneradoBean transformarProductoGenerado(
Productogenerado productoGenerado);
/**
* @param consumoPuestoTrabajos
* @return
*/
public abstract List<ConsumoPuestoTrabajoBean> transformarListaConsumoPuestoTrabajo(
ArrayList<Consumopuestotrabajo> consumoPuestoTrabajos);
/**
* @param consumoPuestoTrabajo
* @return
*/
public abstract ConsumoPuestoTrabajoBean transformarConsumoPuestoTrabajo(
Consumopuestotrabajo consumoPuestoTrabajo);
/**
* @param produccionesDiarias
* @return
*/
public abstract List<ProduccionDiariaBean> transformarListaProduccionDiaria(
ArrayList<Producciondiaria> produccionesDiarias);
/**
* @param produccionDiaria
* @return
*/
public abstract ProduccionDiariaBean transformarProduccionDiaria(
Producciondiaria produccionDiaria);
/**
* @param produccionDiaria
* @return
*/
public abstract ProduccionDiariaBean transformarProduccionDiariaBasico(
Producciondiaria produccionDiaria);
/**
* @param tablaKardexes
* @return
*/
public abstract List<TablaKardexBean> transformarListaTablaKardex(
List<Tablakardex> tablaKardexes);
/**
* @param tablaKardex
* @return
*/
public abstract TablaKardexBean transformarTablaKardex(
Tablakardex tablaKardex);
/**
* @param valoresPromVariablesCalidades
* @return
*/
public abstract List<ValorPromVariableCalidadBean> transformarListaValorPromedioVarCalidad(
ArrayList<Valorpromvariablecalidad> valoresPromVariablesCalidades);
/**
* @param valorPromVariableCalidad
* @return
*/
public abstract ValorPromVariableCalidadBean transformarValorPromedioVarCalidad(
Valorpromvariablecalidad valorPromVariableCalidad);
/**
* @param productosVariableCalidad
* @return
*/
public abstract List<ProductoVariableCalidadBean> transformarListaProductoVariableCalidad(
List<Productovariablecalidad> productosVariableCalidad);
/**
* @param productoVariableCalidad
* @return
*/
public abstract ProductoVariableCalidadBean transformarProductoVariableCalidad(
Productovariablecalidad productoVariableCalidad);
/**
* @param variablesCalidad
* @return
*/
public abstract List<VariableCalidadBean> transformarListaVariableCalidad(
List<Variablecalidad> variablesCalidad);
/**
* @param variableCalidad
* @return
*/
public abstract VariableCalidadBean transformarVariableCalidad(
Variablecalidad variableCalidad);
/**
* @param factorKardexes
* @return
*/
public abstract List<FactorKardexBean> transformarListaFactorKardex(
ArrayList<Factorvariacionpuestotrabajo> factorKardexes);
/**
* @param factorKardex
* @return
*/
public abstract FactorKardexBean transformarFactorKardex(
Factorvariacionpuestotrabajo factorKardex);
/**
* @param consumoComponentes
* @return
*/
public abstract List<ConsumoComponenteBean> transformarListaConsumoComponente(
List<Consumocomponente> consumoComponentes);
/**
* @param consumoComponente
* @return
*/
public abstract ConsumoComponenteBean transformarConsumoComponente(
Consumocomponente consumoComponente);
/**
* @param estadopartediario
* @return
*/
public abstract List<EstadoParteDiarioBean> transformarListaEstadoParteDiario(
List<Estadopartediario> estadopartediario);
/**
* @param estadoParteDiario
* @return
*/
public abstract EstadoParteDiarioBean transformarEstadoParteDiario(
Estadopartediario estadoParteDiario);
/**
* @param ajusteProducciones
* @return
*/
public abstract List<AjusteProduccionBean> transformarListaAjusteProduccion(
List<Ajusteproduccion> ajusteProducciones);
/**
* @param ajusteProduccion
* @return
*/
public abstract AjusteProduccionBean transformarAjusteProduccion(
Ajusteproduccion ajusteProduccion);
/**
* @param estadosAjusteProduccion
* @return
*/
public abstract List<EstadoAjusteProduccionBean> transformarListaEstadoAjusteProduccion(
List<Estadoajusteproduccion> estadosAjusteProduccion);
/**
* @param estadoAjusteProduccion
* @return
*/
public abstract EstadoAjusteProduccionBean transformarEstadoAjusteProduccion(
Estadoajusteproduccion estadoAjusteProduccion);
/**
* @param columnaReporte
* @return
*/
public abstract ColumnaReporteBean transformarColumnaPlantillaReporte(
Columnareporte columnaReporte);
/**
* @param columnasReporte
* @return
*/
public abstract List<ColumnaReporteBean> transformarListaColumnaPlantillaReporte(
Set<Columnareporte> columnasReporte);
/**
* @param estadoOrdenProduccion
* @return
*/
public abstract EstadoOrdenProduccionBean transformarEstadoOrdenProduccionBean(
Estadoordenproduccion estadoOrdenProduccion);
public abstract List<EstadoOrdenProduccionBean> transformarListaEstadoOrdenProduccionBean(
List<Estadoordenproduccion> listaEstadoordenProduccion);
/**
* @param plantillasProducto
* @return
*/
public abstract List<PlantillaProductoBean> transformarListaPlantillaProducto(
List<Plantillaproducto> plantillasProducto);
/**
* @param estado
* @return
*/
public abstract EstadoColumnaReporteBean transformarEstadoColumnaReporte(
Estadocolumnareporte estado);
/**
* @param estados
* @return
*/
public abstract List<EstadoColumnaReporteBean> transformarListaEstadoColumnaReporte(
List<Estadocolumnareporte> estados);
/**
* @param notificaciondiaria
* @return
*/
public abstract NotificacionDiariaBean transformarNotificacionDiaria(
Notificaciondiaria notificaciondiaria);
/**
* @param notificaciondiaria
* @return
*/
public abstract NotificacionDiariaBean transformarNotificacionDiariaSimple(
Notificaciondiaria notificaciondiaria);
/**
* @param notificacionesDiaria
* @return
*/
public abstract List<NotificacionDiariaBean> transformarListaNotificacionDiaria(
List<Notificaciondiaria> notificacionesDiaria);
/**
* @param notificacionesDiaria
* @return
*/
public abstract List<NotificacionDiariaBean> transformarListaNotificacionDiariaSimple(
List<Notificaciondiaria> notificacionesDiaria);
/**
* @param tablerocontrol
* @return
*/
public abstract TableroControlBean transformarTableroControl(
Tablerocontrol tablerocontrol);
/**
* @param notificacionoperacion
* @return
*/
public abstract NotificacionOperacionBean transformarNotificacionOperacion(
Notificacionoperacion notificacionoperacion);
/**
* @param notificacionesOperacion
* @return
*/
public abstract Set<NotificacionOperacionBean> transformarListaNotificacionOperacion(
Set<Notificacionoperacion> notificacionesOperacion);
public abstract RegistroReporteEcsBean TransformarRegistroReporteEcs(
Registroreporteecs registroreporteecs);
/**
* @param notificacionproduccion
* @return
*/
public abstract NotificacionProduccionBean transformarNotificacionProduccion(
Notificacionproduccion notificacionproduccion);
/**
* @param notificacionesProduccion
* @return
*/
public abstract Set<NotificacionProduccionBean> transformarListaNotificacionProduccion(
Set<Notificacionproduccion> notificacionesProduccion);
/**
* @param hora
* @return
*/
public abstract HoraBean transformarHora(Hora hora);
/**
* @param horaBeans
* @return
* @throws AplicacionException
*/
public abstract List<HoraBean> transformarListaHora(List<Hora> horaBeans)
throws AplicacionException;
/**
* @param tablerosControl
* @return
*/
public abstract List<TableroControlBean> transformarListaTableroControl(
List<Tablerocontrol> tablerosControl);
/**
* @param notificacionDiariaBean
* @return
*/
abstract Notificaciondiaria transformarNotificacionDiariaBean(
NotificacionDiariaBean notificacionDiariaBean);
/**
* @param usuarioBean
* @return
*/
public abstract Usuario transformarUsuarioBean(UsuarioBean usuarioBean);
/**
* @param personaBean
* @return
*/
public abstract Persona transformarPersonaBean(PersonaBean personaBean);
/**
* @param tableroControlBean
* @return
*/
public abstract Tablerocontrol transformarTableroControlBean(
TableroControlBean tableroControlBean);
/**
* @param lineaNegocioBean
* @return
*/
public abstract Lineanegocio transformarLineaNegocioBean(
LineaNegocioBean lineaNegocioBean);
/**
* @param unidadBean
* @return
*/
public abstract Unidad transformarUnidadBean(UnidadBean unidadBean);
/**
* @param componenteNotificacionHO
* @return
*/
public ComponenteNotificacionBean transformarComponenteNotificacion(
Componentenotificacion componenteNotificacionHO);
/**
* @param componentesNotificacionHO
* @return
*/
public List<ComponenteNotificacionBean> tranformarListaComponenteNotificacion(
List<Componentenotificacion> componentesNotificacionHO);
/**
* @param listaHojaruta
* @return
*/
public abstract List<HojaRutaBean> transformarListaHojaRutaParaConsulta(
List<Hojaruta> listaHojaruta);
/**
* @param lineaNegocios
* @return
*/
public abstract List<LineaNegocioBean> transformarListaLineaNegocioParaCombos(
List<Lineanegocio> lineaNegocios);
/**
* @param unidades
* @return
*/
public abstract List<UnidadBean> transformarListaUnidadParaCombos(
List<Unidad> unidades);
/**
* @param procesos
* @return
*/
public abstract List<ProcesoBean> transformarListaProcesoParaCombos(
List<Proceso> procesos);
/**
* @param productos
* @return
*/
public abstract List<ProductoBean> transformarListaProductoParaCombos(
List<Producto> productos);
/**
* @param tipoCategoriaProducto
* @return
*/
public abstract TipoCategoriaProductoBean transformarTipoCategoriaProducto(
Tipocategoriaproducto tipoCategoriaProducto);
/**
* @param listaTipoCategoriaProducto
* @return
*/
public abstract List<TipoCategoriaProductoBean> transformarListaTipoCategoriaProducto(
List<Tipocategoriaproducto> listaTipoCategoriaProducto);
public List<OperacionBean> transformarListaOperacionModificarHojaRuta(
List<Operacion> listaOperacion);
public OperacionBean transformarOperacionModificarHojaRuta(
Operacion operacion);
/**
* @param plananual
* @return PlanAnualBean
*/
public abstract PlanAnualBean transformarPlanAnualParaConsulta(
Plananual plananual);
/**
* @param estados
* @return
*/
public List<EstadoUsuarioBean> transformarListaEstados(
List<Estadousuario> estados);
/**
* @param grupos
* @return
*/
public List<GrupoUsuarioBean> transformarListaGruposUsuario(
List<Grupousuario> grupos);
/**
* @param cargos
* @return
*/
public List<CargoBean> transformarListaCargos(List<Cargo> cargos);
/**
* @param usuarioGrupoLista
* @return
*/
public List<UsuarioGrupoUsuarioBean> transformarListaUsuarioGruposUsuarios(
List<Usuariogrupousuario> usuarioGrupoLista);
/**
* @param estadoBean
* @return
*/
public Estadousuario transformarEstadoUsuarioDTO(
EstadoUsuarioBean estadoBean);
/**
* @param grupoBean
* @return
*/
public Grupousuario transformarGrupoUsuarioDTO(GrupoUsuarioBean grupoBean);
/**
* @param grupoBean
* @param usuario
* @return
*/
public Usuariogrupousuario transformarUsuarioGrupoUsuarioDTO(
UsuarioGrupoUsuarioBean grupoBean, Usuario usuario);
public abstract List<RendimientoTermicoBean> transformarListaRendimientoTermico(
List<RendimientoTermico> listRendimientoTermico)
throws LogicaException;
public abstract RendimientoTermicoBean transformarRendimientoTermico(
RendimientoTermico rendimientoTermico);
public abstract ParametroSistemaBean transformarParametroSistema(
ParametroSistema parametro);
public abstract OrdenReporteBean transformarOrdenReporte(
Ordenreporte ordenreporte);
public abstract List<OrdenReporteBean> transformarListaOrdenResumen(
List<Ordenreporte> listaOrdenesReporte);
public abstract List<ParametroSistemaBean> transformarParametrosSistema(
List<ParametroSistema> parametros);
public abstract List<TipoConsumoBean> transformarListaTipoConsumo(
List<Tipoconsumo> listaTipoConsumo);
public CapacidadBolsaProductoBean transformarCapacidadBolsaProduccion(
Capacidadbolsaproducto capacidadbolsaproducto);
/**
* @param cubicacionProductos
* @return
*/
public abstract List<CubicacionProductoBean> transformarListaCubicacionProducto(List<Cubicacionproducto> cubicacionProductos);
/**
* @param estadosCubicacion
* @return
*/
public abstract List<EstadoCubicacionBean> transformarListaEstadoCubicacion(List<Estadocubicacion> estadosCubicacion);
}
| [
"fbngeldres@gmail.com"
] | fbngeldres@gmail.com |
5708c1dc32876251e9b81c5d3d21e4f6fe2f7177 | 02cf6b8c574bdcf7955f844fa236a4a37c6a6c47 | /app/src/main/java/org/team2767/deadeye/DeadeyeView.java | ef5b6355d33e0b5055d2274a07f7473fb290f30d | [
"MIT"
] | permissive | strykeforce/deadeye-android | e927e116abba3ff6f1b7ebeec283558d9778f6af | e070d83c9732de731f3336e697544838175dead2 | refs/heads/master | 2021-07-18T04:51:53.642320 | 2021-04-29T09:32:06 | 2021-04-29T09:32:06 | 113,485,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,320 | java | package org.team2767.deadeye;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.team2767.deadeye.di.Injector;
import timber.log.Timber;
/** Deadeye main view. */
public class DeadeyeView extends GLSurfaceView {
private final DeadeyeRenderer renderer;
public DeadeyeView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
setEGLContextClientVersion(2);
renderer = Injector.get().deadeyeRendererFactory().create(this);
setRenderer(renderer);
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
Timber.tag("LifeCycles");
Timber.d("DeadeyeView constructed");
}
public DeadeyeView(Context context) {
this(context, null);
}
public void setHueRange(int low, int high) {
renderer.setHueRange(low, high);
}
public void setSaturationRange(int low, int high) {
renderer.setSaturationRange(low, high);
}
public void setValueRange(int low, int high) {
renderer.setValueRange(low, high);
}
public void setMonitor(FrameProcessor.Monitor monitor) {
renderer.setMonitor(monitor);
}
public void setContour(FrameProcessor.Contours contour) {
renderer.setContours(contour);
}
}
| [
"jeff@jeffhutchison.com"
] | jeff@jeffhutchison.com |
77d7da4812b277d88af08fbf1b307ee773a9abfd | 28741ef7a80f0fa7c3f9ef14252f0958945580f3 | /Java/Java11-14-master/Java11-14-master/Lab 13/Lab12/src/LoginAndPassword.java | 290daf569a12cb2cd3995c68542aff286d9a56cf | [] | no_license | alyona0stepashka/Java-2018-2019 | f0c50fd5e2d0a6a54ed0c36fcb9397441f0f2c20 | 588241bba4540f996a594598cad520dbf80efe29 | refs/heads/master | 2020-04-25T17:49:50.056644 | 2019-02-28T17:39:37 | 2019-02-28T17:39:37 | 172,962,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,479 | java | import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
import java.sql.*;
import java.time.LocalDateTime;
@WebServlet(name = "LoginAndPassword", urlPatterns = {"/LoginAndPassword"})
public class LoginAndPassword extends HttpServlet
{
// JDBC driver name and database URL
//static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost:3306/users";
static final String USER = "root";
static final String PASS = "root";
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
}
static String Role = "";
private String IsCorrectLoginAndPassword(String login, String password, HttpServletResponse response) throws IOException
{
Connection conn = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
//response.getWriter().println("Connecting to database...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
String query;
query = "SELECT " + " Role, " + " Name " + "FROM userstable WHERE Login='" + login + "' AND Password='" + password + "'";
PreparedStatement stm = conn.prepareStatement(query);
ResultSet rs = stm.executeQuery();
if(rs.next())
{
Role = rs.getString("Role");
return rs.getString("Name");
}
} catch(Exception e)
{
System.out.println(e.getMessage());
} finally
{
if(conn != null)
try
{
conn.close();
} catch(SQLException e)
{
e.printStackTrace();
}
}
return "";
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String Login = request.getParameter("Login");
System.out.println(Login);
String Password = request.getParameter("Password");
System.out.println(Password);
String name = "";
if((name = IsCorrectLoginAndPassword(Login, Password, response)) != "")
{
//response.getWriter().println("Name = " + name);
//response.getWriter().println("Role = " + Role);
//response.getWriter().println("Time now = " + LocalDateTime.now());
request.getServletContext().log("Auth " + name + " is succesful");
HttpSession session = request.getSession(true);
session.setAttribute("Role", Role);
session.setAttribute("TimeStart", LocalDateTime.now());
session.setAttribute("Name", name);
Cookie[] last = request.getCookies();
boolean flag = false;
for(int i = 0; i < last.length; i++)
{
Cookie buffer = last[i];
if(buffer.getName() == "KolVisits")
{
int gg = Integer.parseInt(buffer.getValue() + 1);
buffer.setValue(Integer.toString(gg));
flag = true;
}
}
if(!flag)
{
Cookie cc = new Cookie("KolVisits", "1");
response.addCookie(cc);
}
Cookie cookie = new Cookie("LastSession", LocalDateTime.now().toString());
response.addCookie(cookie);
response.addCookie(new Cookie("Role", Role));
request.setAttribute("Role", Role);
response.setHeader("Role", Role);
request.getRequestDispatcher("/GoodLogin.jsp").forward(request, response);
} else
{
//response.getWriter().println("Error with your roots");
//response.getWriter().println("May be you want to register?");
response.getWriter().println("<html><head><title>May be register?</title></head><body><p>May be you want to register?)</p><a href=\"Registration.jsp\">Go to registration</a></body></html>");
}
}
}
| [
"paspaspas01@yandex.ru"
] | paspaspas01@yandex.ru |
88574fc895ab48766df75d7f4f81ab05148c1e80 | 1dd24d92fc733f2a0fb2ff52d2e86e4d0d0c590c | /javaOOP/TP3_5/src/MyDateTime/Question5.java | 53bc603f0c552b0bd85b03a9c5d1ecb024c5014c | [] | no_license | QuynhHoaNguyen/Java | 507c3ac4be5c166ad82a866d9437e3114a538894 | 060f342b3e385bb30b828a6bb45128d67264de2c | refs/heads/master | 2022-12-24T17:33:31.687896 | 2020-10-06T11:50:31 | 2020-10-06T11:50:31 | 262,301,491 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,320 | java | package MyDateTime;
//import java.util.Scanner;
public class Question5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
MyDate date = new MyDate();
MyDate d1 = new MyDate(28, 12, 2019);
MyDate d2 = new MyDate(10, 04, 2020);
System.out.println("Le jour 1: " + d1);
System.out.println("Le jour 2: " + d2 + "\n");
System.out.println("2. Comparez deux objets MyDate");
if (date.comparez(d1, d2) == 1) {
System.out.println("Le jour 1 est avant le jour 2.\n");
}
if (date.comparez(d1, d2) == -1) {
System.out.println("Le jour 1 est après le jour 2.\n");
}
if (date.comparez(d1, d2) == 0) {
System.out.println("Est un jour.\n");
}
System.out.println("3. Vérifiez si une date est valide.");
if(date.checkDate(d1) == false) {
System.out.println("La date n'est pas valide.\n");
}
else {
System.out.println("valide.\n");
}
System.out.println("4. Calculez la distance entre deux dates générées à partir de MyDate.");
System.out.println("La distance entre les deux dates est " + date.distance(d1, d2) + " jours.\n");
System.out.println("6. Affichage de la date");
System.out.println(date.toString("02/11/1998"));
System.out.println(date.toString("01/10/97"));
System.out.println(date.toString("3030-12-24"));
}
}
| [
"ntqhoa98@gmail.com"
] | ntqhoa98@gmail.com |
3863c9e220e554ea2ff376b192d0d28162813e83 | 94e3ade0a9cccd9bc2d7e9dd544bba20c7834c03 | /webservice/src/main/java/md/utm/fcim/webservice/controller/UserController.java | dc81f5de4e612d39e92043b6d34543944808754f | [] | no_license | vadimeladii/data-warehouse | efc7a29bc4d94a438f99dd22431d0e3c21b1166f | 198c6988875d87efda4a1e2db14b7dee373c17da | refs/heads/master | 2021-08-30T11:21:10.172639 | 2017-11-22T18:19:39 | 2017-11-22T18:19:39 | 111,717,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package md.utm.fcim.webservice.controller;
import md.utm.fcim.webservice.view.UserView;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/user")
public interface UserController {
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
UserView test();
}
| [
"vadimeladii@gmail.ru"
] | vadimeladii@gmail.ru |
0d8fb354b1ff4caffa2c4e06d42669fb2759cb5b | 651e5536597803f0d8b292fb62fca4957a419d43 | /src/library/catalog/SearchResult.java | 266b7f4042bcf5f3f068a6c911641aa3e8a7a0cb | [] | no_license | Nihat17/Library-Catalog-SWING-JAVA-app | 6638c7e31530d8cafc3183c898b6f11a62c2d5c8 | 46e4bda1a2e76f87bb4e121a350497fbe95ac00e | refs/heads/master | 2020-03-31T23:25:53.516184 | 2018-10-11T21:23:25 | 2018-10-11T21:23:25 | 152,655,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,518 | 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 library.catalog;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Hashtable;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author marshall
*/
public class SearchResult extends javax.swing.JDialog {
/**
* Creates new form SearchResult
*/
Return retObj = new Return();
int userID = 0;
int selectedRow = -1;
boolean putDetsToTable = true;
public SearchResult(java.awt.Frame parent, boolean modal, String title,
String author, int userID) {
super(parent, modal);
setLocationRelativeTo(parent);
initComponents();
this.userID = userID;
searchBook(title, author);
}
private void searchBook(String title, String author) {
List<ArrayList> listOfResults = new ArrayList<>();
listOfResults = retObj.searchBook(title, author);
retObj.setBookTable(bookDetTable, listOfResults);
}
/**
* 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() {
jScrollPane2 = new javax.swing.JScrollPane();
bookDetTable = new javax.swing.JTable();
getButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
setDateLabel = new javax.swing.JLabel();
setDateField = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
bookDetTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ISBN", "Title", "Author", "Genre", "Edition", "Publication Date", "DueDate"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane2.setViewportView(bookDetTable);
getButton.setText("Get the book!");
getButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
getButtonActionPerformed(evt);
}
});
cancelButton.setText("Cancel");
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
}
});
setDateLabel.setText("Set due date:");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(getButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(127, 127, 127))
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(setDateLabel)
.addGap(18, 18, 18)
.addComponent(setDateField, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(375, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane2)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(setDateLabel)
.addComponent(setDateField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(getButton)
.addComponent(cancelButton)))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
putDetsToTable = false;
this.dispose();
}//GEN-LAST:event_cancelButtonActionPerformed
private void getButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_getButtonActionPerformed
String date = getCurrentDate();
Book book = new Book();
Return retObj = new Return();
if(checkIfGivenDateIsValid()){
int ISBN = getDetailsOnSelectedRow();
if(ISBN > 0){
book.setDueDate(setDateField.getText());
book.setStatus(StatusType.notAvailable);
try {
if(retObj.modifyBookTableAfterTaken(book, userID, ISBN)){
JOptionPane.showMessageDialog(this, "You took the book successfully. \n"
+ "Please remember to bring it back on " + setDateField.getText(),
"Information", JOptionPane.INFORMATION_MESSAGE);
this.dispose();
}
} catch (ClassNotFoundException | SQLException ex) {
Logger.getLogger(SearchResult.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(ISBN < 0){
JOptionPane.showMessageDialog(this, "Please select one of these list on table.",
"Warning",JOptionPane.ERROR_MESSAGE);
}
}
else{
JOptionPane.showMessageDialog(this, "Please use a date in dd/mm/yyyy format");
}
}//GEN-LAST:event_getButtonActionPerformed
private int getDetailsOnSelectedRow() {
selectedRow = bookDetTable.getSelectedRow();
String ISBN = "";
if(selectedRow > -1){
ISBN = (String) bookDetTable.getValueAt(selectedRow, 0);
}
return Integer.parseInt(ISBN);
}
private boolean checkIfGivenDateIsValid(){
boolean output = true;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
try{
LocalDate date = formatter.parse(setDateField.getText(), LocalDate::from);
}
catch(DateTimeParseException ex){
output = false;
}
return output;
}
public List getListForTable() {
List bookDetails = new ArrayList();
List listOfLists = new ArrayList();
if(putDetsToTable){
for(int i = 0; i < 6; i++){
bookDetails.add(bookDetTable.getValueAt(selectedRow, i));
}
bookDetails.add(setDateField.getText());
listOfLists.add(bookDetails);
}
return listOfLists;
}
private void checkIfDateIsPassed(String date) {
int inputYear, inputMonth, inputDay;
int currYear, currMonth, currDay;
String inputDate = setDateField.getText();
String inputYearStr = "", inputMonthStr = "", inputDayStr= "";
String currYearStr = "", currMonthStr = "", currDayStr = "";
String str = "";
boolean checkYear, checkMonth, checkDay;
for(int c = 0; c < 2; c++){
checkYear = true;
checkMonth = false;
checkDay = false;
for(int i = 0; i < setDateField.getText().length(); i++){
if(c == 0){
if(!"/".equals(inputDate.substring(i, ++i)) && checkYear){
inputYearStr += inputDate.substring(i - 1, i);
}
if(inputDate.substring(i, ++i).equals("/")){
checkYear = false;
checkMonth = true;
continue;
}
if(!inputDate.substring(i, ++i).equals("/") && checkMonth){
inputMonthStr += inputDate.substring(i - 1, i);
}
if(inputDate.substring(i, ++i).equals("/")){
checkMonth = false;
checkDay = true;
continue;
}
if(!inputDate.substring(i, ++i).equals("/") && checkDay){
inputDayStr += inputDate.substring(i - 1, i);
}
if(inputDate.substring(i, ++i).equals("/")){
checkDay = false;
continue;
}
}
else{
if(!"/".equals(date.substring(i, ++i)) && checkYear){
currYearStr += date.substring(i - 1, i);
}
if(date.substring(i, ++i).equals("/")){
checkYear = false;
checkMonth = true;
continue;
}
if(!date.substring(i, ++i).equals("/") && checkMonth){
currMonthStr += date.substring(i - 1, i);
}
if(date.substring(i, ++i).equals("/")){
checkMonth = false;
checkDay = true;
continue;
}
if(!date.substring(i, ++i).equals("/") && checkDay){
currDayStr += date.substring(i - 1, i);
}
if(date.substring(i, ++i).equals("/")){
checkDay = false;
continue;
}
}
}
}
int m = 0;
}
private String getCurrentDate() {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Calendar cal = Calendar.getInstance();
String date = dateFormat.format(cal.getTime());
return date;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTable bookDetTable;
private javax.swing.JButton cancelButton;
private javax.swing.JButton getButton;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextField setDateField;
private javax.swing.JLabel setDateLabel;
// End of variables declaration//GEN-END:variables
}
| [
"nihatallahverdiyev@gmail.com"
] | nihatallahverdiyev@gmail.com |
6349fea96a60aeda5fe2d23b0a123aa3c8c001fc | 255af43d73078259c53b12117b4f36a99550c67d | /src/org/hopen/jjbus/action/CashOperationController.java | b79ad8f4b09c28b11519f65a6119db8609aa7cdf | [] | no_license | npmcdn-to-unpkg-bot/99bus | d5d63299f2f2232abbe610f80e814f776fa75ed5 | 0384af164f8837a18f8f2ea01ed94f29dd182819 | refs/heads/master | 2021-01-21T15:32:05.454033 | 2016-08-10T18:18:31 | 2016-08-10T18:37:27 | 67,423,641 | 0 | 0 | null | 2016-09-05T13:32:35 | 2016-09-05T13:32:34 | null | UTF-8 | Java | false | false | 6,604 | java | /**
* @author jerry
* @mail : jerry_lzw@139.com
*/
package org.hopen.jjbus.action;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.hopen.bean.SessionInfo;
import org.hopen.jjbus.security.Encrypt;
import org.hopen.jjbus.service.ICashOperationService;
import org.hopen.utils.ConfigUtil;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
/**
* @author jerry
*
*/
@Controller
@RequestMapping("/cshoprtn")
public class CashOperationController extends BaseController {
@Autowired
ICashOperationService cashOperationSevice;
@RequestMapping("/toDrawInFyPage")
public String toDrawInFyPage(HttpServletRequest request, String amount) {
request.setAttribute("page", SessionInfo.getUserInfo(request).getTransText());
SessionInfo.getUserInfo(request).setTransText(null);
return "/acct/fyWithPayInPage";
}
@RequestMapping("/toDrwIn")
public String toDrawInNew(HttpServletRequest request, String amount) {
if (amount == null || amount == "" || Float.parseFloat(amount) <= 0) {
request.setAttribute("msg", "充值金额必须大于0");
return "forward:/usrbs/toCptl";
}
Map<String, String> jobj = new HashMap<String, String>();
jobj.put("userId", SessionInfo.getUserInfo(request).getUserId());
jobj.put("amount", amount);
JSONObject job = cashOperationSevice.queryPayInPage(jobj);
String htmlPar = job.getString("htmlParam");
Document document = Jsoup.parse(htmlPar);
Element e = document.getElementById("frm1");
e.attr("target","fyFrame");
job.put("htmlParam", document.html());
SessionInfo.getUserInfo(request).setTransText(document.html());
String error = job.getString("error");
if(!error.equals("-1")){
request.setAttribute("msg", job.getString("msg"));
return "forward:/usrbs/toCptl";
}
request.setAttribute("response", job);
return "/acct/in_money";
}
@RequestMapping("/toDrwOt")
public String toDrawOut(HttpServletRequest request) {
String userId = SessionInfo.getUserInfo(request).getUserId();
JSONObject jobj = cashOperationSevice.queryCashInit(userId);
String error = jobj.getString("error");
if(!error.equals("-1")){
request.setAttribute("msg", jobj.getString("msg"));
return "forward:/usr/toCptl";
}
request.setAttribute("response", jobj);
return "/acct/draw_money";
}
@RequestMapping("/toDrawOutPage")
public String toDrawOutPage(HttpServletRequest request){
request.setAttribute("page", SessionInfo.getUserInfo(request).getTransText());
SessionInfo.getUserInfo(request).setTransText(null);
return "/acct/fyWithDrawPage";
}
@RequestMapping("/drawRqst")
public String drawRqst(HttpServletRequest request,String bankId,String amount,String payPassword) {
String userId = SessionInfo.getUserInfo(request).getUserId();
Map<String, String> inMap = new HashMap<String, String>();
inMap.put("user_id", userId);
inMap.put("amount", amount);
inMap.put("payPassword",Encrypt.encrypt3DES(payPassword, ConfigUtil.getSecretKey()));
inMap.put("bankId", bankId);
JSONObject jobj = cashOperationSevice.storeDrawRqst(inMap);
String error = jobj.getString("error");
if(!error.equals("-1")){
request.setAttribute("msg", jobj.getString("msg"));
request.setAttribute("amount", amount);
return "forward:/cshoprtn/toDrwOt";
}
String htmlParam = jobj.getString("htmlParam");
Document document = Jsoup.parse(htmlParam);
Elements e = document.getElementsByAttributeValue("id", "frm1");
e.attr("target","fyFrame");
SessionInfo.getUserInfo(request).setTransText(document.html());
request.setAttribute("response", jobj);
return "/acct/draw_brige";
}
@RequestMapping("/checkTrad")
@ResponseBody
public JSONObject checkTrad(HttpServletRequest request) {
String userId = SessionInfo.getUserInfo(request).getUserId();
if(userId != null && !userId.equals("")){
JSONObject jobj = cashOperationSevice.queryCashInit(userId);
String error = jobj.getString("error");
boolean setTradPwd = jobj.getBoolean("payPasswordStatus");
if(error.equals("-1")&&setTradPwd){
return JSONObject.parseObject("{error:-1,msg:'检查通过'}");
} else {
return JSONObject.parseObject("{error:-8,msg:'未设置交易密码'}");
}
} else {
return JSONObject.parseObject("{error:-9,msg:'未登录'}");
}
}
@RequestMapping("/checkBank")
@ResponseBody
public JSONObject checkBank(HttpServletRequest request) {
String userId = SessionInfo.getUserInfo(request).getUserId();
JSONObject jobj = cashOperationSevice.queryCashInit(userId);
String error = jobj.getString("error");
JSONArray bankList = jobj.getJSONArray("bankList");
if(error.equals("-1")&&bankList != null &&bankList.size()>0){
return JSONObject.parseObject("{error:-1,msg:'检查通过'}");
} else {
return JSONObject.parseObject("{error:9999,msg:'检查失败'}");
}
}
@RequestMapping("/inverstBid")
public String inverstBid(HttpServletRequest request, String borrowId,
String amount, String dealPwd) {
String userid = SessionInfo.getUserInfo(request).getUserId();
Map<String, String> map = new HashMap<String, String>();
map.put("borrowId", borrowId);
map.put("userId", userid);
map.put("amount", amount);
map.put("dealPwd", Encrypt.encrypt3DES(dealPwd, ConfigUtil.getSecretKey()));
JSONObject rjob = cashOperationSevice.stroeInverstBid(map);
String error = rjob.getString("error");
if (!error.equals("-1")) {
return "forward:/prdct/toBdDtl?bid=" +borrowId +"&msg=" + rjob.get("msg");
}
request.setAttribute("msg",rjob.getString("msg"));
return "forward:/usrbs/toCptl";
}
@RequestMapping("/toQueryTradList")
public String toQueryTradList(HttpServletRequest request, String borrowId,
String amount, String dealPwd) {
String userid = SessionInfo.getUserInfo(request).getUserId();
Map<String, String> map = new HashMap<String, String>();
map.put("id", userid);
map.put("purpose", "0");
JSONObject rjob = cashOperationSevice.queryTradRecord(map);
request.setAttribute("response", rjob);
return "/user/tradlist";
}
}
| [
"jerry_lzw@139.com"
] | jerry_lzw@139.com |
6749084dd70d3b387d5f4c41d336e45e1dcce6a0 | 15bb61e7e026a403114ac570be024d19b29ea0c3 | /DesignPattern/Structural/it/lmpetrella/tutorials/designpattern/bridge/AbstractionIF.java | 55a77e898a93ab3f041e26fe54d93e1ec3fd7035 | [] | no_license | luigimartin/java-tutorials-lmpetrella | ca8e29f7650c163da576c720a14ddb6d48c1b5f6 | b45f9766c74ffa63151711d1c1f8cf5718471012 | refs/heads/master | 2021-01-10T07:41:12.425424 | 2015-01-28T13:51:08 | 2015-01-28T13:51:08 | 43,546,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 119 | java | package it.lmpetrella.tutorials.designpattern.bridge;
public interface AbstractionIF {
public void action();
} | [
"luigimartin.way@gmail.com"
] | luigimartin.way@gmail.com |
8149cce9d075bf56ccac08293243a02bdb04b492 | 5d219e8197528b86a1dfc7b9845b3c476e580ce5 | /app/src/main/java/sventrapopizz/amoledblackthemeshowcase/JamXFragment.java | 6749cb3270de99dcec427789b1326080c8320cc1 | [] | no_license | Sventra/AmoledBlackThemeShowcase | b3f37d8cb08fd8e4602b3d72d6a7fd3db43c495f | 78c61bc60513c8feb3f7437395963c94101eab40 | refs/heads/master | 2022-06-12T21:55:25.543902 | 2022-06-01T19:39:22 | 2022-06-01T19:39:22 | 150,482,584 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package sventrapopizz.amoledblackthemeshowcase;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public class JamXFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_jamx, container, false);
}
}
| [
"andreademichele07@gmail.com"
] | andreademichele07@gmail.com |
eebbacb19511f7350e810a6101d0b946941bb889 | f0a9a2675c84b05f56f627b718932e96b894c09a | /src/main/java/com/yang/bms/service/UserService.java | 899388a46b5f239fb64c9ad23d80f0ab3beec064 | [
"Apache-2.0"
] | permissive | zhichuwy/BMS | a2713f9b4ebdc877c6063cece0ff04b6567c14c3 | 85b15d42623ba4ffccba941ddfe52cf83485ebcd | refs/heads/master | 2022-07-08T15:11:47.703113 | 2019-12-14T15:58:39 | 2019-12-14T15:58:39 | 228,047,617 | 0 | 0 | Apache-2.0 | 2022-06-21T02:26:59 | 2019-12-14T15:46:32 | Java | UTF-8 | Java | false | false | 111 | java | package com.yang.bms.service;
public interface UserService {
void haveUser(String userId,String pwd);
}
| [
"877116700@qq.com"
] | 877116700@qq.com |
6df60a304ddf403ff4d9605e788798fbc952b9e9 | 1777c53ef3947a33d2954b71f566ef6f6e705414 | /src/main/java/filter/CodingFilter.java | 9353d71beefbc581d38c7687634ed4edba893ca0 | [] | no_license | tianhan1998/ojtools | 5b94172554277fb0d8ecf79a24fd5820243f7ed3 | b6e9fb305004e587b079319830d2b89c1f61ca80 | refs/heads/master | 2022-07-02T04:16:59.430943 | 2019-08-29T12:12:34 | 2019-08-29T12:12:34 | 195,880,548 | 2 | 0 | null | 2022-06-21T01:26:58 | 2019-07-08T20:19:03 | Java | UTF-8 | Java | false | false | 1,590 | java | package filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet Filter implementation class CodingFilter
*/
public class CodingFilter implements Filter {
/**
* Default constructor.
*/
public CodingFilter() {
// TODO Auto-generated constructor stub
}
/**
* @see Filter#destroy()
*/
public void destroy() {
// TODO Auto-generated method stub
}
/**
* @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest re = (HttpServletRequest) request;
HttpServletResponse rs = (HttpServletResponse) response;
String spath = re.getServletPath();
String[] urls = { "/login", "/json", ".js", ".css", ".ico", ".jpg", ".png" };
boolean flag = true;
for (String str : urls) {
if (spath.indexOf(str) != -1) {
flag = false;
break;
}
}
if (flag) {
re.setCharacterEncoding("UTF-8");
rs.setContentType("text/html;charset=utf-8");
}
chain.doFilter(request, response);
}
/**
* @see Filter#init(FilterConfig)
*/
public void init(FilterConfig fConfig) throws ServletException {
// TODO Auto-generated method stub
}
}
| [
"892265525@qq.com"
] | 892265525@qq.com |
f742e724e87776d18a2ace55afd5b388f15b6f64 | 318dbf15015fddfb0d93d77d6311a77eed3a9b4b | /ParseURLFunction.java | d0995320be864cecb6d8d33cb47c40972b6b845e | [] | no_license | ketanp28/testCG | fd5db53debebc68ac7fadbe1984a108a16770bc3 | 7343ee2a1b1a66fc230527d095b01ad9ea0cb7db | refs/heads/master | 2021-01-19T21:45:07.548106 | 2017-04-19T05:00:14 | 2017-04-19T05:00:14 | 88,701,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java |
package blackberry.utils;
import blackberry.core.FunctionSignature;
import blackberry.core.ScriptableFunctionBase;
import blackberry.utils.URL.URLObject;
public final class ParseURLFunction extends ScriptableFunctionBase {
public static final String NAME = "parseURL";
public Object execute( Object thiz, Object[] args ) throws Exception {
return new URLObject( args[ 0 ].toString() );
}
protected FunctionSignature[] getFunctionSignatures() {
FunctionSignature fs = new FunctionSignature( 1 );
fs.addParam( String.class, true );
return new FunctionSignature[] { fs };
}
}
| [
"ketan@codenation.co.in"
] | ketan@codenation.co.in |
d0dc41b5ff83de95db832d815ee96820ffc42a98 | 04bd74d3404a807c424694c7afc906fe5f4b5fc2 | /DemoMaven1/src/test/java/subha/OR3.java | b1753c452c85a2cf932bd8ee4f9dbb220e2bcf20 | [] | no_license | sudharanith/demomaven1 | eb81f14fe07a366cf611d8dd95689b8b9ce3c817 | fb05c4a250989cdcf5aef39666c64baa351a9de2 | refs/heads/master | 2023-08-10T01:04:09.186676 | 2019-07-31T10:07:19 | 2019-07-31T10:07:19 | 199,830,248 | 0 | 0 | null | 2023-07-22T12:19:29 | 2019-07-31T10:03:32 | Java | UTF-8 | Java | false | false | 464 | java | package subha;
import org.openqa.selenium.WebDriver;
public class OR3 {
public static String email= " //input[@type='email' and @name='email'] ";
public static String password=" //input[@type='password' and @name='pass'] ";
public static String login=" //input[@type='submit'and @id='u_0_2'] ";
public static String invoke =" //div[text()='Account Settings'] ";
public static String logout =" //text()[.='Log Out']/ancestor::span[1] ";
}
| [
"Administroator@Atyam"
] | Administroator@Atyam |
0d629a22baf6b4b5c85ee0459a144f9799c315be | 2133ffc4e97323ea4e62059e1b793776880f419d | /src/java/it/unibo/cs/rgb/test/TeiTestInputStreamConcordanze.java | 0e4804c46ae0ab7979ad8202210233fd8c0f7438 | [] | no_license | fedo/RgB | 1f92a3b51bd700c1622d60264fa37d4d5849b3b7 | 8c3dcb1d6418d7fe7678b68cf2c0a87e631e6e3b | refs/heads/master | 2020-05-31T04:46:07.138064 | 2010-07-02T13:36:03 | 2010-07-02T13:36:03 | 629,360 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,304 | java | package it.unibo.cs.rgb.test;
import it.unibo.cs.rgb.tei.TeiConcordanze;
import it.unibo.cs.rgb.tei.TeiDocument;
import it.unibo.cs.rgb.tei.TeiSvg;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
import sun.net.www.content.text.PlainTextInputStream;
/**
*
* @author fedo
*/
public class TeiTestInputStreamConcordanze {
public static void main(String[] args) throws FileNotFoundException, IOException {
String xmlString = "/home/gine/NetBeansProjects/RgB/web/collection6/prophecy_of_merlin.xml";
String xslString = "/home/gine/NetBeansProjects/RgB/web/stylesheets/witList.xsl";
String xslString2 = "/home/gine/NetBeansProjects/RgB/web/stylesheets/content_text.xsl";
File xmlFile = new File(xmlString);
File xslFile = new File(xslString);
File xslFile2 = new File(xslString2);
if (xmlFile.exists() && xslFile.exists()) {
//System.out.println("i files esistono");
}
HashMap xslHashMap = new HashMap();
xslHashMap.put("/stylesheets/witList.xsl", FileUtils.readFileToString(xslFile));
xslHashMap.put("/stylesheets/content_text.xsl", FileUtils.readFileToString(xslFile2));
TeiDocument tei = new TeiDocument("zuppaditei", FileUtils.readFileToString(xmlFile), xslHashMap);
String[] witnesses = tei.getWitnessesList();
String out="";
for (int i=0; i<witnesses.length; i++) {
String plainText = tei.getEstrazioneDiConcordanzeContentDataString(witnesses[i]);
//String a[] = plainText.split("\\|");
TeiConcordanze con = new TeiConcordanze("and", 3, plainText, witnesses[i], "pirla");
out += con.getConcordanze();
}
System.out.println(out);
//System.out.println(getContentType(new FileInputStream(xmlFile)));
//System.out.println("nome " + tei.getTeiName());
//System.out.println("path " + tei.getAbsolutePath());
//System.out.println(tei.getHover());
//System.out.println("view " + tei.getView("fasdfdfs"));
//System.out.println(RgB.getXmlStreamEncoding(new FileInputStream(xmlFile)));
//System.out.println("\n\n\nCCCCC\n\n\n");
//System.out.println(RgB.convertXmlStreamToString(new FileInputStream(xmlFile)));
//System.out.println("\n\n\nCCCCC\n\n\n");
//System.out.println(FileUtils.readFileToString(xmlFile));
//System.out.println(RgB.convertStreamToString(new FileInputStream(xmlFile), "UTF-8"));
// parsing dei dati ricevuti
//ArrayList<HashMap> data = new ArrayList<HashMap>();
//String svgDataString = tei.getSvgDataString();
//String svgDataString = "der1 1 sigil1 id1" + "----" + "der2 0 sigil2 id2"; //tring "der", boolean "missing", String "sigil", String "id"
//String svgDataString = "null 0 a a" + "----" + "a 0 b b";
/*str = str.substring(0, str.indexOf("|"));
System.out.println(str);
String[] lines = str.split("-");
for (int i = 0; i < lines.length; i++) {
System.out.println(lines[i]);
HashMap witnessMap = new HashMap();
StringTokenizer tokens = new StringTokenizer(lines[i]);
String der = tokens.nextToken();
if (!der.equalsIgnoreCase("null")) {
witnessMap.put("der", der);
}
witnessMap.put("missing", Boolean.parseBoolean(tokens.nextToken()));
witnessMap.put("sigil", tokens.nextToken());
witnessMap.put("id", tokens.nextToken());
data.add(witnessMap);
}*/
//TeiSvg svg = new TeiSvg(data);
//System.out.println("svg "+svg.getSvg());
//System.out.println("γδεζηθικλμνξο");
}
public static String convertStreamToString(InputStream is) throws IOException {
/*
* To convert the InputStream to String we use the BufferedReader.readLine()
* method. We iterate until the BufferedReader return null which means
* there's no more data to read. Each line will appended to a StringBuilder
* and returned as String.
*/
String encoding = "UTF-8"; //default
// cerca se il documento specifica un altro encoding
if (is != null) {
StringBuilder sb = new StringBuilder();
String line;
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));//"UTF-8"));
while ((line = reader.readLine()) != null) { //CRASHA
sb.append(line).append("\n");
if ((sb.toString().contains("<?") && sb.toString().contains("?>")) && sb.toString().contains("encoding=")) {
Pattern p = Pattern.compile(".*<\\?.*encoding=.(.*).\\?>.*", Pattern.DOTALL);
Matcher matcher = p.matcher(sb.toString());
if (matcher.matches()) {
encoding = matcher.group(1);
}
break;
}
}
}
// converte
if (is != null) {
StringBuilder sb = new StringBuilder();
String line;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, encoding));//"UTF-8"));
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
System.out.println(line);
}
} finally {
is.close();
}
return sb.toString();
} else {
return "error";
}
}
public static String getContentType(InputStream is) throws IOException {
/*
* To convert the InputStream to String we use the BufferedReader.readLine()
* method. We iterate until the BufferedReader return null which means
* there's no more data to read. Each line will appended to a StringBuilder
* and returned as String.
*/
String encoding = "UTF-8"; //default
// cerca se il documento specifica un altro encoding
if (is != null) {
StringBuilder sb = new StringBuilder();
String line;
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));//"UTF-8"));
while ((line = reader.readLine()) != null) { //CRASHA
sb.append(line).append("\n");
if ((sb.toString().contains("<?") && sb.toString().contains("?>")) && sb.toString().contains("encoding=")) {
Pattern p = Pattern.compile(".*<\\?.*encoding=.(.*).\\?>.*", Pattern.DOTALL);
Matcher matcher = p.matcher(sb.toString());
if (matcher.matches()) {
encoding = matcher.group(1);
}
break;
}
}
}
return encoding;
}
}
| [
"fedoverseas@gmail.com"
] | fedoverseas@gmail.com |
879c6f81a1dcac61d19e1a11595d52cf56fe7874 | 7b733e23cefd907fc96d1cb93cbaf2777bcb12eb | /webserviceClient/src/com/mysever/HelloWorldServiceLocator.java | 5da61d4c89ee3db6723ad7a623f704ebe6ae08e6 | [] | no_license | liuxiang/webService_axis | 8d4769f18948a5a789aca295a7fc6826eb7881ca | f64819edf9662cd23680b79b91f420f8b09d450a | refs/heads/master | 2021-01-02T22:18:52.623409 | 2015-02-05T14:28:00 | 2015-02-05T14:28:00 | 30,359,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,265 | java | /**
* HelloWorldServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.mysever;
public class HelloWorldServiceLocator extends org.apache.axis.client.Service implements com.mysever.HelloWorldService {
public HelloWorldServiceLocator() {
}
public HelloWorldServiceLocator(org.apache.axis.EngineConfiguration config) {
super(config);
}
public HelloWorldServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
// Use to get a proxy class for HelloWorld
private java.lang.String HelloWorld_address = "http://localhost:8080/webservice/services/HelloWorld";
public java.lang.String getHelloWorldAddress() {
return HelloWorld_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String HelloWorldWSDDServiceName = "HelloWorld";
public java.lang.String getHelloWorldWSDDServiceName() {
return HelloWorldWSDDServiceName;
}
public void setHelloWorldWSDDServiceName(java.lang.String name) {
HelloWorldWSDDServiceName = name;
}
public com.mysever.HelloWorld getHelloWorld() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(HelloWorld_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getHelloWorld(endpoint);
}
public com.mysever.HelloWorld getHelloWorld(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
com.mysever.HelloWorldSoapBindingStub _stub = new com.mysever.HelloWorldSoapBindingStub(portAddress, this);
_stub.setPortName(getHelloWorldWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setHelloWorldEndpointAddress(java.lang.String address) {
HelloWorld_address = address;
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (com.mysever.HelloWorld.class.isAssignableFrom(serviceEndpointInterface)) {
com.mysever.HelloWorldSoapBindingStub _stub = new com.mysever.HelloWorldSoapBindingStub(new java.net.URL(HelloWorld_address), this);
_stub.setPortName(getHelloWorldWSDDServiceName());
return _stub;
}
}
catch (java.lang.Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
java.lang.String inputPortName = portName.getLocalPart();
if ("HelloWorld".equals(inputPortName)) {
return getHelloWorld();
}
else {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
}
public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("http://mysever.com", "HelloWorldService");
}
private java.util.HashSet ports = null;
public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("http://mysever.com", "HelloWorld"));
}
return ports.iterator();
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
if ("HelloWorld".equals(portName)) {
setHelloWorldEndpointAddress(address);
}
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
}
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
setEndpointAddress(portName.getLocalPart(), address);
}
}
| [
"liuxiang.1227@qq.com"
] | liuxiang.1227@qq.com |
406289798bb4b64d687992cc4a9f41a288569b5f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/6/6_24a45a22114df592a6af77813caea242f274c7eb/ServiceInfo/6_24a45a22114df592a6af77813caea242f274c7eb_ServiceInfo_s.java | 69c2640f71457316554165e681c746324e93e1cc | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 281,640 | java | /*
* This file is part of DRBD Management Console by LINBIT HA-Solutions GmbH
* written by Rasto Levrinc.
*
* Copyright (C) 2009-2010, LINBIT HA-Solutions GmbH.
* Copyright (C) 2009-2010, Rasto Levrinc
*
* DRBD Management Console is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* DRBD Management Console is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with drbd; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package lcmc.gui.resources;
import lcmc.gui.Browser;
import lcmc.gui.ClusterBrowser;
import lcmc.data.Host;
import lcmc.data.HostLocation;
import lcmc.data.ResourceAgent;
import lcmc.gui.widget.Widget;
import lcmc.gui.widget.WidgetFactory;
import lcmc.gui.widget.TextfieldWithUnit;
import java.awt.geom.Point2D;
import lcmc.data.resources.Service;
import lcmc.data.Subtext;
import lcmc.data.CRMXML;
import lcmc.data.ClusterStatus;
import lcmc.data.ConfigData;
import lcmc.data.PtestData;
import lcmc.data.AccessMode;
import lcmc.utilities.MyMenu;
import lcmc.utilities.UpdatableItem;
import lcmc.utilities.Unit;
import lcmc.utilities.Tools;
import lcmc.utilities.CRM;
import lcmc.utilities.ButtonCallback;
import lcmc.utilities.MyMenuItem;
import lcmc.utilities.MyList;
import lcmc.utilities.MyListModel;
import lcmc.utilities.WidgetListener;
import lcmc.gui.SpringUtilities;
import lcmc.gui.dialog.pacemaker.ServiceLogs;
import lcmc.gui.dialog.EditConfig;
import java.awt.Color;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Dimension;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.util.List;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Map;
import java.util.HashMap;
import java.util.TreeSet;
import java.util.LinkedHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.Locale;
import java.util.Set;
import java.util.regex.Matcher;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JComponent;
import javax.swing.ImageIcon;
import javax.swing.BoxLayout;
import javax.swing.SwingUtilities;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.JMenuBar;
import javax.swing.JScrollPane;
import javax.swing.JRadioButton;
import javax.swing.JCheckBox;
import javax.swing.SpringLayout;
import javax.swing.AbstractButton;
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.collections15.map.MultiKeyMap;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.concurrent.locks.Lock;
/**
* This class holds info data for one hearteat service and allows to enter
* its arguments and execute operations on it.
*/
public class ServiceInfo extends EditableInfo {
/** A map from host to the combobox with scores. */
private final Map<HostInfo, Widget> scoreComboBoxHash =
new HashMap<HostInfo, Widget>();
/** A map from host to stored score. */
private final Map<HostInfo, HostLocation> savedHostLocations =
new HashMap<HostInfo, HostLocation>();
/** A combobox with pingd constraint. */
private Widget pingComboBox = null;
/** Saved ping constraint. */
private String savedPingOperation = null;
/** Saved meta attrs id. */
private String savedMetaAttrsId = null;
/** Saved operations id. */
private String savedOperationsId = null;
/** A map from operation to the stored value. First key is
* operation name like "start" and second key is parameter like
* "timeout". */
private final MultiKeyMap<String, String> savedOperation =
new MultiKeyMap<String, String>();
/** Whether id-ref for meta-attributes is used. */
private ServiceInfo savedMetaAttrInfoRef = null;
/** Combo box with same as operations option. */
private Widget sameAsMetaAttrsWi = null;
/** Whether id-ref for operations is used. */
private ServiceInfo savedOperationIdRef = null;
/** Combo box with same as operations option. */
private Widget sameAsOperationsWi = null;
/** Saved operations lock. */
private final Lock mSavedOperationsLock = new ReentrantLock();
/** Operations combo box hash lock. */
private final ReadWriteLock mOperationsComboBoxHashLock =
new ReentrantReadWriteLock();
/** Operations combo box hash read lock. */
private final Lock mOperationsComboBoxHashReadLock =
mOperationsComboBoxHashLock.readLock();
/** Operations combo box hash write lock. */
private final Lock mOperationsComboBoxHashWriteLock =
mOperationsComboBoxHashLock.writeLock();
/** A map from operation to its combo box. */
private final MultiKeyMap<String, Widget> operationsComboBoxHash =
new MultiKeyMap<String, Widget>();
/** Cache for the info panel. */
private JComponent infoPanel = null;
/** Group info object of the group this service is in or null, if it is
* not in any group. */
private GroupInfo groupInfo = null;
/** Master/Slave info object, if is null, it is not master/slave
* resource. */
private volatile CloneInfo cloneInfo = null;
/** ResourceAgent object of the service, with name, ocf informations
* etc. */
private final ResourceAgent resourceAgent;
/** Radio buttons for clone/master/slave primitive resources. */
private Widget typeRadioGroup;
/** Default values item in the "same as" scrolling list in meta
attributes.*/
private static final String META_ATTRS_DEFAULT_VALUES_TEXT =
"default values";
/** Default values internal name. */
private static final String META_ATTRS_DEFAULT_VALUES = "default";
/** Default values item in the "same as" scrolling list in operations. */
private static final String OPERATIONS_DEFAULT_VALUES_TEXT =
"advisory minimum";
/** Default values internal name. */
private static final String OPERATIONS_DEFAULT_VALUES = "default";
/** Check the cached fields. */
protected static final String CACHED_FIELD = "cached";
/** Master / Slave type string. */
static final String MASTER_SLAVE_TYPE_STRING = "Master/Slave";
/** Manage by CRM icon. */
static final ImageIcon MANAGE_BY_CRM_ICON = Tools.createImageIcon(
Tools.getDefault("ServiceInfo.ManageByCRMIcon"));
/** Don't Manage by CRM icon. */
static final ImageIcon UNMANAGE_BY_CRM_ICON = Tools.createImageIcon(
Tools.getDefault("ServiceInfo.UnmanageByCRMIcon"));
/** Icon that indicates a running service. */
public static final ImageIcon SERVICE_RUNNING_ICON_SMALL =
Tools.createImageIcon(Tools.getDefault(
"ServiceInfo.ServiceRunningIconSmall"));
/** Icon that indicates a running that failed. */
private static final ImageIcon SERVICE_RUNNING_FAILED_ICON_SMALL =
Tools.createImageIcon(Tools.getDefault(
"ServiceInfo.ServiceRunningFailedIconSmall"));
/** Icon that indicates a started service (but not running). */
private static final ImageIcon SERVICE_STARTED_ICON_SMALL =
Tools.createImageIcon(Tools.getDefault(
"ServiceInfo.ServiceStartedIconSmall"));
/** Icon that indicates a stopping service (but not stopped). */
private static final ImageIcon SERVICE_STOPPING_ICON_SMALL =
Tools.createImageIcon(Tools.getDefault(
"ServiceInfo.ServiceStoppingIconSmall"));
/** Icon that indicates a not running service. */
public static final ImageIcon SERVICE_STOPPED_ICON_SMALL =
Tools.createImageIcon(Tools.getDefault(
"ServiceInfo.ServiceStoppedIconSmall"));
/** Icon that indicates a not running service that failed. */
private static final ImageIcon SERVICE_STOPPED_FAILED_ICON_SMALL =
Tools.createImageIcon(Tools.getDefault(
"ServiceInfo.ServiceStoppedFailedIconSmall"));
/** Running service icon. */
static final ImageIcon SERVICE_RUNNING_ICON =
Tools.createImageIcon(
Tools.getDefault("CRMGraph.ServiceRunningIcon"));
/** Not running service icon. */
private static final ImageIcon SERVICE_STOPPED_ICON =
Tools.createImageIcon(
Tools.getDefault("CRMGraph.ServiceStoppedIcon"));
/** Start service icon. */
static final ImageIcon START_ICON = SERVICE_RUNNING_ICON;
/** Stop service icon. */
static final ImageIcon STOP_ICON = SERVICE_STOPPED_ICON;
/** Migrate icon. */
protected static final ImageIcon MIGRATE_ICON = Tools.createImageIcon(
Tools.getDefault("CRMGraph.MigrateIcon"));
/** Unmigrate icon. */
static final ImageIcon UNMIGRATE_ICON = Tools.createImageIcon(
Tools.getDefault("CRMGraph.UnmigrateIcon"));
/** Group up icon. */
static final ImageIcon GROUP_UP_ICON = Tools.createImageIcon(
Tools.getDefault("CRMGraph.GroupUp"));
/** Group down icon. */
static final ImageIcon GROUP_DOWN_ICON = Tools.createImageIcon(
Tools.getDefault("CRMGraph.GroupDown"));
/** Orphaned subtext. */
private static final Subtext ORPHANED_SUBTEXT = new Subtext("(LRM)",
null,
Color.BLACK);
/** Orphaned with fail-count subtext. */
private static final Subtext ORPHANED_FAILED_SUBTEXT =
new Subtext("(ORPHANED)", null, Color.RED);
/** Unmanaged subtext. */
private static final Subtext UNMANAGED_SUBTEXT =
new Subtext("(unmanaged)", null, Color.RED);
/** Migrated subtext. */
private static final Subtext MIGRATED_SUBTEXT =
new Subtext("(migrated)", null, Color.RED);
/** Clone type string. */
protected static final String CLONE_TYPE_STRING = "Clone";
/** Primitive type string. */
private static final String PRIMITIVE_TYPE_STRING = "Primitive";
/** Gui ID parameter. */
public static final String GUI_ID = "__drbdmcid";
/** PCMK ID parameter. */
public static final String PCMK_ID = "__pckmkid";
/** String that appears as a tooltip in menu items if item is being
* removed. */
static final String IS_BEING_REMOVED_STRING = "it is being removed";
/** String that appears as a tooltip in menu items if item is orphan. */
static final String IS_ORPHANED_STRING = "cannot do that to an ophan";
/** String that appears as a tooltip in menu items if item is new. */
static final String IS_NEW_STRING = "it is not applied yet";
/** Ping attributes. */
private static final Map<String, String> PING_ATTRIBUTES =
new HashMap<String, String>();
static {
PING_ATTRIBUTES.put("eq0", "no ping: stop"); /* eq 0 */
PING_ATTRIBUTES.put("defined", "most connections");
}
/**
* Prepares a new <code>ServiceInfo</code> object and creates
* new service object.
*/
ServiceInfo(final String name,
final ResourceAgent resourceAgent,
final Browser browser) {
super(name, browser);
this.resourceAgent = resourceAgent;
if (resourceAgent != null && resourceAgent.isStonith()) {
setResource(new Service(name.replaceAll("/", "_")));
getService().setStonith(true);
} else {
setResource(new Service(name));
}
getService().setNew(true);
}
/**
* Prepares a new <code>ServiceInfo</code> object and creates
* new service object. It also initializes parameters along with
* heartbeat id with values from xml stored in resourceNode.
*/
ServiceInfo(final String name,
final ResourceAgent ra,
final String heartbeatId,
final Map<String, String> resourceNode,
final Browser browser) {
this(name, ra, browser);
getService().setHeartbeatId(heartbeatId);
/* TODO: cannot call setParameters here, only after it is
* constructed. */
setParameters(resourceNode);
}
/**
* Returns id of the service, which is heartbeatId.
* TODO: this id is used for stored position info, should be named
* differently.
*/
@Override
public String getId() {
return getService().getHeartbeatId();
}
/** Returns browser object of this info. */
@Override
protected ClusterBrowser getBrowser() {
return (ClusterBrowser) super.getBrowser();
}
/** Sets info panel of the service. */
public void setInfoPanel(final JPanel infoPanel) {
this.infoPanel = infoPanel;
}
/** Returns true if the node is active. */
boolean isOfflineNode(final String node) {
return "no".equals(getBrowser().getClusterStatus().isOnlineNode(node));
}
/**
* Returns whether all the parameters are correct. If param is null,
* all paremeters will be checked, otherwise only the param, but other
* parameters will be checked only in the cache. This is good if only
* one value is changed and we don't want to check everything.
*/
@Override
boolean checkResourceFieldsCorrect(final String param,
final String[] params) {
return checkResourceFieldsCorrect(param, params, false, false, false);
}
/**
* Returns whether all the parameters are correct. If param is null,
* all paremeters will be checked, otherwise only the param, but other
* parameters will be checked only in the cache. This is good if only
* one value is changed and we don't want to check everything.
*/
boolean checkResourceFieldsCorrect(final String param,
final String[] params,
final boolean fromServicesInfo,
final boolean fromCloneInfo,
final boolean fromGroupInfo) {
if (getComboBoxValue(GUI_ID) == null) {
return true;
}
final CloneInfo ci = getCloneInfo();
if (!fromCloneInfo && ci != null) {
return ci.checkResourceFieldsCorrect(param,
ci.getParametersFromXML(),
fromServicesInfo);
}
final GroupInfo gi = getGroupInfo();
if (!fromGroupInfo && gi != null) {
if (!gi.checkResourceFieldsCorrect(param,
gi.getParametersFromXML(),
fromServicesInfo,
fromCloneInfo)) {
return false;
}
}
if (!fromGroupInfo && gi != null) {
if (!fromServicesInfo) {
gi.setApplyButtons(null, gi.getParametersFromXML());
}
}
if (getService().isOrphaned()) {
return false;
}
/* Allow it only for resources that are in LRM. */
final String id = getComboBoxValue(GUI_ID);
final ServiceInfo si =
getBrowser().getServiceInfoFromId(getService().getName(), id);
if (si != null && si != this && !si.getService().isOrphaned()) {
return false;
}
if (!super.checkResourceFieldsCorrect(param, params)) {
return false;
}
if (ci == null) {
boolean on = false;
for (Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
/* at least one "eq" */
final Widget wi = scoreComboBoxHash.get(hi);
if (wi != null) {
final JLabel label = wi.getLabel();
if (label != null) {
final String op = getOpFromLabel(hi.getName(),
label.getText());
if (wi.getValue() == null || "eq".equals(op)) {
on = true;
break;
}
}
}
}
if (!on) {
return false;
}
}
return true;
}
/**
* Returns whether the specified parameter or any of the parameters
* have changed. If param is null, only param will be checked,
* otherwise all parameters will be checked.
*/
@Override
public boolean checkResourceFieldsChanged(final String param,
final String[] params) {
return checkResourceFieldsChanged(param, params, false, false, false);
}
/**
* Returns whether the specified parameter or any of the parameters
* have changed. If param is null, only param will be checked,
* otherwise all parameters will be checked.
*/
public boolean checkResourceFieldsChanged(final String param,
final String[] params,
final boolean fromServicesInfo,
final boolean fromCloneInfo,
final boolean fromGroupInfo) {
final String id = getComboBoxValue(GUI_ID);
final CloneInfo ci = getCloneInfo();
if (!fromCloneInfo && ci != null) {
return ci.checkResourceFieldsChanged(param,
ci.getParametersFromXML(),
fromServicesInfo);
}
final GroupInfo gi = getGroupInfo();
if (!fromGroupInfo && gi != null) {
if (!fromServicesInfo) {
gi.setApplyButtons(null, gi.getParametersFromXML());
}
}
if (id == null) {
return false;
}
boolean changed = false;
if (super.checkResourceFieldsChanged(param, params)) {
changed = true;
}
boolean allMetaAttrsAreDefaultValues = true;
if (params != null) {
for (String otherParam : params) {
if (isMetaAttr(otherParam)) {
final Widget wi = getWidget(otherParam, null);
if (wi == null) {
continue;
}
final Object newValue = wi.getValue();
final Object defaultValue = getParamDefault(otherParam);
if (!Tools.areEqual(newValue, defaultValue)) {
allMetaAttrsAreDefaultValues = false;
}
}
}
}
final String heartbeatId = getService().getHeartbeatId();
if (ConfigData.PM_GROUP_NAME.equals(getName())) {
if (heartbeatId == null) {
changed = true;
} else if (heartbeatId.equals(Service.GRP_ID_PREFIX + id)
|| heartbeatId.equals(id)) {
if (checkHostLocationsFieldsChanged()
|| checkOperationFieldsChanged()) {
changed = true;
}
} else {
changed = true;
}
} else if (ConfigData.PM_CLONE_SET_NAME.equals(getName())
|| ConfigData.PM_MASTER_SLAVE_SET_NAME.equals(getName())) {
String prefix;
if (getService().isMaster()) {
prefix = Service.MS_ID_PREFIX;
} else {
prefix = Service.CL_ID_PREFIX;
}
if (heartbeatId.equals(prefix + id)
|| heartbeatId.equals(id)) {
if (checkHostLocationsFieldsChanged()) {
changed = true;
}
} else {
changed = true;
}
} else {
if (heartbeatId == null) {
} else if (heartbeatId.equals(Service.RES_ID_PREFIX
+ getService().getName()
+ "_" + id)
|| heartbeatId.equals(Service.STONITH_ID_PREFIX
+ getService().getName()
+ "_" + id)
|| heartbeatId.equals(id)) {
if (checkHostLocationsFieldsChanged()
|| checkOperationFieldsChanged()) {
changed = true;
}
} else {
changed = true;
}
}
final String cl = getService().getResourceClass();
if (cl != null && (cl.equals(ResourceAgent.HEARTBEAT_CLASS)
|| ResourceAgent.SERVICE_CLASSES.contains(cl))) {
/* in old style resources don't show all the textfields */
boolean visible = false;
Widget wi = null;
for (int i = params.length - 1; i >= 0; i--) {
final Widget prevWi = getWidget(params[i], null);
if (prevWi == null) {
continue;
}
if (!visible && !prevWi.getStringValue().equals("")) {
visible = true;
}
if (wi != null && wi.isVisible() != visible) {
final boolean v = visible;
final Widget c = wi;
c.setVisible(v);
}
wi = prevWi;
}
}
/* id-refs */
if (sameAsMetaAttrsWi != null) {
final Info info = sameAsMetaAttrsWiValue();
final boolean defaultValues =
info != null
&& META_ATTRS_DEFAULT_VALUES_TEXT.equals(info.toString());
final boolean nothingSelected =
info == null
|| Widget.NOTHING_SELECTED_DISPLAY.equals(
info.toString());
if (!nothingSelected
&& !defaultValues
&& info != savedMetaAttrInfoRef) {
changed = true;
} else {
if ((nothingSelected || defaultValues)
&& savedMetaAttrInfoRef != null) {
changed = true;
}
if (savedMetaAttrInfoRef == null
&& defaultValues != allMetaAttrsAreDefaultValues) {
if (allMetaAttrsAreDefaultValues) {
sameAsMetaAttrsWi.setValueNoListeners(
META_ATTRS_DEFAULT_VALUES_TEXT);
} else {
sameAsMetaAttrsWi.setValueNoListeners(
Widget.NOTHING_SELECTED_INTERNAL);
}
}
}
sameAsMetaAttrsWi.processAccessMode();
}
if (!fromServicesInfo) {
final ServicesInfo sis = getBrowser().getServicesInfo();
sis.setApplyButtons(null, sis.getParametersFromXML());
}
return changed;
}
/** Returns operation default for parameter. */
private String getOpDefaultsDefault(final String param) {
assert param != null;
/* if op_defaults is set... It cannot be set in the GUI */
final ClusterStatus cs = getBrowser().getClusterStatus();
if (cs != null) {
return cs.getOpDefaultsValuePairs().get(param);
}
return null;
}
/** Sets service parameters with values from resourceNode hash. */
void setParameters(final Map<String, String> resourceNode) {
if (resourceNode == null) {
return;
}
final boolean infoPanelOk = isInfoPanelOk();
final CRMXML crmXML = getBrowser().getCRMXML();
if (crmXML == null) {
Tools.appError("crmXML is null");
return;
}
/* Attributes */
final String[] params = getEnabledSectionParams(
crmXML.getParameters(resourceAgent,
getService().isMaster()));
final ClusterStatus cs = getBrowser().getClusterStatus();
if (params != null) {
boolean allMetaAttrsAreDefaultValues = true;
boolean allSavedMetaAttrsAreDefaultValues = true;
final String newMetaAttrsId = cs.getMetaAttrsId(
getService().getHeartbeatId());
if ((savedMetaAttrsId == null && newMetaAttrsId != null)
|| (savedMetaAttrsId != null
&& !savedMetaAttrsId.equals(newMetaAttrsId))) {
/* newly generated operations id, reload all other combo
boxes. */
getBrowser().reloadAllComboBoxes(this);
}
savedMetaAttrsId = newMetaAttrsId;
String refCRMId = cs.getMetaAttrsRef(getService().getHeartbeatId());
final ServiceInfo metaAttrInfoRef =
getBrowser().getServiceInfoFromCRMId(refCRMId);
if (refCRMId == null) {
refCRMId = getService().getHeartbeatId();
}
resourceNode.put(PCMK_ID, getService().getHeartbeatId());
resourceNode.put(GUI_ID, getService().getId());
for (String param : params) {
String value;
if (isMetaAttr(param) && refCRMId != null) {
value = cs.getParameter(refCRMId, param, false);
} else {
value = resourceNode.get(param);
}
final String defaultValue = getParamDefault(param);
if (value == null) {
value = defaultValue;
}
if (value == null) {
value = "";
}
final String oldValue = getResource().getValue(param);
if (isMetaAttr(param)) {
if (!Tools.areEqual(defaultValue, value)) {
allMetaAttrsAreDefaultValues = false;
}
if (!Tools.areEqual(defaultValue, oldValue)) {
allSavedMetaAttrsAreDefaultValues = false;
}
}
if (infoPanelOk) {
final Widget wi = getWidget(param, null);
final boolean haveChanged =
!Tools.areEqual(value, oldValue)
|| !Tools.areEqual(defaultValue,
getResource().getDefaultValue(param));
if (haveChanged
|| (metaAttrInfoRef != null && isMetaAttr(param))) {
getResource().setValue(param, value);
/* set default value, because it can change in
* rsc_defaults. */
getResource().setDefaultValue(param, defaultValue);
if (wi != null && metaAttrInfoRef == null) {
wi.setValue(value);
}
}
}
}
if (!Tools.areEqual(metaAttrInfoRef, savedMetaAttrInfoRef)) {
savedMetaAttrInfoRef = metaAttrInfoRef;
if (sameAsMetaAttrsWi != null) {
if (metaAttrInfoRef == null) {
if (allMetaAttrsAreDefaultValues) {
if (!allSavedMetaAttrsAreDefaultValues) {
sameAsMetaAttrsWi.setValue(
META_ATTRS_DEFAULT_VALUES_TEXT);
}
} else {
if (metaAttrInfoRef != null) {
sameAsMetaAttrsWi.setValue(
Widget.NOTHING_SELECTED_INTERNAL);
}
}
} else {
sameAsMetaAttrsWi.setValue(metaAttrInfoRef);
}
}
}
}
/* set scores */
for (Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
final HostLocation hostLocation = cs.getScore(
getService().getHeartbeatId(),
hi.getName(),
false);
final HostLocation savedLocation = savedHostLocations.get(hi);
if (!Tools.areEqual(hostLocation, savedLocation)) {
if (hostLocation == null) {
savedHostLocations.remove(hi);
} else {
savedHostLocations.put(hi, hostLocation);
}
if (infoPanelOk) {
final Widget wi = scoreComboBoxHash.get(hi);
if (wi != null) {
String score = null;
String op = null;
if (hostLocation != null) {
score = hostLocation.getScore();
op = hostLocation.getOperation();
}
wi.setValue(score);
final JLabel label = wi.getLabel();
final String text =
getHostLocationLabel(hi.getName(), op);
label.setText(text);
}
}
}
}
/* set ping constraint */
final HostLocation hostLocation = cs.getPingScore(
getService().getHeartbeatId(),
false);
String pingOperation = null;
if (hostLocation != null) {
final String op = hostLocation.getOperation();
final String value = hostLocation.getValue();
if ("eq".equals(op) && "0".equals(value)) {
pingOperation = "eq0";
} else {
pingOperation = hostLocation.getOperation();
}
}
if (!Tools.areEqual(pingOperation, savedPingOperation)) {
savedPingOperation = pingOperation;
}
if (infoPanelOk) {
final Widget wi = pingComboBox;
if (wi != null) {
if (pingOperation == null) {
wi.setValue(Widget.NOTHING_SELECTED_INTERNAL);
} else {
wi.setValue(PING_ATTRIBUTES.get(pingOperation));
}
}
}
boolean allAreDefaultValues = true;
boolean allSavedAreDefaultValues = true;
/* Operations */
final String newOperationsId = cs.getOperationsId(
getService().getHeartbeatId());
if ((savedOperationsId == null && newOperationsId != null)
|| (savedOperationsId != null
&& !savedOperationsId.equals(newOperationsId))) {
/* newly generated operations id, reload all other combo
boxes. */
getBrowser().reloadAllComboBoxes(this);
}
savedOperationsId = newOperationsId;
String refCRMId = cs.getOperationsRef(getService().getHeartbeatId());
final ServiceInfo operationIdRef =
getBrowser().getServiceInfoFromCRMId(refCRMId);
if (refCRMId == null) {
refCRMId = getService().getHeartbeatId();
}
mSavedOperationsLock.lock();
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param
: getBrowser().getCRMOperationParams(op)) {
String defaultValue =
resourceAgent.getOperationDefault(op, param);
if (defaultValue == null) {
continue;
}
if (ClusterBrowser.HB_OP_IGNORE_DEFAULT.contains(op)) {
defaultValue = "";
}
String value = cs.getOperation(refCRMId, op, param);
if (value == null || "".equals(value)) {
value = getOpDefaultsDefault(param);
}
if (value == null) {
value = "";
}
if (!defaultValue.equals(value)) {
allAreDefaultValues = false;
}
if (!defaultValue.equals(savedOperation.get(op, param))) {
allSavedAreDefaultValues = false;
}
}
}
boolean sameAs = false;
if (!Tools.areEqual(operationIdRef, savedOperationIdRef)) {
savedOperationIdRef = operationIdRef;
if (sameAsOperationsWi != null) {
if (operationIdRef == null) {
if (allAreDefaultValues) { // TODO: don't have it yet.
if (!allSavedAreDefaultValues) {
sameAsOperationsWi.setValue(
OPERATIONS_DEFAULT_VALUES_TEXT);
}
} else {
if (savedOperationIdRef != null) {
sameAsOperationsWi.setValue(
Widget.NOTHING_SELECTED_INTERNAL);
}
}
} else {
sameAs = false;
sameAsOperationsWi.setValue(operationIdRef);
}
}
}
if (!sameAs) {
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param
: getBrowser().getCRMOperationParams(op)) {
String defaultValue =
resourceAgent.getOperationDefault(op, param);
if (defaultValue == null) {
continue;
}
if (ClusterBrowser.HB_OP_IGNORE_DEFAULT.contains(op)) {
defaultValue = "";
}
String value = cs.getOperation(refCRMId, op, param);
if (value == null || "".equals(value)) {
value = getOpDefaultsDefault(param);
}
if (value == null) {
value = "";
}
if (!value.equals(savedOperation.get(op, param))) {
savedOperation.put(op, param, value);
if (infoPanelOk) {
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op,
param);
mOperationsComboBoxHashReadLock.unlock();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
wi.setEnabled(operationIdRef == null);
}
});
if (value != null) {
wi.setValue(value);
}
}
}
}
}
}
mSavedOperationsLock.unlock();
getService().setAvailable();
if (cs.isOrphaned(getHeartbeatId(false))) {
getService().setOrphaned(true);
getService().setNew(false);
final CloneInfo ci = getCloneInfo();
if (ci != null) {
ci.getService().setNew(false);
}
} else {
getService().setOrphaned(false);
}
}
/** Returns name of this resource, that is used in logs. */
String getNameForLog() {
return getName();
}
/**
* Returns a name of the service with id in the parentheses.
* It adds prefix 'new' if id is null.
*/
@Override
public String toString() {
final StringBuilder s = new StringBuilder(30);
final String provider = resourceAgent.getProvider();
if (!ResourceAgent.HEARTBEAT_PROVIDER.equals(provider)
&& !"".equals(provider)) {
s.append(provider);
s.append(':');
}
s.append(getName());
final String string = getService().getId();
/* 'string' contains the last string if there are more dependent
* resources, although there is usually only one. */
if (string == null) {
s.insert(0, "new ");
} else {
if (!"".equals(string)) {
s.append(" (");
s.append(string);
s.append(')');
}
}
return s.toString();
}
/** Returns node name of the host where this service is running. */
List<String> getMasterOnNodes(final boolean testOnly) {
return getBrowser().getClusterStatus().getMasterOnNodes(
getHeartbeatId(testOnly),
testOnly);
}
/** Returns node name of the host where this service is running. */
List<String> getRunningOnNodes(final boolean testOnly) {
return getBrowser().getClusterStatus().getRunningOnNodes(
getHeartbeatId(testOnly),
testOnly);
}
/** Returns whether service is started. */
boolean isStarted(final boolean testOnly) {
final Host dcHost = getBrowser().getDCHost();
final String hbV = dcHost.getHeartbeatVersion();
final String pmV = dcHost.getPacemakerVersion();
String targetRoleString = "target-role";
if (Tools.versionBeforePacemaker(dcHost)) {
targetRoleString = "target_role";
}
String crmId = getHeartbeatId(testOnly);
final ClusterStatus cs = getBrowser().getClusterStatus();
final String refCRMId = cs.getMetaAttrsRef(crmId);
if (refCRMId != null) {
crmId = refCRMId;
}
String targetRole = cs.getParameter(crmId, targetRoleString, testOnly);
if (targetRole == null) {
targetRole = getParamDefault(targetRoleString);
}
if (!CRMXML.TARGET_ROLE_STOPPED.equals(targetRole)) {
return true;
}
return false;
}
/** Returns whether the service was set to be in slave role. */
public boolean isEnslaved(final boolean testOnly) {
final Host dcHost = getBrowser().getDCHost();
String targetRoleString = "target-role";
if (Tools.versionBeforePacemaker(dcHost)) {
targetRoleString = "target_role";
}
String crmId = getHeartbeatId(testOnly);
final ClusterStatus cs = getBrowser().getClusterStatus();
final String refCRMId = cs.getMetaAttrsRef(crmId);
if (refCRMId != null) {
crmId = refCRMId;
}
String targetRole = cs.getParameter(crmId, targetRoleString, testOnly);
if (targetRole == null) {
targetRole = getParamDefault(targetRoleString);
}
if (CRMXML.TARGET_ROLE_SLAVE.equals(targetRole)) {
return true;
}
return false;
}
/** Returns whether service is stopped. */
public boolean isStopped(final boolean testOnly) {
final Host dcHost = getBrowser().getDCHost();
String targetRoleString = "target-role";
if (Tools.versionBeforePacemaker(dcHost)) {
targetRoleString = "target_role";
}
String crmId = getHeartbeatId(testOnly);
final ClusterStatus cs = getBrowser().getClusterStatus();
final String refCRMId = cs.getMetaAttrsRef(crmId);
if (refCRMId != null) {
crmId = refCRMId;
}
String targetRole = cs.getParameter(crmId, targetRoleString, testOnly);
if (targetRole == null) {
targetRole = getParamDefault(targetRoleString);
}
if (CRMXML.TARGET_ROLE_STOPPED.equals(targetRole)) {
return true;
}
return false;
}
/** Returns whether the group is stopped. */
boolean isGroupStopped(final boolean testOnly) {
return false;
}
/**
* Returns whether service is managed.
* TODO: "default" value
*/
public boolean isManaged(final boolean testOnly) {
return getBrowser().getClusterStatus().isManaged(
getHeartbeatId(testOnly),
testOnly);
}
/** Returns whether the service where was migrated or null. */
public List<Host> getMigratedTo(final boolean testOnly) {
final ClusterStatus cs = getBrowser().getClusterStatus();
for (Host host : getBrowser().getClusterHosts()) {
final String locationId = cs.getLocationId(getHeartbeatId(testOnly),
host.getName(),
testOnly);
if (locationId == null
|| (!locationId.startsWith("cli-prefer-")
&& !locationId.startsWith("cli-standby-"))) {
continue;
}
final HostInfo hi = host.getBrowser().getHostInfo();
final HostLocation hostLocation = cs.getScore(
getHeartbeatId(testOnly),
hi.getName(),
testOnly);
String score = null;
String op = null;
if (hostLocation != null) {
score = hostLocation.getScore();
op = hostLocation.getOperation();
}
if ((CRMXML.INFINITY_STRING.equals(score)
|| CRMXML.PLUS_INFINITY_STRING.equals(score))
&& "eq".equals(op)) {
final List<Host> hosts = new ArrayList<Host>();
hosts.add(host);
return hosts;
}
}
return null;
}
/** Returns whether the service where was migrated or null. */
public List<Host> getMigratedFrom(final boolean testOnly) {
final ClusterStatus cs = getBrowser().getClusterStatus();
for (Host host : getBrowser().getClusterHosts()) {
final String locationId = cs.getLocationId(getHeartbeatId(testOnly),
host.getName(),
testOnly);
if (locationId == null
|| (!locationId.startsWith("cli-prefer-")
&& !locationId.startsWith("cli-standby-"))) {
continue;
}
final HostInfo hi = host.getBrowser().getHostInfo();
final HostLocation hostLocation = cs.getScore(
getHeartbeatId(testOnly),
hi.getName(),
testOnly);
String score = null;
String op = null;
if (hostLocation != null) {
score = hostLocation.getScore();
op = hostLocation.getOperation();
}
if (CRMXML.MINUS_INFINITY_STRING.equals(score)
&& "eq".equals(op)) {
final List<Host> hosts = new ArrayList<Host>();
hosts.add(host);
return hosts;
}
}
return null;
}
/** Returns whether the service is running. */
public boolean isRunning(final boolean testOnly) {
final List<String> runningOnNodes = getRunningOnNodes(testOnly);
return runningOnNodes != null && !runningOnNodes.isEmpty();
}
/** Returns fail count string that appears in the graph. */
private String getFailCountString(final String hostName,
final boolean testOnly) {
String fcString = "";
final String failCount = getFailCount(hostName, testOnly);
if (failCount != null) {
if (CRMXML.INFINITY_STRING.equals(failCount)) {
fcString = " failed";
} else {
fcString = " failed: " + failCount;
}
}
return fcString;
}
/** Returns fail count. */
protected String getFailCount(final String hostName,
final boolean testOnly) {
final ClusterStatus cs = getBrowser().getClusterStatus();
return cs.getFailCount(hostName, getHeartbeatId(testOnly), testOnly);
}
/** Returns ping count. */
protected String getPingCount(final String hostName,
final boolean testOnly) {
final ClusterStatus cs = getBrowser().getClusterStatus();
return cs.getPingCount(hostName, testOnly);
}
/** Returns fail ping string that appears in the graph. */
protected String getPingCountString(final String hostName,
final boolean testOnly) {
if (!resourceAgent.isPingService()) {
return "";
}
final String pingCount = getPingCount(hostName, testOnly);
if (pingCount == null || "0".equals(pingCount)) {
return " / no ping";
} else {
return " / ping: " + pingCount;
}
}
/** Returns whether the resource is orphaned on the specified host. */
protected final boolean isInLRMOnHost(final String hostName,
final boolean testOnly) {
final ClusterStatus cs = getBrowser().getClusterStatus();
return cs.isInLRMOnHost(hostName, getHeartbeatId(testOnly), testOnly);
}
/** Returns whether the resource failed on the specified host. */
protected final boolean failedOnHost(final String hostName,
final boolean testOnly) {
final String failCount = getFailCount(hostName,
testOnly);
return failCount != null
&& CRMXML.INFINITY_STRING.equals(failCount);
}
/** Returns whether the resource has failed to start. */
public boolean isFailed(final boolean testOnly) {
if (isRunning(testOnly)) {
return false;
}
for (final Host host : getBrowser().getClusterHosts()) {
if (host.isClStatus() && failedOnHost(host.getName(),
testOnly)) {
return true;
}
}
return false;
}
/** Returns whether the resource has failed on one of the nodes. */
boolean isOneFailed(final boolean testOnly) {
for (final Host host : getBrowser().getClusterHosts()) {
if (failedOnHost(host.getName(), testOnly)) {
return true;
}
}
return false;
}
/** Returns whether the resource has fail-count on one of the nodes. */
boolean isOneFailedCount(final boolean testOnly) {
for (final Host host : getBrowser().getClusterHosts()) {
if (getFailCount(host.getName(), testOnly) != null) {
return true;
}
}
return false;
}
/** Sets whether the service is managed. */
void setManaged(final boolean isManaged,
final Host dcHost,
final boolean testOnly) {
if (!testOnly) {
setUpdated(true);
}
CRM.setManaged(dcHost, getHeartbeatId(testOnly), isManaged, testOnly);
}
/** Returns color for the host vertex. */
public List<Color> getHostColors(final boolean testOnly) {
return getBrowser().getCluster().getHostColors(
getRunningOnNodes(testOnly));
}
/**
* Returns service icon in the menu. It can be started or stopped.
* TODO: broken icon, not managed icon.
*/
@Override
public ImageIcon getMenuIcon(final boolean testOnly) {
if (isFailed(testOnly)) {
if (isRunning(testOnly)) {
return SERVICE_RUNNING_FAILED_ICON_SMALL;
} else {
return SERVICE_STOPPED_FAILED_ICON_SMALL;
}
} else if (isStopped(testOnly) || getBrowser().allHostsDown()) {
if (isRunning(testOnly)) {
return SERVICE_STOPPING_ICON_SMALL;
} else {
return SERVICE_STOPPED_ICON_SMALL;
}
} else {
if (isRunning(testOnly)) {
return SERVICE_RUNNING_ICON_SMALL;
} else {
return SERVICE_STARTED_ICON_SMALL;
}
}
}
/** Gets saved host scores. */
Map<HostInfo, HostLocation> getSavedHostLocations() {
return savedHostLocations;
}
/** Returns list of all host names in this cluster. */
List<String> getHostNames() {
final List<String> hostNames = new ArrayList<String>();
@SuppressWarnings("unchecked")
final Enumeration<DefaultMutableTreeNode> e =
getBrowser().getClusterHostsNode().children();
while (e.hasMoreElements()) {
final DefaultMutableTreeNode n = e.nextElement();
final String hostName = ((HostInfo) n.getUserObject()).getName();
hostNames.add(hostName);
}
return hostNames;
}
/**
* TODO: wrong doku
* Converts enumeration to the info array, get objects from
* hash if they exist.
*/
protected Info[] enumToInfoArray(
final Info defaultValue,
final String serviceName,
final Enumeration<DefaultMutableTreeNode> e) {
final List<Info> list = new ArrayList<Info>();
if (defaultValue != null) {
list.add(defaultValue);
}
while (e.hasMoreElements()) {
final DefaultMutableTreeNode n = e.nextElement();
final Info i = (Info) n.getUserObject();
final String name = i.getName();
final ServiceInfo si = getBrowser().getServiceInfoFromId(
serviceName,
i.getName());
if (si == null && !name.equals(defaultValue)) {
list.add(i);
}
}
return list.toArray(new Info[list.size()]);
}
/**
* Stores scores for host.
*/
private void storeHostLocations() {
savedHostLocations.clear();
for (final Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
final Widget wi = scoreComboBoxHash.get(hi);
final String score = wi.getStringValue();
final String op = getOpFromLabel(hi.getName(),
wi.getLabel().getText());
if (score == null || "".equals(score)) {
savedHostLocations.remove(hi);
} else {
savedHostLocations.put(hi,
new HostLocation(score, op, null, null));
}
}
/* ping */
final Object o = pingComboBox.getValue();
String value = null;
if (o != null) {
value = ((StringInfo) o).getInternalValue();
}
savedPingOperation = value;
}
/**
* Returns thrue if an operation field changed.
*/
private boolean checkOperationFieldsChanged() {
boolean changed = false;
boolean allAreDefaultValues = true;
mSavedOperationsLock.lock();
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param : getBrowser().getCRMOperationParams(op)) {
String defaultValue =
resourceAgent.getOperationDefault(op, param);
if (defaultValue == null) {
continue;
}
if (ClusterBrowser.HB_OP_IGNORE_DEFAULT.contains(op)) {
defaultValue = "";
}
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op, param);
mOperationsComboBoxHashReadLock.unlock();
if (wi == null) {
continue;
}
if (CRMXML.PAR_CHECK_LEVEL.equals(param)) {
final Object value = wi.getValue();
if (!Tools.areEqual(value, defaultValue)) {
allAreDefaultValues = false;
}
final String savedOp = savedOperation.get(op, param);
if (savedOp == null) {
if (!Tools.areEqual(value, defaultValue)) {
changed = true;
}
} else if (!Tools.areEqual(value, savedOp)) {
changed = true;
}
wi.setBackground(defaultValue, savedOp, false);
} else {
final Object[] defaultValueE =
Tools.extractUnit(defaultValue);
Object value = wi.getValue();
if (Tools.areEqual(value, new Object[]{"", ""})) {
value = new Object[]{getOpDefaultsDefault(param), null};
}
if (!Tools.areEqual(value, defaultValueE)) {
allAreDefaultValues = false;
}
final String savedOp = savedOperation.get(op, param);
final Object[] savedOpE = Tools.extractUnit(savedOp);
if (savedOp == null) {
if (!Tools.areEqual(value, defaultValueE)) {
changed = true;
}
} else if (!Tools.areEqual(value, savedOpE)) {
changed = true;
}
wi.setBackground(defaultValueE, savedOpE, false);
}
}
}
if (sameAsOperationsWi != null) {
final Info info = sameAsOperationsWiValue();
final boolean defaultValues =
info != null
&& OPERATIONS_DEFAULT_VALUES_TEXT.equals(info.toString());
final boolean nothingSelected =
info == null
|| Widget.NOTHING_SELECTED_DISPLAY.equals(
info.toString());
if (!nothingSelected
&& !defaultValues
&& info != savedOperationIdRef) {
changed = true;
} else {
if ((nothingSelected || defaultValues)
&& savedOperationIdRef != null) {
changed = true;
}
if (savedOperationIdRef == null
&& defaultValues != allAreDefaultValues) {
if (allAreDefaultValues) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
sameAsOperationsWi.setValueNoListeners(
OPERATIONS_DEFAULT_VALUES_TEXT);
}
});
} else {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
sameAsOperationsWi.setValueNoListeners(
Widget.NOTHING_SELECTED_INTERNAL);
}
});
}
}
}
sameAsOperationsWi.processAccessMode();
}
mSavedOperationsLock.unlock();
return changed;
}
/**
* Returns true if some of the scores have changed.
*/
private boolean checkHostLocationsFieldsChanged() {
boolean changed = false;
for (Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
final Widget wi = scoreComboBoxHash.get(hi);
final HostLocation hlSaved = savedHostLocations.get(hi);
String hsSaved = null;
String opSaved = null;
if (hlSaved != null) {
hsSaved = hlSaved.getScore();
opSaved = hlSaved.getOperation();
}
final String opSavedLabel = getHostLocationLabel(host.getName(),
opSaved);
if (wi == null) {
continue;
}
String labelText = null;
if (wi.getLabel() != null) {
labelText = wi.getLabel().getText();
}
if (!Tools.areEqual(hsSaved, wi.getStringValue())
|| (!Tools.areEqual(opSavedLabel, labelText)
&& (hsSaved != null && !"".equals(hsSaved)))) {
changed = true;
}
wi.setBackground(getHostLocationLabel(host.getName(), "eq"),
null,
opSavedLabel,
hsSaved,
false);
}
/* ping */
final Widget pwi = pingComboBox;
if (pwi != null) {
if (!Tools.areEqual(savedPingOperation,
pwi.getValue())) {
changed = true;
}
pwi.setBackground(null,
savedPingOperation,
false);
}
return changed;
}
/**
* Returns the list of all services, that can be used in the 'add
* service' action.
*/
List<ResourceAgent> getAddServiceList(final String cl) {
return getBrowser().globalGetAddServiceList(cl);
}
/**
* Returns info object of all block devices on all hosts that have the
* same names and other attributes.
*/
Info[] getCommonBlockDevInfos(final Info defaultValue,
final String serviceName) {
final List<Info> list = new ArrayList<Info>();
/* drbd resources */
@SuppressWarnings("unchecked")
final Enumeration<DefaultMutableTreeNode> drbdResources =
getBrowser().getDrbdNode().children();
if (defaultValue != null) {
list.add(defaultValue);
}
while (drbdResources.hasMoreElements()) {
final DefaultMutableTreeNode n = drbdResources.nextElement();
final DrbdResourceInfo drbdRes =
(DrbdResourceInfo) n.getUserObject();
final DefaultMutableTreeNode drbdResNode = drbdRes.getNode();
if (drbdResNode != null) {
@SuppressWarnings("unchecked")
final Enumeration<DefaultMutableTreeNode> drbdVolumes =
drbdResNode.children();
while (drbdVolumes.hasMoreElements()) {
final DefaultMutableTreeNode vn = drbdVolumes.nextElement();
final CommonDeviceInterface drbdVol =
(CommonDeviceInterface) vn.getUserObject();
list.add((Info) drbdVol);
}
}
}
/* block devices that are the same on all hosts */
@SuppressWarnings("unchecked")
final Enumeration<DefaultMutableTreeNode> wids =
getBrowser().getCommonBlockDevicesNode().children();
while (wids.hasMoreElements()) {
final DefaultMutableTreeNode n = wids.nextElement();
final CommonDeviceInterface wid =
(CommonDeviceInterface) n.getUserObject();
list.add((Info) wid);
}
return list.toArray(new Info[list.size()]);
}
/**
* Adds clone fields to the option pane.
*/
protected void addCloneFields(final JPanel optionsPanel,
final int leftWidth,
final int rightWidth) {
final CloneInfo ci = getCloneInfo();
final String[] params = ci.getParametersFromXML();
final Info savedMAIdRef = ci.getSavedMetaAttrInfoRef();
ci.getResource().setValue(GUI_ID, ci.getService().getId());
ci.addParams(optionsPanel,
params,
ClusterBrowser.SERVICE_LABEL_WIDTH,
ClusterBrowser.SERVICE_FIELD_WIDTH,
ci.getSameAsFields(savedMAIdRef));
if (!ci.getService().isNew()) {
ci.getWidget(GUI_ID, null).setEnabled(false);
}
for (final String param : params) {
if (ci.isMetaAttr(param)) {
final Widget wi = ci.getWidget(param, null);
wi.setEnabled(savedMAIdRef == null);
}
}
ci.addHostLocations(optionsPanel,
ClusterBrowser.SERVICE_LABEL_WIDTH,
ClusterBrowser.SERVICE_FIELD_WIDTH);
}
/**
* Returns label for host locations, which consist of host name and
* operation.
*/
private String getHostLocationLabel(final String hostName,
final String op) {
final StringBuilder sb = new StringBuilder(20);
if (op == null || "eq".equals(op)) {
sb.append("on ");
} else if ("ne".equals(op)) {
sb.append("NOT on ");
} else {
sb.append(op);
sb.append(' ');
}
sb.append(hostName);
return sb.toString();
}
/**
* Creates host score combo boxes with labels, one per host.
*/
protected void addHostLocations(final JPanel optionsPanel,
final int leftWidth,
final int rightWidth) {
int rows = 0;
final JPanel panel =
getParamPanel(Tools.getString("ClusterBrowser.HostLocations"));
panel.setLayout(new SpringLayout());
for (final Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
final Map<String, String> abbreviations =
new HashMap<String, String>();
abbreviations.put("i", CRMXML.INFINITY_STRING);
abbreviations.put("+", CRMXML.PLUS_INFINITY_STRING);
abbreviations.put("I", CRMXML.INFINITY_STRING);
abbreviations.put("a", "ALWAYS");
abbreviations.put("n", "NEVER");
final Widget wi = WidgetFactory.createInstance(
Widget.Type.COMBOBOX,
null,
new String[]{null,
"0",
"2",
"ALWAYS",
"NEVER",
CRMXML.INFINITY_STRING,
CRMXML.MINUS_INFINITY_STRING,
CRMXML.INFINITY_STRING},
"^((-?\\d*|(-|\\+)?" + CRMXML.INFINITY_STRING
+ "))|ALWAYS|NEVER|@NOTHING_SELECTED@$",
rightWidth,
abbreviations,
new AccessMode(ConfigData.AccessType.ADMIN,
false),
Widget.NO_BUTTON);
wi.setEditable(true);
final Widget prevWi = scoreComboBoxHash.get(hi);
scoreComboBoxHash.put(hi, wi);
/* set selected host scores in the combo box from
* savedHostLocations */
if (prevWi == null) {
final HostLocation hl = savedHostLocations.get(hi);
String hsSaved = null;
if (hl != null) {
hsSaved = hl.getScore();
}
wi.setValue(hsSaved);
} else {
wi.setValue(prevWi.getValue());
}
}
/* host score combo boxes */
for (Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
final Widget wi = scoreComboBoxHash.get(hi);
String op = null;
final HostLocation hl = savedHostLocations.get(hi);
if (hl != null) {
op = hl.getOperation();
}
final String text = getHostLocationLabel(hi.getName(), op);
final JLabel label = new JLabel(text);
final String onText = getHostLocationLabel(hi.getName(), "eq");
final String notOnText = getHostLocationLabel(hi.getName(), "ne");
label.addMouseListener(new MouseListener() {
@Override
public final void mouseClicked(final MouseEvent e) {
/* do nothing */
}
@Override
public final void mouseEntered(final MouseEvent e) {
/* do nothing */
}
@Override
public final void mouseExited(final MouseEvent e) {
/* do nothing */
}
@Override
public final void mousePressed(final MouseEvent e) {
final String currentText = label.getText();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (currentText.equals(onText)) {
label.setText(notOnText);
} else if (currentText.equals(notOnText)) {
label.setText(onText);
} else {
/* wierd things */
label.setText(onText);
}
final String[] params = getParametersFromXML();
setApplyButtons(CACHED_FIELD, params);
}
});
}
@Override
public final void mouseReleased(final MouseEvent e) {
/* do nothing */
}
});
wi.setLabel(label, text);
addField(panel,
label,
wi,
leftWidth,
rightWidth,
0);
rows++;
}
rows += addPingField(panel, leftWidth, rightWidth);
SpringUtilities.makeCompactGrid(panel, rows, 2, /* rows, cols */
1, 1, /* initX, initY */
1, 1); /* xPad, yPad */
optionsPanel.add(panel);
}
/** Adds field with ping constraint. */
private int addPingField(final JPanel panel,
final int leftWidth,
final int rightWidth) {
int rows = 0;
final JLabel pingLabel = new JLabel("pingd");
String savedPO = null;
final Widget prevWi = pingComboBox;
if (prevWi == null) {
savedPO = savedPingOperation;
} else {
savedPO = prevWi.getStringValue();
}
final Widget pingWi = WidgetFactory.createInstance(
Widget.Type.COMBOBOX,
savedPO,
new StringInfo[]{new StringInfo(
Widget.NOTHING_SELECTED_DISPLAY,
Widget.NOTHING_SELECTED_INTERNAL,
getBrowser()),
new StringInfo(
PING_ATTRIBUTES.get("defined"),
"defined",
getBrowser()),
new StringInfo(
PING_ATTRIBUTES.get("eq0"),
"eq0",
getBrowser())},
Widget.NO_REGEXP,
rightWidth,
Widget.NO_ABBRV,
new AccessMode(ConfigData.AccessType.ADMIN,
false),
Widget.NO_BUTTON);
addField(panel, pingLabel, pingWi, leftWidth, rightWidth, 0);
pingWi.setLabel(pingLabel,
Tools.getString("ServiceInfo.PingdToolTip"));
if (resourceAgent.isPingService() && savedPingOperation == null) {
pingWi.setEnabled(false);
}
pingComboBox = pingWi;
rows++;
return rows;
}
/**
* Returns whetrher this service's meta attributes are referenced by
* some other service.
*/
private boolean isMetaAttrReferenced() {
final ClusterStatus cs = getBrowser().getClusterStatus();
getBrowser().mHeartbeatIdToServiceLock();
final Map<String, ServiceInfo> services =
getBrowser().getHeartbeatIdToServiceInfo();
for (final ServiceInfo si : services.values()) {
final String refCRMId = cs.getMetaAttrsRef(
si.getService().getHeartbeatId());
if (refCRMId != null
&& refCRMId.equals(getService().getHeartbeatId())) {
getBrowser().mHeartbeatIdToServiceUnlock();
return true;
}
}
getBrowser().mHeartbeatIdToServiceUnlock();
return false;
}
/**
* Sets meta attrs with same values as other service info, or default
* values.
*/
private void setMetaAttrsSameAs(final Info info) {
if (sameAsMetaAttrsWi == null || info == null) {
return;
}
boolean nothingSelected = false;
if (Widget.NOTHING_SELECTED_DISPLAY.equals(info.toString())) {
nothingSelected = true;
}
boolean sameAs = true;
if (META_ATTRS_DEFAULT_VALUES_TEXT.equals(info.toString())) {
sameAs = false;
}
final String[] params = getParametersFromXML();
if (params != null) {
for (final String param : params) {
if (!isMetaAttr(param)) {
continue;
}
String defaultValue = getParamPreferred(param);
if (defaultValue == null) {
defaultValue = getParamDefault(param);
}
final Widget wi = getWidget(param, null);
if (wi == null) {
continue;
}
Object oldValue = wi.getValue();
if (oldValue == null) {
oldValue = defaultValue;
}
wi.setEnabled(!sameAs || nothingSelected);
if (!nothingSelected) {
if (sameAs) {
/* same as some other service */
defaultValue =
((ServiceInfo) info).getParamSaved(param);
}
final String newValue = defaultValue;
if (!Tools.areEqual(oldValue, newValue)) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (wi != null) {
wi.setValue(newValue);
}
}
});
}
}
}
}
}
/**
* Returns whetrher this service's operations are referenced by some
* other service.
*/
private boolean isOperationReferenced() {
final ClusterStatus cs = getBrowser().getClusterStatus();
getBrowser().mHeartbeatIdToServiceLock();
final Map<String, ServiceInfo> services =
getBrowser().getHeartbeatIdToServiceInfo();
for (final ServiceInfo si : services.values()) {
final String refCRMId = cs.getOperationsRef(
si.getService().getHeartbeatId());
if (refCRMId != null
&& refCRMId.equals(getService().getHeartbeatId())) {
getBrowser().mHeartbeatIdToServiceUnlock();
return true;
}
}
getBrowser().mHeartbeatIdToServiceUnlock();
return false;
}
/** Returns selected operations id reference. */
private Info getSameServiceOpIdRef() {
mSavedOperationsLock.lock();
final ServiceInfo savedOpIdRef = savedOperationIdRef;
mSavedOperationsLock.unlock();
return savedOpIdRef;
}
/**
* Returns all services except this one, that are of the same type
* for meta attributes.
*/
private Info[] getSameServicesMetaAttrs() {
final List<Info> sl = new ArrayList<Info>();
sl.add(new StringInfo(Widget.NOTHING_SELECTED_DISPLAY,
Widget.NOTHING_SELECTED_INTERNAL,
getBrowser()));
sl.add(new StringInfo(META_ATTRS_DEFAULT_VALUES_TEXT,
META_ATTRS_DEFAULT_VALUES,
getBrowser()));
final Host dcHost = getBrowser().getDCHost();
if (isMetaAttrReferenced() || Tools.versionBeforePacemaker(dcHost)) {
return sl.toArray(new Info[sl.size()]);
}
getBrowser().lockNameToServiceInfo();
final Map<String, ServiceInfo> idToInfoHash =
getBrowser().getNameToServiceInfoHash().get(getName());
final ClusterStatus cs = getBrowser().getClusterStatus();
if (idToInfoHash != null) {
for (final ServiceInfo si : new TreeSet<ServiceInfo>(
idToInfoHash.values())) {
if (si != this
&& cs.getMetaAttrsId(
si.getService().getHeartbeatId()) != null
&& cs.getMetaAttrsRef(
si.getService().getHeartbeatId()) == null) {
sl.add(si);
}
}
}
final boolean clone = getResourceAgent().isClone();
for (final String name
: getBrowser().getNameToServiceInfoHash().keySet()) {
final Map<String, ServiceInfo> idToInfo =
getBrowser().getNameToServiceInfoHash().get(name);
for (final ServiceInfo si : new TreeSet<ServiceInfo>(
idToInfo.values())) {
if (si != this
&& !si.getName().equals(getName())
&& si.getResourceAgent() != null
&& si.getResourceAgent().isClone() == clone
&& cs.getMetaAttrsId(
si.getService().getHeartbeatId()) != null
&& cs.getMetaAttrsRef(
si.getService().getHeartbeatId()) == null) {
sl.add(si);
}
}
}
getBrowser().unlockNameToServiceInfo();
return sl.toArray(new Info[sl.size()]);
}
/**
* Returns all services except this one, that are of the same type
* for operations.
*/
private Info[] getSameServicesOperations() {
final List<Info> sl = new ArrayList<Info>();
sl.add(new StringInfo(Widget.NOTHING_SELECTED_DISPLAY,
Widget.NOTHING_SELECTED_INTERNAL,
getBrowser()));
sl.add(new StringInfo(OPERATIONS_DEFAULT_VALUES_TEXT,
OPERATIONS_DEFAULT_VALUES,
getBrowser()));
final Host dcHost = getBrowser().getDCHost();
final String pmV = dcHost.getPacemakerVersion();
final String hbV = dcHost.getHeartbeatVersion();
if (isOperationReferenced() || Tools.versionBeforePacemaker(dcHost)) {
return sl.toArray(new Info[sl.size()]);
}
getBrowser().lockNameToServiceInfo();
final Map<String, ServiceInfo> idToInfoHash =
getBrowser().getNameToServiceInfoHash().get(getName());
final ClusterStatus cs = getBrowser().getClusterStatus();
if (idToInfoHash != null) {
for (final ServiceInfo si : new TreeSet<ServiceInfo>(
idToInfoHash.values())) {
if (si != this
&& cs.getOperationsId(
si.getService().getHeartbeatId()) != null
&& cs.getOperationsRef(
si.getService().getHeartbeatId()) == null) {
sl.add(si);
}
}
}
final boolean clone = getResourceAgent().isClone();
for (final String name
: getBrowser().getNameToServiceInfoHash().keySet()) {
final Map<String, ServiceInfo> idToInfo =
getBrowser().getNameToServiceInfoHash().get(name);
for (final ServiceInfo si : new TreeSet<ServiceInfo>(
idToInfo.values())) {
if (si != this
&& si.getResourceAgent() != null
&& si.getResourceAgent().isClone() == clone
&& !si.getName().equals(getName())
&& cs.getOperationsId(
si.getService().getHeartbeatId()) != null
&& cs.getOperationsRef(
si.getService().getHeartbeatId()) == null) {
sl.add(si);
}
}
}
getBrowser().unlockNameToServiceInfo();
return sl.toArray(new Info[sl.size()]);
}
/**
* Sets operations with same values as other service info, or default
* values.
*/
private void setOperationsSameAs(final Info info) {
if (sameAsOperationsWi == null) {
return;
}
boolean nothingSelected = false;
if (info == null
|| Widget.NOTHING_SELECTED_DISPLAY.equals(info.toString())) {
nothingSelected = true;
}
boolean sameAs = true;
if (info == null
|| OPERATIONS_DEFAULT_VALUES_TEXT.equals(info.toString())) {
sameAs = false;
}
mSavedOperationsLock.lock();
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param : getBrowser().getCRMOperationParams(op)) {
String defaultValue =
resourceAgent.getOperationDefault(op, param);
if (defaultValue == null) {
continue;
}
if (ClusterBrowser.HB_OP_IGNORE_DEFAULT.contains(op)) {
defaultValue = "";
}
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op, param);
mOperationsComboBoxHashReadLock.unlock();
final Object oldValue = wi.getValue();
wi.setEnabled(!sameAs || nothingSelected);
if (!nothingSelected) {
if (sameAs) {
/* same as some other service */
defaultValue =
((ServiceInfo) info).getSavedOperation().get(op,
param);
}
final String newValue = defaultValue;
if (!Tools.areEqual(oldValue,
Tools.extractUnit(newValue))) {
if (wi != null) {
wi.setValueNoListeners(newValue);
}
}
}
}
}
mSavedOperationsLock.unlock();
}
/** Creates operations combo boxes with labels. */
protected void addOperations(final JPanel optionsPanel,
final int leftWidth,
final int rightWidth) {
int rows = 0;
final JPanel sectionPanel = getParamPanel(
Tools.getString("ClusterBrowser.Operations"));
String defaultOpIdRef = null;
final Info savedOpIdRef = getSameServiceOpIdRef();
if (savedOpIdRef != null) {
defaultOpIdRef = savedOpIdRef.toString();
}
sameAsOperationsWi = WidgetFactory.createInstance(
Widget.Type.COMBOBOX,
defaultOpIdRef,
getSameServicesOperations(),
Widget.NO_REGEXP,
rightWidth,
Widget.NO_ABBRV,
new AccessMode(
ConfigData.AccessType.ADMIN,
false),
Widget.NO_BUTTON);
sameAsOperationsWi.setToolTipText(defaultOpIdRef);
final JLabel label = new JLabel(Tools.getString(
"ClusterBrowser.OperationsSameAs"));
sameAsOperationsWi.setLabel(label, "");
final JPanel saPanel = new JPanel(new SpringLayout());
saPanel.setBackground(ClusterBrowser.BUTTON_PANEL_BACKGROUND);
addField(saPanel,
label,
sameAsOperationsWi,
leftWidth,
rightWidth,
0);
SpringUtilities.makeCompactGrid(saPanel, 1, 2,
1, 1, // initX, initY
1, 1); // xPad, yPad
sectionPanel.add(saPanel);
boolean allAreDefaultValues = true;
mSavedOperationsLock.lock();
final JPanel normalOpPanel = new JPanel(new SpringLayout());
normalOpPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
int normalRows = 0;
final JPanel advancedOpPanel = new JPanel(new SpringLayout());
advancedOpPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
addToAdvancedList(advancedOpPanel);
advancedOpPanel.setVisible(Tools.getConfigData().isAdvancedMode());
int advancedRows = 0;
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param : getBrowser().getCRMOperationParams(op)) {
String defaultValue =
resourceAgent.getOperationDefault(op, param);
if (defaultValue == null) {
continue;
}
if (ClusterBrowser.HB_OP_IGNORE_DEFAULT.contains(op)) {
defaultValue = "";
}
final String regexp = "^-?\\d*$";
// TODO: old style resources
if (defaultValue == null) {
defaultValue = "0";
}
String savedValue = null;
mOperationsComboBoxHashWriteLock.lock();
try {
final Widget prevWi = operationsComboBoxHash.get(op, param);
if (prevWi != null) {
savedValue = prevWi.getStringValue();
}
} finally {
mOperationsComboBoxHashWriteLock.unlock();
}
if (savedValue == null) {
savedValue = savedOperation.get(op, param);
}
if (!getService().isNew()
&& (savedValue == null || "".equals(savedValue))) {
savedValue = getOpDefaultsDefault(param);
if (savedValue == null) {
savedValue = "";
}
}
if (!defaultValue.equals(savedValue)) {
allAreDefaultValues = false;
}
if (savedValue != null) {
defaultValue = savedValue;
}
Widget wi;
if (CRMXML.PAR_CHECK_LEVEL.equals(param)) {
wi = WidgetFactory.createInstance(
Widget.Type.COMBOBOX,
defaultValue,
new String[]{"",
"10",
"20"},
"^\\d*$",
rightWidth,
Widget.NO_ABBRV,
new AccessMode(ConfigData.AccessType.ADMIN,
false),
Widget.NO_BUTTON);
wi.setAlwaysEditable(true);
} else {
wi = new TextfieldWithUnit(defaultValue,
getUnits(),
regexp,
rightWidth,
Widget.NO_ABBRV,
new AccessMode(
ConfigData.AccessType.ADMIN,
!AccessMode.ADVANCED),
Widget.NO_BUTTON);
}
wi.setEnabled(savedOpIdRef == null);
mOperationsComboBoxHashWriteLock.lock();
try {
operationsComboBoxHash.put(op, param, wi);
} finally {
mOperationsComboBoxHashWriteLock.unlock();
}
rows++;
final String labelText = Tools.ucfirst(op)
+ " / "
+ Tools.ucfirst(param);
final JLabel wiLabel = new JLabel(labelText);
wi.setLabel(wiLabel, labelText);
JPanel panel;
if (getBrowser().isCRMOperationAdvanced(op, param)) {
panel = advancedOpPanel;
advancedRows++;
} else {
panel = normalOpPanel;
normalRows++;
}
addField(panel,
wiLabel,
wi,
leftWidth,
rightWidth,
0);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
wiLabel.setToolTipText(labelText);
}
});
}
}
SpringUtilities.makeCompactGrid(normalOpPanel, normalRows, 2,
1, 1, // initX, initY
1, 1); // xPad, yPad
SpringUtilities.makeCompactGrid(advancedOpPanel, advancedRows, 2,
1, 1, // initX, initY
1, 1); // xPad, yPad
sectionPanel.add(normalOpPanel);
sectionPanel.add(getMoreOptionsPanel(leftWidth + rightWidth + 4));
sectionPanel.add(advancedOpPanel);
mSavedOperationsLock.unlock();
if (allAreDefaultValues && savedOpIdRef == null) {
sameAsOperationsWi.setValue(OPERATIONS_DEFAULT_VALUES_TEXT);
}
sameAsOperationsWi.addListeners(
new WidgetListener() {
@Override
public void check(final Object value) {
final Info info = sameAsOperationsWiValue();
setOperationsSameAs(info);
final String[] params = getParametersFromXML();
setApplyButtons(CACHED_FIELD, params);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (info != null) {
sameAsOperationsWi.setToolTipText(
info.toString());
}
}
});
}
});
optionsPanel.add(sectionPanel);
}
/** Returns parameters. */
@Override
public String[] getParametersFromXML() {
final CRMXML crmXML = getBrowser().getCRMXML();
return getEnabledSectionParams(
crmXML.getParameters(resourceAgent, getService().isMaster()));
}
/** Returns the regexp of the parameter. */
@Override
protected String getParamRegexp(final String param) {
if (isInteger(param)) {
return "^((-?\\d*|(-|\\+)?" + CRMXML.INFINITY_STRING
+ "|" + CRMXML.DISABLED_STRING
+ "))|@NOTHING_SELECTED@$";
}
return null;
}
/** Returns true if the value of the parameter is ok. */
@Override
protected boolean checkParam(final String param, final String newValue) {
if (param.equals("ip")
&& newValue != null
&& !Tools.isIp(newValue)) {
return false;
}
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.checkParam(resourceAgent, param, newValue);
}
/** Returns default value for specified parameter. */
@Override
public String getParamDefault(final String param) {
if (isMetaAttr(param)) {
final String paramDefault = getBrowser().getRscDefaultsInfo()
.getResource().getValue(param);
if (paramDefault != null) {
return paramDefault;
}
}
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.getParamDefault(resourceAgent, param);
}
/** Returns saved value for specified parameter. */
@Override
protected String getParamSaved(final String param) {
final ClusterStatus clStatus = getBrowser().getClusterStatus();
if (isMetaAttr(param)) {
final String crmId = getService().getHeartbeatId();
final String refCRMId = clStatus.getMetaAttrsRef(crmId);
if (refCRMId != null) {
String value = clStatus.getParameter(refCRMId, param, false);
if (value == null) {
value = getParamPreferred(param);
if (value == null) {
return getParamDefault(param);
}
}
return value;
}
}
String value = super.getParamSaved(param);
if (value == null) {
value = clStatus.getParameter(getService().getHeartbeatId(),
param,
false);
if (value == null) {
if (getService().isNew()) {
value = getParamPreferred(param);
}
if (value == null) {
return getParamDefault(param);
}
}
}
return value;
}
/**
* Returns preferred value for specified parameter.
*/
@Override
protected String getParamPreferred(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.getParamPreferred(resourceAgent, param);
}
/**
* Returns possible choices for drop down lists.
*/
@Override
protected Object[] getParamPossibleChoices(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
if (isCheckBox(param)) {
return crmXML.getCheckBoxChoices(resourceAgent, param);
} else {
final CloneInfo ci = getCloneInfo();
final boolean ms = ci != null
&& ci.getService().isMaster();
return crmXML.getParamPossibleChoices(resourceAgent, param, ms);
}
}
/**
* Returns short description of the specified parameter.
*/
@Override
protected String getParamShortDesc(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.getParamShortDesc(resourceAgent, param);
}
/**
* Returns long description of the specified parameter.
*/
@Override
protected String getParamLongDesc(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.getParamLongDesc(resourceAgent, param);
}
/**
* Returns section to which the specified parameter belongs.
*/
@Override
protected String getSection(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.getSection(resourceAgent, param);
}
/** Returns true if the specified parameter is required. */
@Override
protected boolean isRequired(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.isRequired(resourceAgent, param);
}
/** Returns whether this parameter is advanced. */
@Override
protected boolean isAdvanced(final String param) {
if (!Tools.areEqual(getParamDefault(param),
getParamSaved(param))) {
/* it changed, show it */
return false;
}
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.isAdvanced(resourceAgent, param);
}
/** Whether the parameter should be enabled. */
@Override
protected final String isEnabled(final String param) {
if (GUI_ID.equals(param) && !getResource().isNew()) {
return "";
}
if (isMetaAttr(param)) {
final Info info = sameAsMetaAttrsWiValue();
if (info == null) {
return null;
}
boolean nothingSelected = false;
if (Widget.NOTHING_SELECTED_DISPLAY.equals(info.toString())) {
nothingSelected = true;
}
boolean sameAs = true;
if (META_ATTRS_DEFAULT_VALUES_TEXT.equals(info.toString())) {
sameAs = false;
}
if (!sameAs || nothingSelected) {
return null;
} else {
return "";
}
}
return null;
}
/** Whether the parameter should be enabled only in advanced mode. */
@Override
protected final boolean isEnabledOnlyInAdvancedMode(final String param) {
return false;
}
/** Returns access type of this parameter. */
@Override
protected ConfigData.AccessType getAccessType(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.getAccessType(resourceAgent, param);
}
/**
* Returns true if the specified parameter is meta attribute.
*/
protected boolean isMetaAttr(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.isMetaAttr(resourceAgent, param);
}
/** Returns true if the specified parameter is integer. */
@Override
protected boolean isInteger(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.isInteger(resourceAgent, param);
}
/** Returns true if the specified parameter is label. */
@Override
protected boolean isLabel(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.isLabel(resourceAgent, param);
}
/** Returns true if the specified parameter is of time type. */
@Override
protected boolean isTimeType(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.isTimeType(resourceAgent, param);
}
/** Returns whether parameter is checkbox. */
@Override
protected boolean isCheckBox(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.isBoolean(resourceAgent, param);
}
/** Returns the type of the parameter according to the OCF. */
@Override
protected String getParamType(final String param) {
final CRMXML crmXML = getBrowser().getCRMXML();
return crmXML.getParamType(resourceAgent, param);
}
/** Returns the type of the parameter. */
@Override
protected Widget.Type getFieldType(final String param) {
return resourceAgent.getFieldType(param);
}
/**
* Is called before the service is added. This is for example used by
* FilesystemInfo so that it can add LinbitDrbdInfo or DrbddiskInfo
* before it adds itself.
*/
void addResourceBefore(final Host dcHost, final boolean testOnly) {
/* Override to add resource before this one. */
}
/** Change type to Master, Clone or Primitive. */
protected final void changeType(final String value) {
boolean masterSlave = false;
boolean clone = false;
if (MASTER_SLAVE_TYPE_STRING.equals(value)) {
masterSlave = true;
clone = true;
} else if (CLONE_TYPE_STRING.equals(value)) {
clone = true;
}
final ServiceInfo thisClass = this;
if (clone) {
final CRMXML crmXML = getBrowser().getCRMXML();
final CloneInfo oldCI = getCloneInfo();
String title = ConfigData.PM_CLONE_SET_NAME;
if (masterSlave) {
title = ConfigData.PM_MASTER_SLAVE_SET_NAME;
}
final CloneInfo ci = new CloneInfo(crmXML.getHbClone(),
title,
masterSlave,
getBrowser());
setCloneInfo(ci);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (oldCI == null) {
getBrowser().getCRMGraph()
.exchangeObjectInTheVertex(ci, thisClass);
ci.setPingComboBox(pingComboBox);
for (final HostInfo hi : scoreComboBoxHash.keySet()) {
ci.getScoreComboBoxHash().put(
hi,
scoreComboBoxHash.get(hi));
}
final Widget prevWi = getWidget(GUI_ID, null);
if (prevWi != null) {
ci.getService().setId(
getName() + "_" + prevWi.getStringValue());
}
} else {
oldCI.removeNodeAndWait();
getBrowser().getCRMGraph()
.exchangeObjectInTheVertex(ci, oldCI);
cleanup();
oldCI.cleanup();
ci.setPingComboBox(oldCI.getPingComboBox());
for (final HostInfo hi
: oldCI.getScoreComboBoxHash().keySet()) {
ci.getScoreComboBoxHash().put(
hi, oldCI.getScoreComboBoxHash().get(hi));
}
getBrowser().removeFromServiceInfoHash(oldCI);
getBrowser().mHeartbeatIdToServiceLock();
getBrowser().getHeartbeatIdToServiceInfo().remove(
oldCI.getService().getHeartbeatId());
getBrowser().mHeartbeatIdToServiceUnlock();
final DefaultMutableTreeNode oldCINode =
oldCI.getNode();
if (oldCINode != null) {
oldCINode.setUserObject(null); /* would leak
without it*/
}
ci.getService().setId(oldCI.getWidget(
GUI_ID, null).getStringValue());
}
ci.setCloneServicePanel(thisClass);
infoPanel = null;
}
});
} else if (PRIMITIVE_TYPE_STRING.equals(value)) {
final CloneInfo ci = getCloneInfo();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setPingComboBox(ci.getPingComboBox());
for (final HostInfo hi
: ci.getScoreComboBoxHash().keySet()) {
scoreComboBoxHash.put(
hi, ci.getScoreComboBoxHash().get(hi));
}
final DefaultMutableTreeNode node = getNode();
final DefaultMutableTreeNode ciNode = ci.getNode();
removeNodeAndWait();
ci.removeNodeAndWait();
cleanup();
ci.cleanup();
setNode(node);
getBrowser().getServicesNode().add(node);
getBrowser().getCRMGraph().exchangeObjectInTheVertex(
thisClass,
ci);
getBrowser().mHeartbeatIdToServiceLock();
getBrowser().getHeartbeatIdToServiceInfo().remove(
ci.getService().getHeartbeatId());
getBrowser().mHeartbeatIdToServiceUnlock();
getBrowser().removeFromServiceInfoHash(ci);
infoPanel = null;
setCloneInfo(null);
selectMyself();
ciNode.setUserObject(null); /* would leak without it */
}
});
}
}
/** Adds host score listeners. */
protected void addHostLocationsListeners() {
final String[] params = getParametersFromXML();
for (Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
final Widget wi = scoreComboBoxHash.get(hi);
wi.addListeners(new WidgetListener() {
@Override
public void check(final Object value) {
setApplyButtons(CACHED_FIELD, params);
SwingUtilities.invokeLater(
new Runnable() {
@Override
public void run() {
wi.setEditable();
}
});
}
});
}
pingComboBox.addListeners(new WidgetListener() {
@Override
public void check(final Object value) {
setApplyButtons(CACHED_FIELD, params);
}
});
}
/** Adds listeners for operation and parameter. */
private void addOperationListeners(final String op, final String param) {
final String dv = resourceAgent.getOperationDefault(op, param);
if (dv == null) {
return;
}
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op, param);
mOperationsComboBoxHashReadLock.unlock();
final String[] params = getParametersFromXML();
wi.addListeners(new WidgetListener() {
@Override
public void check(final Object value) {
setApplyButtons(CACHED_FIELD, params);
}
});
}
/**
* Returns "same as" fields for some sections. Currently only "meta
* attributes".
*/
protected final Map<String, Widget> getSameAsFields(
final Info savedMAIdRef) {
String defaultMAIdRef = null;
if (savedMAIdRef != null) {
defaultMAIdRef = savedMAIdRef.toString();
}
sameAsMetaAttrsWi = WidgetFactory.createInstance(
Widget.Type.COMBOBOX,
defaultMAIdRef,
getSameServicesMetaAttrs(),
Widget.NO_REGEXP,
ClusterBrowser.SERVICE_FIELD_WIDTH,
Widget.NO_ABBRV,
new AccessMode(
ConfigData.AccessType.ADMIN,
false),
Widget.NO_BUTTON);
sameAsMetaAttrsWi.setToolTipText(defaultMAIdRef);
final Map<String, Widget> sameAsFields = new HashMap<String, Widget>();
sameAsFields.put("Meta Attributes", sameAsMetaAttrsWi);
sameAsMetaAttrsWi.addListeners(new WidgetListener() {
@Override
public void check(final Object value) {
Info i = null;
final Object o = sameAsMetaAttrsWiValue();
if (o instanceof Info) {
i = (Info) o;
}
final Info info = i;
setMetaAttrsSameAs(info);
final String[] params =
getParametersFromXML();
setApplyButtons(CACHED_FIELD, params);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (info != null) {
sameAsMetaAttrsWi.setToolTipText(
info.toString());
}
}
});
}
});
return sameAsFields;
}
/** Returns saved meta attributes reference to another service. */
protected final Info getSavedMetaAttrInfoRef() {
return savedMetaAttrInfoRef;
}
/** Returns info panel with comboboxes for service parameters. */
@Override
public JComponent getInfoPanel() {
if (!getResourceAgent().isMetaDataLoaded()) {
final JPanel p = new JPanel();
p.add(new JLabel(Tools.getString("ServiceInfo.LoadingMetaData")));
return p;
}
final CloneInfo ci = getCloneInfo();
if (ci == null) {
getBrowser().getCRMGraph().pickInfo(this);
} else {
getBrowser().getCRMGraph().pickInfo(ci);
}
if (infoPanel != null) {
return infoPanel;
}
/* init save button */
final boolean abExisted = getApplyButton() != null;
final ServiceInfo thisClass = this;
final ButtonCallback buttonCallback = new ButtonCallback() {
private volatile boolean mouseStillOver = false;
/**
* Whether the whole thing should be enabled.
*/
@Override
public final boolean isEnabled() {
final Host dcHost = getBrowser().getDCHost();
if (dcHost == null) {
return false;
}
if (Tools.versionBeforePacemaker(dcHost)) {
return false;
}
return true;
}
@Override
public final void mouseOut() {
if (!isEnabled()) {
return;
}
mouseStillOver = false;
getBrowser().getCRMGraph().stopTestAnimation(
getApplyButton());
getApplyButton().setToolTipText("");
}
@Override
public final void mouseOver() {
if (!isEnabled()) {
return;
}
mouseStillOver = true;
getApplyButton().setToolTipText(
ClusterBrowser.STARTING_PTEST_TOOLTIP);
getApplyButton().setToolTipBackground(Tools.getDefaultColor(
"ClusterBrowser.Test.Tooltip.Background"));
Tools.sleep(250);
if (!mouseStillOver) {
return;
}
mouseStillOver = false;
final CountDownLatch startTestLatch = new CountDownLatch(1);
getBrowser().getCRMGraph().startTestAnimation(
getApplyButton(),
startTestLatch);
final Host dcHost = getBrowser().getDCHost();
getBrowser().ptestLockAcquire();
final ClusterStatus cs = getBrowser().getClusterStatus();
cs.setPtestData(null);
apply(dcHost, true);
final PtestData ptestData = new PtestData(CRM.getPtest(dcHost));
getApplyButton().setToolTipText(ptestData.getToolTip());
cs.setPtestData(ptestData);
getBrowser().ptestLockRelease();
startTestLatch.countDown();
}
};
if (getResourceAgent().isGroup()) {
initApplyButton(buttonCallback,
Tools.getString("Browser.ApplyGroup"));
} else {
initApplyButton(buttonCallback);
}
if (ci != null) {
ci.setApplyButton(getApplyButton());
ci.setRevertButton(getRevertButton());
}
/* add item listeners to the apply button. */
if (!abExisted) {
getApplyButton().addActionListener(
new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
getBrowser().clStatusLock();
apply(getBrowser().getDCHost(), false);
getBrowser().clStatusUnlock();
}
});
thread.start();
}
}
);
getRevertButton().addActionListener(
new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
getBrowser().clStatusLock();
revert();
getBrowser().clStatusUnlock();
}
});
thread.start();
}
}
);
}
/* main, button and options panels */
final JPanel mainPanel = new JPanel();
mainPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
final JPanel buttonPanel = new JPanel(new BorderLayout());
buttonPanel.setBackground(ClusterBrowser.BUTTON_PANEL_BACKGROUND);
buttonPanel.setMinimumSize(new Dimension(0, 50));
buttonPanel.setPreferredSize(new Dimension(0, 50));
buttonPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, 50));
final JPanel optionsPanel = new JPanel();
optionsPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
optionsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
/* Actions */
final JMenuBar mb = new JMenuBar();
mb.setBackground(ClusterBrowser.PANEL_BACKGROUND);
AbstractButton serviceMenu;
if (ci == null) {
serviceMenu = getActionsButton();
} else {
serviceMenu = ci.getActionsButton();
}
buttonPanel.add(serviceMenu, BorderLayout.EAST);
String defaultValue = PRIMITIVE_TYPE_STRING;
if (ci != null) {
if (ci.getService().isMaster()) {
defaultValue = MASTER_SLAVE_TYPE_STRING;
} else {
defaultValue = CLONE_TYPE_STRING;
}
}
if (!getResourceAgent().isClone() && getGroupInfo() == null) {
typeRadioGroup = WidgetFactory.createInstance(
Widget.Type.RADIOGROUP,
defaultValue,
new String[]{PRIMITIVE_TYPE_STRING,
CLONE_TYPE_STRING,
MASTER_SLAVE_TYPE_STRING},
Widget.NO_REGEXP,
ClusterBrowser.SERVICE_LABEL_WIDTH
+ ClusterBrowser.SERVICE_FIELD_WIDTH,
Widget.NO_ABBRV,
new AccessMode(ConfigData.AccessType.ADMIN,
false),
Widget.NO_BUTTON);
if (!getService().isNew()) {
typeRadioGroup.setEnabled(false);
}
typeRadioGroup.addListeners(new WidgetListener() {
@Override
public void check(final Object value) {
changeType(((JRadioButton) value).getText());
}
});
final JPanel tp = new JPanel();
tp.setBackground(ClusterBrowser.PANEL_BACKGROUND);
tp.setLayout(new BoxLayout(tp, BoxLayout.Y_AXIS));
tp.add(typeRadioGroup);
typeRadioGroup.setBackgroundColor(ClusterBrowser.PANEL_BACKGROUND);
optionsPanel.add(tp);
}
if (ci != null) {
/* add clone fields */
addCloneFields(optionsPanel,
ClusterBrowser.SERVICE_LABEL_WIDTH,
ClusterBrowser.SERVICE_FIELD_WIDTH);
}
getResource().setValue(GUI_ID, getService().getId());
/* get dependent resources and create combo boxes for ones, that
* need parameters */
final String[] params = getParametersFromXML();
final Info savedMAIdRef = savedMetaAttrInfoRef;
addParams(optionsPanel,
params,
ClusterBrowser.SERVICE_LABEL_WIDTH,
ClusterBrowser.SERVICE_FIELD_WIDTH,
getSameAsFields(savedMAIdRef));
if (ci == null) {
/* score combo boxes */
addHostLocations(optionsPanel,
ClusterBrowser.SERVICE_LABEL_WIDTH,
ClusterBrowser.SERVICE_FIELD_WIDTH);
}
for (final String param : params) {
if (isMetaAttr(param)) {
final Widget wi = getWidget(param, null);
wi.setEnabled(savedMAIdRef == null);
}
}
if (!getService().isNew()) {
getWidget(GUI_ID, null).setEnabled(false);
}
if (!getResourceAgent().isGroup()
&& !getResourceAgent().isClone()) {
/* Operations */
addOperations(optionsPanel,
ClusterBrowser.SERVICE_LABEL_WIDTH,
ClusterBrowser.SERVICE_FIELD_WIDTH);
/* add item listeners to the operations combos */
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param
: getBrowser().getCRMOperationParams(op)) {
addOperationListeners(op, param);
}
}
}
/* add item listeners to the host scores combos */
if (ci == null) {
addHostLocationsListeners();
} else {
ci.addHostLocationsListeners();
}
/* apply button */
addApplyButton(buttonPanel);
addRevertButton(buttonPanel);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
/* invoke later on purpose */
setApplyButtons(null, params);
}
});
mainPanel.add(optionsPanel);
final JPanel newPanel = new JPanel();
newPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
newPanel.setLayout(new BoxLayout(newPanel, BoxLayout.Y_AXIS));
newPanel.add(buttonPanel);
newPanel.add(getMoreOptionsPanel(
ClusterBrowser.SERVICE_LABEL_WIDTH
+ ClusterBrowser.SERVICE_FIELD_WIDTH + 4));
newPanel.add(new JScrollPane(mainPanel));
/* if id textfield was changed and this id is not used,
* enable apply button */
infoPanel = newPanel;
infoPanelDone();
return infoPanel;
}
/** Clears the info panel cache, forcing it to reload. */
@Override
boolean selectAutomaticallyInTreeMenu() {
return infoPanel == null;
}
/** Returns operation from host location label. "eq", "ne" etc. */
private String getOpFromLabel(final String onHost,
final String labelText) {
final int l = labelText.length();
final int k = onHost.length();
String op = null;
if (l > k) {
final String labelPart = labelText.substring(0, l - k - 1);
if ("on".equals(labelPart)) {
op = "eq";
} else if ("NOT on".equals(labelPart)) {
op = "ne";
} else {
op = labelPart;
}
}
return op;
}
/** Goes through the scores and sets preferred locations. */
protected void setLocations(final String heartbeatId,
final Host dcHost,
final boolean testOnly) {
final ClusterStatus cs = getBrowser().getClusterStatus();
for (Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
final Widget wi = scoreComboBoxHash.get(hi);
String hs = wi.getStringValue();
if ("ALWAYS".equals(hs)) {
hs = CRMXML.INFINITY_STRING;
} else if ("NEVER".equals(hs)) {
hs = CRMXML.MINUS_INFINITY_STRING;
}
final HostLocation hlSaved = savedHostLocations.get(hi);
String hsSaved = null;
String opSaved = null;
if (hlSaved != null) {
hsSaved = hlSaved.getScore();
opSaved = hlSaved.getOperation();
}
final String onHost = hi.getName();
final String op = getOpFromLabel(onHost, wi.getLabel().getText());
final HostLocation hostLoc = new HostLocation(hs, op, null, null);
if (!hostLoc.equals(hlSaved)) {
String locationId = cs.getLocationId(getHeartbeatId(testOnly),
onHost,
testOnly);
if (((hs == null || "".equals(hs))
|| !Tools.areEqual(op, opSaved))
&& locationId != null) {
CRM.removeLocation(dcHost,
locationId,
getHeartbeatId(testOnly),
testOnly);
locationId = null;
}
if (hs != null && !"".equals(hs)) {
CRM.setLocation(dcHost,
getHeartbeatId(testOnly),
onHost,
hostLoc,
locationId,
testOnly);
}
}
}
/* ping */
final Widget pwi = pingComboBox;
if (pwi != null) {
String value = null;
final Object o = pwi.getValue();
if (o != null) {
value = ((StringInfo) o).getInternalValue();
}
final String locationId = null;
if (!Tools.areEqual(savedPingOperation,
value)) {
final String pingLocationId = cs.getPingLocationId(
getHeartbeatId(testOnly),
testOnly);
if (pingLocationId != null) {
CRM.removeLocation(dcHost,
pingLocationId,
getHeartbeatId(testOnly),
testOnly);
}
if (value != null) {
CRM.setPingLocation(dcHost,
getHeartbeatId(testOnly),
value,
null, /* location id */
testOnly);
}
}
}
if (!testOnly) {
storeHostLocations();
}
}
/**
* Returns hash with changed operation ids and all name, value pairs.
* This works for new heartbeats >= 2.99.0
*/
protected Map<String, Map<String, String>> getOperations(
final String heartbeatId) {
final Map<String, Map<String, String>> operations =
new LinkedHashMap<String, Map<String, String>>();
final ClusterStatus cs = getBrowser().getClusterStatus();
final CloneInfo ci = getCloneInfo();
for (final String op : getResourceAgent().getOperationNames()) {
final Map<String, String> opHash =
new LinkedHashMap<String, String>();
String opId = cs.getOpId(heartbeatId, op);
if (opId == null) {
/* generate one */
opId = "op-" + heartbeatId + "-" + op;
}
/* operations have different kind of default, that is
* recommended, but not used by default. */
boolean firstTime = true;
for (final String param : ClusterBrowser.HB_OPERATION_PARAM_LIST) {
if (getBrowser().getCRMOperationParams(op).contains(param)) {
if (ci == null
&& (ClusterBrowser.HB_OP_DEMOTE.equals(op)
|| ClusterBrowser.HB_OP_PROMOTE.equals(op))) {
continue;
}
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op, param);
mOperationsComboBoxHashReadLock.unlock();
String value;
if (wi == null) {
value = "0";
} else {
value = wi.getStringValue();
}
if (value != null && !"".equals(value)) {
if (wi != null && firstTime) {
opHash.put("id", opId);
opHash.put("name", op);
firstTime = false;
operations.put(op, opHash);
}
opHash.put(param, value);
}
}
}
}
return operations;
}
/**
* Returns id of the meta attrs to which meta attrs of this service are
* referring to.
*/
protected String getMetaAttrsRefId() {
String metaAttrsRefId = null;
if (sameAsMetaAttrsWi != null) {
final Info i = sameAsMetaAttrsWiValue();
if (!Widget.NOTHING_SELECTED_DISPLAY.equals(i.toString())
&& !META_ATTRS_DEFAULT_VALUES_TEXT.equals(i.toString())) {
final ServiceInfo si = (ServiceInfo) i;
final ClusterStatus cs = getBrowser().getClusterStatus();
metaAttrsRefId = cs.getMetaAttrsId(
si.getService().getHeartbeatId());
}
}
return metaAttrsRefId;
}
/**
* Returns id of the operations to which operations of this service are
* referring to.
*/
protected String getOperationsRefId() {
String operationsRefId = null;
if (sameAsOperationsWi != null) {
final Info i = sameAsOperationsWiValue();
if (!Widget.NOTHING_SELECTED_DISPLAY.equals(i.toString())
&& !OPERATIONS_DEFAULT_VALUES_TEXT.equals(i.toString())) {
final ServiceInfo si = (ServiceInfo) i;
final ClusterStatus cs = getBrowser().getClusterStatus();
operationsRefId = cs.getOperationsId(
si.getService().getHeartbeatId());
}
}
return operationsRefId;
}
/** Returns attributes of this resource. */
protected Map<String, String> getPacemakerResAttrs(final boolean testOnly) {
final Map<String, String> pacemakerResAttrs =
new LinkedHashMap<String, String>();
final String raClass = getService().getResourceClass();
final String type = getName();
final String provider = resourceAgent.getProvider();
final String heartbeatId = getHeartbeatId(testOnly);
pacemakerResAttrs.put("id", heartbeatId);
pacemakerResAttrs.put("class", raClass);
if (!ResourceAgent.HEARTBEAT_CLASS.equals(raClass)
&& !ResourceAgent.SERVICE_CLASSES.contains(raClass)
&& !raClass.equals(ResourceAgent.STONITH_CLASS)) {
pacemakerResAttrs.put("provider", provider);
}
pacemakerResAttrs.put("type", type);
return pacemakerResAttrs;
}
/** Returns arguments of this resource. */
protected Map<String, String> getPacemakerResArgs() {
final Map<String, String> pacemakerResArgs =
new LinkedHashMap<String, String>();
final String[] params = getParametersFromXML();
for (final String param : params) {
if (isMetaAttr(param)) {
continue;
}
if (GUI_ID.equals(param)
|| PCMK_ID.equals(param)) {
continue;
}
String value = getComboBoxValue(param);
if (value == null) {
value = "";
}
if (!resourceAgent.isIgnoreDefaults()
&& value.equals(getParamDefault(param))) {
continue;
}
if (!"".equals(value)) {
/* for pacemaker */
pacemakerResArgs.put(param, value);
}
}
return pacemakerResArgs;
}
/** Returns meta arguments of this resource. */
protected Map<String, String> getPacemakerMetaArgs() {
final Map<String, String> pacemakerMetaArgs =
new LinkedHashMap<String, String>();
final String[] params = getParametersFromXML();
for (final String param : params) {
if (!isMetaAttr(param)) {
continue;
}
if (GUI_ID.equals(param)
|| PCMK_ID.equals(param)) {
continue;
}
String value = getComboBoxValue(param);
if (value == null) {
value = "";
}
if (value.equals(getParamDefault(param))) {
continue;
}
if (!"".equals(value)) {
/* for pacemaker */
pacemakerMetaArgs.put(param, value);
}
}
return pacemakerMetaArgs;
}
/** Revert all values. */
@Override
public void revert() {
final CRMXML crmXML = getBrowser().getCRMXML();
final String[] params = getParametersFromXML();
boolean allSavedMetaAttrsAreDefaultValues = true;
boolean sameAs = false;
if (sameAsMetaAttrsWi != null) {
for (String param : params) {
if (isMetaAttr(param)) {
final String defaultValue = getParamDefault(param);
final String oldValue = getResource().getValue(param);
if (!Tools.areEqual(defaultValue, oldValue)) {
allSavedMetaAttrsAreDefaultValues = false;
}
}
}
if (savedMetaAttrInfoRef == null) {
if (allSavedMetaAttrsAreDefaultValues) {
sameAsMetaAttrsWi.setValue(
META_ATTRS_DEFAULT_VALUES_TEXT);
} else {
sameAsMetaAttrsWi.setValue(
Widget.NOTHING_SELECTED_INTERNAL);
}
} else {
sameAs = true;
sameAsMetaAttrsWi.setValue(savedMetaAttrInfoRef);
}
}
for (String param : params) {
if (!sameAs || !isMetaAttr(param)) {
final String v = getParamSaved(param);
final Widget wi = getWidget(param, null);
if (wi != null
&& !Tools.areEqual(wi.getStringValue(), v)) {
if ("".equals(v)) {
wi.setValue(null);
} else {
wi.setValue(v);
}
}
}
}
final GroupInfo gInfo = groupInfo;
CloneInfo ci;
if (gInfo == null) {
ci = getCloneInfo();
} else {
ci = gInfo.getCloneInfo();
}
final CloneInfo clInfo = ci;
if (clInfo != null) {
clInfo.revert();
}
revertOperations();
revertLocations();
}
/** Revert locations to saved values. */
protected final void revertLocations() {
for (Host host : getBrowser().getClusterHosts()) {
final HostInfo hi = host.getBrowser().getHostInfo();
final HostLocation savedLocation = savedHostLocations.get(hi);
final Widget wi = scoreComboBoxHash.get(hi);
if (wi == null) {
continue;
}
String score = null;
String op = null;
if (savedLocation != null) {
score = savedLocation.getScore();
op = savedLocation.getOperation();
}
wi.setValue(score);
final JLabel label = wi.getLabel();
final String text = getHostLocationLabel(hi.getName(), op);
label.setText(text);
}
/* pingd */
final Widget pwi = pingComboBox;
if (pwi != null) {
final String spo = savedPingOperation;
if (spo == null) {
pwi.setValue(Widget.NOTHING_SELECTED_INTERNAL);
} else {
pwi.setValue(PING_ATTRIBUTES.get(spo));
}
}
}
/** Revert to saved operation values. */
protected final void revertOperations() {
if (sameAsOperationsWi == null) {
return;
}
final ClusterStatus cs = getBrowser().getClusterStatus();
mSavedOperationsLock.lock();
boolean allAreDefaultValues = true;
boolean allSavedAreDefaultValues = true;
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param
: getBrowser().getCRMOperationParams(op)) {
String defaultValue =
resourceAgent.getOperationDefault(op, param);
if (defaultValue == null) {
continue;
}
if (ClusterBrowser.HB_OP_IGNORE_DEFAULT.contains(op)) {
defaultValue = "";
}
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op, param);
mOperationsComboBoxHashReadLock.unlock();
String value = wi.getStringValue();
if (value == null || "".equals(value)) {
value = getOpDefaultsDefault(param);
}
if (value == null) {
value = "";
}
if (!defaultValue.equals(value)) {
allAreDefaultValues = false;
}
if (!defaultValue.equals(savedOperation.get(op, param))) {
allSavedAreDefaultValues = false;
}
}
}
boolean sameAs = false;
final ServiceInfo savedOpIdRef = savedOperationIdRef;
ServiceInfo operationIdRef = null;
final Info ref = sameAsOperationsWiValue();
if (ref instanceof ServiceInfo) {
operationIdRef = (ServiceInfo) ref;
}
if (!Tools.areEqual(operationIdRef, savedOpIdRef)) {
if (savedOpIdRef == null) {
if (allSavedAreDefaultValues) {
sameAsOperationsWi.setValue(
OPERATIONS_DEFAULT_VALUES_TEXT);
} else {
if (operationIdRef != null) {
sameAsOperationsWi.setValue(
Widget.NOTHING_SELECTED_INTERNAL);
}
}
} else {
sameAs = true;
sameAsOperationsWi.setValue(savedOpIdRef);
}
}
if (!sameAs) {
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param
: getBrowser().getCRMOperationParams(op)) {
final String value = savedOperation.get(op, param);
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op, param);
mOperationsComboBoxHashReadLock.unlock();
if (wi != null) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
wi.setEnabled(savedOpIdRef == null);
}
});
if (value != null) {
wi.setValue(value);
}
}
}
}
}
mSavedOperationsLock.unlock();
}
/** Applies the changes to the service parameters. */
void apply(final Host dcHost, final boolean testOnly) {
if (!testOnly) {
Tools.invokeAndWait(new Runnable() {
@Override
public void run() {
getApplyButton().setEnabled(false);
getRevertButton().setEnabled(false);
}
});
}
getInfoPanel();
waitForInfoPanel();
/* TODO: make progress indicator per resource. */
if (!testOnly) {
setUpdated(true);
}
final String[] params = getParametersFromXML();
String cloneId = null;
String[] cloneParams = null;
boolean master = false;
final GroupInfo gInfo = groupInfo;
CloneInfo ci;
String[] groupParams = null;
if (gInfo == null) {
ci = getCloneInfo();
} else {
ci = gInfo.getCloneInfo();
groupParams = gInfo.getParametersFromXML();
}
final CloneInfo clInfo = ci;
if (clInfo != null) {
cloneId = clInfo.getHeartbeatId(testOnly);
cloneParams = clInfo.getParametersFromXML();
master = clInfo.getService().isMaster();
}
if (!testOnly) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
getApplyButton().setToolTipText("");
getWidget(GUI_ID, null).setEnabled(false);
if (clInfo != null) {
clInfo.getWidget(GUI_ID, null).setEnabled(false);
}
}
});
/* add myself to the hash with service name and id as
* keys */
getBrowser().removeFromServiceInfoHash(this);
final String oldHeartbeatId = getHeartbeatId(testOnly);
if (oldHeartbeatId != null) {
getBrowser().mHeartbeatIdToServiceLock();
getBrowser().getHeartbeatIdToServiceInfo().remove(
oldHeartbeatId);
getBrowser().mHeartbeatIdToServiceUnlock();
}
if (getService().isNew()) {
final String id = getComboBoxValue(GUI_ID);
getService().setIdAndCrmId(id);
if (clInfo != null) {
final String clid = clInfo.getComboBoxValue(GUI_ID);
clInfo.getService().setIdAndCrmId(clid);
}
if (typeRadioGroup != null) {
typeRadioGroup.setEnabled(false);
}
}
getBrowser().addNameToServiceInfoHash(this);
getBrowser().addToHeartbeatIdList(this);
}
if (!testOnly) {
addResourceBefore(dcHost, testOnly);
}
final Map<String, String> cloneMetaArgs =
new LinkedHashMap<String, String>();
final Map<String, String> groupMetaArgs =
new LinkedHashMap<String, String>();
final Map<String, String> pacemakerResAttrs =
getPacemakerResAttrs(testOnly);
final Map<String, String> pacemakerResArgs = getPacemakerResArgs();
final Map<String, String> pacemakerMetaArgs = getPacemakerMetaArgs();
final String raClass = getService().getResourceClass();
final String type = getName();
final String provider = resourceAgent.getProvider();
final String heartbeatId = getHeartbeatId(testOnly);
String groupId = null; /* for pacemaker */
if (gInfo != null) {
if (gInfo.getService().isNew()) {
gInfo.apply(dcHost, testOnly);
return;
}
groupId = gInfo.getHeartbeatId(testOnly);
}
String cloneMetaAttrsRefIds = null;
if (clInfo != null) {
cloneMetaAttrsRefIds = clInfo.getMetaAttrsRefId();
}
String groupMetaAttrsRefIds = null;
if (gInfo != null) {
groupMetaAttrsRefIds = gInfo.getMetaAttrsRefId();
}
final String refCRMId = getOperationsRefId();
savedOperationsId = refCRMId;
savedOperationIdRef = getBrowser().getServiceInfoFromCRMId(refCRMId);
final Info i = sameAsOperationsWiValue();
if (i == null || (i instanceof StringInfo)) {
savedOperationsId = null;
} else {
savedOperationIdRef = (ServiceInfo) i;
savedOperationsId = ((ServiceInfo) i).getService().getHeartbeatId();
}
if (getService().isNew()) {
if (clInfo != null) {
for (String param : cloneParams) {
if (GUI_ID.equals(param)
|| PCMK_ID.equals(param)) {
continue;
}
final String value = clInfo.getComboBoxValue(param);
if (value.equals(clInfo.getParamDefault(param))) {
continue;
}
if (!GUI_ID.equals(param) && !"".equals(value)) {
cloneMetaArgs.put(param, value);
}
}
}
if (gInfo != null) {
for (String param : groupParams) {
if (GUI_ID.equals(param)
|| PCMK_ID.equals(param)) {
continue;
}
final String value = gInfo.getComboBoxValue(param);
if (value.equals(gInfo.getParamDefault(param))) {
continue;
}
if (!GUI_ID.equals(param) && !"".equals(value)) {
groupMetaArgs.put(param, value);
}
}
}
String command = "-C";
if ((gInfo != null && !gInfo.getService().isNew())
|| (clInfo != null && !clInfo.getService().isNew())) {
command = "-U";
}
CRM.setParameters(dcHost,
command,
heartbeatId,
cloneId,
master,
cloneMetaArgs,
groupMetaArgs,
groupId,
pacemakerResAttrs,
pacemakerResArgs,
pacemakerMetaArgs,
null,
null,
getOperations(heartbeatId),
null,
getMetaAttrsRefId(),
cloneMetaAttrsRefIds,
groupMetaAttrsRefIds,
refCRMId,
resourceAgent.isStonith(),
testOnly);
if (gInfo == null) {
String hbId = heartbeatId;
if (clInfo != null) {
hbId = clInfo.getHeartbeatId(testOnly);
}
final List<Map<String, String>> colAttrsList =
new ArrayList<Map<String, String>>();
final List<Map<String, String>> ordAttrsList =
new ArrayList<Map<String, String>>();
final List<String> parentIds = new ArrayList<String>();
ServiceInfo infoForDependency;
if (clInfo == null) {
infoForDependency = this;
} else {
infoForDependency = clInfo;
}
final Set<ServiceInfo> parents =
getBrowser().getCRMGraph().getParents(
infoForDependency);
for (final ServiceInfo parentInfo : parents) {
if (parentInfo.isConstraintPH()) {
final boolean colocation = true;
final boolean order = true;
final Set<ServiceInfo> with =
new TreeSet<ServiceInfo>();
with.add(infoForDependency);
final Set<ServiceInfo> withFrom =
new TreeSet<ServiceInfo>();
((ConstraintPHInfo) parentInfo)
.addConstraintWithPlaceholder(
with,
withFrom,
colocation,
order,
dcHost,
!parentInfo.getService().isNew(),
testOnly);
} else {
final String parentId =
parentInfo.getService().getHeartbeatId();
parentIds.add(parentId);
final Map<String, String> colAttrs =
new LinkedHashMap<String, String>();
final Map<String, String> ordAttrs =
new LinkedHashMap<String, String>();
if (getBrowser().getCRMGraph().isColocation(
parentInfo,
infoForDependency)) {
colAttrs.put(CRMXML.SCORE_STRING,
CRMXML.INFINITY_STRING);
if (parentInfo.getService().isMaster()) {
colAttrs.put("with-rsc-role", "Master");
}
colAttrsList.add(colAttrs);
} else {
colAttrsList.add(null);
}
if (getBrowser().getCRMGraph().isOrder(
parentInfo,
infoForDependency)) {
ordAttrs.put(CRMXML.SCORE_STRING,
CRMXML.INFINITY_STRING);
if (parentInfo.getService().isMaster()) {
ordAttrs.put("first-action", "promote");
ordAttrs.put("then-action", "start");
}
ordAttrsList.add(ordAttrs);
} else {
ordAttrsList.add(null);
}
}
}
if (!parentIds.isEmpty()) {
CRM.setOrderAndColocation(dcHost,
hbId,
parentIds.toArray(
new String [parentIds.size()]),
colAttrsList,
ordAttrsList,
testOnly);
}
} else {
gInfo.resetPopup();
}
} else {
if (clInfo != null) {
for (String param : cloneParams) {
if (GUI_ID.equals(param)
|| PCMK_ID.equals(param)) {
continue;
}
final String value = clInfo.getComboBoxValue(param);
if (value.equals(clInfo.getParamDefault(param))) {
continue;
}
if (!"".equals(value)) {
cloneMetaArgs.put(param, value);
}
}
}
if (gInfo != null) {
for (String param : groupParams) {
if (GUI_ID.equals(param)
|| PCMK_ID.equals(param)) {
continue;
}
final String value = gInfo.getComboBoxValue(param);
if (value == null
|| value.equals(gInfo.getParamDefault(param))) {
continue;
}
if (!"".equals(value)) {
groupMetaArgs.put(param, value);
}
}
cloneId = null;
}
groupId = null; /* we don't want to replace the whole group */
//TODO: should not be called if only host locations have
//changed.
final ClusterStatus cs = getBrowser().getClusterStatus();
CRM.setParameters(
dcHost,
"-R",
heartbeatId,
cloneId,
master,
cloneMetaArgs,
groupMetaArgs,
groupId,
pacemakerResAttrs,
pacemakerResArgs,
pacemakerMetaArgs,
cs.getResourceInstanceAttrId(heartbeatId),
cs.getParametersNvpairsIds(heartbeatId),
getOperations(heartbeatId),
cs.getOperationsId(heartbeatId),
getMetaAttrsRefId(),
cloneMetaAttrsRefIds,
groupMetaAttrsRefIds,
refCRMId,
resourceAgent.isStonith(),
testOnly);
if (isFailed(testOnly)) {
cleanupResource(dcHost, testOnly);
}
}
if (gInfo == null) {
if (clInfo == null) {
setLocations(heartbeatId, dcHost, testOnly);
} else {
clInfo.setLocations(heartbeatId, dcHost, testOnly);
}
} else {
setLocations(heartbeatId, dcHost, testOnly);
}
if (!testOnly) {
storeComboBoxValues(params);
storeOperations();
if (clInfo != null) {
clInfo.storeComboBoxValues(cloneParams);
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
setApplyButtons(null, params);
final DefaultMutableTreeNode node = getNode();
if (node != null) {
if (clInfo == null) {
getBrowser().reload(node, false);
} else {
getBrowser().reload(clInfo.getNode(), false);
getBrowser().reload(node, false);
}
getBrowser().getCRMGraph().repaint();
}
}
});
}
}
/** Removes order(s). */
public void removeOrder(final ServiceInfo parent,
final Host dcHost,
final boolean testOnly) {
if (getService().isNew() || parent.getService().isNew()) {
return;
}
if (!testOnly
&& !getService().isNew() && !parent.getService().isNew()) {
parent.setUpdated(true);
setUpdated(true);
}
final ClusterStatus clStatus = getBrowser().getClusterStatus();
String rscId;
if (isConstraintPH()) {
rscId = getId();
} else {
rscId = getHeartbeatId(testOnly);
}
if (isConstraintPH() || parent.isConstraintPH()) {
ConstraintPHInfo cphi = null;
if (isConstraintPH()) {
cphi = (ConstraintPHInfo) this;
} else {
cphi = (ConstraintPHInfo) parent;
}
final Map<CRMXML.RscSet, Map<String, String>> rscSetsOrdAttrs =
new LinkedHashMap<CRMXML.RscSet, Map<String, String>>();
final CRMXML.RscSetConnectionData rdata =
cphi.getRscSetConnectionDataOrd();
/** resource set */
final String ordId = rdata.getConstraintId();
String idToRemove;
if (isConstraintPH()) {
idToRemove = parent.getService().getHeartbeatId();
} else {
idToRemove = getService().getHeartbeatId();
}
CRMXML.RscSet modifiedRscSet = null;
final List<CRMXML.RscSet> ordRscSets =
clStatus.getRscSetsOrd(ordId);
if (ordRscSets != null) {
for (final CRMXML.RscSet rscSet : ordRscSets) {
if (rscSet.equals(rdata.getRscSet1())
|| rscSet.equals(rdata.getRscSet2())) {
final List<String> newRscIds =
new ArrayList<String>();
newRscIds.addAll(rscSet.getRscIds());
if (newRscIds.remove(idToRemove) && !testOnly) {
modifiedRscSet = rscSet;
}
if (!newRscIds.isEmpty()) {
final CRMXML.RscSet newRscSet =
new CRMXML.RscSet(
rscSet.getId(),
newRscIds,
rscSet.getSequential(),
rscSet.getRequireAll(),
rscSet.getOrderAction(),
rscSet.getColocationRole());
rscSetsOrdAttrs.put(newRscSet, null);
}
} else {
rscSetsOrdAttrs.put(rscSet, null);
}
}
}
if (!testOnly && rscSetsOrdAttrs.isEmpty()) {
cphi.getRscSetConnectionDataOrd().setConstraintId(null);
}
final Map<String, String> attrs =
new LinkedHashMap<String, String>();
final CRMXML.OrderData od = clStatus.getOrderData(ordId);
if (od != null) {
final String score = od.getScore();
attrs.put(CRMXML.SCORE_STRING, score);
}
if (!testOnly) {
///* so that it will not be removed */
cphi.setUpdated(false);
}
CRM.setRscSet(dcHost,
null,
false,
ordId,
false,
null,
rscSetsOrdAttrs,
attrs,
testOnly);
} else {
final String rscFirstId = parent.getHeartbeatId(testOnly);
final List<CRMXML.OrderData> allData =
clStatus.getOrderDatas(rscFirstId);
if (allData != null) {
for (final CRMXML.OrderData orderData : allData) {
final String orderId = orderData.getId();
final String rscThenId = orderData.getRscThen();
if (rscThenId.equals(getHeartbeatId(testOnly))) {
CRM.removeOrder(dcHost,
orderId,
testOnly);
}
}
}
}
}
/** Returns pacemaker id. */
final String getHeartbeatId(final boolean testOnly) {
String heartbeatId = getService().getHeartbeatId();
if (testOnly && heartbeatId == null) {
heartbeatId = getService().getCrmIdFromId(getComboBoxValue(GUI_ID));
}
return heartbeatId;
}
/** Adds order constraint from this service to the child. */
public void addOrder(final ServiceInfo child,
final Host dcHost,
final boolean testOnly) {
if (!testOnly
&& !getService().isNew() && !child.getService().isNew()) {
child.setUpdated(true);
setUpdated(true);
}
if (isConstraintPH() || child.isConstraintPH()) {
if (!testOnly) {
if (isConstraintPH()
&& ((ConstraintPHInfo) this).isReversedCol()) {
((ConstraintPHInfo) this).reverseOrder();
} else if (child.isConstraintPH()
&& ((ConstraintPHInfo) child).isReversedCol()) {
((ConstraintPHInfo) child).reverseOrder();
}
}
final ConstraintPHInfo cphi;
final ServiceInfo withService;
final Set<ServiceInfo> withFrom = new TreeSet<ServiceInfo>();
if (isConstraintPH()) {
cphi = (ConstraintPHInfo) this;
withService = child;
} else {
cphi = (ConstraintPHInfo) child;
withService = this;
withFrom.add(this);
}
final Set<ServiceInfo> with = new TreeSet<ServiceInfo>();
with.add(withService);
cphi.addConstraintWithPlaceholder(with,
withFrom,
false,
true,
dcHost,
!cphi.getService().isNew(),
testOnly);
} else {
final String childHbId = child.getHeartbeatId(testOnly);
final Map<String, String> attrs =
new LinkedHashMap<String, String>();
attrs.put(CRMXML.SCORE_STRING, CRMXML.INFINITY_STRING);
final CloneInfo chCI = child.getCloneInfo();
if (chCI != null
&& chCI.getService().isMaster()) {
attrs.put("first-action", "promote");
attrs.put("then-action", "start");
}
CRM.addOrder(dcHost,
null, /* order id */
getHeartbeatId(testOnly),
childHbId,
attrs,
testOnly);
}
}
/** Removes colocation(s). */
public void removeColocation(final ServiceInfo parent,
final Host dcHost,
final boolean testOnly) {
if (getService().isNew() || parent.getService().isNew()) {
return;
}
if (!testOnly
&& !getService().isNew() && !parent.getService().isNew()) {
parent.setUpdated(true);
setUpdated(true);
}
final ClusterStatus clStatus = getBrowser().getClusterStatus();
String rscId;
if (isConstraintPH()) {
rscId = getId();
} else {
rscId = getHeartbeatId(testOnly);
}
if (isConstraintPH() || parent.isConstraintPH()) {
final Map<CRMXML.RscSet, Map<String, String>> rscSetsColAttrs =
new LinkedHashMap<CRMXML.RscSet, Map<String, String>>();
ConstraintPHInfo cphi = null;
if (isConstraintPH()) {
cphi = (ConstraintPHInfo) this;
} else {
cphi = (ConstraintPHInfo) parent;
}
final CRMXML.RscSetConnectionData rdata =
cphi.getRscSetConnectionDataCol();
/** resource set */
final String colId = rdata.getConstraintId();
String idToRemove;
if (isConstraintPH()) {
idToRemove = parent.getService().getHeartbeatId();
} else {
idToRemove = getService().getHeartbeatId();
}
CRMXML.RscSet modifiedRscSet = null;
final List<CRMXML.RscSet> colRscSets =
clStatus.getRscSetsCol(colId);
if (colRscSets != null) {
for (final CRMXML.RscSet rscSet : colRscSets) {
if (rscSet.equals(rdata.getRscSet1())
|| rscSet.equals(rdata.getRscSet2())) {
final List<String> newRscIds =
new ArrayList<String>();
newRscIds.addAll(rscSet.getRscIds());
if (newRscIds.remove(idToRemove) && !testOnly) {
modifiedRscSet = rscSet;
}
if (!newRscIds.isEmpty()) {
final CRMXML.RscSet newRscSet =
new CRMXML.RscSet(
rscSet.getId(),
newRscIds,
rscSet.getSequential(),
rscSet.getRequireAll(),
rscSet.getOrderAction(),
rscSet.getColocationRole());
rscSetsColAttrs.put(newRscSet, null);
}
} else {
rscSetsColAttrs.put(rscSet, null);
}
}
}
if (!testOnly && rscSetsColAttrs.isEmpty()) {
cphi.getRscSetConnectionDataCol().setConstraintId(null);
}
final Map<String, String> attrs =
new LinkedHashMap<String, String>();
final CRMXML.ColocationData cd = clStatus.getColocationData(colId);
if (cd != null) {
final String score = cd.getScore();
attrs.put(CRMXML.SCORE_STRING, score);
}
if (!testOnly) {
cphi.setUpdated(false);
}
CRM.setRscSet(dcHost,
colId,
false,
null,
false,
rscSetsColAttrs,
null,
attrs,
testOnly);
} else {
final List<CRMXML.ColocationData> allData =
clStatus.getColocationDatas(rscId);
if (allData != null) {
for (final CRMXML.ColocationData colocationData
: allData) {
final String colId = colocationData.getId();
final String withRscId =
colocationData.getWithRsc();
if (withRscId.equals(
parent.getHeartbeatId(testOnly))) {
CRM.removeColocation(dcHost,
colId,
testOnly);
}
}
}
}
}
/**
* Adds colocation constraint from this service to the child. The
* child - child order is here important, in case colocation
* constraint is used along with order constraint.
*/
public void addColocation(final ServiceInfo child,
final Host dcHost,
final boolean testOnly) {
if (!testOnly
&& !getService().isNew() && !child.getService().isNew()) {
child.setUpdated(true);
setUpdated(true);
}
if (isConstraintPH() || child.isConstraintPH()) {
if (!testOnly) {
if (isConstraintPH()
&& ((ConstraintPHInfo) this).isReversedOrd()) {
((ConstraintPHInfo) this).reverseColocation();
} else if (child.isConstraintPH()
&& ((ConstraintPHInfo) child).isReversedOrd()) {
((ConstraintPHInfo) child).reverseColocation();
}
}
final ConstraintPHInfo cphi;
final ServiceInfo withService;
final Set<ServiceInfo> withFrom = new TreeSet<ServiceInfo>();
if (isConstraintPH()) {
cphi = (ConstraintPHInfo) this;
withService = child;
} else {
cphi = (ConstraintPHInfo) child;
withService = this;
withFrom.add(this);
}
final Set<ServiceInfo> with = new TreeSet<ServiceInfo>();
with.add(withService);
cphi.addConstraintWithPlaceholder(with,
withFrom,
true,
false,
dcHost,
!cphi.getService().isNew(),
testOnly);
} else {
final String childHbId = child.getHeartbeatId(testOnly);
final Map<String, String> attrs =
new LinkedHashMap<String, String>();
attrs.put(CRMXML.SCORE_STRING, CRMXML.INFINITY_STRING);
final CloneInfo pCI = child.getCloneInfo();
if (pCI != null
&& pCI.getService().isMaster()) {
attrs.put("with-rsc-role", "Master");
}
CRM.addColocation(dcHost,
null, /* col id */
childHbId,
getHeartbeatId(testOnly),
attrs,
testOnly);
}
}
/** Returns panel with graph. */
@Override
public JPanel getGraphicalView() {
return getBrowser().getCRMGraph().getGraphPanel();
}
/** Adds service panel to the position 'pos'. */
public ServiceInfo addServicePanel(final ResourceAgent newRA,
final Point2D pos,
final boolean colocation,
final boolean order,
final boolean reloadNode,
final boolean master,
final boolean testOnly) {
ServiceInfo newServiceInfo;
final String name = newRA.getName();
if (newRA.isFilesystem()) {
newServiceInfo = new FilesystemInfo(name, newRA, getBrowser());
} else if (newRA.isLinbitDrbd()) {
newServiceInfo = new LinbitDrbdInfo(name, newRA, getBrowser());
} else if (newRA.isDrbddisk()) {
newServiceInfo = new DrbddiskInfo(name, newRA, getBrowser());
} else if (newRA.isIPaddr()) {
newServiceInfo = new IPaddrInfo(name, newRA, getBrowser());
} else if (newRA.isVirtualDomain()) {
newServiceInfo = new VirtualDomainInfo(name, newRA, getBrowser());
} else if (newRA.isGroup()) {
newServiceInfo = new GroupInfo(newRA, getBrowser());
} else if (newRA.isClone()) {
String cloneName;
if (master) {
cloneName = ConfigData.PM_MASTER_SLAVE_SET_NAME;
} else {
cloneName = ConfigData.PM_CLONE_SET_NAME;
}
newServiceInfo = new CloneInfo(newRA,
cloneName,
master,
getBrowser());
} else {
newServiceInfo = new ServiceInfo(name, newRA, getBrowser());
}
addServicePanel(newServiceInfo,
pos,
colocation,
order,
reloadNode,
getBrowser().getDCHost(),
testOnly);
return newServiceInfo;
}
/**
* Adds service panel to the position 'pos'.
* TODO: is it used?
*/
public void addServicePanel(final ServiceInfo serviceInfo,
final Point2D pos,
final boolean colocation,
final boolean order,
final boolean reloadNode,
final Host dcHost,
final boolean testOnly) {
final ResourceAgent ra = serviceInfo.getResourceAgent();
if (ra != null) {
serviceInfo.getService().setResourceClass(ra.getResourceClass());
}
if (getBrowser().getCRMGraph().addResource(serviceInfo,
this,
pos,
colocation,
order,
testOnly)) {
Tools.waitForSwing();
/* edge added */
if (isConstraintPH() || serviceInfo.isConstraintPH()) {
final ConstraintPHInfo cphi;
final ServiceInfo withService;
final Set<ServiceInfo> withFrom = new TreeSet<ServiceInfo>();
if (isConstraintPH()) {
cphi = (ConstraintPHInfo) this;
withService = serviceInfo;
} else {
cphi = (ConstraintPHInfo) serviceInfo;
withService = this;
withFrom.add(this);
}
withFrom.addAll(getBrowser().getCRMGraph().getParents(cphi));
final Set<ServiceInfo> with = new TreeSet<ServiceInfo>();
with.add(withService);
cphi.addConstraintWithPlaceholder(with,
withFrom,
colocation,
order,
dcHost,
!cphi.getService().isNew(),
testOnly);
if (!testOnly) {
final PcmkRscSetsInfo prsi = cphi.getPcmkRscSetsInfo();
prsi.setApplyButtons(null, prsi.getParametersFromXML());
}
} else {
final String parentId = getHeartbeatId(testOnly);
final String heartbeatId = serviceInfo.getHeartbeatId(testOnly);
final List<Map<String, String>> colAttrsList =
new ArrayList<Map<String, String>>();
final List<Map<String, String>> ordAttrsList =
new ArrayList<Map<String, String>>();
final Map<String, String> colAttrs =
new LinkedHashMap<String, String>();
final Map<String, String> ordAttrs =
new LinkedHashMap<String, String>();
colAttrs.put(CRMXML.SCORE_STRING, CRMXML.INFINITY_STRING);
ordAttrs.put(CRMXML.SCORE_STRING, CRMXML.INFINITY_STRING);
if (getService().isMaster()) {
colAttrs.put("with-rsc-role", "Master");
ordAttrs.put("first-action", "promote");
ordAttrs.put("then-action", "start");
}
if (colocation) {
colAttrsList.add(colAttrs);
} else {
colAttrsList.add(null);
}
if (order) {
ordAttrsList.add(ordAttrs);
} else {
ordAttrsList.add(null);
}
if (!getService().isNew()
&& !serviceInfo.getService().isNew()) {
CRM.setOrderAndColocation(dcHost,
heartbeatId,
new String[]{parentId},
colAttrsList,
ordAttrsList,
testOnly);
}
}
} else {
getBrowser().addNameToServiceInfoHash(serviceInfo);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final DefaultMutableTreeNode newServiceNode =
new DefaultMutableTreeNode(serviceInfo);
serviceInfo.setNode(newServiceNode);
getBrowser().getServicesNode().add(newServiceNode);
if (reloadNode) {
getBrowser().reloadAndWait(
getBrowser().getServicesNode(), false);
getBrowser().reloadAndWait(newServiceNode, false);
}
}
});
getBrowser().reloadAllComboBoxes(serviceInfo);
}
if (reloadNode && ra != null && serviceInfo.getResource().isNew()) {
if (ra.isProbablyMasterSlave()) {
serviceInfo.changeType(MASTER_SLAVE_TYPE_STRING);
} else if (ra.isProbablyClone()) {
serviceInfo.changeType(CLONE_TYPE_STRING);
}
}
getBrowser().getCRMGraph().reloadServiceMenus();
if (reloadNode) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
getBrowser().getCRMGraph().scale();
}
});
}
}
/** Returns service that belongs to this info object. */
public Service getService() {
return (Service) getResource();
}
/** Starts resource in crm. */
void startResource(final Host dcHost, final boolean testOnly) {
if (!testOnly) {
setUpdated(true);
}
CRM.startResource(dcHost, getHeartbeatId(testOnly), testOnly);
}
/** Stops resource in crm. */
void stopResource(final Host dcHost, final boolean testOnly) {
if (!testOnly) {
setUpdated(true);
}
CRM.stopResource(dcHost, getHeartbeatId(testOnly), testOnly);
}
/** Puts a resource up in a group. */
void upResource(final Host dcHost, final boolean testOnly) {
final GroupInfo gi = groupInfo;
final DefaultMutableTreeNode giNode = gi.getNode();
if (giNode == null) {
return;
}
final DefaultMutableTreeNode node = getNode();
if (node == null) {
return;
}
final int index = giNode.getIndex(node);
if (index > 0) {
@SuppressWarnings("unchecked")
final Enumeration<DefaultMutableTreeNode> e = giNode.children();
final List<String> newOrder = new ArrayList<String>();
while (e.hasMoreElements()) {
final DefaultMutableTreeNode n = e.nextElement();
final ServiceInfo child = (ServiceInfo) n.getUserObject();
newOrder.add(child.getHeartbeatId(testOnly));
}
final String el = newOrder.remove(index);
newOrder.add(index - 1, el);
if (!testOnly) {
setUpdated(true);
}
gi.applyWhole(dcHost, false, newOrder, testOnly);
}
}
/** Puts a resource down in a group. */
void downResource(final Host dcHost, final boolean testOnly) {
final GroupInfo gi = groupInfo;
final DefaultMutableTreeNode giNode = gi.getNode();
if (giNode == null) {
return;
}
final DefaultMutableTreeNode node = getNode();
if (node == null) {
return;
}
final int index = giNode.getIndex(node);
if (index < giNode.getChildCount() - 1) {
@SuppressWarnings("unchecked")
final Enumeration<DefaultMutableTreeNode> e = giNode.children();
final List<String> newOrder = new ArrayList<String>();
while (e.hasMoreElements()) {
final DefaultMutableTreeNode n = e.nextElement();
final ServiceInfo child = (ServiceInfo) n.getUserObject();
newOrder.add(child.getHeartbeatId(testOnly));
}
final String el = newOrder.remove(index);
newOrder.add(index + 1, el);
if (!testOnly) {
setUpdated(true);
}
gi.applyWhole(dcHost, false, newOrder, testOnly);
}
}
/** Migrates resource in cluster from current location. */
void migrateResource(final String onHost,
final Host dcHost,
final boolean testOnly) {
if (!testOnly) {
setUpdated(true);
}
CRM.migrateResource(dcHost,
getHeartbeatId(testOnly),
onHost,
testOnly);
}
/** Migrates resource in heartbeat from current location. */
void migrateFromResource(final Host dcHost,
final String fromHost,
final boolean testOnly) {
if (!testOnly) {
setUpdated(true);
}
/* don't need fromHost, but m/s resources need it. */
CRM.migrateFromResource(dcHost,
getHeartbeatId(testOnly),
testOnly);
}
/**
* Migrates resource in cluster from current location with --force option.
*/
void forceMigrateResource(final String onHost,
final Host dcHost,
final boolean testOnly) {
if (!testOnly) {
setUpdated(true);
}
CRM.forceMigrateResource(dcHost,
getHeartbeatId(testOnly),
onHost,
testOnly);
}
/** Removes constraints created by resource migrate command. */
void unmigrateResource(final Host dcHost, final boolean testOnly) {
if (!testOnly) {
setUpdated(true);
}
CRM.unmigrateResource(dcHost, getHeartbeatId(testOnly), testOnly);
}
/** Cleans up the resource. */
void cleanupResource(final Host dcHost, final boolean testOnly) {
if (!testOnly) {
setUpdated(true);
}
final ClusterStatus cs = getBrowser().getClusterStatus();
final String rscId = getHeartbeatId(testOnly);
boolean failedClone = false;
for (final Host host : getBrowser().getClusterHosts()) {
final Set<String> failedClones =
cs.getFailedClones(host.getName(), rscId, testOnly);
if (failedClones == null) {
continue;
}
failedClone = true;
for (final String fc : failedClones) {
CRM.cleanupResource(dcHost,
rscId + ":" + fc,
new Host[]{host},
testOnly);
}
}
if (!failedClone) {
final List<Host> dirtyHosts = new ArrayList<Host>();
for (final Host host : getBrowser().getClusterHosts()) {
if (isInLRMOnHost(host.getName(), testOnly)
|| getFailCount(host.getName(), testOnly) != null) {
dirtyHosts.add(host);
}
}
if (!dirtyHosts.isEmpty()) {
CRM.cleanupResource(
dcHost,
rscId,
dirtyHosts.toArray(new Host[dirtyHosts.size()]),
testOnly);
}
}
}
/** Removes the service without confirmation dialog. */
protected void removeMyselfNoConfirm(final Host dcHost,
final boolean testOnly) {
if (!testOnly) {
if (!getService().isNew()) {
setUpdated(true);
}
getService().setRemoved(true);
cleanup();
}
final CloneInfo ci = getCloneInfo();
if (ci != null) {
ci.removeMyselfNoConfirm(dcHost, testOnly);
setCloneInfo(null);
}
final GroupInfo gi = groupInfo;
if (getService().isNew() && gi == null) {
if (!testOnly) {
getService().setNew(false);
getBrowser().getCRMGraph().killRemovedVertices();
}
} else {
final ClusterStatus cs = getBrowser().getClusterStatus();
if (gi == null) {
removeConstraints(dcHost, testOnly);
}
if (!getResourceAgent().isGroup()
&& !getResourceAgent().isClone()) {
String groupId = null; /* for pacemaker */
if (gi != null) {
/* get group id only if there is only one resource in a
* group.
*/
if (getService().isNew()) {
if (!testOnly) {
super.removeMyself(false);
}
} else {
final String group = gi.getHeartbeatId(testOnly);
final DefaultMutableTreeNode giNode = gi.getNode();
if (giNode != null) {
@SuppressWarnings("unchecked")
final Enumeration<DefaultMutableTreeNode> e =
giNode.children();
while (e.hasMoreElements()) {
final DefaultMutableTreeNode n =
e.nextElement();
final ServiceInfo child =
(ServiceInfo) n.getUserObject();
child.getService().setModified(true);
child.getService().doneModifying();
}
}
if (cs.getGroupResources(group, testOnly).size() == 1) {
if (!testOnly) {
gi.getService().setRemoved(true);
}
gi.removeMyselfNoConfirmFromChild(dcHost, testOnly);
groupId = group;
gi.getService().doneRemoving();
}
}
gi.resetPopup();
}
if (!getService().isNew()) {
String cloneId = null;
boolean master = false;
if (ci != null) {
cloneId = ci.getHeartbeatId(testOnly);
master = ci.getService().isMaster();
}
final boolean ret = CRM.removeResource(
dcHost,
getHeartbeatId(testOnly),
groupId,
cloneId,
master,
testOnly);
cleanupResource(dcHost, testOnly);
setUpdated(false); /* must be here, is not a clone anymore*/
if (!testOnly && !ret) {
Tools.progressIndicatorFailed(dcHost.getName(),
"removing failed");
}
}
}
}
if (!testOnly) {
getBrowser().removeFromServiceInfoHash(this);
infoPanel = null;
getService().doneRemoving();
}
}
/** Removes this service from the crm with confirmation dialog. */
@Override
public void removeMyself(final boolean testOnly) {
if (getService().isNew()) {
removeMyselfNoConfirm(getBrowser().getDCHost(), testOnly);
getService().setNew(false);
getService().doneRemoving();
return;
}
String desc = Tools.getString(
"ClusterBrowser.confirmRemoveService.Description");
desc = desc.replaceAll("@SERVICE@",
Matcher.quoteReplacement(toString()));
if (Tools.confirmDialog(
Tools.getString("ClusterBrowser.confirmRemoveService.Title"),
desc,
Tools.getString("ClusterBrowser.confirmRemoveService.Yes"),
Tools.getString("ClusterBrowser.confirmRemoveService.No"))) {
removeMyselfNoConfirm(getBrowser().getDCHost(), testOnly);
removeInfo();
getService().setNew(false);
}
}
/** Removes the service from some global hashes and lists. */
public void removeInfo() {
getBrowser().mHeartbeatIdToServiceLock();
getBrowser().getHeartbeatIdToServiceInfo().remove(
getService().getHeartbeatId());
getBrowser().mHeartbeatIdToServiceUnlock();
getBrowser().removeFromServiceInfoHash(this);
final CloneInfo ci = cloneInfo;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
removeNodeAndWait();
if (ci != null) {
ci.removeNodeAndWait();
}
}
});
super.removeMyself(false);
}
/** Sets this service as part of a group. */
void setGroupInfo(final GroupInfo groupInfo) {
this.groupInfo = groupInfo;
}
/** Sets this service as part of a clone set. */
void setCloneInfo(final CloneInfo cloneInfo) {
this.cloneInfo = cloneInfo;
}
/**
* Returns the group to which this service belongs or null, if it is
* not in any group.
*/
public GroupInfo getGroupInfo() {
return groupInfo;
}
/**
* Returns the clone set to which this service belongs
* or null, if it is not in such set.
*/
CloneInfo getCloneInfo() {
return cloneInfo;
}
/** Adds existing service menu item for every member of a group. */
protected void addExistingGroupServiceMenuItems(
final ServiceInfo asi,
final MyListModel<MyMenuItem> dlm,
final Map<MyMenuItem, ButtonCallback> callbackHash,
final MyList<MyMenuItem> list,
final JCheckBox colocationWi,
final JCheckBox orderWi,
final List<JDialog> popups,
final boolean testOnly) {
/* empty */
}
/** Adds existing service menu item. */
protected void addExistingServiceMenuItem(
final String name,
final ServiceInfo asi,
final MyListModel<MyMenuItem> dlm,
final Map<MyMenuItem, ButtonCallback> callbackHash,
final MyList<MyMenuItem> list,
final JCheckBox colocationWi,
final JCheckBox orderWi,
final List<JDialog> popups,
final boolean testOnly) {
final MyMenuItem mmi = new MyMenuItem(name,
null,
null,
new AccessMode(
ConfigData.AccessType.ADMIN,
false),
new AccessMode(
ConfigData.AccessType.OP,
false)) {
private static final long serialVersionUID = 1L;
@Override
public void action() {
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
hidePopup();
for (final JDialog otherP : popups) {
otherP.dispose();
}
addServicePanel(asi,
null,
colocationWi.isSelected(),
orderWi.isSelected(),
true,
getBrowser().getDCHost(),
testOnly);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
repaint();
}
});
}
});
thread.start();
}
};
dlm.addElement(mmi);
final ClusterBrowser.ClMenuItemCallback mmiCallback =
getBrowser().new ClMenuItemCallback(list, null) {
@Override
public void action(final Host dcHost) {
addServicePanel(asi,
null,
colocationWi.isSelected(),
orderWi.isSelected(),
true,
dcHost,
true); /* test only */
}
};
callbackHash.put(mmi, mmiCallback);
}
/** Returns existing service manu item. */
private MyMenu getExistingServiceMenuItem(final String name,
final boolean enableForNew,
final boolean testOnly) {
final ServiceInfo thisClass = this;
return new MyMenu(name,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
private final Lock mUpdateLock = new ReentrantLock();
@Override
public String enablePredicate() {
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else if (getService().isRemoved()) {
return IS_BEING_REMOVED_STRING;
} else if (getService().isOrphaned()) {
return IS_ORPHANED_STRING;
} else if (!enableForNew && getService().isNew()) {
return IS_NEW_STRING;
}
if (getBrowser().getExistingServiceList(thisClass).size()
== 0) {
return "<<empty;>>";
}
return null;
}
@Override
public void update() {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
if (mUpdateLock.tryLock()) {
try {
updateThread();
} finally {
mUpdateLock.unlock();
}
}
}
});
t.start();
}
private void updateThread() {
final JCheckBox colocationWi = new JCheckBox("Colo", true);
final JCheckBox orderWi = new JCheckBox("Order", true);
colocationWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
colocationWi.setPreferredSize(colocationWi.getMinimumSize());
orderWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
orderWi.setPreferredSize(orderWi.getMinimumSize());
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setEnabled(false);
}
});
Tools.invokeAndWait(new Runnable() {
@Override
public void run() {
removeAll();
}
});
final MyListModel<MyMenuItem> dlm =
new MyListModel<MyMenuItem>();
final Map<MyMenuItem, ButtonCallback> callbackHash =
new HashMap<MyMenuItem, ButtonCallback>();
final MyList<MyMenuItem> list =
new MyList<MyMenuItem>(dlm, getBackground());
final List<JDialog> popups = new ArrayList<JDialog>();
for (final ServiceInfo asi
: getBrowser().getExistingServiceList(thisClass)) {
if (asi.isConstraintPH() && isConstraintPH()) {
continue;
}
if (asi.getCloneInfo() != null
|| asi.getGroupInfo() != null) {
/* skip services that are clones or in groups. */
continue;
}
addExistingServiceMenuItem(asi.toString(),
asi,
dlm,
callbackHash,
list,
colocationWi,
orderWi,
popups,
testOnly);
asi.addExistingGroupServiceMenuItems(thisClass,
dlm,
callbackHash,
list,
colocationWi,
orderWi,
popups,
testOnly);
}
final JPanel colOrdPanel =
new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
colOrdPanel.setBackground(ClusterBrowser.STATUS_BACKGROUND);
colOrdPanel.add(colocationWi);
colOrdPanel.add(orderWi);
final MyMenu thisM = this;
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
final boolean ret =
Tools.getScrollingMenu(name,
colOrdPanel,
thisM,
dlm,
list,
thisClass,
popups,
callbackHash);
if (!ret) {
setEnabled(false);
}
}
});
} catch (final InterruptedException ix) {
Thread.currentThread().interrupt();
} catch (final InvocationTargetException x) {
Tools.printStackTrace();
}
super.update();
}
};
}
/** Adds Linbit DRBD RA menu item. It is called in swing thread. */
private void addDrbdLinbitMenu(final MyMenu menu,
final CRMXML crmXML,
final Point2D pos,
final ResourceAgent fsService,
final boolean testOnly) {
final MyMenuItem ldMenuItem = new MyMenuItem(
Tools.getString("ClusterBrowser.linbitDrbdMenuName"),
null,
null,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public void action() {
hidePopup();
if (!getBrowser().linbitDrbdConfirmDialog()) {
return;
}
final FilesystemInfo fsi = (FilesystemInfo)
addServicePanel(
fsService,
getPos(),
true, /* colocation */
true, /* order */
true,
false,
testOnly);
fsi.setDrbddiskIsPreferred(false);
getBrowser().getCRMGraph().repaint();
}
};
if (getBrowser().atLeastOneDrbddisk()
|| !crmXML.isLinbitDrbdPresent()) {
ldMenuItem.setEnabled(false);
}
ldMenuItem.setPos(pos);
menu.add(ldMenuItem);
}
/** Adds drbddisk RA menu item. It is called in swing thread. */
private void addDrbddiskMenu(final MyMenu menu,
final CRMXML crmXML,
final Point2D pos,
final ResourceAgent fsService,
final boolean testOnly) {
final ResourceAgent drbddiskService = crmXML.getHbDrbddisk();
final MyMenuItem ddMenuItem = new MyMenuItem(
Tools.getString("ClusterBrowser.DrbddiskMenuName"),
null,
null,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public void action() {
hidePopup();
final FilesystemInfo fsi = (FilesystemInfo) addServicePanel(
fsService,
getPos(),
true, /* colocation */
true, /* order */
true,
false,
testOnly);
fsi.setDrbddiskIsPreferred(true);
getBrowser().getCRMGraph().repaint();
}
};
if (getBrowser().isOneLinbitDrbd()
|| !crmXML.isDrbddiskPresent()) {
ddMenuItem.setEnabled(false);
}
ddMenuItem.setPos(pos);
menu.add(ddMenuItem);
}
/** Adds Ipaddr RA menu item. It is called in swing thread. */
private void addIpMenu(final MyMenu menu,
final Point2D pos,
final ResourceAgent ipService,
final boolean testOnly) {
final MyMenuItem ipMenuItem =
new MyMenuItem(ipService.getMenuName(),
null,
null,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public void action() {
hidePopup();
addServicePanel(ipService,
getPos(),
true, /* colocation */
true, /* order */
true,
false,
testOnly);
getBrowser().getCRMGraph().repaint();
}
};
ipMenuItem.setPos(pos);
menu.add(ipMenuItem);
}
/** Adds Filesystem RA menu item. It is called in swing thread. */
private void addFilesystemMenu(final MyMenu menu,
final Point2D pos,
final ResourceAgent fsService,
final boolean testOnly) {
final MyMenuItem fsMenuItem =
new MyMenuItem(fsService.getMenuName(),
null,
null,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public void action() {
hidePopup();
addServicePanel(fsService,
getPos(),
true, /* colocation */
true, /* order */
true,
false,
testOnly);
getBrowser().getCRMGraph().repaint();
}
};
fsMenuItem.setPos(pos);
menu.add(fsMenuItem);
}
/** Adds resource agent RA menu item. It is called in swing thread. */
private void addResourceAgentMenu(final ResourceAgent ra,
final MyListModel<MyMenuItem> dlm,
final Point2D pos,
final List<JDialog> popups,
final JCheckBox colocationWi,
final JCheckBox orderWi,
final boolean testOnly) {
final MyMenuItem mmi =
new MyMenuItem(
ra.getMenuName(),
null,
null,
new AccessMode(ConfigData.AccessType.ADMIN,
false),
new AccessMode(ConfigData.AccessType.OP,
false)) {
private static final long serialVersionUID = 1L;
@Override
public void action() {
hidePopup();
for (final JDialog otherP : popups) {
otherP.dispose();
}
if (ra.isLinbitDrbd()
&&
!getBrowser().linbitDrbdConfirmDialog()) {
return;
} else if (ra.isHbDrbd()
&& !getBrowser().hbDrbdConfirmDialog()) {
return;
}
addServicePanel(ra,
getPos(),
colocationWi.isSelected(),
orderWi.isSelected(),
true,
false,
testOnly);
getBrowser().getCRMGraph().repaint();
}
};
mmi.setPos(pos);
dlm.addElement(mmi);
}
/** Adds new Service and dependence. */
private MyMenu getAddServiceMenuItem(final boolean testOnly,
final String name) {
final ServiceInfo thisClass = this;
return new MyMenu(name,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
private final Lock mUpdateLock = new ReentrantLock();
@Override
public String enablePredicate() {
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else if (getService().isRemoved()) {
return IS_BEING_REMOVED_STRING;
} else if (getService().isOrphaned()) {
return IS_ORPHANED_STRING;
} else if (getService().isNew()) {
return IS_NEW_STRING;
}
return null;
}
@Override
public void update() {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
if (mUpdateLock.tryLock()) {
try {
updateThread();
} finally {
mUpdateLock.unlock();
}
}
}
});
t.start();
}
private void updateThread() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setEnabled(false);
}
});
Tools.invokeAndWait(new Runnable() {
@Override
public void run() {
removeAll();
}
});
final Point2D pos = getPos();
final CRMXML crmXML = getBrowser().getCRMXML();
final ResourceAgent fsService =
crmXML.getResourceAgent("Filesystem",
ResourceAgent.HEARTBEAT_PROVIDER,
ResourceAgent.OCF_CLASS);
final MyMenu thisMenu = this;
if (crmXML.isLinbitDrbdPresent()) { /* just skip it, if it
is not */
final ResourceAgent linbitDrbdService =
crmXML.getHbLinbitDrbd();
/* Linbit:DRBD */
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
addDrbdLinbitMenu(thisMenu,
crmXML,
pos,
fsService,
testOnly);
}
});
} catch (final InterruptedException ix) {
Thread.currentThread().interrupt();
} catch (final InvocationTargetException x) {
Tools.printStackTrace();
}
}
if (crmXML.isDrbddiskPresent()) { /* just skip it,
if it is not */
/* drbddisk */
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
addDrbddiskMenu(thisMenu,
crmXML,
pos,
fsService,
testOnly);
}
});
} catch (final InterruptedException ix) {
Thread.currentThread().interrupt();
} catch (final InvocationTargetException x) {
Tools.printStackTrace();
}
}
final ResourceAgent ipService = crmXML.getResourceAgent(
"IPaddr2",
ResourceAgent.HEARTBEAT_PROVIDER,
ResourceAgent.OCF_CLASS);
if (ipService != null) { /* just skip it, if it is not*/
/* ipaddr */
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
addIpMenu(thisMenu,
pos,
ipService,
testOnly);
}
});
} catch (final InterruptedException ix) {
Thread.currentThread().interrupt();
} catch (final InvocationTargetException x) {
Tools.printStackTrace();
}
}
if (fsService != null) { /* just skip it, if it is not*/
/* Filesystem */
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
addFilesystemMenu(thisMenu,
pos,
fsService,
testOnly);
}
});
} catch (final InterruptedException ix) {
Thread.currentThread().interrupt();
} catch (final InvocationTargetException x) {
Tools.printStackTrace();
}
}
final List<JDialog> popups = new ArrayList<JDialog>();
for (final String cl : ClusterBrowser.HB_CLASSES) {
final List<ResourceAgent> services = getAddServiceList(cl);
if (services.isEmpty()) {
/* no services, don't show */
continue;
}
final JCheckBox colocationWi = new JCheckBox("Colo", true);
final JCheckBox orderWi = new JCheckBox("Order", true);
colocationWi.setBackground(
ClusterBrowser.STATUS_BACKGROUND);
colocationWi.setPreferredSize(
colocationWi.getMinimumSize());
orderWi.setBackground(ClusterBrowser.STATUS_BACKGROUND);
orderWi.setPreferredSize(orderWi.getMinimumSize());
final JPanel colOrdPanel =
new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
colOrdPanel.setBackground(ClusterBrowser.STATUS_BACKGROUND);
colOrdPanel.add(colocationWi);
colOrdPanel.add(orderWi);
boolean mode = !AccessMode.ADVANCED;
if (ResourceAgent.UPSTART_CLASS.equals(cl)
|| ResourceAgent.SYSTEMD_CLASS.equals(cl)) {
mode = AccessMode.ADVANCED;
}
if (ResourceAgent.LSB_CLASS.equals(cl)
&& !getAddServiceList(
ResourceAgent.SERVICE_CLASS).isEmpty()) {
mode = AccessMode.ADVANCED;
}
final MyMenu classItem = new MyMenu(
ClusterBrowser.getClassMenu(cl),
new AccessMode(ConfigData.AccessType.ADMIN, mode),
new AccessMode(ConfigData.AccessType.OP, mode));
final MyListModel<MyMenuItem> dlm =
new MyListModel<MyMenuItem>();
for (final ResourceAgent ra : services) {
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
addResourceAgentMenu(ra,
dlm,
pos,
popups,
colocationWi,
orderWi,
testOnly);
}
});
} catch (final InterruptedException ix) {
Thread.currentThread().interrupt();
} catch (final InvocationTargetException x) {
Tools.printStackTrace();
}
}
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
final boolean ret = Tools.getScrollingMenu(
ClusterBrowser.getClassMenu(cl),
colOrdPanel,
classItem,
dlm,
new MyList<MyMenuItem>(dlm,
getBackground()),
thisClass,
popups,
null);
if (!ret) {
classItem.setEnabled(false);
}
thisMenu.add(classItem);
}
});
} catch (final InterruptedException ix) {
Thread.currentThread().interrupt();
} catch (final InvocationTargetException x) {
Tools.printStackTrace();
}
}
super.update();
}
};
}
/** Adds menu items with dependend services and groups. */
protected void addDependencyMenuItems(final List<UpdatableItem> items,
final boolean enableForNew,
final boolean testOnly) {
/* add new group and dependency*/
final MyMenuItem addGroupMenuItem =
new MyMenuItem(Tools.getString(
"ClusterBrowser.Hb.AddDependentGroup"),
null,
null,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public String enablePredicate() {
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else if (getService().isRemoved()) {
return IS_BEING_REMOVED_STRING;
} else if (getService().isOrphaned()) {
return IS_ORPHANED_STRING;
} else if (getService().isNew()) {
return IS_NEW_STRING;
}
return null;
}
@Override
public void action() {
hidePopup();
final StringInfo gi = new StringInfo(
ConfigData.PM_GROUP_NAME,
ConfigData.PM_GROUP_NAME,
getBrowser());
final CRMXML crmXML = getBrowser().getCRMXML();
addServicePanel(crmXML.getHbGroup(),
getPos(),
false, /* colocation only */
false, /* order only */
true,
false,
testOnly);
getBrowser().getCRMGraph().repaint();
}
};
items.add((UpdatableItem) addGroupMenuItem);
/* add new service and dependency*/
final MyMenu addServiceMenuItem = getAddServiceMenuItem(
testOnly,
Tools.getString("ClusterBrowser.Hb.AddDependency"));
items.add((UpdatableItem) addServiceMenuItem);
/* add existing service dependency*/
final MyMenu existingServiceMenuItem = getExistingServiceMenuItem(
Tools.getString("ClusterBrowser.Hb.AddStartBefore"),
enableForNew,
testOnly);
items.add((UpdatableItem) existingServiceMenuItem);
}
/**
* Returns list of items for service popup menu with actions that can
* be executed on the heartbeat services.
*/
@Override
public List<UpdatableItem> createPopup() {
final List<UpdatableItem> items = new ArrayList<UpdatableItem>();
final boolean testOnly = false;
final CloneInfo ci = getCloneInfo();
if (ci == null) {
addDependencyMenuItems(items, false, testOnly);
}
/* start resource */
final MyMenuItem startMenuItem =
new MyMenuItem(Tools.getString("ClusterBrowser.Hb.StartResource"),
START_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public final String enablePredicate() {
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else if (isStarted(testOnly)) {
return Tools.getString("ServiceInfo.AlreadyStarted");
} else {
return getService().isAvailableWithText();
}
}
@Override
public void action() {
hidePopup();
startResource(getBrowser().getDCHost(), testOnly);
}
};
final ClusterBrowser.ClMenuItemCallback startItemCallback =
getBrowser().new ClMenuItemCallback(startMenuItem, null) {
@Override
public void action(final Host dcHost) {
startResource(dcHost, true); /* testOnly */
}
};
addMouseOverListener(startMenuItem, startItemCallback);
items.add((UpdatableItem) startMenuItem);
/* stop resource */
final MyMenuItem stopMenuItem =
new MyMenuItem(Tools.getString("ClusterBrowser.Hb.StopResource"),
STOP_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public String enablePredicate() {
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else if (isStopped(testOnly)) {
return Tools.getString("ServiceInfo.AlreadyStopped");
} else {
return getService().isAvailableWithText();
}
}
@Override
public void action() {
hidePopup();
stopResource(getBrowser().getDCHost(), testOnly);
}
};
final ClusterBrowser.ClMenuItemCallback stopItemCallback =
getBrowser().new ClMenuItemCallback(stopMenuItem, null) {
@Override
public void action(final Host dcHost) {
stopResource(dcHost, true); /* testOnly */
}
};
addMouseOverListener(stopMenuItem, stopItemCallback);
items.add((UpdatableItem) stopMenuItem);
/* up group resource */
final MyMenuItem upMenuItem =
new MyMenuItem(Tools.getString("ClusterBrowser.Hb.UpResource"),
GROUP_UP_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean visiblePredicate() {
return groupInfo != null;
}
@Override
public String enablePredicate() {
if (getResource().isNew()) {
return IS_NEW_STRING;
}
final GroupInfo gi = groupInfo;
if (gi == null) {
return "no";
}
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
}
final DefaultMutableTreeNode giNode = gi.getNode();
if (giNode == null) {
return "no";
}
final DefaultMutableTreeNode node = getNode();
if (node == null) {
return "no";
}
final int index = giNode.getIndex(node);
if (index == 0) {
return "already up";
}
return null;
}
@Override
public void action() {
hidePopup();
upResource(getBrowser().getDCHost(), testOnly);
}
};
final ClusterBrowser.ClMenuItemCallback upItemCallback =
getBrowser().new ClMenuItemCallback(upMenuItem, null) {
@Override
public void action(final Host dcHost) {
upResource(dcHost, true); /* testOnly */
}
};
addMouseOverListener(upMenuItem, upItemCallback);
items.add((UpdatableItem) upMenuItem);
/* down group resource */
final MyMenuItem downMenuItem =
new MyMenuItem(Tools.getString("ClusterBrowser.Hb.DownResource"),
GROUP_DOWN_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean visiblePredicate() {
return groupInfo != null;
}
@Override
public String enablePredicate() {
if (getResource().isNew()) {
return IS_NEW_STRING;
}
final GroupInfo gi = groupInfo;
if (gi == null) {
return "no";
}
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
}
final DefaultMutableTreeNode giNode = gi.getNode();
if (giNode == null) {
return "no";
}
final DefaultMutableTreeNode node = getNode();
if (node == null) {
return "no";
}
final int index = giNode.getIndex(node);
if (index >= giNode.getChildCount() - 1) {
return "already down";
}
return null;
}
@Override
public void action() {
hidePopup();
downResource(getBrowser().getDCHost(), testOnly);
}
};
final ClusterBrowser.ClMenuItemCallback downItemCallback =
getBrowser().new ClMenuItemCallback(downMenuItem, null) {
@Override
public void action(final Host dcHost) {
downResource(dcHost, true); /* testOnly */
}
};
addMouseOverListener(downMenuItem, downItemCallback);
items.add((UpdatableItem) downMenuItem);
/* clean up resource */
final MyMenuItem cleanupMenuItem =
new MyMenuItem(
Tools.getString("ClusterBrowser.Hb.CleanUpFailedResource"),
SERVICE_RUNNING_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
Tools.getString("ClusterBrowser.Hb.CleanUpResource"),
SERVICE_RUNNING_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean predicate() {
return getService().isAvailable()
&& isOneFailed(testOnly);
}
@Override
public String enablePredicate() {
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else if (!isOneFailedCount(testOnly)) {
return "no fail count";
} else {
return getService().isAvailableWithText();
}
}
@Override
public void action() {
hidePopup();
cleanupResource(getBrowser().getDCHost(), testOnly);
}
};
/* cleanup ignores CIB_file */
items.add((UpdatableItem) cleanupMenuItem);
/* manage resource */
final MyMenuItem manageMenuItem =
new MyMenuItem(
Tools.getString("ClusterBrowser.Hb.ManageResource"),
MANAGE_BY_CRM_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
Tools.getString("ClusterBrowser.Hb.UnmanageResource"),
UNMANAGE_BY_CRM_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean predicate() {
return !isManaged(testOnly);
}
@Override
public String enablePredicate() {
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else {
return getService().isAvailableWithText();
}
}
@Override
public void action() {
hidePopup();
if (this.getText().equals(Tools.getString(
"ClusterBrowser.Hb.ManageResource"))) {
setManaged(true, getBrowser().getDCHost(), testOnly);
} else {
setManaged(false, getBrowser().getDCHost(), testOnly);
}
}
};
final ClusterBrowser.ClMenuItemCallback manageItemCallback =
getBrowser().new ClMenuItemCallback(manageMenuItem, null) {
@Override
public void action(final Host dcHost) {
setManaged(!isManaged(false),
dcHost, true); /* testOnly */
}
};
addMouseOverListener(manageMenuItem, manageItemCallback);
items.add((UpdatableItem) manageMenuItem);
addMigrateMenuItems(items);
if (ci == null) {
/* remove service */
final MyMenuItem removeMenuItem = new MyMenuItem(
Tools.getString("ClusterBrowser.Hb.RemoveService"),
ClusterBrowser.REMOVE_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public String enablePredicate() {
if (getService().isNew()) {
return null;
}
if (getBrowser().clStatusFailed()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else if (getService().isRemoved()) {
return IS_BEING_REMOVED_STRING;
} else if (isRunning(testOnly)
&& !Tools.getConfigData().isAdvancedMode()) {
return "cannot remove running resource<br>"
+ "(advanced mode only)";
}
if (groupInfo == null) {
return null;
}
final ClusterStatus cs = getBrowser().getClusterStatus();
final List<String> gr = cs.getGroupResources(
groupInfo.getHeartbeatId(testOnly),
testOnly);
if (gr != null && gr.size() > 1) {
return null;
} else {
return "you can remove the group";
}
}
@Override
public void action() {
hidePopup();
if (getService().isOrphaned()) {
cleanupResource(getBrowser().getDCHost(), testOnly);
} else {
removeMyself(false);
}
getBrowser().getCRMGraph().repaint();
}
};
final ServiceInfo thisClass = this;
final ClusterBrowser.ClMenuItemCallback removeItemCallback =
getBrowser().new ClMenuItemCallback(removeMenuItem, null) {
@Override
public final boolean isEnabled() {
return super.isEnabled() && !getService().isNew();
}
@Override
public final void action(final Host dcHost) {
removeMyselfNoConfirm(dcHost, true); /* test only */
}
};
addMouseOverListener(removeMenuItem, removeItemCallback);
items.add((UpdatableItem) removeMenuItem);
}
/* view log */
final MyMenuItem viewLogMenu = new MyMenuItem(
Tools.getString("ClusterBrowser.Hb.ViewServiceLog"),
LOGFILE_ICON,
null,
new AccessMode(ConfigData.AccessType.RO, false),
new AccessMode(ConfigData.AccessType.RO, false)) {
private static final long serialVersionUID = 1L;
@Override
public String enablePredicate() {
if (getService().isNew()) {
return IS_NEW_STRING;
} else {
return null;
}
}
@Override
public void action() {
hidePopup();
ServiceLogs l = new ServiceLogs(getBrowser().getCluster(),
getNameForLog(),
getService().getHeartbeatId());
l.showDialog();
}
};
items.add(viewLogMenu);
/* more migrate options */
final MyMenu migrateSubmenu = new MyMenu(
Tools.getString("ClusterBrowser.MigrateSubmenu"),
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public String enablePredicate() {
return null; //TODO: enable only if it has items
}
};
items.add(migrateSubmenu);
addMoreMigrateMenuItems(migrateSubmenu);
/* config files */
final MyMenu filesSubmenu = new MyMenu(
Tools.getString("ClusterBrowser.FilesSubmenu"),
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.ADMIN, false)) {
private static final long serialVersionUID = 1L;
@Override
public String enablePredicate() {
return null; //TODO: enable only if it has items
}
@Override
public void update() {
super.update();
final MyMenu self = this;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
removeAll();
addFilesMenuItems(self);
}
});
}
};
items.add(filesSubmenu);
return items;
}
/** Adds migrate and unmigrate menu items. */
protected void addMigrateMenuItems(final List<UpdatableItem> items) {
/* migrate resource */
final boolean testOnly = false;
final ServiceInfo thisClass = this;
for (final Host host : getBrowser().getClusterHosts()) {
final String hostName = host.getName();
final MyMenuItem migrateFromMenuItem =
new MyMenuItem(Tools.getString(
"ClusterBrowser.Hb.MigrateFromResource")
+ " " + hostName,
MIGRATE_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
Tools.getString(
"ClusterBrowser.Hb.MigrateFromResource")
+ " " + hostName + " (offline)",
MIGRATE_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean predicate() {
return host.isClStatus();
}
@Override
public boolean visiblePredicate() {
return !host.isClStatus()
|| enablePredicate() == null;
}
@Override
public String enablePredicate() {
final List<String> runningOnNodes =
getRunningOnNodes(testOnly);
if (runningOnNodes == null
|| runningOnNodes.size() < 1) {
return "must run";
}
boolean runningOnNode = false;
for (final String ron : runningOnNodes) {
if (hostName.toLowerCase(Locale.US).equals(
ron.toLowerCase(Locale.US))) {
runningOnNode = true;
break;
}
}
if (!getBrowser().clStatusFailed()
&& getService().isAvailable()
&& runningOnNode
&& host.isClStatus()) {
return null;
} else {
return ""; /* is not visible anyway */
}
}
@Override
public void action() {
hidePopup();
migrateFromResource(getBrowser().getDCHost(),
hostName,
testOnly);
}
};
final ClusterBrowser.ClMenuItemCallback migrateItemCallback =
getBrowser().new ClMenuItemCallback(migrateFromMenuItem, null) {
@Override
public void action(final Host dcHost) {
migrateFromResource(dcHost, hostName, true); /* testOnly */
}
};
addMouseOverListener(migrateFromMenuItem, migrateItemCallback);
items.add(migrateFromMenuItem);
}
/* unmigrate resource */
final MyMenuItem unmigrateMenuItem =
new MyMenuItem(
Tools.getString("ClusterBrowser.Hb.UnmigrateResource"),
UNMIGRATE_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean visiblePredicate() {
return enablePredicate() == null;
}
@Override
public String enablePredicate() {
// TODO: if it was migrated
if (!getBrowser().clStatusFailed()
&& getService().isAvailable()
&& (getMigratedTo(testOnly) != null
|| getMigratedFrom(testOnly) != null)) {
return null;
} else {
return ""; /* it's not visible anyway */
}
}
@Override
public void action() {
hidePopup();
unmigrateResource(getBrowser().getDCHost(), testOnly);
}
};
final ClusterBrowser.ClMenuItemCallback unmigrateItemCallback =
getBrowser().new ClMenuItemCallback(unmigrateMenuItem, null) {
@Override
public void action(final Host dcHost) {
unmigrateResource(dcHost, true); /* testOnly */
}
};
addMouseOverListener(unmigrateMenuItem, unmigrateItemCallback);
items.add((UpdatableItem) unmigrateMenuItem);
}
/** Adds "migrate from" and "force migrate" menuitems to the submenu. */
protected void addMoreMigrateMenuItems(final MyMenu submenu) {
final boolean testOnly = false;
final ServiceInfo thisClass = this;
for (final Host host : getBrowser().getClusterHosts()) {
final String hostName = host.getName();
final MyMenuItem migrateMenuItem =
new MyMenuItem(Tools.getString(
"ClusterBrowser.Hb.MigrateResource")
+ " " + hostName,
MIGRATE_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
Tools.getString(
"ClusterBrowser.Hb.MigrateResource")
+ " " + hostName + " (offline)",
MIGRATE_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean predicate() {
return host.isClStatus();
}
@Override
public boolean visiblePredicate() {
return !host.isClStatus()
|| enablePredicate() == null;
}
@Override
public String enablePredicate() {
final List<String> runningOnNodes =
getRunningOnNodes(testOnly);
if (runningOnNodes == null
|| runningOnNodes.isEmpty()) {
return Tools.getString(
"ServiceInfo.NotRunningAnywhere");
}
final String runningOnNode =
runningOnNodes.get(0).toLowerCase(Locale.US);
if (getBrowser().clStatusFailed()
|| !host.isClStatus()) {
return ClusterBrowser.UNKNOWN_CLUSTER_STATUS_STRING;
} else {
final String tp =
getService().isAvailableWithText();
if (tp != null) {
return tp;
}
}
if (hostName.toLowerCase(Locale.US).equals(
runningOnNode)) {
return Tools.getString(
"ServiceInfo.AlreadyRunningOnNode");
} else {
return null;
}
}
@Override
public void action() {
hidePopup();
migrateResource(hostName,
getBrowser().getDCHost(),
testOnly);
}
};
final ClusterBrowser.ClMenuItemCallback migrateItemCallback =
getBrowser().new ClMenuItemCallback(migrateMenuItem, null) {
@Override
public void action(final Host dcHost) {
migrateResource(hostName, dcHost, true); /* testOnly */
}
};
addMouseOverListener(migrateMenuItem, migrateItemCallback);
submenu.add(migrateMenuItem);
}
for (final Host host : getBrowser().getClusterHosts()) {
final String hostName = host.getName();
final MyMenuItem forceMigrateMenuItem =
new MyMenuItem(Tools.getString(
"ClusterBrowser.Hb.ForceMigrateResource")
+ " " + hostName,
MIGRATE_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
Tools.getString(
"ClusterBrowser.Hb.ForceMigrateResource")
+ " " + hostName + " (offline)",
MIGRATE_ICON,
ClusterBrowser.STARTING_PTEST_TOOLTIP,
new AccessMode(ConfigData.AccessType.OP, false),
new AccessMode(ConfigData.AccessType.OP, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean predicate() {
return host.isClStatus();
}
@Override
public boolean visiblePredicate() {
return !host.isClStatus()
|| enablePredicate() == null;
}
@Override
public String enablePredicate() {
final List<String> runningOnNodes =
getRunningOnNodes(testOnly);
if (runningOnNodes == null
|| runningOnNodes.isEmpty()) {
return Tools.getString(
"ServiceInfo.NotRunningAnywhere");
}
final String runningOnNode =
runningOnNodes.get(0).toLowerCase(Locale.US);
if (!getBrowser().clStatusFailed()
&& getService().isAvailable()
&& !hostName.toLowerCase(Locale.US).equals(
runningOnNode)
&& host.isClStatus()) {
return null;
} else {
return "";
}
}
@Override
public void action() {
hidePopup();
forceMigrateResource(hostName,
getBrowser().getDCHost(),
testOnly);
}
};
final ClusterBrowser.ClMenuItemCallback forceMigrateItemCallback =
getBrowser().new ClMenuItemCallback(forceMigrateMenuItem,
null) {
@Override
public void action(final Host dcHost) {
forceMigrateResource(hostName, dcHost, true); /* testOnly */
}
};
addMouseOverListener(forceMigrateMenuItem,
forceMigrateItemCallback);
submenu.add(forceMigrateMenuItem);
}
}
/** Return config files defined in DistResource config files. */
private List<String> getConfigFiles() {
String raName;
final ServiceInfo cs = getContainedService();
if (cs == null) {
raName = getResourceAgent().getRAString();
} else {
raName = cs.getResourceAgent().getRAString();
}
final Host[] hosts = getBrowser().getCluster().getHostsArray();
final List<String> cfs =
new ArrayList<String>(hosts[0].getDistStrings(raName + ".files"));
final List<String> params =
new ArrayList<String>(hosts[0].getDistStrings(raName + ".params"));
params.add("configfile");
params.add("config");
params.add("conffile");
for (final String param : params) {
String value;
if (cs == null) {
final Widget wi = getWidget(param, null);
if (wi == null) {
value = getParamSaved(param);
} else {
value = wi.getStringValue();
}
} else {
final Widget wi = cs.getWidget(param, null);
if (wi == null) {
value = cs.getParamSaved(param);
} else {
value = wi.getStringValue();
}
}
if (value != null && !"".equals(value)) {
cfs.add(value);
}
}
return cfs;
}
/** Adds config files menuitems to the submenu. */
protected void addFilesMenuItems(final MyMenu submenu) {
final boolean testOnly = false;
final ServiceInfo thisClass = this;
final List<String> configFiles = getConfigFiles();
for (final String configFile : configFiles) {
final MyMenuItem fileItem =
new MyMenuItem(
configFile,
null,
null,
new AccessMode(ConfigData.AccessType.ADMIN, false),
new AccessMode(ConfigData.AccessType.ADMIN, false)) {
private static final long serialVersionUID = 1L;
@Override
public boolean predicate() {
return true;
}
@Override
public boolean visiblePredicate() {
return true;
}
@Override
public String enablePredicate() {
return null;
}
@Override
public void action() {
final EditConfig ed =
new EditConfig(configFile,
getBrowser().getCluster().getHosts());
ed.showDialog();
}
};
submenu.add(fileItem);
}
}
/** Returns tool tip for the service. */
@Override
public String getToolTipText(final boolean testOnly) {
String nodeString = null;
final List<String> nodes = getRunningOnNodes(testOnly);
if (nodes != null && !nodes.isEmpty()) {
nodeString =
Tools.join(", ", nodes.toArray(new String[nodes.size()]));
}
final Host[] hosts = getBrowser().getCluster().getHostsArray();
if (getBrowser().allHostsDown()) {
nodeString = "unknown";
}
final StringBuilder sb = new StringBuilder(200);
sb.append("<b>");
sb.append(toString());
String textOn;
String textNotOn;
if (getResourceAgent().isFilesystem()) {
textOn = Tools.getString("ServiceInfo.Filesystem.MoutedOn");
textNotOn = Tools.getString("ServiceInfo.Filesystem.NotMounted");
} else {
textOn = Tools.getString("ServiceInfo.Filesystem.RunningOn");
textNotOn = Tools.getString("ServiceInfo.Filesystem.NotRunning");
}
if (isFailed(testOnly)) {
sb.append("</b> <b>Failed</b>");
} else if (isStopped(testOnly)
|| nodeString == null) {
sb.append("</b> " + textNotOn);
} else {
sb.append("</b> " + textOn + ": ");
sb.append(nodeString);
}
if (!isManaged(testOnly)) {
sb.append(" (unmanaged)");
}
final Map<String, String> scores =
getBrowser().getClusterStatus().getAllocationScores(
getHeartbeatId(testOnly),
testOnly);
for (final String h : scores.keySet()) {
sb.append("<br>allocation score on ");
sb.append(h);
sb.append(": ");
sb.append(scores.get(h));
}
return sb.toString();
}
/** Returns heartbeat service class. */
public ResourceAgent getResourceAgent() {
return resourceAgent;
}
/** Sets whether the info object is being updated. */
@Override
public void setUpdated(final boolean updated) {
final GroupInfo gi = groupInfo;
if (gi != null) {
gi.setUpdated(updated);
return;
}
final CloneInfo ci = cloneInfo;
if (ci != null) {
ci.setUpdated(updated);
return;
}
if (updated && !isUpdated()) {
getBrowser().getCRMGraph().startAnimation(this);
} else if (!updated) {
getBrowser().getCRMGraph().stopAnimation(this);
}
super.setUpdated(updated);
}
/** Returns text that appears in the corner of the graph. */
public Subtext getRightCornerTextForGraph(final boolean testOnly) {
if (getService().isOrphaned()) {
if (isFailed(testOnly)) {
return ORPHANED_FAILED_SUBTEXT;
} else {
return ORPHANED_SUBTEXT;
}
} else if (!isManaged(testOnly)) {
return UNMANAGED_SUBTEXT;
} else if (getMigratedTo(testOnly) != null
|| getMigratedFrom(testOnly) != null) {
return MIGRATED_SUBTEXT;
}
return null;
}
/** Returns text with lines as array that appears in the cluster graph. */
public Subtext[] getSubtextsForGraph(final boolean testOnly) {
Color color = null;
final List<Subtext> texts = new ArrayList<Subtext>();
String textOn;
String textNotOn;
if (getResourceAgent().isFilesystem()) {
textOn = Tools.getString("ServiceInfo.Filesystem.MoutedOn");
textNotOn = Tools.getString("ServiceInfo.Filesystem.NotMounted");
} else {
textOn = Tools.getString("ServiceInfo.Filesystem.RunningOn");
textNotOn = Tools.getString("ServiceInfo.Filesystem.NotRunning");
}
if (getService().isOrphaned()) {
texts.add(new Subtext("...",
null,
Color.BLACK));
} else if (getResource().isNew()) {
texts.add(new Subtext(textNotOn + " (new)",
ClusterBrowser.FILL_PAINT_STOPPED,
Color.BLACK));
} else if (isFailed(testOnly)) {
texts.add(new Subtext(textNotOn,
null,
Color.BLACK));
} else if (isStopped(testOnly) && !isRunning(testOnly)) {
texts.add(new Subtext("stopped",
ClusterBrowser.FILL_PAINT_STOPPED,
Color.BLACK));
} else {
Color textColor = Color.BLACK;
String runningOnNodeString = null;
if (getBrowser().allHostsDown()) {
runningOnNodeString = "unknown";
} else {
final List<String> runningOnNodes = getRunningOnNodes(testOnly);
if (runningOnNodes != null
&& !runningOnNodes.isEmpty()) {
runningOnNodeString = runningOnNodes.get(0);
if (resourceAgent.isPingService()
&& "0".equals(
getPingCount(runningOnNodeString, testOnly))) {
color = Color.RED;
textColor = Color.WHITE;
} else {
color = getBrowser().getCluster().getHostColors(
runningOnNodes).get(0);
}
}
}
if (runningOnNodeString == null) {
texts.add(new Subtext(textNotOn,
ClusterBrowser.FILL_PAINT_STOPPED,
textColor));
} else {
texts.add(new Subtext(textOn + ": " + runningOnNodeString
+ getPingCountString(runningOnNodeString,
testOnly),
color,
textColor));
}
}
if (isOneFailedCount(testOnly)) {
for (final Host host : getBrowser().getClusterHosts()) {
if (host.isClStatus()
&& getFailCount(host.getName(), testOnly) != null) {
texts.add(new Subtext(ClusterBrowser.IDENT_4
+ host.getName()
+ getFailCountString(
host.getName(),
testOnly),
null,
Color.BLACK));
}
}
}
return texts.toArray(new Subtext[texts.size()]);
}
/** Returns null, when this service is not a clone. */
public ServiceInfo getContainedService() {
return null;
}
/** Returns type radio group. */
Widget getTypeRadioGroup() {
return typeRadioGroup;
}
/** Returns units. */
@Override
protected final Unit[] getUnits() {
return new Unit[]{
new Unit("", "s", "Second", "Seconds"), /* default unit */
new Unit("ms", "ms", "Millisecond", "Milliseconds"),
new Unit("us", "us", "Microsecond", "Microseconds"),
new Unit("s", "s", "Second", "Seconds"),
new Unit("min", "m", "Minute", "Minutes"),
new Unit("h", "h", "Hour", "Hours")
};
}
/** Returns whether it is slave on all nodes. */
protected boolean isSlaveOnAllNodes(final boolean testOnly) {
return false;
}
/** Returns text that appears above the icon in the graph. */
public String getIconTextForGraph(final boolean testOnly) {
if (getBrowser().allHostsDown()) {
return Tools.getString("ClusterBrowser.Hb.NoInfoAvailable");
}
final Host dcHost = getBrowser().getDCHost();
if (getService().isNew()) {
return "new...";
} else if (getService().isOrphaned()) {
return "";
} else if (isEnslaved(testOnly)) {
if (isSlaveOnAllNodes(testOnly)) {
return "";
} else {
return Tools.getString("ClusterBrowser.Hb.Enslaving");
}
} else if (isStarted(testOnly)) {
if (isRunning(testOnly)) {
final List<Host> migratedTo = getMigratedTo(testOnly);
if (migratedTo == null) {
final List<Host> migratedFrom = getMigratedFrom(testOnly);
if (migratedFrom != null) {
final List<String> runningOnNodes =
getRunningOnNodes(testOnly);
boolean alreadyThere = false;
if (runningOnNodes == null) {
alreadyThere = true;
} else {
alreadyThere = true;
for (final Host mfrom : migratedFrom) {
if (runningOnNodes.contains(mfrom.getName())) {
alreadyThere = false;
}
}
}
if (!alreadyThere) {
return Tools.getString(
"ClusterBrowser.Hb.Migrating");
}
}
} else {
final List<String> runningOnNodes =
getRunningOnNodes(testOnly);
if (runningOnNodes != null) {
boolean alreadyThere = false;
for (final Host mto : migratedTo) {
if (runningOnNodes.contains(mto.getName())) {
alreadyThere = true;
}
if (!alreadyThere) {
return Tools.getString(
"ClusterBrowser.Hb.Migrating");
}
}
}
}
return null;
} else if (isFailed(testOnly)) {
return Tools.getString("ClusterBrowser.Hb.StartingFailed");
} else if (isGroupStopped(testOnly)) {
return Tools.getString("ClusterBrowser.Hb.GroupStopped");
} else {
return Tools.getString("ClusterBrowser.Hb.Starting");
}
} else if (isStopped(testOnly)) {
if (isRunning(testOnly)) {
return Tools.getString("ClusterBrowser.Hb.Stopping");
} else {
return null;
}
}
return null;
}
/** Returns hash with saved operations. */
MultiKeyMap<String, String> getSavedOperation() {
return savedOperation;
}
/** Reload combo boxes. */
public void reloadComboBoxes() {
if (sameAsOperationsWi != null) {
String defaultOpIdRef = null;
final Info savedOpIdRef = sameAsOperationsWiValue();
if (savedOpIdRef != null) {
defaultOpIdRef = savedOpIdRef.toString();
}
final String idRef = defaultOpIdRef;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
sameAsOperationsWi.reloadComboBox(
idRef,
getSameServicesOperations());
}
});
}
if (sameAsMetaAttrsWi != null) {
String defaultMAIdRef = null;
final Info savedMAIdRef = sameAsMetaAttrsWiValue();
if (savedMAIdRef != null) {
defaultMAIdRef = savedMAIdRef.toString();
}
final String idRef = defaultMAIdRef;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
sameAsMetaAttrsWi.reloadComboBox(
idRef,
getSameServicesMetaAttrs());
}
});
}
}
/** Returns whether info panel is already created. */
boolean isInfoPanelOk() {
return infoPanel != null;
}
/** Connects with VMSVirtualDomainInfo object. */
public VMSVirtualDomainInfo connectWithVMS() {
/* for VirtualDomainInfo */
return null;
}
/** Whether this class is a constraint placeholder. */
public boolean isConstraintPH() {
return false;
}
/** Remove constraints of this service. */
void removeConstraints(final Host dcHost, final boolean testOnly) {
final ClusterStatus cs = getBrowser().getClusterStatus();
final HbConnectionInfo[] hbcis =
getBrowser().getCRMGraph().getHbConnections(this);
for (final HbConnectionInfo hbci : hbcis) {
if (hbci != null) {
getBrowser().getCRMGraph().removeOrder(hbci, dcHost, testOnly);
getBrowser().getCRMGraph().removeColocation(hbci,
dcHost,
testOnly);
}
}
for (final String locId : cs.getLocationIds(
getHeartbeatId(testOnly),
testOnly)) {
CRM.removeLocation(dcHost,
locId,
getHeartbeatId(testOnly),
testOnly);
}
}
/**
* Returns value of the same as drop down menu as an info object or null.
*/
final Info sameAsOperationsWiValue() {
if (sameAsOperationsWi == null) {
return null;
}
Info i = null;
final Object o = sameAsOperationsWi.getValue();
if (o instanceof Info) {
i = (Info) o;
}
return i;
}
/**
* Returns value of the same as drop down menu as an info object or null.
*/
final Info sameAsMetaAttrsWiValue() {
if (sameAsMetaAttrsWi == null) {
return null;
}
Info i = null;
final Object o = sameAsMetaAttrsWi.getValue();
if (o instanceof Info) {
i = (Info) o;
}
return i;
}
/** Store operation values. */
final void storeOperations() {
mSavedOperationsLock.lock();
for (final String op : getResourceAgent().getOperationNames()) {
for (final String param : getBrowser().getCRMOperationParams(op)) {
final String defaultValue =
resourceAgent.getOperationDefault(op, param);
if (defaultValue == null) {
continue;
}
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op, param);
mOperationsComboBoxHashReadLock.unlock();
savedOperation.put(op, param, wi.getStringValue());
}
}
mSavedOperationsLock.unlock();
}
/** Returns score combo box. */
protected final Map<HostInfo, Widget> getScoreComboBoxHash() {
return scoreComboBoxHash;
}
/** Returns ping combo box. */
public final Widget getPingComboBox() {
return pingComboBox;
}
/** Sets ping combo box. */
protected final void setPingComboBox(final Widget pingComboBox) {
this.pingComboBox = pingComboBox;
}
/** Return operation combo box. */
public final Widget getOperationsComboBox(final String op,
final String param) {
mOperationsComboBoxHashReadLock.lock();
final Widget wi = operationsComboBoxHash.get(op, param);
mOperationsComboBoxHashReadLock.unlock();
return wi;
}
/** Return same as operations combo box. */
public final Widget getSameAsOperationsWi() {
return sameAsOperationsWi;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
260cb2ab3140093a003e11f1ac5f9328486312d8 | 576886b5d295fe04ef5eb62a7ae7c7d6ff9d4ff4 | /CreateFolder/src/sep/util/net/ipseeker/Helper.java | 8d92d67181be9378fce285504b927992930e5228 | [] | no_license | yc-zhaoming/my | 5d95fb74486c1cad18e8bd6351aa2d85e9fe5837 | 4403fc9ad6d50b8976eb52330c529ff79917f06a | refs/heads/master | 2020-03-11T00:35:03.135184 | 2018-04-17T02:07:35 | 2018-04-17T02:07:35 | 129,667,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,095 | java | package sep.util.net.ipseeker;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import sep.util.net.IP4Util;
class Helper {
static final int RecordLength = 7;
static final byte RedirectMode1 = 0x01;
static final byte RedirectMode2 = 0x02;
/** 计算中间位置的偏移 */
static int calcMiddleOffset(final int begin, final int end) {
final int records = ((end - begin) / RecordLength) >> 1;
return begin + ((records == 0) ? 1 : records) * RecordLength;
}
static int compare(byte[] ip, byte[] begin) {
for (int i = 0, x, y; i < 4; i++) {
x = ip[i]; y = begin[i];
if ((x & 0xFF) > (y & 0xFF)) {
return 1;
} else if ((x ^ y) == 0) {
continue;
} else {
return -1;
}
}
return 0;
}
private final ByteBuffer buffer;
private final IPSeeker seeker;
Helper(IPSeeker seeker) {
this.buffer = seeker.buffer;
this.seeker = seeker;
}
IPLocation getLocation(int offset) {
if (offset == -1) {
return IPLocation.Unknown;
}
buffer.position(offset + 4);
switch (buffer.get()) {
case RedirectMode1:
// Read CountryOffset & Set Position
buffer.position(offset = readInt3());
final String country;
switch (buffer.get()) {
case RedirectMode2:
country = readString(readInt3());
buffer.position(offset + 4);
break;
default:
country = readString(offset);
break;
}
return IPLocation.of(country, readArea(buffer.position()));
case RedirectMode2:
return IPLocation.of(readString(readInt3()), readArea(offset + 8));
default:
return IPLocation.of(readString(buffer.position() - 1), readArea(buffer.position()));
}
}
/** 定位IP的绝对偏移 */
int locateOffset(final byte[] address) {
switch (compare(address, readIP(seeker.offsetBegin))) {
case -1:
return -1;
case 0:
return seeker.offsetBegin;
}
int middleOffset = 0;
for (int begin = seeker.offsetBegin, end = seeker.offsetEnd; begin < end;) {
switch (compare(address, readIP(middleOffset = calcMiddleOffset(begin, end)))) {
case 1:
begin = middleOffset;
break;
case -1:
if (middleOffset == end) {
middleOffset = (end -= RecordLength);
} else {
end = middleOffset;
}
break;
case 0:
return readInt3(middleOffset + 4);
}
}
middleOffset = readInt3(middleOffset + 4);
switch (compare(address, readIP(middleOffset))) {
case -1:
case 0:
return middleOffset;
default:
return -1;
}
}
private String readArea(int offset) {
buffer.position(offset);
switch (buffer.get()) {
case RedirectMode1:
case RedirectMode2:
offset = readInt3(offset + 1);
return (offset != 0) ? readString(offset) : IPLocation.Unknown.getArea();
default:
return readString(offset);
}
}
private int readInt3() {
return buffer.getInt() & 0x00FFFFFF;
}
int readInt3(int offset) {
buffer.position(offset);
return buffer.getInt() & 0x00FFFFFF;
}
byte[] readIP(int offset) {
buffer.position(offset);
return IP4Util.toBytes(buffer.getInt());
}
private String readString(int offset) {
buffer.position(offset);
final byte[] buf = new byte[0xFF];
offset = -1;
while ((buf[++offset] = buffer.get()) != 0);
return (offset != 0) ? new String(buf, 0, offset, Charset.forName("GBK")) : null;
}
} | [
"lizhaoming@USER1-HP.yuchai.com"
] | lizhaoming@USER1-HP.yuchai.com |
75a06a24706a8a3f941d16113454c0c55ee4c103 | 001307bfea66fad1cc904ccbf8c160d5cb39083a | /myb-mos/src/main/java/com/myb/mos/VO/EmployeeVO.java | d1cdeeedcfca84ca29943efa8c8062218c4ef4c0 | [] | no_license | yan-huan/mos | 4c56f1f66aa94c2fc7042140bcaa1e132b39db9a | 6e2f3e4c769b96ea5f62222ce8abc8e13b69d044 | refs/heads/master | 2020-05-29T09:13:40.533844 | 2017-10-18T02:25:23 | 2017-10-18T02:25:23 | 68,894,559 | 0 | 0 | null | 2016-09-22T07:10:58 | 2016-09-22T07:10:57 | null | UTF-8 | Java | false | false | 3,501 | java | package com.myb.mos.VO;
import com.myb.framework.data.EntityBase;
public class EmployeeVO extends EntityBase{
private int empId;//
private int parentId;//直属上级Id
private java.lang.String empName;//
private java.lang.String account;//登录账号
private java.lang.String empCode;//员工编号
private java.lang.Integer dutyId;//岗位Id
private java.lang.String parentName;//冗余直属上级姓名
private java.lang.String depName;//冗余部门名称
private java.lang.String cityPermission;//城市权限 可以设置多个城市以空格间隔
private int isUsed;//
private int cityId;//
private java.util.Date createTime;//
private java.lang.String userName;//
private java.lang.String passWord;//
private int status;//
private int ran;//
private String entryTime;//入职时间
private String QuitTime;//退出时间
private String preferPwd;//原来密码
public int getEmpId() {
return empId;
}
public void setEmpId(int empId) {
this.empId = empId;
}
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
public java.lang.String getEmpName() {
return empName;
}
public void setEmpName(java.lang.String empName) {
this.empName = empName;
}
public java.lang.String getAccount() {
return account;
}
public void setAccount(java.lang.String account) {
this.account = account;
}
public java.lang.String getEmpCode() {
return empCode;
}
public void setEmpCode(java.lang.String empCode) {
this.empCode = empCode;
}
public java.lang.Integer getDutyId() {
return dutyId;
}
public void setDutyId(java.lang.Integer dutyId) {
this.dutyId = dutyId;
}
public java.lang.String getParentName() {
return parentName;
}
public void setParentName(java.lang.String parentName) {
this.parentName = parentName;
}
public java.lang.String getDepName() {
return depName;
}
public void setDepName(java.lang.String depName) {
this.depName = depName;
}
public java.lang.String getCityPermission() {
return cityPermission;
}
public void setCityPermission(java.lang.String cityPermission) {
this.cityPermission = cityPermission;
}
public int getIsUsed() {
return isUsed;
}
public void setIsUsed(int isUsed) {
this.isUsed = isUsed;
}
public int getCityId() {
return cityId;
}
public void setCityId(int cityId) {
this.cityId = cityId;
}
public java.util.Date getCreateTime() {
return createTime;
}
public void setCreateTime(java.util.Date createTime) {
this.createTime = createTime;
}
public java.lang.String getUserName() {
return userName;
}
public void setUserName(java.lang.String userName) {
this.userName = userName;
}
public java.lang.String getPassWord() {
return passWord;
}
public void setPassWord(java.lang.String passWord) {
this.passWord = passWord;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getRan() {
return ran;
}
public void setRan(int ran) {
this.ran = ran;
}
public String getEntryTime() {
return entryTime;
}
public void setEntryTime(String entryTime) {
this.entryTime = entryTime;
}
public String getQuitTime() {
return QuitTime;
}
public void setQuitTime(String quitTime) {
QuitTime = quitTime;
}
public String getPreferPwd() {
return preferPwd;
}
public void setPreferPwd(String preferPwd) {
this.preferPwd = preferPwd;
}
}
| [
"809579166@qq.com"
] | 809579166@qq.com |
3b7c639804cde041c1240fa7a24b923daaa76245 | 29957da0b6883456ee753d85aff5e739f4af1530 | /src/lib/evaluation/RelevanceJudgmentException.java | 7268d7b48a189e355455ab2b0741227da7487337 | [] | no_license | tonilam/Java__CAB431_Asgn1 | 05f676bd532219527a6560046e1b7a4553e72d3e | 66e2ead195b29d97178925457e8cc1db4a5c37ac | refs/heads/master | 2021-01-20T13:45:35.379641 | 2017-05-07T10:44:25 | 2017-05-07T10:44:25 | 90,525,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,124 | java | package lib.evaluation;
/**
* RelevanceJudgmentException completely inherits java.lang.Exception without modification.
* It aims to throw the exception in an apt name.
* @author Toni Lam
*
* @since 1.0
* @version 2.0, Apr 24, 2017
*/
public class RelevanceJudgmentException extends Exception {
/**
* Implementation of Serializable needs a serialVersionUID.
*/
private static final long serialVersionUID = 1L;
public RelevanceJudgmentException() {
// TODO Auto-generated constructor stub
}
public RelevanceJudgmentException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public RelevanceJudgmentException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
public RelevanceJudgmentException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
public RelevanceJudgmentException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
// TODO Auto-generated constructor stub
}
}
| [
"qut.toni.9516778@gmail.com"
] | qut.toni.9516778@gmail.com |
b0a9f4906db6dd990bdc2e8ce03f3ff49bec6f2b | 2bf767c50c07906e17df0d3678107a077985f229 | /src/main/java/io/pivotal/pal/tracker/PalTrackerApplication.java | b6f3e655399bbbc272a380e1a9535085826f7abf | [] | no_license | uberscott/pal-tracker | 805734fc5d62a2a695ee5c0e7f52bac10ddea95f | aff8d1f61cef0fa9845ef88da55041cd7a9758fa | refs/heads/master | 2020-03-19T06:45:00.980312 | 2018-06-06T18:00:07 | 2018-06-06T18:00:07 | 136,051,520 | 0 | 0 | null | 2018-06-04T16:15:21 | 2018-06-04T16:15:20 | null | UTF-8 | Java | false | false | 1,300 | java | package io.pivotal.pal.tracker;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.mysql.cj.jdbc.MysqlDataSource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import javax.sql.DataSource;
@SpringBootApplication
public class PalTrackerApplication {
@Bean
public TimeEntryRepository timeEntryRepository(DataSource dataSource)
{
return new JdbcTimeEntryRepository(dataSource);
}
@Bean
public ObjectMapper jsonObjectMapper ()
{
return Jackson2ObjectMapperBuilder.json()
.serializationInclusion(JsonInclude.Include.NON_NULL) // Don’t include null values
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) //ISODate
.modules(new JavaTimeModule())
.build();
}
public static void main(String[] args){
SpringApplication.run(PalTrackerApplication.class, args);
}
}
| [
"paul.williams@asynchrony.com"
] | paul.williams@asynchrony.com |
5376222332c5a2a32bc065835afa1ff214c0e153 | 7ddeae08c021cb9a13612307f212f0356e233956 | /src/main/java/com/ninos/hotelbookings/service/errorhandlers/GlobalExceptionHandler.java | eb117de12a11621bd5c22965f1de5156315c898a | [
"MIT"
] | permissive | spyridon-ninos/hotel-bookings | 86d227b5b79ed5b7a4bb093c2f851d68c68f2db5 | a1115fb9c86f7b9b198681a158d5ae927ec0314b | refs/heads/master | 2023-06-25T22:30:40.672881 | 2021-07-18T20:46:17 | 2021-07-18T20:46:17 | 387,260,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,775 | java | package com.ninos.hotelbookings.service.errorhandlers;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.InvalidMediaTypeException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.validation.ConstraintViolationException;
import javax.validation.ValidationException;
/**
* global HTTP endpoints exception handler
*/
@ControllerAdvice
public class GlobalExceptionHandler {
private final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
@ExceptionHandler(value = {
IllegalArgumentException.class,
ValidationException.class,
HttpRequestMethodNotSupportedException.class,
MethodArgumentNotValidException.class,
InvalidMediaTypeException.class,
ConstraintViolationException.class,
InvalidFormatException.class
})
public ResponseEntity<Void> handleInvalidInputExceptions(Exception ex) {
logger.error("Received a bad request exception: {}", ex.getMessage());
logger.debug("{}", ex.getMessage(), ex);
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(Exception.class)
public ResponseEntity<Void> handleGeneralException(Exception ex) {
logger.error("{}", ex.getMessage(), ex);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
| [
"no email"
] | no email |
0e66b0d011dcd91291c760d5169c400a7a1bd30c | ac1f61b5e9b3d61b13b2a221e3256828f3eac8cb | /src/main/java/com/jeeplus/modules/ehr/dao/UserMemberDao.java | d0461055562edd23a73d262a91642c6b6412d6f6 | [] | no_license | zj312404325/jyoaoa | aaede1961779921a0c087077eed55dc5efb71baf | 9fb5df634b76eec1f1fcaf14bb29cf25528896df | refs/heads/master | 2020-04-05T06:55:07.262154 | 2020-01-15T08:38:44 | 2020-01-15T08:38:44 | 156,656,437 | 0 | 1 | null | 2019-10-29T16:52:46 | 2018-11-08T05:48:08 | JavaScript | UTF-8 | Java | false | false | 559 | java | /**
* Copyright © 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
*/
package com.jeeplus.modules.ehr.dao;
import com.jeeplus.common.persistence.CrudDao;
import com.jeeplus.common.persistence.annotation.MyBatisDao;
import com.jeeplus.modules.ehr.entity.UserInfo;
import com.jeeplus.modules.ehr.entity.UserMember;
/**
* 入职员工信息登记DAO接口
* @author yc
* @version 2017-10-18
*/
@MyBatisDao
public interface UserMemberDao extends CrudDao<UserMember> {
public void deleteByUserinfoid(UserInfo userInfo);
} | [
"zhangj@lemote.com"
] | zhangj@lemote.com |
12d5dbc542774d9efa3c0e8692160184b34be099 | 17055fa42a789fb480b2fd1b5c10695de860e124 | /src/main/java/ru/itsjava/oop/inheritance/Child.java | a49645afdb5e446af081d69d34731a6f414390a9 | [] | no_license | Vkuznecov0102/java-foundations-online | 948f8407c315ed73bdb05a24b1e14741b389383b | b333ea9c0f2a092ca0a5f1a5009aa4d0f2751ba0 | refs/heads/master | 2023-01-11T07:03:36.307559 | 2020-11-10T15:00:51 | 2020-11-10T15:00:51 | 311,680,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package ru.itsjava.oop.inheritance;
public class Child implements Father,Mother {
@Override
public void giveLove() {
System.out.println("Child loves you");
}
}
| [
"simha88@yandex.ru"
] | simha88@yandex.ru |
25d28fad674c825f628bb5b865531d87ad5a3cbc | 403e9e33c35d28f93cb4efc8ec73fed9fbc30e86 | /src/main/java/com/vaadin/lazyloadwrapper/widgetset/client/ui/LLWPoller.java | 4fcf17a1d9ea636d84118e30341892093be4e0dd | [] | no_license | Silvermedia/vaadin-lazyloadwrapper | b56dda82642d078191b1eab786ca73ecbf72c5c2 | 3b3c3322e2307854e7781b4afb053dc9b41a3eaf | refs/heads/master | 2021-01-18T09:36:42.373541 | 2018-03-08T15:54:32 | 2018-03-08T15:54:32 | 50,988,813 | 0 | 1 | null | 2018-03-08T15:50:31 | 2016-02-03T09:26:54 | Java | UTF-8 | Java | false | false | 1,571 | java | package com.vaadin.lazyloadwrapper.widgetset.client.ui;
import java.util.ArrayList;
import com.google.gwt.user.client.Timer;
/**
* The static poller that's shared with all LLW:s in an application. When the
* poller is triggered, all LLW instances will be called to check their
* visibility.
*/
public class LLWPoller extends Timer {
ArrayList<LazyLoadWrapperConnector> listeners = new ArrayList<LazyLoadWrapperConnector>();
@Override
public void run() {
// long start = System.currentTimeMillis();
for (LazyLoadWrapperConnector llw : new ArrayList<LazyLoadWrapperConnector>(
listeners)) {
llw.checkVisibility();
}
// long stop = System.currentTimeMillis();
// VConsole.log("Checking LLW visibility for all LLW:s took: "
// + (stop - start) + " ms");
}
/**
* Register a lazy load wrapper to the master poller
*
* @param llw
* - the LLW instance to be registered
*/
public synchronized void addLLW(LazyLoadWrapperConnector llw) {
if (!listeners.contains(llw)) {
listeners.add(llw);
}
if (listeners.size() == 1) {
scheduleRepeating(1250);
}
}
/**
* Remove a llw from the master poller.
*
* @param llw
* - the instance of the llw to be removed.
*/
public synchronized void removeLLW(LazyLoadWrapperConnector llw) {
listeners.remove(llw);
if (listeners.isEmpty()) {
cancel();
}
}
} | [
"petri@vaadin.com"
] | petri@vaadin.com |
9fcdbc9457e56302daa6703cd2fc11aa615a7071 | d87c529a1f4aacfd09550af732fdd5b97443211e | /src/main/java/service/UserProcService.java | 16fbbd04f7e182cc70fd5d69f819283c792ce8fb | [] | no_license | zpc0921/practice | be22c2861e299f7d21095b09ac2e7b73e490e300 | 9510a17f87192d0a69980fc19d58e7ac78c82606 | refs/heads/master | 2020-07-06T11:38:36.062847 | 2019-08-18T14:27:08 | 2019-08-18T14:27:08 | 203,005,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 974 | java | package service;
import model.User;
import utils.FileUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public class UserProcService {
private List<User> userList;
public void proc(String fileName) {
final String userInfos = FileUtil.read(fileName);
if (Objects.isNull(userInfos)) {
//
}
final List<String> userStrList = Arrays.asList(userInfos.split("\r\n"));
this.userList = userStrList.stream().map(item -> {
final String[] userStr = item.split(", ");
User user = new User();
user.setFirstName(userStr[0]);
user.setLastName(userStr[1]);
user.setBirthDay(userStr[2]);
user.setEmail(userStr[3]);
return user;
}).collect(Collectors.toList());
}
public List<User> getUserList() {
return userList;
}
}
| [
"chengge0921@hotmail.com"
] | chengge0921@hotmail.com |
7397ce29ea27c8e4e42345e3af5209c61cb7b08f | 5d00b27e4022698c2dc56ebbc63263f3c44eea83 | /gen/com/ah/xml/be/config/ApplicationObj.java | 0693d4a163d75052e5b636d6eac28652326f324e | [] | no_license | Aliing/WindManager | ac5b8927124f992e5736e34b1b5ebb4df566770a | f66959dcaecd74696ae8bc764371c9a2aa421f42 | refs/heads/master | 2020-12-27T23:57:43.988113 | 2014-07-28T17:58:46 | 2014-07-28T17:58:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,690 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.07.01 at 11:29:17 AM CST
//
package com.ah.xml.be.config;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for application-obj complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="application-obj">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="identification" type="{http://www.aerohive.com/configuration/others}application-identification" minOccurs="0"/>
* <element name="reporting" type="{http://www.aerohive.com/configuration/others}application-reporting" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "application-obj", propOrder = {
"identification",
"reporting"
})
public class ApplicationObj {
protected ApplicationIdentification identification;
protected ApplicationReporting reporting;
/**
* Gets the value of the identification property.
*
* @return
* possible object is
* {@link ApplicationIdentification }
*
*/
public ApplicationIdentification getIdentification() {
return identification;
}
/**
* Sets the value of the identification property.
*
* @param value
* allowed object is
* {@link ApplicationIdentification }
*
*/
public void setIdentification(ApplicationIdentification value) {
this.identification = value;
}
/**
* Gets the value of the reporting property.
*
* @return
* possible object is
* {@link ApplicationReporting }
*
*/
public ApplicationReporting getReporting() {
return reporting;
}
/**
* Sets the value of the reporting property.
*
* @param value
* allowed object is
* {@link ApplicationReporting }
*
*/
public void setReporting(ApplicationReporting value) {
this.reporting = value;
}
}
| [
"zjie@aerohive.com"
] | zjie@aerohive.com |
58d8dfaac982e9245d97e21ddd02cfeaf653e891 | 5989f2eacadd43feb5e5a6fab0d86893149239c1 | /player_sdk/src/test/java/com/cmcm/v/player_sdk/ExampleUnitTest.java | 997718ecdfaa2dd9dc9f00e1c34d1b578e9de27c | [] | no_license | xunmengyoufeng/xplayer | a5d4b26fba7157d6260ba383bac20aa0bce2dcab | cc5be4ad88837d8d12e97c1e10927dc3f103d055 | refs/heads/master | 2020-12-24T11:17:42.613787 | 2016-12-13T07:30:55 | 2016-12-13T07:30:55 | 73,039,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package com.cmcm.v.player_sdk;
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);
}
} | [
"zhangyanlongcodec@gmail.com"
] | zhangyanlongcodec@gmail.com |
3de9fc3ecdfd0a6528e688b83f4c590d23f325c4 | afc5e5ae723777b014233c3ed457605146cb5888 | /GG1Simulator/src/gg1simulator/Jobs.java | ec39f9fa1181602745e5afb4fd3f4b67e739eead | [] | no_license | XP928/qsim | 859a574245b3c45744d563096aba194689959e9a | a02885f062c4b295a04a4a328420541f27d5b9b7 | refs/heads/master | 2021-01-13T01:44:18.861225 | 2014-08-02T04:05:49 | 2014-08-02T04:05:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,200 | java | /*
* Jobs.java
*/
package gg1simulator;
public class Jobs implements Comparable<Jobs> {
private int jobId;
private double startTime;
private double arrivalTime;
private double lastArrivalTime;
private double startServiceTime;
private double midArrivalTime;
private double midDepartureTime;
private double departureTime;
public Jobs(int jobId, double arrivalTime, double lastArrivalTime) {
this.jobId = jobId;
this.arrivalTime = arrivalTime;
this.lastArrivalTime = lastArrivalTime;
}
public Jobs(int jobId, double startTime, double lastArrivalTime, double departureTime){
this.jobId = jobId;
this.startTime = startTime;
this.lastArrivalTime = lastArrivalTime;
this.departureTime = departureTime;
}
public int getJobId() {
return jobId;
}
public void setJobId(int jobId) {
this.jobId = jobId;
}
public double getStartTime(){
return startTime;
}
public double getArrivalTime() {
return arrivalTime;
}
public double getMidArrivalTime() {
return midArrivalTime;
}
public double getLastArrivalTime() {
return lastArrivalTime;
}
public void setLastArrivaltime(double lastArrivalTime) {
this.lastArrivalTime = lastArrivalTime;
}
public void setMidArrivalTime(double midArrivalTime) {
this.midArrivalTime = midArrivalTime;
}
public double getMidDepartureTime() {
return midDepartureTime;
}
public void setMidDepartureTime(double midDepartureTime) {
this.midDepartureTime = midDepartureTime;
}
public double getDepartureTime() {
return departureTime;
}
public void setDepartureTime(double departureTime) {
this.departureTime = departureTime;
}
public double getStartServiceTime() {
return startServiceTime;
}
public void setStartServiceTime(double startServiceTime) {
this.startServiceTime = startServiceTime;
}
@Override
public int compareTo(Jobs jobs) {
return Double.compare(lastArrivalTime, jobs.lastArrivalTime);
}
}
| [
"xping928@gmail.com"
] | xping928@gmail.com |
0a66cad1dd9b96a91e58190400165de57c76f1d7 | 7302554ae8b5017fefb5e2567e08b727bc5e0ae7 | /src/main/java/com/github/zerkseez/jdbc/wrapper/WrappedStruct.java | 80f4299b3601790a2ad90b43f88e8770f1a117cb | [
"Apache-2.0"
] | permissive | zerkseez/jdbc-wrapper | fa85e2594bd24ad98d0cbbca523b76e72dc1ee16 | 19da9adb9db05b0e03a366a69417b1c7f0905bb4 | refs/heads/master | 2021-01-13T09:45:25.503850 | 2016-10-01T23:15:58 | 2016-10-01T23:15:58 | 69,768,553 | 2 | 0 | null | 2016-10-01T23:15:59 | 2016-10-01T23:05:47 | null | UTF-8 | Java | false | false | 1,573 | java | /*******************************************************************************
* Copyright 2016 Xerxes Tsang
*
* 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.github.zerkseez.jdbc.wrapper;
import javax.annotation.Generated;
@Generated("com.github.zerkseez.codegen.wrappergenerator.WrapperGenerator")
public class WrappedStruct implements java.sql.Struct {
private final java.sql.Struct wrappedObject;
public WrappedStruct(final java.sql.Struct wrappedObject) {
this.wrappedObject = wrappedObject;
}
@Override
public Object[] getAttributes() throws java.sql.SQLException {
return wrappedObject.getAttributes();
}
@Override
public Object[] getAttributes(final java.util.Map<String, Class<?>> p0) throws java.sql.SQLException {
return wrappedObject.getAttributes(p0);
}
@Override
public String getSQLTypeName() throws java.sql.SQLException {
return wrappedObject.getSQLTypeName();
}
}
| [
"xerxestph@gmail.com"
] | xerxestph@gmail.com |
6a48e18a40867ca8f9af04260caef11268b077a5 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/7/7_d2f824d8fc3b422da65b715e837b3bc2d01b2517/CRActivePathRequestProcessor/7_d2f824d8fc3b422da65b715e837b3bc2d01b2517_CRActivePathRequestProcessor_s.java | e60c2e3dcdf6bac8c91eb6a87306dace58c2bf34 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 6,283 | java | package com.gentics.cr;
import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;
import org.apache.log4j.Logger;
import com.gentics.api.lib.datasource.Datasource;
import com.gentics.api.lib.datasource.DatasourceException;
import com.gentics.api.lib.exception.ParserException;
import com.gentics.api.lib.expressionparser.ExpressionParserException;
import com.gentics.api.lib.expressionparser.filtergenerator.DatasourceFilter;
import com.gentics.api.lib.resolving.Resolvable;
import com.gentics.cr.exceptions.CRException;
import com.gentics.cr.util.ArrayHelper;
import com.gentics.cr.util.RequestWrapper;
/**
* This RequestProcessor fetches the active path from a child element
* passed in the request as contentid to the root element.
* Either a root element is given, or it will go up until there is no further
* parent.
* It does not support doNavigation.
* Last changed: $Date: 2010-04-01 15:24:02 +0200 (Do, 01 Apr 2010) $
* @version $Revision: 541 $
* @author $Author: supnig@constantinopel.at $
*
*/
public class CRActivePathRequestProcessor extends RequestProcessor {
/**
* Root id key.
*/
private static final String ROOT_ID = "rootid";
/**
* Logger.
*/
private static final Logger LOG = Logger
.getLogger(CRActivePathRequestProcessor.class);
/**
* Create a new instance of CRRequestProcessor.
* @param config configuration.
* @throws CRException in case of error.
*/
public CRActivePathRequestProcessor(final CRConfig config)
throws CRException {
super(config);
}
/**
*
* Fetch the matching objects using the given CRRequest.
* @param request CRRequest
* @param doNavigation defines if to fetch children
* @return resulting objects
* @throws CRException in case of error.
*/
public final Collection<CRResolvableBean> getObjects(
final CRRequest request,
final boolean doNavigation)
throws CRException {
Datasource ds = null;
DatasourceFilter dsFilter;
Collection<CRResolvableBean> collection = null;
RequestWrapper rW = request.getRequestWrapper();
String rootId = rW.getParameter(ROOT_ID);
if (request != null) {
// Parse the given expression and create a datasource filter
try {
ds = this.config.getDatasource();
if (ds == null) {
throw (new DatasourceException("No Datasource available."));
}
dsFilter = request.getPreparedFilter(config, ds);
// add base resolvables
if (this.resolvables != null) {
for (Iterator<String> it = this.resolvables
.keySet().iterator(); it.hasNext();) {
String name = it.next();
dsFilter.addBaseResolvable(name,
this.resolvables.get(name));
}
}
CRResolvableBean bean = loadSingle(ds, request);
if (bean != null) {
collection = getParents(ds, bean, rootId, request);
if (collection == null) {
collection = new Vector<CRResolvableBean>();
}
collection.add(bean);
}
} catch (ParserException e) {
LOG.error("Error getting filter for Datasource.", e);
throw new CRException(e);
} catch (ExpressionParserException e) {
LOG.error("Error getting filter for Datasource.", e);
throw new CRException(e);
} catch (DatasourceException e) {
LOG.error("Error getting result from Datasource.", e);
throw new CRException(e);
} finally {
CRDatabaseFactory.releaseDatasource(ds);
}
}
return collection;
}
/**
* Create prefill attributes.
* @param request request object
* @return attributes as string array
*/
private String[] getPrefillAttributes(final CRRequest request) {
String[] prefillAttributes = request.getAttributeArray();
prefillAttributes = ArrayHelper.removeElements(
prefillAttributes,
"contentid", "updatetimestamp");
return prefillAttributes;
}
/**
* Fetch a single element.
* @param ds datasource
* @param request request
* @return element
* @throws DatasourceException in case of error
* @throws ParserException in case of error
* @throws ExpressionParserException in case of error
*/
private CRResolvableBean loadSingle(final Datasource ds,
final CRRequest request)
throws DatasourceException, ParserException,
ExpressionParserException {
CRResolvableBean bean = null;
String[] attributes = getPrefillAttributes(request);
Collection<Resolvable> col = this.toResolvableCollection(ds.getResult(
request.getPreparedFilter(config, ds),
attributes,
request.getStart().intValue(),
request.getCount().intValue(),
request.getSorting()));
if (col != null && col.size() > 0) {
bean = new CRResolvableBean(col.iterator().next(), attributes);
}
return bean;
}
/**
* Fetches the parents.
* @param ds datasource
* @param current current child element
* @param rootContentId id of the desired root
* @param request request object
* @return collection of parrents.
* @throws CRException
* @throws ExpressionParserException
* @throws ParserException
* @throws DatasourceException
*/
private Collection<CRResolvableBean> getParents(final Datasource ds,
final CRResolvableBean current, final String rootContentId,
final CRRequest request) throws CRException,
DatasourceException, ParserException, ExpressionParserException {
Collection<CRResolvableBean> ret = null;
String mother = current.getMother_id();
if (mother != null && !(current.getMother_type() + "." + mother)
.equals(rootContentId) && !"0".equals(mother)) {
CRRequest nRequest = request.Clone();
nRequest.setRequestFilter(null);
nRequest.setContentid(current.getMother_type() + "." + mother);
CRResolvableBean parent = loadSingle(ds, nRequest);
ret = getParents(ds, parent, rootContentId, nRequest);
if (ret == null) {
ret = new Vector<CRResolvableBean>();
}
ret.add(parent);
}
return ret;
}
@Override
public void finalize() {
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
2d15254ee371698137186dbd6c063419a7aec002 | 9f98e41c1745181e7d2552f2b7629b1b5e0bab04 | /QMSRest/src/main/java/com/qms/rest/repository/MemberRepository.java | d67a2edfd9620c6b45fe5b34ee865dc122c3b79f | [] | no_license | dharishbabu007/HEALTHINSIGHTS | 649d330958833d851c4515daa36dc68230a50049 | 7be3fa1053eeab5834d5a9faf20e612767474420 | refs/heads/master | 2023-03-07T21:18:19.740770 | 2023-02-19T05:22:30 | 2023-02-19T05:22:30 | 135,386,834 | 2 | 1 | null | 2023-02-19T05:22:31 | 2018-05-30T04:11:22 | HTML | UTF-8 | Java | false | false | 488 | java | package com.qms.rest.repository;
import com.qms.rest.model.DimMember;
import com.qms.rest.model.QualityProgram;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource
public interface MemberRepository extends CrudRepository<DimMember, Integer> {
DimMember findDimMemberByMemberId(@Param("memberId") String memberId);
}
| [
"30212@ITCINFOTECH.COM"
] | 30212@ITCINFOTECH.COM |
76abe006e4487356a29ae6ccc3952fde9660a136 | 19a84113a5e00cb53b39bf1e4b2f701a978fa3c5 | /z_cloud4_nacos_client/src/main/java/com/cloud4/nacos/ZCloud4NacosClientApplication.java | 61bf2ef05c5dff9b4d802eea0727f9ebc4296dc8 | [] | no_license | liuheyong/z_alibabacloud_parent2 | 49b19051763f3afd0102be03a72fe11a0fe241fb | e76041b90c8b61749d273e636c15862eafad36d4 | refs/heads/master | 2020-06-15T05:10:49.230487 | 2019-07-17T03:34:37 | 2019-07-17T03:34:37 | 195,211,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package com.cloud4.nacos;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.reactive.function.client.WebClient;
@EnableDiscoveryClient
@SpringBootApplication
public class ZCloud4NacosClientApplication {
public static void main(String[] args) {
SpringApplication.run(ZCloud4NacosClientApplication.class, args);
}
@Bean
@LoadBalanced
public WebClient.Builder loadBalancedWebClientBuilder() {
return WebClient.builder();
}
}
| [
"17682347237@163.com"
] | 17682347237@163.com |
85213cfc3550be4b6388b7085eb3533a4bc02a3b | d89c8bdd54ebedd3190f8d1bd76e60ec94a37b03 | /app/src/main/java/com/example/xueyangzou/sqlapp/MainActivity.java | 2ac25de31888b5a86fb4d7ac2ba9c683871911e2 | [] | no_license | x124zou/551android | c63746c50a9b7f288fd979db8339219579f50c7e | 006982354586ffa31f133d53b12f07ed80de139d | refs/heads/master | 2021-01-10T01:16:41.911187 | 2016-03-16T18:35:36 | 2016-03-16T18:35:36 | 54,057,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,479 | java | package com.example.xueyangzou.sqlapp;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.common.api.GoogleApiClient;
public class MainActivity extends AppCompatActivity {
private static RadioGroup radio_g;
private static RadioButton radio_b;
private static Button button_search;
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
onClickListenerButton();
}
public void onClickListenerButton() {
radio_g = (RadioGroup) findViewById(R.id.rg_restaurants);
button_search = (Button) findViewById(R.id.button_search);
button_search.setOnClickListener(
new View.OnClickListener(){
@Override
public void onClick(View v){
int selected_id = radio_g.getCheckedRadioButtonId();
radio_b = (RadioButton) findViewById(selected_id);
Toast.makeText(MainActivity.this, radio_b.getText().toString(), Toast.LENGTH_SHORT).show();
/*use radio_b.getText().toString() and upload it into the SQLite db
* also, the click of search should start another activity*/
}
}
);
}
@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_main, 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);
}
@Override
public void onStart() {
super.onStart();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.connect();
Action viewAction = Action.newAction(
Action.TYPE_VIEW, // TODO: choose an action type.
"Main Page", // TODO: Define a title for the content shown.
// TODO: If you have web page content that matches this app activity's content,
// make sure this auto-generated web page URL is correct.
// Otherwise, set the URL to null.
Uri.parse("http://host/path"),
// TODO: Make sure this auto-generated app deep link URI is correct.
Uri.parse("android-app://com.example.xueyangzou.sqlapp/http/host/path")
);
AppIndex.AppIndexApi.start(client, viewAction);
}
@Override
public void onStop() {
super.onStop();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
Action viewAction = Action.newAction(
Action.TYPE_VIEW, // TODO: choose an action type.
"Main Page", // TODO: Define a title for the content shown.
// TODO: If you have web page content that matches this app activity's content,
// make sure this auto-generated web page URL is correct.
// Otherwise, set the URL to null.
Uri.parse("http://host/path"),
// TODO: Make sure this auto-generated app deep link URI is correct.
Uri.parse("android-app://com.example.xueyangzou.sqlapp/http/host/path")
);
AppIndex.AppIndexApi.end(client, viewAction);
client.disconnect();
}
}
| [
"xueyangzou@gmail.com"
] | xueyangzou@gmail.com |
056b2aa533eca3d52c37d5b318b1adb7086f257b | 7ca8ffcdfb39ab4ffc2d8ff291e46ffabc8db6a2 | /hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/fairness/RouterRpcFairnessConstants.java | 5e84317293f9952fd3fc65180a6de83055644059 | [
"CC-PDDC",
"CC0-1.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"CDDL-1.0",
"GCC-exception-3.1",
"MIT",
"EPL-1.0",
"Classpath-exception-2.0",
"BSD-3-Clause",
"GPL-2.0-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-jdom",
"CDDL-1.1",
"BSD-2-Clause",
"LicenseRef-scancode-unknown"
] | permissive | apache/hadoop | ea2a4a370dd00d4a3806dd38df5b3cf6fd5b2c64 | 42b4525f75b828bf58170187f030b08622e238ab | refs/heads/trunk | 2023-08-18T07:29:26.346912 | 2023-08-17T16:56:34 | 2023-08-17T16:56:34 | 23,418,517 | 16,088 | 10,600 | Apache-2.0 | 2023-09-14T16:59:38 | 2014-08-28T07:00:08 | Java | UTF-8 | Java | false | false | 1,103 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdfs.server.federation.fairness;
public class RouterRpcFairnessConstants {
/** Name service keyword to identify fan-out calls. */
public static final String CONCURRENT_NS = "concurrent";
/* Hidden constructor */
protected RouterRpcFairnessConstants() {
}
}
| [
"ayushsaxena@apache.org"
] | ayushsaxena@apache.org |
107d3dbece408545b315bdb603f63d1cfc472d5b | ff17aa326a62de027a014fab99a652f593c7381f | /module_mine/src/main/java/com/example/operator/OperatorView.java | b05714812eb0f2e90f97b400d52b1741623bea06 | [] | no_license | majiaxue/jikehui | 401aa2db1a3846bbbef9d29a29cdb934cb18b4c2 | 9b30feb8dbf058954fe59676303fd260ab5282c8 | refs/heads/master | 2022-08-22T18:25:08.014789 | 2020-05-23T10:40:22 | 2020-05-23T10:40:22 | 263,837,386 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 384 | java | package com.example.operator;
import android.support.v4.view.PagerAdapter;
import com.example.mvp.IView;
import com.example.operator.adapter.YysFactorAdapter;
import com.example.operator.adapter.YysQuanyiAdapter;
public interface OperatorView extends IView {
void loadQuanyi(YysQuanyiAdapter adapter);
void loadVp(PagerAdapter adapter);
void loadFactor(String s);
}
| [
"ellliot_zhang_z@163.com"
] | ellliot_zhang_z@163.com |
52e88608af20ca3b99fc4d1e5efe776cc4ffd9fc | 8923ce39164747a6778a4efa0cfdfcfc8dec161f | /src/com/pogo/model/CsvFile.java | 83e13858846016c9abebabcdccdaf14a6e4c2790 | [] | no_license | dks31mar/pogoerp | 26bbd17e075ee4550f732af94749979a5dc04d15 | 7d695d09b6b7caaded83878c544bc32d444c402a | refs/heads/master | 2021-01-12T15:44:01.119709 | 2016-12-22T06:36:03 | 2016-12-22T06:36:14 | 71,873,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,310 | java | package com.pogo.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.web.multipart.MultipartFile;
@Entity
@Table(name="csvfile")
public class CsvFile {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private int id ;
@Column(name = "filename")
private String filename;
@Column(name="size")
private long size;
@Column(name = "date")
private Date date;
/*private MultipartFile file;
public MultipartFile getFile() {
return file;
}
public void setFile(MultipartFile file) {
this.file = file;
}*/
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
| [
"dks31mar@gmail.com"
] | dks31mar@gmail.com |
61fefa6b251e37e3e9df4a2ada3065a40bacf7d5 | 04ff09bc1c3178fc020a2d17e318d5b29da599e6 | /main/src/main/java/com/sxjs/jd/composition/login/changepassage/ChangePasswordPresenterModule.java | 46bf3acb0eb71f6d33796cead8e81c22f73da8e4 | [
"Apache-2.0"
] | permissive | XiePengLearn/refactor-frontend-android | b9b820007ed216c20b7b590c39639e161c63bbdc | 5a08db4065ae4d7a9dc676a4d5328c8f928a8167 | refs/heads/master | 2020-07-26T08:45:39.313596 | 2019-09-26T09:00:15 | 2019-09-26T09:00:15 | 208,593,612 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package com.sxjs.jd.composition.login.changepassage;
import com.sxjs.jd.MainDataManager;
import dagger.Module;
import dagger.Provides;
/**
* @Auther: xp
* @Date: 2019/9/15 10:49
* @Description:
*/
@Module
public class ChangePasswordPresenterModule {
private ChangePasswordContract.View view;
private MainDataManager mainDataManager;
public ChangePasswordPresenterModule(ChangePasswordContract.View view, MainDataManager mainDataManager) {
this.view = view;
this.mainDataManager = mainDataManager;
}
@Provides
ChangePasswordContract.View providerMainContractView() {
return view;
}
@Provides
MainDataManager providerMainDataManager() {
return mainDataManager;
}
}
| [
"769783182@qq.com"
] | 769783182@qq.com |
f0e40d8eb20705f5801a03d461f27ef5a0325bb6 | 42696694e9a31d684cf4c274d53b2267a34b6d06 | /src/main/java/com/github/ddm4j/api/document/config/DocumentConfig.java | 69805cf6fdad4b7ed51e63c9549e70780b74a790 | [] | no_license | DDM916951890/spring-boot-api-document | 319c2ecb5db07a3c68a9c0caa503118c8bb86df1 | 1421829631741e789987dfd4f0c87a2679ffb589 | refs/heads/master | 2022-11-20T10:42:26.022845 | 2020-07-12T03:15:16 | 2020-07-12T03:15:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,302 | java | package com.github.ddm4j.api.document.config;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import com.github.ddm4j.api.document.config.bean.LoginBean;
import com.github.ddm4j.api.document.config.bean.RequestHeaderBean;
/**
* 文档配置
*/
@Component
@ConfigurationProperties(prefix = "api-document.document")
public class DocumentConfig {
// 是否启用
private boolean enable = true;
// 扫描路径
private String path;
// 前缀
// private String prefix;
// 项目名称
private String name;
// 项目版本
private String version;
// 描述
private String describe;
// 登录配置
private LoginBean login;
// 请求头配置
private Map<String, RequestHeaderBean> header = new HashMap<String, RequestHeaderBean>();
// 获取统一路径
@Value("${server.servlet.context-path:}")
private String contextPath = "";
public boolean isEnable() {
return enable;
}
public void setEnable(boolean enable) {
this.enable = enable;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
// public String getPrefix() {
// return prefix;
// }
//
// public void setPrefix(String prefix) {
// this.prefix = prefix;
// }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
public LoginBean getLogin() {
return login;
}
public void setLogin(LoginBean login) {
this.login = login;
}
public String getContextPath() {
return contextPath;
}
public void setContextPath(String contextPath) {
this.contextPath = contextPath;
}
public Map<String, RequestHeaderBean> getHeader() {
return header;
}
public void setHeader(Map<String, RequestHeaderBean> header) {
this.header = header;
}
}
| [
"916951890@qq.com"
] | 916951890@qq.com |
19814cd3941ef6f6122a285d49e3ac867d9feaa8 | 184eb3780ea8619ee44ebca31d470ef6d1f46a6a | /src/main/java/com/example/demo/jobs/ElasticJobFactory.java | 6511894bd257358e43c1b7748f3e2204bf7adba4 | [] | no_license | fancky2019/SpringBootProject | f2ffab05f5af805efd74baf5600b602ee26bcd6a | 635e74813f45876bfa0764c405598c170440e488 | refs/heads/master | 2023-08-12T03:48:06.909002 | 2023-07-22T04:18:21 | 2023-07-22T04:18:21 | 162,677,730 | 0 | 0 | null | 2022-06-20T22:46:20 | 2018-12-21T06:54:06 | Java | UTF-8 | Java | false | false | 2,171 | java | package com.example.demo.jobs;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;
//import sun.reflect.generics.tree.VoidDescriptor;
import javax.annotation.Resource;
import java.util.TimeZone;
@Component
public class ElasticJobFactory {
@Resource
private ZookeeperRegistryCenter registryCenter;
// private static class StaticInnerClass{
// private static final ElasticJobFactory instance=new ElasticJobFactory();
// }
//
// public static ElasticJobFactory getInstance() {
// return StaticInnerClass.instance;
// }
public void setUpSimpleJob(String jobName, String cron) {
//jobName 不能重复
new ScheduleJobBootstrap(registryCenter, new NoShardingJob(),
JobConfiguration.newBuilder(jobName, 1)
.cron(cron).shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build()).schedule();
}
public void updateJob(String jobName, String cron) {
JobRegistry.getInstance().getJobScheduleController(jobName).rescheduleJob(cron, TimeZone.getDefault().getID());
}
public void shutDownJob(String jobName) {
JobRegistry.getInstance().getJobScheduleController(jobName).shutdown();
}
// private static CoordinatorRegistryCenter setUpRegistryCenter() {
// ZookeeperConfiguration zkConfig = new ZookeeperConfiguration(ZOOKEEPER_CONNECTION_STRING, JOB_NAMESPACE);
// CoordinatorRegistryCenter result = new ZookeeperRegistryCenter(zkConfig);
// result.init();
// return result;
// }
}
| [
"709737588@qq.com"
] | 709737588@qq.com |
5056178ccce9e7aab199060e47276e510fd71cf5 | 6654fded19d77b7adc1de87efdaf9c74fcef885f | /app/src/main/java/com/msm/chatapp/Fragments/CallsFragment.java | 6e287136a493dcb4c0cb6bd38f2fa711d9adec7a | [] | no_license | manasmuda/ChatApp | 7e4a33c855680c2fa139a13d30b6f6259b7e4f0a | 99eb4e7f21afaea0af9e70d1e6b595cffd1a5634 | refs/heads/master | 2022-11-20T15:52:56.377163 | 2020-07-22T03:51:22 | 2020-07-22T03:51:22 | 281,488,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,078 | java | package com.msm.chatapp.Fragments;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.msm.chatapp.Adapters.CallsAdapter;
import com.msm.chatapp.Adapters.ChatsAdapter;
import com.msm.chatapp.CallBacks.LoadingCallBack;
import com.msm.chatapp.DataBase.CallDB;
import com.msm.chatapp.DataBase.ChatDB;
import com.msm.chatapp.R;
public class CallsFragment extends Fragment {
private static CallsFragment callsFragment;
private static Context mContext;
private Activity activity;
private static LoadingCallBack lcb;
private RecyclerView callList;
private LinearLayoutManager layoutManager;
public static CallsAdapter callsAdapter;
private boolean scroll=true;
public CallsFragment() {
// Required empty public constructor
}
public static CallsFragment getInstance(Context context,LoadingCallBack lcb) {
if(callsFragment==null) {
callsFragment = new CallsFragment();
mContext=context;
CallsFragment.lcb=lcb;
}
return callsFragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
activity=getActivity();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.calls_fragment,container,false);
callList=view.findViewById(R.id.call_list);
layoutManager=new LinearLayoutManager(mContext);
callList.setLayoutManager(layoutManager);
callsAdapter=new CallsAdapter(mContext);
callList.setAdapter(callsAdapter);
callsAdapter.setCallModelList(CallDB.getPage(callsAdapter.getSize()));
callList.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int visibleItemCount = layoutManager.getChildCount();
int totalItemCount = layoutManager.getItemCount();
int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition();
Log.i("abc","vic"+String.valueOf(visibleItemCount));
Log.i("abc","tic"+String.valueOf(totalItemCount));
Log.i("abc","fvip"+String.valueOf(firstVisibleItemPosition));
if(scroll) {
if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount
&& firstVisibleItemPosition >= 0
&& totalItemCount >= 8) {
Log.i("abc", "addItems");
lcb.loading(true);
final Handler handler = new Handler();
scroll=false;
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
callsAdapter.setCallModelList(CallDB.getPage(callsAdapter.getSize()));
lcb.loading(false);
scroll=true;
}
}, 1000);
}
}
}
});
return view;
}
}
| [
"manasgupta435@gmail.com"
] | manasgupta435@gmail.com |
d2eb5e663a39aa389de90658f1499f93389de31d | 74bc5c65b984fe13233a6ef29eff1eed631af89d | /Test1/src/Generic/BoundedGenericMethod.java | 1e7fdf2469a8e825a900cfa0717fccc42206afec | [] | no_license | hyeonorcle/javaStudy | d0feb91b8b21c87cf9180782b89102dc8a89e203 | c04ae9e042d3b0a28c673de8c11a6b2ed9caa62e | refs/heads/master | 2020-03-22T23:16:18.492755 | 2018-07-20T08:33:31 | 2018-07-20T08:33:31 | 140,799,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package Generic;
/*class Box<T> {
private T ob;
public void set(T o) {
ob = o;
}
public T get() {
return ob;
}
}*/
class BoxFactory {
public static <T extends Number> Box<T> makeBox(T o) {
Box<T> box = new Box<T>();
box.set(o);
System.out.println("Boxed data: " + o.intValue());
return box;
}
}
class Unboxer {
public static <T extends Number> T openBox(Box<T> box) {
System.out.println("Unboxed data: "+ box.get().intValue());
return box.get();
}
}
public class BoundedGenericMethod {
public static void main(String[] args) {
Box<Integer> sBox = BoxFactory.makeBox(new Integer(5959));
int n = Unboxer.openBox(sBox);
System.out.println("Returned data: " + n);
}
}
| [
"User@YD02-08"
] | User@YD02-08 |
b143d0eb21f143d554d8647d9cc1bd0dfe5333ac | 87f3f6827d27720c23faf3c603842e4fc513b8a0 | /src/test/java/com/proshomon/elasticsearch/nokkhotroelastic/proshomon/InsertHouseHoldRFIDTest.java | f5e7e8e55052e69ec5ed15edfc6a0578379009e4 | [] | no_license | meraihan/nokkhotro-elastic | d14fe5f32b431f50b837b06fdfde2f421a17d4d1 | 3b22a873ac0023c277557aa49b9bd9d7d10510e1 | refs/heads/master | 2022-07-05T04:01:49.720576 | 2019-06-11T05:39:33 | 2019-06-11T05:39:33 | 185,194,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,055 | java | package com.proshomon.elasticsearch.nokkhotroelastic.proshomon;
import com.proshomon.elasticsearch.nokkhotroelastic.repository.HouseholdRepository;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.File;
import java.io.FileInputStream;
@Slf4j
@SpringBootTest
@RunWith(SpringRunner.class)
public class InsertHouseHoldRFIDTest {
@Autowired
HouseholdRepository householdRepository;
public static final String XLSX_FILE_PATH = "./190521 Final_HH_Data_Sheet-Uppercase 内码.xlsx";
@Test
@Ignore
public void readWriteFromExcel() throws Exception {
FileInputStream file = new FileInputStream(new File(XLSX_FILE_PATH));
XSSFWorkbook workbook = new XSSFWorkbook(file);
XSSFSheet sheet = workbook.getSheetAt(0);
Row row = sheet.createRow(0);
for(int i=1; i<=sheet.getLastRowNum(); i++){
row = sheet.getRow(i);
String id;
if(row.getCell(0)==null){id = "0";}
else {
id = row.getCell(0).toString();
}
String cardNo;
Cell cNo = row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
if (cNo != null) {
cNo.setCellType(CellType.STRING);
cardNo = "0" + cNo.getStringCellValue();
}
else {
cardNo = null;
}
try {
householdRepository.update(cardNo, id);
} catch (Exception e){
log.error("Inserting Data Failed: {}", e);
}
}
}
}
| [
"sayedmahmudraihan@gmail.com"
] | sayedmahmudraihan@gmail.com |
cce311d22621a4c55b3b4a1bcd2a8d1eac63cd44 | e129cc3d79473f21a95a4ed0067623a74f53858f | /src/main/java/br/com/rafaelcarvalho/libraryapi/LibraryApiApplication.java | cf5e40ada078a109dbe8fad4e69225ce090c2914 | [] | no_license | rafael2911/book-api | e0ee82f0baed6914aa6286dd69271cd12defd73a | 199401153fca0ad27b52eb85a9d5d1cb10d3b72d | refs/heads/master | 2020-12-21T11:00:08.248718 | 2020-02-03T01:44:48 | 2020-02-03T01:44:48 | 236,410,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package br.com.rafaelcarvalho.libraryapi;
import org.modelmapper.ModelMapper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class LibraryApiApplication {
@Bean
public ModelMapper modelMapper(){
return new ModelMapper();
}
public static void main(String[] args) {
SpringApplication.run(LibraryApiApplication.class, args);
}
}
| [
"crcarvalho@outlook.com.br"
] | crcarvalho@outlook.com.br |
5c1a9df27d6173d11f474b0720506336419b2b8f | 07d17b649f6e3d6816806a408024b25ef2936854 | /src/main/java/com/example/demo/Instructor.java | 8e55b8bfc292b244168acce8d9e5c5a8d230cfbb | [] | no_license | long-stephen-michael/SpringClassroom | 021a21581870598d94d50668483448a4a53b8a4b | d7ad3837ddde10d3df6c9a31aa27e5061cfce915 | refs/heads/main | 2023-01-05T22:34:02.749673 | 2020-11-02T02:29:36 | 2020-11-02T02:29:36 | 309,224,601 | 0 | 0 | null | 2020-11-02T01:15:20 | 2020-11-02T01:15:19 | null | UTF-8 | Java | false | false | 678 | java | package com.example.demo;
public class Instructor extends Person implements Teacher{
Instructor(long id, String name) {
super(id, name);
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
@Override
public void teach(Learner learner, double numberOfHours) {
// TODO Auto-generated method stub
}
@Override
public void lecture(Iterable<? extends Learner> learners, double numberOfHours) {
// TODO Auto-generated method stub
//double numberOfHoursPerLearner = numberOfHours / learners.length;
}
public static int size() {
// TODO Auto-generated method stub
return 0;
}
}
| [
"long.stephen.michael@gmail.com"
] | long.stephen.michael@gmail.com |
26ed2e1dfc43894aed0b78eb3e6181f14e213a53 | 5f14a75cb6b80e5c663daa6f7a36001c9c9b778c | /src/com/ubercab/payment/internal/vendor/baidu/BaiduApi.java | 3a75f4af7f181364775a99cdb77fa1d089b94ce3 | [] | no_license | MaTriXy/com.ubercab | 37b6f6d3844e6a63dc4c94f8b6ba6bb4eb0118fb | ccd296d27e0ecf5ccb46147e8ec8fb70d2024b2c | refs/heads/master | 2021-01-22T11:16:39.511861 | 2016-03-19T20:58:25 | 2016-03-19T20:58:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.ubercab.payment.internal.vendor.baidu;
import com.ubercab.payment.internal.vendor.baidu.model.AuthorizationDetails;
import retrofit.Callback;
import retrofit.http.GET;
import retrofit.http.Query;
abstract interface BaiduApi
{
@GET("/rt/riders/baidu-wallet/connect")
public abstract void getAuthorizationDetails(@Query("pageUrl") String paramString, Callback<AuthorizationDetails> paramCallback);
}
/* Location:
* Qualified Name: com.ubercab.payment.internal.vendor.baidu.BaiduApi
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
707f13bf8c7ca0cd96ec999c59134df6704369e3 | f0f1f1cf4eaa91a18b709da811d52b874d0d2d8a | /src/main/java/edu/pingpong/bicipalma/BiciPalma/BiciPalma.java | 1af45e8f35c8b56dab28ef438bc9f8fa83c20f26 | [] | no_license | sgonzalezb/Bicipalma2 | 4cacd2ad80286a8317cbea380a762ba5d9bb40dd | 21ff24f1f3334421903fa4ef7dcb51072964a451 | refs/heads/main | 2023-03-05T22:12:57.691616 | 2021-02-22T09:29:02 | 2021-02-22T09:29:02 | 339,191,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,237 | java | package edu.pingpong.bicipalma.BiciPalma;
import edu.pingpong.bicipalma.domain.bicicleta.Bicicleta;
import edu.pingpong.bicipalma.domain.estacion.Estacion;
import edu.pingpong.bicipalma.domain.tarjetausuario.TarjetaUsuario;
public class BiciPalma {
public static void main(String[] args) {
Estacion estacion = new Estacion(1, "Manacor", 6);
/**
* caso TEST visualizar estado de la estacion:
* muestra id, direccion, anclaje
*/
System.out.println("\n **** caso TEST visualizar estado de la estacion **** \n");
estacion.consultarEstacion();
/**
* caso TEST visualizar anclajes libres
*/
System.out.println("\n **** caso TEST visualizar anclajes libres **** \n");
System.out.println("anclajesLibres: " + estacion.anclajesLibre());
estacion.consultarAnclajes();
/**
* caso TEST anclar bicicleta(s)
*/
System.out.println("\n **** caso TEST anclar bicicleta(s) **** \n");
int[] bicicletas = { 291, 292, 293, 294 };
Bicicleta bicicleta = null;
for (int id : bicicletas) {
bicicleta = new Bicicleta(id);
estacion.anclarBicicleta(bicicleta);
}
System.out.println("anclajes libres tras generar " + bicicletas.length
+ " bicis: " + estacion.anclajesLibre());
/**
* Caso TEST consultar bicicletas ancladas
*/
System.out.println("\n **** caso TEST consultar bicicletas ancladas **** \n");
estacion.consultarAnclajes();
/**
* Caso TEST retirar bicicleta
*/
System.out.println("\n **** caso TEST retirar bicicleta **** \n");
TarjetaUsuario tarjetaUsuario = new TarjetaUsuario("000456789", true);
System.out.println("¿tarjeta de usuario activada? (true/false): "
+ estacion.leerTarjetaUsuario(tarjetaUsuario));
estacion.retirarBicicleta(tarjetaUsuario);
estacion.consultarAnclajes();
System.out.println("anclajesLibres: " + estacion.anclajesLibre());
/**
* Caso TEST tarjeta inactiva
*/
System.out.println("\n **** caso TEST tarjeta inactiva **** \n");
tarjetaUsuario.setActivada(false);
System.out.println("¿tarjeta de usuario activada? (true/false): "
+ estacion.leerTarjetaUsuario(tarjetaUsuario));
estacion.retirarBicicleta(tarjetaUsuario);
estacion.consultarAnclajes();
}
} | [
"sgonzalezb@cifpfbmoll.eu"
] | sgonzalezb@cifpfbmoll.eu |
6d5a024d361845fa52a1f4ccade2d847562ba363 | 45a4ca5915fbed0cf63cedd5ac65b33bbea324df | /LinkedList/src/Nodo.java | bca17409f91c682304d1f6ae075d81d897d3be49 | [] | no_license | Andxtorres/Estructura-de-Datos-Enero-2018 | a742e3a83b25c4831205225ee0905f5a67128c17 | 7fc91e26a88687151429bf2e8c7ce8bf9311d676 | refs/heads/master | 2021-04-24T19:14:16.290925 | 2018-05-07T21:02:38 | 2018-05-07T21:02:38 | 117,579,701 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 386 | java |
public class Nodo<T> {
private T elemento;
private Nodo<T> siguiente;
public Nodo(T elemento){
this.elemento=elemento;
}
public T getElemento() {
return elemento;
}
public void setElemento(T elemento) {
this.elemento = elemento;
}
public Nodo<T> getSiguiente() {
return siguiente;
}
public void setSiguiente(Nodo<T> siguiente) {
this.siguiente = siguiente;
}
}
| [
"andxtorres22@gmail.com"
] | andxtorres22@gmail.com |
bef6718bcc50d89c5a3866d1ffbf91d5d48a7c7c | cef342c3b590b48a9f9b495dc2036b1d75314601 | /app/src/main/java/daniele/iterinteractive/it/discoverpalermo/util/SystemUiHiderBase.java | a4790aa2be299d1e6d3328862e1dd4160ec76954 | [] | no_license | danielemontemaggiore/iterinteractive | e6433a8b2bbf9e230e37aea489d29db3784b0bd4 | c40fd97a5c17c65b1a3e8768ae21bb4a6f3d3ef7 | refs/heads/master | 2020-04-05T14:36:29.206845 | 2016-08-31T07:56:05 | 2016-08-31T07:56:05 | 59,473,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,037 | java | package daniele.iterinteractive.it.discoverpalermo.util;
import android.app.Activity;
import android.view.View;
import android.view.WindowManager;
/**
* A base implementation of {@link SystemUiHider}. Uses APIs available in all
* API levels to show and hide the status bar.
*/
public class SystemUiHiderBase extends SystemUiHider {
/**
* Whether or not the system UI is currently visible. This is a cached value
* from calls to {@link #hide()} and {@link #show()}.
*/
private boolean mVisible = true;
/**
* Constructor not intended to be called by clients. Use
* {@link SystemUiHider#getInstance} to obtain an instance.
*/
protected SystemUiHiderBase(Activity activity, View anchorView, int flags) {
super(activity, anchorView, flags);
}
@Override
public void setup() {
if ((mFlags & FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES) == 0) {
mActivity.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
}
@Override
public boolean isVisible() {
return mVisible;
}
@Override
public void hide() {
if ((mFlags & FLAG_FULLSCREEN) != 0) {
mActivity.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mOnVisibilityChangeListener.onVisibilityChange(false);
mVisible = false;
}
@Override
public void show() {
if ((mFlags & FLAG_FULLSCREEN) != 0) {
mActivity.getWindow().setFlags(
0,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mOnVisibilityChangeListener.onVisibilityChange(true);
mVisible = true;
}
}
| [
"danidix@hotmail.com"
] | danidix@hotmail.com |
12f791bc3ff49050c6498adcaf498055daf1fad0 | 129f58086770fc74c171e9c1edfd63b4257210f3 | /src/testcases/CWE80_XSS/CWE80_XSS__CWE182_getCookies_Servlet_06.java | 701dd8ffedbc1bb13e8ebdaa67ebe69744d589b5 | [] | no_license | glopezGitHub/Android23 | 1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba | 6215d0684c4fbdc7217ccfbedfccfca69824cc5e | refs/heads/master | 2023-03-07T15:14:59.447795 | 2023-02-06T13:59:49 | 2023-02-06T13:59:49 | 6,856,387 | 0 | 3 | null | 2023-02-06T18:38:17 | 2012-11-25T22:04:23 | Java | UTF-8 | Java | false | false | 5,380 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE80_XSS__CWE182_getCookies_Servlet_06.java
Label Definition File: CWE80_XSS__CWE182.label.xml
Template File: sources-sink-06.tmpl.java
*/
/*
* @description
* CWE: 80 Cross Site Scripting (XSS)
* BadSource: getCookies_Servlet Read data from the first cookie using getCookies()
* GoodSource: A hardcoded string
* BadSink: Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS (CWE 182: Collapse of Data into Unsafe Value)
* Flow Variant: 06 Control flow: if(private_final_five==5) and if(private_final_five!=5)
*
* */
package testcases.CWE80_XSS;
import testcasesupport.*;
import javax.servlet.http.*;
import javax.servlet.http.*;
public class CWE80_XSS__CWE182_getCookies_Servlet_06 extends AbstractTestCaseServlet
{
/* The variable below is declared "final", so a tool should be able
to identify that reads of this will always give its initialized
value. */
private final int private_final_five = 5;
/* uses badsource and badsink */
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
if(private_final_five == 5)
{
data = ""; /* initialize data in case there are no cookies */
/* Read data from cookies */
{
Cookie cookieSources[] = request.getCookies();
if (cookieSources != null)
{
/* POTENTIAL FLAW: Read data from the first cookie value */
data = cookieSources[0].getValue();
}
}
}
else {
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
/* FIX: Use a hardcoded string */
data = "foo";
}
if (data != null)
{
/* POTENTIAL FLAW: Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS with strings like <scr<script>ipt> (CWE 182: Collapse of Data into Unsafe Value) */
response.getWriter().println("<br>bad(): data = " + data.replaceAll("(<script>)", ""));
}
}
/* goodG2B1() - use goodsource and badsink by changing private_final_five==5 to private_final_five!=5 */
private void goodG2B1(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
if(private_final_five != 5)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
data = ""; /* initialize data in case there are no cookies */
/* Read data from cookies */
{
Cookie cookieSources[] = request.getCookies();
if (cookieSources != null)
{
/* POTENTIAL FLAW: Read data from the first cookie value */
data = cookieSources[0].getValue();
}
}
}
else {
/* FIX: Use a hardcoded string */
data = "foo";
}
if (data != null)
{
/* POTENTIAL FLAW: Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS with strings like <scr<script>ipt> (CWE 182: Collapse of Data into Unsafe Value) */
response.getWriter().println("<br>bad(): data = " + data.replaceAll("(<script>)", ""));
}
}
/* goodG2B2() - use goodsource and badsink by reversing statements in if */
private void goodG2B2(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
if(private_final_five == 5)
{
/* FIX: Use a hardcoded string */
data = "foo";
}
else {
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
data = ""; /* initialize data in case there are no cookies */
/* Read data from cookies */
{
Cookie cookieSources[] = request.getCookies();
if (cookieSources != null)
{
/* POTENTIAL FLAW: Read data from the first cookie value */
data = cookieSources[0].getValue();
}
}
}
if (data != null)
{
/* POTENTIAL FLAW: Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS with strings like <scr<script>ipt> (CWE 182: Collapse of Data into Unsafe Value) */
response.getWriter().println("<br>bad(): data = " + data.replaceAll("(<script>)", ""));
}
}
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
goodG2B1(request, response);
goodG2B2(request, response);
}
/* 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);
}
}
| [
"guillermo.pando@gmail.com"
] | guillermo.pando@gmail.com |
4939bfcf2434b716e2a77965cedd93b45855e904 | cd1ca0766bb062935fa7af416620ad3b95f6971b | /演示代码备份/第4章 Hibernate框架/HibernateHQL/src/dps/test/hibernateTest.java | 253af87d3be1c35c7ad129807d35c6bc57d93883 | [] | no_license | CXH2015/ppt_code | a0deecaa726fc891daca4f382e40fb08e6ce8421 | 02dada29e9cfa96036a353736f87cd6a6675cc4e | refs/heads/master | 2021-07-25T09:04:42.155926 | 2017-11-07T12:16:19 | 2017-11-07T12:16:19 | 109,831,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,327 | java | package dps.test;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.hibernate.Session;
import org.hibernate.Transaction;
import dps.bean.MyClass;
import dps.bean.Student;
import dps.util.HibernateSessionFactory;
public class hibernateTest {
/**
* @param args
*/
public static void main(String[] args) {
hibernateTest test = new hibernateTest();
test.OpHqlTest2();
}
//使用HQL查询年龄小于21岁的学生记录--位置参数
public void OpHqlTest()
{
Session session = HibernateSessionFactory.getSession();
String strHQl = "from Student s where s.sage<? ";
List<Student> myList = session.createQuery(strHQl).setParameter(0, 21).list();
for(Student s:myList)
{
System.out.println(s);
}
HibernateSessionFactory.closeSession();
}
//使用HQL查询年龄小于21岁的学生记录--命名参数
public void OpHqlTest2()
{
Session session = HibernateSessionFactory.getSession();
String strHQl = "from Student s where s.sage<:age ";
List<Student> myList = session.createQuery(strHQl).setParameter("age", 21).list();
for(Student s:myList)
{
System.out.println(s);
}
HibernateSessionFactory.closeSession();
}
//向数据库中添加记录
public void OpAdd()
{
Session session = HibernateSessionFactory.getSession();
Transaction tx = session.beginTransaction();
Student s1 = new Student("2014123001", "学生1", 20, new Date());
Student s2 = new Student("2014123002", "学生2", 19, new Date());
Student s3 = new Student("2014123003", "学生3", 21, new Date());
Student s4 = new Student("2014123004", "学生4", 20, new Date());
Student s5 = new Student("2014123005", "学生5", 24, new Date());
Student s6 = new Student("2014123006", "学生6", 20, new Date());
Student s7 = new Student("2014123007", "学生7", 22, new Date());
MyClass myClass = new MyClass("2014Java专业 ");
s1.setMyClass(myClass);
s2.setMyClass(myClass);
s3.setMyClass(myClass);
s4.setMyClass(myClass);
s5.setMyClass(myClass);
s6.setMyClass(myClass);
s7.setMyClass(myClass);
session.save(s1);
session.save(s2);
session.save(s3);
session.save(s4);
session.save(s5);
session.save(s6);
session.save(s7);
tx.commit();
HibernateSessionFactory.closeSession();
}
}
| [
"aichengxinhua@163.com"
] | aichengxinhua@163.com |
b9cc8c14804f46f6e5ad561afaed0dce56226dc6 | 3da7df7f993ed58a607f983ef6fdbabb895df4b1 | /mypush-im-route/src/main/java/com/lyh/route/config/RedisConfig.java | 80e59b93f2e3603d53b56629a4bcda9b16f48703 | [] | no_license | lyhixx/mypush | 3b14990479a669600312b8390ea0f6910caf0191 | 5772f93f767c2e46c62385f3e71c24ea20d1999b | refs/heads/master | 2023-08-08T05:13:08.690182 | 2019-09-19T07:15:47 | 2019-09-19T07:15:47 | 201,185,865 | 2 | 1 | null | 2023-07-22T13:00:50 | 2019-08-08T05:40:34 | Java | UTF-8 | Java | false | false | 2,122 | java | package com.lyh.route.config;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import com.axdoctor.tools.redis.RedisPool;
import com.axdoctor.tools.redis.RedisUtil;
import com.lyh.common.cache.redis.ServerNodeCache;
import com.lyh.common.cache.redis.UserTokenCache;
@Component
@PropertySource(value= "classpath:/application.properties")
public class RedisConfig {
@Value("${redis.host}")
public String redisHost;
public RedisPool redisPool(){
RedisPool redisPool = new RedisPool();
redisPool.setServerHostMaster(redisHost);
redisPool.init();
return redisPool;
}
@Bean("redisUtil")
public RedisUtil redisUtil(){
RedisUtil redisUtil = new RedisUtil();
redisUtil.setJedisPool(redisPool());
return redisUtil;
}
@Bean("redissonClient")
public RedissonClient redissonClient() {
Config config = new Config();
SingleServerConfig singleServerConfig = config.useSingleServer();
// String schema = "redis://";
singleServerConfig.setAddress(redisHost + ":" + 6379);
singleServerConfig.setConnectionPoolSize(10);
// 其他配置项都先采用默认值
return Redisson.create(config);
}
@Bean("serverNodeCache")
public ServerNodeCache serverNodeCache(RedisUtil redisUtil,RedissonClient redissonClient){
ServerNodeCache serverNodeCache = new ServerNodeCache();
serverNodeCache.setRedisUtil(redisUtil);
serverNodeCache.setRedissonClient(redissonClient);
serverNodeCache.init();
return serverNodeCache;
}
@Bean("userTokenCache")
public UserTokenCache userTokenCache(RedisUtil redisUtil,ServerNodeCache serverNodeCache){
UserTokenCache userTokenCache = new UserTokenCache();
userTokenCache.setRedisUtil(redisUtil);
userTokenCache.setServerNodeCache(serverNodeCache);
return userTokenCache;
}
}
| [
"liyanhui@172.16.2.201"
] | liyanhui@172.16.2.201 |
647e4a29a7a76b0ab45a4d08c249fcc7dd081422 | 8eeee50505f6515a74a37323eb444225b52489af | /src/test/java/com/app/up/Aes256EncryptionServiceApplicationTests.java | 93861775bd938205907d04dff087c433bf3e01d1 | [] | no_license | pratikw1859/AES-256-Encryption-Service | 7e52f7ad815cc04500f146f5d8d4e07af3d74e16 | 2e819ccf93e11dd9bc76ea9d70af58743d947749 | refs/heads/master | 2021-01-26T03:36:05.636009 | 2020-02-27T03:39:49 | 2020-02-27T03:39:49 | 243,292,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package com.app.up;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Aes256EncryptionServiceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"pratikw1859@gmail.com"
] | pratikw1859@gmail.com |
c703e859c69c993e2fe80747811bfb577cb62cea | b0b7dd4867f90f50c2299fb4da3c9d318441e7a8 | /takinmq-jafka/src/main/java/io/jafka/mx/ServerInfoMBean.java | 572926ce2d19f22e7500a9f2caba2cbceed2949a | [
"Apache-2.0"
] | permissive | lemonJun/TakinMQ | a0a5e9d0ecf5e5afdfaa1e3e03ee96b0791df57b | dcb26f95737e023698ddef46ba2c12ba77001e8c | refs/heads/master | 2021-01-22T02:39:49.302258 | 2017-06-15T03:26:22 | 2017-06-15T03:26:22 | 81,061,837 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.jafka.mx;
/**
* Server information
* @author adyliu (imxylz@gmail.com)
* @since 1.1
*/
public interface ServerInfoMBean {
String getVersion();
String getStartupTime();
String getStartedTime();
String getRunningTime();
}
| [
"506526593@qq.com"
] | 506526593@qq.com |
bcd59a6437c0925faae44b02db63253deb4003af | 0ad51dde288a43c8c2216de5aedcd228e93590ac | /src/com/vmware/converter/ConverterInvalidTargetProductVersion.java | c0aef0f0f9be67310f994e18f5264ebec2eaab7f | [] | no_license | YujiEda/converter-sdk-java | 61c37b2642f3a9305f2d3d5851c788b1f3c2a65f | bcd6e09d019d38b168a9daa1471c8e966222753d | refs/heads/master | 2020-04-03T09:33:38.339152 | 2019-02-11T15:19:04 | 2019-02-11T15:19:04 | 155,151,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,684 | java | /**
* ConverterInvalidTargetProductVersion.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.vmware.converter;
public class ConverterInvalidTargetProductVersion extends com.vmware.converter.ConverterConverterFault implements java.io.Serializable {
private java.lang.String targetProductVersion;
public ConverterInvalidTargetProductVersion() {
}
public ConverterInvalidTargetProductVersion(
com.vmware.converter.LocalizedMethodFault faultCause,
com.vmware.converter.LocalizableMessage[] faultMessage,
java.lang.String targetProductVersion) {
super(
faultCause,
faultMessage);
this.targetProductVersion = targetProductVersion;
}
/**
* Gets the targetProductVersion value for this ConverterInvalidTargetProductVersion.
*
* @return targetProductVersion
*/
public java.lang.String getTargetProductVersion() {
return targetProductVersion;
}
/**
* Sets the targetProductVersion value for this ConverterInvalidTargetProductVersion.
*
* @param targetProductVersion
*/
public void setTargetProductVersion(java.lang.String targetProductVersion) {
this.targetProductVersion = targetProductVersion;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof ConverterInvalidTargetProductVersion)) return false;
ConverterInvalidTargetProductVersion other = (ConverterInvalidTargetProductVersion) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.targetProductVersion==null && other.getTargetProductVersion()==null) ||
(this.targetProductVersion!=null &&
this.targetProductVersion.equals(other.getTargetProductVersion())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getTargetProductVersion() != null) {
_hashCode += getTargetProductVersion().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(ConverterInvalidTargetProductVersion.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("urn:converter", "ConverterInvalidTargetProductVersion"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("targetProductVersion");
elemField.setXmlName(new javax.xml.namespace.QName("urn:converter", "targetProductVersion"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
/**
* Writes the exception data to the faultDetails
*/
public void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context) throws java.io.IOException {
context.serialize(qname, null, this);
}
}
| [
"yuji_eda@dwango.co.jp"
] | yuji_eda@dwango.co.jp |
81706ab35edbb62c9fc6ae0f49cf1e9a549ff2a0 | 1578433be82bd9b09636b2681d84eaba232fd3a5 | /mainmenu/src/main/java/jankowiak/kamil/mainmenu/App.java | 1734af368f54b8439f5079d7b4e16150c819d987 | [] | no_license | kjdeveloper/SimpleShoppingManagement | 65b3b7625683da023f37bc0431cac331b64d5ec9 | 35540e25809ab728f00cc268fa0277be081c508e | refs/heads/master | 2022-05-30T04:50:02.302434 | 2019-06-05T15:02:55 | 2019-06-05T15:02:55 | 189,732,417 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | package jankowiak.kamil.mainmenu;
import jankowiak.kamil.mainmenu.menu.MenuService;
public class App {
public static void main(String[] args) {
/*DataGeneratorService dataGeneratorService = new DataGeneratorService();
dataGeneratorService.saveToFile("C:\\Programowanie\\ShoppingManagementFinal\\persistence\\src\\main\\java\\jankowiak\\kamil\\persistence\\resources\\shoppingManagementOrderList.json");*/
var filename = "C:\\Users\\Admin\\Desktop\\Git\\ShoppingManagement\\persistence\\src\\main\\java\\jankowiak\\kamil\\persistence\\resources\\shoppingManagementOrderList.json";
var menuService = new MenuService(filename);
menuService.mainMenu();
}
}
| [
"kjdeveloper247@gmail.com"
] | kjdeveloper247@gmail.com |
4f0b69b86c4b9824abf14ab929730fca1d075e1a | 3d846bff897cfeae52c2fc29ee6725d3c098c3c2 | /src/com/tsekhanovich/functional/practice6/Task2.java | 76756f5aa2fdcf8a3f0997e975d6fc46933d0c3a | [] | no_license | PavelTsekhanovich/JavaFunctional | 2f250ab3d90472e7473fb6d697ca42443e6f9f37 | a33a281ac0a062d2f9f21de5095b1c0fb38dad35 | refs/heads/master | 2021-06-26T03:25:24.471267 | 2020-10-21T14:19:09 | 2020-10-21T14:19:09 | 157,601,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package com.tsekhanovich.functional.practice6;
import java.util.function.Function;
/**
* @author Pavel Tsekhanovcih 10.11.2018
* <p>
* Using closure write a lambda expression that adds prefix (before) and suffix (after) to its single string argument;
* prefix and suffix are final variables and will be available in the context during testing.
* All whitespaces on the both ends of the argument must be removed. Do not trim prefix, suffix and the result string.
* Solution format. Submit your lambda expression in any valid format with ; on the end.
* <p>
* Examples: (x, y) -> x + y; (x, y) -> { return x + y; }
*/
public class Task2 {
public static void main(String[] args) {
String prefix = "<";
String suffix = ">";
Function<String, String> example1 = s -> prefix + s.trim() + suffix;
System.out.println(example1.apply("Test"));
}
}
| [
"p.tsekhanovich93@gmail.com"
] | p.tsekhanovich93@gmail.com |
545f75533ca5dc12280af8929b337e52f25c4c0d | ca313720181e65d33d2756e58877f0287586452a | /Intro to Computer Networks /Project3/RequestDecoder.java | d984579b2a310cad363a5aca67232196c0d2c539 | [] | no_license | ljyjl/Auburn-University | cb0eeab76570bff0b0c65ce5e03442cdbd9ba3ff | 3fb3378a06e91cf294a9b90aad950a41b22e679b | refs/heads/master | 2023-01-23T04:52:11.992939 | 2020-11-30T02:16:26 | 2020-11-30T02:16:26 | 315,834,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 255 | java | import java.io.*; // for InputStream and IOException
import java.net.*; // for DatagramPacket
public interface RequestDecoder {
Request decode(InputStream source) throws IOException;
Request decode(DatagramPacket packet) throws IOException;
}
| [
"jzl0213@auburn.edu"
] | jzl0213@auburn.edu |
d0b97be92c90e4dd2db61e44f7f24c42fdbe06a5 | d1ea794384b809075a4a3395cddf90a8ab514f51 | /src/bank/model/CheckingAccount.java | 6ff7d11cb2357d302ee1548606e1377bb03aba3f | [] | no_license | gfasil/Finco | 09d186823f78e7388eae8297fcb4dbf91ee85700 | 4bcc395b69ca4427b262bfa726cf3b8e21995720 | refs/heads/master | 2020-11-25T03:29:10.931110 | 2019-12-19T17:29:16 | 2019-12-19T17:29:16 | 228,481,124 | 0 | 1 | null | 2019-12-17T22:48:08 | 2019-12-16T21:43:20 | Java | UTF-8 | Java | false | false | 393 | java | package bank.model;
import framework.model.AbstractAccount;
import framework.model.ICustomer;
public class CheckingAccount extends AbstractAccount {
public CheckingAccount(ICustomer owner) {
super(owner);
}
@Override
public double getInterest() {
return 0.00967;
}
@Override
public String getType() {
return "CheckingAccount";
}
}
| [
"fhabtegiorgis@mum.edu"
] | fhabtegiorgis@mum.edu |
b017427ec7f2970d42d571aecd5e24a8fff7e87a | 881dc9478bd27f7621515b454343e70bd1aa4ee5 | /ecomerce/ecomerce/src/main/java/br/com/unialfa/ecomerce/produto/repository/ProdutoRepository.java | 3834090297fdd4abc1eb8b1391003dae6ffe12bc | [] | no_license | VictorMachado38/dev-para-internet | feeca9d00c2d799b0b9c1d53bc0a71678cc62dc4 | 4ab443d062a738dba0c26ad255131ae4baae9951 | refs/heads/master | 2023-07-04T18:51:34.780471 | 2021-08-27T16:05:43 | 2021-08-27T16:05:43 | 349,587,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package br.com.unialfa.ecomerce.produto.repository;
import br.com.unialfa.ecomerce.produto.domain.Produto;
import org.springframework.data.repository.CrudRepository;
public interface ProdutoRepository extends CrudRepository<Produto,Long> {
}
| [
"54145667+VictorMachado38@users.noreply.github.com"
] | 54145667+VictorMachado38@users.noreply.github.com |
341e206876a37ee0ec16c317c2481a59b33287ac | 0b7fd8738088bd93403a005ecf9ea65da4d93259 | /src/main/java/tonegod/gui/controls/extras/emitter/ImpulseInfluencer.java | 847e4e88a77c91cc06e38530c4c78dce250f037c | [
"BSD-2-Clause-Views"
] | permissive | repetti/jmegui | 0b4fef68caadc6d6215cbe3222a5310961091e71 | 598a2f6bfc5797ef12499108eb31c771d06fadd9 | refs/heads/master | 2020-05-28T09:42:22.090479 | 2015-04-12T21:39:55 | 2015-04-12T21:39:55 | 33,828,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tonegod.gui.controls.extras.emitter;
import com.jme3.math.FastMath;
import com.jme3.math.Vector2f;
import tonegod.gui.controls.extras.emitter.ElementEmitter.ElementParticle;
/**
*
* @author t0neg0d
*/
public class ImpulseInfluencer extends InfluencerBase {
private boolean isEnabled = true;
private Vector2f temp = new Vector2f();
private Vector2f temp2 = new Vector2f();
private float variationStrength = 0.35f;
public ImpulseInfluencer(ElementEmitter emitter) {
super(emitter);
}
@Override
public void update(ElementParticle particle, float tpf) {
if (isEnabled) {
float incX = FastMath.nextRandomFloat();
if (FastMath.rand.nextBoolean()) incX = -incX;
float incY = FastMath.nextRandomFloat();
if (FastMath.rand.nextBoolean()) incY = -incY;
temp.set(particle.velocity).addLocal(incX, incY);
particle.velocity.interpolate(temp, (variationStrength));
}
}
@Override
public void initialize(ElementParticle particle) {
}
@Override
public boolean getIsEnabled() {
return this.isEnabled;
}
@Override
public void setIsEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
}
public void setVariationStrength(float variationStrength) {
this.variationStrength = variationStrength;
}
@Override
public ImpulseInfluencer clone() {
ImpulseInfluencer clone = new ImpulseInfluencer(emitter);
clone.setVariationStrength(variationStrength);
clone.setIsEnabled(isEnabled);
return clone;
}
}
| [
"repetti@users.noreply.github.com"
] | repetti@users.noreply.github.com |
cecd538cf4c8bcd2d4c446be5591fd4d140fd93c | 8da943247ff17374c7ff916f99c28897c8abc269 | /src/main/java/com/qa/todo/ToDoListApiApplication.java | 4a3d175c22463ee1eef2ebfa0284125c639d108e | [] | no_license | JHarry444/To-Do-List-API | 1cb09bb1f612008d905f3e20149ed59ce98d4834 | 47c8549dc965cad0973fb0438bb7f3ea634f42c5 | refs/heads/master | 2020-06-27T17:27:22.586545 | 2019-08-01T08:28:45 | 2019-08-01T08:28:45 | 200,008,396 | 0 | 0 | null | 2019-08-22T09:27:16 | 2019-08-01T08:18:27 | Java | UTF-8 | Java | false | false | 314 | java | package com.qa.todo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ToDoListApiApplication {
public static void main(String[] args) {
SpringApplication.run(ToDoListApiApplication.class, args);
}
}
| [
"jordan.harrison@qa.com"
] | jordan.harrison@qa.com |
8da8d7781b68aff5ec66c70539cfadba3bd78caa | f86938ea6307bf6d1d89a07b5b5f9e360673d9b8 | /CodeComment_Data/Code_Jam/val/Revenge_of_the_Pancakes/S/pancakes(147).java | d8e4ff1277f1407f338068c569c805bbcab22aa3 | [] | no_license | yxh-y/code_comment_generation | 8367b355195a8828a27aac92b3c738564587d36f | 2c7bec36dd0c397eb51ee5bd77c94fa9689575fa | refs/heads/master | 2021-09-28T18:52:40.660282 | 2018-11-19T14:54:56 | 2018-11-19T14:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,604 | java | package methodEmbedding.Revenge_of_the_Pancakes.S.LYD798;
//DANIEL YANG CODEJAM
import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;
public class pancakes{
public static void main(String args[]) throws IOException
{
BufferedReader f = new BufferedReader(new FileReader("pancakes.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("pancakes.out")));
StringTokenizer st = new StringTokenizer(f.readLine());
int N = Integer.parseInt(st.nextToken());
String temp, x;
int caseNum = 1;
int result = 0;
for(int z = 0; z < N; z++)
{
temp = f.readLine();
//System.out.println(temp);
for(int i = temp.length()-1; i >= 0; i--)//if last character is +/-
{
if(temp.charAt(i) == '+')
continue;
else
{
for(int k = 0; k <= i; k++)//flips pancake
{
if(temp.charAt(k) == '+')
x = temp.substring(0, k) + "-" + temp.substring(k+1);
else
x = temp.substring(0, k) + "+" + temp.substring(k+1);
//System.out.println(temp.substring(0, k)+ " " + temp.substring(k+1));
temp = x;
// System.out.println(temp);
}
}
result ++;
}
out.println("Case #" + caseNum + ": " + result);
caseNum++;
result = 0;
}
out.close();
}
}
| [
"liangyuding@sjtu.edu.cn"
] | liangyuding@sjtu.edu.cn |
d7e47d19a3fc2a25c153a4330c4a00df04df646b | 12e8f5460a8a25d5f431d6695cfdd9614af556f8 | /src/pl/projectspace/idea/plugins/php/phpspec/core/PhpSpecDescribedClass.java | ff1da7fe96f0eb2d6729e8a04b9d60c3610e9529 | [] | no_license | samrastin/phpstorm-phpspec | 6f32dad22d277aeb0bab6281bdf024234387a1a8 | a0f3b4de4149c0903f8f4d78a83b8cec431eed2e | refs/heads/master | 2021-01-14T12:35:32.536435 | 2016-01-07T18:11:43 | 2016-01-07T18:11:43 | 49,221,506 | 0 | 0 | null | 2016-01-07T18:08:59 | 2016-01-07T18:08:58 | Java | UTF-8 | Java | false | false | 1,288 | java | package pl.projectspace.idea.plugins.php.phpspec.core;
import com.jetbrains.php.lang.psi.elements.PhpClass;
import pl.projectspace.idea.plugins.commons.php.psi.element.PhpClassDecorator;
import pl.projectspace.idea.plugins.commons.php.psi.exceptions.MissingElementException;
import pl.projectspace.idea.plugins.php.phpspec.PhpSpecProject;
import pl.projectspace.idea.plugins.php.phpspec.core.services.PhpSpecLocator;
import pl.projectspace.idea.plugins.php.phpspec.core.services.PsiTreeUtils;
/**
* @author Michal Przytulski <michal@przytulski.pl>
*/
public class PhpSpecDescribedClass extends PhpSpecClassDecorator {
protected PhpSpecClass spec = null;
public PhpSpecDescribedClass(PhpClass phpClass) {
super(phpClass);
}
@Override
public boolean hasRelatedClass() {
try {
getSpec();
return true;
} catch (MissingElementException e) {
return false;
}
}
public PhpSpecClass getSpecClass() throws MissingElementException {
return getSpec();
}
protected PhpSpecClass getSpec() throws MissingElementException {
if (spec == null) {
spec = getService(PhpSpecLocator.class).locateSpecFor(getDecoratedObject());
}
return spec;
}
}
| [
"michal@przytulski.pl"
] | michal@przytulski.pl |
71c0bc02234f95d564bad4b60d59d7b7bba88d53 | 1d5523f7ed838c0b628b8f05a7c7b79b13f44dae | /surefire-integration-tests/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java | deb9296b5d9e761ad3b7185b94c8c51ca50eb347 | [] | no_license | atlassian/maven-surefire | 7afb81bb31581ab93b9c29f25c3707b190e634a2 | c033855a81a1412aefcc86ea4f212de15bec0e64 | refs/heads/trunk | 2023-08-24T07:59:39.795919 | 2020-05-10T21:14:05 | 2020-05-10T21:14:05 | 1,638,122 | 0 | 6 | null | 2023-04-04T01:40:59 | 2011-04-19T23:37:13 | Java | UTF-8 | Java | false | false | 212 | java | package forkMode;
import java.io.IOException;
import junit.framework.TestCase;
public class Test3
extends TestCase
{
public void test3() throws IOException {
Test1.dumpPidFile(this);
}
}
| [
"bentmann@apache.org"
] | bentmann@apache.org |
25c1ea17faaabfc3ce068b319d4161bdbf2dbcb5 | 5d180276957df094f09ee511e05786316537f25d | /src/main/java/aspectj/example02/HelloWorld.java | 2708e92391e3f0ab582c0bb7a0ff3366cdab8423 | [
"Apache-2.0"
] | permissive | SomberOfShadow/Local | f727189f1791de203f1efd5cd76b8f241857e473 | 474e71024f72af5adf65180e5468de19ad5fdfd8 | refs/heads/main | 2023-07-18T04:11:49.240683 | 2021-09-07T15:55:28 | 2021-09-07T15:55:28 | 389,494,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | package aspectj.example02;
public class HelloWorld implements HelloWorldInterface {
@Override
public void sayHello() {
System.out.println("Hello, World!");
}
}
| [
"hengtai.nie@ericsson.com"
] | hengtai.nie@ericsson.com |
c72a4883dbe253e7ce573e5d3a199d0a127d7a2c | 1506ae5c46a08f0d6dcd122251aeb3a3a149c8fb | /app/src/main/java/com/whoami/gcxhzz/until/ObjectUtils.java | 3afe9c1951bb0964d341ba4145a617881635859b | [] | no_license | newPersonKing/gcxhzz | b416e1d82a546a69146ebabaee3bd1876bc6b56c | 07d825efe05d63264908c7dae392bcb923733461 | refs/heads/master | 2020-04-22T19:18:48.522149 | 2019-08-30T00:41:16 | 2019-08-30T00:41:16 | 170,604,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,552 | java | package com.whoami.gcxhzz.until;
import java.util.List;
import java.util.Map;
/**
* 对象判断
* Created by Josn on 2017/11/10.
*/
public class ObjectUtils {
/**
* 判断字符串是否为空,
* @param obj
* @return
*/
public static final boolean isNull(Object obj) {
if(obj == null) return true;
String type = obj.getClass().getSimpleName();
switch (type) {
case "String":
String str = (String) obj;
if (str == null /*|| str.isEmpty()*/ || str.equals("null") || str.equals(""))
return true;
break;
case "List":
case "ArrayList":
case "LinkedList":
List list = (List) obj;
if (list == null /*|| list.isEmpty()*/)
return true;
break;
case "Map":
case "HashMap":
case "LinkedHashMap":
case "TreeMap":
Map map = (Map) obj;
if (map == null /*|| map.isEmpty()*/)
return true;
break;
default:
/**
* 在判断一次
*/
if (null == obj || "".equals(obj)||"null".equals(obj)||"".equals(obj.toString().trim())) {
return true;
}
break;
}
return false;
}
public static final boolean isNotNull(Object obj){
return !isNull(obj);
}
}
| [
"guoyong@emcc.net.com"
] | guoyong@emcc.net.com |
083cdbb321c687b962f0c14d6eac90b38d1a69ba | ff32a49b4691966aff0328181f500fcd4ba82366 | /src/com/wzx/entity/Account.java | b2e8cd85bd4ccc2fb6b0c9210135aa259418e693 | [] | no_license | WSGsety/BookStore | 703c0d438436f488604e051c45de8181ece80f9d | 7371a18fcbacf99a13ca00907efce58bcc1b4b95 | refs/heads/master | 2021-01-13T18:01:58.986060 | 2020-02-23T03:28:40 | 2020-02-23T03:28:40 | 242,449,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | package com.wzx.entity;
public class Account {
String userid;
String email;
String firstname;
String lastname;
String status;
String addr1;
String addr2;
String city;
String state;
String zip;
String country;
String phone;
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getAddr1() {
return addr1;
}
public void setAddr1(String addr1) {
this.addr1 = addr1;
}
public String getAddr2() {
return addr2;
}
public void setAddr2(String addr2) {
this.addr2 = addr2;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
| [
"8541152891@163.com"
] | 8541152891@163.com |
697205a324e444e702bba7fc83d989a36b0c9908 | dfb7ea27499fadfb14989be3601e10dc39608dcf | /web/src/main/java/com/hpd/butler/web/SysDictTypeController.java | 3e10c9a2c7d4ffb2b38253bbeceebcf43e2409d2 | [] | no_license | monkekey/monkekey | 2314106881e9a62c1289c7606f78ec2779ab2b29 | 85515f013e54682acddcf6803fd8955d5047a59a | refs/heads/master | 2020-03-14T00:41:43.488385 | 2018-05-17T03:59:54 | 2018-05-17T03:59:54 | 131,362,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,915 | java | package com.hpd.butler.web;
import com.hpd.butler.common.RequestResult;
import com.hpd.butler.constant.CommonFlag;
import com.hpd.butler.domain.ISCategoryRepository;
import com.hpd.butler.domain.SCategory;
import com.hpd.butler.utils.HeaderUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* Created by zy on 2018/2/6.
*/
@RestController
@RequestMapping("/sys/dicttype")
@Api(value = "SysDictTypeController", description = "字典类型相关接口")
public class SysDictTypeController {
@Autowired
private ISCategoryRepository isCategoryRepository;
@ApiOperation(value = "SysDictType|列表")
@GetMapping("")
public RequestResult getAll(@RequestParam(value = "pageIdx", required = false, defaultValue = "0") Integer pageIdx,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
@RequestParam(value = "keywords") String keywords){
PageRequest pageRequest= new PageRequest(pageIdx, pageSize, Sort.Direction.ASC, "id");
Page<SCategory> sCategoryPage = null;
if(keywords != null && !keywords.equals("")){
sCategoryPage = isCategoryRepository.findByCategoryNameContainingAndFlag(keywords,pageRequest,CommonFlag.VALID.getValue());
}else{
sCategoryPage = isCategoryRepository.findByFlag(pageRequest, CommonFlag.VALID.getValue());
}
return RequestResult.success(sCategoryPage);
}
@ApiOperation(value = "All SysDictType|列表")
@GetMapping("/all")
public RequestResult getAllDictType(){
return RequestResult.success(isCategoryRepository.findByFlag(CommonFlag.VALID.getValue()));
}
@ApiOperation(value = "SysDictType|详情")
@GetMapping("/{dtid}")
public RequestResult getDictType(@NotNull @PathVariable("dtid") long dtid) {
SCategory sCategory = isCategoryRepository.findOne(dtid);
if(null == sCategory){
return RequestResult.fail("无法获取记录");
}
return RequestResult.success(sCategory);
}
@ApiOperation(value = "新增|SysDictType")
@PostMapping("")
@Transactional
public RequestResult add(@RequestBody SCategory sCategory){
//Authorization:Bearer + " " + token
sCategory.setCategoryCode("CG"+new Date().getTime());
sCategory.setCategoryCrateby(HeaderUtils.getCurrentUser());
sCategory.setCategoryCratetime(new Date());
sCategory.setCategoryLastby(HeaderUtils.getCurrentUser());
sCategory.setCategoryLasttime(new Date());
sCategory.setFlag(CommonFlag.VALID.getValue());
sCategory = isCategoryRepository.saveAndFlush(sCategory);
return RequestResult.success(sCategory);
}
@ApiOperation(value = "更新|SysDictType")
@RequestMapping(value = "/{sdtid}", method = RequestMethod.PUT)
@Modifying
@Transactional
public RequestResult update(@PathVariable("sdtid") long sdtid,
@RequestBody SCategory sysDictType){
SCategory old_sCategory = isCategoryRepository.findOne(sdtid);
if(null == old_sCategory){
return RequestResult.fail("无法获取记录");
}
old_sCategory.setCategoryName(sysDictType.getCategoryName());
old_sCategory.setCategoryIsFixed(sysDictType.getCategoryIsFixed());
old_sCategory.setCategoryLastby(HeaderUtils.getCurrentUser());
old_sCategory.setCategoryLasttime(new Date());
old_sCategory = isCategoryRepository.saveAndFlush(old_sCategory);
return RequestResult.success(old_sCategory);
}
@ApiOperation(value = "删除|SysDictType")
@DeleteMapping("")
public RequestResult delete(@RequestHeader("Authorization") String Authorization,
@RequestParam(value = "id", required = true) long sdtid) {
SCategory sCategory = isCategoryRepository.findOne(sdtid);
if(null == sCategory){
return RequestResult.fail("无法获取记录");
}
if(sCategory.getCategoryIsFixed() == CommonFlag.VALID.getValue()){
return RequestResult.fail("系统默认,不可删除");
}
//sysDictTypeRepository.delete(sysDictType);
sCategory.setFlag(CommonFlag.DELETED.getValue());
isCategoryRepository.saveAndFlush(sCategory);
return RequestResult.success("ok");
}
}
| [
"dn27@iyumi.com"
] | dn27@iyumi.com |
1b031f8af04bd95e08f6b9261435befa55755660 | 2f2cb1d3d1012a082aa83ad893d1e596701002c7 | /src/main/java/guiframe/LoadFrame.java | c924da3ea412b38c1ce3af5297d823b42f9bea52 | [] | no_license | PhilipBao/record-manager | 263d124e05829d396064ba8680083738583eec28 | d00ebc8d078136140f6f0a6ccbadc3c258bfb013 | refs/heads/master | 2021-05-29T18:18:46.422030 | 2015-01-14T22:01:35 | 2015-01-14T22:01:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,727 | java | package guiframe;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class LoadFrame extends JDialog implements ActionListener {
private static final long serialVersionUID = 7157883588675034571L;
private static final int WIDTH = 190;
private static final int HEIGHT = 120;
private static final String TYPE = "wwj";
private final String HOMEPATH = "D:/";
boolean ok = false;
private JLabel fileName;
String name = "";
int nameInd = 0;
JButton loadButton = new JButton("Load!");
JButton cancelButton = new JButton("Cancel");
String[] nameInd0;
JComboBox <String> nameIndAcc;
public LoadFrame(Frame owner, int lastNameInd) {
super(owner,"Load",true);
setSize(WIDTH,HEIGHT);
setResizable(false);
setLayout(new BorderLayout());
setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2
- WIDTH / 2, Toolkit.getDefaultToolkit()
.getScreenSize().height
/ 2 - HEIGHT / 2); //set the frame in the middle of the screen
initiallize(lastNameInd);
nameIndAcc = new JComboBox<String>(nameInd0);
fileName = new JLabel("");
fileName.setBounds(60, 140, 300, 20);
loadButton.setActionCommand("load");
cancelButton.setActionCommand("cancel");
JPanel fileNameInput = new JPanel(new FlowLayout());
fileNameInput.add(new JLabel("Please choose a file "));
fileNameInput.add(nameIndAcc);
add(fileNameInput, BorderLayout.NORTH);
JPanel display = new JPanel(new FlowLayout());
display.add(new JLabel("The file you choose is "));
fileName.setText(" ");
display.add(fileName);
add(display, BorderLayout.CENTER);
JPanel button = new JPanel(new GridLayout(1, 2));
button.add(loadButton);
button.add(cancelButton);
add(button, BorderLayout.SOUTH);
nameIndAcc.addActionListener(this);
loadButton.addActionListener(this);
cancelButton.addActionListener(this);
loadButton.setEnabled(false);
setVisible(true);
}
private void initiallize(int max) {
nameInd0 = new String[max+2];
for(int i=1; i<=max+1; i++){
int value = i-1;
nameInd0[i] = "" + value;
}
nameInd0[0] = "";
}
public int getValue() {
return nameInd;
}
public boolean getState() {
return ok;
}
public void actionPerformed(ActionEvent e) {
String temp = (String)nameIndAcc.getSelectedItem();
if(temp.compareTo("")==0)
loadButton.setEnabled(false);
else {
loadButton.setEnabled(true);
nameInd = Integer.valueOf(temp).intValue();
try{
File file = new File(HOMEPATH+"david/out"+nameInd+"."+TYPE);
System.out.println(nameInd);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line = null;
while((line = bufferedReader.readLine())!= null ){
// \\s+ means any number of whitespaces between tokens
String [] tokens = line.split("\\s+");
if(tokens[0].compareTo("Name")==0) {
name = line.substring(5);
}
}
bufferedReader.close();
} catch (Exception ex){}
fileName.setText(name);
}
String cmd = e.getActionCommand();
if(cmd.equals("load")) {
ok = true;
setVisible(false);
System.out.println("load");
return;
}
if(cmd.equals("cancel")) {
ok = false;
setVisible(false);
System.out.println("cancel");
return;
}
}
public static void main(String[] args) {
@SuppressWarnings("unused")
LoadFrame loadFrame = new LoadFrame(null, 8);
}
}
| [
"w268wang@gmail.com"
] | w268wang@gmail.com |
5f08b63fdec0125af2ed070fe80919b9fb0baa15 | bdc1d2a153a097235a56580ce4577ace43c046e2 | /nirvana/nirvana.ccard.bill.rest/src/main/java/com/caiyi/financial/nirvana/bill/util/mail/TencentMail.java | 90d6e8cc3959dc100c3ac7fc37345191ebb3d6db | [] | no_license | gahaitao177/CompanyProject | 8ffb6da0edb994d49e3bfb7367e68b85194186ba | caca31a321b1a0729ee2897cea3ec1a5ea1322af | refs/heads/master | 2021-01-21T09:49:52.006332 | 2017-08-10T07:37:08 | 2017-08-10T07:37:08 | 91,668,269 | 2 | 6 | null | null | null | null | UTF-8 | Java | false | false | 16,431 | java | package com.caiyi.financial.nirvana.bill.util.mail;
import com.caiyi.financial.nirvana.bill.util.BankHelper;
import com.caiyi.financial.nirvana.ccard.bill.bean.Channel;
import com.caiyi.financial.nirvana.core.util.CheckUtil;
import com.hsk.cardUtil.HpClientUtil;
import org.apache.http.client.CookieStore;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.json.JSONObject;
import org.slf4j.Logger;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Created by lichuanshun on 16/7/13.
* 腾讯邮箱登录相关
*/
public class TencentMail extends BaseMail{
/**
*
* @param bean
* @return
*/
public static int login(Channel bean,Logger logger) {
String mailaddress=bean.getLoginname();
CloseableHttpClient httpclient = HttpClients.createDefault();
CookieStore cookieStore = new BasicCookieStore();
HttpContext localContext = new BasicHttpContext();
// 设置请求和传输超时时间
RequestConfig.custom().setConnectTimeout(20000);
RequestConfig.custom().setSocketTimeout(20000);
RequestConfig.custom().setConnectionRequestTimeout(20000);
RequestConfig requestConfig = RequestConfig.custom().build();
Map<String, String> requestHeaderMap=new HashMap<String, String>();
requestHeaderMap.put("Accept-Encoding", "gzip, deflate, sdch");
requestHeaderMap.put("Accept-Language", "zh-CN,zh;q=0.8");
requestHeaderMap.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1");
requestHeaderMap.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
requestHeaderMap.put("Connection", "Keep-Alive");
// add by lcs 20160216
if (!CheckUtil.isNullString(bean.getIpAddr())){
requestHeaderMap.put("X-Forwarded-For", bean.getIpAddr());
}
localContext.setAttribute("http.cookie-store", cookieStore);
String url="";
String errorContent="";
//load首页链接的地址
/*url="https://w.mail.qq.com/cgi-bin/loginpage?f=xhtml&kvclick="+URLEncoder.encode("loginpage|app_push|enter|ios", "utf-8")+"&&ad=false&f=xhtml&kvclick=loginpage%7Capp_push%7Center%7Cios%26ad%3Dfalse&s=session_timeout&f=xhtml&autologin=n&uin=&aliastype=&from=&tiptype=";
errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8", false , requestConfig);
System.out.println(errorContent);
if (!CheckUtil.isNullString(errorContent)) {
return;
}*/
url="https://ui.ptlogin2.qq.com/cgi-bin/login?style=9&appid=522005705&daid=4&s_url=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%26delegate_url%3D%26f%3Dxhtml%26target%3D&hln_css=http%3A%2F%2Fmail.qq.com%2Fzh_CN%2Fhtmledition%2Fimages%2Flogo%2Fqqmail%2Fqqmail_logo_default_200h.png&low_login=1&hln_autologin=%E8%AE%B0%E4%BD%8F%E7%99%BB%E5%BD%95%E7%8A%B6%E6%80%81&pt_no_onekey=1";
errorContent= HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig);
url="https://ssl.ptlogin2.qq.com/check?pt_tea=1&uin="+mailaddress+"&appid=522005705&ptlang=2052&r="+Math.random();
errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig);
// 正确格式 ptui_checkVC('0','!LAW','\x00\x00\x00\x00\x13\xb6\xcb\xd9','3df476d7145c143ff34d20cc5cbf4681346df9b88315ecde935267a395182964fdb93effe66ad368e059171453f37126f6480c7999c0ec97','0');
if (!errorContent.contains("ptui_checkVC")||!errorContent.contains("(")||!errorContent.contains(")")) {
bean.setBusiErrCode(0);
bean.setBusiErrDesc("邮箱登录失败,请稍后再试或联系客服询问");
logger.info(bean.getCuserId()+ " 接口参数格式不正确 ptui_checkVC="+errorContent);
return 0;
}
String ptui_checkVC=errorContent.substring(errorContent.indexOf("(")+1, errorContent.indexOf(")")).replaceAll("'", "");
String [] prs=ptui_checkVC.split(",");
if (prs.length!=5) {
bean.setBusiErrCode(0);
bean.setBusiErrDesc("邮箱登录失败,请稍后再试或联系客服询问");
logger.info(bean.getCuserId()+ " 接口参数格式不正确 ptui_checkVC="+errorContent);
return 0;
}
String pcode=prs[0];
cc.set(bean.getCuserId()+"QQMailCookie"+mailaddress, cookieStore, 1000*60*30);
logger.info(bean.getCuserId()+"QQMailCookie"+mailaddress,cookieStore);
if ("0".equals(pcode)) {//正常登录
bean.setBankSessionId(ptui_checkVC);
bean.setBusiErrCode(1);
}else if ("1".equals(pcode)) {//异地登录
cc.set(bean.getCuserId()+"QQMailPtui_checkVC"+mailaddress, ptui_checkVC, 1000*60*30);
bean.setBusiErrCode(3);
bean.setBusiErrDesc("异地登录需要验证码");
bean.setCurrency(getVerifyCode(bean,logger));
logger.info(bean.getCuserId()+ " 异地登录 ptui_checkVC["+errorContent+"] mailaddress["+mailaddress+"]");
return 0;
}else {
bean.setBusiErrCode(0);
bean.setBusiErrDesc("帐号格式不正确,请检查");
return 0;
}
return 1;
}
/**
* 获取验证码
* @param bean
* @param logger
* @return
* @throws IOException
*/
public static String getVerifyCode(Channel bean,Logger logger){
BufferedImage localBufferedImage=null;
String mailaddress=bean.getLoginname();
String base64Str = null;
String url="";
String errorContent="";
try {
Object object=cc.get(bean.getCuserId()+"QQMailCookie"+mailaddress);
Object object2=cc.get(bean.getCuserId()+"QQMailPtui_checkVC"+mailaddress);
logger.info("getQQEmailVcode" + bean.getCuserId()+"QQMailCookie"+mailaddress);
if (object==null||object2==null) {
// bean.setBusiErrCode(0);
// bean.setBusiErrDesc("请求已失效请重新操作");
return null;
}
CookieStore cookieStore=(CookieStore) object;
String ptui_checkVC=String.valueOf(object2);
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpContext localContext = new BasicHttpContext();
// 设置请求和传输超时时间
RequestConfig.custom().setConnectTimeout(20000);
RequestConfig.custom().setSocketTimeout(20000);
RequestConfig.custom().setConnectionRequestTimeout(20000);
RequestConfig requestConfig = RequestConfig.custom().build();
Map<String, String> requestHeaderMap=new HashMap<String, String>();
requestHeaderMap.put("Accept-Encoding", "gzip, deflate, sdch");
requestHeaderMap.put("Accept-Language", "zh-CN,zh;q=0.8");
requestHeaderMap.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1");
requestHeaderMap.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
requestHeaderMap.put("Connection", "Keep-Alive");
localContext.setAttribute("http.cookie-store", cookieStore);
String [] prs=ptui_checkVC.split(",");
String verifycode=prs[1];
// update by lcs 20161122 接口修改 start
// url="https://ssl.captcha.qq.com/cap_union_show?captype=3&lang=2052&aid=522005705&uin="+mailaddress+"&cap_cd="+verifycode+"&pt_style=9&v="+Math.random();
url = "https://ssl.captcha.qq.com/cap_union_show_new?aid=522005705&captype=&protocol=https&clientype=1" +
"&disturblevel=&apptype=2&noheader=0&uin=" + mailaddress + "&color=&" +
"cap_cd=" + verifycode + "&rnd=" + Math.random();
errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig);
// update by lcs 20161122 接口修改 end
// add test by lcs 20160704
cc.add("testqqvcode" + bean.getCuserId(), errorContent,3600000);
if (!errorContent.contains("g_click_cap_sig")||!errorContent.contains("g_cap_postmsg_seq")) {
// bean.setBusiErrCode(0);
// bean.setBusiErrDesc("邮箱登录失败,请稍后再试或联系客服询问!");
logger.info(bean.getCuserId()+ " 接口参数格式不正确 g_click_cap_sig="+errorContent);
return null;
}
// update by lcs 20160704 获取sig 方式修改 start
// String vsig=errorContent.substring(errorContent.indexOf("g_click_cap_sig"),errorContent.indexOf("g_cap_postmsg_seq"));
// String vsig=errorContent.substring(errorContent.indexOf("var g_click_cap_sig=\"") + "var g_click_cap_sig=\"".length(),errorContent.indexOf("\",g_cap_postmsg_seq=1,"));
// vsig=vsig.substring(vsig.indexOf("\"")+1, vsig.lastIndexOf("\""));
// logger.info(bean.getCuserId()+" 获取到接口访问参数vsig["+vsig+"]");
// update by lcs 20160704 获取sig 方式修改 end
// url="https://ssl.captcha.qq.com/getQueSig?aid=522005705&uin="+mailaddress+"&captype=48&sig="+vsig+"*&"+Math.random();
// errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig);
//
// String mgsig=errorContent.substring(errorContent.indexOf("cap_getCapBySig"),errorContent.lastIndexOf("\""));
// mgsig=mgsig.substring(mgsig.indexOf("\"")+1);
// String mgsig = vsig;
String mgsig = getSigFromHtml(errorContent, bean.getCuserId(),logger);
logger.info(bean.getCuserId()+" 获取到接口访问参数mgsig["+mgsig+"]");
if (CheckUtil.isNullString(mgsig)){
// bean.setBusiErrCode(0);
// bean.setBusiErrDesc("获取图片验证码失败");
return null;
}
url="https://ssl.captcha.qq.com/getimgbysig?aid=522005705&uin="+mailaddress+"&sig="+mgsig;
localBufferedImage=HpClientUtil.getRandomImageOfJPEG(url, requestHeaderMap, httpclient, localContext, requestConfig);
cc.set(bean.getCuserId()+"QQMailCookie"+mailaddress, cookieStore, 1000*60*30);
cc.set(bean.getCuserId()+"QQMailPtui_checkVC"+mailaddress, ptui_checkVC);
cc.set(bean.getCuserId()+"QQMailmgsig"+mailaddress, mgsig);
base64Str = BankHelper.GetImageBase64(localBufferedImage,"jpeg");
} catch (Exception e) {
logger.error(bean.getCuserId()+" getQQEmailVcode异常 errorContent["+errorContent+"]", e);
// bean.setBusiErrCode(0);
base64Str = null;
}
if (CheckUtil.isNullString(base64Str)){
bean.setBusiErrCode(0);
bean.setBusiErrDesc("获取验证码失败");
}
return base64Str;
}
//
private static String getSigFromHtml(String htmlContent,String cuserid,Logger logger){
String sig = "";
try{
int indexOne = htmlContent.indexOf("var g_click_cap_sig=\"") + "var g_click_cap_sig=\"".length();
int index2 = htmlContent.indexOf("g_cap_postmsg_seq=1,");
logger.info("index1=" + indexOne + ",index2:" + index2);
sig = htmlContent.substring(indexOne,index2).replace("\",", "");
}catch(Exception e){
e.printStackTrace();
logger.error(cuserid+" getQQEmailVcodegetSigFromHtml异常 errorContent", e);
}
return sig;
}
public static int checkEmailCode(Channel bean,Logger logger){
String mailaddress=bean.getLoginname();
String url="";
String errorContent="";
try {
if (CheckUtil.isNullString(bean.getCode())) {
bean.setBusiErrCode(0);
bean.setBusiErrDesc("验证码不能为空");
return 0;
}
Object object=cc.get(bean.getCuserId()+"QQMailCookie"+mailaddress);
Object object2=cc.get(bean.getCuserId()+"QQMailPtui_checkVC"+mailaddress);
Object object3=cc.get(bean.getCuserId()+"QQMailmgsig"+mailaddress);
if (object==null||object2==null||object3==null) {
bean.setBusiErrCode(0);
bean.setBusiErrDesc("请求已失效请重新操作");
return 0;
}
CookieStore cookieStore=(CookieStore) object;
String ptui_checkVC=String.valueOf(object2);
String mgsig=String.valueOf(object3);
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpContext localContext = new BasicHttpContext();
// 设置请求和传输超时时间
RequestConfig.custom().setConnectTimeout(20000);
RequestConfig.custom().setSocketTimeout(20000);
RequestConfig.custom().setConnectionRequestTimeout(20000);
RequestConfig requestConfig = RequestConfig.custom().build();
Map<String, String> requestHeaderMap=new HashMap<String, String>();
requestHeaderMap.put("Accept-Encoding", "gzip, deflate, sdch");
requestHeaderMap.put("Accept-Language", "zh-CN,zh;q=0.8");
requestHeaderMap.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1");
requestHeaderMap.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
requestHeaderMap.put("Connection", "Keep-Alive");
// add by lcs 20160216
if (!CheckUtil.isNullString(bean.getIpAddr())){
requestHeaderMap.put("X-Forwarded-For", bean.getIpAddr());
}
localContext.setAttribute("http.cookie-store", cookieStore);
String [] prs=ptui_checkVC.split(",");
String pcode=prs[0];
String verifycode=prs[1];
String randstr=verifycode;
String st=prs[2];
String sig=prs[3];
String rcode=prs[4];
url="https://ssl.captcha.qq.com/cap_union_verify?aid=522005705&uin="+mailaddress+"&captype=48&ans="+bean.getCode()+"&sig="+mgsig+"&"+Math.random();
errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig);
// add by lcs 20160414 增加异常日志 测试消除后删除
if (CheckUtil.isNullString(errorContent)){
logger.info("templog" + bean.getCuserId() + "," + mailaddress + "," + bean.getMailPwd() + "," + bean.getCode());
bean.setBusiErrCode(0);
bean.setBusiErrDesc("远程服务器异常,请重试");
return 0;
}
String json=errorContent.substring(errorContent.indexOf("(")+1, errorContent.lastIndexOf(")"));
JSONObject jsonOBJ=new JSONObject(json);
randstr=String.valueOf(jsonOBJ.get("randstr"));
sig=String.valueOf(jsonOBJ.get("sig"));
rcode=String.valueOf(jsonOBJ.get("rcode"));
if (!"0".equals(rcode)) {
bean.setBusiErrCode(3);
bean.setBusiErrDesc("验证码错误,请重试");
bean.setCurrency(getVerifyCode(bean,logger));
logger.info(bean.getCuserId()+" 验证码错误,请重试["+errorContent+"]");
return 0;
}
cc.set(bean.getCuserId()+"QQMailCookie"+mailaddress, cookieStore, 1000*60*30);
bean.setBankSessionId(pcode+","+randstr+","+st+","+sig+","+rcode);
return 1;
} catch (Exception e) {
logger.error(bean.getCuserId()+" checkQQEmailCode异常 errorContent["+errorContent+"]", e);
}
return 0;
}
}
| [
"877610282@qq.com"
] | 877610282@qq.com |
e407b468ac65916fe46cf0e37c84069a3925d8b7 | 1b242dedbe39f775cd9345ff8469c36af3fed727 | /src/main/java/fluffybunny/malbunny/entity/UserRole.java | c6c3e834bf8b93f24dae0852432746f8b47ef921 | [] | no_license | Fircoal/animebunny | af28c0e327e4a22b2606f32595afa2a2c96f0d98 | 426dba438ed0688e5769b993d20156b3a99e7ee8 | refs/heads/master | 2020-03-21T11:48:35.038718 | 2018-06-25T02:10:57 | 2018-06-25T02:10:57 | 138,522,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package fluffybunny.malbunny.entity;
import static javax.persistence.GenerationType.IDENTITY;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "UserRole")
public class UserRole implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Integer userId;
private String role;
public Integer getUserId() {
return this.userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getRole() {
return this.role;
}
public void setRole(String role) {
this.role = role;
}
} | [
"Fircoal@gmail.com"
] | Fircoal@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.